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.
Files changed (295) hide show
  1. package/components/clipboard/clipboardUtils.d.ts +4 -3
  2. package/components/clipboard/clipboardUtils.js +47 -22
  3. package/components/clipboard/clipboardUtils.js.map +1 -1
  4. package/components/codemirror/SyntaxHighlighter.d.ts +21 -21
  5. package/components/codemirror/SyntaxHighlighter.js +45 -44
  6. package/components/codemirror/SyntaxHighlighter.js.map +1 -1
  7. package/components/collapse/expandable.d.ts +13 -12
  8. package/components/collapse/expandable.js +20 -20
  9. package/components/collapse/expandable.js.map +1 -1
  10. package/components/color/colorPicker.d.ts +20 -20
  11. package/components/color/colorPicker.js +53 -53
  12. package/components/color/colorPicker.js.map +1 -1
  13. package/components/color/colorSwatch.d.ts +13 -12
  14. package/components/color/colorSwatch.js +62 -62
  15. package/components/color/colorSwatch.js.map +1 -1
  16. package/components/color/colorUtils.d.ts +7 -7
  17. package/components/color/colorUtils.js +43 -43
  18. package/components/color/colorUtils.js.map +1 -1
  19. package/components/date/dateRangeInput.d.ts +66 -64
  20. package/components/date/dateRangeInput.js +292 -297
  21. package/components/date/dateRangeInput.js.map +1 -1
  22. package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -26
  23. package/components/date/dateRangeInputAdvancedPanel.js +130 -115
  24. package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
  25. package/components/date/dateRangeInputConfirm.d.ts +31 -29
  26. package/components/date/dateRangeInputConfirm.js +132 -121
  27. package/components/date/dateRangeInputConfirm.js.map +1 -1
  28. package/components/date/dateTimeInput.d.ts +72 -69
  29. package/components/date/dateTimeInput.js +440 -412
  30. package/components/date/dateTimeInput.js.map +1 -1
  31. package/components/date/durationInput.d.ts +59 -56
  32. package/components/date/durationInput.js +269 -280
  33. package/components/date/durationInput.js.map +1 -1
  34. package/components/form/NiceFormItem.d.ts +14 -14
  35. package/components/form/NiceFormItem.js +28 -31
  36. package/components/form/NiceFormItem.js.map +1 -1
  37. package/components/grid/cell/beanAccessor.d.ts +9 -0
  38. package/components/grid/cell/beanAccessor.js +13 -0
  39. package/components/grid/cell/beanAccessor.js.map +1 -0
  40. package/components/grid/cell/cellEditorUtils.d.ts +4 -4
  41. package/components/grid/cell/cellEditorUtils.js +8 -8
  42. package/components/grid/cell/customEnumCellEditor.d.ts +4 -26
  43. package/components/grid/cell/customEnumCellEditor.js +82 -91
  44. package/components/grid/cell/customEnumCellEditor.js.map +1 -1
  45. package/components/grid/cell/dataGridCellEditorComponent.d.ts +14 -0
  46. package/components/grid/cell/dataGridCellEditorComponent.js +49 -0
  47. package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -0
  48. package/components/grid/cell/dateCellEditor.d.ts +4 -25
  49. package/components/grid/cell/dateCellEditor.js +53 -72
  50. package/components/grid/cell/dateCellEditor.js.map +1 -1
  51. package/components/grid/cell/durationCellEditor.d.ts +4 -24
  52. package/components/grid/cell/durationCellEditor.js +74 -97
  53. package/components/grid/cell/durationCellEditor.js.map +1 -1
  54. package/components/grid/cell/hexaOctetStringCellEditor.d.ts +4 -24
  55. package/components/grid/cell/hexaOctetStringCellEditor.js +70 -94
  56. package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
  57. package/components/grid/cell/hexaValueCellEditor.d.ts +4 -24
  58. package/components/grid/cell/hexaValueCellEditor.js +65 -89
  59. package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
  60. package/components/grid/cell/numberCellEditor.d.ts +4 -27
  61. package/components/grid/cell/numberCellEditor.js +73 -95
  62. package/components/grid/cell/numberCellEditor.js.map +1 -1
  63. package/components/grid/cell/rangeSelector.d.ts +78 -78
  64. package/components/grid/cell/rangeSelector.js +526 -518
  65. package/components/grid/cell/rangeSelector.js.map +1 -1
  66. package/components/grid/cell/simpleStatusTextCellEditor.d.ts +4 -32
  67. package/components/grid/cell/simpleStatusTextCellEditor.js +106 -116
  68. package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
  69. package/components/grid/cell/statusTextCellEditor.d.ts +4 -32
  70. package/components/grid/cell/statusTextCellEditor.js +136 -159
  71. package/components/grid/cell/statusTextCellEditor.js.map +1 -1
  72. package/components/grid/cell/tableDefaultRowStyleRules.d.ts +20 -20
  73. package/components/grid/cell/tableDefaultRowStyleRules.js +29 -18
  74. package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
  75. package/components/grid/cell/textCellEditor.d.ts +4 -21
  76. package/components/grid/cell/textCellEditor.js +63 -85
  77. package/components/grid/cell/textCellEditor.js.map +1 -1
  78. package/components/grid/cell/withAgGridHooks.d.ts +3 -0
  79. package/components/grid/cell/withAgGridHooks.js +15 -0
  80. package/components/grid/cell/withAgGridHooks.js.map +1 -0
  81. package/components/grid/columnUtils.d.ts +5 -5
  82. package/components/grid/columnUtils.js +26 -26
  83. package/components/grid/columnUtils.js.map +1 -1
  84. package/components/grid/config/columnTransfer.d.ts +21 -22
  85. package/components/grid/config/columnTransfer.js +205 -201
  86. package/components/grid/config/columnTransfer.js.map +1 -1
  87. package/components/grid/config/dataGridEditor.d.ts +41 -41
  88. package/components/grid/config/dataGridEditor.js +181 -160
  89. package/components/grid/config/dataGridEditor.js.map +1 -1
  90. package/components/grid/config/rowHeightCalculator.d.ts +8 -0
  91. package/components/grid/config/rowHeightCalculator.js +20 -0
  92. package/components/grid/config/rowHeightCalculator.js.map +1 -0
  93. package/components/grid/config/rowStylePicker.d.ts +27 -25
  94. package/components/grid/config/rowStylePicker.js +127 -109
  95. package/components/grid/config/rowStylePicker.js.map +1 -1
  96. package/components/grid/dataGrid.d.ts +218 -206
  97. package/components/grid/dataGrid.js +1629 -1538
  98. package/components/grid/dataGrid.js.map +1 -1
  99. package/components/grid/detail/detailHeaderPanel.d.ts +13 -13
  100. package/components/grid/detail/detailHeaderPanel.js +25 -25
  101. package/components/grid/detail/detailHeaderPanel.js.map +1 -1
  102. package/components/grid/export/contextMenu.d.ts +18 -24
  103. package/components/grid/export/contextMenu.js +116 -113
  104. package/components/grid/export/contextMenu.js.map +1 -1
  105. package/components/grid/export/progressPopup.d.ts +29 -29
  106. package/components/grid/export/progressPopup.js +93 -93
  107. package/components/grid/export/progressPopup.js.map +1 -1
  108. package/components/grid/export/worker/clipboardExport.d.ts +1 -1
  109. package/components/grid/export/worker/clipboardExport.js +8 -8
  110. package/components/grid/export/worker/csvExport.d.ts +1 -1
  111. package/components/grid/export/worker/csvExport.js +8 -8
  112. package/components/grid/export/worker/pdfExport.d.ts +1 -1
  113. package/components/grid/export/worker/pdfExport.js +81 -81
  114. package/components/grid/export/worker/pdfExport.js.map +1 -1
  115. package/components/grid/export/worker/txtExport.d.ts +1 -1
  116. package/components/grid/export/worker/txtExport.js +19 -19
  117. package/components/grid/extendedDataGrid.d.ts +140 -140
  118. package/components/grid/extendedDataGrid.js +704 -695
  119. package/components/grid/extendedDataGrid.js.map +1 -1
  120. package/components/grid/filter/customColumnFilter.d.ts +5 -21
  121. package/components/grid/filter/customColumnFilter.js +11 -82
  122. package/components/grid/filter/customColumnFilter.js.map +1 -1
  123. package/components/grid/filter/dataGridColumnFilter.d.ts +17 -0
  124. package/components/grid/filter/dataGridColumnFilter.js +49 -0
  125. package/components/grid/filter/dataGridColumnFilter.js.map +1 -0
  126. package/components/grid/filter/dateColumnFilter.d.ts +7 -11
  127. package/components/grid/filter/dateColumnFilter.js +22 -56
  128. package/components/grid/filter/dateColumnFilter.js.map +1 -1
  129. package/components/grid/filter/textColumnFilter.d.ts +8 -20
  130. package/components/grid/filter/textColumnFilter.js +24 -76
  131. package/components/grid/filter/textColumnFilter.js.map +1 -1
  132. package/components/grid/filter/wildcardQuickFilterEngine.d.ts +7 -0
  133. package/components/grid/filter/wildcardQuickFilterEngine.js +48 -0
  134. package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -0
  135. package/components/grid/header/simpleHeader.d.ts +17 -16
  136. package/components/grid/header/simpleHeader.js +230 -186
  137. package/components/grid/header/simpleHeader.js.map +1 -1
  138. package/components/grid/panel/dataGridPagination.d.ts +16 -16
  139. package/components/grid/panel/dataGridPagination.js +58 -58
  140. package/components/grid/panel/dataGridPagination.js.map +1 -1
  141. package/components/grid/panel/loadingOverlay.d.ts +6 -6
  142. package/components/grid/panel/loadingOverlay.js +10 -10
  143. package/components/grid/panel/loadingOverlay.js.map +1 -1
  144. package/components/grid/panel/noRecordsOverlay.d.ts +6 -6
  145. package/components/grid/panel/noRecordsOverlay.js +10 -10
  146. package/components/grid/panel/noRecordsOverlay.js.map +1 -1
  147. package/components/grid/panel/tablePagination.d.ts +10 -10
  148. package/components/grid/panel/tablePagination.js +45 -45
  149. package/components/grid/panel/tablePagination.js.map +1 -1
  150. package/components/icons/dropdownArrow.d.ts +8 -0
  151. package/components/icons/dropdownArrow.js +59 -0
  152. package/components/icons/dropdownArrow.js.map +1 -0
  153. package/components/icons/undoIcon.d.ts +8 -8
  154. package/components/icons/undoIcon.js +6 -6
  155. package/components/input/autoCompleteInput.d.ts +35 -35
  156. package/components/input/autoCompleteInput.js +122 -121
  157. package/components/input/autoCompleteInput.js.map +1 -1
  158. package/components/input/draftUtils.d.ts +4 -4
  159. package/components/input/draftUtils.js +48 -48
  160. package/components/input/draftUtils.js.map +1 -1
  161. package/components/input/draftail.d.ts +1 -1
  162. package/components/input/draftail.js +1 -1
  163. package/components/input/hexaFormattedInput.d.ts +16 -16
  164. package/components/input/hexaFormattedInput.js +54 -54
  165. package/components/input/hexaFormattedInput.js.map +1 -1
  166. package/components/input/mask/helpers.d.ts +28 -28
  167. package/components/input/mask/helpers.js +112 -112
  168. package/components/input/mask/helpers.js.map +1 -1
  169. package/components/input/mask/inputMaskCore.d.ts +46 -46
  170. package/components/input/mask/inputMaskCore.js +278 -278
  171. package/components/input/mask/inputMaskCore.js.map +1 -1
  172. package/components/input/mask/pattern.d.ts +20 -20
  173. package/components/input/mask/pattern.js +78 -78
  174. package/components/input/mask/pattern.js.map +1 -1
  175. package/components/input/maskedInput.d.ts +373 -351
  176. package/components/input/maskedInput.js +224 -224
  177. package/components/input/maskedInput.js.map +1 -1
  178. package/components/input/passwordInput.d.ts +9 -9
  179. package/components/input/passwordInput.js +55 -55
  180. package/components/input/passwordInput.js.map +1 -1
  181. package/components/input/simpleAutoComplete.d.ts +12 -12
  182. package/components/input/simpleAutoComplete.js +41 -43
  183. package/components/input/simpleAutoComplete.js.map +1 -1
  184. package/components/input/textarea/extractSpansOfClasses.d.ts +15 -15
  185. package/components/input/textarea/extractSpansOfClasses.js +96 -96
  186. package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
  187. package/components/input/textarea/getRanges.d.ts +1 -1
  188. package/components/input/textarea/getRanges.js +73 -73
  189. package/components/input/textarea/getRanges.js.map +1 -1
  190. package/components/input/textarea/getType.d.ts +1 -1
  191. package/components/input/textarea/getType.js +26 -26
  192. package/components/input/textarea/getType.js.map +1 -1
  193. package/components/input/textarea/highlighedContents.d.ts +6 -6
  194. package/components/input/textarea/highlighedContents.js +10 -10
  195. package/components/input/textarea/mentionsWithHighlighting.d.ts +27 -27
  196. package/components/input/textarea/mentionsWithHighlighting.js +60 -60
  197. package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
  198. package/components/keyboard/keyboardUtils.d.ts +5 -5
  199. package/components/keyboard/keyboardUtils.js +32 -32
  200. package/components/modal/draggableModalProvider.d.ts +4 -4
  201. package/components/modal/draggableModalProvider.js +21 -21
  202. package/components/modal/draggableModalProvider.js.map +1 -1
  203. package/components/modal/impl/clamp.d.ts +1 -1
  204. package/components/modal/impl/clamp.js +1 -1
  205. package/components/modal/impl/clamp.js.map +1 -1
  206. package/components/modal/impl/draggableModal.d.ts +12 -12
  207. package/components/modal/impl/draggableModal.js +17 -17
  208. package/components/modal/impl/draggableModal.js.map +1 -1
  209. package/components/modal/impl/draggableModalContext.d.ts +9 -9
  210. package/components/modal/impl/draggableModalContext.js +2 -2
  211. package/components/modal/impl/draggableModalContext.js.map +1 -1
  212. package/components/modal/impl/draggableModalInner.d.ts +15 -13
  213. package/components/modal/impl/draggableModalInner.js +57 -55
  214. package/components/modal/impl/draggableModalInner.js.map +1 -1
  215. package/components/modal/impl/draggableModalReducer.d.ts +66 -62
  216. package/components/modal/impl/draggableModalReducer.js +77 -78
  217. package/components/modal/impl/draggableModalReducer.js.map +1 -1
  218. package/components/modal/impl/getWindowSize.d.ts +4 -4
  219. package/components/modal/impl/getWindowSize.js +4 -4
  220. package/components/modal/impl/getWindowSize.js.map +1 -1
  221. package/components/modal/impl/index.d.ts +3 -3
  222. package/components/modal/impl/index.js +3 -3
  223. package/components/modal/impl/index.js.map +1 -1
  224. package/components/modal/impl/resizeHandle.d.ts +3 -3
  225. package/components/modal/impl/resizeHandle.js +4 -4
  226. package/components/modal/impl/resizeHandle.js.map +1 -1
  227. package/components/modal/impl/useDrag.d.ts +5 -5
  228. package/components/modal/impl/useDrag.js +42 -42
  229. package/components/modal/impl/useDrag.js.map +1 -1
  230. package/components/modal/impl/usePrevious.d.ts +1 -1
  231. package/components/modal/impl/usePrevious.js +8 -8
  232. package/components/modal/impl/usePrevious.js.map +1 -1
  233. package/components/modal/impl/useResize.d.ts +7 -7
  234. package/components/modal/impl/useResize.js +46 -46
  235. package/components/modal/impl/useResize.js.map +1 -1
  236. package/components/modal/modalDialog.d.ts +49 -49
  237. package/components/modal/modalDialog.js +152 -152
  238. package/components/modal/modalDialog.js.map +1 -1
  239. package/components/picker/enumValuePicker.d.ts +16 -16
  240. package/components/picker/enumValuePicker.js +34 -34
  241. package/components/picker/enumValuePicker.js.map +1 -1
  242. package/components/platformSpecific.d.ts +10 -10
  243. package/components/platformSpecific.js +27 -27
  244. package/components/scrollTo/onlyText.d.ts +4 -4
  245. package/components/scrollTo/onlyText.js +30 -30
  246. package/components/scrollTo/onlyText.js.map +1 -1
  247. package/components/scrollTo/scrollTo.d.ts +41 -39
  248. package/components/scrollTo/scrollTo.js +264 -264
  249. package/components/scrollTo/scrollTo.js.map +1 -1
  250. package/components/style/withCss.d.ts +9 -0
  251. package/components/style/withCss.js +6 -0
  252. package/components/style/withCss.js.map +1 -0
  253. package/components/style/withInputNumberCss.d.ts +6 -0
  254. package/components/style/withInputNumberCss.js +13 -0
  255. package/components/style/withInputNumberCss.js.map +1 -0
  256. package/components/table/dragSortingTable.d.ts +13 -14
  257. package/components/table/dragSortingTable.js +96 -82
  258. package/components/table/dragSortingTable.js.map +1 -1
  259. package/components/text/impl/innerSize.d.ts +2 -2
  260. package/components/text/impl/innerSize.js +12 -12
  261. package/components/text/impl/series.d.ts +1 -1
  262. package/components/text/impl/series.js +28 -28
  263. package/components/text/impl/shallowEqual.d.ts +1 -1
  264. package/components/text/impl/shallowEqual.js +18 -18
  265. package/components/text/impl/shallowEqual.js.map +1 -1
  266. package/components/text/impl/uniqueId.d.ts +1 -1
  267. package/components/text/impl/uniqueId.js +4 -4
  268. package/components/text/impl/whilst.d.ts +1 -1
  269. package/components/text/impl/whilst.js +19 -19
  270. package/components/text/impl/whilst.js.map +1 -1
  271. package/components/text/textFit.d.ts +38 -38
  272. package/components/text/textFit.js +165 -168
  273. package/components/text/textFit.js.map +1 -1
  274. package/i18n/components.cs.json +101 -100
  275. package/i18n/components.sk.json +101 -100
  276. package/i18n/components.uk.json +101 -100
  277. package/i18n/componentsLocaleHolder.d.ts +3 -3
  278. package/i18n/componentsLocaleHolder.js +28 -28
  279. package/i18n/componentsLocaleHolder.js.map +1 -1
  280. package/package.json +71 -70
  281. package/style/index.less +274 -298
  282. package/style/modal/DraggableModal.css +43 -40
  283. package/style/modal/ResizeHandle.css +27 -19
  284. package/tsconfig.build.json +24 -24
  285. package/tsconfig.json +11 -11
  286. package/components/grid/cell/wildcardQuickFilter.d.ts +0 -11
  287. package/components/grid/cell/wildcardQuickFilter.js +0 -61
  288. package/components/grid/cell/wildcardQuickFilter.js.map +0 -1
  289. package/components/table/dataTable.d.ts +0 -17
  290. package/components/table/dataTable.js +0 -79
  291. package/components/table/dataTable.js.map +0 -1
  292. package/style/antd/antd-tree-showline.css +0 -25
  293. package/style/antd/full-height-tabs.scss +0 -63
  294. package/style/draftail/draftail-editor.css +0 -179
  295. package/style/table/dragSortingTable.css +0 -7
