d2coreui 21.0.33 → 23.0.0
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/components/clipboard/clipboardUtils.d.ts +4 -3
- package/components/clipboard/clipboardUtils.js +47 -22
- package/components/clipboard/clipboardUtils.js.map +1 -1
- package/components/codemirror/SyntaxHighlighter.d.ts +21 -21
- package/components/codemirror/SyntaxHighlighter.js +45 -44
- package/components/codemirror/SyntaxHighlighter.js.map +1 -1
- package/components/collapse/expandable.d.ts +13 -12
- package/components/collapse/expandable.js +20 -20
- package/components/collapse/expandable.js.map +1 -1
- package/components/color/colorPicker.d.ts +20 -20
- package/components/color/colorPicker.js +53 -53
- package/components/color/colorPicker.js.map +1 -1
- package/components/color/colorSwatch.d.ts +13 -12
- package/components/color/colorSwatch.js +62 -62
- package/components/color/colorSwatch.js.map +1 -1
- package/components/color/colorUtils.d.ts +7 -7
- package/components/color/colorUtils.js +43 -43
- package/components/color/colorUtils.js.map +1 -1
- package/components/date/dateRangeInput.d.ts +66 -64
- package/components/date/dateRangeInput.js +292 -297
- package/components/date/dateRangeInput.js.map +1 -1
- package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -26
- package/components/date/dateRangeInputAdvancedPanel.js +130 -115
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateRangeInputConfirm.d.ts +31 -29
- package/components/date/dateRangeInputConfirm.js +132 -121
- package/components/date/dateRangeInputConfirm.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +72 -69
- package/components/date/dateTimeInput.js +440 -412
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.d.ts +59 -56
- package/components/date/durationInput.js +269 -280
- package/components/date/durationInput.js.map +1 -1
- package/components/form/NiceFormItem.d.ts +14 -14
- package/components/form/NiceFormItem.js +28 -31
- package/components/form/NiceFormItem.js.map +1 -1
- package/components/grid/cell/beanAccessor.d.ts +9 -0
- package/components/grid/cell/beanAccessor.js +13 -0
- package/components/grid/cell/beanAccessor.js.map +1 -0
- package/components/grid/cell/cellEditorUtils.d.ts +4 -4
- package/components/grid/cell/cellEditorUtils.js +8 -8
- package/components/grid/cell/customEnumCellEditor.d.ts +4 -26
- package/components/grid/cell/customEnumCellEditor.js +82 -91
- package/components/grid/cell/customEnumCellEditor.js.map +1 -1
- package/components/grid/cell/dataGridCellEditorComponent.d.ts +14 -0
- package/components/grid/cell/dataGridCellEditorComponent.js +49 -0
- package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -0
- package/components/grid/cell/dateCellEditor.d.ts +4 -25
- package/components/grid/cell/dateCellEditor.js +53 -72
- package/components/grid/cell/dateCellEditor.js.map +1 -1
- package/components/grid/cell/durationCellEditor.d.ts +4 -24
- package/components/grid/cell/durationCellEditor.js +74 -97
- package/components/grid/cell/durationCellEditor.js.map +1 -1
- package/components/grid/cell/hexaOctetStringCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaOctetStringCellEditor.js +70 -94
- package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
- package/components/grid/cell/hexaValueCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaValueCellEditor.js +65 -89
- package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
- package/components/grid/cell/numberCellEditor.d.ts +4 -27
- package/components/grid/cell/numberCellEditor.js +73 -95
- package/components/grid/cell/numberCellEditor.js.map +1 -1
- package/components/grid/cell/rangeSelector.d.ts +78 -78
- package/components/grid/cell/rangeSelector.js +526 -518
- package/components/grid/cell/rangeSelector.js.map +1 -1
- package/components/grid/cell/simpleStatusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/simpleStatusTextCellEditor.js +106 -116
- package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
- package/components/grid/cell/statusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/statusTextCellEditor.js +136 -159
- package/components/grid/cell/statusTextCellEditor.js.map +1 -1
- package/components/grid/cell/tableDefaultRowStyleRules.d.ts +20 -20
- package/components/grid/cell/tableDefaultRowStyleRules.js +29 -18
- package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
- package/components/grid/cell/textCellEditor.d.ts +4 -21
- package/components/grid/cell/textCellEditor.js +63 -85
- package/components/grid/cell/textCellEditor.js.map +1 -1
- package/components/grid/cell/withAgGridHooks.d.ts +3 -0
- package/components/grid/cell/withAgGridHooks.js +15 -0
- package/components/grid/cell/withAgGridHooks.js.map +1 -0
- package/components/grid/columnUtils.d.ts +5 -5
- package/components/grid/columnUtils.js +26 -26
- package/components/grid/columnUtils.js.map +1 -1
- package/components/grid/config/columnTransfer.d.ts +21 -22
- package/components/grid/config/columnTransfer.js +205 -201
- package/components/grid/config/columnTransfer.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +41 -41
- package/components/grid/config/dataGridEditor.js +181 -160
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/config/rowHeightCalculator.d.ts +8 -0
- package/components/grid/config/rowHeightCalculator.js +20 -0
- package/components/grid/config/rowHeightCalculator.js.map +1 -0
- package/components/grid/config/rowStylePicker.d.ts +27 -25
- package/components/grid/config/rowStylePicker.js +127 -109
- package/components/grid/config/rowStylePicker.js.map +1 -1
- package/components/grid/dataGrid.d.ts +218 -206
- package/components/grid/dataGrid.js +1629 -1538
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/detail/detailHeaderPanel.d.ts +13 -13
- package/components/grid/detail/detailHeaderPanel.js +25 -25
- package/components/grid/detail/detailHeaderPanel.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +18 -24
- package/components/grid/export/contextMenu.js +116 -113
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/progressPopup.d.ts +29 -29
- package/components/grid/export/progressPopup.js +93 -93
- package/components/grid/export/progressPopup.js.map +1 -1
- package/components/grid/export/worker/clipboardExport.d.ts +1 -1
- package/components/grid/export/worker/clipboardExport.js +8 -8
- package/components/grid/export/worker/csvExport.d.ts +1 -1
- package/components/grid/export/worker/csvExport.js +8 -8
- package/components/grid/export/worker/pdfExport.d.ts +1 -1
- package/components/grid/export/worker/pdfExport.js +81 -81
- package/components/grid/export/worker/pdfExport.js.map +1 -1
- package/components/grid/export/worker/txtExport.d.ts +1 -1
- package/components/grid/export/worker/txtExport.js +19 -19
- package/components/grid/extendedDataGrid.d.ts +140 -140
- package/components/grid/extendedDataGrid.js +704 -695
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/grid/filter/customColumnFilter.d.ts +5 -21
- package/components/grid/filter/customColumnFilter.js +11 -82
- package/components/grid/filter/customColumnFilter.js.map +1 -1
- package/components/grid/filter/dataGridColumnFilter.d.ts +17 -0
- package/components/grid/filter/dataGridColumnFilter.js +49 -0
- package/components/grid/filter/dataGridColumnFilter.js.map +1 -0
- package/components/grid/filter/dateColumnFilter.d.ts +7 -11
- package/components/grid/filter/dateColumnFilter.js +22 -56
- package/components/grid/filter/dateColumnFilter.js.map +1 -1
- package/components/grid/filter/textColumnFilter.d.ts +8 -20
- package/components/grid/filter/textColumnFilter.js +24 -76
- package/components/grid/filter/textColumnFilter.js.map +1 -1
- package/components/grid/filter/wildcardQuickFilterEngine.d.ts +7 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js +48 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -0
- package/components/grid/header/simpleHeader.d.ts +17 -16
- package/components/grid/header/simpleHeader.js +230 -186
- package/components/grid/header/simpleHeader.js.map +1 -1
- package/components/grid/panel/dataGridPagination.d.ts +16 -16
- package/components/grid/panel/dataGridPagination.js +58 -58
- package/components/grid/panel/dataGridPagination.js.map +1 -1
- package/components/grid/panel/loadingOverlay.d.ts +6 -6
- package/components/grid/panel/loadingOverlay.js +10 -10
- package/components/grid/panel/loadingOverlay.js.map +1 -1
- package/components/grid/panel/noRecordsOverlay.d.ts +6 -6
- package/components/grid/panel/noRecordsOverlay.js +10 -10
- package/components/grid/panel/noRecordsOverlay.js.map +1 -1
- package/components/grid/panel/tablePagination.d.ts +10 -10
- package/components/grid/panel/tablePagination.js +45 -45
- package/components/grid/panel/tablePagination.js.map +1 -1
- package/components/icons/dropdownArrow.d.ts +8 -0
- package/components/icons/dropdownArrow.js +59 -0
- package/components/icons/dropdownArrow.js.map +1 -0
- package/components/icons/undoIcon.d.ts +8 -8
- package/components/icons/undoIcon.js +6 -6
- package/components/input/autoCompleteInput.d.ts +35 -35
- package/components/input/autoCompleteInput.js +122 -121
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/input/draftUtils.d.ts +4 -4
- package/components/input/draftUtils.js +48 -48
- package/components/input/draftUtils.js.map +1 -1
- package/components/input/draftail.d.ts +1 -1
- package/components/input/draftail.js +1 -1
- package/components/input/hexaFormattedInput.d.ts +16 -16
- package/components/input/hexaFormattedInput.js +54 -54
- package/components/input/hexaFormattedInput.js.map +1 -1
- package/components/input/mask/helpers.d.ts +28 -28
- package/components/input/mask/helpers.js +112 -112
- package/components/input/mask/helpers.js.map +1 -1
- package/components/input/mask/inputMaskCore.d.ts +46 -46
- package/components/input/mask/inputMaskCore.js +278 -278
- package/components/input/mask/inputMaskCore.js.map +1 -1
- package/components/input/mask/pattern.d.ts +20 -20
- package/components/input/mask/pattern.js +78 -78
- package/components/input/mask/pattern.js.map +1 -1
- package/components/input/maskedInput.d.ts +373 -351
- package/components/input/maskedInput.js +224 -224
- package/components/input/maskedInput.js.map +1 -1
- package/components/input/passwordInput.d.ts +9 -9
- package/components/input/passwordInput.js +55 -55
- package/components/input/passwordInput.js.map +1 -1
- package/components/input/simpleAutoComplete.d.ts +12 -12
- package/components/input/simpleAutoComplete.js +41 -43
- package/components/input/simpleAutoComplete.js.map +1 -1
- package/components/input/textarea/extractSpansOfClasses.d.ts +15 -15
- package/components/input/textarea/extractSpansOfClasses.js +96 -96
- package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
- package/components/input/textarea/getRanges.d.ts +1 -1
- package/components/input/textarea/getRanges.js +73 -73
- package/components/input/textarea/getRanges.js.map +1 -1
- package/components/input/textarea/getType.d.ts +1 -1
- package/components/input/textarea/getType.js +26 -26
- package/components/input/textarea/getType.js.map +1 -1
- package/components/input/textarea/highlighedContents.d.ts +6 -6
- package/components/input/textarea/highlighedContents.js +10 -10
- package/components/input/textarea/mentionsWithHighlighting.d.ts +27 -27
- package/components/input/textarea/mentionsWithHighlighting.js +60 -60
- package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
- package/components/keyboard/keyboardUtils.d.ts +5 -5
- package/components/keyboard/keyboardUtils.js +32 -32
- package/components/modal/draggableModalProvider.d.ts +4 -4
- package/components/modal/draggableModalProvider.js +21 -21
- package/components/modal/draggableModalProvider.js.map +1 -1
- package/components/modal/impl/clamp.d.ts +1 -1
- package/components/modal/impl/clamp.js +1 -1
- package/components/modal/impl/clamp.js.map +1 -1
- package/components/modal/impl/draggableModal.d.ts +12 -12
- package/components/modal/impl/draggableModal.js +17 -17
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalContext.d.ts +9 -9
- package/components/modal/impl/draggableModalContext.js +2 -2
- package/components/modal/impl/draggableModalContext.js.map +1 -1
- package/components/modal/impl/draggableModalInner.d.ts +15 -13
- package/components/modal/impl/draggableModalInner.js +57 -55
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +66 -62
- package/components/modal/impl/draggableModalReducer.js +77 -78
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/getWindowSize.d.ts +4 -4
- package/components/modal/impl/getWindowSize.js +4 -4
- package/components/modal/impl/getWindowSize.js.map +1 -1
- package/components/modal/impl/index.d.ts +3 -3
- package/components/modal/impl/index.js +3 -3
- package/components/modal/impl/index.js.map +1 -1
- package/components/modal/impl/resizeHandle.d.ts +3 -3
- package/components/modal/impl/resizeHandle.js +4 -4
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/impl/useDrag.d.ts +5 -5
- package/components/modal/impl/useDrag.js +42 -42
- package/components/modal/impl/useDrag.js.map +1 -1
- package/components/modal/impl/usePrevious.d.ts +1 -1
- package/components/modal/impl/usePrevious.js +8 -8
- package/components/modal/impl/usePrevious.js.map +1 -1
- package/components/modal/impl/useResize.d.ts +7 -7
- package/components/modal/impl/useResize.js +46 -46
- package/components/modal/impl/useResize.js.map +1 -1
- package/components/modal/modalDialog.d.ts +49 -49
- package/components/modal/modalDialog.js +152 -152
- package/components/modal/modalDialog.js.map +1 -1
- package/components/picker/enumValuePicker.d.ts +16 -16
- package/components/picker/enumValuePicker.js +34 -34
- package/components/picker/enumValuePicker.js.map +1 -1
- package/components/platformSpecific.d.ts +10 -10
- package/components/platformSpecific.js +27 -27
- package/components/scrollTo/onlyText.d.ts +4 -4
- package/components/scrollTo/onlyText.js +30 -30
- package/components/scrollTo/onlyText.js.map +1 -1
- package/components/scrollTo/scrollTo.d.ts +41 -39
- package/components/scrollTo/scrollTo.js +264 -264
- package/components/scrollTo/scrollTo.js.map +1 -1
- package/components/style/withCss.d.ts +9 -0
- package/components/style/withCss.js +6 -0
- package/components/style/withCss.js.map +1 -0
- package/components/style/withInputNumberCss.d.ts +6 -0
- package/components/style/withInputNumberCss.js +13 -0
- package/components/style/withInputNumberCss.js.map +1 -0
- package/components/table/dragSortingTable.d.ts +13 -14
- package/components/table/dragSortingTable.js +96 -82
- package/components/table/dragSortingTable.js.map +1 -1
- package/components/text/impl/innerSize.d.ts +2 -2
- package/components/text/impl/innerSize.js +12 -12
- package/components/text/impl/series.d.ts +1 -1
- package/components/text/impl/series.js +28 -28
- package/components/text/impl/shallowEqual.d.ts +1 -1
- package/components/text/impl/shallowEqual.js +18 -18
- package/components/text/impl/shallowEqual.js.map +1 -1
- package/components/text/impl/uniqueId.d.ts +1 -1
- package/components/text/impl/uniqueId.js +4 -4
- package/components/text/impl/whilst.d.ts +1 -1
- package/components/text/impl/whilst.js +19 -19
- package/components/text/impl/whilst.js.map +1 -1
- package/components/text/textFit.d.ts +38 -38
- package/components/text/textFit.js +165 -168
- package/components/text/textFit.js.map +1 -1
- package/i18n/components.cs.json +101 -100
- package/i18n/components.sk.json +101 -100
- package/i18n/components.uk.json +101 -100
- package/i18n/componentsLocaleHolder.d.ts +3 -3
- package/i18n/componentsLocaleHolder.js +28 -28
- package/i18n/componentsLocaleHolder.js.map +1 -1
- package/package.json +71 -70
- package/style/index.less +274 -298
- package/style/modal/DraggableModal.css +43 -40
- package/style/modal/ResizeHandle.css +27 -19
- package/tsconfig.build.json +24 -24
- package/tsconfig.json +11 -11
- package/components/grid/cell/wildcardQuickFilter.d.ts +0 -11
- package/components/grid/cell/wildcardQuickFilter.js +0 -61
- package/components/grid/cell/wildcardQuickFilter.js.map +0 -1
- package/components/table/dataTable.d.ts +0 -17
- package/components/table/dataTable.js +0 -79
- package/components/table/dataTable.js.map +0 -1
- package/style/antd/antd-tree-showline.css +0 -25
- package/style/antd/full-height-tabs.scss +0 -63
- package/style/draftail/draftail-editor.css +0 -179
- package/style/table/dragSortingTable.css +0 -7
|
@@ -1,696 +1,705 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React from "react";
|
|
13
|
-
import * as FlexLayout from "flexlayout-react";
|
|
14
|
-
import { Actions } from "flexlayout-react";
|
|
15
|
-
import { ExclamationOutlined, EyeInvisibleOutlined, EyeOutlined, FilterOutlined } from "@ant-design/icons";
|
|
16
|
-
import { Badge, Button, Empty } from "antd";
|
|
17
|
-
import DataGrid from "./dataGrid";
|
|
18
|
-
import debounce from "lodash/debounce";
|
|
19
|
-
import i18n from "d2core/i18n/i18n";
|
|
20
|
-
import isEqual from "lodash/isEqual";
|
|
21
|
-
import isEqualWith from "lodash/isEqualWith";
|
|
22
|
-
import cloneDeep from "lodash/cloneDeep";
|
|
23
|
-
import tableDefaultRowStyleRules from "d2coreui/components/grid/cell/tableDefaultRowStyleRules";
|
|
24
|
-
import { ColumnUtils } from "./columnUtils";
|
|
25
|
-
const CONFIGURATION_VERSION = 1;
|
|
26
|
-
|
|
27
|
-
constructor(props) {
|
|
28
|
-
var _a, _b, _c, _d, _e;
|
|
29
|
-
super(props);
|
|
30
|
-
this.flexLayout = null;
|
|
31
|
-
let gridConfiguration = {
|
|
32
|
-
version: CONFIGURATION_VERSION,
|
|
33
|
-
pageSize: 0
|
|
34
|
-
};
|
|
35
|
-
const gridConfigurationOk = props.defaultGridConfiguration && (!props.defaultGridConfiguration.version || props.defaultGridConfiguration.version === CONFIGURATION_VERSION);
|
|
36
|
-
const layoutModelExists = gridConfigurationOk && !!props.defaultGridConfiguration.layoutModel;
|
|
37
|
-
gridConfiguration.layoutModel = layoutModelExists ? props.defaultGridConfiguration.layoutModel : this._getInitialLayoutModel(props);
|
|
38
|
-
gridConfiguration.columnModel = gridConfigurationOk && props.defaultGridConfiguration.columnModel ? props.defaultGridConfiguration.columnModel : undefined;
|
|
39
|
-
gridConfiguration.pageSize = gridConfigurationOk && props.defaultGridConfiguration.pageSize ? props.defaultGridConfiguration.pageSize : 0;
|
|
40
|
-
gridConfiguration.defaultPageSize = gridConfigurationOk && props.defaultGridConfiguration.defaultPageSize ? props.defaultGridConfiguration.defaultPageSize : undefined;
|
|
41
|
-
gridConfiguration.followLastRecord = gridConfigurationOk && props.defaultGridConfiguration.followLastRecord;
|
|
42
|
-
gridConfiguration.followLastRecordSortModel = gridConfigurationOk && props.defaultGridConfiguration.followLastRecordSortModel ? props.defaultGridConfiguration.followLastRecordSortModel : undefined;
|
|
43
|
-
gridConfiguration.followLastRecordEditable = gridConfigurationOk && props.defaultGridConfiguration.followLastRecordEditable;
|
|
44
|
-
gridConfiguration.columnSearchVisible = gridConfigurationOk && props.defaultGridConfiguration.columnSearchVisible;
|
|
45
|
-
gridConfiguration.rowStyleRules = gridConfigurationOk && props.defaultGridConfiguration.rowStyleRules ? props.defaultGridConfiguration.rowStyleRules : tableDefaultRowStyleRules();
|
|
46
|
-
gridConfiguration.defaultRowStyleRules = gridConfigurationOk && props.defaultGridConfiguration.defaultRowStyleRules ? props.defaultGridConfiguration.defaultRowStyleRules : tableDefaultRowStyleRules();
|
|
47
|
-
gridConfiguration.showMilliseconds = gridConfigurationOk && props.defaultGridConfiguration.showMilliseconds ? props.defaultGridConfiguration.showMilliseconds : false;
|
|
48
|
-
gridConfiguration.defaultShowMilliseconds = gridConfigurationOk && props.defaultGridConfiguration.defaultShowMilliseconds ? props.defaultGridConfiguration.defaultShowMilliseconds : false;
|
|
49
|
-
gridConfiguration.hideYear = gridConfigurationOk && props.defaultGridConfiguration.hideYear ? props.defaultGridConfiguration.hideYear : false;
|
|
50
|
-
gridConfiguration.defaultHideYear = gridConfigurationOk && props.defaultGridConfiguration.defaultHideYear ? props.defaultGridConfiguration.defaultHideYear : false;
|
|
51
|
-
const layoutLength = (_d = (_c = (_b = (_a = gridConfiguration.layoutModel) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
|
|
52
|
-
if (layoutLength > 0) {
|
|
53
|
-
for (let i = 0; i < layoutLength; i++) {
|
|
54
|
-
if (!gridConfiguration.layoutModel.layout.children[i].id) {
|
|
55
|
-
gridConfiguration.layoutModel.layout.children[i].id = `#${(i + 1) * 2}`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
this.state = {
|
|
60
|
-
layoutModel: FlexLayout.Model.fromJson(gridConfiguration.layoutModel),
|
|
61
|
-
gridConfiguration: gridConfiguration,
|
|
62
|
-
searchString: "",
|
|
63
|
-
searchHistory: props.search && props.search.initialSearchHistory ? [...props.search.initialSearchHistory] : [],
|
|
64
|
-
tableConfigVisible: false,
|
|
65
|
-
defaultFilter: this.props.filterPanel && this.props.filterPanel.defaultFilter ? cloneDeep(this.props.filterPanel.defaultFilter) : undefined,
|
|
66
|
-
filterChanged: false,
|
|
67
|
-
tableNeedToBeReloaded: false
|
|
68
|
-
};
|
|
69
|
-
if (!layoutModelExists && props.filterPanel && props.filterPanel.hidden) {
|
|
70
|
-
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes("#2", { width: 0 }));
|
|
71
|
-
this.state.gridConfiguration.layoutModel.layout.children[0].width = 0;
|
|
72
|
-
}
|
|
73
|
-
if (props.detailPanel) {
|
|
74
|
-
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes(props.filterPanel ? "#6" : "#4", { width: 0 }));
|
|
75
|
-
}
|
|
76
|
-
this.dataLoaded = false;
|
|
77
|
-
this.dataTransaction = { add: [], remove: [], update: [] };
|
|
78
|
-
const debounceInterval = (_e = props.updateDataDebounceInterval) !== null && _e !== void 0 ? _e : 500;
|
|
79
|
-
if (debounceInterval > 0) {
|
|
80
|
-
this._updateDataDebounced = debounce(this._updateData.bind(this), debounceInterval, { maxWait: debounceInterval });
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this._updateDataDebounced = this._updateData.bind(this);
|
|
84
|
-
}
|
|
85
|
-
this.renderToolbarButtons = this.renderToolbarButtons.bind(this);
|
|
86
|
-
this._onLoadData = this._onLoadData.bind(this);
|
|
87
|
-
this._onGridReady = this._onGridReady.bind(this);
|
|
88
|
-
this._onPaginationChanged = this._onPaginationChanged.bind(this);
|
|
89
|
-
this._onSearch = this._onSearch.bind(this);
|
|
90
|
-
this._onSearchStringChanged = this._onSearchStringChanged.bind(this);
|
|
91
|
-
this.renderToolbar = this.renderToolbar.bind(this);
|
|
92
|
-
this._followLastRecordDebounced = debounce(this._followLastRecordDebounced.bind(this), 500, { maxWait: 500 });
|
|
93
|
-
this._onRowDataUpdated = this._onRowDataUpdated.bind(this);
|
|
94
|
-
this._onChangeRowStyleRules = this._onChangeRowStyleRules.bind(this);
|
|
95
|
-
this.showFilterPanel = this.showFilterPanel.bind(this);
|
|
96
|
-
this.showDetailPanel = this.showDetailPanel.bind(this);
|
|
97
|
-
this.selectNextPreviousRecord = this.selectNextPreviousRecord.bind(this);
|
|
98
|
-
this._onSelectionChanged = this._onSelectionChanged.bind(this);
|
|
99
|
-
this._onViewportChanged = this._onViewportChanged.bind(this);
|
|
100
|
-
}
|
|
101
|
-
_getInitialLayoutModel(props) {
|
|
102
|
-
const renderFilter = props.filterPanel && props.filterPanel.renderer;
|
|
103
|
-
const renderDetail = props.detailPanel;
|
|
104
|
-
const layoutModel = {
|
|
105
|
-
global: {
|
|
106
|
-
tabSetEnableTabStrip: false,
|
|
107
|
-
splitterSize: 4,
|
|
108
|
-
},
|
|
109
|
-
borders: [],
|
|
110
|
-
layout: {
|
|
111
|
-
"type": "row",
|
|
112
|
-
"weight": 100,
|
|
113
|
-
"children": [{
|
|
114
|
-
"type": "tabset",
|
|
115
|
-
"weight": 100,
|
|
116
|
-
"selected": 0,
|
|
117
|
-
"children": [
|
|
118
|
-
{
|
|
119
|
-
"type": "tab",
|
|
120
|
-
"name": "Data",
|
|
121
|
-
"component": "data-panel",
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
}]
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
if (renderFilter) {
|
|
128
|
-
layoutModel.layout["children"].unshift({
|
|
129
|
-
"id": "#2",
|
|
130
|
-
"type": "tabset",
|
|
131
|
-
"width": props.filterPanel && props.filterPanel.defaultWidth ? props.filterPanel.defaultWidth : 228,
|
|
132
|
-
"selected": 0,
|
|
133
|
-
"children": [
|
|
134
|
-
{
|
|
135
|
-
"type": "tab",
|
|
136
|
-
"name": "Filter",
|
|
137
|
-
"component": "filter-panel",
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
if (renderDetail) {
|
|
143
|
-
layoutModel.layout["children"].push({
|
|
144
|
-
"id": props.filterPanel ? "#6" : "#4",
|
|
145
|
-
"type": "tabset",
|
|
146
|
-
"width": props.detailPanel ? (props.detailPanel.defaultWidth ? props.detailPanel.defaultWidth : 220) : 0,
|
|
147
|
-
"selected": 0,
|
|
148
|
-
"children": [
|
|
149
|
-
{
|
|
150
|
-
"type": "tab",
|
|
151
|
-
"name": "Detail",
|
|
152
|
-
"component": "detail-panel",
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
return layoutModel;
|
|
158
|
-
}
|
|
159
|
-
getConfiguration() {
|
|
160
|
-
return this.state.gridConfiguration;
|
|
161
|
-
}
|
|
162
|
-
getSearchContext() {
|
|
163
|
-
const searchHistory = [...this.state.searchHistory];
|
|
164
|
-
searchHistory.reverse();
|
|
165
|
-
return {
|
|
166
|
-
searchString: this.state.searchString,
|
|
167
|
-
searchHistory: searchHistory
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
loadData(callback) {
|
|
171
|
-
var _a;
|
|
172
|
-
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.loadData(callback);
|
|
173
|
-
}
|
|
174
|
-
isActive() {
|
|
175
|
-
return !!this.dataGrid && this.dataGrid.isActive();
|
|
176
|
-
}
|
|
177
|
-
focus() {
|
|
178
|
-
var _a;
|
|
179
|
-
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.focus();
|
|
180
|
-
}
|
|
181
|
-
_changeConfiguration(configuration, callback) {
|
|
182
|
-
if (this.props.disableConfigurationChange) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const newConfiguration = Object.assign(this.state.gridConfiguration, configuration);
|
|
186
|
-
this.setState({ gridConfiguration: newConfiguration }, callback);
|
|
187
|
-
if (this.props.onChangeConfiguration) {
|
|
188
|
-
this.props.onChangeConfiguration(this.state.gridConfiguration);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
_onGridReady(event) {
|
|
192
|
-
this.gridApi = event.api;
|
|
193
|
-
this.
|
|
194
|
-
this.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this.
|
|
205
|
-
this.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
this.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
this.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
searchHistory
|
|
232
|
-
searchHistory.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
this.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
this.dataTransaction.
|
|
256
|
-
this.dataTransaction.
|
|
257
|
-
this.dataTransaction.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
this.dataTransaction.
|
|
262
|
-
this.dataTransaction.
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
this.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
this.
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
this.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
this.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
this.
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
var _a;
|
|
415
|
-
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
var _a
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
if (
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
if (this.
|
|
521
|
-
this.
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
this.
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import * as FlexLayout from "flexlayout-react";
|
|
14
|
+
import { Actions } from "flexlayout-react";
|
|
15
|
+
import { ExclamationOutlined, EyeInvisibleOutlined, EyeOutlined, FilterOutlined } from "@ant-design/icons";
|
|
16
|
+
import { Badge, Button, Empty } from "antd";
|
|
17
|
+
import DataGrid from "./dataGrid";
|
|
18
|
+
import debounce from "lodash/debounce";
|
|
19
|
+
import i18n from "d2core/i18n/i18n";
|
|
20
|
+
import isEqual from "lodash/isEqual";
|
|
21
|
+
import isEqualWith from "lodash/isEqualWith";
|
|
22
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
23
|
+
import tableDefaultRowStyleRules from "d2coreui/components/grid/cell/tableDefaultRowStyleRules";
|
|
24
|
+
import { ColumnUtils } from "./columnUtils";
|
|
25
|
+
const CONFIGURATION_VERSION = 1;
|
|
26
|
+
class ExtendedDataGrid extends React.Component {
|
|
27
|
+
constructor(props) {
|
|
28
|
+
var _a, _b, _c, _d, _e;
|
|
29
|
+
super(props);
|
|
30
|
+
this.flexLayout = null;
|
|
31
|
+
let gridConfiguration = {
|
|
32
|
+
version: CONFIGURATION_VERSION,
|
|
33
|
+
pageSize: 0
|
|
34
|
+
};
|
|
35
|
+
const gridConfigurationOk = props.defaultGridConfiguration && (!props.defaultGridConfiguration.version || props.defaultGridConfiguration.version === CONFIGURATION_VERSION);
|
|
36
|
+
const layoutModelExists = gridConfigurationOk && !!props.defaultGridConfiguration.layoutModel;
|
|
37
|
+
gridConfiguration.layoutModel = layoutModelExists ? props.defaultGridConfiguration.layoutModel : this._getInitialLayoutModel(props);
|
|
38
|
+
gridConfiguration.columnModel = gridConfigurationOk && props.defaultGridConfiguration.columnModel ? props.defaultGridConfiguration.columnModel : undefined;
|
|
39
|
+
gridConfiguration.pageSize = gridConfigurationOk && props.defaultGridConfiguration.pageSize ? props.defaultGridConfiguration.pageSize : 0;
|
|
40
|
+
gridConfiguration.defaultPageSize = gridConfigurationOk && props.defaultGridConfiguration.defaultPageSize ? props.defaultGridConfiguration.defaultPageSize : undefined;
|
|
41
|
+
gridConfiguration.followLastRecord = gridConfigurationOk && props.defaultGridConfiguration.followLastRecord;
|
|
42
|
+
gridConfiguration.followLastRecordSortModel = gridConfigurationOk && props.defaultGridConfiguration.followLastRecordSortModel ? props.defaultGridConfiguration.followLastRecordSortModel : undefined;
|
|
43
|
+
gridConfiguration.followLastRecordEditable = gridConfigurationOk && props.defaultGridConfiguration.followLastRecordEditable;
|
|
44
|
+
gridConfiguration.columnSearchVisible = gridConfigurationOk && props.defaultGridConfiguration.columnSearchVisible;
|
|
45
|
+
gridConfiguration.rowStyleRules = gridConfigurationOk && props.defaultGridConfiguration.rowStyleRules ? props.defaultGridConfiguration.rowStyleRules : tableDefaultRowStyleRules();
|
|
46
|
+
gridConfiguration.defaultRowStyleRules = gridConfigurationOk && props.defaultGridConfiguration.defaultRowStyleRules ? props.defaultGridConfiguration.defaultRowStyleRules : tableDefaultRowStyleRules();
|
|
47
|
+
gridConfiguration.showMilliseconds = gridConfigurationOk && props.defaultGridConfiguration.showMilliseconds ? props.defaultGridConfiguration.showMilliseconds : false;
|
|
48
|
+
gridConfiguration.defaultShowMilliseconds = gridConfigurationOk && props.defaultGridConfiguration.defaultShowMilliseconds ? props.defaultGridConfiguration.defaultShowMilliseconds : false;
|
|
49
|
+
gridConfiguration.hideYear = gridConfigurationOk && props.defaultGridConfiguration.hideYear ? props.defaultGridConfiguration.hideYear : false;
|
|
50
|
+
gridConfiguration.defaultHideYear = gridConfigurationOk && props.defaultGridConfiguration.defaultHideYear ? props.defaultGridConfiguration.defaultHideYear : false;
|
|
51
|
+
const layoutLength = (_d = (_c = (_b = (_a = gridConfiguration.layoutModel) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
|
|
52
|
+
if (layoutLength > 0) {
|
|
53
|
+
for (let i = 0; i < layoutLength; i++) {
|
|
54
|
+
if (!gridConfiguration.layoutModel.layout.children[i].id) {
|
|
55
|
+
gridConfiguration.layoutModel.layout.children[i].id = `#${(i + 1) * 2}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
this.state = {
|
|
60
|
+
layoutModel: FlexLayout.Model.fromJson(gridConfiguration.layoutModel),
|
|
61
|
+
gridConfiguration: gridConfiguration,
|
|
62
|
+
searchString: "",
|
|
63
|
+
searchHistory: props.search && props.search.initialSearchHistory ? [...props.search.initialSearchHistory] : [],
|
|
64
|
+
tableConfigVisible: false,
|
|
65
|
+
defaultFilter: this.props.filterPanel && this.props.filterPanel.defaultFilter ? cloneDeep(this.props.filterPanel.defaultFilter) : undefined,
|
|
66
|
+
filterChanged: false,
|
|
67
|
+
tableNeedToBeReloaded: false
|
|
68
|
+
};
|
|
69
|
+
if (!layoutModelExists && props.filterPanel && props.filterPanel.hidden) {
|
|
70
|
+
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes("#2", { width: 0 }));
|
|
71
|
+
this.state.gridConfiguration.layoutModel.layout.children[0].width = 0;
|
|
72
|
+
}
|
|
73
|
+
if (props.detailPanel) {
|
|
74
|
+
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes(props.filterPanel ? "#6" : "#4", { width: 0 }));
|
|
75
|
+
}
|
|
76
|
+
this.dataLoaded = false;
|
|
77
|
+
this.dataTransaction = { add: [], remove: [], update: [] };
|
|
78
|
+
const debounceInterval = (_e = props.updateDataDebounceInterval) !== null && _e !== void 0 ? _e : 500;
|
|
79
|
+
if (debounceInterval > 0) {
|
|
80
|
+
this._updateDataDebounced = debounce(this._updateData.bind(this), debounceInterval, { maxWait: debounceInterval });
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this._updateDataDebounced = this._updateData.bind(this);
|
|
84
|
+
}
|
|
85
|
+
this.renderToolbarButtons = this.renderToolbarButtons.bind(this);
|
|
86
|
+
this._onLoadData = this._onLoadData.bind(this);
|
|
87
|
+
this._onGridReady = this._onGridReady.bind(this);
|
|
88
|
+
this._onPaginationChanged = this._onPaginationChanged.bind(this);
|
|
89
|
+
this._onSearch = this._onSearch.bind(this);
|
|
90
|
+
this._onSearchStringChanged = this._onSearchStringChanged.bind(this);
|
|
91
|
+
this.renderToolbar = this.renderToolbar.bind(this);
|
|
92
|
+
this._followLastRecordDebounced = debounce(this._followLastRecordDebounced.bind(this), 500, { maxWait: 500 });
|
|
93
|
+
this._onRowDataUpdated = this._onRowDataUpdated.bind(this);
|
|
94
|
+
this._onChangeRowStyleRules = this._onChangeRowStyleRules.bind(this);
|
|
95
|
+
this.showFilterPanel = this.showFilterPanel.bind(this);
|
|
96
|
+
this.showDetailPanel = this.showDetailPanel.bind(this);
|
|
97
|
+
this.selectNextPreviousRecord = this.selectNextPreviousRecord.bind(this);
|
|
98
|
+
this._onSelectionChanged = this._onSelectionChanged.bind(this);
|
|
99
|
+
this._onViewportChanged = this._onViewportChanged.bind(this);
|
|
100
|
+
}
|
|
101
|
+
_getInitialLayoutModel(props) {
|
|
102
|
+
const renderFilter = props.filterPanel && props.filterPanel.renderer;
|
|
103
|
+
const renderDetail = props.detailPanel;
|
|
104
|
+
const layoutModel = {
|
|
105
|
+
global: {
|
|
106
|
+
tabSetEnableTabStrip: false,
|
|
107
|
+
splitterSize: 4,
|
|
108
|
+
},
|
|
109
|
+
borders: [],
|
|
110
|
+
layout: {
|
|
111
|
+
"type": "row",
|
|
112
|
+
"weight": 100,
|
|
113
|
+
"children": [{
|
|
114
|
+
"type": "tabset",
|
|
115
|
+
"weight": 100,
|
|
116
|
+
"selected": 0,
|
|
117
|
+
"children": [
|
|
118
|
+
{
|
|
119
|
+
"type": "tab",
|
|
120
|
+
"name": "Data",
|
|
121
|
+
"component": "data-panel",
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}]
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
if (renderFilter) {
|
|
128
|
+
layoutModel.layout["children"].unshift({
|
|
129
|
+
"id": "#2",
|
|
130
|
+
"type": "tabset",
|
|
131
|
+
"width": props.filterPanel && props.filterPanel.defaultWidth ? props.filterPanel.defaultWidth : 228,
|
|
132
|
+
"selected": 0,
|
|
133
|
+
"children": [
|
|
134
|
+
{
|
|
135
|
+
"type": "tab",
|
|
136
|
+
"name": "Filter",
|
|
137
|
+
"component": "filter-panel",
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (renderDetail) {
|
|
143
|
+
layoutModel.layout["children"].push({
|
|
144
|
+
"id": props.filterPanel ? "#6" : "#4",
|
|
145
|
+
"type": "tabset",
|
|
146
|
+
"width": props.detailPanel ? (props.detailPanel.defaultWidth ? props.detailPanel.defaultWidth : 220) : 0,
|
|
147
|
+
"selected": 0,
|
|
148
|
+
"children": [
|
|
149
|
+
{
|
|
150
|
+
"type": "tab",
|
|
151
|
+
"name": "Detail",
|
|
152
|
+
"component": "detail-panel",
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return layoutModel;
|
|
158
|
+
}
|
|
159
|
+
getConfiguration() {
|
|
160
|
+
return this.state.gridConfiguration;
|
|
161
|
+
}
|
|
162
|
+
getSearchContext() {
|
|
163
|
+
const searchHistory = [...this.state.searchHistory];
|
|
164
|
+
searchHistory.reverse();
|
|
165
|
+
return {
|
|
166
|
+
searchString: this.state.searchString,
|
|
167
|
+
searchHistory: searchHistory
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
loadData(callback) {
|
|
171
|
+
var _a;
|
|
172
|
+
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.loadData(callback);
|
|
173
|
+
}
|
|
174
|
+
isActive() {
|
|
175
|
+
return !!this.dataGrid && this.dataGrid.isActive();
|
|
176
|
+
}
|
|
177
|
+
focus() {
|
|
178
|
+
var _a;
|
|
179
|
+
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.focus();
|
|
180
|
+
}
|
|
181
|
+
_changeConfiguration(configuration, callback) {
|
|
182
|
+
if (this.props.disableConfigurationChange) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const newConfiguration = Object.assign(this.state.gridConfiguration, configuration);
|
|
186
|
+
this.setState({ gridConfiguration: newConfiguration }, callback);
|
|
187
|
+
if (this.props.onChangeConfiguration) {
|
|
188
|
+
this.props.onChangeConfiguration(this.state.gridConfiguration);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
_onGridReady(event) {
|
|
192
|
+
this.gridApi = event.api;
|
|
193
|
+
this._reloadTableConfiguration();
|
|
194
|
+
if (this.props.onGridReady) {
|
|
195
|
+
this.props.onGridReady(event);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
_onLoadData(callback) {
|
|
199
|
+
if (this.state.tableNeedToBeReloaded) {
|
|
200
|
+
this.setState({ tableNeedToBeReloaded: false });
|
|
201
|
+
}
|
|
202
|
+
this.props.onLoadData((recordsCount) => {
|
|
203
|
+
this.dataLoaded = true;
|
|
204
|
+
this.dataTransaction = { add: [], remove: [], update: [] };
|
|
205
|
+
this.followLastRecord();
|
|
206
|
+
callback(recordsCount);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
_onPaginationChanged(currentPageSize, definedPageSize) {
|
|
210
|
+
if (this.dataLoaded) {
|
|
211
|
+
const definedPageSizeChanged = this.state.gridConfiguration.pageSize !== definedPageSize;
|
|
212
|
+
if (definedPageSizeChanged) {
|
|
213
|
+
this._changeConfiguration({ pageSize: definedPageSize });
|
|
214
|
+
this._followLastRecordDebounced();
|
|
215
|
+
}
|
|
216
|
+
if (this.props.paging && this.props.paging.onPaginationChanged) {
|
|
217
|
+
this.props.paging.onPaginationChanged(currentPageSize, definedPageSize);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
_onSearchStringChanged(searchString) {
|
|
222
|
+
this.setState({ searchString: searchString });
|
|
223
|
+
if (this.props.search && this.props.search.onChange) {
|
|
224
|
+
this.props.search.onChange(searchString);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
_onSearch() {
|
|
228
|
+
const currentSearchString = this.state.searchString;
|
|
229
|
+
let searchHistory = this.state.searchHistory;
|
|
230
|
+
searchHistory = searchHistory.filter((searchString) => searchString !== currentSearchString);
|
|
231
|
+
searchHistory.unshift(currentSearchString);
|
|
232
|
+
searchHistory = searchHistory.slice(0, 10);
|
|
233
|
+
this.setState({
|
|
234
|
+
searchHistory: searchHistory,
|
|
235
|
+
});
|
|
236
|
+
if (this.props.search && this.props.search.onSearch) {
|
|
237
|
+
this.props.search.onSearch();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
_reloadTableConfiguration() {
|
|
241
|
+
if (this.gridApi) {
|
|
242
|
+
if (this.state.gridConfiguration.columnModel) {
|
|
243
|
+
ColumnUtils.mergeColumnsState(this.state.gridConfiguration.columnModel, this.props.columnDefs);
|
|
244
|
+
this.gridApi.applyColumnState({ state: this.state.gridConfiguration.columnModel, applyOrder: true });
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
this.gridApi.resetColumnState();
|
|
248
|
+
const columnState = this.gridApi.getColumnState();
|
|
249
|
+
this._changeConfiguration({ columnModel: columnState });
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
clearTransaction() {
|
|
254
|
+
this.dataTransaction.add = [];
|
|
255
|
+
this.dataTransaction.remove = [];
|
|
256
|
+
this.dataTransaction.update = [];
|
|
257
|
+
this.dataTransaction.addIndex = undefined;
|
|
258
|
+
}
|
|
259
|
+
removeFromTransaction(item) {
|
|
260
|
+
this.dataTransaction.add = this.dataTransaction.add.filter(value => value.id !== item.id);
|
|
261
|
+
this.dataTransaction.remove = this.dataTransaction.remove.filter(value => value.id !== item.id);
|
|
262
|
+
this.dataTransaction.update = this.dataTransaction.update.filter(value => value.id !== item.id);
|
|
263
|
+
}
|
|
264
|
+
addRecord(data, addIndex) {
|
|
265
|
+
const markedToRemove = this.dataTransaction.remove.find((value => value.id === data.id));
|
|
266
|
+
if (markedToRemove) {
|
|
267
|
+
this.removeFromTransaction(data);
|
|
268
|
+
this.dataTransaction.update.push(data);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
this.removeFromTransaction(data);
|
|
272
|
+
this.dataTransaction.add.push(data);
|
|
273
|
+
if (addIndex !== undefined) {
|
|
274
|
+
this.dataTransaction.addIndex = addIndex;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (this._updateDataDebounced) {
|
|
278
|
+
this._updateDataDebounced();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
addRecords(dataArray, addIndex) {
|
|
282
|
+
(addIndex ? dataArray.reverse() : dataArray).forEach(data => this.addRecord(data, addIndex));
|
|
283
|
+
}
|
|
284
|
+
setRowData(dataArray) {
|
|
285
|
+
var _a;
|
|
286
|
+
this.dataTransaction = { add: [], remove: [], update: [] };
|
|
287
|
+
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.setRowData(dataArray);
|
|
288
|
+
}
|
|
289
|
+
removeRecord(data) {
|
|
290
|
+
const markedToAdd = this.dataTransaction.add.find((value => value.id === data.id));
|
|
291
|
+
if (markedToAdd) {
|
|
292
|
+
this.removeFromTransaction(data);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.removeFromTransaction(data);
|
|
296
|
+
this.dataTransaction.remove.push(data);
|
|
297
|
+
}
|
|
298
|
+
if (this._updateDataDebounced) {
|
|
299
|
+
this._updateDataDebounced();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
removeRecords(dataList) {
|
|
303
|
+
dataList.forEach((data) => {
|
|
304
|
+
this.removeRecord(data);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
updateRecord(data) {
|
|
308
|
+
switch (data.dataChangeState) {
|
|
309
|
+
case "DEF":
|
|
310
|
+
this.addRecord(data);
|
|
311
|
+
break;
|
|
312
|
+
case "UNDEF":
|
|
313
|
+
this.removeRecord(data);
|
|
314
|
+
break;
|
|
315
|
+
default:
|
|
316
|
+
const markedToAdd = this.dataTransaction.add.find((value => value.id === data.id));
|
|
317
|
+
if (markedToAdd) {
|
|
318
|
+
this.addRecord(data);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
this.removeFromTransaction(data);
|
|
322
|
+
this.dataTransaction.update.push(data);
|
|
323
|
+
if (this._updateDataDebounced) {
|
|
324
|
+
this._updateDataDebounced();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
updateRecords(dataList) {
|
|
331
|
+
dataList.forEach((data) => {
|
|
332
|
+
this.updateRecord(data);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
_updateData() {
|
|
336
|
+
this.dataTransaction.update.forEach(data => {
|
|
337
|
+
const rowNode = this.gridApi ? this.gridApi.getRowNode(data.id + "") : null;
|
|
338
|
+
if (rowNode) {
|
|
339
|
+
rowNode.updateData(data);
|
|
340
|
+
if (this.props.filter && this.props.filter.quickFilterEnabled) {
|
|
341
|
+
rowNode.resetQuickFilterAggregateText();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
this.dataTransaction.add.push(data);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
this.dataTransaction.update = [];
|
|
349
|
+
if (this.dataTransaction.add.length > 0 || this.dataTransaction.remove.length > 0) {
|
|
350
|
+
this.dataTransaction.remove.forEach((object) => {
|
|
351
|
+
const node = this.gridApi ? this.gridApi.getRowNode(object.id + "") : null;
|
|
352
|
+
if (node && node.isSelected()) {
|
|
353
|
+
node.setSelected(false);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
if (this.gridApi) {
|
|
357
|
+
this.gridApi.applyTransaction(this.dataTransaction);
|
|
358
|
+
}
|
|
359
|
+
if (this.props.rowData) {
|
|
360
|
+
if (this.dataTransaction.addIndex !== undefined) {
|
|
361
|
+
this.props.rowData.splice(this.dataTransaction.addIndex, 0, ...this.dataTransaction.add);
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
this.props.rowData.push(...this.dataTransaction.add);
|
|
365
|
+
}
|
|
366
|
+
this.dataTransaction.remove.forEach((object) => {
|
|
367
|
+
const index = this.props.rowData ? this.props.rowData.indexOf(object) : -1;
|
|
368
|
+
if (index >= 0 && this.props.rowData) {
|
|
369
|
+
this.props.rowData.splice(index, 1);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
this.dataTransaction = { add: [], remove: [], update: [] };
|
|
374
|
+
}
|
|
375
|
+
if (this.props.onDataChanged) {
|
|
376
|
+
this.props.onDataChanged();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
enableFollowLastRecord(enable) {
|
|
380
|
+
var _a;
|
|
381
|
+
if (enable) {
|
|
382
|
+
if (this.gridApi && this.state.gridConfiguration.followLastRecordSortModel) {
|
|
383
|
+
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.setSortModel(this.state.gridConfiguration.followLastRecordSortModel);
|
|
384
|
+
this.gridApi.onSortChanged();
|
|
385
|
+
}
|
|
386
|
+
this._changeConfiguration({ followLastRecord: true });
|
|
387
|
+
this._followLastRecordDebounced();
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
if (this.state.gridConfiguration.followLastRecord) {
|
|
391
|
+
this._changeConfiguration({ followLastRecord: false });
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
_followLastRecordDebounced() {
|
|
396
|
+
if (this.state.gridConfiguration.followLastRecord && this.props.rowData && this.props.rowData.length > 0) {
|
|
397
|
+
this.followLastRecord();
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
followLastRecord() {
|
|
401
|
+
if (this.state.gridConfiguration.followLastRecord && this.props.rowData && this.props.rowData.length > 0) {
|
|
402
|
+
if (this.gridApi) {
|
|
403
|
+
let lastIndex = -1;
|
|
404
|
+
this.gridApi.forEachNodeAfterFilterAndSort((_, index) => {
|
|
405
|
+
lastIndex = index;
|
|
406
|
+
});
|
|
407
|
+
if (lastIndex >= 0) {
|
|
408
|
+
this.gridApi.ensureIndexVisible(lastIndex);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
setColumnModel(columnModel) {
|
|
414
|
+
var _a;
|
|
415
|
+
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.setColumnState(columnModel);
|
|
416
|
+
}
|
|
417
|
+
setSortModel(sortModel) {
|
|
418
|
+
var _a;
|
|
419
|
+
(_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.setSortModel(sortModel);
|
|
420
|
+
}
|
|
421
|
+
getSortModel() {
|
|
422
|
+
var _a, _b;
|
|
423
|
+
return (_b = (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.getSortModel()) !== null && _b !== void 0 ? _b : [];
|
|
424
|
+
}
|
|
425
|
+
_onRowDataUpdated(event) {
|
|
426
|
+
this._followLastRecordDebounced();
|
|
427
|
+
if (this.props.onRowDataUpdated) {
|
|
428
|
+
this.props.onRowDataUpdated(event);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
showFilterPanel(show) {
|
|
432
|
+
if (show) {
|
|
433
|
+
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes("#2", { width: this.props.filterPanel && this.props.filterPanel.defaultWidth ? this.props.filterPanel.defaultWidth : 250 }));
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes("#2", { width: 0 }));
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
showDetailPanel(show) {
|
|
440
|
+
if (show) {
|
|
441
|
+
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes(this.props.filterPanel ? "#6" : "#4", { width: this.props.detailPanel && this.props.detailPanel.defaultWidth ? this.props.detailPanel.defaultWidth : 250 }));
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.state.layoutModel.doAction(FlexLayout.Actions.updateNodeAttributes(this.props.filterPanel ? "#6" : "#4", { width: 0 }));
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
selectNextPreviousRecord(previous) {
|
|
448
|
+
var _a, _b, _c, _d;
|
|
449
|
+
let selectedNodes = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getSelectedNodes();
|
|
450
|
+
if (selectedNodes && selectedNodes.length === 1) {
|
|
451
|
+
let selectedNode = selectedNodes[0];
|
|
452
|
+
if (this.props.rowData && this.props.rowData.length > 0) {
|
|
453
|
+
(_b = this.gridApi) === null || _b === void 0 ? void 0 : _b.forEachNodeAfterFilterAndSort((node) => {
|
|
454
|
+
var _a;
|
|
455
|
+
if ((!previous && node.childIndex === (selectedNode.childIndex + 1)) || (previous && node.childIndex === (selectedNode.childIndex - 1))) {
|
|
456
|
+
node.setSelected(true, true);
|
|
457
|
+
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.ensureNodeVisible(node);
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
else if (this.props.rowModelType === "infinite" && selectedNode.rowIndex !== null) {
|
|
462
|
+
const nextRowIndex = !previous ? selectedNode.rowIndex + 1 : (selectedNode.rowIndex !== 0 ? selectedNode.rowIndex - 1 : 0);
|
|
463
|
+
const nextNode = (_c = this.gridApi) === null || _c === void 0 ? void 0 : _c.getDisplayedRowAtIndex(nextRowIndex);
|
|
464
|
+
if (nextNode) {
|
|
465
|
+
nextNode.setSelected(true, true);
|
|
466
|
+
(_d = this.gridApi) === null || _d === void 0 ? void 0 : _d.ensureNodeVisible(nextNode);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
changeRowStyleRules(rowStyleRules) {
|
|
472
|
+
this.state.gridConfiguration.rowStyleRules = rowStyleRules;
|
|
473
|
+
this.setState({ gridConfiguration: this.state.gridConfiguration }, () => {
|
|
474
|
+
var _a;
|
|
475
|
+
(_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.redrawRows();
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
_onChangeRowStyleRules(rowStyleRules) {
|
|
479
|
+
this.changeRowStyleRules(rowStyleRules);
|
|
480
|
+
if (this.props.onChangeRowStyleRules) {
|
|
481
|
+
this.props.onChangeRowStyleRules(rowStyleRules);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
onPanelFilterApplied(newFilter) {
|
|
485
|
+
const filterChanged = !isEqualWith(newFilter, this.state.defaultFilter, this.equalValues);
|
|
486
|
+
if (filterChanged !== this.state.filterChanged) {
|
|
487
|
+
this.setState({ filterChanged: filterChanged });
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
getUiColumnFilterValue(colId) {
|
|
491
|
+
var _a;
|
|
492
|
+
const nameFilterModel = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnFilterModel(colId);
|
|
493
|
+
return nameFilterModel && nameFilterModel.filter ? nameFilterModel.filter : "";
|
|
494
|
+
}
|
|
495
|
+
async removeUiColumnFilterValue(colId) {
|
|
496
|
+
var _a;
|
|
497
|
+
const filterInstance = await ((_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnFilterInstance(colId));
|
|
498
|
+
const textFilterInstance = filterInstance;
|
|
499
|
+
const nameFilterModel = textFilterInstance.getModelFromUi();
|
|
500
|
+
if (nameFilterModel) {
|
|
501
|
+
nameFilterModel.filter = "";
|
|
502
|
+
textFilterInstance.resetUiToDefaults(false);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
async applyUiColumnFilterValue(colId) {
|
|
506
|
+
var _a, _b, _c;
|
|
507
|
+
const filterInstance = await ((_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getColumnFilterInstance(colId));
|
|
508
|
+
(_c = (_b = ((filterInstance))) === null || _b === void 0 ? void 0 : _b.applyModel) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
509
|
+
}
|
|
510
|
+
equalValues(value, otherValue) {
|
|
511
|
+
if ((value === undefined || value === null) && (otherValue === undefined || otherValue === null)) {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
return undefined;
|
|
515
|
+
}
|
|
516
|
+
_onSelectionChanged(event) {
|
|
517
|
+
if (this.state.gridConfiguration.followLastRecord && this.gridApi && this.gridApi.getSelectedRows().length > 0) {
|
|
518
|
+
this.enableFollowLastRecord(false);
|
|
519
|
+
}
|
|
520
|
+
if (this.props.onSelectionChanged) {
|
|
521
|
+
this.props.onSelectionChanged(event);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
_onViewportChanged(event) {
|
|
525
|
+
const dataGridEvent = event;
|
|
526
|
+
if (this.state.gridConfiguration.followLastRecord && dataGridEvent.rowsScrollingDelta < 0) {
|
|
527
|
+
this.enableFollowLastRecord(false);
|
|
528
|
+
}
|
|
529
|
+
if (this.props.onViewportChanged) {
|
|
530
|
+
this.props.onViewportChanged(dataGridEvent);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
renderToolbarButtons() {
|
|
534
|
+
var _a;
|
|
535
|
+
const renderFilter = this.props.filterPanel && this.props.filterPanel.renderer;
|
|
536
|
+
const filterPanelVisible = renderFilter && this.isFilterPanelVisible();
|
|
537
|
+
return (React.createElement(React.Fragment, null,
|
|
538
|
+
renderFilter && React.createElement(Button, { type: filterPanelVisible ? "primary" : "default", key: "filter-button", title: i18n("Show/Hide filter panel"), onClick: () => {
|
|
539
|
+
this.showFilterPanel(!filterPanelVisible);
|
|
540
|
+
} },
|
|
541
|
+
React.createElement(FilterOutlined, null)), (_a = this.props.toolbar) === null || _a === void 0 ? void 0 :
|
|
542
|
+
_a.toolbarButtons,
|
|
543
|
+
this.state.gridConfiguration.followLastRecordEditable &&
|
|
544
|
+
React.createElement(Button, { key: "track-button", title: i18n("Track last added record to table"), onClick: (e) => {
|
|
545
|
+
this.enableFollowLastRecord(!this.state.gridConfiguration.followLastRecord);
|
|
546
|
+
e.target.blur();
|
|
547
|
+
} }, this.state.gridConfiguration.followLastRecord ? React.createElement(EyeOutlined, null) : React.createElement(EyeInvisibleOutlined, null))));
|
|
548
|
+
}
|
|
549
|
+
renderToolbar(originalToolbar) {
|
|
550
|
+
let toolbarToRender = originalToolbar;
|
|
551
|
+
if (this.props.toolbar && this.props.toolbar.renderToolbar) {
|
|
552
|
+
const searchBar = this.props.toolbar.renderToolbar(originalToolbar);
|
|
553
|
+
if (searchBar) {
|
|
554
|
+
toolbarToRender = searchBar;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
const statsBadge = this.renderSearchBadge();
|
|
558
|
+
return (React.createElement("div", { style: { whiteSpace: "nowrap", flexGrow: 1, display: "flex" } },
|
|
559
|
+
toolbarToRender,
|
|
560
|
+
statsBadge));
|
|
561
|
+
}
|
|
562
|
+
renderSearchBadge() {
|
|
563
|
+
if (this.state.tableNeedToBeReloaded) {
|
|
564
|
+
return (React.createElement(Badge, { count: React.createElement("span", { className: "ant-badge-count", title: i18n("Records has been added or removed, table need to be reloaded in order to see actual records"), style: { color: "#fa541c", background: "#fff2e8", borderColor: "#ffbb96" } },
|
|
565
|
+
React.createElement(ExclamationOutlined, { style: { color: '#fa541c' } })), style: { cursor: "hand" }, offset: [10, -10] }));
|
|
566
|
+
}
|
|
567
|
+
return undefined;
|
|
568
|
+
}
|
|
569
|
+
isFilterPanelVisible() {
|
|
570
|
+
return this.state.gridConfiguration.layoutModel ? this.state.gridConfiguration.layoutModel.layout.children[0].width > 0 : true;
|
|
571
|
+
}
|
|
572
|
+
renderDataGrid() {
|
|
573
|
+
const _a = this.props, { defaultGridConfiguration, onGridReady, onLoadData, onSortChanged, onColumnsChanged, onSelectionChanged, onViewportChanged, onTableConfigVisible, toolbar, paging, filter, search, onChangeConfiguration, onDataChanged, onChangeRowStyleRules, filterPanel, controlPanel } = _a, rest = __rest(_a, ["defaultGridConfiguration", "onGridReady", "onLoadData", "onSortChanged", "onColumnsChanged", "onSelectionChanged", "onViewportChanged", "onTableConfigVisible", "toolbar", "paging", "filter", "search", "onChangeConfiguration", "onDataChanged", "onChangeRowStyleRules", "filterPanel", "controlPanel"]);
|
|
574
|
+
return (React.createElement(DataGrid, Object.assign({}, rest, { ref: (dataGrid) => {
|
|
575
|
+
this.dataGrid = dataGrid ? dataGrid : undefined;
|
|
576
|
+
}, onLoadData: this._onLoadData, onGridReady: this._onGridReady, paging: {
|
|
577
|
+
pageSize: this.state.gridConfiguration.pageSize,
|
|
578
|
+
defaultPageSize: this.state.gridConfiguration.defaultPageSize,
|
|
579
|
+
onPaginationChanged: this._onPaginationChanged,
|
|
580
|
+
}, filter: {
|
|
581
|
+
columnSearchVisible: this.state.gridConfiguration.columnSearchVisible,
|
|
582
|
+
getFilterModel: filter ? filter.getFilterModel : undefined,
|
|
583
|
+
onColumnSearchVisible: (visible) => {
|
|
584
|
+
this._changeConfiguration({ columnSearchVisible: visible });
|
|
585
|
+
if (filter === null || filter === void 0 ? void 0 : filter.onColumnSearchVisible) {
|
|
586
|
+
filter.onColumnSearchVisible(visible);
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
onFilterModified: filter ? filter.onFilterModified : undefined,
|
|
590
|
+
onFilterChanged: filter ? filter.onFilterChanged : undefined,
|
|
591
|
+
onFilterConfirmed: filter ? filter.onFilterConfirmed : undefined,
|
|
592
|
+
}, search: {
|
|
593
|
+
hidden: !!search ? search.hidden : undefined,
|
|
594
|
+
inputReadonly: !!search ? search.inputReadonly : undefined,
|
|
595
|
+
placeholder: !!search ? search.placeholder : undefined,
|
|
596
|
+
searchString: !!search && search.searchString !== undefined ? search.searchString : this.state.searchString,
|
|
597
|
+
stringFormatter: !!search ? search.stringFormatter : undefined,
|
|
598
|
+
searchHistory: !!search && search.searchHistory !== undefined ? search.searchHistory : this.state.searchHistory,
|
|
599
|
+
searchButtonClassName: !!search ? search.searchButtonClassName : undefined,
|
|
600
|
+
searchButtonDisabled: !!search ? search.searchButtonDisabled : undefined,
|
|
601
|
+
searchRenderer: search === null || search === void 0 ? void 0 : search.searchRenderer,
|
|
602
|
+
onChange: this._onSearchStringChanged,
|
|
603
|
+
onSearch: this._onSearch
|
|
604
|
+
}, toolbar: {
|
|
605
|
+
renderToolbar: this.renderToolbar,
|
|
606
|
+
toolbarButtons: this.renderToolbarButtons(),
|
|
607
|
+
hideRecordCount: toolbar === null || toolbar === void 0 ? void 0 : toolbar.hideRecordCount
|
|
608
|
+
}, onSortChanged: (event) => {
|
|
609
|
+
var _a, _b;
|
|
610
|
+
const sortModel = (_a = this.dataGrid) === null || _a === void 0 ? void 0 : _a.getSortModel();
|
|
611
|
+
if (this.state.gridConfiguration.followLastRecord && this.state.gridConfiguration.followLastRecordSortModel && !isEqual(this.state.gridConfiguration.followLastRecordSortModel, sortModel)) {
|
|
612
|
+
this.enableFollowLastRecord(false);
|
|
613
|
+
}
|
|
614
|
+
const columnState = (_b = this.gridApi) === null || _b === void 0 ? void 0 : _b.getColumnState();
|
|
615
|
+
this._changeConfiguration({ columnModel: columnState });
|
|
616
|
+
if (onSortChanged) {
|
|
617
|
+
onSortChanged(event);
|
|
618
|
+
}
|
|
619
|
+
}, onColumnsChanged: (columnModel, event) => {
|
|
620
|
+
this._changeConfiguration({ columnModel: columnModel });
|
|
621
|
+
if (onColumnsChanged) {
|
|
622
|
+
onColumnsChanged(columnModel, event);
|
|
623
|
+
}
|
|
624
|
+
}, onRowDataUpdated: this._onRowDataUpdated, tableConfigVisible: this.state.tableConfigVisible, onTableConfigVisible: (visible) => {
|
|
625
|
+
this.setState({ tableConfigVisible: visible });
|
|
626
|
+
if (onTableConfigVisible) {
|
|
627
|
+
onTableConfigVisible(visible);
|
|
628
|
+
}
|
|
629
|
+
}, onSelectionChanged: this._onSelectionChanged, rowStyleRules: this.state.gridConfiguration.rowStyleRules, defaultRowStyleRules: this.state.gridConfiguration.defaultRowStyleRules, onChangeRowStyleRules: this._onChangeRowStyleRules, onViewportChanged: this._onViewportChanged, showMilliseconds: this.state.gridConfiguration.showMilliseconds, defaultShowMilliseconds: this.state.gridConfiguration.defaultShowMilliseconds, onShowMilliseconds: (showMillis, callback) => {
|
|
630
|
+
this._changeConfiguration({ showMilliseconds: showMillis }, callback);
|
|
631
|
+
}, hideYear: this.state.gridConfiguration.hideYear, defaultHideYear: this.state.gridConfiguration.defaultHideYear, onShowYear: (showYear, callback) => {
|
|
632
|
+
this._changeConfiguration({ hideYear: !showYear }, callback);
|
|
633
|
+
} })));
|
|
634
|
+
}
|
|
635
|
+
renderDataGridWithControlPanel() {
|
|
636
|
+
if (this.props.controlPanel && this.props.controlPanel.renderer) {
|
|
637
|
+
return (React.createElement("div", { key: "table-with-control-panel", style: {
|
|
638
|
+
display: "flex",
|
|
639
|
+
flexFlow: "column",
|
|
640
|
+
height: "100%",
|
|
641
|
+
width: "100%"
|
|
642
|
+
} },
|
|
643
|
+
React.createElement("div", { key: "table-with-control-panel-wrapper", style: { flex: "1 1 auto", overflow: "auto" } }, this.renderDataGrid()),
|
|
644
|
+
this.props.controlPanel.renderer()));
|
|
645
|
+
}
|
|
646
|
+
return this.renderDataGrid();
|
|
647
|
+
}
|
|
648
|
+
componentDidUpdate() {
|
|
649
|
+
var _a;
|
|
650
|
+
(_a = this.flexLayout) === null || _a === void 0 ? void 0 : _a.updateRect();
|
|
651
|
+
}
|
|
652
|
+
render() {
|
|
653
|
+
const { filterPanel, detailPanel } = this.props;
|
|
654
|
+
if (filterPanel || detailPanel) {
|
|
655
|
+
return (React.createElement(FlexLayout.Layout, { ref: (flexLayout) => {
|
|
656
|
+
this.flexLayout = flexLayout;
|
|
657
|
+
}, model: this.state.layoutModel, onModelChange: (model) => {
|
|
658
|
+
this._changeConfiguration({ layoutModel: model.toJson() });
|
|
659
|
+
}, onAction: (action) => {
|
|
660
|
+
var _a;
|
|
661
|
+
const node1 = action.data.node1;
|
|
662
|
+
const node2 = action.data.node2;
|
|
663
|
+
let tabset;
|
|
664
|
+
if (action.type === Actions.ADJUST_SPLIT) {
|
|
665
|
+
if (node1 === "#4" && node2 === "#6") {
|
|
666
|
+
tabset = this.state.layoutModel.getNodeById('#6');
|
|
667
|
+
}
|
|
668
|
+
else if (node1 === "#2" && node2 === "#4") {
|
|
669
|
+
tabset = this.state.layoutModel.getNodeById('#2');
|
|
670
|
+
}
|
|
671
|
+
if (tabset) {
|
|
672
|
+
const width = (_a = tabset === null || tabset === void 0 ? void 0 : tabset._attributes) === null || _a === void 0 ? void 0 : _a.width;
|
|
673
|
+
if (width === 0) {
|
|
674
|
+
return undefined;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return action;
|
|
679
|
+
}, factory: (node) => {
|
|
680
|
+
const component = node.getComponent();
|
|
681
|
+
if (component === "filter-panel") {
|
|
682
|
+
return filterPanel && filterPanel.renderer && filterPanel.renderer({
|
|
683
|
+
defaultFilter: this.state.defaultFilter,
|
|
684
|
+
filterChanged: this.state.filterChanged
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
else if (component === "data-panel") {
|
|
688
|
+
return this.renderDataGridWithControlPanel();
|
|
689
|
+
}
|
|
690
|
+
else if (component === "detail-panel") {
|
|
691
|
+
return detailPanel && detailPanel.renderer();
|
|
692
|
+
}
|
|
693
|
+
return React.createElement(Empty, null);
|
|
694
|
+
} }));
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
return this.renderDataGridWithControlPanel();
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
ExtendedDataGrid.defaultProps = {
|
|
702
|
+
rowStyleRules: tableDefaultRowStyleRules()
|
|
703
|
+
};
|
|
704
|
+
export default ExtendedDataGrid;
|
|
696
705
|
//# sourceMappingURL=extendedDataGrid.js.map
|