es-grid-template 1.3.6 → 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.
Files changed (31) hide show
  1. package/assets/index.css +35 -24
  2. package/assets/index.scss +57 -21
  3. package/es/grid-component/EditableCell.js +12 -11
  4. package/es/grid-component/GridStyle.d.ts +5 -3
  5. package/es/grid-component/GridStyle.js +1 -1
  6. package/es/grid-component/TableGrid.js +28 -21
  7. package/es/grid-component/hooks/columns/index.d.ts +1 -1
  8. package/es/grid-component/hooks/columns/index.js +15 -14
  9. package/es/grid-component/hooks/useColumns.js +12 -9
  10. package/es/grid-component/hooks/utils.d.ts +19 -4
  11. package/es/grid-component/hooks/utils.js +377 -26
  12. package/es/grid-component/styles.scss +57 -21
  13. package/es/grid-component/table/Grid.js +1 -1
  14. package/es/grid-component/table/GridEdit.js +383 -268
  15. package/es/grid-component/table/Group.js +1 -1
  16. package/es/grid-component/type.d.ts +4 -4
  17. package/lib/grid-component/EditableCell.js +12 -11
  18. package/lib/grid-component/GridStyle.d.ts +5 -3
  19. package/lib/grid-component/GridStyle.js +1 -1
  20. package/lib/grid-component/TableGrid.js +26 -20
  21. package/lib/grid-component/hooks/columns/index.d.ts +1 -1
  22. package/lib/grid-component/hooks/columns/index.js +15 -14
  23. package/lib/grid-component/hooks/useColumns.js +12 -9
  24. package/lib/grid-component/hooks/utils.d.ts +19 -4
  25. package/lib/grid-component/hooks/utils.js +401 -33
  26. package/lib/grid-component/styles.scss +57 -21
  27. package/lib/grid-component/table/Grid.js +1 -1
  28. package/lib/grid-component/table/GridEdit.js +382 -259
  29. package/lib/grid-component/table/Group.js +1 -1
  30. package/lib/grid-component/type.d.ts +4 -4
  31. package/package.json +2 -2
@@ -96,7 +96,7 @@ const Group = props => {
96
96
  })));
97
97
  };
98
98
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
99
- heightTable: height,
99
+ $heightTable: height,
100
100
  style: {
101
101
  position: 'relative'
102
102
  }
@@ -84,7 +84,7 @@ export type ToolbarClick = {
84
84
  item: any;
85
85
  column: any;
86
86
  };
