d2coreui 23.0.14 → 23.0.15

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 (403) hide show
  1. package/components/clipboard/clipboardUtils.ts +53 -0
  2. package/components/codemirror/SyntaxHighlighter.tsx +58 -0
  3. package/components/collapse/expandable.tsx +48 -0
  4. package/components/color/colorPicker.tsx +121 -0
  5. package/components/color/colorSwatch.d.ts +18 -13
  6. package/components/color/colorSwatch.jsx +87 -0
  7. package/components/color/colorUtils.ts +60 -0
  8. package/components/date/dateRangeInput.tsx +468 -0
  9. package/components/date/dateRangeInputAdvancedPanel.tsx +238 -0
  10. package/components/date/dateRangeInputConfirm.tsx +200 -0
  11. package/components/date/dateTimeInput.tsx +633 -0
  12. package/components/date/durationInput.tsx +375 -0
  13. package/components/form/NiceFormItem.tsx +32 -0
  14. package/components/grid/cell/beanAccessor.ts +17 -0
  15. package/components/grid/cell/cellEditorUtils.ts +12 -0
  16. package/components/grid/cell/customEnumCellEditor.tsx +130 -0
  17. package/components/grid/cell/dataGridCellEditorComponent.tsx +61 -0
  18. package/components/grid/cell/dateCellEditor.tsx +83 -0
  19. package/components/grid/cell/durationCellEditor.tsx +105 -0
  20. package/components/grid/cell/hexaOctetStringCellEditor.tsx +101 -0
  21. package/components/grid/cell/hexaValueCellEditor.tsx +92 -0
  22. package/components/grid/cell/numberCellEditor.tsx +115 -0
  23. package/components/grid/cell/rangeSelector.d.ts +9 -78
  24. package/components/grid/cell/rangeSelector.js +674 -527
  25. package/components/grid/cell/simpleStatusTextCellEditor.tsx +168 -0
  26. package/components/grid/cell/statusTextCellEditor.tsx +198 -0
  27. package/components/grid/cell/tableDefaultRowStyleRules.ts +51 -0
  28. package/components/grid/cell/textCellEditor.tsx +94 -0
  29. package/components/grid/cell/withAgGridHooks.tsx +15 -0
  30. package/components/grid/columnUtils.ts +29 -0
  31. package/components/grid/config/columnTransfer.tsx +258 -0
  32. package/components/grid/config/dataGridEditor.tsx +328 -0
  33. package/components/grid/config/rowHeightCalculator.tsx +29 -0
  34. package/components/grid/config/rowStylePicker.tsx +196 -0
  35. package/components/grid/dataGrid.tsx +2183 -0
  36. package/components/grid/detail/detailHeaderPanel.tsx +59 -0
  37. package/components/grid/export/contextMenu.tsx +154 -0
  38. package/components/grid/export/progressPopup.tsx +106 -0
  39. package/components/grid/export/worker/clipboardExport.ts +10 -0
  40. package/components/grid/export/worker/csvExport.ts +10 -0
  41. package/components/grid/export/worker/pdfExport.ts +98 -0
  42. package/components/grid/export/worker/txtExport.ts +21 -0
  43. package/components/grid/extendedDataGrid.tsx +974 -0
  44. package/components/grid/filter/customColumnFilter.tsx +14 -0
  45. package/components/grid/filter/dataGridColumnFilter.tsx +70 -0
  46. package/components/grid/filter/dateColumnFilter.tsx +34 -0
  47. package/components/grid/filter/textColumnFilter.tsx +37 -0
  48. package/components/grid/filter/wildcardQuickFilterEngine.ts +50 -0
  49. package/components/grid/header/simpleHeader.tsx +270 -0
  50. package/components/grid/panel/dataGridPagination.tsx +123 -0
  51. package/components/grid/panel/loadingOverlay.tsx +14 -0
  52. package/components/grid/panel/noRecordsOverlay.tsx +16 -0
  53. package/components/grid/panel/tablePagination.tsx +77 -0
  54. package/components/icons/dropdownArrow.tsx +67 -0
  55. package/components/icons/undoIcon.tsx +16 -0
  56. package/components/input/autoCompleteInput.tsx +174 -0
  57. package/components/input/draftUtils.tsx +62 -0
  58. package/components/input/draftail.d.ts +186 -1
  59. package/components/input/draftail.js +1 -2
  60. package/components/input/hexaFormattedInput.tsx +64 -0
  61. package/components/input/mask/helpers.ts +154 -0
  62. package/components/input/mask/inputMaskCore.ts +452 -0
  63. package/components/input/mask/pattern.ts +122 -0
  64. package/components/input/maskedInput.tsx +275 -0
  65. package/components/input/passwordInput.tsx +62 -0
  66. package/components/input/simpleAutoComplete.tsx +60 -0
  67. package/components/input/textarea/extractSpansOfClasses.tsx +125 -0
  68. package/components/input/textarea/getRanges.ts +82 -0
  69. package/components/input/textarea/getType.ts +23 -0
  70. package/components/input/textarea/highlighedContents.tsx +20 -0
  71. package/components/input/textarea/highlightedTextarea.css +61 -0
  72. package/components/input/textarea/mentionsWithHighlighting.tsx +95 -0
  73. package/components/keyboard/keyboardUtils.ts +42 -0
  74. package/components/modal/draggableModalProvider.tsx +37 -0
  75. package/components/modal/impl/clamp.ts +4 -0
  76. package/components/modal/impl/draggableModal.tsx +36 -0
  77. package/components/modal/impl/draggableModalContext.ts +14 -0
  78. package/components/modal/impl/draggableModalInner.tsx +114 -0
  79. package/components/modal/impl/draggableModalReducer.ts +285 -0
  80. package/components/modal/impl/getWindowSize.ts +6 -0
  81. package/components/modal/impl/index.ts +5 -0
  82. package/components/modal/impl/resizeHandle.tsx +12 -0
  83. package/components/modal/impl/useDrag.ts +57 -0
  84. package/components/modal/impl/usePrevious.ts +11 -0
  85. package/components/modal/impl/useResize.ts +79 -0
  86. package/components/modal/modalDialog.tsx +172 -0
  87. package/components/picker/enumValuePicker.tsx +48 -0
  88. package/components/platformSpecific.ts +39 -0
  89. package/components/scrollTo/dom-scroll-into-view.d.ts +1 -0
  90. package/components/scrollTo/onlyText.ts +36 -0
  91. package/components/scrollTo/scrollTo.tsx +324 -0
  92. package/components/style/withCss.tsx +14 -0
  93. package/components/style/withInputNumberCss.tsx +18 -0
  94. package/components/svg.d.ts +1 -0
  95. package/components/table/dragSortingTable.tsx +123 -0
  96. package/components/text/impl/innerSize.ts +15 -0
  97. package/components/text/impl/series.ts +37 -0
  98. package/components/text/impl/shallowEqual.ts +19 -0
  99. package/components/text/impl/uniqueId.ts +5 -0
  100. package/components/text/impl/whilst.ts +25 -0
  101. package/components/text/textFit.tsx +229 -0
  102. package/i18n/components.cs.json +101 -101
  103. package/i18n/components.sk.json +101 -101
  104. package/i18n/components.uk.json +101 -101
  105. package/i18n/componentsLocaleHolder.js +24 -29
  106. package/i18n/componentsLocaleLoader.d.ts +9 -0
  107. package/lib/esm/components/color/colorSwatch.d.ts +13 -0
  108. package/lib/esm/components/grid/cell/rangeSelector.d.ts +78 -0
  109. package/lib/esm/components/grid/cell/rangeSelector.js +527 -0
  110. package/{components → lib/esm/components}/grid/export/contextMenu.js +4 -4
  111. package/lib/esm/components/input/draftail.d.ts +1 -0
  112. package/lib/esm/components/input/draftail.js +2 -0
  113. package/lib/esm/i18n/components.cs.json +101 -0
  114. package/lib/esm/i18n/components.sk.json +101 -0
  115. package/lib/esm/i18n/components.uk.json +101 -0
  116. package/lib/esm/i18n/componentsLocaleHolder.js +29 -0
  117. package/lib/esm/package.json +70 -0
  118. package/lib/esm/tsconfig.build.json +24 -0
  119. package/lib/esm/tsconfig.json +11 -0
  120. package/package.json +3 -3
  121. package/tsconfig.build.json +24 -24
  122. package/tsconfig.json +11 -11
  123. /package/{components → lib/esm/components}/clipboard/clipboardUtils.d.ts +0 -0
  124. /package/{components → lib/esm/components}/clipboard/clipboardUtils.js +0 -0
  125. /package/{components → lib/esm/components}/clipboard/clipboardUtils.js.map +0 -0
  126. /package/{components → lib/esm/components}/codemirror/SyntaxHighlighter.d.ts +0 -0
  127. /package/{components → lib/esm/components}/codemirror/SyntaxHighlighter.js +0 -0
  128. /package/{components → lib/esm/components}/codemirror/SyntaxHighlighter.js.map +0 -0
  129. /package/{components → lib/esm/components}/collapse/expandable.d.ts +0 -0
  130. /package/{components → lib/esm/components}/collapse/expandable.js +0 -0
  131. /package/{components → lib/esm/components}/collapse/expandable.js.map +0 -0
  132. /package/{components → lib/esm/components}/color/colorPicker.d.ts +0 -0
  133. /package/{components → lib/esm/components}/color/colorPicker.js +0 -0
  134. /package/{components → lib/esm/components}/color/colorPicker.js.map +0 -0
  135. /package/{components → lib/esm/components}/color/colorSwatch.js +0 -0
  136. /package/{components → lib/esm/components}/color/colorSwatch.js.map +0 -0
  137. /package/{components → lib/esm/components}/color/colorUtils.d.ts +0 -0
  138. /package/{components → lib/esm/components}/color/colorUtils.js +0 -0
  139. /package/{components → lib/esm/components}/color/colorUtils.js.map +0 -0
  140. /package/{components → lib/esm/components}/date/dateRangeInput.d.ts +0 -0
  141. /package/{components → lib/esm/components}/date/dateRangeInput.js +0 -0
  142. /package/{components → lib/esm/components}/date/dateRangeInput.js.map +0 -0
  143. /package/{components → lib/esm/components}/date/dateRangeInputAdvancedPanel.d.ts +0 -0
  144. /package/{components → lib/esm/components}/date/dateRangeInputAdvancedPanel.js +0 -0
  145. /package/{components → lib/esm/components}/date/dateRangeInputAdvancedPanel.js.map +0 -0
  146. /package/{components → lib/esm/components}/date/dateRangeInputConfirm.d.ts +0 -0
  147. /package/{components → lib/esm/components}/date/dateRangeInputConfirm.js +0 -0
  148. /package/{components → lib/esm/components}/date/dateRangeInputConfirm.js.map +0 -0
  149. /package/{components → lib/esm/components}/date/dateTimeInput.d.ts +0 -0
  150. /package/{components → lib/esm/components}/date/dateTimeInput.js +0 -0
  151. /package/{components → lib/esm/components}/date/dateTimeInput.js.map +0 -0
  152. /package/{components → lib/esm/components}/date/durationInput.d.ts +0 -0
  153. /package/{components → lib/esm/components}/date/durationInput.js +0 -0
  154. /package/{components → lib/esm/components}/date/durationInput.js.map +0 -0
  155. /package/{components → lib/esm/components}/form/NiceFormItem.d.ts +0 -0
  156. /package/{components → lib/esm/components}/form/NiceFormItem.js +0 -0
  157. /package/{components → lib/esm/components}/form/NiceFormItem.js.map +0 -0
  158. /package/{components → lib/esm/components}/grid/cell/beanAccessor.d.ts +0 -0
  159. /package/{components → lib/esm/components}/grid/cell/beanAccessor.js +0 -0
  160. /package/{components → lib/esm/components}/grid/cell/beanAccessor.js.map +0 -0
  161. /package/{components → lib/esm/components}/grid/cell/cellEditorUtils.d.ts +0 -0
  162. /package/{components → lib/esm/components}/grid/cell/cellEditorUtils.js +0 -0
  163. /package/{components → lib/esm/components}/grid/cell/cellEditorUtils.js.map +0 -0
  164. /package/{components → lib/esm/components}/grid/cell/customEnumCellEditor.d.ts +0 -0
  165. /package/{components → lib/esm/components}/grid/cell/customEnumCellEditor.js +0 -0
  166. /package/{components → lib/esm/components}/grid/cell/customEnumCellEditor.js.map +0 -0
  167. /package/{components → lib/esm/components}/grid/cell/dataGridCellEditorComponent.d.ts +0 -0
  168. /package/{components → lib/esm/components}/grid/cell/dataGridCellEditorComponent.js +0 -0
  169. /package/{components → lib/esm/components}/grid/cell/dataGridCellEditorComponent.js.map +0 -0
  170. /package/{components → lib/esm/components}/grid/cell/dateCellEditor.d.ts +0 -0
  171. /package/{components → lib/esm/components}/grid/cell/dateCellEditor.js +0 -0
  172. /package/{components → lib/esm/components}/grid/cell/dateCellEditor.js.map +0 -0
  173. /package/{components → lib/esm/components}/grid/cell/durationCellEditor.d.ts +0 -0
  174. /package/{components → lib/esm/components}/grid/cell/durationCellEditor.js +0 -0
  175. /package/{components → lib/esm/components}/grid/cell/durationCellEditor.js.map +0 -0
  176. /package/{components → lib/esm/components}/grid/cell/hexaOctetStringCellEditor.d.ts +0 -0
  177. /package/{components → lib/esm/components}/grid/cell/hexaOctetStringCellEditor.js +0 -0
  178. /package/{components → lib/esm/components}/grid/cell/hexaOctetStringCellEditor.js.map +0 -0
  179. /package/{components → lib/esm/components}/grid/cell/hexaValueCellEditor.d.ts +0 -0
  180. /package/{components → lib/esm/components}/grid/cell/hexaValueCellEditor.js +0 -0
  181. /package/{components → lib/esm/components}/grid/cell/hexaValueCellEditor.js.map +0 -0
  182. /package/{components → lib/esm/components}/grid/cell/numberCellEditor.d.ts +0 -0
  183. /package/{components → lib/esm/components}/grid/cell/numberCellEditor.js +0 -0
  184. /package/{components → lib/esm/components}/grid/cell/numberCellEditor.js.map +0 -0
  185. /package/{components → lib/esm/components}/grid/cell/rangeSelector.js.map +0 -0
  186. /package/{components → lib/esm/components}/grid/cell/simpleStatusTextCellEditor.d.ts +0 -0
  187. /package/{components → lib/esm/components}/grid/cell/simpleStatusTextCellEditor.js +0 -0
  188. /package/{components → lib/esm/components}/grid/cell/simpleStatusTextCellEditor.js.map +0 -0
  189. /package/{components → lib/esm/components}/grid/cell/statusTextCellEditor.d.ts +0 -0
  190. /package/{components → lib/esm/components}/grid/cell/statusTextCellEditor.js +0 -0
  191. /package/{components → lib/esm/components}/grid/cell/statusTextCellEditor.js.map +0 -0
  192. /package/{components → lib/esm/components}/grid/cell/tableDefaultRowStyleRules.d.ts +0 -0
  193. /package/{components → lib/esm/components}/grid/cell/tableDefaultRowStyleRules.js +0 -0
  194. /package/{components → lib/esm/components}/grid/cell/tableDefaultRowStyleRules.js.map +0 -0
  195. /package/{components → lib/esm/components}/grid/cell/textCellEditor.d.ts +0 -0
  196. /package/{components → lib/esm/components}/grid/cell/textCellEditor.js +0 -0
  197. /package/{components → lib/esm/components}/grid/cell/textCellEditor.js.map +0 -0
  198. /package/{components → lib/esm/components}/grid/cell/withAgGridHooks.d.ts +0 -0
  199. /package/{components → lib/esm/components}/grid/cell/withAgGridHooks.js +0 -0
  200. /package/{components → lib/esm/components}/grid/cell/withAgGridHooks.js.map +0 -0
  201. /package/{components → lib/esm/components}/grid/columnUtils.d.ts +0 -0
  202. /package/{components → lib/esm/components}/grid/columnUtils.js +0 -0
  203. /package/{components → lib/esm/components}/grid/columnUtils.js.map +0 -0
  204. /package/{components → lib/esm/components}/grid/config/columnTransfer.d.ts +0 -0
  205. /package/{components → lib/esm/components}/grid/config/columnTransfer.js +0 -0
  206. /package/{components → lib/esm/components}/grid/config/columnTransfer.js.map +0 -0
  207. /package/{components → lib/esm/components}/grid/config/dataGridEditor.d.ts +0 -0
  208. /package/{components → lib/esm/components}/grid/config/dataGridEditor.js +0 -0
  209. /package/{components → lib/esm/components}/grid/config/dataGridEditor.js.map +0 -0
  210. /package/{components → lib/esm/components}/grid/config/rowHeightCalculator.d.ts +0 -0
  211. /package/{components → lib/esm/components}/grid/config/rowHeightCalculator.js +0 -0
  212. /package/{components → lib/esm/components}/grid/config/rowHeightCalculator.js.map +0 -0
  213. /package/{components → lib/esm/components}/grid/config/rowStylePicker.d.ts +0 -0
  214. /package/{components → lib/esm/components}/grid/config/rowStylePicker.js +0 -0
  215. /package/{components → lib/esm/components}/grid/config/rowStylePicker.js.map +0 -0
  216. /package/{components → lib/esm/components}/grid/dataGrid.d.ts +0 -0
  217. /package/{components → lib/esm/components}/grid/dataGrid.js +0 -0
  218. /package/{components → lib/esm/components}/grid/dataGrid.js.map +0 -0
  219. /package/{components → lib/esm/components}/grid/detail/detailHeaderPanel.d.ts +0 -0
  220. /package/{components → lib/esm/components}/grid/detail/detailHeaderPanel.js +0 -0
  221. /package/{components → lib/esm/components}/grid/detail/detailHeaderPanel.js.map +0 -0
  222. /package/{components → lib/esm/components}/grid/export/contextMenu.d.ts +0 -0
  223. /package/{components → lib/esm/components}/grid/export/contextMenu.js.map +0 -0
  224. /package/{components → lib/esm/components}/grid/export/progressPopup.d.ts +0 -0
  225. /package/{components → lib/esm/components}/grid/export/progressPopup.js +0 -0
  226. /package/{components → lib/esm/components}/grid/export/progressPopup.js.map +0 -0
  227. /package/{components → lib/esm/components}/grid/export/worker/clipboardExport.d.ts +0 -0
  228. /package/{components → lib/esm/components}/grid/export/worker/clipboardExport.js +0 -0
  229. /package/{components → lib/esm/components}/grid/export/worker/clipboardExport.js.map +0 -0
  230. /package/{components → lib/esm/components}/grid/export/worker/csvExport.d.ts +0 -0
  231. /package/{components → lib/esm/components}/grid/export/worker/csvExport.js +0 -0
  232. /package/{components → lib/esm/components}/grid/export/worker/csvExport.js.map +0 -0
  233. /package/{components → lib/esm/components}/grid/export/worker/pdfExport.d.ts +0 -0
  234. /package/{components → lib/esm/components}/grid/export/worker/pdfExport.js +0 -0
  235. /package/{components → lib/esm/components}/grid/export/worker/pdfExport.js.map +0 -0
  236. /package/{components → lib/esm/components}/grid/export/worker/txtExport.d.ts +0 -0
  237. /package/{components → lib/esm/components}/grid/export/worker/txtExport.js +0 -0
  238. /package/{components → lib/esm/components}/grid/export/worker/txtExport.js.map +0 -0
  239. /package/{components → lib/esm/components}/grid/extendedDataGrid.d.ts +0 -0
  240. /package/{components → lib/esm/components}/grid/extendedDataGrid.js +0 -0
  241. /package/{components → lib/esm/components}/grid/extendedDataGrid.js.map +0 -0
  242. /package/{components → lib/esm/components}/grid/filter/customColumnFilter.d.ts +0 -0
  243. /package/{components → lib/esm/components}/grid/filter/customColumnFilter.js +0 -0
  244. /package/{components → lib/esm/components}/grid/filter/customColumnFilter.js.map +0 -0
  245. /package/{components → lib/esm/components}/grid/filter/dataGridColumnFilter.d.ts +0 -0
  246. /package/{components → lib/esm/components}/grid/filter/dataGridColumnFilter.js +0 -0
  247. /package/{components → lib/esm/components}/grid/filter/dataGridColumnFilter.js.map +0 -0
  248. /package/{components → lib/esm/components}/grid/filter/dateColumnFilter.d.ts +0 -0
  249. /package/{components → lib/esm/components}/grid/filter/dateColumnFilter.js +0 -0
  250. /package/{components → lib/esm/components}/grid/filter/dateColumnFilter.js.map +0 -0
  251. /package/{components → lib/esm/components}/grid/filter/textColumnFilter.d.ts +0 -0
  252. /package/{components → lib/esm/components}/grid/filter/textColumnFilter.js +0 -0
  253. /package/{components → lib/esm/components}/grid/filter/textColumnFilter.js.map +0 -0
  254. /package/{components → lib/esm/components}/grid/filter/wildcardQuickFilterEngine.d.ts +0 -0
  255. /package/{components → lib/esm/components}/grid/filter/wildcardQuickFilterEngine.js +0 -0
  256. /package/{components → lib/esm/components}/grid/filter/wildcardQuickFilterEngine.js.map +0 -0
  257. /package/{components → lib/esm/components}/grid/header/simpleHeader.d.ts +0 -0
  258. /package/{components → lib/esm/components}/grid/header/simpleHeader.js +0 -0
  259. /package/{components → lib/esm/components}/grid/header/simpleHeader.js.map +0 -0
  260. /package/{components → lib/esm/components}/grid/panel/dataGridPagination.d.ts +0 -0
  261. /package/{components → lib/esm/components}/grid/panel/dataGridPagination.js +0 -0
  262. /package/{components → lib/esm/components}/grid/panel/dataGridPagination.js.map +0 -0
  263. /package/{components → lib/esm/components}/grid/panel/loadingOverlay.d.ts +0 -0
  264. /package/{components → lib/esm/components}/grid/panel/loadingOverlay.js +0 -0
  265. /package/{components → lib/esm/components}/grid/panel/loadingOverlay.js.map +0 -0
  266. /package/{components → lib/esm/components}/grid/panel/noRecordsOverlay.d.ts +0 -0
  267. /package/{components → lib/esm/components}/grid/panel/noRecordsOverlay.js +0 -0
  268. /package/{components → lib/esm/components}/grid/panel/noRecordsOverlay.js.map +0 -0
  269. /package/{components → lib/esm/components}/grid/panel/tablePagination.d.ts +0 -0
  270. /package/{components → lib/esm/components}/grid/panel/tablePagination.js +0 -0
  271. /package/{components → lib/esm/components}/grid/panel/tablePagination.js.map +0 -0
  272. /package/{components → lib/esm/components}/icons/dropdownArrow.d.ts +0 -0
  273. /package/{components → lib/esm/components}/icons/dropdownArrow.js +0 -0
  274. /package/{components → lib/esm/components}/icons/dropdownArrow.js.map +0 -0
  275. /package/{components → lib/esm/components}/icons/undoIcon.d.ts +0 -0
  276. /package/{components → lib/esm/components}/icons/undoIcon.js +0 -0
  277. /package/{components → lib/esm/components}/icons/undoIcon.js.map +0 -0
  278. /package/{components → lib/esm/components}/input/autoCompleteInput.d.ts +0 -0
  279. /package/{components → lib/esm/components}/input/autoCompleteInput.js +0 -0
  280. /package/{components → lib/esm/components}/input/autoCompleteInput.js.map +0 -0
  281. /package/{components → lib/esm/components}/input/draftUtils.d.ts +0 -0
  282. /package/{components → lib/esm/components}/input/draftUtils.js +0 -0
  283. /package/{components → lib/esm/components}/input/draftUtils.js.map +0 -0
  284. /package/{components → lib/esm/components}/input/draftail.js.map +0 -0
  285. /package/{components → lib/esm/components}/input/hexaFormattedInput.d.ts +0 -0
  286. /package/{components → lib/esm/components}/input/hexaFormattedInput.js +0 -0
  287. /package/{components → lib/esm/components}/input/hexaFormattedInput.js.map +0 -0
  288. /package/{components → lib/esm/components}/input/mask/helpers.d.ts +0 -0
  289. /package/{components → lib/esm/components}/input/mask/helpers.js +0 -0
  290. /package/{components → lib/esm/components}/input/mask/helpers.js.map +0 -0
  291. /package/{components → lib/esm/components}/input/mask/inputMaskCore.d.ts +0 -0
  292. /package/{components → lib/esm/components}/input/mask/inputMaskCore.js +0 -0
  293. /package/{components → lib/esm/components}/input/mask/inputMaskCore.js.map +0 -0
  294. /package/{components → lib/esm/components}/input/mask/pattern.d.ts +0 -0
  295. /package/{components → lib/esm/components}/input/mask/pattern.js +0 -0
  296. /package/{components → lib/esm/components}/input/mask/pattern.js.map +0 -0
  297. /package/{components → lib/esm/components}/input/maskedInput.d.ts +0 -0
  298. /package/{components → lib/esm/components}/input/maskedInput.js +0 -0
  299. /package/{components → lib/esm/components}/input/maskedInput.js.map +0 -0
  300. /package/{components → lib/esm/components}/input/passwordInput.d.ts +0 -0
  301. /package/{components → lib/esm/components}/input/passwordInput.js +0 -0
  302. /package/{components → lib/esm/components}/input/passwordInput.js.map +0 -0
  303. /package/{components → lib/esm/components}/input/simpleAutoComplete.d.ts +0 -0
  304. /package/{components → lib/esm/components}/input/simpleAutoComplete.js +0 -0
  305. /package/{components → lib/esm/components}/input/simpleAutoComplete.js.map +0 -0
  306. /package/{components → lib/esm/components}/input/textarea/extractSpansOfClasses.d.ts +0 -0
  307. /package/{components → lib/esm/components}/input/textarea/extractSpansOfClasses.js +0 -0
  308. /package/{components → lib/esm/components}/input/textarea/extractSpansOfClasses.js.map +0 -0
  309. /package/{components → lib/esm/components}/input/textarea/getRanges.d.ts +0 -0
  310. /package/{components → lib/esm/components}/input/textarea/getRanges.js +0 -0
  311. /package/{components → lib/esm/components}/input/textarea/getRanges.js.map +0 -0
  312. /package/{components → lib/esm/components}/input/textarea/getType.d.ts +0 -0
  313. /package/{components → lib/esm/components}/input/textarea/getType.js +0 -0
  314. /package/{components → lib/esm/components}/input/textarea/getType.js.map +0 -0
  315. /package/{components → lib/esm/components}/input/textarea/highlighedContents.d.ts +0 -0
  316. /package/{components → lib/esm/components}/input/textarea/highlighedContents.js +0 -0
  317. /package/{components → lib/esm/components}/input/textarea/highlighedContents.js.map +0 -0
  318. /package/{components → lib/esm/components}/input/textarea/mentionsWithHighlighting.d.ts +0 -0
  319. /package/{components → lib/esm/components}/input/textarea/mentionsWithHighlighting.js +0 -0
  320. /package/{components → lib/esm/components}/input/textarea/mentionsWithHighlighting.js.map +0 -0
  321. /package/{components → lib/esm/components}/keyboard/keyboardUtils.d.ts +0 -0
  322. /package/{components → lib/esm/components}/keyboard/keyboardUtils.js +0 -0
  323. /package/{components → lib/esm/components}/keyboard/keyboardUtils.js.map +0 -0
  324. /package/{components → lib/esm/components}/modal/draggableModalProvider.d.ts +0 -0
  325. /package/{components → lib/esm/components}/modal/draggableModalProvider.js +0 -0
  326. /package/{components → lib/esm/components}/modal/draggableModalProvider.js.map +0 -0
  327. /package/{components → lib/esm/components}/modal/impl/clamp.d.ts +0 -0
  328. /package/{components → lib/esm/components}/modal/impl/clamp.js +0 -0
  329. /package/{components → lib/esm/components}/modal/impl/clamp.js.map +0 -0
  330. /package/{components → lib/esm/components}/modal/impl/draggableModal.d.ts +0 -0
  331. /package/{components → lib/esm/components}/modal/impl/draggableModal.js +0 -0
  332. /package/{components → lib/esm/components}/modal/impl/draggableModal.js.map +0 -0
  333. /package/{components → lib/esm/components}/modal/impl/draggableModalContext.d.ts +0 -0
  334. /package/{components → lib/esm/components}/modal/impl/draggableModalContext.js +0 -0
  335. /package/{components → lib/esm/components}/modal/impl/draggableModalContext.js.map +0 -0
  336. /package/{components → lib/esm/components}/modal/impl/draggableModalInner.d.ts +0 -0
  337. /package/{components → lib/esm/components}/modal/impl/draggableModalInner.js +0 -0
  338. /package/{components → lib/esm/components}/modal/impl/draggableModalInner.js.map +0 -0
  339. /package/{components → lib/esm/components}/modal/impl/draggableModalReducer.d.ts +0 -0
  340. /package/{components → lib/esm/components}/modal/impl/draggableModalReducer.js +0 -0
  341. /package/{components → lib/esm/components}/modal/impl/draggableModalReducer.js.map +0 -0
  342. /package/{components → lib/esm/components}/modal/impl/getWindowSize.d.ts +0 -0
  343. /package/{components → lib/esm/components}/modal/impl/getWindowSize.js +0 -0
  344. /package/{components → lib/esm/components}/modal/impl/getWindowSize.js.map +0 -0
  345. /package/{components → lib/esm/components}/modal/impl/index.d.ts +0 -0
  346. /package/{components → lib/esm/components}/modal/impl/index.js +0 -0
  347. /package/{components → lib/esm/components}/modal/impl/index.js.map +0 -0
  348. /package/{components → lib/esm/components}/modal/impl/resizeHandle.d.ts +0 -0
  349. /package/{components → lib/esm/components}/modal/impl/resizeHandle.js +0 -0
  350. /package/{components → lib/esm/components}/modal/impl/resizeHandle.js.map +0 -0
  351. /package/{components → lib/esm/components}/modal/impl/useDrag.d.ts +0 -0
  352. /package/{components → lib/esm/components}/modal/impl/useDrag.js +0 -0
  353. /package/{components → lib/esm/components}/modal/impl/useDrag.js.map +0 -0
  354. /package/{components → lib/esm/components}/modal/impl/usePrevious.d.ts +0 -0
  355. /package/{components → lib/esm/components}/modal/impl/usePrevious.js +0 -0
  356. /package/{components → lib/esm/components}/modal/impl/usePrevious.js.map +0 -0
  357. /package/{components → lib/esm/components}/modal/impl/useResize.d.ts +0 -0
  358. /package/{components → lib/esm/components}/modal/impl/useResize.js +0 -0
  359. /package/{components → lib/esm/components}/modal/impl/useResize.js.map +0 -0
  360. /package/{components → lib/esm/components}/modal/modalDialog.d.ts +0 -0
  361. /package/{components → lib/esm/components}/modal/modalDialog.js +0 -0
  362. /package/{components → lib/esm/components}/modal/modalDialog.js.map +0 -0
  363. /package/{components → lib/esm/components}/picker/enumValuePicker.d.ts +0 -0
  364. /package/{components → lib/esm/components}/picker/enumValuePicker.js +0 -0
  365. /package/{components → lib/esm/components}/picker/enumValuePicker.js.map +0 -0
  366. /package/{components → lib/esm/components}/platformSpecific.d.ts +0 -0
  367. /package/{components → lib/esm/components}/platformSpecific.js +0 -0
  368. /package/{components → lib/esm/components}/platformSpecific.js.map +0 -0
  369. /package/{components → lib/esm/components}/scrollTo/onlyText.d.ts +0 -0
  370. /package/{components → lib/esm/components}/scrollTo/onlyText.js +0 -0
  371. /package/{components → lib/esm/components}/scrollTo/onlyText.js.map +0 -0
  372. /package/{components → lib/esm/components}/scrollTo/scrollTo.d.ts +0 -0
  373. /package/{components → lib/esm/components}/scrollTo/scrollTo.js +0 -0
  374. /package/{components → lib/esm/components}/scrollTo/scrollTo.js.map +0 -0
  375. /package/{components → lib/esm/components}/style/withCss.d.ts +0 -0
  376. /package/{components → lib/esm/components}/style/withCss.js +0 -0
  377. /package/{components → lib/esm/components}/style/withCss.js.map +0 -0
  378. /package/{components → lib/esm/components}/style/withInputNumberCss.d.ts +0 -0
  379. /package/{components → lib/esm/components}/style/withInputNumberCss.js +0 -0
  380. /package/{components → lib/esm/components}/style/withInputNumberCss.js.map +0 -0
  381. /package/{components → lib/esm/components}/table/dragSortingTable.d.ts +0 -0
  382. /package/{components → lib/esm/components}/table/dragSortingTable.js +0 -0
  383. /package/{components → lib/esm/components}/table/dragSortingTable.js.map +0 -0
  384. /package/{components → lib/esm/components}/text/impl/innerSize.d.ts +0 -0
  385. /package/{components → lib/esm/components}/text/impl/innerSize.js +0 -0
  386. /package/{components → lib/esm/components}/text/impl/innerSize.js.map +0 -0
  387. /package/{components → lib/esm/components}/text/impl/series.d.ts +0 -0
  388. /package/{components → lib/esm/components}/text/impl/series.js +0 -0
  389. /package/{components → lib/esm/components}/text/impl/series.js.map +0 -0
  390. /package/{components → lib/esm/components}/text/impl/shallowEqual.d.ts +0 -0
  391. /package/{components → lib/esm/components}/text/impl/shallowEqual.js +0 -0
  392. /package/{components → lib/esm/components}/text/impl/shallowEqual.js.map +0 -0
  393. /package/{components → lib/esm/components}/text/impl/uniqueId.d.ts +0 -0
  394. /package/{components → lib/esm/components}/text/impl/uniqueId.js +0 -0
  395. /package/{components → lib/esm/components}/text/impl/uniqueId.js.map +0 -0
  396. /package/{components → lib/esm/components}/text/impl/whilst.d.ts +0 -0
  397. /package/{components → lib/esm/components}/text/impl/whilst.js +0 -0
  398. /package/{components → lib/esm/components}/text/impl/whilst.js.map +0 -0
  399. /package/{components → lib/esm/components}/text/textFit.d.ts +0 -0
  400. /package/{components → lib/esm/components}/text/textFit.js +0 -0
  401. /package/{components → lib/esm/components}/text/textFit.js.map +0 -0
  402. /package/{i18n → lib/esm/i18n}/componentsLocaleHolder.d.ts +0 -0
  403. /package/{i18n → lib/esm/i18n}/componentsLocaleHolder.js.map +0 -0
