es-grid-template 1.9.38 → 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.
@@ -194,10 +194,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
194
194
  value: any;
195
195
  rowData: RecordType;
196
196
  }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
197
- onCellStyles?: Omit<CSSProperties, "right" | "left" | "position" | "display" | "minWidth" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "right" | "left" | "position" | "display" | "minWidth" | "width">);
198
- onCellHeaderStyles?: Omit<CSSProperties, "right" | "left" | "position" | "display" | "minWidth" | "width"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "right" | "left" | "position" | "display" | "minWidth" | "width">);
197
+ onCellStyles?: Omit<CSSProperties, "width" | "minWidth" | "right" | "left" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "right" | "left" | "position" | "display">);
198
+ onCellHeaderStyles?: Omit<CSSProperties, "width" | "minWidth" | "right" | "left" | "position" | "display"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "right" | "left" | "position" | "display">);
199
199
  onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
200
- onCellFooterStyles?: Omit<CSSProperties, "right" | "left" | "position" | "display" | "minWidth" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "right" | "left" | "position" | "display" | "minWidth" | "width">);
200
+ onCellFooterStyles?: Omit<CSSProperties, "width" | "minWidth" | "right" | "left" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "right" | "left" | "position" | "display">);
201
201
  getValue?: (row: any, rowIndex: number) => any;
202
202
  getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
203
203
  headerCellProps?: import("./../../grid-component/type").CellProps;
@@ -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, detectSeparators, findItemByKey, flattenArray, flattenData, getAllRowKey, getColIdsBetween, getDefaultValue, getEditType, getFormat, getRowIdsBetween, getSelectedCellMatrix, getTableHeight, isEditable, isFormattedNumber, newGuid, parseExcelClipboard,
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, Input, Button } from "antd";
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 fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex, format, false);
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 fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex, format, true);
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 => {
@@ -182,6 +182,10 @@ const TableHeadCell2 = props => {
182
182
  onChange: val => {
183
183
  column.setFilterOperator(val);
184
184
  }
185
+ // dropdownStyle={{
186
+
187
+ // zIndex: 1059
188
+ // }}
185
189
  })), /*#__PURE__*/React.createElement("div", {
186
190
  style: {
187
191
  marginBottom: 8
@@ -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
- } = _antd.Input;
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: _antd.Input
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 fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex, format, false);
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 fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex, format, true);
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.38",
3
+ "version": "1.9.39",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",