es-grid-template 1.8.44 → 1.8.46

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.
@@ -29,7 +29,7 @@ import Grid from "./table/Grid";
29
29
 
30
30
  // import { Tooltip } from 'react-tooltip'
31
31
  // import ContextMenu from './ContextMenu'
32
- import { addRowIdArray, convertToObj, convertToObjTrue,
32
+ import { addRowIdArray, convertFlatColumn1, convertToObj, convertToObjTrue,
33
33
  // convertFilters,
34
34
  filterDataByColumns, findAllChildrenKeys2, flatColumns2,
35
35
  // filterDataByColumns,
@@ -37,6 +37,7 @@ getAllRowKey, getDiffent2Array, getFixedFields, getInvisibleColumns, groupArrayB
37
37
  // import GridEdit from './table/GridEdit'
38
38
  import { convertToTanStackColumns } from "./hook/useColumns";
39
39
  import { convertColumns } from "./hook/convert";
40
+ import { removeInvisibleColumns } from "../grid-component/hooks";
40
41
  // import { Modal } from 'antd'
41
42
  // import { findAllChildrenKeys2 } from '../grid-component/hooks'
42
43
  // import { columns111 } from '../test-2/columns'
@@ -64,6 +65,7 @@ const InternalTable = props => {
64
65
  groupColumns,
65
66
  selectionSettings,
66
67
  expandable,
68
+ onChooseColumns,
67
69
  // contextMenuClick,
68
70
  // contextMenuOpen,
69
71
  height,
@@ -174,6 +176,11 @@ const InternalTable = props => {
174
176
  const aa = flatColumns2(columns).map(it => it.field);
175
177
  const rsss = getDiffent2Array(aa, keys);
176
178
  setColumnsHiddenKeys(rsss);
179
+ onChooseColumns?.({
180
+ showColumns: removeInvisibleColumns([...cols]),
181
+ columns: [...cols],
182
+ flattenColumns: convertFlatColumn1([...cols])
183
+ });
177
184
  }
178
185
  };
179
186
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
@@ -474,27 +474,37 @@ const TableContainerEdit = props => {
474
474
  const isEdit = typeof columnOri?.editEnable === 'function' ? columnOri.editEnable(newData[targetRow]) : columnOri.editEnable;
475
475
  if (isEdit) {
476
476
  const columnKey = allCols[targetCol].id;
477
- if (columnOri.type === 'number' && isFormattedNumber(cellValue.trim())) {
478
- const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
479
- const valuePasteFormat = detectSeparators(cellValue.trim());
480
- const cellFormat = getFormat(colFormat, format);
481
- const thousandSeparator = valuePasteFormat?.thousandSeparator ?? cellFormat?.thousandSeparator;
482
- const decimalSeparator = valuePasteFormat?.decimalSeparator ?? cellFormat?.decimalSeparator;
483
- const dec = cellFormat?.decimalScale;
484
- const numericFormatProps = {
485
- thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
486
- decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
487
- allowNegative: cellFormat?.allowNegative ?? true,
488
- prefix: cellFormat?.prefix,
489
- suffix: cellFormat?.suffix,
490
- decimalScale: dec,
491
- fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
492
- };
493
- const val = removeNumericFormat(cellValue.trim(), undefined, numericFormatProps);
494
- newData[targetRow] = {
495
- ...newData[targetRow],
496
- [columnKey]: Number(val)
497
- };
477
+
478
+ // if (columnOri.type === 'number' && isFormattedNumber(cellValue.trim())) {
479
+ if (columnOri.type === 'number') {
480
+ if (cellValue.trim() === '') {
481
+ newData[targetRow] = {
482
+ ...newData[targetRow],
483
+ [columnKey]: null
484
+ };
485
+ }
486
+ if (isFormattedNumber(cellValue.trim())) {
487
+ const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
488
+ const valuePasteFormat = detectSeparators(cellValue.trim());
489
+ const cellFormat = getFormat(colFormat, format);
490
+ const thousandSeparator = valuePasteFormat?.thousandSeparator ?? cellFormat?.thousandSeparator;
491
+ const decimalSeparator = valuePasteFormat?.decimalSeparator ?? cellFormat?.decimalSeparator;
492
+ const dec = cellFormat?.decimalScale;
493
+ const numericFormatProps = {
494
+ thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
495
+ decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
496
+ allowNegative: cellFormat?.allowNegative ?? true,
497
+ prefix: cellFormat?.prefix,
498
+ suffix: cellFormat?.suffix,
499
+ decimalScale: dec,
500
+ fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
501
+ };
502
+ const val = removeNumericFormat(cellValue.trim(), undefined, numericFormatProps);
503
+ newData[targetRow] = {
504
+ ...newData[targetRow],
505
+ [columnKey]: Number(val)
506
+ };
507
+ }
498
508
  } else {
499
509
  newData[targetRow] = {
500
510
  ...newData[targetRow],
@@ -153,3 +153,4 @@ export declare function toggleRowAndChildren(row: Row<any>, isSelected?: boolean
153
153
  export declare function countUnselectedChildren(row: Row<any>): number;
154
154
  export declare function removeDuplicatesByKey(arr: any[], key?: string): any[];
155
155
  export declare const getTableHeight: (height?: number, minHeight?: number) => number;
156
+ export declare const convertFlatColumn1: (array: ColumnsTable) => ColumnsTable[];
@@ -2266,4 +2266,16 @@ export const getTableHeight = (height, minHeight) => {
2266
2266
  // return minHeight
2267
2267
  // }
2268
2268
  }
2269
+ };
2270
+ export const convertFlatColumn1 = array => {
2271
+ const tmp = [...array];
2272
+ let result = [];
2273
+ tmp.forEach(item => {
2274
+ if (item.children) {
2275
+ result = result.concat(convertFlatColumn1(item.children));
2276
+ } else {
2277
+ result.push(item);
2278
+ }
2279
+ });
2280
+ return result;
2269
2281
  };
@@ -16,7 +16,7 @@ $cell-selected-bg: #F3F8FF !default;
16
16
  $cell-index-selected-bg: #1869E6 !default;
17
17
  //$cell-index-focus-bg: #CEDBEF !default;
18
18
  $cell-index-focus-bg: #E6EFFD !default;
19
- $rowSelectedHoverBg: 'ui-rc' !default;
19
+ // $rowSelectedHoverBg: 'ui-rc' !default;
20
20
  $boxShadowColor: rgba(5, 5, 5, 0.09) !default;
21
21
  $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
22
22
 
@@ -546,9 +546,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
546
546
  // ------------ select ---------------
547
547
 
548
548
  .#{$prefix}-table-select-single .#{$prefix}-table-select-selector,
549
- .#{$prefix}-select-single .#{$prefix}-select-selector {
549
+ .#{$prefix}-select-single .#{$prefix}-select-selector,
550
+ .ui-rc-table-select-selector {
550
551
 
551
- border-radius: 0;
552
+ border-radius: 0 !important;
552
553
 
553
554
  }
554
555
 
@@ -19,6 +19,7 @@ var _Grid = _interopRequireDefault(require("./table/Grid"));
19
19
  var _utils = require("./hook/utils");
20
20
  var _useColumns = require("./hook/useColumns");
21
21
  var _convert = require("./hook/convert");
22
+ var _hooks = require("../grid-component/hooks");
22
23
  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); }
23
24
  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; }
24
25
  // import en from "rc-master-ui/es/date-picker/locale/en_US"
@@ -70,6 +71,7 @@ const InternalTable = props => {
70
71
  groupColumns,
71
72
  selectionSettings,
72
73
  expandable,
74
+ onChooseColumns,
73
75
  // contextMenuClick,
74
76
  // contextMenuOpen,
75
77
  height,
@@ -180,6 +182,11 @@ const InternalTable = props => {
180
182
  const aa = (0, _utils.flatColumns2)(columns).map(it => it.field);
181
183
  const rsss = (0, _utils.getDiffent2Array)(aa, keys);
182
184
  setColumnsHiddenKeys(rsss);
185
+ onChooseColumns?.({
186
+ showColumns: (0, _hooks.removeInvisibleColumns)([...cols]),
187
+ columns: [...cols],
188
+ flattenColumns: (0, _utils.convertFlatColumn1)([...cols])
189
+ });
183
190
  }
184
191
  };
185
192
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_Grid.default, (0, _extends2.default)({}, rest, {
@@ -481,27 +481,37 @@ const TableContainerEdit = props => {
481
481
  const isEdit = typeof columnOri?.editEnable === 'function' ? columnOri.editEnable(newData[targetRow]) : columnOri.editEnable;
482
482
  if (isEdit) {
483
483
  const columnKey = allCols[targetCol].id;
484
- if (columnOri.type === 'number' && (0, _utils.isFormattedNumber)(cellValue.trim())) {
485
- const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
486
- const valuePasteFormat = (0, _utils.detectSeparators)(cellValue.trim());
487
- const cellFormat = (0, _utils.getFormat)(colFormat, format);
488
- const thousandSeparator = valuePasteFormat?.thousandSeparator ?? cellFormat?.thousandSeparator;
489
- const decimalSeparator = valuePasteFormat?.decimalSeparator ?? cellFormat?.decimalSeparator;
490
- const dec = cellFormat?.decimalScale;
491
- const numericFormatProps = {
492
- thousandSeparator: (0, _utils.checkThousandSeparator)(thousandSeparator, decimalSeparator),
493
- decimalSeparator: (0, _utils.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
494
- allowNegative: cellFormat?.allowNegative ?? true,
495
- prefix: cellFormat?.prefix,
496
- suffix: cellFormat?.suffix,
497
- decimalScale: dec,
498
- fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
499
- };
500
- const val = (0, _reactNumericComponent.removeNumericFormat)(cellValue.trim(), undefined, numericFormatProps);
501
- newData[targetRow] = {
502
- ...newData[targetRow],
503
- [columnKey]: Number(val)
504
- };
484
+
485
+ // if (columnOri.type === 'number' && isFormattedNumber(cellValue.trim())) {
486
+ if (columnOri.type === 'number') {
487
+ if (cellValue.trim() === '') {
488
+ newData[targetRow] = {
489
+ ...newData[targetRow],
490
+ [columnKey]: null
491
+ };
492
+ }
493
+ if ((0, _utils.isFormattedNumber)(cellValue.trim())) {
494
+ const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
495
+ const valuePasteFormat = (0, _utils.detectSeparators)(cellValue.trim());
496
+ const cellFormat = (0, _utils.getFormat)(colFormat, format);
497
+ const thousandSeparator = valuePasteFormat?.thousandSeparator ?? cellFormat?.thousandSeparator;
498
+ const decimalSeparator = valuePasteFormat?.decimalSeparator ?? cellFormat?.decimalSeparator;
499
+ const dec = cellFormat?.decimalScale;
500
+ const numericFormatProps = {
501
+ thousandSeparator: (0, _utils.checkThousandSeparator)(thousandSeparator, decimalSeparator),
502
+ decimalSeparator: (0, _utils.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
503
+ allowNegative: cellFormat?.allowNegative ?? true,
504
+ prefix: cellFormat?.prefix,
505
+ suffix: cellFormat?.suffix,
506
+ decimalScale: dec,
507
+ fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
508
+ };
509
+ const val = (0, _reactNumericComponent.removeNumericFormat)(cellValue.trim(), undefined, numericFormatProps);
510
+ newData[targetRow] = {
511
+ ...newData[targetRow],
512
+ [columnKey]: Number(val)
513
+ };
514
+ }
505
515
  } else {
506
516
  newData[targetRow] = {
507
517
  ...newData[targetRow],
@@ -153,3 +153,4 @@ export declare function toggleRowAndChildren(row: Row<any>, isSelected?: boolean
153
153
  export declare function countUnselectedChildren(row: Row<any>): number;
154
154
  export declare function removeDuplicatesByKey(arr: any[], key?: string): any[];
155
155
  export declare const getTableHeight: (height?: number, minHeight?: number) => number;
156
+ export declare const convertFlatColumn1: (array: ColumnsTable) => ColumnsTable[];
@@ -17,7 +17,7 @@ exports.compareDate = compareDate;
17
17
  exports.compareDates = compareDates;
18
18
  exports.convertArrayWithIndent = void 0;
19
19
  exports.convertColumnsToTreeData = convertColumnsToTreeData;
20
- exports.convertFilters = exports.convertDayjsToDate = exports.convertDateToDayjs = void 0;
20
+ exports.convertFlatColumn1 = exports.convertFilters = exports.convertDayjsToDate = exports.convertDateToDayjs = void 0;
21
21
  exports.convertFormat = convertFormat;
22
22
  exports.convertToObjTrue = exports.convertToObj = exports.convertLabelToTitle = void 0;
23
23
  exports.countUnselectedChildren = countUnselectedChildren;
@@ -2388,4 +2388,17 @@ const getTableHeight = (height, minHeight) => {
2388
2388
  // }
2389
2389
  }
2390
2390
  };
2391
- exports.getTableHeight = getTableHeight;
2391
+ exports.getTableHeight = getTableHeight;
2392
+ const convertFlatColumn1 = array => {
2393
+ const tmp = [...array];
2394
+ let result = [];
2395
+ tmp.forEach(item => {
2396
+ if (item.children) {
2397
+ result = result.concat(convertFlatColumn1(item.children));
2398
+ } else {
2399
+ result.push(item);
2400
+ }
2401
+ });
2402
+ return result;
2403
+ };
2404
+ exports.convertFlatColumn1 = convertFlatColumn1;
@@ -16,7 +16,7 @@ $cell-selected-bg: #F3F8FF !default;
16
16
  $cell-index-selected-bg: #1869E6 !default;
17
17
  //$cell-index-focus-bg: #CEDBEF !default;
18
18
  $cell-index-focus-bg: #E6EFFD !default;
19
- $rowSelectedHoverBg: 'ui-rc' !default;
19
+ // $rowSelectedHoverBg: 'ui-rc' !default;
20
20
  $boxShadowColor: rgba(5, 5, 5, 0.09) !default;
21
21
  $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
22
22
 
@@ -546,9 +546,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
546
546
  // ------------ select ---------------
547
547
 
548
548
  .#{$prefix}-table-select-single .#{$prefix}-table-select-selector,
549
- .#{$prefix}-select-single .#{$prefix}-select-selector {
549
+ .#{$prefix}-select-single .#{$prefix}-select-selector,
550
+ .ui-rc-table-select-selector {
550
551
 
551
- border-radius: 0;
552
+ border-radius: 0 !important;
552
553
 
553
554
  }
554
555
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.44",
3
+ "version": "1.8.46",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",