es-grid-template 1.3.7 → 1.3.8
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 +82 -209
- 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 +81 -209
- package/lib/grid-component/type.d.ts +4 -4
- package/package.json +109 -109
|
@@ -64,8 +64,9 @@ const EditableCell = props => {
|
|
|
64
64
|
const dateTimePickerRef = _react.default.useRef(null);
|
|
65
65
|
// const timePickerRef = React.useRef(null);
|
|
66
66
|
|
|
67
|
+
const cellFormat = column?.format ? typeof column?.format === 'function' ? column?.format?.(record) : column?.format : format;
|
|
67
68
|
const inputNode = (value, onChange) => {
|
|
68
|
-
const dateFormat = (0, _hooks.getDatepickerFormat)(editType,
|
|
69
|
+
const dateFormat = (0, _hooks.getDatepickerFormat)(editType, cellFormat);
|
|
69
70
|
const date = !(0, _hooks.isEmpty)(value) ? (0, _hooks.convertDateToDayjs)(new Date(value), dateFormat) : null;
|
|
70
71
|
const maxDate = (0, _hooks.convertDateToDayjs)(column.maxDate, dateFormat) ?? undefined;
|
|
71
72
|
const minDate = (0, _hooks.convertDateToDayjs)(column.minDate, dateFormat) ?? undefined;
|
|
@@ -207,7 +208,7 @@ const EditableCell = props => {
|
|
|
207
208
|
case 'month':
|
|
208
209
|
case 'quarter':
|
|
209
210
|
case 'year':
|
|
210
|
-
const pickerFormat = (0, _hooks.getDatepickerFormat)(editType,
|
|
211
|
+
const pickerFormat = (0, _hooks.getDatepickerFormat)(editType, cellFormat);
|
|
211
212
|
const maxDateValue1 = !(0, _hooks.isEmpty)(column.maxDate) ? (0, _dayjs.default)(column.maxDate, pickerFormat) : undefined;
|
|
212
213
|
const minDateValue1 = !(0, _hooks.isEmpty)(column.minDate) ? (0, _dayjs.default)(column.minDate, pickerFormat) : undefined;
|
|
213
214
|
return /*#__PURE__*/_react.default.createElement(_antd.DatePicker, {
|
|
@@ -228,7 +229,7 @@ const EditableCell = props => {
|
|
|
228
229
|
popupClassName: 'be-popup-container'
|
|
229
230
|
});
|
|
230
231
|
case 'week':
|
|
231
|
-
const weekFormat = (0, _hooks.getDatepickerFormat)(editType,
|
|
232
|
+
const weekFormat = (0, _hooks.getDatepickerFormat)(editType, cellFormat);
|
|
232
233
|
const maxWeekValue = !(0, _hooks.isEmpty)(column.maxDate) ? (0, _dayjs.default)(column.maxDate, weekFormat) : undefined;
|
|
233
234
|
const minWeekValue = !(0, _hooks.isEmpty)(column.minDate) ? (0, _dayjs.default)(column.minDate, weekFormat) : undefined;
|
|
234
235
|
return /*#__PURE__*/_react.default.createElement(_antd.DatePicker, {
|
|
@@ -245,7 +246,7 @@ const EditableCell = props => {
|
|
|
245
246
|
popupClassName: 'be-popup-container'
|
|
246
247
|
});
|
|
247
248
|
case 'time':
|
|
248
|
-
const timeFormat = (0, _hooks.getDatepickerFormat)(editType,
|
|
249
|
+
const timeFormat = (0, _hooks.getDatepickerFormat)(editType, cellFormat);
|
|
249
250
|
const maxTimeValue = !(0, _hooks.isEmpty)(column.maxTime) ? (0, _dayjs.default)(column.maxTime).format(timeFormat) : null;
|
|
250
251
|
const minTimeValue = !(0, _hooks.isEmpty)(column.minTime) ? (0, _dayjs.default)(column.minTime).format(timeFormat) : null;
|
|
251
252
|
|
|
@@ -760,8 +761,8 @@ const EditableCell = props => {
|
|
|
760
761
|
// )
|
|
761
762
|
|
|
762
763
|
case 'numeric':
|
|
763
|
-
const thousandSeparator =
|
|
764
|
-
const decimalSeparator =
|
|
764
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
765
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
765
766
|
|
|
766
767
|
// let floatValue = value
|
|
767
768
|
|
|
@@ -769,11 +770,11 @@ const EditableCell = props => {
|
|
|
769
770
|
value,
|
|
770
771
|
thousandSeparator: (0, _hooks.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
771
772
|
decimalSeparator: (0, _hooks.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
772
|
-
decimalScale:
|
|
773
|
-
fixedDecimalScale:
|
|
774
|
-
allowNegative:
|
|
775
|
-
prefix:
|
|
776
|
-
suffix:
|
|
773
|
+
decimalScale: cellFormat?.decimalScale ?? undefined,
|
|
774
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false,
|
|
775
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
776
|
+
prefix: cellFormat?.prefix ?? undefined,
|
|
777
|
+
suffix: cellFormat?.suffix ?? undefined
|
|
777
778
|
};
|
|
778
779
|
return /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, (0, _extends2.default)({
|
|
779
780
|
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.default.createElement(_rcMasterUi.Table.Summary, {
|
|
424
424
|
fixed: true
|
|
425
425
|
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table.Summary.Row, null, (0, _columns.flatColumns)(!!mode ? [_rcMasterUi.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' ? (0, _hooks.sumDataByField)(dataSource, col?.key) : 0;
|
|
430
433
|
const value = !(0, _hooks.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: (0, _hooks.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
434
437
|
decimalSeparator: (0, _hooks.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.default.createElement(_rcMasterUi.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;
|
|
@@ -81,9 +81,9 @@ function flatColumns2(columns
|
|
|
81
81
|
const getValueCell = (column, value, format) => {
|
|
82
82
|
switch (column?.type) {
|
|
83
83
|
case 'number':
|
|
84
|
-
const thousandSeparator =
|
|
85
|
-
const decimalSeparator =
|
|
86
|
-
const dec =
|
|
84
|
+
const thousandSeparator = format?.thousandSeparator;
|
|
85
|
+
const decimalSeparator = format?.decimalSeparator;
|
|
86
|
+
const dec = format?.decimalScale;
|
|
87
87
|
|
|
88
88
|
// const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? parseFloat(Number(value).toFixed(dec)).toString() : value.toString()) : '0'
|
|
89
89
|
|
|
@@ -92,22 +92,22 @@ const getValueCell = (column, value, format) => {
|
|
|
92
92
|
const numericFormatProps = {
|
|
93
93
|
thousandSeparator: (0, _utils.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
94
94
|
decimalSeparator: (0, _utils.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
95
|
-
allowNegative:
|
|
96
|
-
prefix:
|
|
97
|
-
suffix:
|
|
98
|
-
decimalScale:
|
|
99
|
-
fixedDecimalScale:
|
|
95
|
+
allowNegative: format?.allowNegative ?? true,
|
|
96
|
+
prefix: format?.prefix,
|
|
97
|
+
suffix: format?.suffix,
|
|
98
|
+
decimalScale: dec,
|
|
99
|
+
fixedDecimalScale: format?.fixedDecimalScale ?? false
|
|
100
100
|
};
|
|
101
101
|
return !(0, _utils.isEmpty)(contentNumber) ? (0, _reactNumericComponent.numericFormatter)(contentNumber, numericFormatProps) : '';
|
|
102
102
|
case 'date':
|
|
103
|
-
return value ? (0, _dayjs.default)(value).format(
|
|
103
|
+
return value ? (0, _dayjs.default)(value).format(format?.dateFormat ?? 'DD/MM/YYYY') : '';
|
|
104
104
|
case 'time':
|
|
105
105
|
return value ? value : '';
|
|
106
106
|
case 'year':
|
|
107
107
|
const year = value ? (0, _moment.default)(value).format('yyyy') : '';
|
|
108
108
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, year);
|
|
109
109
|
case 'datetime':
|
|
110
|
-
return value ? (0, _moment.default)(value).format(
|
|
110
|
+
return value ? (0, _moment.default)(value).format(format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm') : '';
|
|
111
111
|
case 'boolean':
|
|
112
112
|
return value ? 'true' : 'false';
|
|
113
113
|
case 'color':
|
|
@@ -148,10 +148,11 @@ const renderContent = (column, value, record, index, format) => {
|
|
|
148
148
|
}) : column.template : content);
|
|
149
149
|
};
|
|
150
150
|
exports.renderContent = renderContent;
|
|
151
|
-
const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t) => {
|
|
151
|
+
const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale, locale, t, format) => {
|
|
152
|
+
const cellFormat = column.format ? typeof column.format === 'function' ? column.format({}) : column.format : format;
|
|
152
153
|
const type = (0, _utils.getTypeFilter)(column);
|
|
153
|
-
const dateFormat = (0, _utils.getDatepickerFormat)(column?.typeFilter ?? column?.type,
|
|
154
|
-
const dateRangeFormat = (0, _utils.getDatepickerFormat)(column?.type,
|
|
154
|
+
const dateFormat = (0, _utils.getDatepickerFormat)(column?.typeFilter ?? column?.type, cellFormat) ?? 'DD/MM/YYYY';
|
|
155
|
+
const dateRangeFormat = (0, _utils.getDatepickerFormat)(column?.type, cellFormat) ?? 'DD/MM/YYYY';
|
|
155
156
|
const find = dataSourceFilter?.find(it => it.key === column?.field);
|
|
156
157
|
const options = find ? find.data : [];
|
|
157
158
|
switch (type) {
|
|
@@ -288,23 +288,24 @@ const useColumns = config => {
|
|
|
288
288
|
};
|
|
289
289
|
},
|
|
290
290
|
render: (value, record, rowIndex) => {
|
|
291
|
+
const cellFormat = col.format ? typeof col.format === 'function' ? col.format(record) : col.format : format;
|
|
291
292
|
if (groupSetting && groupSetting.hiddenColumnGroup === false) {
|
|
292
293
|
if (record.children) {
|
|
293
|
-
return (0, _columns.renderContent)(col, value, record, rowIndex,
|
|
294
|
+
return (0, _columns.renderContent)(col, value, record, rowIndex, cellFormat);
|
|
294
295
|
}
|
|
295
296
|
if (groupColumns?.includes(col.field)) {
|
|
296
297
|
return '';
|
|
297
298
|
}
|
|
298
|
-
return (0, _columns.renderContent)(col, value, record, rowIndex,
|
|
299
|
+
return (0, _columns.renderContent)(col, value, record, rowIndex, cellFormat);
|
|
299
300
|
}
|
|
300
301
|
if (col.field === firstNonGroupColumn?.field && record.children) {
|
|
301
302
|
const currentGroupColumn = (0, _columns.flatColumns2)(cols).find(it => it.field === record.field);
|
|
302
303
|
if (currentGroupColumn?.template) {
|
|
303
|
-
return (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex,
|
|
304
|
+
return (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex, cellFormat);
|
|
304
305
|
}
|
|
305
|
-
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex,
|
|
306
|
+
return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex, cellFormat));
|
|
306
307
|
}
|
|
307
|
-
return (0, _columns.renderContent)(col, value, record, rowIndex,
|
|
308
|
+
return (0, _columns.renderContent)(col, value, record, rowIndex, cellFormat);
|
|
308
309
|
},
|
|
309
310
|
hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? transformedColumn.hidden : groupAble && groupColumns && groupColumns.includes(col.field) ? true : transformedColumn.hidden
|
|
310
311
|
};
|
|
@@ -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;
|
|
@@ -28,7 +28,7 @@ exports.isEmpty = exports.isEditable = exports.isDisable = void 0;
|
|
|
28
28
|
exports.isEqualSet = isEqualSet;
|
|
29
29
|
exports.isObjEmpty = exports.isNullOrUndefined = exports.isNameColor = void 0;
|
|
30
30
|
exports.isRightMostInRegion = isRightMostInRegion;
|
|
31
|
-
exports.updateData = exports.updateColumnsByGroup = exports.updateColumns = exports.updateArrayByKey = exports.transformColumns1 = exports.transformColumns = exports.totalFixedWidth = exports.sumDataByField = exports.sortedSetDSC = exports.sortedSetASC = exports.showDraggingPoint = exports.shouldInclude = exports.removeFieldRecursive = exports.removeColumns = exports.removeClassCellIndexSelected = exports.removeClassBorderPasteCell = exports.removeBorderClass = exports.parseCells = exports.parseBooleanToValue = exports.
|
|
31
|
+
exports.updateData = exports.updateColumnsByGroup = exports.updateColumns = exports.updateArrayByKey = exports.transformColumns1 = exports.transformColumns = exports.totalFixedWidth = exports.sumDataByField = exports.sortedSetDSC = exports.sortedSetASC = exports.showDraggingPoint = exports.shouldInclude = exports.removeFieldRecursive = exports.removeColumns = exports.removeClassCellIndexSelected = exports.removeClassBorderPasteCell = exports.removeBorderClass2 = exports.removeBorderClass = exports.parseCells = exports.parseBooleanToValue = exports.onRemoveBorderSelectedCell = exports.onRemoveBgSelectedCell = exports.onAddBorderSelectedCell = exports.onAddBgSelectedCell = exports.newGuid = exports.mergedSets = exports.isTopMostInRegion = void 0;
|
|
32
32
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
33
33
|
var _moment = _interopRequireDefault(require("moment/moment"));
|
|
34
34
|
var _uuid = require("uuid");
|
|
@@ -216,24 +216,24 @@ const updateColumnsByGroup = (columns, columnsGroup) => {
|
|
|
216
216
|
});
|
|
217
217
|
};
|
|
218
218
|
exports.updateColumnsByGroup = updateColumnsByGroup;
|
|
219
|
-
const getDatepickerFormat = (type,
|
|
219
|
+
const getDatepickerFormat = (type, format) => {
|
|
220
220
|
const typeFormat = type ? type.toLowerCase() : '';
|
|
221
221
|
switch (typeFormat) {
|
|
222
222
|
case "date":
|
|
223
223
|
case "daterange":
|
|
224
|
-
return
|
|
224
|
+
return format?.dateFormat ?? 'DD/MM/YYYY';
|
|
225
225
|
case "datetime":
|
|
226
|
-
return
|
|
226
|
+
return format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm';
|
|
227
227
|
case "week":
|
|
228
|
-
return
|
|
228
|
+
return format?.weekFormat ?? 'DD/MM';
|
|
229
229
|
case "month":
|
|
230
|
-
return
|
|
230
|
+
return format?.monthFormat ?? 'MM/YYYY';
|
|
231
231
|
case "quarter":
|
|
232
|
-
return
|
|
232
|
+
return format?.dateFormat ?? 'DD/MM/YYYY';
|
|
233
233
|
case "year":
|
|
234
|
-
return
|
|
234
|
+
return format?.yearFormat ?? 'YYYY';
|
|
235
235
|
case "time":
|
|
236
|
-
return
|
|
236
|
+
return format?.timeFormat ?? 'HH:mm';
|
|
237
237
|
default:
|
|
238
238
|
return 'DD/MM/YYYY';
|
|
239
239
|
}
|
|
@@ -1630,7 +1630,17 @@ const removeBorderClass = (selectedCells, type, className, id) => {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
};
|
|
1632
1632
|
exports.removeBorderClass = removeBorderClass;
|
|
1633
|
-
const
|
|
1633
|
+
const removeBorderClass2 = (className, id) => {
|
|
1634
|
+
const table = document.querySelector(`#${id}`);
|
|
1635
|
+
const cellsFilter = table ? table?.querySelectorAll(`.ui-rc-table-cell.${className}`) : null;
|
|
1636
|
+
if (cellsFilter && cellsFilter.length > 0) {
|
|
1637
|
+
cellsFilter.forEach(cell => {
|
|
1638
|
+
cell.classList.remove(className);
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
exports.removeBorderClass2 = removeBorderClass2;
|
|
1643
|
+
const onAddBgSelectedCell = (selectedCells, id) => {
|
|
1634
1644
|
const selectors = Array.from(selectedCells).map(pos => {
|
|
1635
1645
|
const [row1, col1] = pos.split('-');
|
|
1636
1646
|
return `[data-row-index="${row1}"][data-col-index="${col1}"]`;
|
|
@@ -1651,6 +1661,30 @@ const onAddClassBgSelectedCell = (selectedCells, id) => {
|
|
|
1651
1661
|
});
|
|
1652
1662
|
}
|
|
1653
1663
|
|
|
1664
|
+
// // tăng z-index để hiển thị round point paste
|
|
1665
|
+
// const row = getLastSelectCell(selectedCells).row
|
|
1666
|
+
// const col = getLastSelectCell(selectedCells).col
|
|
1667
|
+
// const cell: any = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`)
|
|
1668
|
+
//
|
|
1669
|
+
// if (cell) {
|
|
1670
|
+
// cell.style.zIndex = 1
|
|
1671
|
+
// }
|
|
1672
|
+
//
|
|
1673
|
+
// if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
|
|
1674
|
+
// cell.style.zIndex = 3;
|
|
1675
|
+
// }
|
|
1676
|
+
|
|
1677
|
+
// thêm class border selected
|
|
1678
|
+
|
|
1679
|
+
// addBorderClass(selectedCells, 'bottom', 'cell-border-bottom', id)
|
|
1680
|
+
// addBorderClass(selectedCells, 'right', 'cell-border-right', id)
|
|
1681
|
+
// addBorderClass(selectedCells, 'top', 'cell-border-top', id)
|
|
1682
|
+
// addBorderClass(selectedCells, 'left', 'cell-border-left', id)
|
|
1683
|
+
};
|
|
1684
|
+
exports.onAddBgSelectedCell = onAddBgSelectedCell;
|
|
1685
|
+
const onAddBorderSelectedCell = (selectedCells, id) => {
|
|
1686
|
+
const table = document.querySelector(`#${id}`);
|
|
1687
|
+
|
|
1654
1688
|
// tăng z-index để hiển thị round point paste
|
|
1655
1689
|
const row = getLastSelectCell(selectedCells).row;
|
|
1656
1690
|
const col = getLastSelectCell(selectedCells).col;
|
|
@@ -1669,26 +1703,16 @@ const onAddClassBgSelectedCell = (selectedCells, id) => {
|
|
|
1669
1703
|
addBorderClass(selectedCells, 'top', 'cell-border-top', id);
|
|
1670
1704
|
addBorderClass(selectedCells, 'left', 'cell-border-left', id);
|
|
1671
1705
|
};
|
|
1672
|
-
exports.
|
|
1673
|
-
const
|
|
1674
|
-
const selectors = Array.from(selectedCells).map(pos => {
|
|
1675
|
-
const [row, col] = pos.split('-');
|
|
1676
|
-
return `[data-row-index="${row}"][data-col-index="${col}"]`;
|
|
1677
|
-
});
|
|
1678
|
-
const rowsArray = [...new Set([...selectedCells].map(item => item.split("-")[0]))];
|
|
1679
|
-
const rowsSelectors = rowsArray.map(row => `.rc-ui-cell-index[data-row-index="${row}"]`).join(", ");
|
|
1706
|
+
exports.onAddBorderSelectedCell = onAddBorderSelectedCell;
|
|
1707
|
+
const onRemoveBgSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
1680
1708
|
const table = document.querySelector(`#${id}`);
|
|
1681
|
-
const cells = table
|
|
1682
|
-
// const cells = table?.querySelectorAll(selectors.join(','))
|
|
1683
|
-
|
|
1684
|
-
// const cells = table?.querySelectorAll('.ui-rc-table-cell.selected');
|
|
1685
|
-
|
|
1709
|
+
const cells = table ? table?.querySelectorAll('.ui-rc-table-cell.selected') : null;
|
|
1686
1710
|
if (cells) {
|
|
1687
1711
|
cells.forEach(cell => {
|
|
1688
1712
|
cell.classList.remove('selected');
|
|
1689
1713
|
});
|
|
1690
1714
|
}
|
|
1691
|
-
const cellsIndex = table
|
|
1715
|
+
const cellsIndex = table ? table?.querySelectorAll('.ui-rc-table-cell.focus') : null;
|
|
1692
1716
|
if (cellsIndex) {
|
|
1693
1717
|
cellsIndex.forEach(cell => {
|
|
1694
1718
|
cell.classList.remove('focus');
|
|
@@ -1707,11 +1731,17 @@ const onRemoveClassSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
|
1707
1731
|
});
|
|
1708
1732
|
}
|
|
1709
1733
|
}
|
|
1734
|
+
};
|
|
1735
|
+
exports.onRemoveBgSelectedCell = onRemoveBgSelectedCell;
|
|
1736
|
+
const onRemoveBorderSelectedCell = (selectedCells, id) => {
|
|
1737
|
+
const table = document.querySelector(`#${id}`);
|
|
1710
1738
|
|
|
1711
1739
|
// xóa z-index về mặc định
|
|
1712
1740
|
|
|
1713
1741
|
const row = getLastSelectCell(selectedCells).row;
|
|
1714
1742
|
const col = getLastSelectCell(selectedCells).col;
|
|
1743
|
+
|
|
1744
|
+
// const cell: any = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`)
|
|
1715
1745
|
const cell = table?.querySelector(`.ui-rc-table-cell[data-row-index="${row}"][data-col-index="${col}"]`);
|
|
1716
1746
|
if (cell) {
|
|
1717
1747
|
cell.style.zIndex = 0;
|
|
@@ -1722,12 +1752,16 @@ const onRemoveClassSelectedCell = (selectedCells, id, rowsSelected) => {
|
|
|
1722
1752
|
|
|
1723
1753
|
// remove class border
|
|
1724
1754
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1755
|
+
removeBorderClass2('cell-border-bottom', id);
|
|
1756
|
+
removeBorderClass2('cell-border-top', id);
|
|
1757
|
+
removeBorderClass2('cell-border-right', id);
|
|
1758
|
+
removeBorderClass2('cell-border-left', id);
|
|
1759
|
+
|
|
1760
|
+
// removeBorderClass(selectedCells, 'right', 'cell-border-right', id)
|
|
1761
|
+
// removeBorderClass(selectedCells, 'top', 'cell-border-top', id)
|
|
1762
|
+
// removeBorderClass(selectedCells, 'left', 'cell-border-left', id)
|
|
1729
1763
|
};
|
|
1730
|
-
exports.
|
|
1764
|
+
exports.onRemoveBorderSelectedCell = onRemoveBorderSelectedCell;
|
|
1731
1765
|
const addClassBorderPasteCell = (pasteCells, type, id) => {
|
|
1732
1766
|
// thêm class border
|
|
1733
1767
|
|
|
@@ -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
|
|