es-grid-template 1.3.7 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/index.css +6 -12
- package/assets/index.scss +11 -7
- package/es/grid-component/EditableCell.js +12 -11
- package/es/grid-component/TableGrid.js +12 -9
- package/es/grid-component/hooks/columns/index.d.ts +1 -1
- package/es/grid-component/hooks/columns/index.js +14 -13
- package/es/grid-component/hooks/useColumns.js +6 -5
- package/es/grid-component/hooks/utils.d.ts +7 -4
- package/es/grid-component/hooks/utils.js +57 -26
- package/es/grid-component/styles.scss +11 -7
- package/es/grid-component/table/GridEdit.js +88 -213
- package/es/grid-component/type.d.ts +4 -4
- package/lib/grid-component/EditableCell.js +12 -11
- package/lib/grid-component/TableGrid.js +12 -9
- package/lib/grid-component/hooks/columns/index.d.ts +1 -1
- package/lib/grid-component/hooks/columns/index.js +14 -13
- package/lib/grid-component/hooks/useColumns.js +6 -5
- package/lib/grid-component/hooks/utils.d.ts +7 -4
- package/lib/grid-component/hooks/utils.js +63 -29
- package/lib/grid-component/styles.scss +11 -7
- package/lib/grid-component/table/GridEdit.js +87 -213
- package/lib/grid-component/type.d.ts +4 -4
- package/package.json +109 -109
package/assets/index.css
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
background-color: #f0f0f0;
|
|
57
57
|
}
|
|
58
58
|
.ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell.selected {
|
|
59
|
-
background-color: #
|
|
59
|
+
background-color: #F3F8FF !important;
|
|
60
60
|
}
|
|
61
61
|
.ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell .ui-rc-table-cell-content {
|
|
62
62
|
line-height: 22px;
|
|
@@ -217,11 +217,11 @@
|
|
|
217
217
|
left: 8px;
|
|
218
218
|
}
|
|
219
219
|
.ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.rc-ui-cell-index.focus {
|
|
220
|
-
background-color: #
|
|
220
|
+
background-color: #E6EFFD;
|
|
221
221
|
font-weight: 500;
|
|
222
222
|
}
|
|
223
223
|
.ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.rc-ui-cell-index.selected {
|
|
224
|
-
background-color: #
|
|
224
|
+
background-color: #1869E6 !important;
|
|
225
225
|
color: #fff;
|
|
226
226
|
}
|
|
227
227
|
.ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-border-top {
|
|
@@ -319,21 +319,15 @@
|
|
|
319
319
|
right: -3px;
|
|
320
320
|
}
|
|
321
321
|
.ui-rc-table-wrapper.grid-editable .ui-rc_cell-content.selected {
|
|
322
|
-
background-color: #
|
|
322
|
+
background-color: #F3F8FF;
|
|
323
323
|
}
|
|
324
324
|
.ui-rc-table-wrapper.grid-editable .ui-rc_cell-content--index.focus {
|
|
325
|
-
background-color: #
|
|
325
|
+
background-color: #E6EFFD;
|
|
326
326
|
}
|
|
327
327
|
.ui-rc-table-wrapper.grid-editable .ui-rc_cell-content--index.selected {
|
|
328
|
-
background-color: #
|
|
328
|
+
background-color: #1869E6;
|
|
329
329
|
color: #fff;
|
|
330
330
|
}
|
|
331
|
-
.ui-rc-table-wrapper.grid-editable .ui-rc-table-tbody .ui-rc-table-row.ui-rc-table-row-selected > .ui-rc-table-cell {
|
|
332
|
-
background: #FEF2EF;
|
|
333
|
-
}
|
|
334
|
-
.ui-rc-table-wrapper.grid-editable .ui-rc-table-tbody .ui-rc-table-row > .ui-rc-table-cell.ui-rc-table-cell-row-hover {
|
|
335
|
-
background: #FBDED6;
|
|
336
|
-
}
|
|
337
331
|
.ui-rc-table-wrapper.grid-editable .ui-rc-table-tbody .ui-rc-table-row .ui-rc-table-cell .ui-rc-table-row-indent {
|
|
338
332
|
position: absolute;
|
|
339
333
|
}
|
package/assets/index.scss
CHANGED
|
@@ -5,13 +5,17 @@ $rowHoverBg: #FBDED6 !default;
|
|
|
5
5
|
$rowSelectedBg: #FEF2EF !default;
|
|
6
6
|
//$tableBorderColor: red !default;
|
|
7
7
|
$tableBorderColor: #e0e0e0 !default;
|
|
8
|
+
//$tableBorderColor: #C4C4C4 !default;
|
|
8
9
|
//$tableBorderColor: #f0f0f0 !default;
|
|
9
10
|
$border-radius: 6px !default;
|
|
10
11
|
$border-selected-color: #0550C5 !default;
|
|
11
12
|
$body-color: #ffffff !default;
|
|
12
|
-
|
|
13
|
-
$cell-
|
|
14
|
-
|
|
13
|
+
//$cell-selected-bg: #E6EFFD !default;
|
|
14
|
+
$cell-selected-bg: #F3F8FF !default;
|
|
15
|
+
//$cell-index-selected-bg: #0550C5 !default;
|
|
16
|
+
$cell-index-selected-bg: #1869E6 !default;
|
|
17
|
+
//$cell-index-focus-bg: #CEDBEF !default;
|
|
18
|
+
$cell-index-focus-bg: #E6EFFD !default;
|
|
15
19
|
$rowSelectedHoverBg: 'ui-rc' !default;
|
|
16
20
|
$boxShadowColor: rgba(5, 5, 5, 0.09) !default;
|
|
17
21
|
$fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
@@ -155,7 +159,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
155
159
|
|
|
156
160
|
&.selected {
|
|
157
161
|
//background: red;
|
|
158
|
-
background-color: $cell-selected-bg;
|
|
162
|
+
background-color: $cell-selected-bg !important;
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
.ui-rc-table-cell-content {
|
|
@@ -425,7 +429,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
425
429
|
font-weight: 500;
|
|
426
430
|
}
|
|
427
431
|
&.selected {
|
|
428
|
-
background-color: $cell-index-selected-bg;
|
|
432
|
+
background-color: $cell-index-selected-bg !important;
|
|
429
433
|
color: #fff;
|
|
430
434
|
//font-weight: 500;
|
|
431
435
|
}
|
|
@@ -695,12 +699,12 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
695
699
|
.#{$prefix}-table-row {
|
|
696
700
|
&.#{$prefix}-table-row-selected {
|
|
697
701
|
>.#{$prefix}-table-cell {
|
|
698
|
-
background: #FEF2EF;
|
|
702
|
+
//background: #FEF2EF;
|
|
699
703
|
}
|
|
700
704
|
}
|
|
701
705
|
>.#{$prefix}-table-cell {
|
|
702
706
|
&.#{$prefix}-table-cell-row-hover {
|
|
703
|
-
background: #FBDED6;
|
|
707
|
+
//background: #FBDED6;
|
|
704
708
|
}
|
|
705
709
|
}
|
|
706
710
|
|
|
@@ -62,8 +62,9 @@ const EditableCell = props => {
|
|
|
62
62
|
const dateTimePickerRef = React.useRef(null);
|
|
63
63
|
// const timePickerRef = React.useRef(null);
|
|
64
64
|
|
|
65
|
+
const cellFormat = column?.format ? typeof column?.format === 'function' ? column?.format?.(record) : column?.format : format;
|
|
65
66
|
const inputNode = (value, onChange) => {
|
|
66
|
-
const dateFormat = getDatepickerFormat(editType,
|
|
67
|
+
const dateFormat = getDatepickerFormat(editType, cellFormat);
|
|
67
68
|
const date = !isEmpty(value) ? convertDateToDayjs(new Date(value), dateFormat) : null;
|
|
68
69
|
const maxDate = convertDateToDayjs(column.maxDate, dateFormat) ?? undefined;
|
|
69
70
|
const minDate = convertDateToDayjs(column.minDate, dateFormat) ?? undefined;
|
|
@@ -205,7 +206,7 @@ const EditableCell = props => {
|
|
|
205
206
|
case 'month':
|
|
206
207
|
case 'quarter':
|
|
207
208
|
case 'year':
|
|
208
|
-
const pickerFormat = getDatepickerFormat(editType,
|
|
209
|
+
const pickerFormat = getDatepickerFormat(editType, cellFormat);
|
|
209
210
|
const maxDateValue1 = !isEmpty(column.maxDate) ? dayjs(column.maxDate, pickerFormat) : undefined;
|
|
210
211
|
const minDateValue1 = !isEmpty(column.minDate) ? dayjs(column.minDate, pickerFormat) : undefined;
|
|
211
212
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
@@ -226,7 +227,7 @@ const EditableCell = props => {
|
|
|
226
227
|
popupClassName: 'be-popup-container'
|
|
227
228
|
});
|
|
228
229
|
case 'week':
|
|
229
|
-
const weekFormat = getDatepickerFormat(editType,
|
|
230
|
+
const weekFormat = getDatepickerFormat(editType, cellFormat);
|
|
230
231
|
const maxWeekValue = !isEmpty(column.maxDate) ? dayjs(column.maxDate, weekFormat) : undefined;
|
|
231
232
|
const minWeekValue = !isEmpty(column.minDate) ? dayjs(column.minDate, weekFormat) : undefined;
|
|
232
233
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
@@ -243,7 +244,7 @@ const EditableCell = props => {
|
|
|
243
244
|
popupClassName: 'be-popup-container'
|
|
244
245
|
});
|
|
245
246
|
case 'time':
|
|
246
|
-
const timeFormat = getDatepickerFormat(editType,
|
|
247
|
+
const timeFormat = getDatepickerFormat(editType, cellFormat);
|
|
247
248
|
const maxTimeValue = !isEmpty(column.maxTime) ? dayjs(column.maxTime).format(timeFormat) : null;
|
|
248
249
|
const minTimeValue = !isEmpty(column.minTime) ? dayjs(column.minTime).format(timeFormat) : null;
|
|
249
250
|
|
|
@@ -758,8 +759,8 @@ const EditableCell = props => {
|
|
|
758
759
|
// )
|
|
759
760
|
|
|
760
761
|
case 'numeric':
|
|
761
|
-
const thousandSeparator =
|
|
762
|
-
const decimalSeparator =
|
|
762
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
763
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
763
764
|
|
|
764
765
|
// let floatValue = value
|
|
765
766
|
|
|
@@ -767,11 +768,11 @@ const EditableCell = props => {
|
|
|
767
768
|
value,
|
|
768
769
|
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
769
770
|
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
770
|
-
decimalScale:
|
|
771
|
-
fixedDecimalScale:
|
|
772
|
-
allowNegative:
|
|
773
|
-
prefix:
|
|
774
|
-
suffix:
|
|
771
|
+
decimalScale: cellFormat?.decimalScale ?? undefined,
|
|
772
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false,
|
|
773
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
774
|
+
prefix: cellFormat?.prefix ?? undefined,
|
|
775
|
+
suffix: cellFormat?.suffix ?? undefined
|
|
775
776
|
};
|
|
776
777
|
return /*#__PURE__*/React.createElement(NumericFormat, _extends({
|
|
777
778
|
id: `col${indexCol}-record${indexRow}`
|
|
@@ -408,8 +408,8 @@ const TableGrid = props => {
|
|
|
408
408
|
hideSelectAll: !type || type === 'single' || mode === 'radio' ? true : hideSelectAll ?? type !== 'multiple'
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
// onScroll={() => {
|
|
412
|
-
//
|
|
411
|
+
// onScroll={(event) => {
|
|
412
|
+
// console.log('event', event)
|
|
413
413
|
// }}
|
|
414
414
|
,
|
|
415
415
|
|
|
@@ -423,20 +423,23 @@ const TableGrid = props => {
|
|
|
423
423
|
return /*#__PURE__*/React.createElement(Table.Summary, {
|
|
424
424
|
fixed: true
|
|
425
425
|
}, /*#__PURE__*/React.createElement(Table.Summary.Row, null, flatColumns(!!mode ? [Table.SELECTION_COLUMN, ...columns] : [...columns]).filter(col => col.hidden !== true).map((col, index) => {
|
|
426
|
-
const
|
|
427
|
-
const
|
|
428
|
-
const
|
|
426
|
+
const cellFormat = col.format ? typeof col.format === 'function' ? col.format({}) : col.format : format;
|
|
427
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
428
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
429
|
+
|
|
430
|
+
// const dec = (col.format?.decimalScale || col.format?.decimalScale === 0) ? col.format?.decimalScale : format?.decimalScale
|
|
431
|
+
const dec = cellFormat?.decimalScale;
|
|
429
432
|
const sumValue = col.type === 'number' ? sumDataByField(dataSource, col?.key) : 0;
|
|
430
433
|
const value = !isEmpty(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
|
|
431
434
|
const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
|
|
432
435
|
const numericFormatProps = {
|
|
433
436
|
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
434
437
|
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
435
|
-
allowNegative:
|
|
436
|
-
prefix:
|
|
437
|
-
suffix:
|
|
438
|
+
allowNegative: cellFormat?.allowNegative ?? false,
|
|
439
|
+
prefix: cellFormat?.prefix,
|
|
440
|
+
suffix: cellFormat?.suffix,
|
|
438
441
|
decimalScale: dec,
|
|
439
|
-
fixedDecimalScale:
|
|
442
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
440
443
|
};
|
|
441
444
|
return /*#__PURE__*/React.createElement(Table.Summary.Cell, {
|
|
442
445
|
key: col.key,
|
|
@@ -6,4 +6,4 @@ export declare function flatColumns<RecordType>(columns: ColumnsTable<RecordType
|
|
|
6
6
|
export declare function flatColumns2<RecordType>(columns: ColumnsTable<RecordType>): ColumnsTable<RecordType>;
|
|
7
7
|
export declare const getValueCell: <T>(column: ColumnTable<T>, value: any, format?: IFormat) => any;
|
|
8
8
|
export declare const renderContent: <T>(column: ColumnTable<T>, value: any, record: any, index: number, format?: IFormat) => React.JSX.Element;
|
|
9
|
-
export declare const renderFilter: <RecordType>(column: ColumnTable<RecordType>, selectedKeys: string[], setSelectedKeys: any, confirm: any, visible: boolean, searchValue: string, setSearchValue: any, dataSourceFilter: any[], buddhistLocale: any, locale?: TableLocale, t?: any) => React.JSX.Element;
|
|
9
|
+
export declare const renderFilter: <RecordType>(column: ColumnTable<RecordType>, selectedKeys: string[], setSelectedKeys: any, confirm: any, visible: boolean, searchValue: string, setSearchValue: any, dataSourceFilter: any[], buddhistLocale: any, locale?: TableLocale, t?: any, format?: IFormat) => React.JSX.Element;
|
|
@@ -70,9 +70,9 @@ export function flatColumns2(columns
|
|
|
70
70
|
export const getValueCell = (column, value, format) => {
|
|
71
71
|
switch (column?.type) {
|
|
72
72
|
case 'number':
|
|
73
|
-
const thousandSeparator =
|
|
74
|
-
const decimalSeparator =
|
|
75
|
-
const dec =
|
|
73
|
+
const thousandSeparator = format?.thousandSeparator;
|
|
74
|
+
const decimalSeparator = format?.decimalSeparator;
|
|
75
|
+
const dec = format?.decimalScale;
|
|
76
76
|
|
|
77
77
|
// const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? parseFloat(Number(value).toFixed(dec)).toString() : value.toString()) : '0'
|
|
78
78
|
|
|
@@ -81,22 +81,22 @@ export const getValueCell = (column, value, format) => {
|
|
|
81
81
|
const numericFormatProps = {
|
|
82
82
|
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
83
83
|
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
84
|
-
allowNegative:
|
|
85
|
-
prefix:
|
|
86
|
-
suffix:
|
|
87
|
-
decimalScale:
|
|
88
|
-
fixedDecimalScale:
|
|
84
|
+
allowNegative: format?.allowNegative ?? true,
|
|
85
|
+
prefix: format?.prefix,
|
|
86
|
+
suffix: format?.suffix,
|
|
87
|
+
decimalScale: dec,
|
|
88
|
+
fixedDecimalScale: format?.fixedDecimalScale ?? false
|
|
89
89
|
};
|
|
90
90
|
return !isEmpty(contentNumber) ? numericFormatter(contentNumber, numericFormatProps) : '';
|
|
91
91
|
case 'date':
|
|
92
|
-
return value ? dayjs(value).format(
|
|
92
|
+
return value ? dayjs(value).format(format?.dateFormat ?? 'DD/MM/YYYY') : '';
|
|
93
93
|
case 'time':
|
|
94
94
|
return value ? value : '';
|
|
95
95
|
case 'year':
|
|
96
96
|
const year = value ? moment(value).format('yyyy') : '';
|
|
97
97
|
return /*#__PURE__*/React.createElement(Fragment, null, year);
|
|
98
98
|
case 'datetime':
|
|
99
|
-
return value ? moment(value).format(
|
|
99
|
+
return value ? moment(value).format(format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm') : '';
|
|
100
100
|
case 'boolean':
|
|
101
101
|
return value ? 'true' : 'false';
|
|
102
102
|
case 'color':
|
|
@@ -135,10 +135,11 @@ export const renderContent = (column, value, record, index, format) => {
|
|
|
135
135
|
field: column.field
|
|
136
136
|
}) : column.template : content);
|
|
137
137
|
};
|
|
138
|
-
export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t) => {
|
|
138
|
+
export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t, format) => {
|
|
139
|
+
const cellFormat = column.format ? typeof column.format === 'function' ? column.format({}) : column.format : format;
|
|
139
140
|
const type = getTypeFilter(column);
|
|
140
|
-
const dateFormat = getDatepickerFormat(column?.typeFilter ?? column?.type,
|
|
141
|
-
const dateRangeFormat = getDatepickerFormat(column?.type,
|
|
141
|
+
const dateFormat = getDatepickerFormat(column?.typeFilter ?? column?.type, cellFormat) ?? 'DD/MM/YYYY';
|
|
142
|
+
const dateRangeFormat = getDatepickerFormat(column?.type, cellFormat) ?? 'DD/MM/YYYY';
|
|
142
143
|
const find = dataSourceFilter?.find(it => it.key === column?.field);
|
|
143
144
|
const options = find ? find.data : [];
|
|
144
145
|
switch (type) {
|
|
@@ -277,23 +277,24 @@ const useColumns = config => {
|
|
|
277
277
|
};
|
|
278
278
|
},
|
|
279
279
|
render: (value, record, rowIndex) => {
|
|
280
|
+
const cellFormat = col.format ? typeof col.format === 'function' ? col.format(record) : col.format : format;
|
|
280
281
|
if (groupSetting && groupSetting.hiddenColumnGroup === false) {
|
|
281
282
|
if (record.children) {
|
|
282
|
-
return renderContent(col, value, record, rowIndex,
|
|
283
|
+
return renderContent(col, value, record, rowIndex, cellFormat);
|
|
283
284
|
}
|
|
284
285
|
if (groupColumns?.includes(col.field)) {
|
|
285
286
|
return '';
|
|
286
287
|
}
|
|
287
|
-
return renderContent(col, value, record, rowIndex,
|
|
288
|
+
return renderContent(col, value, record, rowIndex, cellFormat);
|
|
288
289
|
}
|
|
289
290
|
if (col.field === firstNonGroupColumn?.field && record.children) {
|
|
290
291
|
const currentGroupColumn = flatColumns2(cols).find(it => it.field === record.field);
|
|
291
292
|
if (currentGroupColumn?.template) {
|
|
292
|
-
return renderContent(currentGroupColumn, record[record.field], record, rowIndex,
|
|
293
|
+
return renderContent(currentGroupColumn, record[record.field], record, rowIndex, cellFormat);
|
|
293
294
|
}
|
|
294
|
-
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", renderContent(currentGroupColumn, record[record.field], record, rowIndex,
|
|
295
|
+
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", renderContent(currentGroupColumn, record[record.field], record, rowIndex, cellFormat));
|
|
295
296
|
}
|
|
296
|
-
return renderContent(col, value, record, rowIndex,
|
|
297
|
+
return renderContent(col, value, record, rowIndex, cellFormat);
|
|
297
298
|
},
|
|
298
299
|
hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? transformedColumn.hidden : groupAble && groupColumns && groupColumns.includes(col.field) ? true : transformedColumn.hidden
|
|
299
300
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import type { EditType, IColumnType, TypeFilter } from "rc-master-ui";
|
|
4
|
-
import type { ColumnTable, GetRowKey } from "../type";
|
|
4
|
+
import type { ColumnTable, GetRowKey, IFormat } from "../type";
|
|
5
5
|
import type { SelectionSettings } from "../type";
|
|
6
6
|
import type { AnyObject } from "../type";
|
|
7
7
|
import type { Key } from "react";
|
|
@@ -21,7 +21,7 @@ export declare const getVisibleColumnKeys: (columns: any[]) => string[];
|
|
|
21
21
|
export declare function getHiddenParentKeys(columns: any[], parentKeys?: string[]): string[];
|
|
22
22
|
export declare const updateColumns: (columns: any[], includes: string[]) => any[];
|
|
23
23
|
export declare const updateColumnsByGroup: (columns: any[], columnsGroup: string[]) => any[];
|
|
24
|
-
export declare const getDatepickerFormat: (type: EditType | TypeFilter | IColumnType,
|
|
24
|
+
export declare const getDatepickerFormat: (type: EditType | TypeFilter | IColumnType, format?: IFormat) => string;
|
|
25
25
|
export declare const customWeekStartEndFormat: (value: any, weekFormat: string) => string;
|
|
26
26
|
export declare const getTypeFilter: (col: ColumnTable<any>) => TypeFilter;
|
|
27
27
|
export declare const updateArrayByKey: (arr: any[], element: any, key: string) => any[];
|
|
@@ -108,8 +108,11 @@ export declare function getBottomRowCells(cellSet: any): any[];
|
|
|
108
108
|
export declare function getCellsByPosition(cellSet: any, position?: string): any[];
|
|
109
109
|
export declare const addBorderClass: (selectedCells: any, type: string, className: string, id?: string) => void;
|
|
110
110
|
export declare const removeBorderClass: (selectedCells: any, type: string, className: string, id?: string) => void;
|
|
111
|
-
export declare const
|
|
112
|
-
export declare const
|
|
111
|
+
export declare const removeBorderClass2: (className: string, id?: string) => void;
|
|
112
|
+
export declare const onAddBgSelectedCell: (selectedCells: any, id?: string) => void;
|
|
113
|
+
export declare const onAddBorderSelectedCell: (selectedCells: any, id?: string) => void;
|
|
114
|
+
export declare const onRemoveBgSelectedCell: (selectedCells: any, id?: string, rowsSelected?: any) => void;
|
|
115
|
+
export declare const onRemoveBorderSelectedCell: (selectedCells: any, id?: string) => void;
|
|
113
116
|
export declare const addClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
|
|
114
117
|
export declare const removeClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
|
|
115
118
|
export declare const addClassCellIndexSelected: (rowsSelected: any, id?: string) => void;
|
|
@@ -171,24 +171,24 @@ export const updateColumnsByGroup = (columns, columnsGroup) => {
|
|
|
171
171
|
return newColumn;
|
|
172
172
|
});
|
|
173
173
|
};
|
|
174
|
-
export const getDatepickerFormat = (type,
|
|
174
|
+
export const getDatepickerFormat = (type, format) => {
|
|
175
175
|
const typeFormat = type ? type.toLowerCase() : '';
|
|
176
176
|
switch (typeFormat) {
|
|
177
177
|
case "date":
|
|
178
178
|
case "daterange":
|
|
179
|
-
return
|
|
179
|
+
return format?.dateFormat ?? 'DD/MM/YYYY';
|
|
180
180
|
case "datetime":
|
|
181
|
-
return
|
|
181
|
+
return format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm';
|
|
182
182
|
case "week":
|
|
183
|
-
return
|
|
183
|
+
return format?.weekFormat ?? 'DD/MM';
|
|
184
184
|
case "month":
|
|
185
|
-
return
|
|
185
|
+
return format?.monthFormat ?? 'MM/YYYY';
|
|
186
186
|
case "quarter":
|
|
187
|
-
return
|
|
187
|
+
return format?.dateFormat ?? 'DD/MM/YYYY';
|
|
188
188
|
case "year":
|
|
189
|
-
return
|
|
189
|
+
return format?.yearFormat ?? 'YYYY';
|
|
190
190
|
case "time":
|
|
191
|
-
return
|
|
191
|
+
return format?.timeFormat ?? 'HH:mm';
|
|
192
192
|
default:
|
|
193
193
|
return 'DD/MM/YYYY';
|
|
194
194
|
}
|
|
@@ -1533,7 +1533,16 @@ export const removeBorderClass = (selectedCells, type, className, id) => {
|
|
|
1533
1533
|
});
|
|
1534
1534
|
}
|
|
1535
1535
|
};
|
|
1536
|
-
export const
|
|
1536
|
+
export const removeBorderClass2 = (className, id) => {
|
|
1537
|
+
const table = document.querySelector(`#${id}`);
|
|
1538
|
+
const cellsFilter = table ? table?.querySelectorAll(`.ui-rc-table-cell.${className}`) : null;
|
|
1539
|
+
if (cellsFilter && cellsFilter.length > 0) {
|
|
1540
|
+
cellsFilter.forEach(cell => {
|
|
1541
|
+
cell.classList.remove(className);
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
export const onAddBgSelectedCell = (selectedCells, id) => {
|
|
1537
1546
|
const selectors = Array.from(selectedCells).map(pos => {
|
|
1538
1547
|
const [row1, col1] = pos.split('-');
|
|
1539
1548
|
return `[data-row-index="${row1}"][data-col-index="${col1}"]`;
|
|
@@ -1554,6 +1563,29 @@ export const onAddClassBgSelectedCell = (selectedCells, id) => {
|
|
|
1554
1563
|
});
|
|
1555
1564
|
}
|
|
1556
1565
|
|
|
1566
|
+
// // tăng z-index để hiển thị round point paste
|
|
1567
|
+
// const row = getLastSelectCell(selectedCells).row
|
|
1568
|
+
// const col = getLastSelectCell(selectedCells).col
|
|
1569
|
+
// const cell: any = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`)
|
|
1570
|
+
//
|
|
1571
|
+
// if (cell) {
|
|
1572
|
+
// cell.style.zIndex = 1
|
|
1573
|
+
// }
|
|
1574
|
+
//
|
|
1575
|
+
// if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
|
|
1576
|
+
// cell.style.zIndex = 3;
|
|
1577
|
+
// }
|
|
1578
|
+
|
|
1579
|
+
// thêm class border selected
|
|
1580
|
+
|
|
1581
|
+
// addBorderClass(selectedCells, 'bottom', 'cell-border-bottom', id)
|
|
1582
|
+
// addBorderClass(selectedCells, 'right', 'cell-border-right', id)
|
|
1583
|
+
// addBorderClass(selectedCells, 'top', 'cell-border-top', id)
|
|
1584
|
+
// addBorderClass(selectedCells, 'left', 'cell-border-left', id)
|
|
1585
|
+
};
|
|
1586
|
+
export const onAddBorderSelectedCell = (selectedCells, id) => {
|
|
1587
|
+
const table = document.querySelector(`#${id}`);
|
|
1588
|
+
|
|
1557
1589
|
// tăng z-index để hiển thị round point paste
|
|
1558
1590
|
const row = getLastSelectCell(selectedCells).row;
|
|
1559
1591
|
const col = getLastSelectCell(selectedCells).col;
|
|
@@ -1572,25 +1604,15 @@ export const onAddClassBgSelectedCell = (selectedCells, id) => {
|
|
|
1572
1604
|
addBorderClass(selectedCells, 'top', 'cell-border-top', id);
|
|
1573
1605
|
addBorderClass(selectedCells, 'left', 'cell-border-left', id);
|
|
1574
1606
|
};
|
|
1575
|
-
export const
|
|
1576
|
-
const selectors = Array.from(selectedCells).map(pos => {
|
|
1577
|
-
const [row, col] = pos.split('-');
|
|
1578
|
-
return `[data-row-index="${row}"][data-col-index="${col}"]`;
|
|
1579
|
-
});
|
|
1580
|
-
const rowsArray = [...new Set([...selectedCells].map(item => item.split("-")[0]))];
|
|
1581
|
-
const rowsSelectors = rowsArray.map(row => `.rc-ui-cell-index[data-row-index="${row}"]`).join(", ");
|
|
1607
|
+
export const onRemoveBgSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
1582
1608
|
const table = document.querySelector(`#${id}`);
|
|
1583
|
-
const cells = table
|
|
1584
|
-
// const cells = table?.querySelectorAll(selectors.join(','))
|
|
1585
|
-
|
|
1586
|
-
// const cells = table?.querySelectorAll('.ui-rc-table-cell.selected');
|
|
1587
|
-
|
|
1609
|
+
const cells = table ? table?.querySelectorAll('.ui-rc-table-cell.selected') : null;
|
|
1588
1610
|
if (cells) {
|
|
1589
1611
|
cells.forEach(cell => {
|
|
1590
1612
|
cell.classList.remove('selected');
|
|
1591
1613
|
});
|
|
1592
1614
|
}
|
|
1593
|
-
const cellsIndex = table
|
|
1615
|
+
const cellsIndex = table ? table?.querySelectorAll('.ui-rc-table-cell.focus') : null;
|
|
1594
1616
|
if (cellsIndex) {
|
|
1595
1617
|
cellsIndex.forEach(cell => {
|
|
1596
1618
|
cell.classList.remove('focus');
|
|
@@ -1609,11 +1631,16 @@ export const onRemoveClassSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
|
1609
1631
|
});
|
|
1610
1632
|
}
|
|
1611
1633
|
}
|
|
1634
|
+
};
|
|
1635
|
+
export const onRemoveBorderSelectedCell = (selectedCells, id) => {
|
|
1636
|
+
const table = document.querySelector(`#${id}`);
|
|
1612
1637
|
|
|
1613
1638
|
// xóa z-index về mặc định
|
|
1614
1639
|
|
|
1615
1640
|
const row = getLastSelectCell(selectedCells).row;
|
|
1616
1641
|
const col = getLastSelectCell(selectedCells).col;
|
|
1642
|
+
|
|
1643
|
+
// const cell: any = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`)
|
|
1617
1644
|
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1618
1645
|
if (cell) {
|
|
1619
1646
|
cell.style.zIndex = 0;
|
|
@@ -1624,10 +1651,14 @@ export const onRemoveClassSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
|
1624
1651
|
|
|
1625
1652
|
// remove class border
|
|
1626
1653
|
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1654
|
+
removeBorderClass2('cell-border-bottom', id);
|
|
1655
|
+
removeBorderClass2('cell-border-top', id);
|
|
1656
|
+
removeBorderClass2('cell-border-right', id);
|
|
1657
|
+
removeBorderClass2('cell-border-left', id);
|
|
1658
|
+
|
|
1659
|
+
// removeBorderClass(selectedCells, 'right', 'cell-border-right', id)
|
|
1660
|
+
// removeBorderClass(selectedCells, 'top', 'cell-border-top', id)
|
|
1661
|
+
// removeBorderClass(selectedCells, 'left', 'cell-border-left', id)
|
|
1631
1662
|
};
|
|
1632
1663
|
export const addClassBorderPasteCell = (pasteCells, type, id) => {
|
|
1633
1664
|
// thêm class border
|
|
@@ -5,13 +5,17 @@ $rowHoverBg: #FBDED6 !default;
|
|
|
5
5
|
$rowSelectedBg: #FEF2EF !default;
|
|
6
6
|
//$tableBorderColor: red !default;
|
|
7
7
|
$tableBorderColor: #e0e0e0 !default;
|
|
8
|
+
//$tableBorderColor: #C4C4C4 !default;
|
|
8
9
|
//$tableBorderColor: #f0f0f0 !default;
|
|
9
10
|
$border-radius: 6px !default;
|
|
10
11
|
$border-selected-color: #0550C5 !default;
|
|
11
12
|
$body-color: #ffffff !default;
|
|
12
|
-
|
|
13
|
-
$cell-
|
|
14
|
-
|
|
13
|
+
//$cell-selected-bg: #E6EFFD !default;
|
|
14
|
+
$cell-selected-bg: #F3F8FF !default;
|
|
15
|
+
//$cell-index-selected-bg: #0550C5 !default;
|
|
16
|
+
$cell-index-selected-bg: #1869E6 !default;
|
|
17
|
+
//$cell-index-focus-bg: #CEDBEF !default;
|
|
18
|
+
$cell-index-focus-bg: #E6EFFD !default;
|
|
15
19
|
$rowSelectedHoverBg: 'ui-rc' !default;
|
|
16
20
|
$boxShadowColor: rgba(5, 5, 5, 0.09) !default;
|
|
17
21
|
$fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
@@ -155,7 +159,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
155
159
|
|
|
156
160
|
&.selected {
|
|
157
161
|
//background: red;
|
|
158
|
-
background-color: $cell-selected-bg;
|
|
162
|
+
background-color: $cell-selected-bg !important;
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
.ui-rc-table-cell-content {
|
|
@@ -425,7 +429,7 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
425
429
|
font-weight: 500;
|
|
426
430
|
}
|
|
427
431
|
&.selected {
|
|
428
|
-
background-color: $cell-index-selected-bg;
|
|
432
|
+
background-color: $cell-index-selected-bg !important;
|
|
429
433
|
color: #fff;
|
|
430
434
|
//font-weight: 500;
|
|
431
435
|
}
|
|
@@ -695,12 +699,12 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
|
|
|
695
699
|
.#{$prefix}-table-row {
|
|
696
700
|
&.#{$prefix}-table-row-selected {
|
|
697
701
|
>.#{$prefix}-table-cell {
|
|
698
|
-
background: #FEF2EF;
|
|
702
|
+
//background: #FEF2EF;
|
|
699
703
|
}
|
|
700
704
|
}
|
|
701
705
|
>.#{$prefix}-table-cell {
|
|
702
706
|
&.#{$prefix}-table-cell-row-hover {
|
|
703
|
-
background: #FBDED6;
|
|
707
|
+
//background: #FBDED6;
|
|
704
708
|
}
|
|
705
709
|
}
|
|
706
710
|
|