d2coreui 21.0.33 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/clipboard/clipboardUtils.d.ts +4 -3
- package/components/clipboard/clipboardUtils.js +47 -22
- package/components/clipboard/clipboardUtils.js.map +1 -1
- package/components/codemirror/SyntaxHighlighter.d.ts +21 -21
- package/components/codemirror/SyntaxHighlighter.js +45 -44
- package/components/codemirror/SyntaxHighlighter.js.map +1 -1
- package/components/collapse/expandable.d.ts +13 -12
- package/components/collapse/expandable.js +20 -20
- package/components/collapse/expandable.js.map +1 -1
- package/components/color/colorPicker.d.ts +20 -20
- package/components/color/colorPicker.js +53 -53
- package/components/color/colorPicker.js.map +1 -1
- package/components/color/colorSwatch.d.ts +13 -12
- package/components/color/colorSwatch.js +62 -62
- package/components/color/colorSwatch.js.map +1 -1
- package/components/color/colorUtils.d.ts +7 -7
- package/components/color/colorUtils.js +43 -43
- package/components/color/colorUtils.js.map +1 -1
- package/components/date/dateRangeInput.d.ts +66 -64
- package/components/date/dateRangeInput.js +292 -297
- package/components/date/dateRangeInput.js.map +1 -1
- package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -26
- package/components/date/dateRangeInputAdvancedPanel.js +130 -115
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateRangeInputConfirm.d.ts +31 -29
- package/components/date/dateRangeInputConfirm.js +132 -121
- package/components/date/dateRangeInputConfirm.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +72 -69
- package/components/date/dateTimeInput.js +440 -412
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.d.ts +59 -56
- package/components/date/durationInput.js +269 -280
- package/components/date/durationInput.js.map +1 -1
- package/components/form/NiceFormItem.d.ts +14 -14
- package/components/form/NiceFormItem.js +28 -31
- package/components/form/NiceFormItem.js.map +1 -1
- package/components/grid/cell/beanAccessor.d.ts +9 -0
- package/components/grid/cell/beanAccessor.js +13 -0
- package/components/grid/cell/beanAccessor.js.map +1 -0
- package/components/grid/cell/cellEditorUtils.d.ts +4 -4
- package/components/grid/cell/cellEditorUtils.js +8 -8
- package/components/grid/cell/customEnumCellEditor.d.ts +4 -26
- package/components/grid/cell/customEnumCellEditor.js +82 -91
- package/components/grid/cell/customEnumCellEditor.js.map +1 -1
- package/components/grid/cell/dataGridCellEditorComponent.d.ts +14 -0
- package/components/grid/cell/dataGridCellEditorComponent.js +49 -0
- package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -0
- package/components/grid/cell/dateCellEditor.d.ts +4 -25
- package/components/grid/cell/dateCellEditor.js +53 -72
- package/components/grid/cell/dateCellEditor.js.map +1 -1
- package/components/grid/cell/durationCellEditor.d.ts +4 -24
- package/components/grid/cell/durationCellEditor.js +74 -97
- package/components/grid/cell/durationCellEditor.js.map +1 -1
- package/components/grid/cell/hexaOctetStringCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaOctetStringCellEditor.js +70 -94
- package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
- package/components/grid/cell/hexaValueCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaValueCellEditor.js +65 -89
- package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
- package/components/grid/cell/numberCellEditor.d.ts +4 -27
- package/components/grid/cell/numberCellEditor.js +73 -95
- package/components/grid/cell/numberCellEditor.js.map +1 -1
- package/components/grid/cell/rangeSelector.d.ts +78 -78
- package/components/grid/cell/rangeSelector.js +526 -518
- package/components/grid/cell/rangeSelector.js.map +1 -1
- package/components/grid/cell/simpleStatusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/simpleStatusTextCellEditor.js +106 -116
- package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
- package/components/grid/cell/statusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/statusTextCellEditor.js +136 -159
- package/components/grid/cell/statusTextCellEditor.js.map +1 -1
- package/components/grid/cell/tableDefaultRowStyleRules.d.ts +20 -20
- package/components/grid/cell/tableDefaultRowStyleRules.js +29 -18
- package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
- package/components/grid/cell/textCellEditor.d.ts +4 -21
- package/components/grid/cell/textCellEditor.js +63 -85
- package/components/grid/cell/textCellEditor.js.map +1 -1
- package/components/grid/cell/withAgGridHooks.d.ts +3 -0
- package/components/grid/cell/withAgGridHooks.js +15 -0
- package/components/grid/cell/withAgGridHooks.js.map +1 -0
- package/components/grid/columnUtils.d.ts +5 -5
- package/components/grid/columnUtils.js +26 -26
- package/components/grid/columnUtils.js.map +1 -1
- package/components/grid/config/columnTransfer.d.ts +21 -22
- package/components/grid/config/columnTransfer.js +205 -201
- package/components/grid/config/columnTransfer.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +41 -41
- package/components/grid/config/dataGridEditor.js +181 -160
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/config/rowHeightCalculator.d.ts +8 -0
- package/components/grid/config/rowHeightCalculator.js +20 -0
- package/components/grid/config/rowHeightCalculator.js.map +1 -0
- package/components/grid/config/rowStylePicker.d.ts +27 -25
- package/components/grid/config/rowStylePicker.js +127 -109
- package/components/grid/config/rowStylePicker.js.map +1 -1
- package/components/grid/dataGrid.d.ts +218 -206
- package/components/grid/dataGrid.js +1629 -1538
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/detail/detailHeaderPanel.d.ts +13 -13
- package/components/grid/detail/detailHeaderPanel.js +25 -25
- package/components/grid/detail/detailHeaderPanel.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +18 -24
- package/components/grid/export/contextMenu.js +116 -113
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/progressPopup.d.ts +29 -29
- package/components/grid/export/progressPopup.js +93 -93
- package/components/grid/export/progressPopup.js.map +1 -1
- package/components/grid/export/worker/clipboardExport.d.ts +1 -1
- package/components/grid/export/worker/clipboardExport.js +8 -8
- package/components/grid/export/worker/csvExport.d.ts +1 -1
- package/components/grid/export/worker/csvExport.js +8 -8
- package/components/grid/export/worker/pdfExport.d.ts +1 -1
- package/components/grid/export/worker/pdfExport.js +81 -81
- package/components/grid/export/worker/pdfExport.js.map +1 -1
- package/components/grid/export/worker/txtExport.d.ts +1 -1
- package/components/grid/export/worker/txtExport.js +19 -19
- package/components/grid/extendedDataGrid.d.ts +140 -140
- package/components/grid/extendedDataGrid.js +704 -695
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/grid/filter/customColumnFilter.d.ts +5 -21
- package/components/grid/filter/customColumnFilter.js +11 -82
- package/components/grid/filter/customColumnFilter.js.map +1 -1
- package/components/grid/filter/dataGridColumnFilter.d.ts +17 -0
- package/components/grid/filter/dataGridColumnFilter.js +49 -0
- package/components/grid/filter/dataGridColumnFilter.js.map +1 -0
- package/components/grid/filter/dateColumnFilter.d.ts +7 -11
- package/components/grid/filter/dateColumnFilter.js +22 -56
- package/components/grid/filter/dateColumnFilter.js.map +1 -1
- package/components/grid/filter/textColumnFilter.d.ts +8 -20
- package/components/grid/filter/textColumnFilter.js +24 -76
- package/components/grid/filter/textColumnFilter.js.map +1 -1
- package/components/grid/filter/wildcardQuickFilterEngine.d.ts +7 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js +48 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -0
- package/components/grid/header/simpleHeader.d.ts +17 -16
- package/components/grid/header/simpleHeader.js +230 -186
- package/components/grid/header/simpleHeader.js.map +1 -1
- package/components/grid/panel/dataGridPagination.d.ts +16 -16
- package/components/grid/panel/dataGridPagination.js +58 -58
- package/components/grid/panel/dataGridPagination.js.map +1 -1
- package/components/grid/panel/loadingOverlay.d.ts +6 -6
- package/components/grid/panel/loadingOverlay.js +10 -10
- package/components/grid/panel/loadingOverlay.js.map +1 -1
- package/components/grid/panel/noRecordsOverlay.d.ts +6 -6
- package/components/grid/panel/noRecordsOverlay.js +10 -10
- package/components/grid/panel/noRecordsOverlay.js.map +1 -1
- package/components/grid/panel/tablePagination.d.ts +10 -10
- package/components/grid/panel/tablePagination.js +45 -45
- package/components/grid/panel/tablePagination.js.map +1 -1
- package/components/icons/dropdownArrow.d.ts +8 -0
- package/components/icons/dropdownArrow.js +59 -0
- package/components/icons/dropdownArrow.js.map +1 -0
- package/components/icons/undoIcon.d.ts +8 -8
- package/components/icons/undoIcon.js +6 -6
- package/components/input/autoCompleteInput.d.ts +35 -35
- package/components/input/autoCompleteInput.js +122 -121
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/input/draftUtils.d.ts +4 -4
- package/components/input/draftUtils.js +48 -48
- package/components/input/draftUtils.js.map +1 -1
- package/components/input/draftail.d.ts +1 -1
- package/components/input/draftail.js +1 -1
- package/components/input/hexaFormattedInput.d.ts +16 -16
- package/components/input/hexaFormattedInput.js +54 -54
- package/components/input/hexaFormattedInput.js.map +1 -1
- package/components/input/mask/helpers.d.ts +28 -28
- package/components/input/mask/helpers.js +112 -112
- package/components/input/mask/helpers.js.map +1 -1
- package/components/input/mask/inputMaskCore.d.ts +46 -46
- package/components/input/mask/inputMaskCore.js +278 -278
- package/components/input/mask/inputMaskCore.js.map +1 -1
- package/components/input/mask/pattern.d.ts +20 -20
- package/components/input/mask/pattern.js +78 -78
- package/components/input/mask/pattern.js.map +1 -1
- package/components/input/maskedInput.d.ts +373 -351
- package/components/input/maskedInput.js +224 -224
- package/components/input/maskedInput.js.map +1 -1
- package/components/input/passwordInput.d.ts +9 -9
- package/components/input/passwordInput.js +55 -55
- package/components/input/passwordInput.js.map +1 -1
- package/components/input/simpleAutoComplete.d.ts +12 -12
- package/components/input/simpleAutoComplete.js +41 -43
- package/components/input/simpleAutoComplete.js.map +1 -1
- package/components/input/textarea/extractSpansOfClasses.d.ts +15 -15
- package/components/input/textarea/extractSpansOfClasses.js +96 -96
- package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
- package/components/input/textarea/getRanges.d.ts +1 -1
- package/components/input/textarea/getRanges.js +73 -73
- package/components/input/textarea/getRanges.js.map +1 -1
- package/components/input/textarea/getType.d.ts +1 -1
- package/components/input/textarea/getType.js +26 -26
- package/components/input/textarea/getType.js.map +1 -1
- package/components/input/textarea/highlighedContents.d.ts +6 -6
- package/components/input/textarea/highlighedContents.js +10 -10
- package/components/input/textarea/mentionsWithHighlighting.d.ts +27 -27
- package/components/input/textarea/mentionsWithHighlighting.js +60 -60
- package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
- package/components/keyboard/keyboardUtils.d.ts +5 -5
- package/components/keyboard/keyboardUtils.js +32 -32
- package/components/modal/draggableModalProvider.d.ts +4 -4
- package/components/modal/draggableModalProvider.js +21 -21
- package/components/modal/draggableModalProvider.js.map +1 -1
- package/components/modal/impl/clamp.d.ts +1 -1
- package/components/modal/impl/clamp.js +1 -1
- package/components/modal/impl/clamp.js.map +1 -1
- package/components/modal/impl/draggableModal.d.ts +12 -12
- package/components/modal/impl/draggableModal.js +17 -17
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalContext.d.ts +9 -9
- package/components/modal/impl/draggableModalContext.js +2 -2
- package/components/modal/impl/draggableModalContext.js.map +1 -1
- package/components/modal/impl/draggableModalInner.d.ts +15 -13
- package/components/modal/impl/draggableModalInner.js +57 -55
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +66 -62
- package/components/modal/impl/draggableModalReducer.js +77 -78
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/getWindowSize.d.ts +4 -4
- package/components/modal/impl/getWindowSize.js +4 -4
- package/components/modal/impl/getWindowSize.js.map +1 -1
- package/components/modal/impl/index.d.ts +3 -3
- package/components/modal/impl/index.js +3 -3
- package/components/modal/impl/index.js.map +1 -1
- package/components/modal/impl/resizeHandle.d.ts +3 -3
- package/components/modal/impl/resizeHandle.js +4 -4
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/impl/useDrag.d.ts +5 -5
- package/components/modal/impl/useDrag.js +42 -42
- package/components/modal/impl/useDrag.js.map +1 -1
- package/components/modal/impl/usePrevious.d.ts +1 -1
- package/components/modal/impl/usePrevious.js +8 -8
- package/components/modal/impl/usePrevious.js.map +1 -1
- package/components/modal/impl/useResize.d.ts +7 -7
- package/components/modal/impl/useResize.js +46 -46
- package/components/modal/impl/useResize.js.map +1 -1
- package/components/modal/modalDialog.d.ts +49 -49
- package/components/modal/modalDialog.js +152 -152
- package/components/modal/modalDialog.js.map +1 -1
- package/components/picker/enumValuePicker.d.ts +16 -16
- package/components/picker/enumValuePicker.js +34 -34
- package/components/picker/enumValuePicker.js.map +1 -1
- package/components/platformSpecific.d.ts +10 -10
- package/components/platformSpecific.js +27 -27
- package/components/scrollTo/onlyText.d.ts +4 -4
- package/components/scrollTo/onlyText.js +30 -30
- package/components/scrollTo/onlyText.js.map +1 -1
- package/components/scrollTo/scrollTo.d.ts +41 -39
- package/components/scrollTo/scrollTo.js +264 -264
- package/components/scrollTo/scrollTo.js.map +1 -1
- package/components/style/withCss.d.ts +9 -0
- package/components/style/withCss.js +6 -0
- package/components/style/withCss.js.map +1 -0
- package/components/style/withInputNumberCss.d.ts +6 -0
- package/components/style/withInputNumberCss.js +13 -0
- package/components/style/withInputNumberCss.js.map +1 -0
- package/components/table/dragSortingTable.d.ts +13 -14
- package/components/table/dragSortingTable.js +96 -82
- package/components/table/dragSortingTable.js.map +1 -1
- package/components/text/impl/innerSize.d.ts +2 -2
- package/components/text/impl/innerSize.js +12 -12
- package/components/text/impl/series.d.ts +1 -1
- package/components/text/impl/series.js +28 -28
- package/components/text/impl/shallowEqual.d.ts +1 -1
- package/components/text/impl/shallowEqual.js +18 -18
- package/components/text/impl/shallowEqual.js.map +1 -1
- package/components/text/impl/uniqueId.d.ts +1 -1
- package/components/text/impl/uniqueId.js +4 -4
- package/components/text/impl/whilst.d.ts +1 -1
- package/components/text/impl/whilst.js +19 -19
- package/components/text/impl/whilst.js.map +1 -1
- package/components/text/textFit.d.ts +38 -38
- package/components/text/textFit.js +165 -168
- package/components/text/textFit.js.map +1 -1
- package/i18n/components.cs.json +101 -100
- package/i18n/components.sk.json +101 -100
- package/i18n/components.uk.json +101 -100
- package/i18n/componentsLocaleHolder.d.ts +3 -3
- package/i18n/componentsLocaleHolder.js +28 -28
- package/i18n/componentsLocaleHolder.js.map +1 -1
- package/package.json +71 -70
- package/style/index.less +274 -298
- package/style/modal/DraggableModal.css +43 -40
- package/style/modal/ResizeHandle.css +27 -19
- package/tsconfig.build.json +24 -24
- package/tsconfig.json +11 -11
- package/components/grid/cell/wildcardQuickFilter.d.ts +0 -11
- package/components/grid/cell/wildcardQuickFilter.js +0 -61
- package/components/grid/cell/wildcardQuickFilter.js.map +0 -1
- package/components/table/dataTable.d.ts +0 -17
- package/components/table/dataTable.js +0 -79
- package/components/table/dataTable.js.map +0 -1
- package/style/antd/antd-tree-showline.css +0 -25
- package/style/antd/full-height-tabs.scss +0 -63
- package/style/draftail/draftail-editor.css +0 -179
- package/style/table/dragSortingTable.css +0 -7
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface Props {
|
|
3
|
-
style?: React.CSSProperties;
|
|
4
|
-
hidePrevNextButton?: boolean;
|
|
5
|
-
onPrevRecord?(): void;
|
|
6
|
-
onNextRecord?(): void;
|
|
7
|
-
onClose?(): void;
|
|
8
|
-
}
|
|
9
|
-
export default class DetailHeaderPanel extends React.Component<Props> {
|
|
10
|
-
constructor(props: Readonly<Props>);
|
|
11
|
-
render(): JSX.Element;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
style?: React.CSSProperties;
|
|
4
|
+
hidePrevNextButton?: boolean;
|
|
5
|
+
onPrevRecord?(): void;
|
|
6
|
+
onNextRecord?(): void;
|
|
7
|
+
onClose?(): void;
|
|
8
|
+
}
|
|
9
|
+
export default class DetailHeaderPanel extends React.Component<Props> {
|
|
10
|
+
constructor(props: Readonly<Props>);
|
|
11
|
+
render(): React.JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -1,26 +1,26 @@
|
|
|
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
|
-
export default class DetailHeaderPanel extends React.Component {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super(props);
|
|
8
|
-
}
|
|
9
|
-
render() {
|
|
10
|
-
return (React.createElement("div", { className: "
|
|
11
|
-
React.createElement("div", null,
|
|
12
|
-
React.createElement(ProfileOutlined, null),
|
|
13
|
-
" ",
|
|
14
|
-
i18n("Detail")),
|
|
15
|
-
React.createElement("div", null,
|
|
16
|
-
!this.props.hidePrevNextButton &&
|
|
17
|
-
React.createElement(Button.Group, { style: { marginTop: -4 } },
|
|
18
|
-
React.createElement(Button, { title: i18n("Previous Record"), onClick: this.props.onPrevRecord },
|
|
19
|
-
React.createElement(ArrowUpOutlined, null)),
|
|
20
|
-
React.createElement(Button, { title: i18n("Next Record"), onClick: this.props.onNextRecord },
|
|
21
|
-
React.createElement(ArrowDownOutlined, null))),
|
|
22
|
-
React.createElement(Button, { title: i18n("Close"), type: "text", onClick: this.props.onClose },
|
|
23
|
-
React.createElement(CloseOutlined, null)))));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
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
|
+
export default class DetailHeaderPanel extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
|
+
return (React.createElement("div", { className: "d2-drawer-header", style: Object.assign({ padding: "8px 4px 8px 12px", display: "flex", justifyContent: "space-between", alignItems: "center" }, this.props.style) },
|
|
11
|
+
React.createElement("div", null,
|
|
12
|
+
React.createElement(ProfileOutlined, null),
|
|
13
|
+
" ",
|
|
14
|
+
i18n("Detail")),
|
|
15
|
+
React.createElement("div", null,
|
|
16
|
+
!this.props.hidePrevNextButton &&
|
|
17
|
+
React.createElement(Button.Group, { style: { marginTop: -4 } },
|
|
18
|
+
React.createElement(Button, { title: i18n("Previous Record"), onClick: this.props.onPrevRecord },
|
|
19
|
+
React.createElement(ArrowUpOutlined, null)),
|
|
20
|
+
React.createElement(Button, { title: i18n("Next Record"), onClick: this.props.onNextRecord },
|
|
21
|
+
React.createElement(ArrowDownOutlined, null))),
|
|
22
|
+
React.createElement(Button, { title: i18n("Close"), type: "text", onClick: this.props.onClose },
|
|
23
|
+
React.createElement(CloseOutlined, null)))));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
26
|
//# sourceMappingURL=detailHeaderPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detailHeaderPanel.js","sourceRoot":"","sources":["../../../../../components/grid/detail/detailHeaderPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACrG,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAa5B,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,KAAK,CAAC,SAAgB;IACjE,YAAY,KAAsB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,MAAM;QACF,OAAO,CACH,6BACI,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"detailHeaderPanel.js","sourceRoot":"","sources":["../../../../../components/grid/detail/detailHeaderPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO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esContent":["import React from \"react\";\r\nimport {ArrowDownOutlined, ArrowUpOutlined, CloseOutlined, ProfileOutlined} from \"@ant-design/icons\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {Button} from \"antd\";\r\n\r\ninterface Props {\r\n style?: React.CSSProperties\r\n hidePrevNextButton?: boolean\r\n\r\n onPrevRecord?(): void\r\n\r\n onNextRecord?(): void\r\n\r\n onClose?(): void\r\n}\r\n\r\nexport default class DetailHeaderPanel extends React.Component<Props> {\r\n constructor(props: Readonly<Props>) {\r\n super(props);\r\n }\r\n\r\n render() {\r\n return (\r\n <div\r\n className=\"d2-drawer-header\"\r\n style={{\r\n padding: \"8px 4px 8px 12px\",\r\n display: \"flex\",\r\n justifyContent: \"space-between\",\r\n alignItems: \"center\",\r\n ...this.props.style\r\n }}\r\n >\r\n <div>\r\n <ProfileOutlined/> {i18n(\"Detail\")}\r\n </div>\r\n <div>\r\n {!this.props.hidePrevNextButton &&\r\n <Button.Group style={{marginTop: -4}}>\r\n <Button title={i18n(\"Previous Record\")} onClick={this.props.onPrevRecord}>\r\n <ArrowUpOutlined/>\r\n </Button>\r\n <Button title={i18n(\"Next Record\")} onClick={this.props.onNextRecord}>\r\n <ArrowDownOutlined/>\r\n </Button>\r\n </Button.Group>\r\n }\r\n <Button\r\n title={i18n(\"Close\")}\r\n type=\"text\"\r\n onClick={this.props.onClose}\r\n >\r\n <CloseOutlined/>\r\n </Button>\r\n </div>\r\n </div>\r\n );\r\n }\r\n}"]}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ProgressPopup from "./progressPopup";
|
|
3
|
-
import { MenuElement } from "../dataGrid";
|
|
4
|
-
export interface ContextMenuProps {
|
|
5
|
-
onlySelectedNodes?: boolean;
|
|
6
|
-
showMilliseconds: boolean;
|
|
7
|
-
showYear: boolean;
|
|
8
|
-
hideNotificationOnClipboardCopy?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export default
|
|
19
|
-
constructor(props: Readonly<ContextMenuProps>);
|
|
20
|
-
onExportMenuClick(menuKey: string): Promise<void>;
|
|
21
|
-
render(): JSX.Element;
|
|
22
|
-
renderExportMenuItems(): JSX.Element[];
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
1
|
+
import { MenuProps } from "antd";
|
|
2
|
+
import ProgressPopup from "./progressPopup";
|
|
3
|
+
import { MenuElement } from "../dataGrid";
|
|
4
|
+
export interface ContextMenuProps {
|
|
5
|
+
onlySelectedNodes?: boolean;
|
|
6
|
+
showMilliseconds: boolean;
|
|
7
|
+
showYear: boolean;
|
|
8
|
+
hideNotificationOnClipboardCopy?: boolean;
|
|
9
|
+
pageOrientation: PageOrientation;
|
|
10
|
+
exporting: boolean;
|
|
11
|
+
getExportContent: (progressPopup: ProgressPopup | null, props: ContextMenuProps) => Promise<string[][]>;
|
|
12
|
+
onPageOrientationChange: (pageOrientation: PageOrientation) => void;
|
|
13
|
+
onExport: (start: boolean) => void;
|
|
14
|
+
renderer?(menuElements: MenuElement[]): MenuElement[];
|
|
15
|
+
onClick?(key: string): void;
|
|
16
|
+
}
|
|
17
|
+
export type PageOrientation = "PORTRAIT" | "LANDSCAPE";
|
|
18
|
+
export default function getContextMenu(props: ContextMenuProps): MenuProps;
|
|
@@ -1,114 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
await
|
|
42
|
-
await
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
1
|
+
import { CopyOutlined, FileOutlined, FilePdfOutlined, FileTextOutlined } from "@ant-design/icons";
|
|
2
|
+
import { 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 { ClipboardUtils } from "d2coreui/components/clipboard/clipboardUtils";
|
|
9
|
+
import txtExportUrl from 'threads-plugin/dist/loader?name=txtExport!d2coreui/components/grid/export/worker/txtExport.js';
|
|
10
|
+
import csvExportUrl from "threads-plugin/dist/loader?name=csvExport!d2coreui/components/grid/export/worker/csvExport.js";
|
|
11
|
+
import clipboardExportUrl from "threads-plugin/dist/loader?name=clipboardExport!d2coreui/components/grid/export/worker/clipboardExport.js";
|
|
12
|
+
import pdfExportUrl from "threads-plugin/dist/loader?name=pdfExport!d2coreui/components/grid/export/worker/pdfExport.js";
|
|
13
|
+
import PlatformSpecific from "d2coreui/components/platformSpecific";
|
|
14
|
+
export default function getContextMenu(props) {
|
|
15
|
+
const { hideNotificationOnClipboardCopy, getExportContent, renderer, onClick } = props;
|
|
16
|
+
const onExportMenuClick = async (menuKey) => {
|
|
17
|
+
props.onExport(true);
|
|
18
|
+
switch (menuKey) {
|
|
19
|
+
case "txtExport": {
|
|
20
|
+
const progressPopup = new ProgressPopup(i18n("Export List to") + " TXT");
|
|
21
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
22
|
+
const txtExport = await spawn(new Worker(txtExportUrl));
|
|
23
|
+
const textContent = await txtExport(tableContent);
|
|
24
|
+
await Thread.terminate(txtExport);
|
|
25
|
+
await progressPopup.update(100);
|
|
26
|
+
PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format("YYYYMMDD_HHmm")}.txt`, textContent, true);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case "csvExport": {
|
|
30
|
+
const progressPopup = new ProgressPopup(i18n("Export List to") + " CSV");
|
|
31
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
32
|
+
const csvExport = await spawn(new Worker(csvExportUrl));
|
|
33
|
+
const csvContent = await csvExport(tableContent);
|
|
34
|
+
await Thread.terminate(csvExport);
|
|
35
|
+
await progressPopup.update(100);
|
|
36
|
+
PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format("YYYYMMDD_HHmm")}.csv`, `\ufeff${csvContent}`, true);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case "clipboardCopy": {
|
|
40
|
+
const progressPopup = !hideNotificationOnClipboardCopy ? new ProgressPopup(i18n("Export List to") + " " + i18n("Clipboard")) : null;
|
|
41
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
42
|
+
const clipboardExport = await spawn(new Worker(clipboardExportUrl));
|
|
43
|
+
const clipboardContent = await clipboardExport(tableContent);
|
|
44
|
+
const success = ClipboardUtils.copyToClipboard(clipboardContent);
|
|
45
|
+
if (success) {
|
|
46
|
+
await Thread.terminate(clipboardExport);
|
|
47
|
+
await (progressPopup === null || progressPopup === void 0 ? void 0 : progressPopup.update(100));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
progressPopup === null || progressPopup === void 0 ? void 0 : progressPopup.error();
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case "pdfExport": {
|
|
55
|
+
const progressPopup = new ProgressPopup(i18n("Export List to") + " PDF");
|
|
56
|
+
const tableContent = await getExportContent(progressPopup, props);
|
|
57
|
+
const pdfExport = await spawn(new Worker(pdfExportUrl));
|
|
58
|
+
pdfExport.handler().subscribe(async (data) => {
|
|
59
|
+
Thread.terminate(pdfExport);
|
|
60
|
+
await progressPopup.update(100);
|
|
61
|
+
PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format("YYYYMMDD_HHmm")}.pdf`, data, false);
|
|
62
|
+
});
|
|
63
|
+
pdfExport.export(tableContent, { pageOrientation: props.pageOrientation });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
props.onExport(false);
|
|
67
|
+
};
|
|
68
|
+
let menuItems = [
|
|
69
|
+
{
|
|
70
|
+
key: "txtExport",
|
|
71
|
+
icon: React.createElement(FileOutlined, null),
|
|
72
|
+
disabled: props.exporting,
|
|
73
|
+
label: i18n("Export List to") + " TXT",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "csvExport",
|
|
77
|
+
icon: React.createElement(FileTextOutlined, null),
|
|
78
|
+
disabled: props.exporting,
|
|
79
|
+
label: i18n("Export List to") + " CSV",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: "pdfExport",
|
|
83
|
+
icon: React.createElement(FilePdfOutlined, null),
|
|
84
|
+
disabled: props.exporting,
|
|
85
|
+
label: React.createElement(React.Fragment, null,
|
|
86
|
+
i18n("Export List to") + " PDF",
|
|
87
|
+
React.createElement(Switch, { style: { marginLeft: 8 }, checkedChildren: i18n("Landscape") + " ", unCheckedChildren: "" + i18n("Portrait"), checked: props.pageOrientation !== "PORTRAIT", onChange: (checked, e) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
90
|
+
props.onPageOrientationChange(checked ? "LANDSCAPE" : "PORTRAIT");
|
|
91
|
+
} }))
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "divider1",
|
|
95
|
+
type: "divider",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "clipboardCopy",
|
|
99
|
+
icon: React.createElement(CopyOutlined, null),
|
|
100
|
+
disabled: props.exporting,
|
|
101
|
+
label: i18n("Copy to Clipboard"),
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
if (renderer) {
|
|
105
|
+
menuItems = renderer(menuItems);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
items: menuItems,
|
|
109
|
+
onClick: (item) => {
|
|
110
|
+
onExportMenuClick(item.key);
|
|
111
|
+
if (onClick) {
|
|
112
|
+
onClick(item.key.toString());
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
114
117
|
//# sourceMappingURL=contextMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextM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{CopyOutlined, FileOutlined, FilePdfOutlined, FileTextOutlined} from \"@ant-design/icons\";\nimport {Menu, Switch} from \"antd\";\nimport React from \"react\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {spawn, Thread, Worker} from \"threads\"\nimport moment from \"moment\";\nimport ProgressPopup from \"./progressPopup\";\nimport {MenuElement} from \"../dataGrid\";\nimport {ClipboardUtils} from \"d2coreui/components/clipboard/clipboardUtils\";\n// @ts-ignore\nimport txtExportUrl from 'threads-plugin/dist/loader?name=txtExport!d2coreui/components/grid/export/worker/txtExport.ts'\n// @ts-ignore\nimport csvExportUrl from \"threads-plugin/dist/loader?name=csvExport!d2coreui/components/grid/export/worker/csvExport.ts\"\n// @ts-ignore\nimport clipboardExportUrl from \"threads-plugin/dist/loader?name=clipboardExport!d2coreui/components/grid/export/worker/clipboardExport.ts\"\n// @ts-ignore\nimport pdfExportUrl from \"threads-plugin/dist/loader?name=pdfExport!d2coreui/components/grid/export/worker/pdfExport.ts\"\nimport PlatformSpecific from \"d2coreui/components/platformSpecific\";\n\n\nexport interface ContextMenuProps {\n onlySelectedNodes?: boolean\n showMilliseconds: boolean\n showYear: boolean\n hideNotificationOnClipboardCopy?: boolean\n\n getExportContent: (progressPopup: ProgressPopup | null, props: ContextMenuProps) => Promise<string[][]>\n\n // overrides context menu rendering\n renderer?(menuElements: MenuElement[]): MenuElement[]\n\n // handler for custom context menu items click\n onClick?(key: string): void\n}\n\ntype PageOrientation = \"PORTRAIT\" | \"LANDSCAPE\";\n\ninterface ContextMenuState {\n pageOrientation: PageOrientation\n exporting: boolean\n}\n\n\nexport default class ContextMenu extends React.Component<ContextMenuProps, ContextMenuState> {\n constructor(props: Readonly<ContextMenuProps>) {\n super(props);\n this.state = {\n pageOrientation: \"PORTRAIT\",\n exporting: false\n };\n }\n\n async onExportMenuClick(menuKey: string) {\n this.setState({exporting: true});\n switch (menuKey) {\n case \"txtExport\": {\n const progressPopup = new ProgressPopup(i18n(\"Export List to\") + \" TXT\");\n const tableContent = await this.props.getExportContent(progressPopup, this.props);\n const txtExport = await spawn(new Worker(txtExportUrl));\n const textContent = await txtExport(tableContent);\n await Thread.terminate(txtExport);\n await progressPopup.update(100);\n PlatformSpecific.INSTANCE.saveContent(`export_${moment().format(\"YYYYMMDD_HHmm\")}.txt`, textContent, true);\n break;\n }\n case \"csvExport\": {\n const progressPopup = new ProgressPopup(i18n(\"Export List to\") + \" CSV\");\n const tableContent = await this.props.getExportContent(progressPopup, this.props);\n const csvExport = await spawn(new Worker(csvExportUrl));\n const csvContent = await csvExport(tableContent);\n await Thread.terminate(csvExport);\n await progressPopup.update(100);\n PlatformSpecific.INSTANCE.saveContent(`export_${moment().format(\"YYYYMMDD_HHmm\")}.csv`, `\\ufeff${csvContent}`, true);\n break;\n }\n case \"clipboardCopy\": {\n const progressPopup = !this.props.hideNotificationOnClipboardCopy ? new ProgressPopup(i18n(\"Export List to\") + \" \" + i18n(\"Clipboard\")) : null;\n const tableContent = await this.props.getExportContent(progressPopup, this.props);\n const clipboardExport = await spawn(new Worker(clipboardExportUrl));\n const clipboardContent = await clipboardExport(tableContent);\n const success = ClipboardUtils.copyToClipboard(clipboardContent);\n if (success) {\n await Thread.terminate(clipboardExport);\n await progressPopup?.update(100);\n } else {\n progressPopup?.error();\n }\n break;\n }\n case \"pdfExport\": {\n const progressPopup = new ProgressPopup(i18n(\"Export List to\") + \" PDF\");\n const tableContent = await this.props.getExportContent(progressPopup, this.props);\n const pdfExport = await spawn(new Worker(pdfExportUrl));\n pdfExport.handler().subscribe(async (data: string) => {\n Thread.terminate(pdfExport);\n await progressPopup.update(100);\n PlatformSpecific.INSTANCE.saveContent(`export_${moment().format(\"YYYYMMDD_HHmm\")}.pdf`, data, false);\n });\n pdfExport.export(tableContent, {pageOrientation: this.state.pageOrientation});\n }\n }\n this.setState({exporting: false});\n }\n\n render() {\n const {onlySelectedNodes, showMilliseconds, showYear, hideNotificationOnClipboardCopy, getExportContent, renderer, ...rest} = this.props;\n let menuItems: MenuElement[] = this.renderExportMenuItems();\n if (renderer) {\n menuItems = renderer(menuItems);\n }\n return (\n <Menu {...rest}\n onClick={(item: any) => {\n this.onExportMenuClick(item.key);\n if (this.props.onClick) {\n this.props.onClick(item.key.toString());\n }\n }}>\n {menuItems}\n </Menu>);\n }\n\n renderExportMenuItems() {\n return [\n <Menu.Item icon={<FileOutlined/>} key=\"txtExport\" disabled={this.state.exporting}>{i18n(\"Export List to\") + \" TXT\"}\n </Menu.Item>,\n <Menu.Item icon={<FileTextOutlined/>} key=\"csvExport\"\n disabled={this.state.exporting}>{i18n(\"Export List to\") + \" CSV\"}\n </Menu.Item>,\n <Menu.Item icon={<FilePdfOutlined/>} key=\"pdfExport\"\n disabled={this.state.exporting}>{i18n(\"Export List to\") + \" PDF\"}\n <Switch\n style={{marginLeft: 8}}\n checkedChildren={i18n(\"Landscape\") + \" \"}\n unCheckedChildren={\"\" + i18n(\"Portrait\")}\n checked={this.state.pageOrientation !== \"PORTRAIT\"}\n onChange={(checked, e) => {\n e.stopPropagation();\n (e as any).nativeEvent.stopImmediatePropagation();\n this.setState({pageOrientation: checked ? \"LANDSCAPE\" : \"PORTRAIT\"});\n }}\n /></Menu.Item>,\n <Menu.Divider key=\"divider1\"/>,\n <Menu.Item key=\"clipboardCopy\" icon={<CopyOutlined/>} disabled={this.state.exporting}>{i18n(\"Copy to Clipboard\")}\n </Menu.Item>\n ];\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"contextMenu.js","sourceRoot":"","sources":["../../../../../components/grid/export/contextMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAY,MAAM,EAAC,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAA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EAAE,EAAE;YACd,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,OAAO,EAAE,CAAC;gBACV,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YACjC,CAAC;QACL,CAAC;KACJ,CAAA;AACL,CAAC","sourcesContent":["import {CopyOutlined, FileOutlined, FilePdfOutlined, FileTextOutlined} from \"@ant-design/icons\";\r\nimport {MenuProps, Switch} from \"antd\";\r\nimport React from \"react\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {spawn, Thread, Worker} from \"threads\"\r\nimport dayjs from \"dayjs\";\r\nimport ProgressPopup from \"./progressPopup\";\r\nimport {MenuElement} from \"../dataGrid\";\r\nimport {ClipboardUtils} from \"d2coreui/components/clipboard/clipboardUtils\";\r\n// @ts-ignore\r\nimport txtExportUrl from 'threads-plugin/dist/loader?name=txtExport!d2coreui/components/grid/export/worker/txtExport.ts'\r\n// @ts-ignore\r\nimport csvExportUrl from \"threads-plugin/dist/loader?name=csvExport!d2coreui/components/grid/export/worker/csvExport.ts\"\r\n// @ts-ignore\r\nimport clipboardExportUrl from \"threads-plugin/dist/loader?name=clipboardExport!d2coreui/components/grid/export/worker/clipboardExport.ts\"\r\n// @ts-ignore\r\nimport pdfExportUrl from \"threads-plugin/dist/loader?name=pdfExport!d2coreui/components/grid/export/worker/pdfExport.ts\"\r\nimport PlatformSpecific from \"d2coreui/components/platformSpecific\";\r\n\r\n\r\nexport interface ContextMenuProps {\r\n onlySelectedNodes?: boolean\r\n showMilliseconds: boolean\r\n showYear: boolean\r\n hideNotificationOnClipboardCopy?: boolean\r\n pageOrientation: PageOrientation\r\n exporting: boolean\r\n\r\n getExportContent: (progressPopup: ProgressPopup | null, props: ContextMenuProps) => Promise<string[][]>\r\n onPageOrientationChange:(pageOrientation: PageOrientation)=>void\r\n onExport:(start: boolean)=>void\r\n\r\n // overrides context menu rendering\r\n renderer?(menuElements: MenuElement[]): MenuElement[]\r\n\r\n // handler for custom context menu items click\r\n onClick?(key: string): void\r\n}\r\n\r\nexport type PageOrientation = \"PORTRAIT\" | \"LANDSCAPE\";\r\n\r\nexport default function getContextMenu(props: ContextMenuProps): MenuProps {\r\n const {hideNotificationOnClipboardCopy, getExportContent, renderer, onClick} = props;\r\n\r\n const onExportMenuClick = async (menuKey: string) => {\r\n props.onExport(true);\r\n switch (menuKey) {\r\n case \"txtExport\": {\r\n const progressPopup = new ProgressPopup(i18n(\"Export List to\") + \" TXT\");\r\n const tableContent = await getExportContent(progressPopup, props);\r\n const txtExport = await spawn(new Worker(txtExportUrl));\r\n const textContent = await txtExport(tableContent);\r\n await Thread.terminate(txtExport);\r\n await progressPopup.update(100);\r\n PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format(\"YYYYMMDD_HHmm\")}.txt`, textContent, true);\r\n break;\r\n }\r\n case \"csvExport\": {\r\n const progressPopup = new ProgressPopup(i18n(\"Export List to\") + \" CSV\");\r\n const tableContent = await getExportContent(progressPopup, props);\r\n const csvExport = await spawn(new Worker(csvExportUrl));\r\n const csvContent = await csvExport(tableContent);\r\n await Thread.terminate(csvExport);\r\n await progressPopup.update(100);\r\n PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format(\"YYYYMMDD_HHmm\")}.csv`, `\\ufeff${csvContent}`, true);\r\n break;\r\n }\r\n case \"clipboardCopy\": {\r\n const progressPopup = !hideNotificationOnClipboardCopy ? new ProgressPopup(i18n(\"Export List to\") + \" \" + i18n(\"Clipboard\")) : null;\r\n const tableContent = await getExportContent(progressPopup, props);\r\n const clipboardExport = await spawn(new Worker(clipboardExportUrl));\r\n const clipboardContent = await clipboardExport(tableContent);\r\n const success = ClipboardUtils.copyToClipboard(clipboardContent);\r\n if (success) {\r\n await Thread.terminate(clipboardExport);\r\n await progressPopup?.update(100);\r\n } else {\r\n progressPopup?.error();\r\n }\r\n break;\r\n }\r\n case \"pdfExport\": {\r\n const progressPopup = new ProgressPopup(i18n(\"Export List to\") + \" PDF\");\r\n const tableContent = await getExportContent(progressPopup, props);\r\n const pdfExport = await spawn(new Worker(pdfExportUrl));\r\n pdfExport.handler().subscribe(async (data: string) => {\r\n Thread.terminate(pdfExport);\r\n await progressPopup.update(100);\r\n PlatformSpecific.INSTANCE.saveContent(`export_${dayjs().format(\"YYYYMMDD_HHmm\")}.pdf`, data, false);\r\n });\r\n pdfExport.export(tableContent, {pageOrientation: props.pageOrientation});\r\n }\r\n }\r\n props.onExport(false);\r\n }\r\n\r\n let menuItems: MenuElement[] = [\r\n {\r\n key: \"txtExport\",\r\n icon: <FileOutlined/>,\r\n disabled: props.exporting,\r\n label: i18n(\"Export List to\") + \" TXT\",\r\n },\r\n {\r\n key: \"csvExport\",\r\n icon: <FileTextOutlined/>,\r\n disabled: props.exporting,\r\n label: i18n(\"Export List to\") + \" CSV\",\r\n },\r\n {\r\n key: \"pdfExport\",\r\n icon: <FilePdfOutlined/>,\r\n disabled: props.exporting,\r\n label: <>\r\n {i18n(\"Export List to\") + \" PDF\"}\r\n <Switch\r\n style={{marginLeft: 8}}\r\n checkedChildren={i18n(\"Landscape\") + \" \"}\r\n unCheckedChildren={\"\" + i18n(\"Portrait\")}\r\n checked={props.pageOrientation !== \"PORTRAIT\"}\r\n onChange={(checked, e) => {\r\n e.stopPropagation();\r\n (e as any).nativeEvent.stopImmediatePropagation();\r\n props.onPageOrientationChange(checked ? \"LANDSCAPE\" : \"PORTRAIT\")\r\n }}\r\n />\r\n </>\r\n },\r\n {\r\n key: \"divider1\",\r\n type: \"divider\",\r\n },\r\n {\r\n key: \"clipboardCopy\",\r\n icon: <CopyOutlined/>,\r\n disabled: props.exporting,\r\n label: i18n(\"Copy to Clipboard\"),\r\n }\r\n ];\r\n\r\n if (renderer) {\r\n menuItems = renderer(menuItems);\r\n }\r\n\r\n return {\r\n items: menuItems,\r\n onClick: (item) => {\r\n onExportMenuClick(item.key);\r\n if (onClick) {\r\n onClick(item.key.toString());\r\n }\r\n },\r\n }\r\n}\r\n"]}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ProgressProps } from "antd/lib/progress/progress";
|
|
3
|
-
interface ProgressBarProps extends ProgressProps {
|
|
4
|
-
registerUpdateHandler(updateHandler: ((percent: number) => void) | null): void;
|
|
5
|
-
}
|
|
6
|
-
interface ProgressBarState {
|
|
7
|
-
percent: number;
|
|
8
|
-
}
|
|
9
|
-
export declare class ProgressBar extends React.Component<ProgressBarProps, ProgressBarState> {
|
|
10
|
-
constructor(props: Readonly<ProgressBarProps>);
|
|
11
|
-
componentDidMount(): void;
|
|
12
|
-
componentWillUnmount(): void;
|
|
13
|
-
makeProgress(percent: number): void;
|
|
14
|
-
render(): JSX.Element;
|
|
15
|
-
}
|
|
16
|
-
export default class ProgressPopup {
|
|
17
|
-
title: string;
|
|
18
|
-
recordCount?: number;
|
|
19
|
-
makeProgress: ((percent: number) => void) | null;
|
|
20
|
-
progressVisible: boolean;
|
|
21
|
-
constructor(title: string);
|
|
22
|
-
initializeProgressPopup(): Promise<void>;
|
|
23
|
-
setRecordCount(recordCount: number): void;
|
|
24
|
-
update(progressPercent: number): Promise<void>;
|
|
25
|
-
close(): void;
|
|
26
|
-
error(): void;
|
|
27
|
-
sleep(ms: number): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ProgressProps } from "antd/lib/progress/progress";
|
|
3
|
+
interface ProgressBarProps extends ProgressProps {
|
|
4
|
+
registerUpdateHandler(updateHandler: ((percent: number) => void) | null): void;
|
|
5
|
+
}
|
|
6
|
+
interface ProgressBarState {
|
|
7
|
+
percent: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class ProgressBar extends React.Component<ProgressBarProps, ProgressBarState> {
|
|
10
|
+
constructor(props: Readonly<ProgressBarProps>);
|
|
11
|
+
componentDidMount(): void;
|
|
12
|
+
componentWillUnmount(): void;
|
|
13
|
+
makeProgress(percent: number): void;
|
|
14
|
+
render(): React.JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export default class ProgressPopup {
|
|
17
|
+
title: string;
|
|
18
|
+
recordCount?: number;
|
|
19
|
+
makeProgress: ((percent: number) => void) | null;
|
|
20
|
+
progressVisible: boolean;
|
|
21
|
+
constructor(title: string);
|
|
22
|
+
initializeProgressPopup(): Promise<void>;
|
|
23
|
+
setRecordCount(recordCount: number): void;
|
|
24
|
+
update(progressPercent: number): Promise<void>;
|
|
25
|
+
close(): void;
|
|
26
|
+
error(): void;
|
|
27
|
+
sleep(ms: number): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|