From eac7734f07ff7c4f77284fa17ab473eb2b0e0c76 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 6 Jan 2021 16:15:01 +0800 Subject: [PATCH] feat: align number columns text to right --- packages/app/src/components/views/Field/style.less | 5 +++++ packages/app/src/components/views/SortableTable/index.tsx | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/views/Field/style.less b/packages/app/src/components/views/Field/style.less index bb8f269f2..d86ade22e 100644 --- a/packages/app/src/components/views/Field/style.less +++ b/packages/app/src/components/views/Field/style.less @@ -32,4 +32,9 @@ > *:last-child { margin-bottom: 0; } +} + +.ant-table-cell.noco-field-percent, +.ant-table-cell.noco-field-number { + text-align: right; } \ No newline at end of file diff --git a/packages/app/src/components/views/SortableTable/index.tsx b/packages/app/src/components/views/SortableTable/index.tsx index 105b24f45..472f769bf 100644 --- a/packages/app/src/components/views/SortableTable/index.tsx +++ b/packages/app/src/components/views/SortableTable/index.tsx @@ -7,6 +7,7 @@ import findIndex from 'lodash/findIndex'; import get from 'lodash/get'; import './style.less'; import Field from '../Field'; +import cloneDeep from 'lodash/cloneDeep'; export const SortableItem = sortableElement(props => ); export const SortableContainer = sortableContainer(props => ); @@ -57,8 +58,10 @@ export const components = ({data = {}, rowKey, mutate, onMoved}: Props) => { }; export function fields2columns(fields) { - const columns: any[] = fields.map(field => { + const columns: any[] = fields.map(item => { + const field = cloneDeep(item); field.render = (value) => field.interface === 'sort' ? : ; + field.className = `${field.className||''} noco-field-${field.interface}`; return { ...field, ...(field.component||{}),