es-grid-template 1.9.37 → 1.9.39
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/es/table-component/InternalTable.js +9 -2
- package/es/table-component/TableContainerEdit.js +28 -3
- package/es/table-component/body/EditableCell.js +2 -2
- package/es/table-component/body/TableBodyCell.js +5 -3
- package/es/table-component/body/TableBodyCellEdit.js +4 -2
- package/es/table-component/header/TableHeadCell2.js +4 -0
- package/lib/table-component/InternalTable.js +9 -2
- package/lib/table-component/TableContainerEdit.js +23 -2
- package/lib/table-component/body/EditableCell.js +2 -2
- package/lib/table-component/body/TableBodyCell.js +4 -2
- package/lib/table-component/body/TableBodyCellEdit.js +3 -1
- package/lib/table-component/header/TableHeadCell2.js +4 -0
- package/package.json +2 -2
|
@@ -182,16 +182,23 @@ const InternalTable = props => {
|
|
|
182
182
|
colorLink: '#eb4619',
|
|
183
183
|
colorLinkHover: '#eb4619'
|
|
184
184
|
},
|
|
185
|
+
TableSelect: {
|
|
186
|
+
activeBorderColor: '#1677ff',
|
|
187
|
+
hoverBorderColor: '#1677ff',
|
|
188
|
+
zIndexPopup: 1059
|
|
189
|
+
},
|
|
185
190
|
Select: {
|
|
186
191
|
activeBorderColor: '#1677ff',
|
|
187
|
-
hoverBorderColor: '#1677ff'
|
|
192
|
+
hoverBorderColor: '#1677ff',
|
|
193
|
+
zIndexPopup: 1059
|
|
188
194
|
// colorPrimary: '#eb4619',
|
|
189
195
|
// colorBgBase: 'red'
|
|
190
196
|
},
|
|
191
197
|
DatePicker: {
|
|
192
198
|
colorPrimary: '#eb4619',
|
|
193
199
|
activeBorderColor: '#1677ff',
|
|
194
|
-
hoverBorderColor: '#1677ff'
|
|
200
|
+
hoverBorderColor: '#1677ff',
|
|
201
|
+
zIndexPopup: 1059
|
|
195
202
|
},
|
|
196
203
|
Pagination: {
|
|
197
204
|
fontSize: 12
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import React, { Fragment } from "react";
|
|
3
3
|
import { useCopyToClipboard } from 'usehooks-ts';
|
|
4
|
-
import { checkDecimalSeparator, checkThousandSeparator,
|
|
4
|
+
import { checkDecimalSeparator, checkThousandSeparator,
|
|
5
|
+
// convertDateToDayjs,
|
|
6
|
+
detectSeparators, findItemByKey, flattenArray, flattenData, getAllRowKey, getColIdsBetween, getDatepickerFormat,
|
|
7
|
+
// getDatepickerFormat,
|
|
8
|
+
getDefaultValue, getEditType, getFormat, getRowIdsBetween, getSelectedCellMatrix, getTableHeight, isDateValue, isEditable, isEmpty, isFormattedNumber, newGuid, parseExcelClipboard,
|
|
5
9
|
// parseExcelClipboardText,
|
|
6
10
|
sumSize,
|
|
7
11
|
// sumSize,
|
|
@@ -24,6 +28,7 @@ import withReactContent from "sweetalert2-react-content";
|
|
|
24
28
|
import Swal from "sweetalert2";
|
|
25
29
|
import { useLocale } from "rc-master-ui/es/locale";
|
|
26
30
|
import { getToolbarTemplate } from "../grid-component/hooks";
|
|
31
|
+
import moment from "moment";
|
|
27
32
|
const MySwal = withReactContent(Swal);
|
|
28
33
|
const {
|
|
29
34
|
Paragraph,
|
|
@@ -409,6 +414,17 @@ const TableContainerEdit = props => {
|
|
|
409
414
|
[columnKey]: Number(val)
|
|
410
415
|
};
|
|
411
416
|
}
|
|
417
|
+
} else if (columnOri.type === 'data' || columnOri.type === 'datatime' || columnOri.editType === 'date' || columnOri.editType === 'datetime') {
|
|
418
|
+
const isDate = isDateValue(cellValue.trim());
|
|
419
|
+
const colFormat = typeof columnOri?.format === 'function' ? columnOri?.format(record) : columnOri?.format;
|
|
420
|
+
const cellFormat = getFormat(colFormat, format);
|
|
421
|
+
const editType = getEditType(columnOri);
|
|
422
|
+
const dateFormat = getDatepickerFormat(editType, cellFormat);
|
|
423
|
+
const date = isDate && !isEmpty(cellValue.trim()) ? moment(cellValue.trim(), dateFormat).format("YYYY-MM-DDTHH:mm:ssZ") : null;
|
|
424
|
+
newData[targetRow] = {
|
|
425
|
+
...newData[targetRow],
|
|
426
|
+
[columnKey]: date
|
|
427
|
+
};
|
|
412
428
|
} else {
|
|
413
429
|
newData[targetRow] = {
|
|
414
430
|
...newData[targetRow],
|
|
@@ -474,8 +490,6 @@ const TableContainerEdit = props => {
|
|
|
474
490
|
|
|
475
491
|
if (isEdit) {
|
|
476
492
|
const columnKey = allCols[targetCol].id;
|
|
477
|
-
|
|
478
|
-
// if (columnOri.type === 'number' && isFormattedNumber(cellValue.trim())) {
|
|
479
493
|
if (columnOri.type === 'number') {
|
|
480
494
|
if (cellValue.trim() === '') {
|
|
481
495
|
childData[targetRow] = {
|
|
@@ -505,6 +519,17 @@ const TableContainerEdit = props => {
|
|
|
505
519
|
[columnKey]: Number(val)
|
|
506
520
|
};
|
|
507
521
|
}
|
|
522
|
+
} else if (columnOri.type === 'data' || columnOri.type === 'datatime' || columnOri.editType === 'date' || columnOri.editType === 'datetime') {
|
|
523
|
+
const isDate = isDateValue(cellValue.trim());
|
|
524
|
+
const colFormat = typeof columnOri?.format === 'function' ? columnOri?.format(record) : columnOri?.format;
|
|
525
|
+
const cellFormat = getFormat(colFormat, format);
|
|
526
|
+
const editType = getEditType(columnOri);
|
|
527
|
+
const dateFormat = getDatepickerFormat(editType, cellFormat);
|
|
528
|
+
const date = isDate && !isEmpty(cellValue.trim()) ? moment(cellValue.trim(), dateFormat).format("YYYY-MM-DDTHH:mm:ssZ") : null;
|
|
529
|
+
childData[targetRow] = {
|
|
530
|
+
...childData[targetRow],
|
|
531
|
+
[columnKey]: date
|
|
532
|
+
};
|
|
508
533
|
} else {
|
|
509
534
|
childData[targetRow] = {
|
|
510
535
|
...childData[targetRow],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
|
-
import { DatePicker, TimePicker, ColorPicker } from "rc-master-ui";
|
|
4
|
-
import { Divider, Row, Col,
|
|
3
|
+
import { DatePicker, TimePicker, ColorPicker, Input } from "rc-master-ui";
|
|
4
|
+
import { Divider, Row, Col, Button } from "antd";
|
|
5
5
|
import { checkDecimalSeparator, checkThousandSeparator, checkFieldKey, convertArrayWithIndent, convertDateToDayjs, convertLabelToTitle, getDatepickerFormat, isDisable, isEmpty, isNullOrUndefined, customWeekStartEndFormat, convertDayjsToDate, parseBooleanToValue, isColor, genPresets, getFormat, removeVietnameseTones } from "../hook/utils";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import { NumericFormat } from "react-numeric-component";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Space from "rc-master-ui/es/space";
|
|
2
2
|
import Command from "../components/command/Command";
|
|
3
|
-
import { getCommonPinningStyles } from "../hook/utils";
|
|
3
|
+
import { getCommonPinningStyles, getFormat } from "../hook/utils";
|
|
4
4
|
import Checkbox from "rc-master-ui/es/checkbox/Checkbox";
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import React from "react";
|
|
@@ -182,7 +182,7 @@ const TableBodyCell = props => {
|
|
|
182
182
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
183
183
|
const [isOpenTooltip, setIsOpenTooltip] = React.useState(false);
|
|
184
184
|
const record = cell.row.original;
|
|
185
|
-
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
185
|
+
const columnMeta = React.useMemo(() => cell.column.columnDef.meta ?? {}, [cell.column.columnDef.meta]);
|
|
186
186
|
const cellStyles = typeof columnMeta.onCellStyles === 'function' ? columnMeta.onCellStyles(cell.getValue(), cell) : columnMeta.onCellStyles;
|
|
187
187
|
|
|
188
188
|
// const tooltipContent: any = (isOpenTooltip === false)
|
|
@@ -208,7 +208,9 @@ const TableBodyCell = props => {
|
|
|
208
208
|
const parrents = cell.row.getParentRows();
|
|
209
209
|
const cellValue = cell.getValue();
|
|
210
210
|
const rowIndex = cell.row.index;
|
|
211
|
-
const
|
|
211
|
+
const colFormat = typeof columnMeta?.format === 'function' ? columnMeta?.format(record) : columnMeta?.format;
|
|
212
|
+
const cellFormat = getFormat(colFormat, format);
|
|
213
|
+
const fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, true);
|
|
212
214
|
const valueCellString = getValueCellString(columnMeta, cellValue, record, rowIndex, colIndex, format);
|
|
213
215
|
const tooltipContent = React.useMemo(() => {
|
|
214
216
|
if (isOpenTooltip === false) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Space from "rc-master-ui/es/space";
|
|
2
2
|
import Command from "../components/command/Command";
|
|
3
|
-
import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, findFirst, flattenArray, flattenData, getColIdsBetween, getCommonPinningStyles, getEditType, getRowIdsBetween, getSelectedCellMatrix, isEditable, isObjEmpty, isObjEqual, newGuid, unFlattenData, updateOrInsert } from "../hook/utils";
|
|
3
|
+
import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, findFirst, flattenArray, flattenData, getColIdsBetween, getCommonPinningStyles, getEditType, getFormat, getRowIdsBetween, getSelectedCellMatrix, isEditable, isObjEmpty, isObjEqual, newGuid, unFlattenData, updateOrInsert } from "../hook/utils";
|
|
4
4
|
import Checkbox from "rc-master-ui/es/checkbox/Checkbox";
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import React from "react";
|
|
@@ -1113,7 +1113,9 @@ const TableBodyCellEdit = props => {
|
|
|
1113
1113
|
};
|
|
1114
1114
|
const cellValue = cell.getValue();
|
|
1115
1115
|
const rowIndex = cell.row.index;
|
|
1116
|
-
const
|
|
1116
|
+
const colFormat = typeof columnMeta?.format === 'function' ? columnMeta?.format(record) : columnMeta?.format;
|
|
1117
|
+
const cellFormat = getFormat(colFormat, format);
|
|
1118
|
+
const fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, true);
|
|
1117
1119
|
return /*#__PURE__*/React.createElement("div", {
|
|
1118
1120
|
key: cell.id,
|
|
1119
1121
|
ref: el => {
|
|
@@ -191,16 +191,23 @@ const InternalTable = props => {
|
|
|
191
191
|
colorLink: '#eb4619',
|
|
192
192
|
colorLinkHover: '#eb4619'
|
|
193
193
|
},
|
|
194
|
+
TableSelect: {
|
|
195
|
+
activeBorderColor: '#1677ff',
|
|
196
|
+
hoverBorderColor: '#1677ff',
|
|
197
|
+
zIndexPopup: 1059
|
|
198
|
+
},
|
|
194
199
|
Select: {
|
|
195
200
|
activeBorderColor: '#1677ff',
|
|
196
|
-
hoverBorderColor: '#1677ff'
|
|
201
|
+
hoverBorderColor: '#1677ff',
|
|
202
|
+
zIndexPopup: 1059
|
|
197
203
|
// colorPrimary: '#eb4619',
|
|
198
204
|
// colorBgBase: 'red'
|
|
199
205
|
},
|
|
200
206
|
DatePicker: {
|
|
201
207
|
colorPrimary: '#eb4619',
|
|
202
208
|
activeBorderColor: '#1677ff',
|
|
203
|
-
hoverBorderColor: '#1677ff'
|
|
209
|
+
hoverBorderColor: '#1677ff',
|
|
210
|
+
zIndexPopup: 1059
|
|
204
211
|
},
|
|
205
212
|
Pagination: {
|
|
206
213
|
fontSize: 12
|
|
@@ -27,6 +27,7 @@ var _sweetalert2ReactContent = _interopRequireDefault(require("sweetalert2-react
|
|
|
27
27
|
var _sweetalert = _interopRequireDefault(require("sweetalert2"));
|
|
28
28
|
var _locale = require("rc-master-ui/es/locale");
|
|
29
29
|
var _hooks = require("../grid-component/hooks");
|
|
30
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
30
31
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
31
32
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
33
|
const MySwal = (0, _sweetalert2ReactContent.default)(_sweetalert.default);
|
|
@@ -414,6 +415,17 @@ const TableContainerEdit = props => {
|
|
|
414
415
|
[columnKey]: Number(val)
|
|
415
416
|
};
|
|
416
417
|
}
|
|
418
|
+
} else if (columnOri.type === 'data' || columnOri.type === 'datatime' || columnOri.editType === 'date' || columnOri.editType === 'datetime') {
|
|
419
|
+
const isDate = (0, _utils.isDateValue)(cellValue.trim());
|
|
420
|
+
const colFormat = typeof columnOri?.format === 'function' ? columnOri?.format(record) : columnOri?.format;
|
|
421
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
422
|
+
const editType = (0, _utils.getEditType)(columnOri);
|
|
423
|
+
const dateFormat = (0, _utils.getDatepickerFormat)(editType, cellFormat);
|
|
424
|
+
const date = isDate && !(0, _utils.isEmpty)(cellValue.trim()) ? (0, _moment.default)(cellValue.trim(), dateFormat).format("YYYY-MM-DDTHH:mm:ssZ") : null;
|
|
425
|
+
newData[targetRow] = {
|
|
426
|
+
...newData[targetRow],
|
|
427
|
+
[columnKey]: date
|
|
428
|
+
};
|
|
417
429
|
} else {
|
|
418
430
|
newData[targetRow] = {
|
|
419
431
|
...newData[targetRow],
|
|
@@ -479,8 +491,6 @@ const TableContainerEdit = props => {
|
|
|
479
491
|
|
|
480
492
|
if (isEdit) {
|
|
481
493
|
const columnKey = allCols[targetCol].id;
|
|
482
|
-
|
|
483
|
-
// if (columnOri.type === 'number' && isFormattedNumber(cellValue.trim())) {
|
|
484
494
|
if (columnOri.type === 'number') {
|
|
485
495
|
if (cellValue.trim() === '') {
|
|
486
496
|
childData[targetRow] = {
|
|
@@ -510,6 +520,17 @@ const TableContainerEdit = props => {
|
|
|
510
520
|
[columnKey]: Number(val)
|
|
511
521
|
};
|
|
512
522
|
}
|
|
523
|
+
} else if (columnOri.type === 'data' || columnOri.type === 'datatime' || columnOri.editType === 'date' || columnOri.editType === 'datetime') {
|
|
524
|
+
const isDate = (0, _utils.isDateValue)(cellValue.trim());
|
|
525
|
+
const colFormat = typeof columnOri?.format === 'function' ? columnOri?.format(record) : columnOri?.format;
|
|
526
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
527
|
+
const editType = (0, _utils.getEditType)(columnOri);
|
|
528
|
+
const dateFormat = (0, _utils.getDatepickerFormat)(editType, cellFormat);
|
|
529
|
+
const date = isDate && !(0, _utils.isEmpty)(cellValue.trim()) ? (0, _moment.default)(cellValue.trim(), dateFormat).format("YYYY-MM-DDTHH:mm:ssZ") : null;
|
|
530
|
+
childData[targetRow] = {
|
|
531
|
+
...childData[targetRow],
|
|
532
|
+
[columnKey]: date
|
|
533
|
+
};
|
|
513
534
|
} else {
|
|
514
535
|
childData[targetRow] = {
|
|
515
536
|
...childData[targetRow],
|
|
@@ -29,7 +29,7 @@ const {
|
|
|
29
29
|
} = _rcMasterUi.TreeSelect;
|
|
30
30
|
const {
|
|
31
31
|
TextArea
|
|
32
|
-
} =
|
|
32
|
+
} = _rcMasterUi.Input;
|
|
33
33
|
const filterTreeNode = (input, treeNode) => {
|
|
34
34
|
const {
|
|
35
35
|
title,
|
|
@@ -1039,7 +1039,7 @@ const EditableCell = props => {
|
|
|
1039
1039
|
}, numericFormatProps, {
|
|
1040
1040
|
min: column.min,
|
|
1041
1041
|
max: column.max,
|
|
1042
|
-
customInput:
|
|
1042
|
+
customInput: _rcMasterUi.Input
|
|
1043
1043
|
// valueIsNumericString={true}
|
|
1044
1044
|
,
|
|
1045
1045
|
placeholder: t && column.placeholder ? t(column.placeholder) : tableLocal?.textPlaceholder,
|
|
@@ -189,7 +189,7 @@ const TableBodyCell = props => {
|
|
|
189
189
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
190
190
|
const [isOpenTooltip, setIsOpenTooltip] = _react.default.useState(false);
|
|
191
191
|
const record = cell.row.original;
|
|
192
|
-
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
192
|
+
const columnMeta = _react.default.useMemo(() => cell.column.columnDef.meta ?? {}, [cell.column.columnDef.meta]);
|
|
193
193
|
const cellStyles = typeof columnMeta.onCellStyles === 'function' ? columnMeta.onCellStyles(cell.getValue(), cell) : columnMeta.onCellStyles;
|
|
194
194
|
|
|
195
195
|
// const tooltipContent: any = (isOpenTooltip === false)
|
|
@@ -215,7 +215,9 @@ const TableBodyCell = props => {
|
|
|
215
215
|
const parrents = cell.row.getParentRows();
|
|
216
216
|
const cellValue = cell.getValue();
|
|
217
217
|
const rowIndex = cell.row.index;
|
|
218
|
-
const
|
|
218
|
+
const colFormat = typeof columnMeta?.format === 'function' ? columnMeta?.format(record) : columnMeta?.format;
|
|
219
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
220
|
+
const fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, true);
|
|
219
221
|
const valueCellString = (0, _useColumns.getValueCellString)(columnMeta, cellValue, record, rowIndex, colIndex, format);
|
|
220
222
|
const tooltipContent = _react.default.useMemo(() => {
|
|
221
223
|
if (isOpenTooltip === false) {
|
|
@@ -1120,7 +1120,9 @@ const TableBodyCellEdit = props => {
|
|
|
1120
1120
|
};
|
|
1121
1121
|
const cellValue = cell.getValue();
|
|
1122
1122
|
const rowIndex = cell.row.index;
|
|
1123
|
-
const
|
|
1123
|
+
const colFormat = typeof columnMeta?.format === 'function' ? columnMeta?.format(record) : columnMeta?.format;
|
|
1124
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
1125
|
+
const fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, true);
|
|
1124
1126
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
1125
1127
|
key: cell.id,
|
|
1126
1128
|
ref: el => {
|
|
@@ -191,6 +191,10 @@ const TableHeadCell2 = props => {
|
|
|
191
191
|
onChange: val => {
|
|
192
192
|
column.setFilterOperator(val);
|
|
193
193
|
}
|
|
194
|
+
// dropdownStyle={{
|
|
195
|
+
|
|
196
|
+
// zIndex: 1059
|
|
197
|
+
// }}
|
|
194
198
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
195
199
|
style: {
|
|
196
200
|
marginBottom: 8
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-grid-template",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.39",
|
|
4
4
|
"description": "es-grid-template",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"antd-style": "3.7.1",
|
|
60
60
|
"becoxy-icons": "2.0.1",
|
|
61
61
|
"classnames": "2.3.1",
|
|
62
|
-
"dayjs": "1.11.13",
|
|
62
|
+
"dayjs": "^1.11.13",
|
|
63
63
|
"lodash": "4.17.21",
|
|
64
64
|
"moment": "2.30.1",
|
|
65
65
|
"postcss": "8.4.35",
|