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.
- 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/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/color/colorSwatch.d.ts +13 -0
- package/lib/esm/components/grid/cell/rangeSelector.d.ts +78 -0
- package/lib/esm/components/grid/cell/rangeSelector.js +527 -0
- package/{components → lib/esm/components}/grid/export/contextMenu.js +4 -4
- package/lib/esm/components/input/draftail.d.ts +1 -0
- package/lib/esm/components/input/draftail.js +2 -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/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/tsconfig.build.json +24 -24
- package/tsconfig.json +11 -11
- /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}/codemirror/SyntaxHighlighter.js.map +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/colorSwatch.js.map +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/cellEditorUtils.js.map +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/columnUtils.js.map +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/progressPopup.js.map +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/clipboardExport.js.map +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/csvExport.js.map +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/export/worker/txtExport.js.map +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}/icons/undoIcon.js.map +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/draftUtils.js.map +0 -0
- /package/{components → lib/esm/components}/input/draftail.js.map +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/inputMaskCore.js.map +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/mask/pattern.js.map +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/passwordInput.js.map +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/extractSpansOfClasses.js.map +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/getRanges.js.map +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/getType.js.map +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/highlighedContents.js.map +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}/input/textarea/mentionsWithHighlighting.js.map +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}/keyboard/keyboardUtils.js.map +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}/platformSpecific.js.map +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/innerSize.js.map +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/series.js.map +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/shallowEqual.js.map +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/uniqueId.js.map +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/impl/whilst.js.map +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
- /package/{i18n → lib/esm/i18n}/componentsLocaleHolder.js.map +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {ArrowDownOutlined, ArrowUpOutlined, CloseOutlined, ProfileOutlined} from "@ant-design/icons";
|
|
3
|
+
import i18n from "d2core/i18n/i18n";
|
|
4
|
+
import {Button} from "antd";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: React.CSSProperties
|
|
8
|
+
hidePrevNextButton?: boolean
|
|
9
|
+
|
|
10
|
+
onPrevRecord?(): void
|
|
11
|
+
|
|
12
|
+
onNextRecord?(): void
|
|
13
|
+
|
|
14
|
+
onClose?(): void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default class DetailHeaderPanel extends React.Component<Props> {
|
|
18
|
+
constructor(props: Readonly<Props>) {
|
|
19
|
+
super(props);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
render() {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className="d2-drawer-header"
|
|
26
|
+
style={{
|
|
27
|
+
padding: "8px 4px 8px 12px",
|
|
28
|
+
display: "flex",
|
|
29
|
+
justifyContent: "space-between",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
...this.props.style
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<div>
|
|
35
|
+
<ProfileOutlined/> {i18n("Detail")}
|
|
36
|
+
</div>
|
|
37
|
+
<div>
|
|
38
|
+
{!this.props.hidePrevNextButton &&
|
|
39
|
+
<Button.Group style={{marginTop: -4}}>
|
|
40
|
+
<Button title={i18n("Previous Record")} onClick={this.props.onPrevRecord}>
|
|
41
|
+
<ArrowUpOutlined/>
|
|
42
|
+
</Button>
|
|
43
|
+
<Button title={i18n("Next Record")} onClick={this.props.onNextRecord}>
|
|
44
|
+
<ArrowDownOutlined/>
|
|
45
|
+
</Button>
|
|
46
|
+
</Button.Group>
|
|
47
|
+
}
|
|
48
|
+
<Button
|
|
49
|
+
title={i18n("Close")}
|
|
50
|
+
type="text"
|
|
51
|
+
onClick={this.props.onClose}
|
|
52
|
+
>
|
|
53
|
+
<CloseOutlined/>
|
|
54
|
+
</Button>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {CopyOutlined, FileOutlined, FilePdfOutlined, FileTextOutlined} from "@ant-design/icons";
|
|
2
|
+
import {MenuProps, Switch} from "antd";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import i18n from "d2core/i18n/i18n";
|
|
5
|
+
import {spawn, Thread, Worker} from "threads"
|
|
6
|
+
import dayjs from "dayjs";
|
|
7
|
+
import ProgressPopup from "./progressPopup";
|
|
8
|
+
import {MenuElement} from "../dataGrid";
|
|
9
|
+
import {ClipboardUtils} from "d2coreui/components/clipboard/clipboardUtils";
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import txtExportUrl from 'threads-plugin/dist/loader?name=txtExport!d2coreui/components/grid/export/worker/txtExport.ts'
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
import csvExportUrl from "threads-plugin/dist/loader?name=csvExport!d2coreui/components/grid/export/worker/csvExport.ts"
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
import clipboardExportUrl from "threads-plugin/dist/loader?name=clipboardExport!d2coreui/components/grid/export/worker/clipboardExport.ts"
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
import pdfExportUrl from "threads-plugin/dist/loader?name=pdfExport!d2coreui/components/grid/export/worker/pdfExport.ts"
|
|
18
|
+
import PlatformSpecific from "d2coreui/components/platformSpecific";
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export interface ContextMenuProps {
|
|
22
|
+
onlySelectedNodes?: boolean
|
|
23
|
+
showMilliseconds: boolean
|
|
24
|
+
showYear: boolean
|
|
25
|
+
hideNotificationOnClipboardCopy?: boolean
|
|
26
|
+
pageOrientation: PageOrientation
|
|
27
|
+
exporting: boolean
|
|
28
|
+
|
|
29
|
+
getExportContent: (progressPopup: ProgressPopup | null, props: ContextMenuProps) => Promise<string[][]>
|
|
30
|
+
onPageOrientationChange:(pageOrientation: PageOrientation)=>void
|
|
31
|
+
onExport:(start: boolean)=>void
|
|
32
|
+
|
|
33
|
+
// overrides context menu rendering
|
|
34
|
+
renderer?(menuElements: MenuElement[]): MenuElement[]
|
|
35
|
+
|
|
36
|
+
// handler for custom context menu items click
|
|
37
|
+
onClick?(key: string): void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type PageOrientation = "PORTRAIT" | "LANDSCAPE";
|
|
41
|
+
|
|
42
|
+
export default function getContextMenu(props: ContextMenuProps): MenuProps {
|
|
43
|
+
const {hideNotificationOnClipboardCopy, getExportContent, renderer, onClick} = props;
|
|
44
|
+
|
|
45
|
+
const onExportMenuClick = async (menuKey: string) => {
|
|
46
|
+
props.onExport(true);
|
|
47
|
+
switch (menuKey) {
|
|
48
|
+
case "txtExport": {
|
|
49
|
+
const progressPopup = new ProgressPopup(i18n("Export List to") + " TXT");
|
|
50
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
51
|
+
const txtExport = await spawn(new Worker(txtExportUrl));
|
|
52
|
+
const textContent = await txtExport(tableContent);
|
|
53
|
+
await Thread.terminate(txtExport);
|
|
54
|
+
await progressPopup.update(100);
|
|
55
|
+
PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format("YYYYMMDD_HHmm")}.txt`, textContent, true);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "csvExport": {
|
|
59
|
+
const progressPopup = new ProgressPopup(i18n("Export List to") + " CSV");
|
|
60
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
61
|
+
const csvExport = await spawn(new Worker(csvExportUrl));
|
|
62
|
+
const csvContent = await csvExport(tableContent);
|
|
63
|
+
await Thread.terminate(csvExport);
|
|
64
|
+
await progressPopup.update(100);
|
|
65
|
+
PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format("YYYYMMDD_HHmm")}.csv`, `\ufeff${csvContent}`, true);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "clipboardCopy": {
|
|
69
|
+
const progressPopup = !hideNotificationOnClipboardCopy ? new ProgressPopup(i18n("Export List to") + " " + i18n("Clipboard")) : null;
|
|
70
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
71
|
+
const clipboardExport = await spawn(new Worker(clipboardExportUrl));
|
|
72
|
+
const clipboardContent = await clipboardExport(tableContent);
|
|
73
|
+
const success = ClipboardUtils.copyToClipboard(clipboardContent);
|
|
74
|
+
if (success) {
|
|
75
|
+
await Thread.terminate(clipboardExport);
|
|
76
|
+
await progressPopup?.update(100);
|
|
77
|
+
} else {
|
|
78
|
+
progressPopup?.error();
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case "pdfExport": {
|
|
83
|
+
const progressPopup = new ProgressPopup(i18n("Export List to") + " PDF");
|
|
84
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
85
|
+
const pdfExport = await spawn(new Worker(pdfExportUrl));
|
|
86
|
+
pdfExport.handler().subscribe(async (data: string) => {
|
|
87
|
+
Thread.terminate(pdfExport);
|
|
88
|
+
await progressPopup.update(100);
|
|
89
|
+
PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format("YYYYMMDD_HHmm")}.pdf`, data, false);
|
|
90
|
+
});
|
|
91
|
+
pdfExport.export(tableContent, {pageOrientation: props.pageOrientation});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
props.onExport(false);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let menuItems: MenuElement[] = [
|
|
98
|
+
{
|
|
99
|
+
key: "txtExport",
|
|
100
|
+
icon: <FileOutlined/>,
|
|
101
|
+
disabled: props.exporting,
|
|
102
|
+
label: i18n("Export List to") + " TXT",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
key: "csvExport",
|
|
106
|
+
icon: <FileTextOutlined/>,
|
|
107
|
+
disabled: props.exporting,
|
|
108
|
+
label: i18n("Export List to") + " CSV",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
key: "pdfExport",
|
|
112
|
+
icon: <FilePdfOutlined/>,
|
|
113
|
+
disabled: props.exporting,
|
|
114
|
+
label: <>
|
|
115
|
+
{i18n("Export List to") + " PDF"}
|
|
116
|
+
<Switch
|
|
117
|
+
style={{marginLeft: 8}}
|
|
118
|
+
checkedChildren={i18n("Landscape") + " "}
|
|
119
|
+
unCheckedChildren={"" + i18n("Portrait")}
|
|
120
|
+
checked={props.pageOrientation !== "PORTRAIT"}
|
|
121
|
+
onChange={(checked, e) => {
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
(e as any).nativeEvent.stopImmediatePropagation();
|
|
124
|
+
props.onPageOrientationChange(checked ? "LANDSCAPE" : "PORTRAIT")
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
</>
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
key: "divider1",
|
|
131
|
+
type: "divider",
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: "clipboardCopy",
|
|
135
|
+
icon: <CopyOutlined/>,
|
|
136
|
+
disabled: props.exporting,
|
|
137
|
+
label: i18n("Copy to Clipboard"),
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
if (renderer) {
|
|
142
|
+
menuItems = renderer(menuItems);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
items: menuItems,
|
|
147
|
+
onClick: (item) => {
|
|
148
|
+
onExportMenuClick(item.key);
|
|
149
|
+
if (onClick) {
|
|
150
|
+
onClick(item.key.toString());
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {LoadingOutlined} from "@ant-design/icons";
|
|
3
|
+
import {notification, Progress} from "antd";
|
|
4
|
+
import i18n from "d2core/i18n/i18n";
|
|
5
|
+
import {ProgressProps} from "antd/lib/progress/progress";
|
|
6
|
+
|
|
7
|
+
interface ProgressBarProps extends ProgressProps {
|
|
8
|
+
registerUpdateHandler(updateHandler: ((percent: number) => void) | null): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ProgressBarState {
|
|
12
|
+
percent: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class ProgressBar extends React.Component<ProgressBarProps, ProgressBarState> {
|
|
16
|
+
constructor(props: Readonly<ProgressBarProps>) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.state = {
|
|
19
|
+
percent: 0,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
componentDidMount() {
|
|
24
|
+
if (this.props.registerUpdateHandler) {
|
|
25
|
+
this.props.registerUpdateHandler(this.makeProgress.bind(this));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
componentWillUnmount() {
|
|
30
|
+
if (this.props.registerUpdateHandler) {
|
|
31
|
+
this.props.registerUpdateHandler(null);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
makeProgress(percent: number) {
|
|
36
|
+
this.setState({percent: percent});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
const {registerUpdateHandler, ...rest} = this.props;
|
|
41
|
+
return <Progress percent={this.state.percent} {...rest}/>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default class ProgressPopup {
|
|
46
|
+
title: string;
|
|
47
|
+
recordCount?: number;
|
|
48
|
+
makeProgress: ((percent: number) => void) | null = null;
|
|
49
|
+
progressVisible: boolean = false;
|
|
50
|
+
|
|
51
|
+
constructor(title: string) {
|
|
52
|
+
this.title = title;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async initializeProgressPopup() {
|
|
56
|
+
notification.open({
|
|
57
|
+
message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", {n: "" + this.recordCount})),
|
|
58
|
+
key: "export",
|
|
59
|
+
description: <ProgressBar registerUpdateHandler={(makeProgress) => {
|
|
60
|
+
this.makeProgress = makeProgress;
|
|
61
|
+
}}/>,
|
|
62
|
+
icon: <LoadingOutlined/>,
|
|
63
|
+
duration: 0
|
|
64
|
+
});
|
|
65
|
+
this.progressVisible = true;
|
|
66
|
+
await this.sleep(100);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setRecordCount(recordCount: number) {
|
|
70
|
+
this.recordCount = recordCount;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async update(progressPercent: number) {
|
|
74
|
+
if (!this.progressVisible) {
|
|
75
|
+
await this.initializeProgressPopup();
|
|
76
|
+
}
|
|
77
|
+
if (progressPercent === 100) {
|
|
78
|
+
this.close();
|
|
79
|
+
}
|
|
80
|
+
if (this.makeProgress) {
|
|
81
|
+
this.makeProgress(progressPercent);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
close() {
|
|
86
|
+
notification.success({
|
|
87
|
+
message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", {n: "" + this.recordCount})),
|
|
88
|
+
key: "export",
|
|
89
|
+
description: <Progress percent={100}/>
|
|
90
|
+
});
|
|
91
|
+
this.progressVisible = false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
error() {
|
|
95
|
+
notification.error({
|
|
96
|
+
message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", {n: "" + this.recordCount})),
|
|
97
|
+
key: "export",
|
|
98
|
+
description: <Progress status={"exception"} percent={100}/>
|
|
99
|
+
});
|
|
100
|
+
this.progressVisible = false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
sleep(ms: number): Promise<void> {
|
|
104
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {expose} from "threads/worker"
|
|
2
|
+
import pdfMake from "pdfmake/build/pdfmake";
|
|
3
|
+
import {PageOrientation, TDocumentDefinitions} from "pdfmake/interfaces";
|
|
4
|
+
import pdfFonts from "pdfmake/build/vfs_fonts";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
import {Observable, Subject} from "threads/observable"
|
|
7
|
+
import {LocaleHolder} from "d2core/i18n/localeHolder";
|
|
8
|
+
|
|
9
|
+
pdfMake.vfs = pdfFonts.pdfMake.vfs;
|
|
10
|
+
|
|
11
|
+
interface PageConfig {
|
|
12
|
+
pageOrientation: PageOrientation
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type TableCell = string | { text: string, style: string }
|
|
16
|
+
|
|
17
|
+
function getPdfConfig(tableData: TableCell[][], pageConfig: PageConfig): TDocumentDefinitions {
|
|
18
|
+
// styling header
|
|
19
|
+
tableData[0] = tableData[0].map((value) => {
|
|
20
|
+
return {text: value as string, style: 'tableHeader'};
|
|
21
|
+
});
|
|
22
|
+
// escaping empty data
|
|
23
|
+
tableData.forEach((row) => {
|
|
24
|
+
row.forEach((value, index) => {
|
|
25
|
+
if (value === undefined || value === null) {
|
|
26
|
+
row[index] = "";
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
content: [{
|
|
32
|
+
style: 'tableExample',
|
|
33
|
+
table: {
|
|
34
|
+
headerRows: 1,
|
|
35
|
+
// dontBreakRows: true,
|
|
36
|
+
// keepWithHeaderRows: 1,
|
|
37
|
+
body: tableData
|
|
38
|
+
}
|
|
39
|
+
}],
|
|
40
|
+
styles: {
|
|
41
|
+
header: {
|
|
42
|
+
fontSize: 10,
|
|
43
|
+
bold: true,
|
|
44
|
+
margin: [0, 0, 0, 10]
|
|
45
|
+
},
|
|
46
|
+
subheader: {
|
|
47
|
+
fontSize: 9,
|
|
48
|
+
bold: true,
|
|
49
|
+
margin: [0, 10, 0, 5]
|
|
50
|
+
},
|
|
51
|
+
tableExample: {
|
|
52
|
+
margin: [0, 5, 0, 15],
|
|
53
|
+
|
|
54
|
+
},
|
|
55
|
+
tableHeader: {
|
|
56
|
+
bold: true,
|
|
57
|
+
fontSize: 10,
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultStyle: {
|
|
61
|
+
// alignment: 'justify',
|
|
62
|
+
fontSize: 10,
|
|
63
|
+
},
|
|
64
|
+
footer: function (currentPage: number, pageCount: number) {
|
|
65
|
+
return {
|
|
66
|
+
table: {
|
|
67
|
+
widths: ['*'],
|
|
68
|
+
body: [
|
|
69
|
+
[
|
|
70
|
+
{text: `${currentPage}/${pageCount}`, alignment: 'center'},
|
|
71
|
+
]
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
layout: 'noBorders'
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
info: {
|
|
78
|
+
title: `Export ${dayjs().format(LocaleHolder.getDateTimeFormat(true, true))}`,
|
|
79
|
+
author: 'D2000',
|
|
80
|
+
},
|
|
81
|
+
pageOrientation: pageConfig.pageOrientation
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const subject = new Subject();
|
|
86
|
+
const pdfExport = {
|
|
87
|
+
export(tableData: TableCell[][], pageConfig: PageConfig) {
|
|
88
|
+
pdfMake.createPdf(getPdfConfig(tableData, pageConfig)).getBase64((data) => {
|
|
89
|
+
subject.next(data);
|
|
90
|
+
subject.complete();
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
handler() {
|
|
94
|
+
return Observable.from(subject);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
expose(pdfExport);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {expose} from "threads/worker"
|
|
2
|
+
import padEnd from "lodash/padEnd";
|
|
3
|
+
|
|
4
|
+
function txtExport(tableData:string[][]) {
|
|
5
|
+
let cellLengths = tableData[0].map((cell) => cell ? cell.length : 0);
|
|
6
|
+
cellLengths = tableData.reduce((result, row) => {
|
|
7
|
+
row.forEach((cell, index) => {
|
|
8
|
+
result[index] = Math.max(result[index], cell ? cell.length : 0);
|
|
9
|
+
});
|
|
10
|
+
return result;
|
|
11
|
+
}, cellLengths);
|
|
12
|
+
const textContent = tableData.map((row, index) => {
|
|
13
|
+
const rowContent = row.map((cell, index) => {
|
|
14
|
+
return padEnd(cell, cellLengths[index] + 1);
|
|
15
|
+
}).join("");
|
|
16
|
+
return index === 0 ? rowContent + "\r\n" + padEnd("", cellLengths.reduce((total, cellLength) => total + cellLength + 1, 0), "-") : rowContent;
|
|
17
|
+
}).join("\r\n");
|
|
18
|
+
return textContent;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
expose(txtExport);
|