d2coreui 21.0.34 → 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 -27
- 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,281 +1,270 @@
|
|
|
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 MaskedInput from "d2coreui/components/input/maskedInput";
|
|
14
|
-
import
|
|
15
|
-
import { LocaleHolder } from "d2core/i18n/localeHolder";
|
|
16
|
-
import { AutoComplete } from "antd";
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{ key: "
|
|
21
|
-
{ key: "
|
|
22
|
-
{ key: "
|
|
23
|
-
{ key: "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
maskResult.
|
|
32
|
-
maskResult.
|
|
33
|
-
maskResult.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
event.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
opened: false
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
entry.length++;
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return entry;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return undefined;
|
|
280
|
-
}
|
|
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 MaskedInput from "d2coreui/components/input/maskedInput";
|
|
14
|
+
import dayjs, { isDuration } from "dayjs";
|
|
15
|
+
import { LocaleHolder } from "d2core/i18n/localeHolder";
|
|
16
|
+
import { AutoComplete } from "antd";
|
|
17
|
+
import DropdownArrow from "../icons/dropdownArrow";
|
|
18
|
+
import WithInputNumberCss from "d2coreui/components/style/withInputNumberCss";
|
|
19
|
+
const DURATION_DATA_MAP = [
|
|
20
|
+
{ key: "SSS", min: 0, max: 999, minLen: 3, maxLen: 3, mult: 1, unit: "ms" },
|
|
21
|
+
{ key: "s", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 1000, unit: "s" },
|
|
22
|
+
{ key: "m", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 60 * 1000, unit: "m" },
|
|
23
|
+
{ key: "H", min: 0, max: 23, minLen: 1, maxLen: 2, mult: 60 * 60 * 1000, unit: "h" },
|
|
24
|
+
{ key: "D", min: 0, max: 24854, minLen: 1, maxLen: 5, mult: 24 * 60 * 60 * 1000, unit: "d" },
|
|
25
|
+
];
|
|
26
|
+
export const MAX_VALID_DURATION = 24854 * 24 * 60 * 60 * 1000 + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000 + 499;
|
|
27
|
+
export function parseDuration(value, mask, cursorPos, maskResult) {
|
|
28
|
+
let result = dayjs.duration(0);
|
|
29
|
+
const clearMaskResult = () => {
|
|
30
|
+
if (maskResult) {
|
|
31
|
+
maskResult.info = undefined;
|
|
32
|
+
maskResult.length = 0;
|
|
33
|
+
maskResult.infoFromMask = undefined;
|
|
34
|
+
maskResult.time = undefined;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
let maskPos = 0;
|
|
38
|
+
let valPos;
|
|
39
|
+
for (valPos = 0; valPos < value.length; valPos++) {
|
|
40
|
+
const c = value.charAt(valPos);
|
|
41
|
+
if (['D', 'H', 'm', 's', 'S'].includes(mask.charAt(maskPos))) {
|
|
42
|
+
if (/\d/.test(c)) {
|
|
43
|
+
const entry = getInfoFromMask(mask, maskPos);
|
|
44
|
+
if (entry) {
|
|
45
|
+
let str = c;
|
|
46
|
+
while (/\d/.test(value.charAt(valPos + 1))) {
|
|
47
|
+
valPos++;
|
|
48
|
+
str += value.charAt(valPos);
|
|
49
|
+
}
|
|
50
|
+
if (str.length !== entry.length) {
|
|
51
|
+
clearMaskResult();
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const time = parseInt(str);
|
|
55
|
+
result = result.add(dayjs.duration(time, entry.infoEntry.unit));
|
|
56
|
+
if (maskResult) {
|
|
57
|
+
const item = {
|
|
58
|
+
value: time,
|
|
59
|
+
length: str.length,
|
|
60
|
+
infoEntry: entry.infoEntry,
|
|
61
|
+
};
|
|
62
|
+
if (maskResult.infoFromMask) {
|
|
63
|
+
maskResult.infoFromMask.push(item);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
maskResult.infoFromMask = [item];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
maskPos += entry.length;
|
|
70
|
+
if (cursorPos !== undefined && maskResult !== undefined && cursorPos >= valPos - str.length + 1 && cursorPos <= valPos + 1) {
|
|
71
|
+
maskResult.info = entry.infoEntry;
|
|
72
|
+
maskResult.length = str.length;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
clearMaskResult();
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
clearMaskResult();
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
if (c === mask.charAt(maskPos)) {
|
|
87
|
+
maskPos++;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (maskPos === mask.length && valPos === value.length && result.asMilliseconds() <= MAX_VALID_DURATION) {
|
|
92
|
+
if (maskResult !== undefined) {
|
|
93
|
+
maskResult.time = result;
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
clearMaskResult();
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
export default class DurationInput extends React.Component {
|
|
101
|
+
constructor(props) {
|
|
102
|
+
super(props);
|
|
103
|
+
this.inputRef = React.createRef();
|
|
104
|
+
this.state = {
|
|
105
|
+
valid: isDuration(props.value),
|
|
106
|
+
selectionStart: null,
|
|
107
|
+
selectionEnd: null,
|
|
108
|
+
currentInfo: {
|
|
109
|
+
info: undefined,
|
|
110
|
+
infoFromMask: undefined,
|
|
111
|
+
time: undefined,
|
|
112
|
+
length: 0
|
|
113
|
+
},
|
|
114
|
+
opened: false,
|
|
115
|
+
value: formatDuration(props.value, props.mask),
|
|
116
|
+
};
|
|
117
|
+
this.recalc = this.recalc.bind(this);
|
|
118
|
+
this.increment = this.increment.bind(this);
|
|
119
|
+
this.decrement = this.decrement.bind(this);
|
|
120
|
+
}
|
|
121
|
+
componentDidUpdate() {
|
|
122
|
+
if (this.inputRef.current !== null) {
|
|
123
|
+
this.inputRef.current.input.selectionStart = this.state.selectionStart;
|
|
124
|
+
this.inputRef.current.input.selectionEnd = this.state.selectionEnd;
|
|
125
|
+
}
|
|
126
|
+
const value = formatDuration(this.props.value, this.props.mask);
|
|
127
|
+
if (this.state.value !== value) {
|
|
128
|
+
this.setState({
|
|
129
|
+
value: value,
|
|
130
|
+
valid: isDuration(this.props.value),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
recalc() {
|
|
135
|
+
var _a;
|
|
136
|
+
if (this.inputRef.current !== null) {
|
|
137
|
+
const value = { length: 0 };
|
|
138
|
+
parseDuration(this.inputRef.current.input.value, this.props.mask, (_a = this.inputRef.current.input.selectionStart) !== null && _a !== void 0 ? _a : undefined, value);
|
|
139
|
+
this.setState({
|
|
140
|
+
currentInfo: value,
|
|
141
|
+
selectionStart: this.inputRef.current.input.selectionStart,
|
|
142
|
+
selectionEnd: this.inputRef.current.input.selectionEnd,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
increment() {
|
|
147
|
+
var _a, _b, _c, _d, _e;
|
|
148
|
+
if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, 1)) {
|
|
149
|
+
(_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, (_d = (_c = this.props.value) === null || _c === void 0 ? void 0 : _c.add(1, this.state.currentInfo.info.unit)) !== null && _d !== void 0 ? _d : null);
|
|
150
|
+
this.setState({ selectionEnd: this.state.selectionStart });
|
|
151
|
+
}
|
|
152
|
+
(_e = this.inputRef.current) === null || _e === void 0 ? void 0 : _e.focus();
|
|
153
|
+
}
|
|
154
|
+
decrement() {
|
|
155
|
+
var _a, _b, _c, _d, _e;
|
|
156
|
+
if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, -1)) {
|
|
157
|
+
(_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, (_d = (_c = this.props.value) === null || _c === void 0 ? void 0 : _c.subtract(1, this.state.currentInfo.info.unit)) !== null && _d !== void 0 ? _d : null);
|
|
158
|
+
this.setState({ selectionEnd: this.state.selectionStart });
|
|
159
|
+
}
|
|
160
|
+
(_e = this.inputRef.current) === null || _e === void 0 ? void 0 : _e.focus();
|
|
161
|
+
}
|
|
162
|
+
get input() {
|
|
163
|
+
var _a;
|
|
164
|
+
return (_a = this.inputRef.current) === null || _a === void 0 ? void 0 : _a.input;
|
|
165
|
+
}
|
|
166
|
+
focus() {
|
|
167
|
+
var _a;
|
|
168
|
+
(_a = this.inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
169
|
+
}
|
|
170
|
+
render() {
|
|
171
|
+
const _a = this.props, { mask, value, onChange, style, disabled, predefinedValues, autoFocus, size } = _a, props = __rest(_a, ["mask", "value", "onChange", "style", "disabled", "predefinedValues", "autoFocus", "size"]);
|
|
172
|
+
const incrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, 1);
|
|
173
|
+
const decrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, -1);
|
|
174
|
+
return (React.createElement(WithInputNumberCss, null,
|
|
175
|
+
React.createElement("div", Object.assign({ style: Object.assign({ width: "100%" }, style) }, props, { className: !predefinedValues ? "ant-input-number ant-input-number-outlined" : "", onKeyDown: (event) => {
|
|
176
|
+
if (event.code === "ArrowUp") {
|
|
177
|
+
this.increment();
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
event.stopPropagation();
|
|
180
|
+
}
|
|
181
|
+
else if (event.code === "ArrowDown") {
|
|
182
|
+
this.decrement();
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
event.stopPropagation();
|
|
185
|
+
}
|
|
186
|
+
} }),
|
|
187
|
+
React.createElement(AutoComplete, { className: this.state.valid ? "" : "invalid", options: this.state.opened ? predefinedValues === null || predefinedValues === void 0 ? void 0 : predefinedValues.map(v => {
|
|
188
|
+
return { value: v.value, label: v.key };
|
|
189
|
+
}) : [], defaultOpen: false, defaultActiveFirstOption: false, defaultValue: undefined, disabled: disabled, autoFocus: autoFocus, style: { width: "100%", height: "inherit" }, value: this.state.valid ? this.state.value : "", onSelect: (e) => {
|
|
190
|
+
const val = dayjs.duration(Number(e));
|
|
191
|
+
this.setState({
|
|
192
|
+
opened: false,
|
|
193
|
+
valid: isDuration(val),
|
|
194
|
+
value: formatDuration(val, this.props.mask),
|
|
195
|
+
});
|
|
196
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val === undefined ? null : val);
|
|
197
|
+
}, onBlur: () => {
|
|
198
|
+
this.setState({ opened: false });
|
|
199
|
+
} },
|
|
200
|
+
React.createElement(MaskedInput, { mask: this.props.mask.replace(/[a-zA-Z]/g, '1'), ref: this.inputRef, style: Object.assign({ border: predefinedValues ? undefined : "none" }, this.props.inputStyle), size: size, placeholder: this.props.mask.replace(/[a-zA-Z]/g, '_'), autoFocus: autoFocus, onFocus: (event => {
|
|
201
|
+
event.target.selectionStart = event.target.selectionEnd = this.state.selectionStart;
|
|
202
|
+
}), suffix: this.props.predefinedValues !== undefined && this.props.predefinedValues.length > 0 &&
|
|
203
|
+
React.createElement(DropdownArrow, { opened: this.state.opened, onClick: () => {
|
|
204
|
+
if (!this.props.disabled) {
|
|
205
|
+
this.setState({ opened: !this.state.opened });
|
|
206
|
+
}
|
|
207
|
+
} }), onMouseUp: this.recalc, onKeyUp: this.recalc, onChange: (event) => {
|
|
208
|
+
var _a;
|
|
209
|
+
const value = { length: 0 };
|
|
210
|
+
parseDuration(event.target.value, this.props.mask, (_a = event.target.selectionStart) !== null && _a !== void 0 ? _a : undefined, value);
|
|
211
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value.time === undefined ? null : value.time);
|
|
212
|
+
this.setState({
|
|
213
|
+
valid: isDuration(value.time),
|
|
214
|
+
currentInfo: value,
|
|
215
|
+
value: event.target.value,
|
|
216
|
+
});
|
|
217
|
+
} })),
|
|
218
|
+
!predefinedValues && !disabled &&
|
|
219
|
+
React.createElement("div", { className: "ant-input-number-handler-wrap" },
|
|
220
|
+
React.createElement("span", { onClick: this.increment, className: `ant-input-number-handler ant-input-number-handler-up ${incrementButtonDisabled ? "ant-input-number-handler-up-disabled" : ""}` },
|
|
221
|
+
React.createElement("span", { className: "anticon anticon-up ant-input-number-handler-up-inner" },
|
|
222
|
+
React.createElement("svg", { viewBox: "64 64 896 896", focusable: "false", "data-icon": "up", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" },
|
|
223
|
+
React.createElement("path", { d: "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" })))),
|
|
224
|
+
React.createElement("span", { onClick: this.decrement, className: `ant-input-number-handler ant-input-number-handler-down ${decrementButtonDisabled ? "ant-input-number-handler-down-disabled" : ""}` },
|
|
225
|
+
React.createElement("span", { className: "anticon anticon-down ant-input-number-handler-down-inner" },
|
|
226
|
+
React.createElement("svg", { viewBox: "64 64 896 896", focusable: "false", "data-icon": "down", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" },
|
|
227
|
+
React.createElement("path", { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }))))))));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function checkValue(info, value, offset = 0) {
|
|
231
|
+
var _a;
|
|
232
|
+
const currentMillis = value ? value.add(offset, (_a = info.info) === null || _a === void 0 ? void 0 : _a.unit).asMilliseconds() : 0;
|
|
233
|
+
const maxValues = (info === null || info === void 0 ? void 0 : info.infoFromMask) ? info.infoFromMask.map((i) => (i.length !== i.infoEntry.maxLen ? (Math.pow(10, i.length) - 1) : i.infoEntry.max) * i.infoEntry.mult) : [];
|
|
234
|
+
const maxMaskedValue = (info === null || info === void 0 ? void 0 : info.infoFromMask) ? maxValues.reduce((p, n) => p + n, 0) : 0;
|
|
235
|
+
return !!value && currentMillis >= 0 && currentMillis <= MAX_VALID_DURATION && currentMillis <= maxMaskedValue;
|
|
236
|
+
}
|
|
237
|
+
function formatDuration(value, mask) {
|
|
238
|
+
return (isDuration(value) ? value : dayjs.duration(0)).locale("locale.d2000").format(mask, {
|
|
239
|
+
trim: false,
|
|
240
|
+
decimalSeparator: LocaleHolder.decimalSeparator,
|
|
241
|
+
useGrouping: false,
|
|
242
|
+
groupingSeparator: "",
|
|
243
|
+
userLocale: LocaleHolder.formattingLocale
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function getInfoFromMask(mask, fromPos) {
|
|
247
|
+
if (fromPos < mask.length) {
|
|
248
|
+
const ch = mask.charAt(fromPos);
|
|
249
|
+
const info = DURATION_DATA_MAP.find((d) => d.key.includes(ch));
|
|
250
|
+
if (info) {
|
|
251
|
+
const entry = {
|
|
252
|
+
length: 1,
|
|
253
|
+
value: 0,
|
|
254
|
+
infoEntry: info,
|
|
255
|
+
};
|
|
256
|
+
for (let i = fromPos + 1; i < mask.length; i++) {
|
|
257
|
+
const c = mask.charAt(i);
|
|
258
|
+
if (c === ch) {
|
|
259
|
+
entry.length++;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return entry;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
}
|
|
281
270
|
//# sourceMappingURL=durationInput.js.map
|