@@ -1,160 +1,137 @@
1
- import React from 'react';
2
- import { InputNumber, Select } from "antd";
3
- import { Key } from "ts-key-enum";
4
- import KeyboardUtils from "d2coreui/components/keyboard/keyboardUtils";
5
- import { LocaleHolder } from "d2core/i18n/localeHolder";
6
- import ReactDOM from 'react-dom';
7
- import scrollIntoView from "dom-scroll-into-view";
8
- const KEY_BACKSPACE = 8;
9
- const KEY_DELETE = 46;
10
- const KEY_F2 = 113;
11
- export default class StatusTextCellEditor extends React.Component {
12
- constructor(props) {
13
- super(props);
14
- this.inputComponent = null;
15
- this.focusOpId = null;
16
- this.state = this.getInitialState(props);
17
- }
18
- getInitialState(props) {
19
- let value;
20
- let highlightAllOnFocus = true;
21
- if (props.keyPress === KEY_BACKSPACE || props.keyPress === KEY_DELETE) {
22
- value = null;
23
- }
24
- else if (props.charPress) {
25
- const parsedValue = Number.parseInt(props.charPress);
26
- value = isNaN(parsedValue) ? props.value : parsedValue;
27
- highlightAllOnFocus = false;
28
- }
29
- else {
30
- value = props.value;
31
- if (props.keyPress === KEY_F2) {
32
- highlightAllOnFocus = false;
33
- }
34
- }
35
- return {
36
- value: value,
37
- highlightAllOnFocus,
38
- cancelEdit: false
39
- };
40
- }
41
- componentWillUnmount() {
42
- if (this.focusOpId) {
43
- clearTimeout(this.focusOpId);
44
- }
45
- }
46
- afterGuiAttached() {
47
- this.focusOpId = window.setTimeout(() => {
48
- var _a, _b, _c, _d, _e;
49
- (_a = this.inputComponent) === null || _a === void 0 ? void 0 : _a.focus();
50
- if (this.state.highlightAllOnFocus) {
51
- (_b = this.inputComponent) === null || _b === void 0 ? void 0 : _b.select();
52
- this.setState({
53
- highlightAllOnFocus: false,
54
- });
55
- }
56
- else {
57
- const length = ((_c = this.inputComponent) === null || _c === void 0 ? void 0 : _c.value) ? (_d = this.inputComponent) === null || _d === void 0 ? void 0 : _d.value.length : 0;
58
- if (length > 0) {
59
- (_e = this.inputComponent) === null || _e === void 0 ? void 0 : _e.setSelectionRange(length, length);
60
- }
61
- }
62
- }, 200);
63
- }
64
- getValue() {
65
- return this.state.value;
66
- }
67
- isPopup() {
68
- return true;
69
- }
70
- isCancelBeforeStart() {
71
- return !!this.props.charPress && '1234567890'.indexOf(this.props.charPress) < 0;
72
- }
73
- isCancelAfterEnd() {
74
- return false;
75
- }
76
- getScrollParent(element, includeHidden = false) {
77
- var style = getComputedStyle(element);
78
- var excludeStaticParent = style.position === "absolute";
79
- var overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
80
- if (style.position === "fixed")
81
- return document.body;
82
- let parent;
83
- for (parent = element; (parent = parent.parentElement);) {
84
- style = getComputedStyle(parent);
85
- if (excludeStaticParent && style.position === "static") {
86
- continue;
87
- }
88
- if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX))
89
- return parent;
90
- }
91
- return document.body;
92
- }
93
- scrollTo(value) {
94
- const elementToScroll = document.getElementById("select-value-" + value);
95
- if (elementToScroll) {
96
- const parent = this.getScrollParent(elementToScroll, true);
97
- scrollIntoView(elementToScroll, parent, {
98
- onlyScrollIfNeeded: true,
99
- allowHorizontalScroll: false,
100
- alignWithTop: true,
101
- offsetTop: 20,
102
- offsetBottom: 20,
103
- });
104
- }
105
- }
106
- render() {
107
- var _a;
108
- return (React.createElement("div", { style: { width: "100%", minWidth: 150 } },
109
- React.createElement(Select, { size: "small", virtual: false, dropdownMatchSelectWidth: false, className: "select-with-one-item", style: { width: "100%", overflow: "auto", visibility: "hidden" }, dropdownStyle: { maxHeight: 400, overflow: 'auto' }, allowClear: true, dropdownAlign: { points: ["tl", "tr"], offset: [0, -100], overflow: { adjustX: true, adjustY: true } }, filterOption: (inputValue, option) => {
110
- var _a;
111
- const inputToSearch = inputValue.toLocaleLowerCase(LocaleHolder.formattingLocale);
112
- const value = option === null || option === void 0 ? void 0 : option.value;
113
- return ((value === null || value === void 0 ? void 0 : value.toString().indexOf(inputToSearch)) >= 0) || (((_a = option === null || option === void 0 ? void 0 : option.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase(LocaleHolder.formattingLocale).indexOf(inputToSearch)) >= 0);
114
- }, value: this.state.value !== null ? this.state.value : undefined, onChange: (value) => {
115
- this.setState({ value: value });
116
- }, open: this.state.opened, onDropdownVisibleChange: (visible) => {
117
- this.setState({ opened: visible });
118
- }, getPopupContainer: (_trigger) => {
119
- var _a, _b;
120
- return ((_b = (_a = ReactDOM.findDOMNode(this)) === null || _a === void 0 ? void 0 : _a.parentNode) !== null && _b !== void 0 ? _b : document.body);
121
- } }, (_a = this.props.statusTexts) === null || _a === void 0 ? void 0 : _a.map((statusTextItem) => {
122
- return React.createElement(Select.Option, { id: "select-value-" + statusTextItem.value, key: "" + statusTextItem.value, value: statusTextItem.value, title: statusTextItem.text },
123
- React.createElement("span", { style: {
124
- color: "rgba(0, 0, 0, 0.85)",
125
- whiteSpace: "nowrap"
126
- } }, `${statusTextItem.text} (${statusTextItem.value})`));
127
- })),
128
- React.createElement(InputNumber, { ref: (component) => {
129
- this.inputComponent = component;
130
- }, size: "small", style: {
131
- position: "absolute",
132
- top: 0,
133
- bottom: 0,
134
- left: 0,
135
- right: 0,
136
- width: "100%"
137
- }, autoFocus: true, decimalSeparator: this.props.decimalSeparator, precision: this.props.precision, placeholder: this.state.value === null ? "NULL" : "", value: this.state.value !== undefined && this.state.value !== null ? this.state.value : undefined, onChange: value => {
138
- if (KeyboardUtils.isKeyPressed(Key.Alt)) {
139
- return;
140
- }
141
- if (typeof value === "number") {
142
- this.setState({ value: value, opened: true });
143
- this.scrollTo(value);
144
- }
145
- else if (value === undefined || value === "") {
146
- this.setState({ value: null, opened: true });
147
- }
148
- }, onKeyDown: (e) => {
149
- if (e.key === Key.ArrowUp || e.key === Key.ArrowDown) {
150
- this.props.onKeyDown(e.nativeEvent);
151
- e.preventDefault();
152
- }
153
- }, onFocus: () => {
154
- this.setState({ opened: true });
155
- }, onClick: () => {
156
- this.setState({ opened: true });
157
- } })));
158
- }
159
- }
1
+ import React from 'react';
2
+ import { InputNumber, Select } from "antd";
3
+ import { Key } from "ts-key-enum";
4
+ import KeyboardUtils from "d2coreui/components/keyboard/keyboardUtils";
5
+ import { LocaleHolder } from "d2core/i18n/localeHolder";
6
+ import ReactDOM from 'react-dom';
7
+ import scrollIntoView from "dom-scroll-into-view";
8
+ import { DataGridCellEditorComponent, withAgGridHooks } from "./dataGridCellEditorComponent";
9
+ class StatusTextCellEditor extends DataGridCellEditorComponent {
10
+ constructor(props) {
11
+ super(props);
12
+ this.inputComponent = null;
13
+ this.state = this.getInitialState(props);
14
+ }
15
+ getInitialState(props) {
16
+ let value;
17
+ if (props.eventKey === Key.Backspace || props.eventKey === Key.Delete) {
18
+ value = null;
19
+ props.onValueChange(null);
20
+ }
21
+ else if (props.eventKey && props.eventKey.length === 1) {
22
+ const parsedValue = Number.parseInt(props.eventKey);
23
+ value = isNaN(parsedValue) ? props.value : parsedValue;
24
+ props.onValueChange(value);
25
+ }
26
+ else {
27
+ value = props.initialValue;
28
+ }
29
+ return { value: value };
30
+ }
31
+ focus() {
32
+ var _a;
33
+ (_a = this.inputComponent) === null || _a === void 0 ? void 0 : _a.focus();
34
+ }
35
+ select() {
36
+ var _a;
37
+ (_a = this.inputComponent) === null || _a === void 0 ? void 0 : _a.select();
38
+ }
39
+ placeCursorToEnd() {
40
+ var _a, _b, _c;
41
+ const length = ((_a = this.inputComponent) === null || _a === void 0 ? void 0 : _a.value) ? (_b = this.inputComponent) === null || _b === void 0 ? void 0 : _b.value.length : 0;
42
+ if (length > 0) {
43
+ (_c = this.inputComponent) === null || _c === void 0 ? void 0 : _c.setSelectionRange(length, length);
44
+ }
45
+ }
46
+ isCancelBeforeStart() {
47
+ return !!this.props.eventKey && this.props.eventKey.length === 1 && '1234567890'.indexOf(this.props.eventKey) < 0;
48
+ }
49
+ getScrollParent(element, includeHidden = false) {
50
+ var style = getComputedStyle(element);
51
+ var excludeStaticParent = style.position === "absolute";
52
+ var overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
53
+ if (style.position === "fixed")
54
+ return document.body;
55
+ let parent;
56
+ for (parent = element; (parent = parent.parentElement);) {
57
+ style = getComputedStyle(parent);
58
+ if (excludeStaticParent && style.position === "static") {
59
+ continue;
60
+ }
61
+ if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX))
62
+ return parent;
63
+ }
64
+ return document.body;
65
+ }
66
+ scrollTo(value) {
67
+ const elementToScroll = document.getElementById("select-value-" + value);
68
+ if (elementToScroll) {
69
+ const parent = this.getScrollParent(elementToScroll, true);
70
+ scrollIntoView(elementToScroll, parent, {
71
+ onlyScrollIfNeeded: true,
72
+ allowHorizontalScroll: false,
73
+ alignWithTop: true,
74
+ offsetTop: 20,
75
+ offsetBottom: 20,
76
+ });
77
+ }
78
+ }
79
+ render() {
80
+ var _a;
81
+ return (React.createElement("div", { style: { width: "100%", minWidth: 150 } },
82
+ React.createElement(Select, { size: "small", virtual: false, popupMatchSelectWidth: false, className: "select-with-one-item", style: { width: "100%", overflow: "auto", visibility: "hidden" }, dropdownStyle: { maxHeight: 400, overflow: 'auto' }, allowClear: true, dropdownAlign: { points: ["tl", "tr"], offset: [0, -100], overflow: { adjustX: true, adjustY: true } }, filterOption: (inputValue, option) => {
83
+ var _a, _b;
84
+ const inputToSearch = inputValue.toLocaleLowerCase(LocaleHolder.formattingLocale);
85
+ const value = option === null || option === void 0 ? void 0 : option.value;
86
+ return ((value === null || value === void 0 ? void 0 : value.toString().indexOf(inputToSearch)) >= 0) || (((_b = (_a = option === null || option === void 0 ? void 0 : option.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase(LocaleHolder.formattingLocale).indexOf(inputToSearch)) !== null && _b !== void 0 ? _b : -1) >= 0);
87
+ }, value: this.state.value !== null ? this.state.value : undefined, onChange: (value) => {
88
+ this.setState({ value: value });
89
+ this.props.onValueChange(value);
90
+ }, open: this.state.opened, onDropdownVisibleChange: (visible) => {
91
+ this.setState({ opened: visible });
92
+ }, getPopupContainer: (_trigger) => {
93
+ var _a, _b;
94
+ return ((_b = (_a = ReactDOM.findDOMNode(this)) === null || _a === void 0 ? void 0 : _a.parentNode) !== null && _b !== void 0 ? _b : document.body);
95
+ } }, (_a = this.props.statusTexts) === null || _a === void 0 ? void 0 : _a.map((statusTextItem) => {
96
+ return React.createElement(Select.Option, { id: "select-value-" + statusTextItem.value, key: "" + statusTextItem.value, value: statusTextItem.value, title: statusTextItem.text },
97
+ React.createElement("span", { style: {
98
+ color: "rgba(0, 0, 0, 0.85)",
99
+ whiteSpace: "nowrap"
100
+ } }, `${statusTextItem.text} (${statusTextItem.value})`));
101
+ })),
102
+ React.createElement(InputNumber, { ref: (component) => {
103
+ this.inputComponent = component;
104
+ }, size: "small", style: {
105
+ position: "absolute",
106
+ top: 0,
107
+ bottom: 0,
108
+ left: 0,
109
+ right: 0,
110
+ width: "100%"
111
+ }, autoFocus: true, decimalSeparator: this.props.decimalSeparator, precision: this.props.precision, placeholder: this.state.value === null ? "NULL" : "", value: this.state.value !== undefined && this.state.value !== null ? this.state.value : undefined, onChange: value => {
112
+ if (KeyboardUtils.isKeyPressed(Key.Alt)) {
113
+ return;
114
+ }
115
+ if (typeof value === "number") {
116
+ this.setState({ value: value, opened: true });
117
+ this.scrollTo(value);
118
+ this.props.onValueChange(value);
119
+ }
120
+ else if (value === undefined || value === "") {
121
+ this.setState({ value: null, opened: true });
122
+ this.props.onValueChange(null);
123
+ }
124
+ }, onKeyDown: (e) => {
125
+ if (e.key === Key.ArrowUp || e.key === Key.ArrowDown) {
126
+ this.props.onKeyDown(e.nativeEvent);
127
+ e.preventDefault();
128
+ }
129
+ }, onFocus: () => {
130
+ this.setState({ opened: true });
131
+ }, onClick: () => {
132
+ this.setState({ opened: true });
133
+ } })));
134
+ }
135
+ }
136
+ export default withAgGridHooks(StatusTextCellEditor);
160
137
  //# sourceMappingURL=statusTextCellEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"statusTextCellEditor.js","sourceRoot":"","sources":["../../../../../components/grid/cell/statusTextCellEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,MAAM,CAAC;AAEzC,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAElD,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,MAAM,GAAG,GAAG,CAAC;AAenB,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAAoE;IAIxH,YAAY,KAA+C;QACvD,KAAK,CAAC,KAAK,CAAC,CAAC;QAJT,mBAAc,GAA4B,IAAI,CAAC;QAC/C,cAAS,GAAkB,IAAI,CAAC;QAIpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,eAAe,CAAC,KAA+C;QAC3D,IAAI,KAAoB,CAAC;QACzB,IAAI,mBAAmB,GAAG,IAAI,CAAC;QAE/B,IAAI,KAAK,CAAC,QAAQ,KAAK,aAAa,IAAI,KAAK,CAAC,QAAQ,KAAK,UAAU,EAAE;YAEnE,KAAK,GAAG,IAAI,CAAC;SAChB;aAAM,IAAI,KAAK,CAAC,SAAS,EAAE;YAExB,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACrD,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KA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AAC,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,SAAS,EAAE;wBAClD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;wBACpC,CAAC,CAAC,cAAc,EAAE,CAAC;qBACtB;gBACL,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;oBACV,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;gBAClC,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;oBACV,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;gBAClC,CAAC,GACH,CACA,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from 'react';\nimport {InputNumber, Select} from \"antd\";\nimport {ICellEditor, ICellEditorParams} from \"ag-grid-community\";\nimport {Key} from \"ts-key-enum\";\nimport KeyboardUtils from \"d2coreui/components/keyboard/keyboardUtils\";\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\nimport ReactDOM from 'react-dom';\nimport scrollIntoView from \"dom-scroll-into-view\";\n\nconst KEY_BACKSPACE = 8;\nconst KEY_DELETE = 46;\nconst KEY_F2 = 113;\n\ninterface StatusTextCellEditorProperties extends ICellEditorParams {\n decimalSeparator?: string\n precision?: number\n statusTexts: { text: string, value: number }[];\n}\n\ninterface StatusTextCellEditorState {\n value: number | null\n highlightAllOnFocus: boolean\n cancelEdit: boolean\n opened: boolean\n}\n\nexport default class StatusTextCellEditor extends React.Component<StatusTextCellEditorProperties, StatusTextCellEditorState> implements ICellEditor {\n private inputComponent: HTMLInputElement | null = null;\n private focusOpId: number | null = null;\n\n constructor(props: Readonly<StatusTextCellEditorProperties>) {\n super(props);\n this.state = this.getInitialState(props);\n }\n\n getInitialState(props: Readonly<StatusTextCellEditorProperties>): StatusTextCellEditorState {\n let value: number | null;\n let highlightAllOnFocus = true;\n\n if (props.keyPress === KEY_BACKSPACE || props.keyPress === KEY_DELETE) {\n // if backspace or delete pressed, we clear the cell\n value = null;\n } else if (props.charPress) {\n // if a letter was pressed, we start with the letter\n const parsedValue = Number.parseInt(props.charPress);\n value = isNaN(parsedValue) ? props.value : parsedValue;\n highlightAllOnFocus = false;\n } else {\n // otherwise we start with the current value\n value = props.value;\n if (props.keyPress === KEY_F2) {\n highlightAllOnFocus = false;\n }\n }\n return {\n value: value,\n highlightAllOnFocus,\n cancelEdit: false\n } as StatusTextCellEditorState;\n }\n\n componentWillUnmount() {\n if (this.focusOpId) {\n clearTimeout(this.focusOpId);\n }\n }\n\n afterGuiAttached() {\n this.focusOpId = window.setTimeout(() => {\n this.inputComponent?.focus();\n if (this.state.highlightAllOnFocus) {\n this.inputComponent?.select();\n this.setState({\n highlightAllOnFocus: false,\n });\n } else {\n // when we started editing, we want the carot at the end, not the start.\n // this comes into play in two scenarios: a) when user hits F2 and b)\n // when user hits a printable character, then on IE (and only IE) the carot\n // was placed after the first character, thus 'apply' would end up as 'pplea'\n const length = this.inputComponent?.value ? this.inputComponent?.value.length : 0;\n if (length > 0) {\n this.inputComponent?.setSelectionRange(length, length);\n }\n }\n }, 200);\n }\n\n getValue() {\n return this.state.value;\n }\n\n isPopup(): boolean {\n return true;\n }\n\n isCancelBeforeStart(): boolean {\n return !!this.props.charPress && '1234567890'.indexOf(this.props.charPress) < 0;\n }\n\n isCancelAfterEnd() {\n return false;\n }\n\n // noinspection DuplicatedCode\n getScrollParent(element: HTMLElement, includeHidden = false): HTMLElement {\n var style = getComputedStyle(element);\n var excludeStaticParent = style.position === \"absolute\";\n var overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;\n if (style.position === \"fixed\") return document.body;\n let parent: HTMLElement | null;\n for (parent = element; (parent = parent.parentElement);) {\n style = getComputedStyle(parent);\n if (excludeStaticParent && style.position === \"static\") {\n continue;\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) return parent;\n }\n return document.body;\n }\n\n scrollTo(value: number) {\n const elementToScroll = document.getElementById(\"select-value-\" + value);\n if (elementToScroll) {\n const parent = this.getScrollParent(elementToScroll, true);\n scrollIntoView(elementToScroll, parent, {\n onlyScrollIfNeeded: true,\n allowHorizontalScroll: false,\n alignWithTop: true,\n offsetTop: 20,\n offsetBottom: 20,\n });\n }\n }\n\n render() {\n return (\n <div style={{width: \"100%\", minWidth: 150}}>\n <Select<number>\n size={\"small\"}\n virtual={false}\n dropdownMatchSelectWidth={false}\n className={\"select-with-one-item\"}\n style={{width: \"100%\", overflow: \"auto\", visibility: \"hidden\"}}\n dropdownStyle={{maxHeight: 400, overflow: 'auto'}}\n allowClear\n dropdownAlign={{points: [\"tl\", \"tr\"], offset: [0, -100], overflow: {adjustX: true, adjustY: true}}}\n filterOption={(inputValue, option) => {\n const inputToSearch = inputValue.toLocaleLowerCase(LocaleHolder.formattingLocale);\n const value: number = option?.value as number;\n return (value?.toString().indexOf(inputToSearch) >= 0) || (option?.title?.toLocaleLowerCase(LocaleHolder.formattingLocale).indexOf(inputToSearch) >= 0);\n }}\n value={this.state.value !== null ? this.state.value : undefined}\n onChange={(value) => {\n this.setState({value: value});\n }}\n open={this.state.opened}\n onDropdownVisibleChange={(visible) => {\n this.setState({opened: visible});\n }}\n getPopupContainer={(_trigger) => {\n // very nasty trick how to keep select's popup within focusable area of ag-grid cell editor popup (prevent closing cell editor when we click in select's dropdown area)\n return (ReactDOM.findDOMNode(this)?.parentNode ?? document.body) as HTMLElement;\n }}\n >\n {this.props.statusTexts?.map((statusTextItem) => {\n return <Select.Option\n id={\"select-value-\" + statusTextItem.value}\n key={\"\" + statusTextItem.value}\n value={statusTextItem.value}\n title={statusTextItem.text}\n >\n <span style={{\n color: \"rgba(0, 0, 0, 0.85)\",\n whiteSpace: \"nowrap\"\n }}>{`${statusTextItem.text} (${statusTextItem.value})`}</span>\n </Select.Option>;\n })}\n </Select>\n <InputNumber\n ref={(component) => {\n this.inputComponent = component;\n }}\n size=\"small\"\n style={{\n position: \"absolute\",\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n width: \"100%\"\n }}\n autoFocus\n decimalSeparator={this.props.decimalSeparator}\n precision={this.props.precision}\n placeholder={this.state.value === null ? \"NULL\" : \"\"}\n value={this.state.value !== undefined && this.state.value !== null ? this.state.value : undefined}\n onChange={value => {\n if (KeyboardUtils.isKeyPressed(Key.Alt)) {\n // ignore navigational keystrokes ALT+cursor arrow\n return;\n }\n if (typeof value === \"number\") {\n this.setState({value: value, opened: true});\n this.scrollTo(value);\n } else if (value === undefined || value === \"\") {\n this.setState({value: null, opened: true});\n }\n }}\n onKeyDown={(e) => {\n if (e.key === Key.ArrowUp || e.key === Key.ArrowDown) {\n this.props.onKeyDown(e.nativeEvent);\n e.preventDefault();\n }\n }}\n onFocus={() => {\n this.setState({opened: true});\n }}\n onClick={() => {\n this.setState({opened: true});\n }}\n />\n </div>\n );\n }\n}"]}