87
- export type ColumnTable<RecordType = AnyObject> = Omit<RcColumnType<RecordType>, 'headerTemplate' | 'title'> & {
87
+ export type ColumnTable<RecordType = AnyObject> = Omit<RcColumnType<RecordType>, 'headerTemplate' | 'title' | 'format' | 'commandItems'> & {
88
88
  field?: string;
89
89
  key?: any;
90
90
  type?: IColumnType;
@@ -93,7 +93,7 @@ export type ColumnTable<RecordType = AnyObject> = Omit<RcColumnType<RecordType>,
93
93
  isSummary?: boolean;
94
94
  summaryTemplate?: (data: number, key: string) => ReactElement | ReactNode;
95
95
  maxWidth?: string | number;
96
- format?: IFormat;
96
+ format?: IFormat | ((rowData: any) => IFormat);
97
97
  allowFiltering?: boolean;
98
98
  allowSorter?: boolean;
99
99
  operator?: FilterOperator;
@@ -207,12 +207,12 @@ export type GridTableProps<RecordType = AnyObject> = TableProps<RecordType>;
207
207
  export interface CommandItem {
208
208
  id: string;
209
209
  type?: string;
210
- visible?: boolean;
210
+ visible?: boolean | ((record: any) => boolean);
211
211
  title: string;
212
212
  color?: 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
213
213
  tooltip?: string;
214
214
  icon?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
215
- template?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
215
+ template?: ReactNode | ReactElement | ((record: any) => ReactNode | ReactElement);
216
216
  client?: boolean;
217
217
  confirmDialog?: boolean;
218
218
  }
@@ -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, column);
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, column);
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, column);
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, column);
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 = column.format?.thousandSeparator ? column.format?.thousandSeparator : format?.thousandSeparator;
764
- const decimalSeparator = column.format?.decimalSeparator ? column.format?.decimalSeparator : format?.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: !(0, _hooks.isEmpty)(column.format?.decimalScale) ? column.format?.decimalScale : undefined,
773
- fixedDecimalScale: !(0, _hooks.isEmpty)(column.format?.fixedDecimalScale) ? column.format?.fixedDecimalScale : false,
774
- allowNegative: column.format?.allowNegative ?? true,
775
- prefix: column.format?.prefix ?? undefined,
776
- suffix: column.format?.suffix ?? undefined
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}`
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
- heightTable?: number | string;
4
- }>> & string;
2
+ interface GridProps {
3
+ $heightTable?: number | string;
4
+ }
5
+ export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, GridProps>> & string;
6
+ export {};
@@ -9,4 +9,4 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
  const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
10
10
  displayName: "GridStyle",
11
11
  componentId: "es-grid-template__sc-sueu2e-0"
12
- })([".ui-rc-table-container{min-height:", ";}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.heightTable ? typeof props.heightTable === 'string' ? props.heightTable : `${props.heightTable}px` : undefined);
12
+ })([".ui-rc-table-container{min-height:", ";}.ui-rc-toolbar-bottom{position:relative;padding:.25rem 1rem;background-color:#ffffff;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}.toolbar-button{border-radius:0;.ant-btn{border-radius:0;}}}.ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;background-color:#ffffff;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:50px;bottom:0;visibility:visible;right:0;}&.pagination-template{position:relative;&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:100%;bottom:0;visibility:visible;right:0;}}}.react-resizable{position:relative;background-clip:padding-box;}.rc-resizable-handle{position:absolute;right:0px;bottom:0;z-index:1;width:5px;height:100%;cursor:col-resize;&.none{cursor:auto;display:none;}}"], props => props.$heightTable ? typeof props.$heightTable === 'string' ? props.$heightTable : `${props.$heightTable}px` : undefined);
@@ -24,6 +24,8 @@ var _AdvanceFilter = _interopRequireDefault(require("./AdvanceFilter"));
24
24
  var _reactTooltip = require("react-tooltip");
25
25
  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); }
26
26
  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; }
27
+ // import Table from "../../core/table"
28
+
27
29
  // import {ConfigProvider} from "antd";
28
30
 
29
31
  const convertFilters = filters => {
@@ -366,8 +368,10 @@ const TableGrid = props => {
366
368
  loading: {
367
369
  spinning: columns && columns.length === 0 || loading === true,
368
370
  indicator: /*#__PURE__*/_react.default.createElement(_LoadingSpinner.default, null)
369
- },
370
- dataSource: columns && columns.length > 0 ? (0, _hooks.filterDataByColumns3)(dataSource, filterStates) : []
371
+ }
372
+ // dataSource={columns && columns.length > 0 ? filterDataByColumns3(dataSource, filterStates) : []}
373
+ ,
374
+ dataSource: columns && columns.length > 0 ? (0, _hooks.filterDataByColumns4)(dataSource, filterStates) : []
371
375
  // dataSource={columns && columns.length > 0 && loading !== true ? dataSource : []}
372
376
  // className={styles.customTable}
373
377
  ,
@@ -392,21 +396,20 @@ const TableGrid = props => {
392
396
  },
393
397
  rowSelection: columns && columns.length === 0 ? undefined : {
394
398
  ...selectionSettings,
395
- type: selectionSettings?.mode === 'checkbox' || type === 'multiple' ? 'checkbox' : "radio",
396
- columnWidth: !mode ? 0.0000001 : columnWidth ?? 50,
399
+ // type: selectionSettings?.mode,
400
+ type: mode,
401
+ columnWidth: columnWidth ?? 50,
397
402
  onChange: onSelectChange,
398
403
  // selectedRowKeys: mode === 'checkbox' && type === 'single' ? selectedRowKeys : undefined,
399
404
  selectedRowKeys: mergedSelectedKeys,
400
- defaultSelectedRowKeys: selectionSettings?.defaultSelectedRowKeys,
405
+ // defaultSelectedRowKeys: selectionSettings?.defaultSelectedRowKeys,
406
+ defaultSelectedRowKeys: defaultSelectedRowKeys,
401
407
  preserveSelectedRowKeys: true,
402
- // ...rowSelection,
403
- // checkStrictly: false,
404
-
405
- hideSelectAll: !type || type === 'single' || selectionSettings?.mode === 'radio' ? true : hideSelectAll ?? type !== 'multiple'
408
+ hideSelectAll: !type || type === 'single' || mode === 'radio' ? true : hideSelectAll ?? type !== 'multiple'
406
409
  }
407
410
 
408
- // onScroll={() => {
409
- // setMenuVisible(false)
411
+ // onScroll={(event) => {
412
+ // console.log('event', event)
410
413
  // }}
411
414
  ,
412
415
 
@@ -419,21 +422,24 @@ const TableGrid = props => {
419
422
  }
420
423
  return /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table.Summary, {
421
424
  fixed: true
422
- }, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table.Summary.Row, null, (0, _columns.flatColumns)([_rcMasterUi.Table.SELECTION_COLUMN, ...columns]).filter(col => col.hidden !== true).map((col, index) => {
423
- const thousandSeparator = col.format?.thousandSeparator ? col.format?.thousandSeparator : format?.thousandSeparator;
424
- const decimalSeparator = col.format?.decimalSeparator ? col.format?.decimalSeparator : format?.decimalSeparator;
425
- const dec = col.format?.decimalScale || col.format?.decimalScale === 0 ? col.format?.decimalScale : format?.decimalScale;
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 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;
426
432
  const sumValue = col.type === 'number' ? (0, _hooks.sumDataByField)(dataSource, col?.key) : 0;
427
433
  const value = !(0, _hooks.isEmpty)(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
428
434
  const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
429
435
  const numericFormatProps = {
430
436
  thousandSeparator: (0, _hooks.checkThousandSeparator)(thousandSeparator, decimalSeparator),
431
437
  decimalSeparator: (0, _hooks.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
432
- allowNegative: (col.format?.allowNegative ? col.format?.allowNegative : format?.allowNegative) ?? false,
433
- prefix: col.format?.prefix ? col.format?.prefix : format?.prefix,
434
- suffix: col.format?.suffix ? col.format?.suffix : format?.suffix,
438
+ allowNegative: cellFormat?.allowNegative ?? false,
439
+ prefix: cellFormat?.prefix,
440
+ suffix: cellFormat?.suffix,
435
441
  decimalScale: dec,
436
- fixedDecimalScale: (col.format?.fixedDecimalScale ? col.format?.fixedDecimalScale : format?.fixedDecimalScale) ?? false
442
+ fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
437
443
  };
438
444
  return /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table.Summary.Cell, {
439
445
  key: col.key,
@@ -443,7 +449,7 @@ const TableGrid = props => {
443
449
  }, col.summaryTemplate ? col.summaryTemplate(cellValue, col.key) : (0, _reactNumericComponent.numericFormatter)(cellValue, numericFormatProps));
444
450
  })));
445
451
  },
446
- pagination: !pagination || pagination && pagination.onChange ? false : {
452
+ pagination: !pagination || pagination && pagination?.onChange ? false : {
447
453
  showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} items`,
