es-grid-template 1.3.6 → 1.3.7

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 CHANGED
@@ -49,6 +49,15 @@
49
49
  .ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell {
50
50
  line-height: 22px;
51
51
  }
52
+ .ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell:focus-visible {
53
+ outline: none;
54
+ }
55
+ .ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell.disable {
56
+ background-color: #f0f0f0;
57
+ }
58
+ .ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell.selected {
59
+ background-color: #E6EFFD;
60
+ }
52
61
  .ui-rc-table-wrapper .ui-rc-table-tbody .ui-rc-table-cell .ui-rc-table-cell-content {
53
62
  line-height: 22px;
54
63
  }
@@ -207,26 +216,34 @@
207
216
  top: 8px;
208
217
  left: 8px;
209
218
  }
219
+ .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.rc-ui-cell-index.focus {
220
+ background-color: #CEDBEF;
221
+ font-weight: 500;
222
+ }
223
+ .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.rc-ui-cell-index.selected {
224
+ background-color: #0550C5;
225
+ color: #fff;
226
+ }
210
227
  .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-border-top {
211
228
  border-bottom: 1px solid #0550C5;
212
229
  }
213
230
  .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-border-bottom {
214
231
  border-bottom: 1px solid #0550C5;
215
232
  }
216
- .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-paste-border-bottom {
217
- border-bottom: 1px dashed #949494;
218
- }
219
233
  .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-border-left {
220
234
  border-inline-end: 1px solid #0550C5;
221
235
  }
