d2coreui 23.0.13 → 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.
- package/components/clipboard/clipboardUtils.ts +53 -0
- package/components/codemirror/SyntaxHighlighter.tsx +58 -0
- package/components/collapse/expandable.tsx +48 -0
- package/components/color/colorPicker.tsx +121 -0
- package/components/color/colorSwatch.d.ts +18 -13
- package/components/color/colorSwatch.jsx +87 -0
- package/components/color/colorUtils.ts +60 -0
- package/components/date/dateRangeInput.tsx +468 -0
- package/components/date/dateRangeInputAdvancedPanel.tsx +238 -0
- package/components/date/dateRangeInputConfirm.tsx +200 -0
- package/components/date/dateTimeInput.tsx +633 -0
- package/components/date/durationInput.tsx +375 -0
- package/components/form/NiceFormItem.tsx +32 -0
- package/components/grid/cell/beanAccessor.ts +17 -0
- package/components/grid/cell/cellEditorUtils.ts +12 -0
- package/components/grid/cell/customEnumCellEditor.tsx +130 -0
- package/components/grid/cell/dataGridCellEditorComponent.tsx +61 -0
- package/components/grid/cell/dateCellEditor.tsx +83 -0
- package/components/grid/cell/durationCellEditor.tsx +105 -0
- package/components/grid/cell/hexaOctetStringCellEditor.tsx +101 -0
- package/components/grid/cell/hexaValueCellEditor.tsx +92 -0
- package/components/grid/cell/numberCellEditor.tsx +115 -0
- package/components/grid/cell/rangeSelector.d.ts +9 -78
- package/components/grid/cell/rangeSelector.js +674 -527
- package/components/grid/cell/simpleStatusTextCellEditor.tsx +168 -0
- package/components/grid/cell/statusTextCellEditor.tsx +198 -0
- package/components/grid/cell/tableDefaultRowStyleRules.ts +51 -0
- package/components/grid/cell/textCellEditor.tsx +94 -0
- package/components/grid/cell/withAgGridHooks.tsx +15 -0
- package/components/grid/columnUtils.ts +29 -0
- package/components/grid/config/columnTransfer.tsx +258 -0
- package/components/grid/config/dataGridEditor.tsx +328 -0
- package/components/grid/config/rowHeightCalculator.tsx +29 -0
- package/components/grid/config/rowStylePicker.tsx +196 -0
- package/components/grid/dataGrid.tsx +2183 -0
- package/components/grid/detail/detailHeaderPanel.tsx +59 -0
- package/components/grid/export/contextMenu.tsx +154 -0
- package/components/grid/export/progressPopup.tsx +106 -0
- package/components/grid/export/worker/clipboardExport.ts +10 -0
- package/components/grid/export/worker/csvExport.ts +10 -0
- package/components/grid/export/worker/pdfExport.ts +98 -0
- package/components/grid/export/worker/txtExport.ts +21 -0
- package/components/grid/extendedDataGrid.tsx +974 -0
- package/components/grid/filter/customColumnFilter.tsx +14 -0
- package/components/grid/filter/dataGridColumnFilter.tsx +70 -0
- package/components/grid/filter/dateColumnFilter.tsx +34 -0
- package/components/grid/filter/textColumnFilter.tsx +37 -0
- package/components/grid/filter/wildcardQuickFilterEngine.ts +50 -0
- package/components/grid/header/simpleHeader.tsx +270 -0
- package/components/grid/panel/dataGridPagination.tsx +123 -0
- package/components/grid/panel/loadingOverlay.tsx +14 -0
- package/components/grid/panel/noRecordsOverlay.tsx +16 -0
- package/components/grid/panel/tablePagination.tsx +77 -0
- package/components/icons/ant-design-double-right-outline.svg +5 -5
- package/components/icons/ant-design_close-outline.svg +5 -5
- package/components/icons/dropdownArrow.tsx +67 -0
- package/components/icons/undoIcon.tsx +16 -0
- package/components/input/autoCompleteInput.tsx +174 -0
- package/components/input/draftUtils.tsx +62 -0
- package/components/input/draftail.d.ts +186 -1
- package/components/input/draftail.js +1 -2
- package/components/input/hexaFormattedInput.tsx +64 -0
- package/components/input/mask/helpers.ts +154 -0
- package/components/input/mask/inputMaskCore.ts +452 -0
- package/components/input/mask/pattern.ts +122 -0
- package/components/input/maskedInput.tsx +275 -0
- package/components/input/passwordInput.tsx +62 -0
- package/components/input/simpleAutoComplete.tsx +60 -0
- package/components/input/textarea/extractSpansOfClasses.tsx +125 -0
- package/components/input/textarea/getRanges.ts +82 -0
- package/components/input/textarea/getType.ts +23 -0
- package/components/input/textarea/highlighedContents.tsx +20 -0
- package/components/input/textarea/highlightedTextarea.css +61 -0
- package/components/input/textarea/mentionsWithHighlighting.tsx +95 -0
- package/components/keyboard/keyboardUtils.ts +42 -0
- package/components/modal/draggableModalProvider.tsx +37 -0
- package/components/modal/impl/clamp.ts +4 -0
- package/components/modal/impl/draggableModal.tsx +36 -0
- package/components/modal/impl/draggableModalContext.ts +14 -0
- package/components/modal/impl/draggableModalInner.tsx +114 -0
- package/components/modal/impl/draggableModalReducer.ts +285 -0
- package/components/modal/impl/getWindowSize.ts +6 -0
- package/components/modal/impl/index.ts +5 -0
- package/components/modal/impl/resizeHandle.tsx +12 -0
- package/components/modal/impl/useDrag.ts +57 -0
- package/components/modal/impl/usePrevious.ts +11 -0
- package/components/modal/impl/useResize.ts +79 -0
- package/components/modal/modalDialog.tsx +172 -0
- package/components/picker/enumValuePicker.tsx +48 -0
- package/components/platformSpecific.ts +39 -0
- package/components/scrollTo/dom-scroll-into-view.d.ts +1 -0
- package/components/scrollTo/onlyText.ts +36 -0
- package/components/scrollTo/scrollTo.tsx +324 -0
- package/components/style/withCss.tsx +14 -0
- package/components/style/withInputNumberCss.tsx +18 -0
- package/components/svg.d.ts +1 -0
- package/components/table/dragSortingTable.tsx +123 -0
- package/components/text/impl/innerSize.ts +15 -0
- package/components/text/impl/series.ts +37 -0
- package/components/text/impl/shallowEqual.ts +19 -0
- package/components/text/impl/uniqueId.ts +5 -0
- package/components/text/impl/whilst.ts +25 -0
- package/components/text/textFit.tsx +229 -0
- package/i18n/components.cs.json +101 -101
- package/i18n/components.sk.json +101 -101
- package/i18n/components.uk.json +101 -101
- package/i18n/componentsLocaleHolder.js +24 -29
- package/i18n/componentsLocaleLoader.d.ts +9 -0
- package/lib/esm/components/codemirror/SyntaxHighlighter.js.map +1 -0
- package/lib/esm/components/color/colorSwatch.d.ts +13 -0
- package/lib/esm/components/color/colorSwatch.js.map +1 -0
- package/{components → lib/esm/components}/grid/cell/cellEditorUtils.js.map +1 -1
- package/lib/esm/components/grid/cell/rangeSelector.d.ts +78 -0
- package/lib/esm/components/grid/cell/rangeSelector.js +527 -0
- package/lib/esm/components/grid/columnUtils.js.map +1 -0
- package/{components → lib/esm/components}/grid/export/contextMenu.js +4 -4
- package/lib/esm/components/grid/export/progressPopup.js.map +1 -0
- package/{components → lib/esm/components}/grid/export/worker/clipboardExport.js.map +1 -1
- package/{components → lib/esm/components}/grid/export/worker/csvExport.js.map +1 -1
- package/{components → lib/esm/components}/grid/export/worker/txtExport.js.map +1 -1
- package/lib/esm/components/icons/undoIcon.js.map +1 -0
- package/lib/esm/components/input/draftUtils.js.map +1 -0
- package/lib/esm/components/input/draftail.d.ts +1 -0
- package/lib/esm/components/input/draftail.js +2 -0
- package/{components → lib/esm/components}/input/draftail.js.map +1 -1
- package/lib/esm/components/input/mask/inputMaskCore.js.map +1 -0
- package/lib/esm/components/input/mask/pattern.js.map +1 -0
- package/lib/esm/components/input/passwordInput.js.map +1 -0
- package/lib/esm/components/input/textarea/extractSpansOfClasses.js.map +1 -0
- package/lib/esm/components/input/textarea/getRanges.js.map +1 -0
- package/{components → lib/esm/components}/input/textarea/getType.js.map +1 -1
- package/{components → lib/esm/components}/input/textarea/highlighedContents.js.map +1 -1
- package/lib/esm/components/input/textarea/mentionsWithHighlighting.js.map +1 -0
- package/{components → lib/esm/components}/keyboard/keyboardUtils.js.map +1 -1
- package/lib/esm/components/platformSpecific.js.map +1 -0
- package/{components → lib/esm/components}/text/impl/innerSize.js.map +1 -1
- package/lib/esm/components/text/impl/series.js.map +1 -0
- package/{components → lib/esm/components}/text/impl/shallowEqual.js.map +1 -1
- package/{components → lib/esm/components}/text/impl/uniqueId.js.map +1 -1
- package/lib/esm/components/text/impl/whilst.js.map +1 -0
- package/lib/esm/i18n/components.cs.json +101 -0
- package/lib/esm/i18n/components.sk.json +101 -0
- package/lib/esm/i18n/components.uk.json +101 -0
- package/lib/esm/i18n/componentsLocaleHolder.js +29 -0
- package/lib/esm/i18n/componentsLocaleHolder.js.map +1 -0
- package/lib/esm/package.json +70 -0
- package/lib/esm/tsconfig.build.json +24 -0
- package/lib/esm/tsconfig.json +11 -0
- package/package.json +3 -3
- package/style/ag-grid/_ag-theme-antd-vars.scss +194 -194
- package/style/ag-grid/ag-theme-antd.scss +87 -87
- package/style/ag-grid/aggrid-adaptations.css +42 -42
- package/style/ag-grid/aggrid.scss +11 -11
- package/style/flexLayout/flexLayout.scss +130 -130
- package/style/flexLayout/flexLayoutBase.scss +623 -623
- package/style/flexLayout/new/_base.scss +616 -616
- package/style/flexLayout/new/flexLayoutBase.scss +621 -621
- package/style/flexLayout/new/light.scss +107 -107
- package/style/flexLayout/old/_base.scss +551 -551
- package/style/flexLayout/old/light.scss +16 -16
- package/style/form/niceFormItem.css +38 -38
- package/style/loading.css +31 -31
- package/style/splitPane/splitPane.css +48 -48
- package/tsconfig.build.json +24 -24
- package/tsconfig.json +11 -11
- package/components/codemirror/SyntaxHighlighter.js.map +0 -1
- package/components/color/colorSwatch.js.map +0 -1
- package/components/grid/columnUtils.js.map +0 -1
- package/components/grid/export/progressPopup.js.map +0 -1
- package/components/icons/undoIcon.js.map +0 -1
- package/components/input/draftUtils.js.map +0 -1
- package/components/input/mask/inputMaskCore.js.map +0 -1
- package/components/input/mask/pattern.js.map +0 -1
- package/components/input/passwordInput.js.map +0 -1
- package/components/input/textarea/extractSpansOfClasses.js.map +0 -1
- package/components/input/textarea/getRanges.js.map +0 -1
- package/components/input/textarea/mentionsWithHighlighting.js.map +0 -1
- package/components/platformSpecific.js.map +0 -1
- package/components/text/impl/series.js.map +0 -1
- package/components/text/impl/whilst.js.map +0 -1
- package/i18n/componentsLocaleHolder.js.map +0 -1
- /package/{components → lib/esm/components}/clipboard/clipboardUtils.d.ts +0 -0
- /package/{components → lib/esm/components}/clipboard/clipboardUtils.js +0 -0
- /package/{components → lib/esm/components}/clipboard/clipboardUtils.js.map +0 -0
- /package/{components → lib/esm/components}/codemirror/SyntaxHighlighter.d.ts +0 -0
- /package/{components → lib/esm/components}/codemirror/SyntaxHighlighter.js +0 -0
- /package/{components → lib/esm/components}/collapse/expandable.d.ts +0 -0
- /package/{components → lib/esm/components}/collapse/expandable.js +0 -0
- /package/{components → lib/esm/components}/collapse/expandable.js.map +0 -0
- /package/{components → lib/esm/components}/color/colorPicker.d.ts +0 -0
- /package/{components → lib/esm/components}/color/colorPicker.js +0 -0
- /package/{components → lib/esm/components}/color/colorPicker.js.map +0 -0
- /package/{components → lib/esm/components}/color/colorSwatch.js +0 -0
- /package/{components → lib/esm/components}/color/colorUtils.d.ts +0 -0
- /package/{components → lib/esm/components}/color/colorUtils.js +0 -0
- /package/{components → lib/esm/components}/color/colorUtils.js.map +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInput.d.ts +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInput.js +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInput.js.map +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInputAdvancedPanel.d.ts +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInputAdvancedPanel.js +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInputAdvancedPanel.js.map +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInputConfirm.d.ts +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInputConfirm.js +0 -0
- /package/{components → lib/esm/components}/date/dateRangeInputConfirm.js.map +0 -0
- /package/{components → lib/esm/components}/date/dateTimeInput.d.ts +0 -0
- /package/{components → lib/esm/components}/date/dateTimeInput.js +0 -0
- /package/{components → lib/esm/components}/date/dateTimeInput.js.map +0 -0
- /package/{components → lib/esm/components}/date/durationInput.d.ts +0 -0
- /package/{components → lib/esm/components}/date/durationInput.js +0 -0
- /package/{components → lib/esm/components}/date/durationInput.js.map +0 -0
- /package/{components → lib/esm/components}/form/NiceFormItem.d.ts +0 -0
- /package/{components → lib/esm/components}/form/NiceFormItem.js +0 -0
- /package/{components → lib/esm/components}/form/NiceFormItem.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/beanAccessor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/beanAccessor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/beanAccessor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/cellEditorUtils.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/cellEditorUtils.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/customEnumCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/customEnumCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/customEnumCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/dataGridCellEditorComponent.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/dataGridCellEditorComponent.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/dataGridCellEditorComponent.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/dateCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/dateCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/dateCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/durationCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/durationCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/durationCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/hexaOctetStringCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/hexaOctetStringCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/hexaOctetStringCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/hexaValueCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/hexaValueCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/hexaValueCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/numberCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/numberCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/numberCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/rangeSelector.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/simpleStatusTextCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/simpleStatusTextCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/simpleStatusTextCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/statusTextCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/statusTextCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/statusTextCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/tableDefaultRowStyleRules.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/tableDefaultRowStyleRules.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/tableDefaultRowStyleRules.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/textCellEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/textCellEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/textCellEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/cell/withAgGridHooks.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/cell/withAgGridHooks.js +0 -0
- /package/{components → lib/esm/components}/grid/cell/withAgGridHooks.js.map +0 -0
- /package/{components → lib/esm/components}/grid/columnUtils.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/columnUtils.js +0 -0
- /package/{components → lib/esm/components}/grid/config/columnTransfer.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/config/columnTransfer.js +0 -0
- /package/{components → lib/esm/components}/grid/config/columnTransfer.js.map +0 -0
- /package/{components → lib/esm/components}/grid/config/dataGridEditor.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/config/dataGridEditor.js +0 -0
- /package/{components → lib/esm/components}/grid/config/dataGridEditor.js.map +0 -0
- /package/{components → lib/esm/components}/grid/config/rowHeightCalculator.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/config/rowHeightCalculator.js +0 -0
- /package/{components → lib/esm/components}/grid/config/rowHeightCalculator.js.map +0 -0
- /package/{components → lib/esm/components}/grid/config/rowStylePicker.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/config/rowStylePicker.js +0 -0
- /package/{components → lib/esm/components}/grid/config/rowStylePicker.js.map +0 -0
- /package/{components → lib/esm/components}/grid/dataGrid.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/dataGrid.js +0 -0
- /package/{components → lib/esm/components}/grid/dataGrid.js.map +0 -0
- /package/{components → lib/esm/components}/grid/detail/detailHeaderPanel.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/detail/detailHeaderPanel.js +0 -0
- /package/{components → lib/esm/components}/grid/detail/detailHeaderPanel.js.map +0 -0
- /package/{components → lib/esm/components}/grid/export/contextMenu.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/export/contextMenu.js.map +0 -0
- /package/{components → lib/esm/components}/grid/export/progressPopup.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/export/progressPopup.js +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/clipboardExport.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/clipboardExport.js +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/csvExport.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/csvExport.js +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/pdfExport.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/pdfExport.js +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/pdfExport.js.map +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/txtExport.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/export/worker/txtExport.js +0 -0
- /package/{components → lib/esm/components}/grid/extendedDataGrid.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/extendedDataGrid.js +0 -0
- /package/{components → lib/esm/components}/grid/extendedDataGrid.js.map +0 -0
- /package/{components → lib/esm/components}/grid/filter/customColumnFilter.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/filter/customColumnFilter.js +0 -0
- /package/{components → lib/esm/components}/grid/filter/customColumnFilter.js.map +0 -0
- /package/{components → lib/esm/components}/grid/filter/dataGridColumnFilter.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/filter/dataGridColumnFilter.js +0 -0
- /package/{components → lib/esm/components}/grid/filter/dataGridColumnFilter.js.map +0 -0
- /package/{components → lib/esm/components}/grid/filter/dateColumnFilter.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/filter/dateColumnFilter.js +0 -0
- /package/{components → lib/esm/components}/grid/filter/dateColumnFilter.js.map +0 -0
- /package/{components → lib/esm/components}/grid/filter/textColumnFilter.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/filter/textColumnFilter.js +0 -0
- /package/{components → lib/esm/components}/grid/filter/textColumnFilter.js.map +0 -0
- /package/{components → lib/esm/components}/grid/filter/wildcardQuickFilterEngine.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/filter/wildcardQuickFilterEngine.js +0 -0
- /package/{components → lib/esm/components}/grid/filter/wildcardQuickFilterEngine.js.map +0 -0
- /package/{components → lib/esm/components}/grid/header/simpleHeader.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/header/simpleHeader.js +0 -0
- /package/{components → lib/esm/components}/grid/header/simpleHeader.js.map +0 -0
- /package/{components → lib/esm/components}/grid/panel/dataGridPagination.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/panel/dataGridPagination.js +0 -0
- /package/{components → lib/esm/components}/grid/panel/dataGridPagination.js.map +0 -0
- /package/{components → lib/esm/components}/grid/panel/loadingOverlay.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/panel/loadingOverlay.js +0 -0
- /package/{components → lib/esm/components}/grid/panel/loadingOverlay.js.map +0 -0
- /package/{components → lib/esm/components}/grid/panel/noRecordsOverlay.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/panel/noRecordsOverlay.js +0 -0
- /package/{components → lib/esm/components}/grid/panel/noRecordsOverlay.js.map +0 -0
- /package/{components → lib/esm/components}/grid/panel/tablePagination.d.ts +0 -0
- /package/{components → lib/esm/components}/grid/panel/tablePagination.js +0 -0
- /package/{components → lib/esm/components}/grid/panel/tablePagination.js.map +0 -0
- /package/{components → lib/esm/components}/icons/dropdownArrow.d.ts +0 -0
- /package/{components → lib/esm/components}/icons/dropdownArrow.js +0 -0
- /package/{components → lib/esm/components}/icons/dropdownArrow.js.map +0 -0
- /package/{components → lib/esm/components}/icons/undoIcon.d.ts +0 -0
- /package/{components → lib/esm/components}/icons/undoIcon.js +0 -0
- /package/{components → lib/esm/components}/input/autoCompleteInput.d.ts +0 -0
- /package/{components → lib/esm/components}/input/autoCompleteInput.js +0 -0
- /package/{components → lib/esm/components}/input/autoCompleteInput.js.map +0 -0
- /package/{components → lib/esm/components}/input/draftUtils.d.ts +0 -0
- /package/{components → lib/esm/components}/input/draftUtils.js +0 -0
- /package/{components → lib/esm/components}/input/hexaFormattedInput.d.ts +0 -0
- /package/{components → lib/esm/components}/input/hexaFormattedInput.js +0 -0
- /package/{components → lib/esm/components}/input/hexaFormattedInput.js.map +0 -0
- /package/{components → lib/esm/components}/input/mask/helpers.d.ts +0 -0
- /package/{components → lib/esm/components}/input/mask/helpers.js +0 -0
- /package/{components → lib/esm/components}/input/mask/helpers.js.map +0 -0
- /package/{components → lib/esm/components}/input/mask/inputMaskCore.d.ts +0 -0
- /package/{components → lib/esm/components}/input/mask/inputMaskCore.js +0 -0
- /package/{components → lib/esm/components}/input/mask/pattern.d.ts +0 -0
- /package/{components → lib/esm/components}/input/mask/pattern.js +0 -0
- /package/{components → lib/esm/components}/input/maskedInput.d.ts +0 -0
- /package/{components → lib/esm/components}/input/maskedInput.js +0 -0
- /package/{components → lib/esm/components}/input/maskedInput.js.map +0 -0
- /package/{components → lib/esm/components}/input/passwordInput.d.ts +0 -0
- /package/{components → lib/esm/components}/input/passwordInput.js +0 -0
- /package/{components → lib/esm/components}/input/simpleAutoComplete.d.ts +0 -0
- /package/{components → lib/esm/components}/input/simpleAutoComplete.js +0 -0
- /package/{components → lib/esm/components}/input/simpleAutoComplete.js.map +0 -0
- /package/{components → lib/esm/components}/input/textarea/extractSpansOfClasses.d.ts +0 -0
- /package/{components → lib/esm/components}/input/textarea/extractSpansOfClasses.js +0 -0
- /package/{components → lib/esm/components}/input/textarea/getRanges.d.ts +0 -0
- /package/{components → lib/esm/components}/input/textarea/getRanges.js +0 -0
- /package/{components → lib/esm/components}/input/textarea/getType.d.ts +0 -0
- /package/{components → lib/esm/components}/input/textarea/getType.js +0 -0
- /package/{components → lib/esm/components}/input/textarea/highlighedContents.d.ts +0 -0
- /package/{components → lib/esm/components}/input/textarea/highlighedContents.js +0 -0
- /package/{components → lib/esm/components}/input/textarea/mentionsWithHighlighting.d.ts +0 -0
- /package/{components → lib/esm/components}/input/textarea/mentionsWithHighlighting.js +0 -0
- /package/{components → lib/esm/components}/keyboard/keyboardUtils.d.ts +0 -0
- /package/{components → lib/esm/components}/keyboard/keyboardUtils.js +0 -0
- /package/{components → lib/esm/components}/modal/draggableModalProvider.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/draggableModalProvider.js +0 -0
- /package/{components → lib/esm/components}/modal/draggableModalProvider.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/clamp.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/clamp.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/clamp.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModal.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModal.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModal.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalContext.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalContext.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalContext.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalInner.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalInner.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalInner.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalReducer.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalReducer.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/draggableModalReducer.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/getWindowSize.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/getWindowSize.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/getWindowSize.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/index.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/index.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/index.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/resizeHandle.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/resizeHandle.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/resizeHandle.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/useDrag.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/useDrag.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/useDrag.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/usePrevious.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/usePrevious.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/usePrevious.js.map +0 -0
- /package/{components → lib/esm/components}/modal/impl/useResize.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/impl/useResize.js +0 -0
- /package/{components → lib/esm/components}/modal/impl/useResize.js.map +0 -0
- /package/{components → lib/esm/components}/modal/modalDialog.d.ts +0 -0
- /package/{components → lib/esm/components}/modal/modalDialog.js +0 -0
- /package/{components → lib/esm/components}/modal/modalDialog.js.map +0 -0
- /package/{components → lib/esm/components}/picker/enumValuePicker.d.ts +0 -0
- /package/{components → lib/esm/components}/picker/enumValuePicker.js +0 -0
- /package/{components → lib/esm/components}/picker/enumValuePicker.js.map +0 -0
- /package/{components → lib/esm/components}/platformSpecific.d.ts +0 -0
- /package/{components → lib/esm/components}/platformSpecific.js +0 -0
- /package/{components → lib/esm/components}/scrollTo/onlyText.d.ts +0 -0
- /package/{components → lib/esm/components}/scrollTo/onlyText.js +0 -0
- /package/{components → lib/esm/components}/scrollTo/onlyText.js.map +0 -0
- /package/{components → lib/esm/components}/scrollTo/scrollTo.d.ts +0 -0
- /package/{components → lib/esm/components}/scrollTo/scrollTo.js +0 -0
- /package/{components → lib/esm/components}/scrollTo/scrollTo.js.map +0 -0
- /package/{components → lib/esm/components}/style/withCss.d.ts +0 -0
- /package/{components → lib/esm/components}/style/withCss.js +0 -0
- /package/{components → lib/esm/components}/style/withCss.js.map +0 -0
- /package/{components → lib/esm/components}/style/withInputNumberCss.d.ts +0 -0
- /package/{components → lib/esm/components}/style/withInputNumberCss.js +0 -0
- /package/{components → lib/esm/components}/style/withInputNumberCss.js.map +0 -0
- /package/{components → lib/esm/components}/table/dragSortingTable.d.ts +0 -0
- /package/{components → lib/esm/components}/table/dragSortingTable.js +0 -0
- /package/{components → lib/esm/components}/table/dragSortingTable.js.map +0 -0
- /package/{components → lib/esm/components}/text/impl/innerSize.d.ts +0 -0
- /package/{components → lib/esm/components}/text/impl/innerSize.js +0 -0
- /package/{components → lib/esm/components}/text/impl/series.d.ts +0 -0
- /package/{components → lib/esm/components}/text/impl/series.js +0 -0
- /package/{components → lib/esm/components}/text/impl/shallowEqual.d.ts +0 -0
- /package/{components → lib/esm/components}/text/impl/shallowEqual.js +0 -0
- /package/{components → lib/esm/components}/text/impl/uniqueId.d.ts +0 -0
- /package/{components → lib/esm/components}/text/impl/uniqueId.js +0 -0
- /package/{components → lib/esm/components}/text/impl/whilst.d.ts +0 -0
- /package/{components → lib/esm/components}/text/impl/whilst.js +0 -0
- /package/{components → lib/esm/components}/text/textFit.d.ts +0 -0
- /package/{components → lib/esm/components}/text/textFit.js +0 -0
- /package/{components → lib/esm/components}/text/textFit.js.map +0 -0
- /package/{i18n → lib/esm/i18n}/componentsLocaleHolder.d.ts +0 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import React, {HTMLAttributes, RefObject} from "react";
|
|
2
|
+
import MaskedInput from "d2coreui/components/input/maskedInput";
|
|
3
|
+
import dayjs, {isDuration, ManipulateType} from "dayjs";
|
|
4
|
+
import {Duration} from "d2core/dayjs/duration";
|
|
5
|
+
import {LocaleHolder} from "d2core/i18n/localeHolder";
|
|
6
|
+
import {AutoComplete} from "antd";
|
|
7
|
+
import DropdownArrow from "../icons/dropdownArrow";
|
|
8
|
+
import WithInputNumberCss from "d2coreui/components/style/withInputNumberCss";
|
|
9
|
+
import {SizeType} from "antd/lib/config-provider/SizeContext";
|
|
10
|
+
|
|
11
|
+
interface DurationInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
12
|
+
mask: string
|
|
13
|
+
value: Duration | null
|
|
14
|
+
onChange?: (time: Duration | null) => void
|
|
15
|
+
predefinedValues?: { key: string, value: string }[]
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
inputStyle?: React.CSSProperties
|
|
18
|
+
autoFocus?: boolean
|
|
19
|
+
size?: SizeType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface DurationInputState {
|
|
23
|
+
valid: boolean
|
|
24
|
+
selectionStart: number | null
|
|
25
|
+
selectionEnd: number | null
|
|
26
|
+
currentInfo: MaskResult
|
|
27
|
+
opened: boolean
|
|
28
|
+
value: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface MaskResult {
|
|
32
|
+
time?: Duration
|
|
33
|
+
info?: InfoEntry
|
|
34
|
+
infoFromMask?: EntryValue[]
|
|
35
|
+
length: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface InfoEntry {
|
|
39
|
+
key: string
|
|
40
|
+
min: number
|
|
41
|
+
max: number
|
|
42
|
+
minLen: number
|
|
43
|
+
maxLen: number
|
|
44
|
+
mult: number
|
|
45
|
+
unit: ManipulateType
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface EntryValue {
|
|
49
|
+
length: number
|
|
50
|
+
infoEntry: InfoEntry
|
|
51
|
+
value: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const DURATION_DATA_MAP: InfoEntry[] = [
|
|
55
|
+
{key: "SSS", min: 0, max: 999, minLen: 3, maxLen: 3, mult: 1, unit: "ms"},
|
|
56
|
+
{key: "s", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 1000, unit: "s"},
|
|
57
|
+
{key: "m", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 60 * 1000, unit: "m"},
|
|
58
|
+
{key: "H", min: 0, max: 23, minLen: 1, maxLen: 2, mult: 60 * 60 * 1000, unit: "h"},
|
|
59
|
+
{key: "D", min: 0, max: 24854, minLen: 1, maxLen: 5, mult: 24 * 60 * 60 * 1000, unit: "d"},
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
export const MAX_VALID_DURATION = 24854 * 24 * 60 * 60 * 1000 + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000 + 499;
|
|
63
|
+
|
|
64
|
+
export function parseDuration(value: string, mask: string, cursorPos?: number, maskResult?: MaskResult): Duration | null {
|
|
65
|
+
let result: Duration = dayjs.duration(0);
|
|
66
|
+
const clearMaskResult = () => {
|
|
67
|
+
if (maskResult) {
|
|
68
|
+
maskResult.info = undefined;
|
|
69
|
+
maskResult.length = 0;
|
|
70
|
+
maskResult.infoFromMask = undefined;
|
|
71
|
+
maskResult.time = undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
let maskPos: number = 0;
|
|
75
|
+
let valPos: number;
|
|
76
|
+
|
|
77
|
+
for (valPos = 0; valPos < value.length; valPos++) {
|
|
78
|
+
const c: string = value.charAt(valPos);
|
|
79
|
+
|
|
80
|
+
if (['D', 'H', 'm', 's', 'S'].includes(mask.charAt(maskPos))) { // je to maska
|
|
81
|
+
if (/\d/.test(c)) {
|
|
82
|
+
const entry: EntryValue | undefined = getInfoFromMask(mask, maskPos);
|
|
83
|
+
|
|
84
|
+
if (entry) {
|
|
85
|
+
let str = c;
|
|
86
|
+
|
|
87
|
+
while (/\d/.test(value.charAt(valPos + 1))) {
|
|
88
|
+
valPos++;
|
|
89
|
+
str += value.charAt(valPos);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (str.length !== entry.length) {
|
|
93
|
+
clearMaskResult();
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const time: number = parseInt(str);
|
|
98
|
+
|
|
99
|
+
result = result.add(dayjs.duration(time, entry.infoEntry.unit));
|
|
100
|
+
if (maskResult) {
|
|
101
|
+
const item: EntryValue = {
|
|
102
|
+
value: time,
|
|
103
|
+
length: str.length,
|
|
104
|
+
infoEntry: entry.infoEntry,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (maskResult.infoFromMask) {
|
|
108
|
+
maskResult.infoFromMask.push(item);
|
|
109
|
+
} else {
|
|
110
|
+
maskResult.infoFromMask = [item];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
maskPos += entry.length;
|
|
114
|
+
|
|
115
|
+
if (cursorPos !== undefined && maskResult !== undefined && cursorPos >= valPos - str.length + 1 && cursorPos <= valPos + 1) {
|
|
116
|
+
maskResult.info = entry.infoEntry;
|
|
117
|
+
maskResult.length = str.length;
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
clearMaskResult();
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
// non-numeric character when value expected
|
|
125
|
+
clearMaskResult();
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
if (c === mask.charAt(maskPos)) {
|
|
130
|
+
// skip special characters
|
|
131
|
+
maskPos++;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (maskPos === mask.length && valPos === value.length && result.asMilliseconds() <= MAX_VALID_DURATION) {
|
|
137
|
+
if (maskResult !== undefined) {
|
|
138
|
+
maskResult.time = result;
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
clearMaskResult();
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export default class DurationInput extends React.Component<DurationInputProps, DurationInputState> {
|
|
148
|
+
private inputRef: RefObject<MaskedInput> = React.createRef();
|
|
149
|
+
|
|
150
|
+
constructor(props: Readonly<DurationInputProps>) {
|
|
151
|
+
super(props);
|
|
152
|
+
this.state = {
|
|
153
|
+
valid: isDuration(props.value),
|
|
154
|
+
selectionStart: null,
|
|
155
|
+
selectionEnd: null,
|
|
156
|
+
currentInfo: {
|
|
157
|
+
info: undefined,
|
|
158
|
+
infoFromMask: undefined,
|
|
159
|
+
time: undefined,
|
|
160
|
+
length: 0
|
|
161
|
+
},
|
|
162
|
+
opened: false,
|
|
163
|
+
value: formatDuration(props.value, props.mask),
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
this.recalc = this.recalc.bind(this);
|
|
167
|
+
this.increment = this.increment.bind(this);
|
|
168
|
+
this.decrement = this.decrement.bind(this);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
componentDidUpdate(): void {
|
|
172
|
+
if (this.inputRef.current !== null) {
|
|
173
|
+
this.inputRef.current.input.selectionStart = this.state.selectionStart;
|
|
174
|
+
this.inputRef.current.input.selectionEnd = this.state.selectionEnd;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const value: string = formatDuration(this.props.value, this.props.mask);
|
|
178
|
+
|
|
179
|
+
if (this.state.value !== value) {
|
|
180
|
+
this.setState({
|
|
181
|
+
value: value,
|
|
182
|
+
valid: isDuration(this.props.value),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
recalc(): void {
|
|
188
|
+
if (this.inputRef.current !== null) {
|
|
189
|
+
const value: MaskResult = {length: 0};
|
|
190
|
+
parseDuration(this.inputRef.current.input.value, this.props.mask, this.inputRef.current.input.selectionStart ?? undefined, value);
|
|
191
|
+
this.setState({
|
|
192
|
+
currentInfo: value,
|
|
193
|
+
selectionStart: this.inputRef.current.input.selectionStart,
|
|
194
|
+
selectionEnd: this.inputRef.current.input.selectionEnd,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
increment(): void {
|
|
200
|
+
if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, 1)) {
|
|
201
|
+
this.props.onChange?.(this.props.value?.add(1, this.state.currentInfo.info.unit) ?? null);
|
|
202
|
+
this.setState({selectionEnd: this.state.selectionStart});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
this.inputRef.current?.focus();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
decrement(): void {
|
|
209
|
+
if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, -1)) {
|
|
210
|
+
this.props.onChange?.(this.props.value?.subtract(1, this.state.currentInfo.info.unit) ?? null);
|
|
211
|
+
this.setState({selectionEnd: this.state.selectionStart});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
this.inputRef.current?.focus();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
get input() {
|
|
218
|
+
return this.inputRef.current?.input;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
focus() {
|
|
222
|
+
this.inputRef.current?.focus();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
render() {
|
|
226
|
+
const {mask, value, onChange, style, disabled, predefinedValues, autoFocus, size, ...props} = this.props;
|
|
227
|
+
const incrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, 1);
|
|
228
|
+
const decrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, -1);
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<WithInputNumberCss>
|
|
232
|
+
<div style={{width: "100%", ...style}}
|
|
233
|
+
{...props}
|
|
234
|
+
className={!predefinedValues ? "ant-input-number ant-input-number-outlined" : ""}
|
|
235
|
+
onKeyDown={(event) => {
|
|
236
|
+
if (event.code === "ArrowUp") { // up
|
|
237
|
+
this.increment();
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
event.stopPropagation();
|
|
240
|
+
} else if (event.code === "ArrowDown") { // down
|
|
241
|
+
this.decrement();
|
|
242
|
+
event.preventDefault();
|
|
243
|
+
event.stopPropagation();
|
|
244
|
+
}
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
<AutoComplete
|
|
248
|
+
className={this.state.valid ? "" : "invalid"}
|
|
249
|
+
options={this.state.opened ? predefinedValues?.map(v => {
|
|
250
|
+
return {value: v.value, label: v.key}
|
|
251
|
+
}) : []}
|
|
252
|
+
defaultOpen={false}
|
|
253
|
+
defaultActiveFirstOption={false}
|
|
254
|
+
defaultValue={undefined}
|
|
255
|
+
disabled={disabled}
|
|
256
|
+
autoFocus={autoFocus}
|
|
257
|
+
style={{width: "100%", height: "inherit"}}
|
|
258
|
+
value={this.state.valid ? this.state.value : ""}
|
|
259
|
+
onSelect={(e) => {
|
|
260
|
+
const val: Duration = dayjs.duration(Number(e));
|
|
261
|
+
this.setState({
|
|
262
|
+
opened: false,
|
|
263
|
+
valid: isDuration(val),
|
|
264
|
+
value: formatDuration(val, this.props.mask),
|
|
265
|
+
});
|
|
266
|
+
onChange?.(val === undefined ? null : val);
|
|
267
|
+
}}
|
|
268
|
+
onBlur={() => {
|
|
269
|
+
this.setState({opened: false});
|
|
270
|
+
}}>
|
|
271
|
+
<MaskedInput mask={this.props.mask.replace(/[a-zA-Z]/g, '1')}
|
|
272
|
+
ref={this.inputRef}
|
|
273
|
+
style={{
|
|
274
|
+
border: predefinedValues ? undefined : "none",
|
|
275
|
+
...this.props.inputStyle
|
|
276
|
+
}}
|
|
277
|
+
size={size}
|
|
278
|
+
placeholder={this.props.mask.replace(/[a-zA-Z]/g, '_')}
|
|
279
|
+
autoFocus={autoFocus}
|
|
280
|
+
onFocus={(event => {
|
|
281
|
+
event.target.selectionStart = event.target.selectionEnd = this.state.selectionStart;
|
|
282
|
+
})}
|
|
283
|
+
suffix={
|
|
284
|
+
this.props.predefinedValues !== undefined && this.props.predefinedValues.length > 0 &&
|
|
285
|
+
<DropdownArrow opened={this.state.opened}
|
|
286
|
+
onClick={() => {
|
|
287
|
+
if (!this.props.disabled) {
|
|
288
|
+
this.setState({opened: !this.state.opened});
|
|
289
|
+
}
|
|
290
|
+
}}/>
|
|
291
|
+
}
|
|
292
|
+
onMouseUp={this.recalc}
|
|
293
|
+
onKeyUp={this.recalc}
|
|
294
|
+
onChange={(event) => {
|
|
295
|
+
const value: MaskResult = {length: 0};
|
|
296
|
+
parseDuration(event.target.value, this.props.mask, event.target.selectionStart ?? undefined, value);
|
|
297
|
+
onChange?.(value.time === undefined ? null : value.time);
|
|
298
|
+
this.setState({
|
|
299
|
+
valid: isDuration(value.time),
|
|
300
|
+
currentInfo: value,
|
|
301
|
+
value: event.target.value,
|
|
302
|
+
});
|
|
303
|
+
}}
|
|
304
|
+
/>
|
|
305
|
+
</AutoComplete>
|
|
306
|
+
{!predefinedValues && !disabled &&
|
|
307
|
+
<div className="ant-input-number-handler-wrap">
|
|
308
|
+
<span onClick={this.increment} className={`ant-input-number-handler ant-input-number-handler-up ${incrementButtonDisabled ? "ant-input-number-handler-up-disabled" : ""}`}>
|
|
309
|
+
<span className="anticon anticon-up ant-input-number-handler-up-inner">
|
|
310
|
+
<svg viewBox="64 64 896 896" focusable="false" data-icon="up" width="1em" height="1em" fill="currentColor" aria-hidden="true">
|
|
311
|
+
<path d="M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"></path>
|
|
312
|
+
</svg>
|
|
313
|
+
</span>
|
|
314
|
+
</span>
|
|
315
|
+
<span onClick={this.decrement} className={`ant-input-number-handler ant-input-number-handler-down ${decrementButtonDisabled ? "ant-input-number-handler-down-disabled" : ""}`}>
|
|
316
|
+
<span className="anticon anticon-down ant-input-number-handler-down-inner">
|
|
317
|
+
<svg viewBox="64 64 896 896" focusable="false" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true">
|
|
318
|
+
<path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path>
|
|
319
|
+
</svg>
|
|
320
|
+
</span>
|
|
321
|
+
</span>
|
|
322
|
+
</div>
|
|
323
|
+
}
|
|
324
|
+
</div>
|
|
325
|
+
</WithInputNumberCss>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function checkValue(info: MaskResult, value: Duration | null, offset = 0): boolean {
|
|
331
|
+
const currentMillis = value ? value.add(offset, info.info?.unit).asMilliseconds() : 0;
|
|
332
|
+
const maxValues = info?.infoFromMask ? info.infoFromMask.map((i) => (i.length !== i.infoEntry.maxLen ? (Math.pow(10, i.length) - 1) : i.infoEntry.max) * i.infoEntry.mult) : [];
|
|
333
|
+
const maxMaskedValue = info?.infoFromMask ? maxValues.reduce((p, n) => p + n, 0) : 0;
|
|
334
|
+
return !!value && currentMillis >= 0 && currentMillis <= MAX_VALID_DURATION && currentMillis <= maxMaskedValue;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function formatDuration(value: Duration | null, mask: string): string {
|
|
338
|
+
//@ts-ignore
|
|
339
|
+
return (isDuration(value) ? value : dayjs.duration(0)).locale("locale.d2000").format(mask, {
|
|
340
|
+
trim: false,
|
|
341
|
+
decimalSeparator: LocaleHolder.decimalSeparator,
|
|
342
|
+
useGrouping: false,
|
|
343
|
+
groupingSeparator: "",
|
|
344
|
+
userLocale: LocaleHolder.formattingLocale
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function getInfoFromMask(mask: string, fromPos: number): EntryValue | undefined {
|
|
349
|
+
if (fromPos < mask.length) {
|
|
350
|
+
const ch = mask.charAt(fromPos);
|
|
351
|
+
const info = DURATION_DATA_MAP.find((d) => d.key.includes(ch));
|
|
352
|
+
|
|
353
|
+
if (info) {
|
|
354
|
+
const entry: EntryValue = {
|
|
355
|
+
length: 1,
|
|
356
|
+
value: 0,
|
|
357
|
+
infoEntry: info,
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
for (let i = fromPos + 1; i < mask.length; i++) {
|
|
361
|
+
const c = mask.charAt(i);
|
|
362
|
+
|
|
363
|
+
if (c === ch) {
|
|
364
|
+
entry.length++;
|
|
365
|
+
} else {
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return entry;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, {CSSProperties, ReactNode} from "react";
|
|
2
|
+
import {Form, FormItemProps} from "antd"
|
|
3
|
+
import "../../style/form/niceFormItem.css"
|
|
4
|
+
|
|
5
|
+
export interface NiceFormItemProps extends FormItemProps {
|
|
6
|
+
border?: boolean
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
labelStyle?: CSSProperties
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface NiceFormItemState {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class NiceFormItem extends React.Component<NiceFormItemProps, NiceFormItemState> {
|
|
15
|
+
constructor(props: Readonly<NiceFormItemProps> | NiceFormItemProps) {
|
|
16
|
+
super(props);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
const {label, children, border, disabled, className, labelStyle, ...rest} = this.props;
|
|
21
|
+
const eLabelStyle = !!labelStyle ? {...labelStyle} : (disabled ? {} : undefined);
|
|
22
|
+
const classNames = "nice-form-item" + (className ?? "")
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Form.Item {...rest} className={classNames}>
|
|
26
|
+
<div className="nice-float-label">
|
|
27
|
+
{(border ? <section className="nice-form-item-box">{children as ReactNode}</section> : children) as ReactNode}
|
|
28
|
+
<label className="nice-label nice-label-float" style={eLabelStyle}>{label}</label>
|
|
29
|
+
</div>
|
|
30
|
+
</Form.Item>);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {BeanCollection, BeanStub, GridApi, NamedBean} from "ag-grid-community";
|
|
2
|
+
|
|
3
|
+
export interface GridApiWithPrivateAccess extends GridApi {
|
|
4
|
+
beans: BeanCollection;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default class BeanAccessor extends BeanStub implements NamedBean {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
beanName = "beanAccessor" as const
|
|
10
|
+
|
|
11
|
+
public wireBeans(beans: BeanCollection) {
|
|
12
|
+
(beans.gridApi as GridApiWithPrivateAccess).beans = beans;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public postConstruct(): void {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import KeyboardUtils from "d2coreui/components/keyboard/keyboardUtils";
|
|
2
|
+
import {Key} from "ts-key-enum";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
export class CellEditorUtils {
|
|
6
|
+
static shouldIgnoreKeyEvent<T>(e: React.KeyboardEvent<T>): boolean {
|
|
7
|
+
return (
|
|
8
|
+
(KeyboardUtils.isKeyPressed(Key.Alt) && (e.key === Key.ArrowUp || e.key === Key.ArrowDown)) ||
|
|
9
|
+
(KeyboardUtils.isKeyPressed(Key.Control) && e.key === "KeyA")
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {RefSelectProps} from "antd/es/select";
|
|
3
|
+
import debounce from "lodash/debounce";
|
|
4
|
+
import {Select} from "antd";
|
|
5
|
+
import ReactDOM from "react-dom";
|
|
6
|
+
import {Key} from "ts-key-enum";
|
|
7
|
+
import {CustomCellEditorProps} from "ag-grid-react";
|
|
8
|
+
import {DataGridCellEditorComponent, withAgGridHooks} from "./dataGridCellEditorComponent";
|
|
9
|
+
|
|
10
|
+
interface CustomEnumCellEditorProps extends CustomCellEditorProps {
|
|
11
|
+
values: string[]
|
|
12
|
+
listHeight?: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface CustomEnumCellEditorState {
|
|
16
|
+
value: number | null
|
|
17
|
+
opened: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class CustomEnumCellEditor extends DataGridCellEditorComponent<CustomEnumCellEditorProps, CustomEnumCellEditorState> {
|
|
21
|
+
private selectComponent: RefSelectProps | null = null;
|
|
22
|
+
private wrappingComponent: HTMLDivElement | null = null;
|
|
23
|
+
|
|
24
|
+
constructor(props: Readonly<CustomEnumCellEditorProps>) {
|
|
25
|
+
super(props);
|
|
26
|
+
this.state = this.getInitialState(props);
|
|
27
|
+
this.updateValueFromPreselection = debounce(this.updateValueFromPreselection.bind(this), 200, {maxWait: 200});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getInitialState(props: Readonly<CustomEnumCellEditorProps>): CustomEnumCellEditorState {
|
|
31
|
+
let value: number | null;
|
|
32
|
+
if (props.eventKey === Key.Backspace || props.eventKey === Key.Delete) {
|
|
33
|
+
// if backspace or delete pressed, we clear the cell
|
|
34
|
+
value = null;
|
|
35
|
+
props.onValueChange(null);
|
|
36
|
+
} else if (props.eventKey && props.eventKey.length === 1) {
|
|
37
|
+
// if a letter was pressed, we start with the letter
|
|
38
|
+
const parsedValue = Number.parseInt(props.eventKey);
|
|
39
|
+
value = isNaN(parsedValue) ? props.value : parsedValue;
|
|
40
|
+
props.onValueChange(value);
|
|
41
|
+
} else {
|
|
42
|
+
// otherwise we start with the current value
|
|
43
|
+
value = props.initialValue;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
value: value,
|
|
47
|
+
opened: true,
|
|
48
|
+
} as CustomEnumCellEditorState;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
focus() {
|
|
52
|
+
this.selectComponent?.focus();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
select() {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
placeCursorToEnd() {
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private updateValueFromPreselection() {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
let selectables: HTMLElement[] = Array.from(this.wrappingComponent?.getElementsByClassName("ant-select-item-option-active") ?? []) as HTMLElement[];
|
|
64
|
+
if (selectables.length > 0) {
|
|
65
|
+
const optionStringValue = selectables[0].dataset?.optionvalue;
|
|
66
|
+
const optionValue = optionStringValue !== undefined ? Number.parseFloat(optionStringValue) : undefined
|
|
67
|
+
if (optionValue) {
|
|
68
|
+
this.setState({value: optionValue});
|
|
69
|
+
this.props.onValueChange(optionValue);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, 200)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
render() {
|
|
76
|
+
return (
|
|
77
|
+
<div style={{width: "100%", minWidth: 150, height: 24}}>
|
|
78
|
+
<Select
|
|
79
|
+
ref={(component) => {
|
|
80
|
+
this.selectComponent = component;
|
|
81
|
+
}}
|
|
82
|
+
size={"small"}
|
|
83
|
+
virtual={false}
|
|
84
|
+
className={"select-with-one-item"}
|
|
85
|
+
popupMatchSelectWidth={false}
|
|
86
|
+
style={{width: "100%", overflow: "auto", padding: 0, margin: 0}}
|
|
87
|
+
dropdownStyle={{width: "100%", maxHeight: 400, overflow: 'auto'}}
|
|
88
|
+
showAction={['focus', 'click']}
|
|
89
|
+
listHeight={this.props.listHeight}
|
|
90
|
+
value={this.state.value !== null ? this.state.value : undefined}
|
|
91
|
+
onChange={(value) => {
|
|
92
|
+
const valueToSet = value === undefined ? null : value;
|
|
93
|
+
this.setState({value: valueToSet});
|
|
94
|
+
this.props.onValueChange(valueToSet);
|
|
95
|
+
}}
|
|
96
|
+
onSelect={(value) => {
|
|
97
|
+
const valueToSet = value === undefined ? null : value;
|
|
98
|
+
this.setState({value: valueToSet});
|
|
99
|
+
this.props.onValueChange(valueToSet);
|
|
100
|
+
}}
|
|
101
|
+
open={this.state.opened}
|
|
102
|
+
onDropdownVisibleChange={(visible) => {
|
|
103
|
+
this.setState({opened: visible});
|
|
104
|
+
}}
|
|
105
|
+
getPopupContainer={(_trigger) => {
|
|
106
|
+
// 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)
|
|
107
|
+
return (ReactDOM.findDOMNode(this)?.parentNode ?? document.body) as HTMLElement;
|
|
108
|
+
}}
|
|
109
|
+
dropdownRender={(menu) => {
|
|
110
|
+
return (
|
|
111
|
+
<div ref={(component) => {
|
|
112
|
+
this.wrappingComponent = component;
|
|
113
|
+
}}>
|
|
114
|
+
{menu}
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{this.props.values.map((value, index) => {
|
|
120
|
+
return (
|
|
121
|
+
<Select.Option value={index} key={index}>{value}</Select.Option>
|
|
122
|
+
)
|
|
123
|
+
})}
|
|
124
|
+
</Select>
|
|
125
|
+
</div>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default withAgGridHooks(CustomEnumCellEditor);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {CustomCellEditorProps, useGridCellEditor} from "ag-grid-react";
|
|
2
|
+
import React, {useRef} from "react";
|
|
3
|
+
import {Key} from "ts-key-enum";
|
|
4
|
+
|
|
5
|
+
export class DataGridCellEditorComponent<P extends CustomCellEditorProps, S> extends React.Component<P, S> {
|
|
6
|
+
private focusOpId: number | null = null;
|
|
7
|
+
private highlightAllOnFocus: boolean = true;
|
|
8
|
+
|
|
9
|
+
constructor(props: P) {
|
|
10
|
+
super(props);
|
|
11
|
+
if (!!props.eventKey && (props.eventKey.length === 1 || props.eventKey === Key.F2)) {
|
|
12
|
+
this.highlightAllOnFocus = false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
componentDidMount() {
|
|
17
|
+
this.focusOpId = window.setTimeout(() => {
|
|
18
|
+
this.focus();
|
|
19
|
+
if (this.highlightAllOnFocus) {
|
|
20
|
+
this.select();
|
|
21
|
+
this.highlightAllOnFocus = false;
|
|
22
|
+
} else {
|
|
23
|
+
this.placeCursorToEnd();
|
|
24
|
+
}
|
|
25
|
+
}, 200);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentWillUnmount() {
|
|
29
|
+
if (this.focusOpId) {
|
|
30
|
+
clearTimeout(this.focusOpId);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
focus() {
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
select() {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
placeCursorToEnd() {
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Optional: Gets called once after initialised. If you return true, the editor will not be
|
|
44
|
+
* used and the grid will continue editing. Use this to make a decision on editing
|
|
45
|
+
* inside the init() function, eg maybe you want to only start editing if the user
|
|
46
|
+
* hits a numeric key, but not a letter, if the editor is for numbers.
|
|
47
|
+
*/
|
|
48
|
+
isCancelBeforeStart?(): boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function withAgGridHooks<P extends CustomCellEditorProps, S>(Component: any) {
|
|
52
|
+
return (props: CustomCellEditorProps) => {
|
|
53
|
+
const componentRef: React.MutableRefObject<DataGridCellEditorComponent<P, S> | null> = useRef(null);
|
|
54
|
+
useGridCellEditor({
|
|
55
|
+
isCancelBeforeStart: () => {
|
|
56
|
+
return componentRef.current?.isCancelBeforeStart?.() ?? false;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return <Component ref={componentRef} {...props} />;
|
|
60
|
+
};
|
|
61
|
+
}
|