448
454
  ...pagination
449
455
  },
@@ -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,33 +81,33 @@ function flatColumns2(columns
81
81
  const getValueCell = (column, value, format) => {
82
82
  switch (column?.type) {
83
83
  case 'number':
84
- const thousandSeparator = column?.format?.thousandSeparator ? column?.format?.thousandSeparator : format?.thousandSeparator;
85
- const decimalSeparator = column?.format?.decimalSeparator ? column?.format?.decimalSeparator : format?.decimalSeparator;
86
- const dec = column?.format?.decimalScale || column?.format?.decimalScale === 0 ? column?.format?.decimalScale : format?.decimalScale;
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
 
90
90
  const tmpval = typeof value === 'string' ? Number(value) : value;
91
- const contentNumber = !(0, _utils.isEmpty)(value) ? dec || dec === 0 ? tmpval.toFixed(dec) : tmpval.toString() : '0';
91
+ const contentNumber = !(0, _utils.isEmpty)(value) ? dec || dec === 0 ? parseFloat(tmpval.toFixed(dec)).toString() : tmpval.toString() : '0';
92
92
  const numericFormatProps = {
93
93
  thousandSeparator: (0, _utils.checkThousandSeparator)(thousandSeparator, decimalSeparator),
94
94
  decimalSeparator: (0, _utils.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
95
- allowNegative: (column?.format?.allowNegative ? column?.format?.allowNegative : format?.allowNegative) ?? true,
96
- prefix: column?.format?.prefix ? column?.format?.prefix : format?.prefix,
97
- suffix: column?.format?.suffix ? column?.format?.suffix : format?.suffix,
98
- decimalScale: column?.format?.decimalScale || column?.format?.decimalScale === 0 ? column?.format?.decimalScale : format?.decimalScale,
99
- fixedDecimalScale: (column?.format?.fixedDecimalScale ? column?.format?.fixedDecimalScale : format?.fixedDecimalScale) ?? false
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(column?.format?.dateFormat ?? format?.dateFormat ?? 'DD/MM/YYYY') : '';
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(column?.format?.datetimeFormat ?? format?.datetimeFormat ?? 'DD/MM/YYYY HH:mm') : '';
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, column) ?? 'DD/MM/YYYY';
154
- const dateRangeFormat = (0, _utils.getDatepickerFormat)(column?.type, column) ?? 'DD/MM/YYYY';
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) {
@@ -165,8 +165,8 @@ const useColumns = config => {
165
165
  const transformColumns = (0, _react.useCallback)(columns => {
166
166
  // >>>>>>>>>>> Support selection
167
167
  const cloneColumns = [...columns];
168
- const firstNonGroupColumn = (0, _columns.flatColumns2)(cloneColumns).find(col => col.field && col.field !== '#' && col.field !== 'index' && !groupColumns?.includes(col.field) && col.hidden !== true);
169
- const nonGroupColumns = (0, _columns.flatColumns2)(cloneColumns).filter(col => col.field && col.field !== '#' && col.field !== 'index' && !groupColumns?.includes(col.field) && col.hidden !== true);
168
+ const firstNonGroupColumn = (0, _columns.flatColumns2)(cloneColumns).find(col => col.field && col.field !== '#' && !groupColumns?.includes(col.field) && col.hidden !== true);
169
+ const nonGroupColumns = (0, _columns.flatColumns2)(cloneColumns).filter(col => col.field && col.field !== '#' && !groupColumns?.includes(col.field) && col.hidden !== true);
170
170
 
171
171
  // ===================== Render =====================
172
172
 
@@ -202,19 +202,18 @@ const useColumns = config => {
202
202
  children: convertColumns(transformedColumn.children)
203
203
  };
204
204
  }
205
- if (["index", "#"].includes(col.field)) {
205
+ if (transformedColumn.field === '#') {
206
206
  return {
207
207
  ...transformedColumn,
208
208
  onCell: () => ({
209
209
  className: 'cell-number'
210
210
  }),
211
211
  render: (val, record) => {
212
- // return rowIndex + 1
213
212
  return (0, _utils.findItemPath)(dataSource, record, rowKey);
214
213
  }
215
214
  };
216
215
  }
217
- if (col.field === 'command') {
216
+ if (transformedColumn.field === 'command') {
218
217
  return {
219
218
  ...transformedColumn,
220
219
  onCell: () => ({
@@ -289,20 +288,24 @@ const useColumns = config => {
289
288
  };
290
289
  },
291
290
  render: (value, record, rowIndex) => {
291
+ const cellFormat = col.format ? typeof col.format === 'function' ? col.format(record) : col.format : format;
292
292
  if (groupSetting && groupSetting.hiddenColumnGroup === false) {
293
293
  if (record.children) {
294
- return (0, _columns.renderContent)(col, value, record, rowIndex, format);
294
+ return (0, _columns.renderContent)(col, value, record, rowIndex, cellFormat);
295
295
  }
296
296
  if (groupColumns?.includes(col.field)) {
297
297
  return '';
298
298
  }
299
- return (0, _columns.renderContent)(col, value, record, rowIndex, format);
299
+ return (0, _columns.renderContent)(col, value, record, rowIndex, cellFormat);
300
300
  }
301
301
  if (col.field === firstNonGroupColumn?.field && record.children) {
302
302
  const currentGroupColumn = (0, _columns.flatColumns2)(cols).find(it => it.field === record.field);
303
- return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex, format));
303
+ if (currentGroupColumn?.template) {
304
+ return (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex, cellFormat);
305
+ }
306
+ return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", (0, _columns.renderContent)(currentGroupColumn, record[record.field], record, rowIndex, cellFormat));
304
307
  }
305
- return (0, _columns.renderContent)(col, value, record, rowIndex, format);
308
+ return (0, _columns.renderContent)(col, value, record, rowIndex, cellFormat);
306
309
  },
307
310
  hidden: groupSetting && groupSetting.hiddenColumnGroup === false ? transformedColumn.hidden : groupAble && groupColumns && groupColumns.includes(col.field) ? true : transformedColumn.hidden
308
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, col: ColumnTable<any>) => string;
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[];
@@ -83,6 +83,8 @@ export declare const filterDataByColumns: (data: any[], queries: any) => any[];
83
83
  export declare const filterDataByColumns2: (data: any[], queries: any) => any[];
84
84
  export declare const removeFieldRecursive: (data: any[], field: string) => any[];
85
85
  export declare const filterDataByColumns3: (data: any[], queries: any[]) => any[];
86
+ export declare const shouldInclude: (item: any, queries: any[]) => any;
87
+ export declare function filterDataByColumns4(data: any[], queries: any[]): any[];
86
88
  export declare function isDateString(str: any): boolean;
87
89
  export declare function compareDates(date1: any, date2: any): boolean;
88
90
  export declare function compareDate(itemValue: any, value: any): boolean;
@@ -102,5 +104,18 @@ export declare function isBottomMostInRanges(rowIndex: number, colIndex: number,
102
104
  export declare const mergedSets: (arr: any[]) => Set<unknown>;
103
105
  export declare const sortedSetASC: (setValue: any) => Set<unknown>;
104
106
  export declare const sortedSetDSC: (setValue: any) => Set<unknown>;
105
- export declare const onAddClassSelectedCell: (selectedCells: any, id?: string) => void;
106
- export declare const onRemoveClassSelectedCell: (selectedCells: any, id?: string) => void;
107
+ export declare function getBottomRowCells(cellSet: any): any[];
108
+ export declare function getCellsByPosition(cellSet: any, position?: string): any[];
109
+ export declare const addBorderClass: (selectedCells: any, type: string, className: string, id?: string) => void;
110
+ export declare const removeBorderClass: (selectedCells: any, type: string, className: string, id?: string) => void;
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;
116
+ export declare const addClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
117
+ export declare const removeClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
118
+ export declare const addClassCellIndexSelected: (rowsSelected: any, id?: string) => void;
119
+ export declare const removeClassCellIndexSelected: (rowsSelected: any, id?: string) => void;
120
+ export declare const showDraggingPoint: (selectedCells: any, id?: any) => void;
121
+ export declare const hideDraggingPoint: (selectedCells: any, id?: any) => void;