d2coreui 23.0.52 → 23.0.54
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/CHANGELOG.md +40 -0
- package/README.md +154 -0
- package/components/clipboard/clipboardUtils.d.ts +11 -0
- package/components/clipboard/clipboardUtils.js +16 -4
- package/components/clipboard/clipboardUtils.js.map +1 -1
- package/components/codemirror/SyntaxHighlighter.d.ts +13 -0
- package/components/codemirror/SyntaxHighlighter.js +6 -1
- package/components/codemirror/SyntaxHighlighter.js.map +1 -1
- package/components/collapse/expandable.d.ts +10 -0
- package/components/collapse/expandable.js +4 -0
- package/components/collapse/expandable.js.map +1 -1
- package/components/color/colorPicker.d.ts +16 -0
- package/components/color/colorPicker.js +4 -0
- package/components/color/colorPicker.js.map +1 -1
- package/components/color/colorSwatch.d.ts +16 -0
- package/components/color/colorSwatch.js +23 -2
- package/components/color/colorSwatch.js.map +1 -1
- package/components/color/colorUtils.d.ts +9 -0
- package/components/color/colorUtils.js +15 -0
- package/components/color/colorUtils.js.map +1 -1
- package/components/date/dateRangeInput.d.ts +76 -0
- package/components/date/dateRangeInput.js +63 -12
- package/components/date/dateRangeInput.js.map +1 -1
- package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -0
- package/components/date/dateRangeInputAdvancedPanel.js +7 -0
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateRangeInputConfirm.d.ts +18 -0
- package/components/date/dateRangeInputConfirm.js +12 -0
- package/components/date/dateRangeInputConfirm.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +99 -0
- package/components/date/dateTimeInput.js +78 -6
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.d.ts +37 -0
- package/components/date/durationInput.js +26 -3
- package/components/date/durationInput.js.map +1 -1
- package/components/date/savedIntervals.d.ts +63 -0
- package/components/date/savedIntervals.js +37 -0
- package/components/date/savedIntervals.js.map +1 -1
- package/components/date/savedIntervalsDialog.d.ts +13 -0
- package/components/date/savedIntervalsDialog.js +7 -2
- package/components/date/savedIntervalsDialog.js.map +1 -1
- package/components/form/NiceFormItem.d.ts +9 -0
- package/components/form/NiceFormItem.js +4 -0
- package/components/form/NiceFormItem.js.map +1 -1
- package/components/grid/cell/beanAccessor.d.ts +12 -0
- package/components/grid/cell/beanAccessor.js +8 -0
- package/components/grid/cell/beanAccessor.js.map +1 -1
- package/components/grid/cell/bigNumberCellEditor.d.ts +9 -0
- package/components/grid/cell/bigNumberCellEditor.js +19 -0
- package/components/grid/cell/bigNumberCellEditor.js.map +1 -1
- package/components/grid/cell/cellControl.d.ts +4 -0
- package/components/grid/cell/cellControl.js +14 -0
- package/components/grid/cell/cellControl.js.map +1 -1
- package/components/grid/cell/cellEditorUtils.d.ts +6 -0
- package/components/grid/cell/cellEditorUtils.js +6 -0
- package/components/grid/cell/cellEditorUtils.js.map +1 -1
- package/components/grid/cell/customEnumCellEditor.d.ts +6 -0
- package/components/grid/cell/customEnumCellEditor.js +10 -0
- package/components/grid/cell/customEnumCellEditor.js.map +1 -1
- package/components/grid/cell/dataGridCellEditorComponent.d.ts +26 -0
- package/components/grid/cell/dataGridCellEditorComponent.js +21 -0
- package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -1
- package/components/grid/cell/dateCellEditor.d.ts +6 -0
- package/components/grid/cell/dateCellEditor.js +10 -0
- package/components/grid/cell/dateCellEditor.js.map +1 -1
- package/components/grid/cell/dragListenerFeature.d.ts +6 -0
- package/components/grid/cell/dragListenerFeature.js +6 -0
- package/components/grid/cell/dragListenerFeature.js.map +1 -1
- package/components/grid/cell/durationCellEditor.d.ts +6 -0
- package/components/grid/cell/durationCellEditor.js +14 -0
- package/components/grid/cell/durationCellEditor.js.map +1 -1
- package/components/grid/cell/hexaOctetStringCellEditor.d.ts +6 -0
- package/components/grid/cell/hexaOctetStringCellEditor.js +14 -0
- package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
- package/components/grid/cell/hexaValueCellEditor.d.ts +6 -0
- package/components/grid/cell/hexaValueCellEditor.js +14 -0
- package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
- package/components/grid/cell/numberCellEditor.d.ts +6 -0
- package/components/grid/cell/numberCellEditor.js +15 -0
- package/components/grid/cell/numberCellEditor.js.map +1 -1
- package/components/grid/cell/rangeSelector.d.ts +7 -0
- package/components/grid/cell/rangeSelector.js +59 -5
- package/components/grid/cell/rangeSelector.js.map +1 -1
- package/components/grid/cell/simpleStatusTextCellEditor.d.ts +7 -0
- package/components/grid/cell/simpleStatusTextCellEditor.js +11 -0
- package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
- package/components/grid/cell/statusTextCellEditor.d.ts +7 -0
- package/components/grid/cell/statusTextCellEditor.js +17 -0
- package/components/grid/cell/statusTextCellEditor.js.map +1 -1
- package/components/grid/cell/tableDefaultRowStyleRules.d.ts +31 -0
- package/components/grid/cell/tableDefaultRowStyleRules.js +5 -0
- package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
- package/components/grid/cell/textCellEditor.d.ts +6 -0
- package/components/grid/cell/textCellEditor.js +15 -0
- package/components/grid/cell/textCellEditor.js.map +1 -1
- package/components/grid/cell/withAgGridHooks.d.ts +8 -0
- package/components/grid/cell/withAgGridHooks.js +8 -0
- package/components/grid/cell/withAgGridHooks.js.map +1 -1
- package/components/grid/columnUtils.d.ts +10 -1
- package/components/grid/columnUtils.js +11 -0
- package/components/grid/columnUtils.js.map +1 -1
- package/components/grid/config/columnTransfer.d.ts +18 -0
- package/components/grid/config/columnTransfer.js +45 -29
- package/components/grid/config/columnTransfer.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +31 -0
- package/components/grid/config/dataGridEditor.js +14 -2
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/config/rowHeightCalculator.d.ts +11 -0
- package/components/grid/config/rowHeightCalculator.js +11 -0
- package/components/grid/config/rowHeightCalculator.js.map +1 -1
- package/components/grid/config/rowStylePicker.d.ts +19 -0
- package/components/grid/config/rowStylePicker.js +12 -0
- package/components/grid/config/rowStylePicker.js.map +1 -1
- package/components/grid/dataGrid.d.ts +361 -12
- package/components/grid/dataGrid.js +201 -28
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/detail/detailHeaderPanel.d.ts +11 -0
- package/components/grid/detail/detailHeaderPanel.js +5 -0
- package/components/grid/detail/detailHeaderPanel.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +31 -0
- package/components/grid/export/contextMenu.js +8 -0
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/progressPopup.d.ts +21 -0
- package/components/grid/export/progressPopup.js +17 -0
- package/components/grid/export/progressPopup.js.map +1 -1
- package/components/grid/export/worker/pdfExport.js +5 -0
- package/components/grid/export/worker/pdfExport.js.map +1 -1
- package/components/grid/extendedDataGrid.d.ts +249 -4
- package/components/grid/extendedDataGrid.js +160 -19
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/grid/filter/customColumnFilter.d.ts +5 -0
- package/components/grid/filter/customColumnFilter.js +5 -0
- package/components/grid/filter/customColumnFilter.js.map +1 -1
- package/components/grid/filter/dataGridColumnFilter.d.ts +19 -0
- package/components/grid/filter/dataGridColumnFilter.js +19 -0
- package/components/grid/filter/dataGridColumnFilter.js.map +1 -1
- package/components/grid/filter/dateColumnFilter.d.ts +6 -0
- package/components/grid/filter/dateColumnFilter.js +6 -0
- package/components/grid/filter/dateColumnFilter.js.map +1 -1
- package/components/grid/filter/textColumnFilter.d.ts +6 -0
- package/components/grid/filter/textColumnFilter.js +6 -0
- package/components/grid/filter/textColumnFilter.js.map +1 -1
- package/components/grid/filter/wildcardQuickFilterEngine.d.ts +21 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js +21 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -1
- package/components/grid/header/simpleHeader.d.ts +17 -0
- package/components/grid/header/simpleHeader.js +20 -0
- package/components/grid/header/simpleHeader.js.map +1 -1
- package/components/grid/panel/dataGridPagination.d.ts +10 -0
- package/components/grid/panel/dataGridPagination.js +5 -0
- package/components/grid/panel/dataGridPagination.js.map +1 -1
- package/components/grid/panel/loadingOverlay.d.ts +5 -0
- package/components/grid/panel/loadingOverlay.js +4 -0
- package/components/grid/panel/loadingOverlay.js.map +1 -1
- package/components/grid/panel/noRecordsOverlay.d.ts +6 -0
- package/components/grid/panel/noRecordsOverlay.js +5 -0
- package/components/grid/panel/noRecordsOverlay.js.map +1 -1
- package/components/grid/panel/tablePagination.d.ts +4 -0
- package/components/grid/panel/tablePagination.js +4 -0
- package/components/grid/panel/tablePagination.js.map +1 -1
- package/components/icons/dropdownArrow.d.ts +3 -0
- package/components/icons/dropdownArrow.js +2 -0
- package/components/icons/dropdownArrow.js.map +1 -1
- package/components/icons/undoIcon.d.ts +2 -0
- package/components/icons/undoIcon.js +2 -0
- package/components/icons/undoIcon.js.map +1 -1
- package/components/input/autoCompleteInput.d.ts +29 -0
- package/components/input/autoCompleteInput.js +7 -0
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/input/draftUtils.d.ts +7 -0
- package/components/input/draftUtils.js +9 -0
- package/components/input/draftUtils.js.map +1 -1
- package/components/input/hexaFormattedInput.d.ts +9 -0
- package/components/input/hexaFormattedInput.js +3 -0
- package/components/input/hexaFormattedInput.js.map +1 -1
- package/components/input/mask/helpers.d.ts +27 -0
- package/components/input/mask/helpers.js +27 -0
- package/components/input/mask/helpers.js.map +1 -1
- package/components/input/mask/inputMaskCore.d.ts +80 -0
- package/components/input/mask/inputMaskCore.js +90 -0
- package/components/input/mask/inputMaskCore.js.map +1 -1
- package/components/input/mask/pattern.d.ts +24 -0
- package/components/input/mask/pattern.js +26 -0
- package/components/input/mask/pattern.js.map +1 -1
- package/components/input/maskedInput.d.ts +53 -0
- package/components/input/maskedInput.js +44 -4
- package/components/input/maskedInput.js.map +1 -1
- package/components/input/passwordInput.d.ts +7 -0
- package/components/input/passwordInput.js +8 -0
- package/components/input/passwordInput.js.map +1 -1
- package/components/input/simpleAutoComplete.d.ts +6 -0
- package/components/input/simpleAutoComplete.js +6 -0
- package/components/input/simpleAutoComplete.js.map +1 -1
- package/components/input/textarea/extractSpansOfClasses.d.ts +17 -0
- package/components/input/textarea/extractSpansOfClasses.js +26 -1
- package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
- package/components/input/textarea/getRanges.d.ts +7 -0
- package/components/input/textarea/getRanges.js +11 -0
- package/components/input/textarea/getRanges.js.map +1 -1
- package/components/input/textarea/getType.d.ts +5 -0
- package/components/input/textarea/getType.js +5 -0
- package/components/input/textarea/getType.js.map +1 -1
- package/components/input/textarea/highlighedContents.d.ts +4 -0
- package/components/input/textarea/highlighedContents.js +5 -0
- package/components/input/textarea/highlighedContents.js.map +1 -1
- package/components/input/textarea/mentionsWithHighlighting.d.ts +25 -0
- package/components/input/textarea/mentionsWithHighlighting.js +14 -0
- package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
- package/components/keyboard/keyboardUtils.d.ts +6 -0
- package/components/keyboard/keyboardUtils.js +6 -0
- package/components/keyboard/keyboardUtils.js.map +1 -1
- package/components/modal/draggableModalProvider.d.ts +6 -0
- package/components/modal/draggableModalProvider.js +7 -0
- package/components/modal/draggableModalProvider.js.map +1 -1
- package/components/modal/impl/clamp.js +1 -0
- package/components/modal/impl/clamp.js.map +1 -1
- package/components/modal/impl/draggableModal.d.ts +1 -0
- package/components/modal/impl/draggableModal.js +6 -0
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalContext.js +1 -0
- package/components/modal/impl/draggableModalContext.js.map +1 -1
- package/components/modal/impl/draggableModalInner.js +12 -1
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +7 -1
- package/components/modal/impl/draggableModalReducer.js +6 -1
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/draggableModalStyles.d.ts +17 -0
- package/components/modal/impl/draggableModalStyles.js +31 -0
- package/components/modal/impl/draggableModalStyles.js.map +1 -1
- package/components/modal/impl/getWindowSize.js +1 -0
- package/components/modal/impl/getWindowSize.js.map +1 -1
- package/components/modal/impl/index.js +1 -0
- package/components/modal/impl/index.js.map +1 -1
- package/components/modal/impl/resizeHandle.d.ts +1 -0
- package/components/modal/impl/resizeHandle.js +4 -1
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/impl/useDrag.js +1 -0
- package/components/modal/impl/useDrag.js.map +1 -1
- package/components/modal/impl/usePrevious.js +1 -0
- package/components/modal/impl/usePrevious.js.map +1 -1
- package/components/modal/impl/useResize.js +1 -0
- package/components/modal/impl/useResize.js.map +1 -1
- package/components/modal/modalDialog.d.ts +85 -0
- package/components/modal/modalDialog.js +80 -10
- package/components/modal/modalDialog.js.map +1 -1
- package/components/picker/enumValuePicker.d.ts +17 -0
- package/components/picker/enumValuePicker.js +4 -0
- package/components/picker/enumValuePicker.js.map +1 -1
- package/components/platformSpecific.d.ts +17 -0
- package/components/platformSpecific.js +16 -0
- package/components/platformSpecific.js.map +1 -1
- package/components/scrollTo/onlyText.d.ts +5 -0
- package/components/scrollTo/onlyText.js +5 -0
- package/components/scrollTo/onlyText.js.map +1 -1
- package/components/scrollTo/scrollTo.d.ts +56 -0
- package/components/scrollTo/scrollTo.js +40 -3
- package/components/scrollTo/scrollTo.js.map +1 -1
- package/components/style/withCss.d.ts +15 -0
- package/components/style/withCss.js +6 -0
- package/components/style/withCss.js.map +1 -1
- package/components/table/dragSortingTable.d.ts +15 -0
- package/components/table/dragSortingTable.js +12 -0
- package/components/table/dragSortingTable.js.map +1 -1
- package/components/text/impl/innerSize.js +2 -0
- package/components/text/impl/innerSize.js.map +1 -1
- package/components/text/impl/series.d.ts +10 -0
- package/components/text/impl/series.js +10 -0
- package/components/text/impl/series.js.map +1 -1
- package/components/text/impl/shallowEqual.js +1 -0
- package/components/text/impl/shallowEqual.js.map +1 -1
- package/components/text/impl/whilst.d.ts +7 -0
- package/components/text/impl/whilst.js +7 -0
- package/components/text/impl/whilst.js.map +1 -1
- package/components/text/textFit.d.ts +24 -0
- package/components/text/textFit.js +29 -1
- package/components/text/textFit.js.map +1 -1
- package/i18n/componentsLocaleHolder.d.ts +9 -0
- package/i18n/componentsLocaleHolder.js +9 -0
- package/i18n/componentsLocaleHolder.js.map +1 -1
- package/package.json +66 -65
|
@@ -3,61 +3,205 @@ import DataGrid, { DataGridFilterProps, DataGridProps, DataGridSearchProps, Sort
|
|
|
3
3
|
import { RowStyleRule } from "d2coreui/components/grid/cell/tableDefaultRowStyleRules";
|
|
4
4
|
import { ColumnState, RowDataUpdatedEvent } from "ag-grid-community";
|
|
5
5
|
import { DataChangeStateEnum } from "d2core/types/dataChangeStateEnum";
|
|
6
|
+
/**
|
|
7
|
+
* Persistable user configuration of an {@link ExtendedDataGrid}: column state, paging, follow-last-record,
|
|
8
|
+
* row styling, date-time formatting and side panel widths.
|
|
9
|
+
*
|
|
10
|
+
* Passed in as {@link ExtendedDataGridProps.defaultGridConfiguration} and reported back through
|
|
11
|
+
* {@link ExtendedDataGridProps.onChangeConfiguration}, so that the caller can store it and restore it later.
|
|
12
|
+
*/
|
|
6
13
|
export interface GridConfiguration {
|
|
14
|
+
/**
|
|
15
|
+
* Format version of the configuration. A configuration whose version is set and differs from the current
|
|
16
|
+
* one (2) is ignored as a whole and the grid starts with defaults; omit it to always accept the configuration.
|
|
17
|
+
*/
|
|
7
18
|
version?: number;
|
|
19
|
+
/**
|
|
20
|
+
* ag-grid column state (order, visibility, width, sort, pinning). When missing, the grid takes the state
|
|
21
|
+
* derived from the column definitions and reports it back. Columns defined in `columnDefs` but missing here
|
|
22
|
+
* are merged in with their initial state.
|
|
23
|
+
*/
|
|
8
24
|
columnModel?: ColumnState[];
|
|
25
|
+
/**
|
|
26
|
+
* Page size: `-1` disables paging (scrolling only), `0` sizes pages automatically to the available height,
|
|
27
|
+
* a positive number is a fixed number of rows per page.
|
|
28
|
+
*/
|
|
9
29
|
pageSize: number;
|
|
30
|
+
/** Page size applied when the user reverts the table settings in the configuration drawer (`0` when not set). */
|
|
10
31
|
defaultPageSize?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Keep the last displayed row in view whenever data are loaded or rows are added. Works only with
|
|
34
|
+
* client-side `rowData`. It is switched off automatically when the user selects a row, scrolls backwards,
|
|
35
|
+
* or sorts differently than {@link GridConfiguration.followLastRecordSortModel}.
|
|
36
|
+
*/
|
|
11
37
|
followLastRecord?: boolean;
|
|
38
|
+
/** Sort model applied when follow-last-record is switched on; sorting differently switches the feature off. */
|
|
12
39
|
followLastRecordSortModel?: SortItem[];
|
|
40
|
+
/** Show a toolbar button that lets the user toggle {@link GridConfiguration.followLastRecord}. */
|
|
13
41
|
followLastRecordEditable?: boolean;
|
|
42
|
+
/** Show the floating column filters beneath the column headers. */
|
|
14
43
|
columnSearchVisible?: boolean;
|
|
44
|
+
/** Row styling rules; defaults to {@link tableDefaultRowStyleRules}. */
|
|
15
45
|
rowStyleRules?: RowStyleRule[];
|
|
46
|
+
/** Row styling rules restored when the user reverts row styling; defaults to {@link tableDefaultRowStyleRules}. */
|
|
16
47
|
defaultRowStyleRules?: RowStyleRule[];
|
|
48
|
+
/**
|
|
49
|
+
* Show milliseconds in date-time and time columns.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
17
52
|
showMilliseconds?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Value of {@link GridConfiguration.showMilliseconds} restored when the user reverts the table settings.
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
18
57
|
defaultShowMilliseconds?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Hide the year in date and date-time columns.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
19
62
|
hideYear?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Value of {@link GridConfiguration.hideYear} restored when the user reverts the table settings.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
20
67
|
defaultHideYear?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Show the UTC offset in date-time columns, so that the two readings of a DST fold stay distinguishable.
|
|
70
|
+
* Only an explicit `false` turns it off.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
21
73
|
showUtcOffset?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Value of {@link GridConfiguration.showUtcOffset} restored when the user reverts the table settings.
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
22
78
|
defaultShowUtcOffset?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Width of the left filter panel in pixels; `0` means collapsed. When not set, the panel is shown with
|
|
81
|
+
* `filterPanel.defaultWidth` (220 if that is not set either) if a `filterPanel` is configured.
|
|
82
|
+
*/
|
|
23
83
|
filterPanelWidth?: number;
|
|
84
|
+
/** Width of the right detail panel in pixels; `0` (the default) means collapsed. */
|
|
24
85
|
detailPanelWidth?: number;
|
|
25
86
|
}
|
|
87
|
+
/** Search bar configuration of {@link ExtendedDataGrid}. */
|
|
26
88
|
interface ExtendedDataGridSearchProps extends DataGridSearchProps {
|
|
89
|
+
/**
|
|
90
|
+
* Initial search history, most recent first, used while `searchHistory` is not controlled. The grid keeps
|
|
91
|
+
* the last 10 distinct search strings, adding one each time a search is invoked.
|
|
92
|
+
*/
|
|
27
93
|
initialSearchHistory?: string[];
|
|
28
94
|
}
|
|
95
|
+
/** Floating filter configuration of {@link ExtendedDataGrid}. */
|
|
29
96
|
interface ExtendedDataGridFilterProps extends DataGridFilterProps {
|
|
97
|
+
/**
|
|
98
|
+
* Set when the grid uses the ag-grid quick filter: rows updated by {@link ExtendedDataGrid.updateRecord}
|
|
99
|
+
* then get their quick filter text recomputed so the filter reflects the new values.
|
|
100
|
+
*/
|
|
30
101
|
quickFilterEnabled?: boolean;
|
|
31
102
|
}
|
|
103
|
+
/** Parameters passed to the filter panel renderer ({@link ExtendedDataGridProps.filterPanel}). */
|
|
32
104
|
export interface FilterPanelRendererParams {
|
|
105
|
+
/** Deep copy of `filterPanel.defaultFilter`, taken when the grid was constructed. */
|
|
33
106
|
defaultFilter?: any;
|
|
107
|
+
/**
|
|
108
|
+
* Whether the last filter reported by {@link ExtendedDataGrid.onPanelFilterApplied} differs from
|
|
109
|
+
* {@link FilterPanelRendererParams.defaultFilter}.
|
|
110
|
+
*/
|
|
34
111
|
filterChanged: boolean;
|
|
35
112
|
}
|
|
36
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Properties of {@link ExtendedDataGrid}. All {@link DataGridProps} are forwarded to the inner {@link DataGrid},
|
|
115
|
+
* except those the extended grid manages itself from its {@link GridConfiguration} (paging, row style rules,
|
|
116
|
+
* date-time formatting, floating filter visibility, table configuration visibility); setting those
|
|
117
|
+
* props on the extended grid has no effect.
|
|
118
|
+
*
|
|
119
|
+
* @typeParam TData - row data type, see {@link DataGridProps}
|
|
120
|
+
*/
|
|
121
|
+
export interface ExtendedDataGridProps<TData = any> extends Omit<DataGridProps<TData>, "paging"> {
|
|
122
|
+
/**
|
|
123
|
+
* Initial configuration, read only once in the constructor; later changes of this prop are ignored.
|
|
124
|
+
* Typically the configuration previously reported by {@link ExtendedDataGridProps.onChangeConfiguration}.
|
|
125
|
+
*/
|
|
37
126
|
defaultGridConfiguration: GridConfiguration;
|
|
127
|
+
/**
|
|
128
|
+
* Called whenever the configuration changes through the UI or API: column state (sort, order, visibility,
|
|
129
|
+
* width), page size, floating filter visibility, date-time formatting, follow-last-record. The same, mutated
|
|
130
|
+
* configuration object is passed each time. Row style rule changes are reported through
|
|
131
|
+
* `onChangeRowStyleRules` instead, and side panel widths are not reported on their own.
|
|
132
|
+
*/
|
|
38
133
|
onChangeConfiguration?(gridConfiguration: GridConfiguration): void;
|
|
134
|
+
/**
|
|
135
|
+
* Freeze the configuration: changes are neither stored nor reported by {@link ExtendedDataGridProps.onChangeConfiguration}
|
|
136
|
+
* (the change itself, e.g. a new sort order, still takes effect in the grid).
|
|
137
|
+
*/
|
|
39
138
|
disableConfigurationChange?: boolean;
|
|
139
|
+
/** Floating filter configuration; visibility of the floating filters comes from the configuration. */
|
|
40
140
|
filter?: ExtendedDataGridFilterProps;
|
|
141
|
+
/**
|
|
142
|
+
* Search bar configuration. `searchString` and `searchHistory` are controlled when set; otherwise the grid
|
|
143
|
+
* keeps them in its own state.
|
|
144
|
+
*/
|
|
41
145
|
search?: ExtendedDataGridSearchProps;
|
|
146
|
+
/** Paging callbacks; the page size itself is taken from {@link GridConfiguration.pageSize}. */
|
|
42
147
|
paging?: {
|
|
148
|
+
/**
|
|
149
|
+
* Page size change handler, called only after the first data load has finished.
|
|
150
|
+
* @param currentPageSize - number of rows that fit on the current page (`null` while not known yet)
|
|
151
|
+
* @param definedPageSize - configured page size, see {@link GridConfiguration.pageSize}
|
|
152
|
+
*/
|
|
43
153
|
onPaginationChanged?: (currentPageSize: number | null, definedPageSize: number) => void;
|
|
44
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Resizable, collapsible filter panel on the left side of the grid. When a `renderer` is set, the toolbar
|
|
157
|
+
* gets a button that shows/hides the panel.
|
|
158
|
+
*/
|
|
45
159
|
filterPanel?: {
|
|
160
|
+
/**
|
|
161
|
+
* Width in pixels used when the configuration does not define one and when the panel is re-opened by the
|
|
162
|
+
* toolbar button; if not set, 220 and 250 pixels respectively.
|
|
163
|
+
*/
|
|
46
164
|
defaultWidth?: number;
|
|
165
|
+
/** Intended to hide the panel initially. Currently not evaluated. */
|
|
47
166
|
hidden?: boolean;
|
|
167
|
+
/** Default filter; its deep copy is passed to the renderer and compared by {@link ExtendedDataGrid.onPanelFilterApplied}. */
|
|
48
168
|
defaultFilter?: any;
|
|
169
|
+
/** Renders the panel content. */
|
|
49
170
|
renderer?(parameters: FilterPanelRendererParams): ReactElement;
|
|
171
|
+
/** Icon of the toolbar toggle button; defaults to a filter icon. */
|
|
50
172
|
icon?: React.ReactNode;
|
|
51
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Resizable, collapsible detail panel on the right side of the grid, collapsed until opened by
|
|
176
|
+
* {@link ExtendedDataGrid.showDetailPanel} or by a stored {@link GridConfiguration.detailPanelWidth}.
|
|
177
|
+
*/
|
|
52
178
|
detailPanel?: {
|
|
179
|
+
/**
|
|
180
|
+
* Width in pixels used when the panel is opened by {@link ExtendedDataGrid.showDetailPanel}.
|
|
181
|
+
* @default 250
|
|
182
|
+
*/
|
|
53
183
|
defaultWidth?: number;
|
|
184
|
+
/** Renders the panel content, e.g. a `DetailHeaderPanel` followed by the record detail. */
|
|
54
185
|
renderer(): ReactElement;
|
|
186
|
+
/**
|
|
187
|
+
* Called when the splitter collapses or expands the detail panel (collapse arrow or dragging the divider), with
|
|
188
|
+
* `true` when it becomes visible. Not called for {@link ExtendedDataGrid.showDetailPanel}.
|
|
189
|
+
*/
|
|
55
190
|
onVisibleChange?(visible: boolean): void;
|
|
56
191
|
};
|
|
192
|
+
/** Panel rendered directly below the grid, usually with context buttons. */
|
|
57
193
|
controlPanel?: {
|
|
194
|
+
/** Renders the panel content. */
|
|
58
195
|
renderer?(): React.ReactElement | null;
|
|
59
196
|
};
|
|
197
|
+
/** Called after each batch of queued record changes ({@link ExtendedDataGrid.addRecord} etc.) has been applied. */
|
|
60
198
|
onDataChanged?(): void;
|
|
199
|
+
/**
|
|
200
|
+
* Interval in milliseconds for batching record changes queued by {@link ExtendedDataGrid.addRecord},
|
|
201
|
+
* {@link ExtendedDataGrid.updateRecord} and {@link ExtendedDataGrid.removeRecord}; a batch is applied at
|
|
202
|
+
* the latest after this interval. `0` applies every change immediately. Read only in the constructor.
|
|
203
|
+
* @default 500
|
|
204
|
+
*/
|
|
61
205
|
updateDataDebounceInterval?: number;
|
|
62
206
|
}
|
|
63
207
|
interface ExtendedDataGridState {
|
|
@@ -71,67 +215,166 @@ interface ExtendedDataGridState {
|
|
|
71
215
|
sizes: (number | undefined)[];
|
|
72
216
|
width: number;
|
|
73
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* {@link DataGrid} with a persistable {@link GridConfiguration}, optional side panels and batched live updates.
|
|
220
|
+
*
|
|
221
|
+
* It lays out a resizable filter panel (left), the grid with an optional control panel below it, and a detail
|
|
222
|
+
* panel (right); keeps column state, paging, row styling and date-time formatting in a configuration reported by
|
|
223
|
+
* `onChangeConfiguration`; and applies record changes pushed by {@link addRecord}, {@link updateRecord} and
|
|
224
|
+
* {@link removeRecord} as debounced ag-grid transactions. When `rowData` is passed, those transactions also
|
|
225
|
+
* modify that array in place.
|
|
226
|
+
*
|
|
227
|
+
* @typeParam T - row data type; rows are identified by `id`, which is also the ag-grid row id
|
|
228
|
+
* @example
|
|
229
|
+
* ```tsx
|
|
230
|
+
* <ExtendedDataGrid<Row>
|
|
231
|
+
* ref={(grid) => this.grid = grid ?? undefined}
|
|
232
|
+
* columnDefs={columnDefs}
|
|
233
|
+
* rowData={this.state.rows}
|
|
234
|
+
* defaultGridConfiguration={storedConfiguration ?? {pageSize: 0}}
|
|
235
|
+
* onChangeConfiguration={(configuration) => store(configuration)}
|
|
236
|
+
* onLoadData={(callback) => callback(this.state.rows.length)}
|
|
237
|
+
* />
|
|
238
|
+
* // later, on a pushed change:
|
|
239
|
+
* this.grid?.updateRecord(changedRow);
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
74
242
|
export default class ExtendedDataGrid<T extends {
|
|
75
243
|
id: number | string;
|
|
76
|
-
}> extends React.Component<ExtendedDataGridProps
|
|
244
|
+
}> extends React.Component<ExtendedDataGridProps<T>, ExtendedDataGridState> {
|
|
245
|
+
/** Fills the `rowStyleRules` prop required by {@link DataGridProps}; rendering uses the rules from the configuration instead. */
|
|
77
246
|
static defaultProps: {
|
|
78
247
|
rowStyleRules: RowStyleRule[];
|
|
79
248
|
};
|
|
80
|
-
|
|
249
|
+
/** The inner {@link DataGrid}, available after mount. */
|
|
250
|
+
dataGrid?: DataGrid<T>;
|
|
81
251
|
private gridApi?;
|
|
82
252
|
private dataLoaded;
|
|
83
253
|
private dataTransaction;
|
|
254
|
+
private pendingColumnStates;
|
|
84
255
|
private containerRef;
|
|
85
256
|
private resizeObserver;
|
|
86
257
|
private _updateDataDebounced;
|
|
87
|
-
constructor(props: Readonly<ExtendedDataGridProps
|
|
258
|
+
constructor(props: Readonly<ExtendedDataGridProps<T>>);
|
|
88
259
|
componentDidMount(): void;
|
|
89
260
|
componentWillUnmount(): void;
|
|
261
|
+
/** Returns the current configuration (the live object, not a copy). */
|
|
90
262
|
getConfiguration(): GridConfiguration;
|
|
263
|
+
/**
|
|
264
|
+
* Returns the internally kept search string and a copy of the search history.
|
|
265
|
+
* @returns the search history ordered oldest first (reverse of the internal and `initialSearchHistory` order)
|
|
266
|
+
*/
|
|
91
267
|
getSearchContext(): {
|
|
92
268
|
searchString: string;
|
|
93
269
|
searchHistory: string[];
|
|
94
270
|
};
|
|
271
|
+
/**
|
|
272
|
+
* Reloads the grid data by calling `onLoadData`. Pending record changes are discarded once the data are loaded.
|
|
273
|
+
* @param callback - called after `onLoadData` reports the loaded data
|
|
274
|
+
*/
|
|
95
275
|
loadData(callback?: () => void): void;
|
|
276
|
+
/** Whether the inner ag-grid exists and has not been destroyed. */
|
|
96
277
|
isActive(): boolean;
|
|
278
|
+
/** Focuses a cell of the last selected row (or the first row) of the inner grid. */
|
|
97
279
|
focus(): void;
|
|
98
280
|
private _changeConfiguration;
|
|
99
281
|
private _onGridReady;
|
|
282
|
+
private _onNewColumnsLoaded;
|
|
283
|
+
private _withPendingColumnStates;
|
|
100
284
|
private _onLoadData;
|
|
101
285
|
private _onPaginationChanged;
|
|
102
286
|
private _onSearchStringChanged;
|
|
103
287
|
private _onSearch;
|
|
104
288
|
private _reloadTableConfiguration;
|
|
289
|
+
/** Discards all queued, not yet applied record changes. */
|
|
105
290
|
clearTransaction(): void;
|
|
291
|
+
/** Removes all queued, not yet applied changes of the record with the id of `item`. */
|
|
106
292
|
removeFromTransaction(item: T): void;
|
|
293
|
+
/** Whether the record is displayed in the grid or queued to be added. */
|
|
107
294
|
hasRecord(id: number | string): boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Queues a record to be added; it is applied with the next debounced batch.
|
|
297
|
+
* If a removal of the same record is queued, the record is updated instead.
|
|
298
|
+
* @param addIndex - row index to insert at; applies to the whole batch (the last value wins), rows are appended when not set
|
|
299
|
+
*/
|
|
108
300
|
addRecord(data: T, addIndex?: number): void;
|
|
301
|
+
/**
|
|
302
|
+
* Queues several records to be added, see {@link addRecord}.
|
|
303
|
+
* Note that a non-zero `addIndex` reverses `dataArray` in place.
|
|
304
|
+
*/
|
|
109
305
|
addRecords(dataArray: T[], addIndex?: number): void;
|
|
306
|
+
/** Replaces all grid data and discards queued record changes. */
|
|
110
307
|
setRowData(dataArray: T[]): void;
|
|
308
|
+
/**
|
|
309
|
+
* Queues removal of the record with the id of `data`; it is applied with the next debounced batch.
|
|
310
|
+
* If the record is only queued to be added, that addition is cancelled. A removed row is deselected first.
|
|
311
|
+
*/
|
|
111
312
|
removeRecord(data: T): void;
|
|
313
|
+
/** Queues removal of several records, see {@link removeRecord}. */
|
|
112
314
|
removeRecords(dataList: T[]): void;
|
|
315
|
+
/**
|
|
316
|
+
* Queues a record change according to its `dataChangeState`: `CONFIGURED` adds the record, `REMOVED` removes it,
|
|
317
|
+
* anything else updates it. An update of a record that is not in the grid when the batch is applied adds it.
|
|
318
|
+
*/
|
|
113
319
|
updateRecord(data: (T & {
|
|
114
320
|
dataChangeState?: DataChangeStateEnum;
|
|
115
321
|
})): void;
|
|
322
|
+
/** Queues several record changes, see {@link updateRecord}. */
|
|
116
323
|
updateRecords(dataList: (T & {
|
|
117
324
|
dataChangeState?: DataChangeStateEnum;
|
|
118
325
|
})[]): void;
|
|
119
326
|
private _updateData;
|
|
327
|
+
/**
|
|
328
|
+
* Switches follow-last-record on or off and reports the change through `onChangeConfiguration`.
|
|
329
|
+
* Switching on applies {@link GridConfiguration.followLastRecordSortModel} (if set) and scrolls to the last row.
|
|
330
|
+
*/
|
|
120
331
|
enableFollowLastRecord(enable: boolean): void;
|
|
332
|
+
/** Debounced (500 ms) variant of {@link followLastRecord}; used internally. */
|
|
121
333
|
_followLastRecordDebounced(): void;
|
|
334
|
+
/**
|
|
335
|
+
* Scrolls to the last displayed row if {@link GridConfiguration.followLastRecord} is on and client-side `rowData`
|
|
336
|
+
* is not empty.
|
|
337
|
+
*/
|
|
122
338
|
followLastRecord(): void;
|
|
339
|
+
/** Applies an ag-grid column state, including column order, through {@link DataGrid.setColumnState}. */
|
|
123
340
|
setColumnModel(columnModel: ColumnState[]): void;
|
|
341
|
+
/** Sorts by the given columns in the given order; all other columns become unsorted. */
|
|
124
342
|
setSortModel(sortModel: SortItem[]): void;
|
|
343
|
+
/** Returns the current sort columns ordered by sort priority, or an empty array before the grid is ready. */
|
|
125
344
|
getSortModel(): SortItem[];
|
|
345
|
+
/** Internal ag-grid `rowDataUpdated` handler; forwards the event to `onRowDataUpdated`. */
|
|
126
346
|
_onRowDataUpdated(event: RowDataUpdatedEvent): void;
|
|
347
|
+
/**
|
|
348
|
+
* Shows or collapses the filter panel. Showing a collapsed panel opens it with `filterPanel.defaultWidth` (250 if not set).
|
|
349
|
+
* The width is stored in the configuration but not reported through `onChangeConfiguration`.
|
|
350
|
+
*/
|
|
127
351
|
showFilterPanel(show: boolean): void;
|
|
352
|
+
/**
|
|
353
|
+
* Shows or collapses the detail panel. Showing a collapsed panel opens it with `detailPanel.defaultWidth` (250 if not set).
|
|
354
|
+
* The width is stored in the configuration but not reported through `onChangeConfiguration`.
|
|
355
|
+
*/
|
|
128
356
|
showDetailPanel(show: boolean): void;
|
|
357
|
+
/**
|
|
358
|
+
* Moves a single-row selection to the next or previous row and scrolls it into view; does nothing unless exactly one row
|
|
359
|
+
* is selected. Supported for client-side `rowData` and the `infinite` row model.
|
|
360
|
+
*/
|
|
129
361
|
selectNextPreviousRecord(previous: boolean): void;
|
|
362
|
+
/** Replaces the row style rules in the configuration and redraws the rows, without calling any change handler. */
|
|
130
363
|
changeRowStyleRules(rowStyleRules: RowStyleRule[]): void;
|
|
364
|
+
/** Internal handler of row style rule edits; applies them and calls `onChangeRowStyleRules`. */
|
|
131
365
|
_onChangeRowStyleRules(rowStyleRules: RowStyleRule[]): void;
|
|
366
|
+
/**
|
|
367
|
+
* Tells the grid which filter the filter panel has applied, so that {@link FilterPanelRendererParams.filterChanged}
|
|
368
|
+
* reflects whether it differs from the default filter (`null` and `undefined` values are treated as equal).
|
|
369
|
+
*/
|
|
132
370
|
onPanelFilterApplied(newFilter: any): void;
|
|
371
|
+
/** Returns the text of the column's applied text filter model, or an empty string. */
|
|
133
372
|
getUiColumnFilterValue(colId: string): string;
|
|
373
|
+
/** Clears the UI of the column's text filter without applying the change to the grid. */
|
|
134
374
|
removeUiColumnFilterValue(colId: string): Promise<void>;
|
|
375
|
+
/**
|
|
376
|
+
* Applies the value currently entered in the column's filter UI to its filter model, without redrawing ag-grid.
|
|
377
|
+
*/
|
|
135
378
|
applyUiColumnFilterValue(colId: string): Promise<void>;
|
|
136
379
|
private equalValues;
|
|
137
380
|
private _onSelectionChanged;
|
|
@@ -139,7 +382,9 @@ export default class ExtendedDataGrid<T extends {
|
|
|
139
382
|
private renderToolbarButtons;
|
|
140
383
|
private renderToolbar;
|
|
141
384
|
private renderSearchBadge;
|
|
385
|
+
/** Whether the filter panel is expanded (has a non-zero width). */
|
|
142
386
|
isFilterPanelVisible(): boolean;
|
|
387
|
+
/** Renders the inner {@link DataGrid}; used by {@link render}. */
|
|
143
388
|
renderDataGrid(): ReactElement;
|
|
144
389
|
private renderDataGridWithControlPanel;
|
|
145
390
|
render(): React.JSX.Element;
|