@@ -0,0 +1,633 @@
1
+ import React, {HTMLAttributes, RefObject} from "react";
2
+ import MaskedInput from "../input/maskedInput";
3
+ import padStart from 'lodash/padStart';
4
+ import isEqual from 'lodash/isEqual';
5
+ import debounce from 'lodash/debounce';
6
+ import dayjs, {Dayjs, ManipulateType} from "dayjs";
7
+ import {CalendarOutlined} from "@ant-design/icons";
8
+ import {Button, Calendar, Select, Tooltip} from "antd";
9
+ import {Key} from "ts-key-enum";
10
+ import {D2000UnixTimeNullValue} from "d2core/types/unixTimeUtils";
11
+ import {TooltipPlacement} from "antd/lib/tooltip";
12
+ import {createStyles} from "antd-style";
13
+ import WithCss from "d2coreui/components/style/withCss";
14
+ import {SizeType} from "antd/lib/config-provider/SizeContext";
15
+
16
+ // @ts-ignore
17
+ const useStyles = createStyles(({token, css, cx}) => {
18
+ return {
19
+ dateTimeInputCalendar: css`
20
+ // adaptations of date-picker calendar styles
21
+ .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner:not(.date-picker-item-marked) {
22
+ color: inherit;
23
+ background: inherit;
24
+ }
25
+
26
+ .ant-picker-panel:focus > .ant-picker-date-panel .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner:before {
27
+ position: absolute;
28
+ top: 0;
29
+ right: 0;
30
+ bottom: 0;
31
+ left: 0;
32
+ z-index: 1;
33
+ border: 1px solid #096dd9;
34
+ border-radius: 2px;
35
+ content: '';
36
+ }
37
+
38
+ .ant-picker-content thead {
39
+ user-select: none;
40
+ }
41
+
42
+ .date-picker-item-marked {
43
+ color: #fff;
44
+ background: #1890ff;
45
+ }
46
+
47
+ .ant-picker-cell-in-view.ant-picker-cell-today .ant-picker-cell-inner::before {
48
+ border: 1px solid #13c2c2;
49
+ }
50
+
51
+ .ant-picker-cell:hover:not(.ant-picker-cell-in-view) .ant-picker-cell-inner, .ant-picker-cell:hover:not(.ant-picker-cell-selected):not(.ant-picker-cell-range-start):not(.ant-picker-cell-range-end):not(.ant-picker-cell-range-hover-start):not(.ant-picker-cell-range-hover-end) .ant-picker-cell-inner {
52
+ background: #1890ff;
53
+ color: rgba(0, 0, 0, 0.85);
54
+ }
55
+ `,
56
+ }
57
+ });
58
+
59
+
60
+ interface DateTimeInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
61
+ mask: string
62
+ value: Dayjs | null
63
+ onChange?: (time: Dayjs | null) => void
64
+ onInvalidValue?: (inputString: string) => void
65
+ // allows to set no (null) date by datepicker
66
+ allowClear?: boolean
67
+ disabled?: boolean
68
+ // disable only input component - useful when calendar popup is opened
69
+ inputDisabled?: boolean
70
+ minDateTime?: Dayjs
71
+ maxDateTime?: Dayjs
72
+
73
+ bordered?: boolean
74
+ hidePopup?: boolean
75
+ renderAsCalendar?: boolean
76
+ autoFocus?: boolean
77
+ placement?: TooltipPlacement;
78
+ size?: SizeType;
79
+
80
+ // special methods for rendering date range
81
+ defaultSelectedDate?: Dayjs
82
+ markedDateInterval?: [Dayjs, Dayjs]
83
+ onDateItemMouseDown?: (date: Dayjs) => void
84
+ onDateItemMouseUp?: (date: Dayjs) => void
85
+ onDateItemMouseOver?: (date: Dayjs) => void
86
+
87
+ inputStyle?: React.CSSProperties
88
+ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
89
+
90
+ ignoreKeyStrokes?: boolean
91
+ }
92
+
93
+ interface DateTimeInputState {
94
+ valid: boolean
95
+ currentPos: number | null
96
+ currentInfo: MaskResult
97
+ popupCalendarVisible: boolean
98
+
99
+ calendarSelectedDate: Dayjs
100
+ focused: boolean
101
+ }
102
+
103
+ interface MaskResult {
104
+ time: Dayjs | undefined
105
+ info: InfoEntry | undefined
106
+ length: number
107
+ }
108
+
109
+ interface InfoEntry {
110
+ key: string | string[]
111
+ min: number | number[]
112
+ max: number | number[]
113
+ unit: ManipulateType
114
+ }
115
+
116
+ const DATE_TIME_DATA_MAP: InfoEntry[] = [
117
+ {key: "SSS", min: 0, max: 999, unit: "ms"},
118
+ {key: "ss", min: 0, max: 59, unit: "s"},
119
+ {key: "mm", min: 0, max: 59, unit: "m"},
120
+ {key: "HH", min: 0, max: 23, unit: "h"},
121
+ {key: ["YYYY", "YY"], min: [1900, 0], max: [9999, 99], unit: "y"},
122
+ {key: "MM", min: 1, max: 12, unit: "M"},
123
+ {key: "DD", min: 1, max: 31, unit: "d"},
124
+ ];
125
+
126
+ const MIN_TIME = dayjs.unix(0);
127
+ const MAX_TIME = dayjs().add(1000, "year");
128
+
129
+ export function allowDatesBeforeEpoch() {
130
+ DATE_TIME_DATA_MAP[4].min = 1902;
131
+ }
132
+
133
+ export default class DateTimeInput extends React.Component<DateTimeInputProps, DateTimeInputState> {
134
+ private inputRef: RefObject<MaskedInput> = React.createRef();
135
+ private today: Dayjs = dayjs();
136
+
137
+ constructor(props: Readonly<DateTimeInputProps>) {
138
+ super(props);
139
+ this.state = {
140
+ valid: DateTimeInput.isValidValue(props.value, props.minDateTime, props.maxDateTime, props.allowClear),
141
+ currentPos: null,
142
+ currentInfo: {
143
+ info: undefined,
144
+ time: undefined,
145
+ length: 0
146
+ },
147
+ popupCalendarVisible: false,
148
+ calendarSelectedDate: props.defaultSelectedDate?.clone() ?? props.value?.clone() ?? dayjs().startOf('day'),
149
+ focused: false,
150
+ };
151
+
152
+ this.recalc = this.recalc.bind(this);
153
+ this.increment = this.increment.bind(this);
154
+ this.decrement = this.decrement.bind(this);
155
+ this.onItemMouseOver = debounce(this.onItemMouseOver.bind(this), 100, {maxWait: 100});
156
+ }
157
+
158
+ componentDidUpdate(prevProps: Readonly<DateTimeInputProps>, _prevState: Readonly<DateTimeInputState>, _snapshot?: any): void {
159
+ if (!isEqual(prevProps, this.props) && this.inputRef.current !== null) {
160
+ this.inputRef.current.input.selectionStart = this.state.currentPos;
161
+ this.inputRef.current.input.selectionEnd = this.state.currentPos;
162
+ if (prevProps.value !== this.props.value) {
163
+ this.setState({valid: DateTimeInput.isValidValue(this.props.value, this.props.minDateTime, this.props.maxDateTime, this.props.allowClear)});
164
+ }
165
+ }
166
+ }
167
+
168
+ get input() {
169
+ return this.inputRef.current?.input;
170
+ }
171
+
172
+ focus() {
173
+ this.inputRef.current?.focus();
174
+ }
175
+
176
+ recalc(): void {
177
+ if (this.inputRef.current !== null) {
178
+ this.setState({
179
+ currentInfo: DateTimeInput.parseDateTimeFormat(this.props.value, this.inputRef.current.input.value, this.props.mask, this.inputRef.current.input.selectionStart),
180
+ currentPos: this.inputRef.current.input.selectionStart,
181
+ });
182
+ }
183
+ }
184
+
185
+ private increment(): void {
186
+ if (this.state.currentInfo.info !== undefined && !!this.props.value && DateTimeInput.isValid(this.state.currentInfo, this.props.value, 1)) {
187
+ const unit = this.state.currentInfo.info.unit;
188
+ this.incrementDate(unit);
189
+ }
190
+
191
+ this.inputRef.current?.focus();
192
+ }
193
+
194
+ private incrementDate(unit: ManipulateType) {
195
+ if (!!this.props.value) {
196
+ const value = this.props.value.clone().add(1, unit);
197
+ if (!!this.props.maxDateTime && value.isAfter(this.props.maxDateTime)) {
198
+ this.props.onChange?.(this.props.maxDateTime?.clone());
199
+ } else {
200
+ this.props.onChange?.(value);
201
+ }
202
+ }
203
+ }
204
+
205
+ private decrement(): void {
206
+ if (this.state.currentInfo.info !== undefined && !!this.props.value && DateTimeInput.isValid(this.state.currentInfo, this.props.value, -1)) {
207
+ const unit = this.state.currentInfo.info.unit;
208
+ this.decrementDate(unit);
209
+ }
210
+
211
+ this.inputRef.current?.focus();
212
+ }
213
+
214
+ private decrementDate(unit: ManipulateType) {
215
+ if (!!this.props.value) {
216
+ const value = this.props.value.clone().subtract(1, unit);
217
+ if (!!this.props.minDateTime && value.isBefore(this.props.minDateTime)) {
218
+ this.props.onChange?.(this.props.minDateTime?.clone());
219
+ } else {
220
+ this.props.onChange?.(value);
221
+ }
222
+ }
223
+ }
224
+
225
+ onItemMouseOver(itemDate: Dayjs) {
226
+ this.props.onDateItemMouseOver?.(itemDate);
227
+ }
228
+
229
+ private renderCalendarNavigation(value: Dayjs) {
230
+ const start = 0;
231
+ const end = 12;
232
+ const monthOptions = [];
233
+
234
+ const current = value.clone();
235
+ const localeData = value.localeData();
236
+ const months = [];
237
+ for (let i = 0; i < 12; i++) {
238
+ months.push(localeData.months(current.month(i)));
239
+ }
240
+
241
+ for (let index = start; index < end; index++) {
242
+ monthOptions.push(
243
+ <Select.Option key={`${index}`} value={`${index}`}>
244
+ {months[index]}
245
+ </Select.Option>,
246
+ );
247
+ }
248
+ const month = value.month();
249
+
250
+ const year = value.year();
251
+ const options = [];
252
+ for (let i = year - 4; i <= year + 2; i += 1) {
253
+ options.push(
254
+ <Select.Option key={`${i}`} value={`${i}`}>
255
+ {i}
256
+ </Select.Option>,
257
+ );
258
+ }
259
+
260
+ const calendarSelectedDate = this.state.calendarSelectedDate;
261
+
262
+ return (
263
+ <div style={{display: "flex", marginBottom: 6}}>
264
+ <div style={{display: "flex", width: 140}}>
265
+ <Button style={{width: 10, padding: 0}} size="small" type="text" tabIndex={-1}
266
+ disabled={!DateTimeInput.checkDateValueValidity(calendarSelectedDate, -1, "month")}
267
+ onClick={() => {
268
+ this.setState({calendarSelectedDate: calendarSelectedDate.subtract(1, "month")});
269
+ }}
270
+ className="ant-picker-header-prev-btn"><span
271
+ className="ant-picker-prev-icon"/></Button>
272
+ <Select
273
+ style={{flex: "1 1 auto"}}
274
+ size="small"
275
+ popupMatchSelectWidth={false}
276
+ dropdownStyle={{zIndex: 2070}}
277
+ getPopupContainer={this.props.getPopupContainer}
278
+ value={String(month)}
279
+ onChange={selectedMonth => {
280
+ this.setState({calendarSelectedDate: calendarSelectedDate.month(parseInt(selectedMonth, 10))});
281
+ }}
282
+ >
283
+ {monthOptions}
284
+ </Select>
285
+ <Button style={{width: 10, padding: 0}} size="small" type="text" tabIndex={-1}
286
+ className="ant-picker-header-next-btn"
287
+ onClick={() => {
288
+ this.setState({calendarSelectedDate: calendarSelectedDate.add(1, "month")});
289
+ }}>
290
+ <span className="ant-picker-next-icon"/>
291
+ </Button>
292
+ </div>
293
+ <div style={{display: "flex", width: 110}}>
294
+ <Button style={{width: 12, padding: 0}} size="small" type="text" tabIndex={-1}
295
+ className="ant-picker-header-prev-btn"
296
+ onClick={() => {
297
+ this.setState({calendarSelectedDate: calendarSelectedDate.subtract(1, "year")});
298
+ }}>
299
+ <span className="ant-picker-prev-icon"/>
300
+ </Button>
301
+ <Select
302
+ size="small"
303
+ style={{width: 84}}
304
+ popupMatchSelectWidth={false}
305
+ dropdownStyle={{zIndex: 2070}}
306
+ getPopupContainer={this.props.getPopupContainer}
307
+ onChange={newYear => {
308
+ this.setState({calendarSelectedDate: calendarSelectedDate.year(parseInt(newYear, 10))});
309
+ }}
310
+ value={String(year)}
311
+ >
312
+ {options}
313
+ </Select>
314
+ <Button style={{width: 12, padding: 0}} size="small" type="text" tabIndex={-1}
315
+ className="ant-picker-header-next-btn"
316
+ onClick={() => {
317
+ this.setState({calendarSelectedDate: calendarSelectedDate.add(1, "year")});
318
+ }}>
319
+ <span className="ant-picker-next-icon"/>
320
+ </Button>
321
+ </div>
322
+ </div>
323
+ );
324
+ }
325
+
326
+ renderCalendar(): React.ReactElement {
327
+ return (<div
328
+ onKeyDown={!this.props.ignoreKeyStrokes ? (e) => {
329
+ if (e.key === Key.Enter) {
330
+ var tagName = (e.target as any)?.tagName?.toLowerCase();
331
+ if (tagName !== "input") {
332
+ this.props.onChange?.(this.state.calendarSelectedDate);
333
+ }
334
+ }
335
+ } : undefined}
336
+ onMouseOver={(e) => {
337
+ if (e.target instanceof HTMLTableCellElement) {
338
+ const date = dayjs(e.target.title, "YYYY-MM-DD");
339
+ this.onItemMouseOver(date);
340
+ }
341
+ }}>
342
+ <WithCss useStyles={useStyles}>{(css) =>
343
+ <Calendar
344
+ className={css.styles.dateTimeInputCalendar}
345
+ fullscreen={false}
346
+ style={this.props.renderAsCalendar ? this.props.style : undefined}
347
+ fullCellRender={((date: Dayjs) => {
348
+ let className = date.isSame(this.today, "date") ? 'ant-picker-cell-inner ant-picker-calendar-date ant-picker-calendar-date-today' : 'ant-picker-cell-inner ant-picker-calendar-date';
349
+ const markedDateInterval = this.props.markedDateInterval;
350
+ if (markedDateInterval && (markedDateInterval[0].isBefore(date) || markedDateInterval[0].isSame(date, "millisecond")) &&
351
+ (markedDateInterval[1].isAfter(date) || markedDateInterval[1].isSame(date, "millisecond"))) {
352
+ className += " date-picker-item-marked";
353
+ } else if (date.isSame(this.props.value, "date")) {
354
+ className += " date-picker-item-marked";
355
+ }
356
+ return (
357
+ <div className={className} style={{userSelect: "none"}}
358
+ onKeyDown={(e) => {
359
+ if (e.key === Key.Enter) {
360
+ let newValue = this.props.value?.clone() ?? dayjs().startOf("day");
361
+ newValue = newValue.year(date.year()).month(date.month()).date(date.date());
362
+ this.props.onChange?.(newValue);
363
+ }
364
+ }}
365
+ onMouseDown={() => {
366
+ let newValue = this.props.value?.clone() ?? dayjs().startOf("day");
367
+ newValue = newValue.year(date.year()).month(date.month()).date(date.date());
368
+ this.props.onDateItemMouseDown?.(newValue);
369
+ }}
370
+ onMouseUp={() => {
371
+ let newValue = this.props.value?.clone() ?? dayjs().startOf("day");
372
+ newValue = newValue.year(date.year()).month(date.month()).date(date.date());
373
+ this.props.onDateItemMouseUp?.(newValue);
374
+ }}
375
+ >
376
+ <div className={`ant-picker-calendar-date-value`}>
377
+ {padStart("" + date.date(), 2, '0')}
378
+ </div>
379
+ <div className={`ant-picker-calendar-date-content`}>
380
+ </div>
381
+ </div>
382
+ );
383
+ })}
384
+ headerRender={({value}) => {
385
+ return this.renderCalendarNavigation(value);
386
+ }}
387
+ value={this.state.calendarSelectedDate}
388
+ validRange={[this.props.minDateTime ?? MIN_TIME, this.props.maxDateTime ?? MAX_TIME]}
389
+ onSelect={(value) => {
390
+ if (window.event instanceof MouseEvent) {
391
+ let newValue = this.props.value?.clone() ?? dayjs().startOf("day");
392
+ newValue = newValue.year(value.year()).month(value.month()).date(value.date());
393
+ this.props.onChange?.(newValue);
394
+ }
395
+ this.setState({calendarSelectedDate: value, popupCalendarVisible: false});
396
+ }}
397
+ />
398
+ }</WithCss>
399
+ </div>
400
+ );
401
+ }
402
+
403
+ renderInput() {
404
+ const {
405
+ mask,
406
+ value,
407
+ onChange,
408
+ onInvalidValue,
409
+ style,
410
+ disabled,
411
+ inputDisabled,
412
+ bordered,
413
+ hidePopup,
414
+ renderAsCalendar,
415
+ allowClear,
416
+ minDateTime,
417
+ maxDateTime,
418
+ onDateItemMouseDown,
419
+ onDateItemMouseOver,
420
+ onDateItemMouseUp,
421
+ markedDateInterval,
422
+ inputStyle,
423
+ getPopupContainer,
424
+ autoFocus,
425
+ className,
426
+ size,
427
+ ...props
428
+ } = this.props;
429
+
430
+ const isUpDisabled = disabled || this.state.currentInfo.info === undefined || !DateTimeInput.isValid(this.state.currentInfo, this.props.value, 1);
431
+ const isDownDisabled = disabled || this.state.currentInfo.info === undefined || !DateTimeInput.isValid(this.state.currentInfo, this.props.value, -1);
432
+ const unix: number | undefined = value?.valueOf();
433
+ const maskedInputStyle = {color: this.state.valid ? undefined : "#ff4d4f"};
434
+ if (inputStyle) {
435
+ Object.assign(maskedInputStyle, inputStyle);
436
+ }
437
+
438
+ return (
439
+ <div style={{...style, position: "relative"}} {...props} className={className}>
440
+ <div
441
+ onKeyDown={(event) => {
442
+ if (event.code === "ArrowUp") { // up
443
+ this.increment();
444
+ event.preventDefault();
445
+ event.stopPropagation();
446
+ } else if (event.code === "ArrowDown") { // down
447
+ this.decrement();
448
+ event.preventDefault();
449
+ event.stopPropagation();
450
+ }
451
+ }}>
452
+ <MaskedInput mask={this.props.mask.replace(/[a-zA-Z]/g, '1')}
453
+ bordered={bordered}
454
+ ref={this.inputRef}
455
+ style={maskedInputStyle}
456
+ size={size}
457
+ value={(this.state.focused || unix !== D2000UnixTimeNullValue * 1000) ? (value?.locale("locale.d2000").format(this.props.mask) ?? "") : ""}
458
+ placeholder={(!this.state.focused && unix === D2000UnixTimeNullValue * 1000) ? "Null Time" : undefined}
459
+ onFocus={(event => {
460
+ event.target.selectionStart = event.target.selectionEnd = this.state.currentPos;
461
+ this.setState({focused: true});
462
+ })}
463
+ onBlur={() => {
464
+ this.setState({focused: false});
465
+ }}
466
+ autoFocus={autoFocus}
467
+ disabled={disabled || inputDisabled}
468
+ onWheel={(event) => {
469
+ if (event.deltaY > 0) {
470
+ if (!isDownDisabled) {
471
+ this.decrement();
472
+ }
473
+ }
474
+ if (event.deltaY < 0) {
475
+ if (!isUpDisabled) {
476
+ this.increment();
477
+ }
478
+ }
479
+ }}
480
+ onMouseUp={this.recalc}
481
+ onKeyUp={this.recalc}
482
+ onChange={(event) => {
483
+ const inputString = event.target.value;
484
+ const value: MaskResult = DateTimeInput.parseDateTimeFormat(this.props.value, inputString, this.props.mask, event.target.selectionStart);
485
+ const valid: boolean = DateTimeInput.isValidValue(value.time, this.props.minDateTime, this.props.maxDateTime, this.props.allowClear) || (!!this.props.allowClear && !inputString);
486
+
487
+ if (value.time !== undefined && valid) {
488
+ onChange?.(value.time.clone());
489
+ } else if (!!this.props.allowClear && !inputString) {
490
+ onChange?.(null);
491
+ } else {
492
+ onInvalidValue?.(inputString);
493
+ }
494
+ this.setState({
495
+ valid: valid,
496
+ currentInfo: value
497
+ })
498
+ }}/>
499
+ </div>
500
+ {!hidePopup && !renderAsCalendar && <div
501
+ style={{
502
+ width: 28,
503
+ opacity: 1,
504
+ height: "100%",
505
+ textAlign: "center",
506
+ cursor: disabled ? "not-allowed" : "pointer",
507
+ background: "transparent",
508
+ position: "absolute",
509
+ top: 0,
510
+ right: 0,
511
+ }}
512
+ onClick={(event) => {
513
+ if (document.createEvent) {
514
+ var ev = document.createEvent('HTMLEvents');
515
+ ev.initEvent('contextmenu', true, false);
516
+ event.target.dispatchEvent(ev);
517
+ }
518
+ }}
519
+ >
520
+ <CalendarOutlined style={{color: "rgba(0,0,0,0.65)", verticalAlign: "middle", height: "100%"}}/>
521
+ </div>}
522
+ </div>
523
+ );
524
+ }
525
+
526
+ render(): any {
527
+ if (this.props.renderAsCalendar) {
528
+ return this.renderCalendar();
529
+ } else if (this.props.hidePopup) {
530
+ return this.renderInput();
531
+ } else {
532
+ return (
533
+ <Tooltip color={"white"} trigger={this.props.disabled ? [] : ["contextMenu"]}
534
+ getPopupContainer={this.props.getPopupContainer}
535
+ overlayInnerStyle={{maxHeight: "100vh", overflowY: "auto", overflowX: "hidden", width: 266}}
536
+ open={this.state.popupCalendarVisible}
537
+ onOpenChange={(visible) => {
538
+ this.setState({popupCalendarVisible: visible});
539
+ if (visible) {
540
+ this.setState({calendarSelectedDate: this.props.defaultSelectedDate?.clone() ?? this.props.value?.clone() ?? dayjs().startOf("day")})
541
+ }
542
+ }}
543
+ title={this.renderCalendar()}
544
+ placement={this.props.placement}
545
+ >
546
+ {this.renderInput()}
547
+ </Tooltip>
548
+ );
549
+ }
550
+ }
551
+
552
+ private static isValid(info: MaskResult, value: Dayjs | null, offset: number): boolean {
553
+ const unit = info.info?.unit;
554
+ return this.checkDateValueValidity(value, offset, unit);
555
+ }
556
+
557
+ private static checkDateValueValidity(value: Dayjs | null, offset: number, unit: ManipulateType | undefined) {
558
+ if (value === null) {
559
+ return false;
560
+ }
561
+ let v = value.clone().add(offset, unit);
562
+ return v.isValid() && v.isSameOrAfter(dayjs(0));
563
+ }
564
+
565
+ private static parseDateTimeFormat(previousTime: Dayjs | null, value: string, mask: string, cursorPos: number | null): MaskResult {
566
+ let result: MaskResult = {
567
+ time: dayjs().startOf("day"),
568
+ info: undefined,
569
+ length: 0,
570
+ };
571
+
572
+ for (let v of DATE_TIME_DATA_MAP) {
573
+ let index: number = -1;
574
+ let length: number = 0;
575
+ let min: number = 0;
576
+ let max: number = 0;
577
+
578
+ if (Array.isArray(v.key) || Array.isArray(v.min) || Array.isArray(v.max)) {
579
+ for (let i = 0; i < v.key.length; i++) {
580
+ const x = v.key[i];
581
+ index = mask.indexOf(x);
582
+
583
+ if (index !== -1) {
584
+ length = x.length;
585
+ min = (v.min as number[])[i];
586
+ max = (v.max as number[])[i];
587
+ break;
588
+ }
589
+ }
590
+ } else {
591
+ index = mask.indexOf(v.key);
592
+ length = v.key.length;
593
+ min = v.min;
594
+ max = v.max;
595
+ }
596
+
597
+ if (index !== -1) {
598
+ let val: number = Number(value.substring(index, index + length));
599
+
600
+ if (!isNaN(val) && val >= min && val <= max) {
601
+ if (v.unit === "M") {
602
+ val--; // 0-11
603
+ }
604
+
605
+ if (v.unit === "d") {
606
+ result.time = result.time?.set('D', val);
607
+ } else if (v.unit === "y" && length === 2) {
608
+ const century: number = (previousTime != null && previousTime.isValid()) ? Math.floor(previousTime.year() / 100) * 100 : (val > 70 ? 1900 : 2000); // if short year
609
+ result.time = result.time?.set(v.unit, century + val)
610
+ } else if (v.unit !== "weeks" && v.unit !== "week" && v.unit !== "w") {
611
+ result.time = result.time?.set(v.unit, val);
612
+ }
613
+ } else {
614
+ result.time = undefined;
615
+ result.info = undefined;
616
+ result.length = 0;
617
+ break;
618
+ }
619
+
620
+ if (cursorPos !== null && cursorPos >= index && cursorPos <= index + length) {
621
+ result.info = v;
622
+ result.length = length;
623
+ }
624
+ }
625
+ }
626
+
627
+ return result;
628
+ }
629
+
630
+ private static isValidValue(value?: Dayjs | null, minDateTime?: Dayjs, maxDateTime?: Dayjs, allowClear?: boolean): boolean {
631
+ return (!!value && value.isValid() && (!minDateTime || value.isSameOrAfter(minDateTime)) && (!maxDateTime || value.isSameOrBefore(maxDateTime))) || (!!allowClear && value === null);
632
+ }
633
+ }