d2coreui 23.0.51 → 23.0.53
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 +27 -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 +7 -0
- package/components/grid/columnUtils.js +7 -0
- package/components/grid/columnUtils.js.map +1 -1
- package/components/grid/config/columnTransfer.d.ts +18 -0
- package/components/grid/config/columnTransfer.js +14 -3
- 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 +331 -0
- package/components/grid/dataGrid.js +168 -11
- 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 +241 -0
- package/components/grid/extendedDataGrid.js +121 -2
- 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 +157 -126
- 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 +4 -3
- package/style/index.less +240 -240
|
@@ -85,6 +85,7 @@ const gridFrameworkComponents = {
|
|
|
85
85
|
};
|
|
86
86
|
const DataGridModule = {
|
|
87
87
|
version: "34.3.1",
|
|
88
|
+
// @ts-ignore
|
|
88
89
|
moduleName: `dataGridModule`,
|
|
89
90
|
beans: [RangeSelector, CellControl, BeanAccessor],
|
|
90
91
|
dependantModules: [],
|
|
@@ -97,16 +98,51 @@ provideGlobalGridOptions({
|
|
|
97
98
|
theme: "legacy"
|
|
98
99
|
});
|
|
99
100
|
const rowStyleRuleCompiledExpressions = {};
|
|
101
|
+
/**
|
|
102
|
+
* Separator for joining several parts into one cell value (e.g. name and status).
|
|
103
|
+
* When a string cell value contains it (after the first character), clipboard copy of several rows and export
|
|
104
|
+
* replace every run of line breaks with a single space; copying a single focused cell keeps the line breaks.
|
|
105
|
+
*/
|
|
100
106
|
export const EXPORT_SEPARATOR = "\n";
|
|
101
107
|
var NavigationEventEnum;
|
|
102
108
|
(function (NavigationEventEnum) {
|
|
103
109
|
NavigationEventEnum[NavigationEventEnum["KEYBOARD"] = 0] = "KEYBOARD";
|
|
104
110
|
NavigationEventEnum[NavigationEventEnum["MOUSE"] = 1] = "MOUSE";
|
|
105
111
|
})(NavigationEventEnum || (NavigationEventEnum = {}));
|
|
112
|
+
/**
|
|
113
|
+
* ag-grid (community modules, Balham theme derived from the antd theme tokens unless `theme` is given) wrapped in a
|
|
114
|
+
* card with a toolbar: custom buttons,
|
|
115
|
+
* export and settings menus, a search box and a pager. Adds D2000 column types (see {@link DataGridColDef}), rule-based
|
|
116
|
+
* row styling with configurable font size and row height, a table configuration panel, a columns configuration
|
|
117
|
+
* dialog, a row context menu with export, wildcard quick filter and an optional fill handle.
|
|
118
|
+
*
|
|
119
|
+
* Data are requested through `onLoadData`; use `rowData` (client-side row model) or an ag-grid `datasource`
|
|
120
|
+
* (infinite row model). Row objects must have a unique `id`. The grid state (paging, columns, row styles, date format)
|
|
121
|
+
* is not persisted by DataGrid itself; it reports changes through callbacks and expects the updated values back in
|
|
122
|
+
* props (`ExtendedDataGrid` from `d2coreui/components/grid/extendedDataGrid` keeps this state and reports it as one
|
|
123
|
+
* configuration object; storing it is still up to the caller).
|
|
124
|
+
*
|
|
125
|
+
* Keyboard: PageUp/PageDown/Home/End and arrows at page edges move across pages, Alt+arrows move the open cell editor,
|
|
126
|
+
* Ctrl+A selects the displayed rows, Ctrl+C copies the selected rows with a header line (when more than one is
|
|
127
|
+
* selected) or the focused cell,
|
|
128
|
+
* Ctrl+I / Ctrl+B copy the `objectId`/`id` or `objectName`/`name` column of the focused row.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* <DataGrid
|
|
132
|
+
* columnDefs={[{colId: "name", field: "name", headerName: "Name", group: "Object", type: "textColumnFilter"}]}
|
|
133
|
+
* rowData={rows}
|
|
134
|
+
* paging={{pageSize: 0}}
|
|
135
|
+
* rowStyleRules={rowStyleRules}
|
|
136
|
+
* onChangeRowStyleRules={setRowStyleRules}
|
|
137
|
+
* onLoadData={(callback) => loadRows().then((rows) => { setRows(rows); callback(rows.length); })}
|
|
138
|
+
* />
|
|
139
|
+
*/
|
|
106
140
|
class DataGrid extends React.Component {
|
|
107
141
|
constructor(props) {
|
|
108
142
|
super(props);
|
|
143
|
+
/** Whether the initial `onLoadData` call has already been made. */
|
|
109
144
|
this.firstLoadDone = false;
|
|
145
|
+
/** Pagination event received before the grid API was available, replayed once the grid is ready. */
|
|
110
146
|
this.lastPaginationEvent = null;
|
|
111
147
|
this.state = {
|
|
112
148
|
pageIndex: 0,
|
|
@@ -431,6 +467,11 @@ class DataGrid extends React.Component {
|
|
|
431
467
|
}
|
|
432
468
|
return undefined;
|
|
433
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Case-insensitive `textCustomComparator` used by the grid's text filters; `contains` supports `*` and `?` wildcards.
|
|
472
|
+
* @param filter - ag-grid text filter type (`contains`, `notContains`, `equals`, `notEqual`, `startsWith`, `endsWith`)
|
|
473
|
+
* @returns whether `value` passes the filter
|
|
474
|
+
*/
|
|
434
475
|
textCustomComparator(filter, value, filterText) {
|
|
435
476
|
const filterTextLowerCase = filterText.toLowerCase();
|
|
436
477
|
const valueLowerCase = value.toString().toLowerCase();
|
|
@@ -453,6 +494,7 @@ class DataGrid extends React.Component {
|
|
|
453
494
|
case 'equals':
|
|
454
495
|
return valueLowerCase === filterTextLowerCase;
|
|
455
496
|
case 'notEqual':
|
|
497
|
+
// noinspection EqualityComparisonWithCoercionJS
|
|
456
498
|
return valueLowerCase != filterTextLowerCase;
|
|
457
499
|
case 'startsWith':
|
|
458
500
|
return valueLowerCase.indexOf(filterTextLowerCase) === 0;
|
|
@@ -460,6 +502,7 @@ class DataGrid extends React.Component {
|
|
|
460
502
|
var index = valueLowerCase.lastIndexOf(filterTextLowerCase);
|
|
461
503
|
return index >= 0 && index === (valueLowerCase.length - filterTextLowerCase.length);
|
|
462
504
|
default:
|
|
505
|
+
// should never happen
|
|
463
506
|
console.warn('invalid filter type ' + filter);
|
|
464
507
|
return false;
|
|
465
508
|
}
|
|
@@ -479,14 +522,18 @@ class DataGrid extends React.Component {
|
|
|
479
522
|
}
|
|
480
523
|
}, 0);
|
|
481
524
|
}
|
|
525
|
+
// functionality when all data are loaded to table
|
|
482
526
|
if (this.props.rowData && this.props.rowData !== prevProps.rowData) {
|
|
527
|
+
// keep filter model when data are changed
|
|
483
528
|
if (this.props.filter && this.props.filter.getFilterModel) {
|
|
484
529
|
this.gridApi.setFilterModel(this.props.filter.getFilterModel());
|
|
485
530
|
this.gridApi.onFilterChanged();
|
|
486
531
|
}
|
|
532
|
+
// keep sorting model when data are changed
|
|
487
533
|
this.setSortModel(this.state.sortModel);
|
|
488
534
|
this.gridApi.refreshClientSideRowModel("group");
|
|
489
535
|
this.gridApi.redrawRows();
|
|
536
|
+
// keep selected rows when data are changed and rows are still present
|
|
490
537
|
const selectedObjectsVisibleInGrid = this.props.rowData.filter((object) => {
|
|
491
538
|
return this.props.selectedIds ? this.props.selectedIds.indexOf(object.id) >= 0 : false;
|
|
492
539
|
});
|
|
@@ -502,7 +549,9 @@ class DataGrid extends React.Component {
|
|
|
502
549
|
this.gridApi.deselectAll();
|
|
503
550
|
}
|
|
504
551
|
}
|
|
552
|
+
// functionality when chunks of data are dynamically loaded from server
|
|
505
553
|
if (this.props.datasource && this.props.datasource !== prevProps.datasource) {
|
|
554
|
+
// resets grid data
|
|
506
555
|
this.gridApi.updateGridOptions({ datasource: this.props.datasource });
|
|
507
556
|
}
|
|
508
557
|
this.updateRowHeight();
|
|
@@ -510,6 +559,11 @@ class DataGrid extends React.Component {
|
|
|
510
559
|
componentWillUnmount() {
|
|
511
560
|
window.removeEventListener('mouseup', this.onMouseUp);
|
|
512
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* Applies a column state (order, width, visibility, pinning, sorting) to the grid, e.g. one saved from
|
|
564
|
+
* `onColumnsChanged`. Columns not in the state lose their sorting. No-op until the grid is ready.
|
|
565
|
+
* Note: it clears `sort` and `sortIndex` on the passed objects.
|
|
566
|
+
*/
|
|
513
567
|
setColumnState(columnModel) {
|
|
514
568
|
var _a;
|
|
515
569
|
const columnStates = [];
|
|
@@ -523,6 +577,10 @@ class DataGrid extends React.Component {
|
|
|
523
577
|
}
|
|
524
578
|
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.applyColumnState({ state: columnStates, defaultState: { sort: null }, applyOrder: true });
|
|
525
579
|
}
|
|
580
|
+
/**
|
|
581
|
+
* Sorts the grid by the given columns; array order defines the sort priority and all other columns are unsorted.
|
|
582
|
+
* No-op until the grid is ready.
|
|
583
|
+
*/
|
|
526
584
|
setSortModel(sortModel) {
|
|
527
585
|
var _a;
|
|
528
586
|
const columnState = [];
|
|
@@ -537,6 +595,7 @@ class DataGrid extends React.Component {
|
|
|
537
595
|
}
|
|
538
596
|
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.applyColumnState({ state: columnState, defaultState: { sort: null }, applyOrder: true });
|
|
539
597
|
}
|
|
598
|
+
/** Returns the sorted columns ordered by sort priority; empty until the grid is ready. */
|
|
540
599
|
getSortModel() {
|
|
541
600
|
var _a, _b;
|
|
542
601
|
const columnState = (_b = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnState()) !== null && _b !== void 0 ? _b : [];
|
|
@@ -553,6 +612,7 @@ class DataGrid extends React.Component {
|
|
|
553
612
|
res.sort((a, b) => indexes[a.colId] - indexes[b.colId]);
|
|
554
613
|
return res;
|
|
555
614
|
}
|
|
615
|
+
/** Recomputes font size and row height from `rowStyleRules` and applies them if they changed. */
|
|
556
616
|
updateRowHeight() {
|
|
557
617
|
let rowAndFontHeight = this.calculateRowAndFontHeight(this.props.rowStyleRules);
|
|
558
618
|
if (rowAndFontHeight.rowHeight !== this.state.rowHeight) {
|
|
@@ -562,6 +622,10 @@ class DataGrid extends React.Component {
|
|
|
562
622
|
this.setState({ fontSize: rowAndFontHeight.fontSize });
|
|
563
623
|
}
|
|
564
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
* Computes the font size and row height (pixels) defined by the `table-font-size` and `table-line-indentation`
|
|
627
|
+
* rules, falling back to the grid defaults.
|
|
628
|
+
*/
|
|
565
629
|
calculateRowAndFontHeight(rowStyleRules) {
|
|
566
630
|
let rowHeightDelta = GRID_DEFAULT_ROW_HEIGHT_DELTA;
|
|
567
631
|
let fontSize = GRID_DEFAULT_FONT_SIZE;
|
|
@@ -582,6 +646,7 @@ class DataGrid extends React.Component {
|
|
|
582
646
|
}
|
|
583
647
|
return { rowHeight: rowHeight, fontSize: fontSize };
|
|
584
648
|
}
|
|
649
|
+
/** Synchronizes the table configuration panel visibility with the `tableConfigVisible` prop when it is set. */
|
|
585
650
|
static getDerivedStateFromProps(props, state) {
|
|
586
651
|
const newState = {};
|
|
587
652
|
if (props.tableConfigVisible === true || props.tableConfigVisible === false) {
|
|
@@ -591,6 +656,7 @@ class DataGrid extends React.Component {
|
|
|
591
656
|
}
|
|
592
657
|
return newState;
|
|
593
658
|
}
|
|
659
|
+
/** ag-grid `gridReady` handler: stores the grid API, forwards the event to `props.onGridReady` and initializes sort/column state. */
|
|
594
660
|
onGridReady(gridReadyEvent) {
|
|
595
661
|
const gridApi = gridReadyEvent.api;
|
|
596
662
|
if (!this.gridApi || this.gridApi !== gridApi) {
|
|
@@ -605,17 +671,24 @@ class DataGrid extends React.Component {
|
|
|
605
671
|
this.updateRowHeight();
|
|
606
672
|
}
|
|
607
673
|
window.addEventListener('mouseup', this.onMouseUp);
|
|
674
|
+
// fixing some cases when after onGridReady callback no onPaginationChanged callback is called
|
|
675
|
+
// and therefore no initial data loading (loadData()) occurs
|
|
608
676
|
setTimeout(() => {
|
|
609
677
|
if (!!this.lastPaginationEvent) {
|
|
610
678
|
this.onPaginationChanged(this.lastPaginationEvent);
|
|
611
679
|
}
|
|
612
680
|
});
|
|
613
681
|
}
|
|
682
|
+
/**
|
|
683
|
+
* ag-grid `paginationChanged` handler: updates the pager, reports page size changes through
|
|
684
|
+
* `paging.onPaginationChanged`, triggers the initial data load and forwards the event to `props.onPaginationChanged`.
|
|
685
|
+
*/
|
|
614
686
|
onPaginationChanged(event) {
|
|
615
687
|
if (this.gridApi) {
|
|
616
688
|
const currentPage = this.gridApi.paginationGetCurrentPage();
|
|
617
689
|
const currentPageSize = this.gridApi.paginationGetPageSize();
|
|
618
690
|
let recordsCount = this.props.paging.pageSize >= 0 ? (this.gridApi.paginationIsLastPageFound() ? this.gridApi.paginationGetRowCount() : 0) : this.gridApi.getDisplayedRowCount();
|
|
691
|
+
// process only when onGridReady passed
|
|
619
692
|
if (this.state.pageSize !== currentPageSize) {
|
|
620
693
|
if (this.props.paging.onPaginationChanged) {
|
|
621
694
|
this.props.paging.onPaginationChanged(currentPageSize, this.props.paging.pageSize);
|
|
@@ -639,8 +712,10 @@ class DataGrid extends React.Component {
|
|
|
639
712
|
this.props.onPaginationChanged(event);
|
|
640
713
|
}
|
|
641
714
|
}
|
|
715
|
+
/** ag-grid `viewportChanged` handler: adds `rowsScrollingDelta` (see {@link DataGridViewportChangedEvent}) and forwards the event to `props.onViewportChanged`. */
|
|
642
716
|
onViewportChanged(event) {
|
|
643
717
|
const dataGridEvent = event;
|
|
718
|
+
// calculation of the flag that last record is shown
|
|
644
719
|
const rowsScrollingDelta = this.state.viewport[1] ? event.lastRow + 1 - this.state.viewport[1] : event.lastRow + 1;
|
|
645
720
|
dataGridEvent.rowsScrollingDelta = rowsScrollingDelta;
|
|
646
721
|
this.setState({ viewport: [event.firstRow + 1, event.lastRow + 1] });
|
|
@@ -648,6 +723,11 @@ class DataGrid extends React.Component {
|
|
|
648
723
|
this.props.onViewportChanged(event);
|
|
649
724
|
}
|
|
650
725
|
}
|
|
726
|
+
/**
|
|
727
|
+
* Switches the paging mode at runtime (used by the table configuration panel) and reports it through
|
|
728
|
+
* `paging.onPaginationChanged`; the `paging.pageSize` prop is not changed. No-op until the grid is ready.
|
|
729
|
+
* @param pageSize - `-1` no paging, `0` automatic page size, positive number fixed rows per page
|
|
730
|
+
*/
|
|
651
731
|
changePagination(pageSize) {
|
|
652
732
|
var _a, _b, _c;
|
|
653
733
|
if (!this.gridApi) {
|
|
@@ -666,7 +746,9 @@ class DataGrid extends React.Component {
|
|
|
666
746
|
}
|
|
667
747
|
else if (pageSize === 0) {
|
|
668
748
|
this.gridApi.updateGridOptions({ pagination: true, paginationAutoPageSize: true });
|
|
749
|
+
// handling AG-Grid bug caused by different previous pageSize state
|
|
669
750
|
const rowHeight = (_c = (_b = (_a = gridApiWithPrivateAccess.beans.gos).getRowHeightAsNumber) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : 1;
|
|
751
|
+
// @ts-ignore
|
|
670
752
|
const bodyHeight = gridApiWithPrivateAccess.beans.ctrlsSvc.params.center.viewportSizeFeature.getBodyHeight();
|
|
671
753
|
let availablePageSize = 1000;
|
|
672
754
|
if (bodyHeight > 0) {
|
|
@@ -676,6 +758,7 @@ class DataGrid extends React.Component {
|
|
|
676
758
|
this.gridApi.updateGridOptions({ paginationPageSize: 1 });
|
|
677
759
|
}
|
|
678
760
|
else {
|
|
761
|
+
// special hack to remove setting page size
|
|
679
762
|
this.gridApi.updateGridOptions({ paginationPageSize: null });
|
|
680
763
|
}
|
|
681
764
|
if (this.props.paging && this.props.paging.onPaginationChanged) {
|
|
@@ -689,6 +772,7 @@ class DataGrid extends React.Component {
|
|
|
689
772
|
}
|
|
690
773
|
}
|
|
691
774
|
}
|
|
775
|
+
/** Requests showing/hiding milliseconds via `props.onShowMilliseconds` and redraws the rows once the parent calls back. */
|
|
692
776
|
showMilliseconds(showMilis) {
|
|
693
777
|
var _a, _b;
|
|
694
778
|
(_b = (_a = this.props).onShowMilliseconds) === null || _b === void 0 ? void 0 : _b.call(_a, showMilis, () => {
|
|
@@ -696,11 +780,13 @@ class DataGrid extends React.Component {
|
|
|
696
780
|
return;
|
|
697
781
|
}
|
|
698
782
|
if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
|
|
783
|
+
// table is shown
|
|
699
784
|
this.gridApi.refreshClientSideRowModel("group");
|
|
700
785
|
}
|
|
701
786
|
this.gridApi.redrawRows();
|
|
702
787
|
});
|
|
703
788
|
}
|
|
789
|
+
/** Requests showing/hiding the year via `props.onShowYear` and redraws the rows once the parent calls back. */
|
|
704
790
|
showYear(showYear) {
|
|
705
791
|
var _a, _b;
|
|
706
792
|
(_b = (_a = this.props).onShowYear) === null || _b === void 0 ? void 0 : _b.call(_a, showYear, () => {
|
|
@@ -708,11 +794,13 @@ class DataGrid extends React.Component {
|
|
|
708
794
|
return;
|
|
709
795
|
}
|
|
710
796
|
if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
|
|
797
|
+
// table is shown
|
|
711
798
|
this.gridApi.refreshClientSideRowModel("group");
|
|
712
799
|
}
|
|
713
800
|
this.gridApi.redrawRows();
|
|
714
801
|
});
|
|
715
802
|
}
|
|
803
|
+
/** Requests showing/hiding the UTC offset via `props.onShowUtcOffset` and redraws the rows once the parent calls back. */
|
|
716
804
|
showUtcOffset(showUtcOffset) {
|
|
717
805
|
var _a, _b;
|
|
718
806
|
(_b = (_a = this.props).onShowUtcOffset) === null || _b === void 0 ? void 0 : _b.call(_a, showUtcOffset, () => {
|
|
@@ -720,11 +808,16 @@ class DataGrid extends React.Component {
|
|
|
720
808
|
return;
|
|
721
809
|
}
|
|
722
810
|
if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
|
|
811
|
+
// table is shown
|
|
723
812
|
this.gridApi.refreshClientSideRowModel("group");
|
|
724
813
|
}
|
|
725
814
|
this.gridApi.redrawRows();
|
|
726
815
|
});
|
|
727
816
|
}
|
|
817
|
+
/**
|
|
818
|
+
* Applies a new row height (and header/floating filter height derived from `fontSize`, unless given in props),
|
|
819
|
+
* redraws the grid (reloading an infinite datasource) and calls `props.onRowHeightChanged`.
|
|
820
|
+
*/
|
|
728
821
|
changeRowHeight(fontSize, rowHeight) {
|
|
729
822
|
this.setState({ rowHeight: rowHeight }, () => {
|
|
730
823
|
if (this.gridApi) {
|
|
@@ -740,6 +833,7 @@ class DataGrid extends React.Component {
|
|
|
740
833
|
this.gridApi.redrawRows();
|
|
741
834
|
if (this.props.rowModelType === "infinite" && this.props.datasource) {
|
|
742
835
|
this.gridApi.setGridOption('rowHeight', rowHeight);
|
|
836
|
+
// redraws all server side loaded table data
|
|
743
837
|
this.gridApi.updateGridOptions({ datasource: this.props.datasource });
|
|
744
838
|
}
|
|
745
839
|
}
|
|
@@ -748,11 +842,16 @@ class DataGrid extends React.Component {
|
|
|
748
842
|
}
|
|
749
843
|
});
|
|
750
844
|
}
|
|
845
|
+
/** Shows the page with the given zero-based index. */
|
|
751
846
|
onGoToPage(pageIndex) {
|
|
752
847
|
if (this.gridApi) {
|
|
753
848
|
this.gridApi.paginationGoToPage(pageIndex);
|
|
754
849
|
}
|
|
755
850
|
}
|
|
851
|
+
/**
|
|
852
|
+
* (Re)loads data: shows the loading overlay and calls `props.onLoadData`. No-op until the grid is ready.
|
|
853
|
+
* @param callback - called after `onLoadData` reports that loading has finished
|
|
854
|
+
*/
|
|
756
855
|
loadData(callback) {
|
|
757
856
|
if (!this.gridApi) {
|
|
758
857
|
return;
|
|
@@ -785,6 +884,7 @@ class DataGrid extends React.Component {
|
|
|
785
884
|
}
|
|
786
885
|
});
|
|
787
886
|
}
|
|
887
|
+
/** Focuses (after a short delay) the first column of the last selected row, or of the first row when nothing is selected. */
|
|
788
888
|
focus() {
|
|
789
889
|
setTimeout(() => {
|
|
790
890
|
var _a, _b, _c, _d;
|
|
@@ -798,9 +898,11 @@ class DataGrid extends React.Component {
|
|
|
798
898
|
(_d = this.gridApi) === null || _d === void 0 ? void 0 : _d.setFocusedCell(selectedRowIndex, columnIdToFocus);
|
|
799
899
|
}, 200);
|
|
800
900
|
}
|
|
901
|
+
/** Returns `true` when the grid is ready and not destroyed. */
|
|
801
902
|
isActive() {
|
|
802
903
|
return !!this.gridApi && !this.gridApi.isDestroyed();
|
|
803
904
|
}
|
|
905
|
+
/** Handler of ag-grid column visible/pinned/resized/moved events; stores the column state and calls `props.onColumnsChanged`. */
|
|
804
906
|
onColumnsChanged(event) {
|
|
805
907
|
const columnModel = event.api.getColumnState();
|
|
806
908
|
if (this.props.onColumnsChanged) {
|
|
@@ -808,6 +910,10 @@ class DataGrid extends React.Component {
|
|
|
808
910
|
}
|
|
809
911
|
this.setState({ columnModel: columnModel });
|
|
810
912
|
}
|
|
913
|
+
/**
|
|
914
|
+
* Requests showing/hiding the floating column filters: re-applies `filter.getFilterModel()` and calls
|
|
915
|
+
* `filter.onColumnSearchVisible`; the actual visibility follows `filter.columnSearchVisible`.
|
|
916
|
+
*/
|
|
811
917
|
setColumnSearchVisible(visible) {
|
|
812
918
|
if (this.gridApi && this.props.filter && this.props.filter.getFilterModel) {
|
|
813
919
|
this.gridApi.setFilterModel(this.props.filter.getFilterModel());
|
|
@@ -835,6 +941,7 @@ class DataGrid extends React.Component {
|
|
|
835
941
|
if (this.props.onSortChanged && this.gridApi) {
|
|
836
942
|
const currentSortModel = this.getSortModel();
|
|
837
943
|
if (!isEqual(this.state.sortModel, currentSortModel)) {
|
|
944
|
+
// propagate only changes to sorting
|
|
838
945
|
this.setState({ sortModel: currentSortModel }, () => {
|
|
839
946
|
if (this.props.onSortChanged) {
|
|
840
947
|
this.props.onSortChanged(event);
|
|
@@ -843,19 +950,24 @@ class DataGrid extends React.Component {
|
|
|
843
950
|
}
|
|
844
951
|
}
|
|
845
952
|
}
|
|
953
|
+
/** Requests opening/closing the table configuration panel via `props.onTableConfigVisible`; redraws the rows when it closes. */
|
|
846
954
|
showTableConfiguration(show) {
|
|
847
955
|
if (this.props.onTableConfigVisible) {
|
|
848
956
|
this.props.onTableConfigVisible(show);
|
|
849
957
|
}
|
|
850
958
|
this.setState({ tableConfigVisible: show }, () => {
|
|
851
959
|
if (this.gridApi && !this.state.tableConfigVisible) {
|
|
960
|
+
// redrawing rows after closing table configuration panel, probably not required any more,
|
|
961
|
+
// because config panel and table is shown simultaneously
|
|
852
962
|
if (!this.props.rowModelType || this.props.rowModelType === "clientSide") {
|
|
963
|
+
// table is shown
|
|
853
964
|
this.gridApi.refreshClientSideRowModel("group");
|
|
854
965
|
}
|
|
855
966
|
this.gridApi.redrawRows();
|
|
856
967
|
}
|
|
857
968
|
});
|
|
858
969
|
}
|
|
970
|
+
/** Opens/closes the columns configuration dialog and calls `props.onColumnsConfigVisible`. */
|
|
859
971
|
showColumnsConfig(show) {
|
|
860
972
|
if (this.props.onColumnsConfigVisible) {
|
|
861
973
|
this.props.onColumnsConfigVisible(show);
|
|
@@ -865,7 +977,7 @@ class DataGrid extends React.Component {
|
|
|
865
977
|
}
|
|
866
978
|
navigateToNextCell(params) {
|
|
867
979
|
var _a;
|
|
868
|
-
this.lastNavigationEvent = 0
|
|
980
|
+
this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
|
|
869
981
|
var suggestedNextCell = params.nextCellPosition;
|
|
870
982
|
if (!this.gridApi) {
|
|
871
983
|
return suggestedNextCell !== null && suggestedNextCell !== void 0 ? suggestedNextCell : params.previousCellPosition;
|
|
@@ -944,7 +1056,7 @@ class DataGrid extends React.Component {
|
|
|
944
1056
|
indexToJump = focusedCell.rowIndex;
|
|
945
1057
|
}
|
|
946
1058
|
}
|
|
947
|
-
this.lastNavigationEvent = 0
|
|
1059
|
+
this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
|
|
948
1060
|
this.indexToJump = indexToJump;
|
|
949
1061
|
this.columnToJump = columnToJump;
|
|
950
1062
|
setTimeout(() => {
|
|
@@ -969,7 +1081,7 @@ class DataGrid extends React.Component {
|
|
|
969
1081
|
indexToJump = focusedCell.rowIndex;
|
|
970
1082
|
}
|
|
971
1083
|
}
|
|
972
|
-
this.lastNavigationEvent = 0
|
|
1084
|
+
this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
|
|
973
1085
|
this.indexToJump = indexToJump;
|
|
974
1086
|
this.columnToJump = columnToJump;
|
|
975
1087
|
setTimeout(() => {
|
|
@@ -986,7 +1098,7 @@ class DataGrid extends React.Component {
|
|
|
986
1098
|
this.gridApi.tabToPreviousCell();
|
|
987
1099
|
break;
|
|
988
1100
|
}
|
|
989
|
-
else {
|
|
1101
|
+
else /*Key.ArrowRight*/ {
|
|
990
1102
|
this.gridApi.tabToNextCell();
|
|
991
1103
|
break;
|
|
992
1104
|
}
|
|
@@ -994,7 +1106,7 @@ class DataGrid extends React.Component {
|
|
|
994
1106
|
}
|
|
995
1107
|
break;
|
|
996
1108
|
case Key.PageDown:
|
|
997
|
-
this.lastNavigationEvent = 0
|
|
1109
|
+
this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
|
|
998
1110
|
if (pageIndex < (totalPages - 1)) {
|
|
999
1111
|
this.gridApi.paginationGoToNextPage();
|
|
1000
1112
|
const focusedCell = this.gridApi.getFocusedCell();
|
|
@@ -1006,7 +1118,7 @@ class DataGrid extends React.Component {
|
|
|
1006
1118
|
}
|
|
1007
1119
|
break;
|
|
1008
1120
|
case Key.PageUp:
|
|
1009
|
-
this.lastNavigationEvent = 0
|
|
1121
|
+
this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
|
|
1010
1122
|
if (pageIndex > 0) {
|
|
1011
1123
|
this.gridApi.paginationGoToPreviousPage();
|
|
1012
1124
|
const focusedCell = this.gridApi.getFocusedCell();
|
|
@@ -1018,7 +1130,7 @@ class DataGrid extends React.Component {
|
|
|
1018
1130
|
}
|
|
1019
1131
|
break;
|
|
1020
1132
|
case Key.End:
|
|
1021
|
-
this.lastNavigationEvent = 0
|
|
1133
|
+
this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
|
|
1022
1134
|
if (pageIndex < (totalPages - 1)) {
|
|
1023
1135
|
this.gridApi.paginationGoToLastPage();
|
|
1024
1136
|
const focusedCell = this.gridApi.getFocusedCell();
|
|
@@ -1030,7 +1142,7 @@ class DataGrid extends React.Component {
|
|
|
1030
1142
|
}
|
|
1031
1143
|
break;
|
|
1032
1144
|
case Key.Home:
|
|
1033
|
-
this.lastNavigationEvent = 0
|
|
1145
|
+
this.lastNavigationEvent = 0 /* NavigationEventEnum.KEYBOARD */;
|
|
1034
1146
|
if (pageIndex > 0) {
|
|
1035
1147
|
this.gridApi.paginationGoToFirstPage();
|
|
1036
1148
|
const focusedCell = this.gridApi.getFocusedCell();
|
|
@@ -1139,6 +1251,11 @@ class DataGrid extends React.Component {
|
|
|
1139
1251
|
(_l = (_k = this.props).onKeyPressed) === null || _l === void 0 ? void 0 : _l.call(_k, params.event, params.editing);
|
|
1140
1252
|
return false;
|
|
1141
1253
|
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Returns the cell value as used for clipboard copy and export: the ag-grid cell value passed through the column's
|
|
1256
|
+
* `valueFormatter` (a string formatter is treated as a field path into the row data).
|
|
1257
|
+
* @param doNotReplaceNewline - keep line breaks in values containing {@link EXPORT_SEPARATOR} (otherwise replaced by a space)
|
|
1258
|
+
*/
|
|
1142
1259
|
getValue(column, row, doNotReplaceNewline) {
|
|
1143
1260
|
var _a, _b;
|
|
1144
1261
|
let formattedValue = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getCellValue({ rowNode: row, colKey: column });
|
|
@@ -1165,6 +1282,13 @@ class DataGrid extends React.Component {
|
|
|
1165
1282
|
}
|
|
1166
1283
|
return formattedValue;
|
|
1167
1284
|
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Collects the table content for export: a header row with the displayed column names followed by one row of
|
|
1287
|
+
* {@link DataGrid.getValue} values per record (all filtered and sorted rows, or only the selected ones when
|
|
1288
|
+
* `props.onlySelectedNodes` is set). With a non client-side row model it waits for rows to be loaded.
|
|
1289
|
+
* @param progressPopup - optional popup updated with the progress
|
|
1290
|
+
* @returns rows of cell strings; empty when the grid is not ready
|
|
1291
|
+
*/
|
|
1168
1292
|
async getExportContent(progressPopup, props) {
|
|
1169
1293
|
if (!this.gridApi) {
|
|
1170
1294
|
return [];
|
|
@@ -1256,21 +1380,29 @@ class DataGrid extends React.Component {
|
|
|
1256
1380
|
} while (record.filter((cell) => !!cell).length === 0);
|
|
1257
1381
|
tableContent.push(record);
|
|
1258
1382
|
if (index % percentStep === 0) {
|
|
1383
|
+
// noinspection ES6MissingAwait
|
|
1259
1384
|
progressPopup === null || progressPopup === void 0 ? void 0 : progressPopup.update(Math.floor(index / rowCount * 100) - 1);
|
|
1260
1385
|
await TimeUtils.sleep(100);
|
|
1261
1386
|
}
|
|
1262
1387
|
}
|
|
1263
1388
|
}
|
|
1389
|
+
// noinspection ES6MissingAwait
|
|
1264
1390
|
progressPopup === null || progressPopup === void 0 ? void 0 : progressPopup.update(99);
|
|
1265
1391
|
await TimeUtils.sleep(300);
|
|
1266
1392
|
return tableContent;
|
|
1267
1393
|
}
|
|
1394
|
+
/**
|
|
1395
|
+
* ag-grid `cellFocused` handler: selects the focused row (Shift+arrow extends/shrinks the selection), tracks the
|
|
1396
|
+
* fill handle cell and forwards the event to `props.onCellFocused`.
|
|
1397
|
+
*/
|
|
1268
1398
|
onCellFocused(event) {
|
|
1269
1399
|
var _a, _b, _c, _d, _e;
|
|
1270
1400
|
const row = event.rowIndex !== null ? (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getDisplayedRowAtIndex(event.rowIndex) : undefined;
|
|
1271
1401
|
if (row) {
|
|
1272
|
-
if (this.lastNavigationEvent === 0 && KeyboardUtils.isKeyPressed(Key.Shift) && this.lastCellFocus && this.lastCellFocus.rowIndex !== event.rowIndex) {
|
|
1402
|
+
if (this.lastNavigationEvent === 0 /* NavigationEventEnum.KEYBOARD */ && KeyboardUtils.isKeyPressed(Key.Shift) && this.lastCellFocus && this.lastCellFocus.rowIndex !== event.rowIndex) {
|
|
1403
|
+
// focusing new row with SHIFT key pressed
|
|
1273
1404
|
if (!row.isSelected()) {
|
|
1405
|
+
// add to selection
|
|
1274
1406
|
row.setSelected(true, false);
|
|
1275
1407
|
}
|
|
1276
1408
|
else if (((_b = this.lastCellFocus) === null || _b === void 0 ? void 0 : _b.rowIndex) !== null) {
|
|
@@ -1294,6 +1426,7 @@ class DataGrid extends React.Component {
|
|
|
1294
1426
|
(_e = (_d = this.props).onCellFocused) === null || _e === void 0 ? void 0 : _e.call(_d, event);
|
|
1295
1427
|
this.lastCellFocus = event;
|
|
1296
1428
|
}
|
|
1429
|
+
/** ag-grid `cellMouseOver` handler: extends the fill handle range while dragging. */
|
|
1297
1430
|
onCellMouseOver(e) {
|
|
1298
1431
|
if (this.state.isDragging) {
|
|
1299
1432
|
this.setState({ endCoord: { rowIndex: e.rowIndex, colId: e.column.getColId() } }, () => {
|
|
@@ -1302,9 +1435,14 @@ class DataGrid extends React.Component {
|
|
|
1302
1435
|
});
|
|
1303
1436
|
}
|
|
1304
1437
|
}
|
|
1438
|
+
/**
|
|
1439
|
+
* ag-grid `cellMouseDown` handler: focuses the clicked cell, forwards the event to `props.onCellMouseDown` and
|
|
1440
|
+
* starts a fill handle drag when the bottom-right corner of the cell is pressed.
|
|
1441
|
+
*/
|
|
1305
1442
|
onCellMouseDown(e) {
|
|
1306
1443
|
var _a, _b;
|
|
1307
|
-
this.lastNavigationEvent = 1
|
|
1444
|
+
this.lastNavigationEvent = 1 /* NavigationEventEnum.MOUSE */;
|
|
1445
|
+
// always focus clicked cell (also when using shift key)
|
|
1308
1446
|
if (e.rowIndex !== null) {
|
|
1309
1447
|
this.setFocusedCellDebounced(e.rowIndex, e.column, e.rowPinned !== null ? e.rowPinned : undefined);
|
|
1310
1448
|
}
|
|
@@ -1323,6 +1461,7 @@ class DataGrid extends React.Component {
|
|
|
1323
1461
|
}
|
|
1324
1462
|
}
|
|
1325
1463
|
}
|
|
1464
|
+
/** Window `mouseup` handler: finishes a fill handle drag and calls `props.onFillHandleComplete`. */
|
|
1326
1465
|
onMouseUp() {
|
|
1327
1466
|
var _a, _b, _c, _d;
|
|
1328
1467
|
if (this.state.isDragging) {
|
|
@@ -1345,6 +1484,7 @@ class DataGrid extends React.Component {
|
|
|
1345
1484
|
}
|
|
1346
1485
|
}
|
|
1347
1486
|
;
|
|
1487
|
+
/** Focuses the given cell; debounced by 200 ms. */
|
|
1348
1488
|
setFocusedCellDebounced(rowIndex, column, rowPinned) {
|
|
1349
1489
|
var _a;
|
|
1350
1490
|
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.setFocusedCell(rowIndex, column, rowPinned);
|
|
@@ -1384,6 +1524,10 @@ class DataGrid extends React.Component {
|
|
|
1384
1524
|
" ",
|
|
1385
1525
|
i18n("Search"))));
|
|
1386
1526
|
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Replaces the grid's row data (client-side row model) without going through the `rowData` prop; intended for
|
|
1529
|
+
* {@link DataGridProps.rowDataManualMode}. No-op until the grid is ready.
|
|
1530
|
+
*/
|
|
1387
1531
|
setRowData(dataArray) {
|
|
1388
1532
|
var _a;
|
|
1389
1533
|
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.updateGridOptions({ rowData: dataArray });
|
|
@@ -1399,6 +1543,7 @@ class DataGrid extends React.Component {
|
|
|
1399
1543
|
this.props.onRowDataUpdated(event);
|
|
1400
1544
|
}
|
|
1401
1545
|
}
|
|
1546
|
+
/** ag-grid `getRowStyle` implementation: merges the matching `rowStyleRules` and then `props.getRowStyle`. */
|
|
1402
1547
|
_getRowStyle(params) {
|
|
1403
1548
|
const rowStyleRules = this.props.rowStyleRules;
|
|
1404
1549
|
if (rowStyleRules) {
|
|
@@ -1459,9 +1604,11 @@ class DataGrid extends React.Component {
|
|
|
1459
1604
|
}
|
|
1460
1605
|
return DataGrid.EMPTY_STYLE;
|
|
1461
1606
|
}
|
|
1607
|
+
/** ag-grid `getRowHeight` implementation: the current row height in pixels. */
|
|
1462
1608
|
_getRowHeight() {
|
|
1463
1609
|
return this.state.rowHeight;
|
|
1464
1610
|
}
|
|
1611
|
+
/** Cell style applied to every adapted column: font size, right alignment for `alignRight` and the column's own `cellStyle`. */
|
|
1465
1612
|
_getCellStyle(params) {
|
|
1466
1613
|
var _a;
|
|
1467
1614
|
const fontSize = this.state.fontSize;
|
|
@@ -1483,6 +1630,7 @@ class DataGrid extends React.Component {
|
|
|
1483
1630
|
}
|
|
1484
1631
|
return cellStyles;
|
|
1485
1632
|
}
|
|
1633
|
+
/** Returns `props.defaultColDef` extended with the grid's keyboard handling (`suppressKeyboardEvent` is always overridden). */
|
|
1486
1634
|
getDefaultColDefinition(colDef) {
|
|
1487
1635
|
if (colDef) {
|
|
1488
1636
|
return Object.assign(Object.assign({}, colDef), { suppressKeyboardEvent: this.suppressKeyboardEvent });
|
|
@@ -1504,6 +1652,7 @@ class DataGrid extends React.Component {
|
|
|
1504
1652
|
onExport(start) {
|
|
1505
1653
|
this.setState({ exporting: start });
|
|
1506
1654
|
}
|
|
1655
|
+
/** Renders the toolbar row: toolbar with search, pager (or record range when paging is disabled) and `toolbar.extraContent`. */
|
|
1507
1656
|
renderNavigationPanel() {
|
|
1508
1657
|
var _a, _b, _c;
|
|
1509
1658
|
return (React.createElement(React.Fragment, null,
|
|
@@ -1522,6 +1671,7 @@ class DataGrid extends React.Component {
|
|
|
1522
1671
|
: undefined, (_c = this.props.toolbar) === null || _c === void 0 ? void 0 :
|
|
1523
1672
|
_c.extraContent));
|
|
1524
1673
|
}
|
|
1674
|
+
/** Renders the default toolbar: `toolbar.toolbarButtons`, export and settings menus, search field and search button. */
|
|
1525
1675
|
renderToolBarWithSearch() {
|
|
1526
1676
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1527
1677
|
return (React.createElement(Space.Compact, { key: "filter-panel", className: "datagrid-autocomplete-input-group", style: { whiteSpace: "nowrap", flexGrow: 1, display: "flex" } }, (_a = this.props.toolbar) === null || _a === void 0 ? void 0 :
|
|
@@ -1554,6 +1704,7 @@ class DataGrid extends React.Component {
|
|
|
1554
1704
|
} }, this.state.loading ? React.createElement(LoadingOutlined, null) : ((_p = (_o = this.props.search) === null || _o === void 0 ? void 0 : _o.searchButtonIcon) !== null && _p !== void 0 ? _p : (((_q = this.props.search) === null || _q === void 0 ? void 0 : _q.hidden) ? React.createElement(ReloadOutlined, null) :
|
|
1555
1705
|
React.createElement(SearchOutlined, null))))));
|
|
1556
1706
|
}
|
|
1707
|
+
/** Builds the toolbar settings menu (keys `columnFilter`, `autosizeAllColumns`, `columnsConfig`, `advancedConfig`), passed through `settingsMenu.renderer`. */
|
|
1557
1708
|
getSettingsMenu() {
|
|
1558
1709
|
var _a;
|
|
1559
1710
|
let menuItems = [
|
|
@@ -1683,9 +1834,11 @@ class DataGrid extends React.Component {
|
|
|
1683
1834
|
key = "paginated-table";
|
|
1684
1835
|
}
|
|
1685
1836
|
else {
|
|
1837
|
+
// pagination is disabled
|
|
1686
1838
|
passedProperties.pagination = false;
|
|
1687
1839
|
key = "non-paginated-table";
|
|
1688
1840
|
}
|
|
1841
|
+
// nejde
|
|
1689
1842
|
const floatingFilterEnabled = !!filter && !!filter.columnSearchVisible;
|
|
1690
1843
|
const adaptedColumnDefs = this.getAdaptedColumnDefs(columnDefs, floatingFilterEnabled, !!disableColumnDefsPreprocessing);
|
|
1691
1844
|
const customComponents = this.getCustomComponents(components);
|
|
@@ -1713,6 +1866,7 @@ class DataGrid extends React.Component {
|
|
|
1713
1866
|
var _a, _b, _c, _d;
|
|
1714
1867
|
return React.createElement(Dropdown, { trigger: ["contextMenu"], getPopupContainer: (triggerNode) => {
|
|
1715
1868
|
var _a;
|
|
1869
|
+
// very nasty trick how remove error of ResizeObservers infinite cycling - because popover (with dynamic size) is placed in in resizable panel
|
|
1716
1870
|
const parentNode = ((_a = triggerNode === null || triggerNode === void 0 ? void 0 : triggerNode.parentNode) !== null && _a !== void 0 ? _a : document.body);
|
|
1717
1871
|
return parentNode;
|
|
1718
1872
|
}, menu: getContextMenu({
|
|
@@ -1748,7 +1902,7 @@ class DataGrid extends React.Component {
|
|
|
1748
1902
|
tableOverlayRenderer())),
|
|
1749
1903
|
!!this.gridApi && !!this.gridApi && this.state.pageSize !== null &&
|
|
1750
1904
|
React.createElement(DataGridEditor, { dataGrid: this, gridApi: this.gridApi, columnDefinitions: columnDefs, columnModel: this.state.columnModel, visible: !!this.props.tableConfigVisible, onTableConfigVisible: this.showTableConfiguration, paginationPageSize: paging.pageSize, paginationDefaultPageSize: paging.defaultPageSize, currentPageSize: this.state.pageSize, showMilliseconds: !!this.props.showMilliseconds, defaultShowMilliseconds: !!this.props.defaultShowMilliseconds, showYear: !this.props.hideYear, defaultShowYear: !this.props.defaultHideYear, showUtcOffset: !!this.props.showUtcOffset, defaultShowUtcOffset: !!this.props.defaultShowUtcOffset, rowStyleRules: this.props.rowStyleRules, defaultRowStyleRules: this.props.defaultRowStyleRules, onChangeRowStyleRules: onChangeRowStyleRules }),
|
|
1751
|
-
!!this.gridApi && React.createElement(ModalDialog, { mode: "OK_CANCEL"
|
|
1905
|
+
!!this.gridApi && React.createElement(ModalDialog, { mode: "OK_CANCEL" /* ModalDialogMode.OK_CANCEL */, open: this.state.columnsConfigVisible, initialWidth: 700, initialHeight: this.state.columnTransferHeight, title: React.createElement("span", null,
|
|
1752
1906
|
React.createElement(ControlOutlined, { style: {
|
|
1753
1907
|
color: "#faad14",
|
|
1754
1908
|
fontSize: 22,
|
|
@@ -1769,6 +1923,7 @@ class DataGrid extends React.Component {
|
|
|
1769
1923
|
React.createElement(ColumnTransfer, { columnDefinitions: columnDefs, columnModel: this.state.columnModel, gridApi: this.gridApi, height: this.state.columnTransferHeight - 154 }))));
|
|
1770
1924
|
}
|
|
1771
1925
|
}
|
|
1926
|
+
/** Default `paging` (automatic page size) and `rowStyleRules` ({@link tableDefaultRowStyleRules}). */
|
|
1772
1927
|
DataGrid.defaultProps = {
|
|
1773
1928
|
paging: {
|
|
1774
1929
|
pageSize: 0,
|
|
@@ -1794,8 +1949,10 @@ function getAgGridThemeFromAntd(algorithm, token) {
|
|
|
1794
1949
|
function agThemeEquals(newArgs, lastArgs) {
|
|
1795
1950
|
const [newAlgo, newToken] = newArgs;
|
|
1796
1951
|
const [lastAlgo, lastToken] = lastArgs;
|
|
1952
|
+
// Check algorithm reference (usually stable constants in Antd)
|
|
1797
1953
|
if (newAlgo !== lastAlgo)
|
|
1798
1954
|
return false;
|
|
1955
|
+
// Only compare the tokens you actually use in your function
|
|
1799
1956
|
return (newToken.colorPrimary === lastToken.colorPrimary &&
|
|
1800
1957
|
newToken.colorBgContainer === lastToken.colorBgContainer &&
|
|
1801
1958
|
newToken.colorText === lastToken.colorText &&
|