1
+ {"version":3,"file":"statusTextCellEditor.js","sourceRoot":"","sources":["../../../../../components/grid/cell/statusTextCellEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,MAAM,CAAC;AACzC,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAChC,OAAO,aAAa,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAC,2BAA2B,EAAE,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAa3F,MAAM,oBAAqB,SAAQ,2BAAsF;IAGrH,YAAY,KAA+C;QACvD,KAAK,CAAC,KAAK,CAAC,CAAC;QAHT,mBAAc,GAA4B,IAAI,CAAC;QAInD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;I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K,KAAK,EAAE,EAAE,CAAC;wBAC7C,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;wBAC3C,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;oBACnC,CAAC;gBACL,CAAC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;oBACb,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,SAAS,EAAE,CAAC;wBACnD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;wBACpC,CAAC,CAAC,cAAc,EAAE,CAAC;oBACvB,CAAC;gBACL,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;oBACV,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;gBAClC,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;oBACV,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;gBAClC,CAAC,GACH,CACA,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,eAAe,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import React from 'react';\r\nimport {InputNumber, Select} from \"antd\";\r\nimport {Key} from \"ts-key-enum\";\r\nimport KeyboardUtils from \"d2coreui/components/keyboard/keyboardUtils\";\r\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\r\nimport ReactDOM from 'react-dom';\r\nimport scrollIntoView from \"dom-scroll-into-view\";\r\nimport {CustomCellEditorProps} from \"ag-grid-react\";\r\nimport {DataGridCellEditorComponent, withAgGridHooks} from \"./dataGridCellEditorComponent\";\r\n\r\ninterface StatusTextCellEditorProperties extends CustomCellEditorProps {\r\n decimalSeparator?: string\r\n precision?: number\r\n statusTexts: { text: string, value: number }[];\r\n}\r\n\r\ninterface StatusTextCellEditorState {\r\n value: number | null\r\n opened: boolean\r\n}\r\n\r\nclass StatusTextCellEditor extends DataGridCellEditorComponent<StatusTextCellEditorProperties, StatusTextCellEditorState> {\r\n private inputComponent: HTMLInputElement | null = null;\r\n\r\n constructor(props: Readonly<StatusTextCellEditorProperties>) {\r\n super(props);\r\n this.state = this.getInitialState(props);\r\n }\r\n\r\n getInitialState(props: Readonly<StatusTextCellEditorProperties>): StatusTextCellEditorState {\r\n let value: number | null;\r\n\r\n if (props.eventKey === Key.Backspace || props.eventKey === Key.Delete) {\r\n // if backspace or delete pressed, we clear the cell\r\n value = null;\r\n props.onValueChange(null);\r\n } else if (props.eventKey && props.eventKey.length === 1) {\r\n // if a letter was pressed, we start with the letter\r\n const parsedValue = Number.parseInt(props.eventKey);\r\n value = isNaN(parsedValue) ? props.value : parsedValue;\r\n props.onValueChange(value);\r\n } else {\r\n // otherwise we start with the current value\r\n value = props.initialValue;\r\n }\r\n return {value: value} as StatusTextCellEditorState;\r\n }\r\n\r\n focus() {\r\n this.inputComponent?.focus();\r\n }\r\n\r\n select() {\r\n this.inputComponent?.select();\r\n }\r\n\r\n placeCursorToEnd() {\r\n // when we started editing, we want the carot at the end, not the start.\r\n // this comes into play in two scenarios: a) when user hits F2 and b)\r\n // when user hits a printable character, then on IE (and only IE) the carot\r\n // was placed after the first character, thus 'apply' would end up as 'pplea'\r\n const length = this.inputComponent?.value ? this.inputComponent?.value.length : 0;\r\n if (length > 0) {\r\n this.inputComponent?.setSelectionRange(length, length);\r\n }\r\n }\r\n\r\n isCancelBeforeStart(): boolean {\r\n return !!this.props.eventKey && this.props.eventKey.length === 1 && '1234567890'.indexOf(this.props.eventKey) < 0;\r\n }\r\n\r\n // noinspection DuplicatedCode\r\n getScrollParent(element: HTMLElement, includeHidden = false): HTMLElement {\r\n var style = getComputedStyle(element);\r\n var excludeStaticParent = style.position === \"absolute\";\r\n var overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;\r\n if (style.position === \"fixed\") return document.body;\r\n let parent: HTMLElement | null;\r\n for (parent = element; (parent = parent.parentElement);) {\r\n style = getComputedStyle(parent);\r\n if (excludeStaticParent && style.position === \"static\") {\r\n continue;\r\n }\r\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) return parent;\r\n }\r\n return document.body;\r\n }\r\n\r\n scrollTo(value: number) {\r\n const elementToScroll = document.getElementById(\"select-value-\" + value);\r\n if (elementToScroll) {\r\n const parent = this.getScrollParent(elementToScroll, true);\r\n scrollIntoView(elementToScroll, parent, {\r\n onlyScrollIfNeeded: true,\r\n allowHorizontalScroll: false,\r\n alignWithTop: true,\r\n offsetTop: 20,\r\n offsetBottom: 20,\r\n });\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <div style={{width: \"100%\", minWidth: 150}}>\r\n <Select<number>\r\n size={\"small\"}\r\n virtual={false}\r\n popupMatchSelectWidth={false}\r\n className={\"select-with-one-item\"}\r\n style={{width: \"100%\", overflow: \"auto\", visibility: \"hidden\"}}\r\n dropdownStyle={{maxHeight: 400, overflow: 'auto'}}\r\n allowClear\r\n dropdownAlign={{points: [\"tl\", \"tr\"], offset: [0, -100], overflow: {adjustX: true, adjustY: true}}}\r\n filterOption={(inputValue, option) => {\r\n const inputToSearch = inputValue.toLocaleLowerCase(LocaleHolder.formattingLocale);\r\n const value: number = option?.value as number;\r\n return (value?.toString().indexOf(inputToSearch) >= 0) || ((option?.title?.toLocaleLowerCase(LocaleHolder.formattingLocale).indexOf(inputToSearch) ?? -1) >= 0);\r\n }}\r\n value={this.state.value !== null ? this.state.value : undefined}\r\n onChange={(value) => {\r\n this.setState({value: value});\r\n this.props.onValueChange(value);\r\n }}\r\n open={this.state.opened}\r\n onDropdownVisibleChange={(visible) => {\r\n this.setState({opened: visible});\r\n }}\r\n getPopupContainer={(_trigger) => {\r\n // very nasty trick how to keep select's popup within focusable area of ag-grid cell editor popup (prevent closing cell editor when we click in select's dropdown area)\r\n return (ReactDOM.findDOMNode(this)?.parentNode ?? document.body) as HTMLElement;\r\n }}\r\n >\r\n {this.props.statusTexts?.map((statusTextItem) => {\r\n return <Select.Option\r\n id={\"select-value-\" + statusTextItem.value}\r\n key={\"\" + statusTextItem.value}\r\n value={statusTextItem.value}\r\n title={statusTextItem.text}\r\n >\r\n <span style={{\r\n color: \"rgba(0, 0, 0, 0.85)\",\r\n whiteSpace: \"nowrap\"\r\n }}>{`${statusTextItem.text} (${statusTextItem.value})`}</span>\r\n </Select.Option>;\r\n })}\r\n </Select>\r\n <InputNumber\r\n ref={(component) => {\r\n this.inputComponent = component;\r\n }}\r\n size=\"small\"\r\n style={{\r\n position: \"absolute\",\r\n top: 0,\r\n bottom: 0,\r\n left: 0,\r\n right: 0,\r\n width: \"100%\"\r\n }}\r\n autoFocus\r\n decimalSeparator={this.props.decimalSeparator}\r\n precision={this.props.precision}\r\n placeholder={this.state.value === null ? \"NULL\" : \"\"}\r\n value={this.state.value !== undefined && this.state.value !== null ? this.state.value : undefined}\r\n onChange={value => {\r\n if (KeyboardUtils.isKeyPressed(Key.Alt)) {\r\n // ignore navigational keystrokes ALT+cursor arrow\r\n return;\r\n }\r\n if (typeof value === \"number\") {\r\n this.setState({value: value, opened: true});\r\n this.scrollTo(value);\r\n this.props.onValueChange(value);\r\n } else if (value === undefined || value === \"\") {\r\n this.setState({value: null, opened: true});\r\n this.props.onValueChange(null);\r\n }\r\n }}\r\n onKeyDown={(e) => {\r\n if (e.key === Key.ArrowUp || e.key === Key.ArrowDown) {\r\n this.props.onKeyDown(e.nativeEvent);\r\n e.preventDefault();\r\n }\r\n }}\r\n onFocus={() => {\r\n this.setState({opened: true});\r\n }}\r\n onClick={() => {\r\n this.setState({opened: true});\r\n }}\r\n />\r\n </div>\r\n );\r\n }\r\n}\r\n\r\nexport default withAgGridHooks(StatusTextCellEditor)"]}
@@ -1,20 +1,20 @@
1
- import { RGBColor } from "react-color";
2
- export interface GridRowStyle {
3
- [cssProperty: string]: string | number | RGBColor;
4
- }
5
- export interface RowStyleRule {
6
- name: string;
7
- divider?: string;
8
- key: string;
9
- expression: string | null;
10
- style: GridRowStyle;
11
- styleEditor?: {
12
- backgroundColor?: boolean;
13
- color?: boolean;
14
- fontSize?: boolean;
15
- fontWeight?: boolean;
16
- };
17
- }
18
- export declare const GRID_DEFAULT_FONT_SIZE = 12;
19
- declare const tableDefaultRowStyleRules: () => RowStyleRule[];
20
- export default tableDefaultRowStyleRules;
1
+ import { RGBColor } from "react-color";
2
+ export interface GridRowStyle {
3
+ [cssProperty: string]: string | number | RGBColor;
4
+ }
5
+ export interface RowStyleRule {
6
+ name: string;
7
+ divider?: string;
8
+ key: string;
9
+ expression: string | null;
10
+ style: GridRowStyle;
11
+ styleEditor?: {
12
+ backgroundColor?: boolean;
13
+ color?: boolean;
14
+ fontSize?: boolean;
15
+ fontWeight?: boolean;
16
+ rowHeightDelta?: boolean;
17
+ };
18
+ }
19
+ declare const tableDefaultRowStyleRules: () => RowStyleRule[];
20
+ export default tableDefaultRowStyleRules;
@@ -1,19 +1,30 @@
1
- export const GRID_DEFAULT_FONT_SIZE = 12;
2
- const tableDefaultRowStyleRules = function () {
3
- return [
4
- {
5
- name: "Font Size",
6
- divider: "All Rows",
7
- key: "table-font-size",
8
- expression: null,
9
- style: {
10
- fontSize: GRID_DEFAULT_FONT_SIZE
11
- },
12
- styleEditor: {
13
- fontSize: true,
14
- }
15
- }
16
- ];
17
- };
18
- export default tableDefaultRowStyleRules;
1
+ import { GRID_DEFAULT_FONT_SIZE, GRID_DEFAULT_ROW_HEIGHT_DELTA } from "../config/rowHeightCalculator";
2
+ const tableDefaultRowStyleRules = function () {
3
+ return [
4
+ {
5
+ name: "Font Size",
6
+ divider: "All Rows",
7
+ key: "table-font-size",
8
+ expression: null,
9
+ style: {
10
+ fontSize: GRID_DEFAULT_FONT_SIZE
11
+ },
12
+ styleEditor: {
13
+ fontSize: true,
14
+ }
15
+ },
16
+ {
17
+ name: "Line Indentation",
18
+ key: "table-line-indentation",
19
+ expression: null,
20
+ style: {
21
+ rowHeightDelta: GRID_DEFAULT_ROW_HEIGHT_DELTA
22
+ },
23
+ styleEditor: {
24
+ rowHeightDelta: true,
25
+ }
26
+ }
27
+ ];
28
+ };
29
+ export default tableDefaultRowStyleRules;
19
30
  //# sourceMappingURL=tableDefaultRowStyleRules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tableDefaultRowStyleRules.js","sourceRoot":"","sources":["../../../../../components/grid/cell/tableDefaultRowStyleRules.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,MAAM,yBAAyB,GAAG;IAC9B,OAAO;QACH;YACI,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,UAAU;YACnB,GAAG,EAAE,iBAAiB;YACtB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE;gBACH,QAAQ,EAAE,sBAAsB;aACnC;YACD,WAAW,EAAE;gBACT,QAAQ,EAAE,IAAI;aACjB;SACJ;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["import {RGBColor} from \"react-color\";\n\nexport interface GridRowStyle {\n [cssProperty: string]: string | number | RGBColor\n}\n\nexport interface RowStyleRule {\n name: string\n divider?: string\n key: string\n expression: string | null\n style: GridRowStyle\n styleEditor?: {\n backgroundColor?: boolean\n color?: boolean\n fontSize?: boolean\n fontWeight?: boolean\n }\n}\n\nexport const GRID_DEFAULT_FONT_SIZE = 12;\n\nconst tableDefaultRowStyleRules = function (): RowStyleRule[] {\n return [\n {\n name: \"Font Size\",\n divider: \"All Rows\",\n key: \"table-font-size\",\n expression: null,\n style: {\n fontSize: GRID_DEFAULT_FONT_SIZE\n },\n styleEditor: {\n fontSize: true,\n }\n }\n ];\n};\n\nexport default tableDefaultRowStyleRules;"]}