222
- .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-paste-border-left {
223
- border-inline-end: 1px dashed #949494;
236
+ .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-border-right {
237
+ border-inline-end: 1px solid #0550C5;
224
238
  }
225
239
  .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-paste-border-top {
226
- border-bottom: 1px dashed #949494 !important;
240
+ border-bottom: 1px dashed #949494;
227
241
  }
228
- .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-border-right {
229
- border-inline-end: 1px solid #0550C5;
242
+ .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-paste-border-bottom {
243
+ border-bottom: 1px dashed #949494;
244
+ }
245
+ .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-paste-border-left {
246
+ border-inline-end: 1px dashed #949494;
230
247
  }
231
248
  .ui-rc-table-wrapper.grid-editable .ui-rc-table .ui-rc-table-tbody .rc-ui-cell-editable.cell-editable.cell-paste-border-right {
232
249
  border-inline-end: 1px dashed #949494;
@@ -286,8 +303,11 @@
286
303
  height: 10px;
287
304
  position: absolute;
288
305
  cursor: crosshair;
289
- right: 0;
290
- bottom: 0;
306
+ right: -1px;
307
+ bottom: -1px;
308
+ }
309
+ .ui-rc-table-wrapper.grid-editable .ui-rc_cell-content .dragging-point.hidden {
310
+ display: none;
291
311
  }
292
312
  .ui-rc-table-wrapper.grid-editable .ui-rc_cell-content .dragging-point .dot-point {
293
313
  position: absolute;
@@ -295,15 +315,12 @@
295
315
  height: 8px;
296
316
  border-radius: 6px;
297
317
  background-color: #0550C5;
298
- bottom: -4px;
299
- right: -4px;
318
+ bottom: -3px;
319
+ right: -3px;
300
320
  }
301
321
  .ui-rc-table-wrapper.grid-editable .ui-rc_cell-content.selected {
302
322
  background-color: #E6EFFD;
303
323
  }
304
- .ui-rc-table-wrapper.grid-editable .ui-rc_cell-content.disable {
305
- background-color: #f0f0f0;
306
- }
307
324
  .ui-rc-table-wrapper.grid-editable .ui-rc_cell-content--index.focus {
308
325
  background-color: #CEDBEF;
309
326
  }
package/assets/index.scss CHANGED
@@ -144,6 +144,19 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
144
144
 
145
145
  .#{$prefix}-table-cell {
146
146
  line-height: 22px;
147
+ &:focus-visible {
148
+ outline: none;
149
+ }
150
+
151
+
152
+ &.disable {
153
+ background-color: #f0f0f0;
154
+ }
155
+
156
+ &.selected {
157
+ //background: red;
158
+ background-color: $cell-selected-bg;
159
+ }
147
160
 
148
161
  .ui-rc-table-cell-content {
149
162
  line-height: 22px;
@@ -406,7 +419,20 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
406
419
  left: 8px;
407
420
  }
408
421
 
422
+ &.rc-ui-cell-index {
423
+ &.focus {
424
+ background-color: $cell-index-focus-bg;
425
+ font-weight: 500;
426
+ }
427
+ &.selected {
428
+ background-color: $cell-index-selected-bg;
429
+ color: #fff;
430
+ //font-weight: 500;
431
+ }
432
+ }
433
+
409
434
  &.cell-editable {
435
+
410
436
  &.cell-border-top {
411
437
  border-bottom: 1px solid $border-selected-color;
412
438
  }
@@ -415,29 +441,31 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
415
441
  border-bottom: 1px solid $border-selected-color;
416
442
  }
417
443
 
418
- &.cell-paste-border-bottom {
419
- border-bottom: 1px dashed #949494;
420
- }
421
-
422
444
  &.cell-border-left {
423
445
  border-inline-end: 1px solid $border-selected-color;
424
446
  }
425
447
 
426
- &.cell-paste-border-left {
427
- border-inline-end: 1px dashed #949494;
448
+ &.cell-border-right {
449
+ border-inline-end: 1px solid $border-selected-color;
428
450
  }
451
+
429
452
  &.cell-paste-border-top {
430
- border-bottom: 1px dashed #949494 !important;
453
+ border-bottom: 1px dashed #949494;
431
454
  }
432
455
 
433
- &.cell-border-right {
434
- border-inline-end: 1px solid $border-selected-color;
456
+ &.cell-paste-border-bottom {
457
+ border-bottom: 1px dashed #949494;
458
+ }
459
+
460
+ &.cell-paste-border-left {
461
+ border-inline-end: 1px dashed #949494;
435
462
  }
436
463
 
437
464
  &.cell-paste-border-right {
438
465
  border-inline-end: 1px dashed #949494;
439
466
  }
440
467
 
468
+
441
469
  &.#{$prefix}-table-cell-fix-left {
442
470
  &:has(.ui-rc_cell-content.selected) {
443
471
  }
@@ -620,18 +648,22 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
620
648
  height: 10px;
621
649
  position: absolute;
622
650
  cursor: crosshair;
623
- right: 0;
624
- bottom: 0;
651
+ right: -1px;
652
+ bottom: -1px;
625
653
  //background: red;
626
654
 
655
+ &.hidden {
656
+ display: none;
657
+ }
658
+
627
659
  .dot-point {
628
660
  position: absolute;
629
661
  width: 8px;
630
662
  height: 8px;
631
663
  border-radius: 6px;
632
664
  background-color: $border-selected-color;
633
- bottom: -4px;
634
- right: -4px;
665
+ bottom: -3px;
666
+ right: -3px;
635
667
  }
636
668
 
637
669
  }
@@ -641,9 +673,9 @@ $fontFamily: "Montserrat",Helvetica,Arial,serif !default;
641
673
  background-color: $cell-selected-bg;
642
674
  }
643
675
 
644
- .ui-rc_cell-content.disable {
645
- background-color: #f0f0f0;
646
- }
676
+ //.ui-rc_cell-content.disable {
677
+ // background-color: #f0f0f0;
678
+ //}
647
679
 
648
680
  .ui-rc_cell-content--index {
649
681
  &.focus {
@@ -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 {};
@@ -2,4 +2,4 @@ import styled from "styled-components";
2
2
  export const GridStyle = styled.div.withConfig({
3
3
  displayName: "GridStyle",
4
4
  componentId: "es-grid-template__sc-sueu2e-0"
5
- })([".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);
5
+ })([".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);
@@ -3,13 +3,16 @@ import React, { Fragment } from 'react';
3
3
  import { createStyles } from 'antd-style';
4
4
  import { numericFormatter } from "react-numeric-component";
5
5
  import { Empty, Table, Toolbar } from "rc-master-ui";
6
+ // import Table from "../../core/table"
7
+
6
8
  import 'dayjs/locale/es';
7
9
  import 'dayjs/locale/vi';
8
10
  import ContextMenu from "./ContextMenu";
9
11
  import classNames from "classnames";
10
12
  import { checkDecimalSeparator, checkThousandSeparator,
11
13
  // filterDataByColumns2,
12
- filterDataByColumns3,
14
+ // filterDataByColumns3,
15
+ filterDataByColumns4,
13
16
  // convertFlatColumn,
14
17
  isEmpty,
15
18
  // newGuid,
@@ -365,8 +368,10 @@ const TableGrid = props => {
365
368
  loading: {
366
369
  spinning: columns && columns.length === 0 || loading === true,
367
370
  indicator: /*#__PURE__*/React.createElement(ComponentSpinner, null)
368
- },
369
- dataSource: columns && columns.length > 0 ? filterDataByColumns3(dataSource, filterStates) : []
371
+ }
372
+ // dataSource={columns && columns.length > 0 ? filterDataByColumns3(dataSource, filterStates) : []}
373
+ ,
374
+ dataSource: columns && columns.length > 0 ? filterDataByColumns4(dataSource, filterStates) : []
370
375
  // dataSource={columns && columns.length > 0 && loading !== true ? dataSource : []}
371
376
  // className={styles.customTable}
372
377
  ,
@@ -391,17 +396,16 @@ const TableGrid = props => {
391
396
  },
392
397
  rowSelection: columns && columns.length === 0 ? undefined : {
393
398
  ...selectionSettings,
394
- type: selectionSettings?.mode === 'checkbox' || type === 'multiple' ? 'checkbox' : "radio",
395
- columnWidth: !mode ? 0.0000001 : columnWidth ?? 50,
399
+ // type: selectionSettings?.mode,
400
+ type: mode,
401
+ columnWidth: columnWidth ?? 50,
396
402
  onChange: onSelectChange,
397
403
  // selectedRowKeys: mode === 'checkbox' && type === 'single' ? selectedRowKeys : undefined,
398
404
  selectedRowKeys: mergedSelectedKeys,
399
- defaultSelectedRowKeys: selectionSettings?.defaultSelectedRowKeys,
405
+ // defaultSelectedRowKeys: selectionSettings?.defaultSelectedRowKeys,
406
+ defaultSelectedRowKeys: defaultSelectedRowKeys,
400
407
  preserveSelectedRowKeys: true,
401
- // ...rowSelection,
402
- // checkStrictly: false,
403
-
404
- hideSelectAll: !type || type === 'single' || selectionSettings?.mode === 'radio' ? true : hideSelectAll ?? type !== 'multiple'
408
+ hideSelectAll: !type || type === 'single' || mode === 'radio' ? true : hideSelectAll ?? type !== 'multiple'
405
409
  }
406
410
 
407
411
  // onScroll={() => {
@@ -418,7 +422,7 @@ const TableGrid = props => {
418
422
  }
419
423
  return /*#__PURE__*/React.createElement(Table.Summary, {
420
424
  fixed: true
421
- }, /*#__PURE__*/React.createElement(Table.Summary.Row, null, flatColumns([Table.SELECTION_COLUMN, ...columns]).filter(col => col.hidden !== true).map((col, index) => {
425
+ }, /*#__PURE__*/React.createElement(Table.Summary.Row, null, flatColumns(!!mode ? [Table.SELECTION_COLUMN, ...columns] : [...columns]).filter(col => col.hidden !== true).map((col, index) => {
422
426
  const thousandSeparator = col.format?.thousandSeparator ? col.format?.thousandSeparator : format?.thousandSeparator;
423
427
  const decimalSeparator = col.format?.decimalSeparator ? col.format?.decimalSeparator : format?.decimalSeparator;
424
428
  const dec = col.format?.decimalScale || col.format?.decimalScale === 0 ? col.format?.decimalScale : format?.decimalScale;
@@ -442,7 +446,7 @@ const TableGrid = props => {
442
446
  }, col.summaryTemplate ? col.summaryTemplate(cellValue, col.key) : numericFormatter(cellValue, numericFormatProps));
443
447
  })));
444
448
  },
445
- pagination: !pagination || pagination && pagination.onChange ? false : {
449
+ pagination: !pagination || pagination && pagination?.onChange ? false : {
446
450
  showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} items`,
447
451
  ...pagination
448
452
  },
@@ -77,7 +77,7 @@ export const getValueCell = (column, value, format) => {
77
77
  // const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? parseFloat(Number(value).toFixed(dec)).toString() : value.toString()) : '0'
78
78
 
79
79
  const tmpval = typeof value === 'string' ? Number(value) : value;
80
- const contentNumber = !isEmpty(value) ? dec || dec === 0 ? tmpval.toFixed(dec) : tmpval.toString() : '0';
80
+ const contentNumber = !isEmpty(value) ? dec || dec === 0 ? parseFloat(tmpval.toFixed(dec)).toString() : tmpval.toString() : '0';
81
81
  const numericFormatProps = {
82
82
  thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
83
83
  decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
@@ -154,8 +154,8 @@ const useColumns = config => {
154
154
  const transformColumns = useCallback(columns => {
155
155
  // >>>>>>>>>>> Support selection
156
156
  const cloneColumns = [...columns];
157
- const firstNonGroupColumn = flatColumns2(cloneColumns).find(col => col.field && col.field !== '#' && col.field !== 'index' && !groupColumns?.includes(col.field) && col.hidden !== true);
158
- const nonGroupColumns = flatColumns2(cloneColumns).filter(col => col.field && col.field !== '#' && col.field !== 'index' && !groupColumns?.includes(col.field) && col.hidden !== true);
157
+ const firstNonGroupColumn = flatColumns2(cloneColumns).find(col => col.field && col.field !== '#' && !groupColumns?.includes(col.field) && col.hidden !== true);
158
+ const nonGroupColumns = flatColumns2(cloneColumns).filter(col => col.field && col.field !== '#' && !groupColumns?.includes(col.field) && col.hidden !== true);
159
159
 
160
160
  // ===================== Render =====================
161
161
 
@@ -191,19 +191,18 @@ const useColumns = config => {
191
191
  children: convertColumns(transformedColumn.children)
192
192
  };
193
193
  }
194
- if (["index", "#"].includes(col.field)) {
194
+ if (transformedColumn.field === '#') {
195
195
  return {
196
196
  ...transformedColumn,
197
197
  onCell: () => ({
198
198
  className: 'cell-number'
199
199
  }),
200
200
  render: (val, record) => {
201
- // return rowIndex + 1
202
201
  return findItemPath(dataSource, record, rowKey);
203
202
  }
204
203
  };
205
204
  }
206
- if (col.field === 'command') {
205
+ if (transformedColumn.field === 'command') {
207
206
  return {
208
207
  ...transformedColumn,
209
208
  onCell: () => ({
@@ -289,6 +288,9 @@ const useColumns = config => {
289
288
  }
290
289
  if (col.field === firstNonGroupColumn?.field && record.children) {
291
290
  const currentGroupColumn = flatColumns2(cols).find(it => it.field === record.field);
291
+ if (currentGroupColumn?.template) {
292
+ return renderContent(currentGroupColumn, record[record.field], record, rowIndex, format);
293
+ }
292
294
  return /*#__PURE__*/React.createElement("span", null, currentGroupColumn?.headerText, ": ", renderContent(currentGroupColumn, record[record.field], record, rowIndex, format));
293
295
  }
294
296
  return renderContent(col, value, record, rowIndex, format);
@@ -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,15 @@ 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 onAddClassBgSelectedCell: (selectedCells: any, id?: string) => void;
112
+ export declare const onRemoveClassSelectedCell: (selectedCells: any, id?: string, rowsSelected?: any) => void;
113
+ export declare const addClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
114
+ export declare const removeClassBorderPasteCell: (pasteCells: any, type: 'up' | 'down', id?: string) => void;
115
+ export declare const addClassCellIndexSelected: (rowsSelected: any, id?: string) => void;
116
+ export declare const removeClassCellIndexSelected: (rowsSelected: any, id?: string) => void;
117
+ export declare const showDraggingPoint: (selectedCells: any, id?: any) => void;
118
+ export declare const hideDraggingPoint: (selectedCells: any, id?: any) => void;