1
+ {"version":3,"file":"tableDefaultRowStyleRules.js","sourceRoot":"","sources":["../../../../../components/grid/cell/tableDefaultRowStyleRules.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAE,6BAA6B,EAAC,MAAM,+BAA+B,CAAC;AAqBpG,MAAM,yBAAyB,GAAG;IAC9B,OAAO;QACH;YACI,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,UAAU;YACnB,GAAG,EAAE,iBAAiB;YACtB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE;gBACH,QAAQ,EAAE,sBAAsB;aACnC;YACD,WAAW,EAAE;gBACT,QAAQ,EAAE,IAAI;aACjB;SACJ;QACD;YACI,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,wBAAwB;YAC7B,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE;gBACH,cAAc,EAAE,6BAA6B;aAChD;YACD,WAAW,EAAE;gBACT,cAAc,EAAE,IAAI;aACvB;SACJ;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["import {RGBColor} from \"react-color\";\r\nimport {GRID_DEFAULT_FONT_SIZE, GRID_DEFAULT_ROW_HEIGHT_DELTA} from \"../config/rowHeightCalculator\";\r\n\r\nexport interface GridRowStyle {\r\n [cssProperty: string]: string | number | RGBColor\r\n}\r\n\r\nexport interface RowStyleRule {\r\n name: string\r\n divider?: string\r\n key: string\r\n expression: string | null\r\n style: GridRowStyle\r\n styleEditor?: {\r\n backgroundColor?: boolean\r\n color?: boolean\r\n fontSize?: boolean\r\n fontWeight?: boolean\r\n rowHeightDelta?: boolean\r\n }\r\n}\r\n\r\nconst tableDefaultRowStyleRules = function (): RowStyleRule[] {\r\n return [\r\n {\r\n name: \"Font Size\",\r\n divider: \"All Rows\",\r\n key: \"table-font-size\",\r\n expression: null,\r\n style: {\r\n fontSize: GRID_DEFAULT_FONT_SIZE\r\n },\r\n styleEditor: {\r\n fontSize: true,\r\n }\r\n },\r\n {\r\n name: \"Line Indentation\",\r\n key: \"table-line-indentation\",\r\n expression: null,\r\n style: {\r\n rowHeightDelta: GRID_DEFAULT_ROW_HEIGHT_DELTA\r\n },\r\n styleEditor: {\r\n rowHeightDelta: true,\r\n }\r\n }\r\n ];\r\n};\r\n\r\nexport default tableDefaultRowStyleRules;"]}
@@ -1,21 +1,4 @@
1
- import React from 'react';
2
- import { ICellEditor, ICellEditorParams } from "ag-grid-community";
3
- interface TextCellEditorProperties extends ICellEditorParams {
4
- }
5
- interface TextCellEditorState {
6
- value: string | null;
7
- highlightAllOnFocus: boolean;
8
- cancelEdit: boolean;
9
- }
10
- export default class TextCellEditor extends React.Component<TextCellEditorProperties, TextCellEditorState> implements ICellEditor {
11
- private inputComponent;
12
- private focusOpId;
13
- constructor(props: Readonly<TextCellEditorProperties>);
14
- getInitialState(props: Readonly<TextCellEditorProperties>): TextCellEditorState;
15
- componentWillUnmount(): void;
16
- afterGuiAttached(): void;
17
- getValue(): string | null;
18
- isPopup(): boolean;
19
- render(): JSX.Element;
20
- }
21
- export {};
1
+ import React from 'react';
2
+ import { CustomCellEditorProps } from "ag-grid-react";
3
+ declare const _default: (props: CustomCellEditorProps) => React.JSX.Element;
4
+ export default _default;