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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggableModalProvider.js","sourceRoot":"","sources":["../../../../components/modal/draggableModalProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"draggableModalProvider.js","sourceRoot":"","sources":["../../../../components/modal/draggableModalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAC,qBAAqB,EAAC,MAAM,sDAAsD,CAAA;AAC1F,OAAO,EAAC,aAAa,EAAC,MAAM,8CAA8C,CAAA;AAC1E,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,sDAAsD,CAAA;AAE9G,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACnC,QAAQ,GAGX,EAAsB,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAA;IAE/E,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAE7B,OAAO;QACX,CAAC;QACD,MAAM,QAAQ,GAAG,GAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA;QACtF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC3C,QAAQ,EAAE,CAAA;QACV,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC/D,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,CACH,oBAAC,qBAAqB,CAAC,QAAQ,IAC3B,KAAK,EAAE;YACH,KAAK;YACL,QAAQ;SACX,IAEA,QAAQ,CACoB,CACpC,CAAA;AACL,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {useEffect, useReducer} from 'react'\r\nimport {DraggableModalContext} from 'd2coreui/components/modal/impl/draggableModalContext'\r\nimport {getWindowSize} from 'd2coreui/components/modal/impl/getWindowSize'\r\nimport {draggableModalReducer, initialModalsState} from 'd2coreui/components/modal/impl/draggableModalReducer'\r\n\r\nexport const DraggableModalProvider = ({\r\n children,\r\n}: {\r\n children: React.ReactNode\r\n}): React.ReactElement => {\r\n const [state, dispatch] = useReducer(draggableModalReducer, initialModalsState)\r\n\r\n useEffect(() => {\r\n if (typeof window !== 'object') {\r\n // @ts-ignore\r\n return;\r\n }\r\n const onResize = (): void => dispatch({ type: 'windowResize', size: getWindowSize() })\r\n window.addEventListener('resize', onResize)\r\n onResize()\r\n return () => window.removeEventListener('resize', onResize)\r\n }, [dispatch])\r\n\r\n return (\r\n <DraggableModalContext.Provider\r\n value={{\r\n state,\r\n dispatch,\r\n }}\r\n >\r\n {children}\r\n </DraggableModalContext.Provider>\r\n )\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const clamp: (min: number, max: number, value: number) => number;
|
|
1
|
+
export declare const clamp: (min: number, max: number, value: number) => number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const clamp = (min, max, value) => Math.max(min, Math.min(max, value));
|
|
1
|
+
export const clamp = (min, max, value) => Math.max(min, Math.min(max, value));
|
|
2
2
|
//# sourceMappingURL=clamp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../../../../components/modal/impl/clamp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../../../../components/modal/impl/clamp.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,KAAa,EAAU,EAAE,CACrE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nexport const clamp = (min: number, max: number, value: number): number =>\r\n Math.max(min, Math.min(max, value));\r\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ModalProps } from 'antd/lib/modal';
|
|
3
|
-
import '../../../style/modal/DraggableModal.css';
|
|
4
|
-
export interface DraggableModalProps extends Omit<ModalProps, "width"> {
|
|
5
|
-
initialWidth?: number;
|
|
6
|
-
initialHeight?: number;
|
|
7
|
-
onResize?(size: {
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
}): void;
|
|
11
|
-
}
|
|
12
|
-
export declare const DraggableModal:
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ModalProps } from 'antd/lib/modal';
|
|
3
|
+
import '../../../style/modal/DraggableModal.css';
|
|
4
|
+
export interface DraggableModalProps extends Omit<ModalProps, "width"> {
|
|
5
|
+
initialWidth?: number;
|
|
6
|
+
initialHeight?: number;
|
|
7
|
+
onResize?(size: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const DraggableModal: FunctionComponent<DraggableModalProps>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useContext } from 'react';
|
|
3
|
-
import { useUID } from 'react-uid';
|
|
4
|
-
import { DraggableModalContext } from './draggableModalContext';
|
|
5
|
-
import { DraggableModalInner } from './draggableModalInner';
|
|
6
|
-
import {
|
|
7
|
-
import '../../../style/modal/DraggableModal.css';
|
|
8
|
-
export const DraggableModal = (props) => {
|
|
9
|
-
const id = useUID();
|
|
10
|
-
const modalProvider = useContext(DraggableModalContext);
|
|
11
|
-
if (!modalProvider) {
|
|
12
|
-
throw new Error('No Provider');
|
|
13
|
-
}
|
|
14
|
-
const { dispatch, state } = modalProvider;
|
|
15
|
-
const modalState =
|
|
16
|
-
return React.createElement(DraggableModalInner, Object.assign({ id: id, dispatch: dispatch, modalState: modalState }, props));
|
|
17
|
-
};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { useUID } from 'react-uid';
|
|
4
|
+
import { DraggableModalContext } from './draggableModalContext';
|
|
5
|
+
import { DraggableModalInner } from './draggableModalInner';
|
|
6
|
+
import { getModalState } from './draggableModalReducer';
|
|
7
|
+
import '../../../style/modal/DraggableModal.css';
|
|
8
|
+
export const DraggableModal = (props) => {
|
|
9
|
+
const id = useUID();
|
|
10
|
+
const modalProvider = useContext(DraggableModalContext);
|
|
11
|
+
if (!modalProvider) {
|
|
12
|
+
throw new Error('No Provider');
|
|
13
|
+
}
|
|
14
|
+
const { dispatch, state } = modalProvider;
|
|
15
|
+
const modalState = getModalState({ state, id, initialWidth: props.initialWidth, initialHeight: props.initialHeight });
|
|
16
|
+
return React.createElement(DraggableModalInner, Object.assign({ id: id, dispatch: dispatch, modalState: modalState }, props));
|
|
17
|
+
};
|
|
18
18
|
//# sourceMappingURL=draggableModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggableModal.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"draggableModal.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAoB,UAAU,EAAC,MAAM,OAAO,CAAA;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAA;AAChC,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAA;AAErD,OAAO,yCAAyC,CAAA;AAShD,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,KAA0B,EAAsB,EAAE;IAErH,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAGpB,MAAM,aAAa,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IACxD,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,EAAC,QAAQ,EAAE,KAAK,EAAC,GAAG,aAAa,CAAC;IACxC,MAAM,UAAU,GAAG,aAAa,CAAC,EAAC,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAC,CAAC,CAAC;IAKpH,OAAO,oBAAC,mBAAmB,kBAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,IAAM,KAAK,EAAI,CAAA;AACjG,CAAC,CAAC","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {FunctionComponent, useContext} from 'react'\r\nimport {useUID} from 'react-uid'\r\nimport {DraggableModalContext} from './draggableModalContext'\r\nimport {DraggableModalInner} from './draggableModalInner'\r\nimport {getModalState} from './draggableModalReducer'\r\nimport {ModalProps} from 'antd/lib/modal'\r\nimport '../../../style/modal/DraggableModal.css'\r\n\r\nexport interface DraggableModalProps extends Omit<ModalProps, \"width\"> {\r\n initialWidth?: number,\r\n initialHeight?: number\r\n // resize dialog handler\r\n onResize?(size: { width: number, height: number }): void\r\n}\r\n\r\nexport const DraggableModal: FunctionComponent<DraggableModalProps> = (props: DraggableModalProps): React.ReactElement => {\r\n // Get the unique ID of this modal.\r\n const id = useUID();\r\n\r\n // Get modal provider.\r\n const modalProvider = useContext(DraggableModalContext);\r\n if (!modalProvider) {\r\n throw new Error('No Provider')\r\n }\r\n\r\n const {dispatch, state} = modalProvider;\r\n const modalState = getModalState({state, id, initialWidth: props.initialWidth, initialHeight: props.initialHeight});\r\n\r\n // We do this so that we don't re-render all modals for every state change.\r\n // DraggableModalInner uses React.memo, so it only re-renders if\r\n // if props change (e.g. modalState).\r\n return <DraggableModalInner id={id} dispatch={dispatch} modalState={modalState} {...props} />\r\n};\r\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Action, ModalsState } from './draggableModalReducer';
|
|
3
|
-
export interface DraggableModalContextMethods {
|
|
4
|
-
dispatch: (action: Action) => void;
|
|
5
|
-
}
|
|
6
|
-
export interface DraggableModalContextValue extends DraggableModalContextMethods {
|
|
7
|
-
state: ModalsState;
|
|
8
|
-
}
|
|
9
|
-
export declare const DraggableModalContext: React.Context<DraggableModalContextValue | null>;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Action, ModalsState } from './draggableModalReducer';
|
|
3
|
+
export interface DraggableModalContextMethods {
|
|
4
|
+
dispatch: (action: Action) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface DraggableModalContextValue extends DraggableModalContextMethods {
|
|
7
|
+
state: ModalsState;
|
|
8
|
+
}
|
|
9
|
+
export declare const DraggableModalContext: React.Context<DraggableModalContextValue | null>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export const DraggableModalContext = React.createContext(null);
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export const DraggableModalContext = React.createContext(null);
|
|
3
3
|
//# sourceMappingURL=draggableModalContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggableModalContext.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"draggableModalContext.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC,aAAa,CAAoC,IAAI,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {Action, ModalsState} from './draggableModalReducer'\r\n\r\nexport interface DraggableModalContextMethods {\r\n dispatch: (action: Action) => void\r\n}\r\n\r\nexport interface DraggableModalContextValue extends DraggableModalContextMethods {\r\n state: ModalsState\r\n}\r\n\r\nexport const DraggableModalContext = React.createContext<DraggableModalContextValue | null>(null)\r\n"]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DraggableModalContextMethods } from './draggableModalContext';
|
|
3
|
-
import { ModalID, ModalState } from './draggableModalReducer';
|
|
4
|
-
import { DraggableModalProps } from "./draggableModal";
|
|
5
|
-
interface ContextProps extends DraggableModalContextMethods {
|
|
6
|
-
id: ModalID;
|
|
7
|
-
modalState: ModalState;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DraggableModalContextMethods } from './draggableModalContext';
|
|
3
|
+
import { ModalID, ModalState } from './draggableModalReducer';
|
|
4
|
+
import { DraggableModalProps } from "./draggableModal";
|
|
5
|
+
interface ContextProps extends DraggableModalContextMethods {
|
|
6
|
+
id: ModalID;
|
|
7
|
+
modalState: ModalState;
|
|
8
|
+
initialWidth?: number;
|
|
9
|
+
initialHeight?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface DraggableModalInnerProps extends DraggableModalProps, ContextProps {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const DraggableModalInner: React.MemoExoticComponent<({ id, modalState, dispatch, open, children, title, initialWidth, initialHeight, onResize, ...otherProps }: DraggableModalInnerProps) => React.JSX.Element>;
|
|
15
|
+
export {};
|
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
14
|
-
import { Modal } from 'antd';
|
|
15
|
-
import { ResizeHandle } from './resizeHandle';
|
|
16
|
-
import { useDrag } from './useDrag';
|
|
17
|
-
import { usePrevious } from './usePrevious';
|
|
18
|
-
import { useResize } from './useResize';
|
|
19
|
-
const modalStyle = { margin: 0, paddingBottom: 0, pointerEvents: 'auto' };
|
|
20
|
-
export const DraggableModalInner = memo((_a) => {
|
|
21
|
-
var { id, modalState, dispatch, open, children, title, onResize } = _a, otherProps = __rest(_a, ["id", "modalState", "dispatch", "open", "children", "title", "onResize"]);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
dispatch({ type: 'mount', id,
|
|
24
|
-
return () => dispatch({ type: 'unmount', id });
|
|
25
|
-
}, [dispatch, id]);
|
|
26
|
-
const visiblePrevious = usePrevious(open);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (open !== visiblePrevious) {
|
|
29
|
-
if (open) {
|
|
30
|
-
dispatch({ type: 'show', id });
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
dispatch({ type: 'hide', id });
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}, [open, visiblePrevious, id, dispatch]);
|
|
37
|
-
const { zIndex, x, y, width, height } = modalState;
|
|
38
|
-
const style = useMemo(() => (Object.assign(Object.assign({}, modalStyle), { top: y, left: x, height })), [y, x, height]);
|
|
39
|
-
const onFocus = useCallback(() => dispatch({ type: 'focus', id }), [id, dispatch]);
|
|
40
|
-
const onDragWithID = useCallback(args => dispatch(Object.assign({ type: 'drag', id }, args)), [
|
|
41
|
-
dispatch,
|
|
42
|
-
id,
|
|
43
|
-
]);
|
|
44
|
-
const onResizeWithID = useCallback((args) => {
|
|
45
|
-
onResize === null || onResize === void 0 ? void 0 : onResize({ width: args.width, height: args.height });
|
|
46
|
-
return dispatch(Object.assign({ type: 'resize', id }, args));
|
|
47
|
-
}, [dispatch, id,]);
|
|
48
|
-
const onMouseDrag = useDrag(x, y, onDragWithID);
|
|
49
|
-
const onMouseResize = useResize(x, y, width, height, onResizeWithID);
|
|
50
|
-
const titleElement = useMemo(() => (React.createElement("div", { className: "ant-design-draggable-modal-title", onMouseDown: onMouseDrag, onClick: onFocus }, title)), [onMouseDrag, onFocus, title]);
|
|
51
|
-
return (React.createElement(Modal, Object.assign({ wrapClassName: "ant-design-draggable-modal", style: style, destroyOnClose: true, width: width, zIndex: zIndex, title: titleElement, open: open }, otherProps),
|
|
52
|
-
children,
|
|
53
|
-
React.createElement(ResizeHandle, { onMouseDown: onMouseResize })));
|
|
54
|
-
});
|
|
55
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
14
|
+
import { Modal } from 'antd';
|
|
15
|
+
import { ResizeHandle } from './resizeHandle';
|
|
16
|
+
import { useDrag } from './useDrag';
|
|
17
|
+
import { usePrevious } from './usePrevious';
|
|
18
|
+
import { useResize } from './useResize';
|
|
19
|
+
const modalStyle = { margin: 0, paddingBottom: 0, pointerEvents: 'auto' };
|
|
20
|
+
export const DraggableModalInner = memo((_a) => {
|
|
21
|
+
var { id, modalState, dispatch, open, children, title, initialWidth, initialHeight, onResize } = _a, otherProps = __rest(_a, ["id", "modalState", "dispatch", "open", "children", "title", "initialWidth", "initialHeight", "onResize"]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
dispatch({ type: 'mount', id, intialState: { initialWidth, initialHeight } });
|
|
24
|
+
return () => dispatch({ type: 'unmount', id });
|
|
25
|
+
}, [dispatch, id, initialWidth, initialHeight]);
|
|
26
|
+
const visiblePrevious = usePrevious(open);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (open !== visiblePrevious) {
|
|
29
|
+
if (open) {
|
|
30
|
+
dispatch({ type: 'show', id });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
dispatch({ type: 'hide', id });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, [open, visiblePrevious, id, dispatch]);
|
|
37
|
+
const { zIndex, x, y, width, height } = modalState;
|
|
38
|
+
const style = useMemo(() => (Object.assign(Object.assign({}, modalStyle), { top: y, left: x, height })), [y, x, height]);
|
|
39
|
+
const onFocus = useCallback(() => dispatch({ type: 'focus', id }), [id, dispatch]);
|
|
40
|
+
const onDragWithID = useCallback((args) => dispatch(Object.assign({ type: 'drag', id }, args)), [
|
|
41
|
+
dispatch,
|
|
42
|
+
id,
|
|
43
|
+
]);
|
|
44
|
+
const onResizeWithID = useCallback((args) => {
|
|
45
|
+
onResize === null || onResize === void 0 ? void 0 : onResize({ width: args.width, height: args.height });
|
|
46
|
+
return dispatch(Object.assign({ type: 'resize', id }, args));
|
|
47
|
+
}, [dispatch, id,]);
|
|
48
|
+
const onMouseDrag = useDrag(x, y, onDragWithID);
|
|
49
|
+
const onMouseResize = useResize(x, y, width, height, onResizeWithID);
|
|
50
|
+
const titleElement = useMemo(() => (React.createElement("div", { className: "ant-design-draggable-modal-title", onMouseDown: onMouseDrag, onClick: onFocus }, title)), [onMouseDrag, onFocus, title]);
|
|
51
|
+
return (React.createElement(Modal, Object.assign({ wrapClassName: "ant-design-draggable-modal", style: style, destroyOnClose: true, mask: false, maskClosable: false, width: width, zIndex: zIndex, title: titleElement, open: open }, otherProps),
|
|
52
|
+
children,
|
|
53
|
+
React.createElement(ResizeHandle, { onMouseDown: onMouseResize })));
|
|
54
|
+
});
|
|
55
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
56
|
+
DraggableModalInner.displayName = 'DraggableModalInner';
|
|
57
|
+
}
|
|
56
58
|
//# sourceMappingURL=draggableModalInner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draggableModalInner.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalInner.tsx"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"draggableModalInner.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalInner.tsx"],"names":[],"mappings":"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","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {memo, useCallback, useEffect, useMemo} from 'react'\r\nimport {Modal} from 'antd'\r\nimport {ResizeHandle} from './resizeHandle'\r\nimport {useDrag} from './useDrag'\r\nimport {DraggableModalContextMethods} from './draggableModalContext'\r\nimport {usePrevious} from './usePrevious'\r\nimport {ModalID, ModalState} from './draggableModalReducer'\r\nimport {useResize} from './useResize'\r\nimport {DraggableModalProps} from \"./draggableModal\";\r\n\r\nconst modalStyle: React.CSSProperties = {margin: 0, paddingBottom: 0, pointerEvents: 'auto'}\r\n\r\ninterface ContextProps extends DraggableModalContextMethods {\r\n id: ModalID\r\n modalState: ModalState\r\n initialWidth?: number\r\n initialHeight?: number\r\n}\r\n\r\n//export type DraggableModalInnerProps = ModalProps & { children?: React.ReactNode } & ContextProps\r\nexport interface DraggableModalInnerProps extends DraggableModalProps, ContextProps {\r\n children?: React.ReactNode\r\n}\r\n\r\nexport const DraggableModalInner = memo(\r\n ({\r\n id,\r\n modalState,\r\n dispatch,\r\n open,\r\n children,\r\n title,\r\n initialWidth,\r\n initialHeight,\r\n onResize,\r\n ...otherProps\r\n }: DraggableModalInnerProps) => {\r\n // Call on mount and unmount.\r\n useEffect(() => {\r\n dispatch({type: 'mount', id, intialState: {initialWidth, initialHeight}});\r\n return () => dispatch({type: 'unmount', id})\r\n }, [dispatch, id, initialWidth, initialHeight]);\r\n\r\n // Bring this to the front if it's been opened with props.\r\n const visiblePrevious = usePrevious(open);\r\n useEffect(() => {\r\n if (open !== visiblePrevious) {\r\n if (open) {\r\n dispatch({type: 'show', id})\r\n } else {\r\n dispatch({type: 'hide', id})\r\n }\r\n }\r\n }, [open, visiblePrevious, id, dispatch]);\r\n\r\n const {zIndex, x, y, width, height} = modalState;\r\n\r\n const style: React.CSSProperties = useMemo(\r\n () => ({...modalStyle, top: y, left: x, height}),\r\n [y, x, height],\r\n );\r\n\r\n const onFocus = useCallback(() => dispatch({type: 'focus', id}), [id, dispatch])\r\n\r\n const onDragWithID = useCallback((args: any) => dispatch({type: 'drag', id, ...args}), [\r\n dispatch,\r\n id,\r\n ]);\r\n\r\n const onResizeWithID = useCallback((args: any) => {\r\n onResize?.({width: args.width, height: args.height});\r\n return dispatch({type: 'resize', id, ...args})\r\n }, [dispatch, id,]);\r\n\r\n const onMouseDrag = useDrag(x, y, onDragWithID);\r\n const onMouseResize = useResize(x, y, width, height, onResizeWithID);\r\n\r\n const titleElement = useMemo(\r\n () => (\r\n <div\r\n className=\"ant-design-draggable-modal-title\"\r\n onMouseDown={onMouseDrag}\r\n onClick={onFocus}\r\n >\r\n {title}\r\n </div>\r\n ),\r\n [onMouseDrag, onFocus, title],\r\n );\r\n\r\n return (\r\n <Modal\r\n wrapClassName=\"ant-design-draggable-modal\"\r\n style={style}\r\n destroyOnClose={true}\r\n mask={false}\r\n maskClosable={false}\r\n width={width}\r\n zIndex={zIndex}\r\n title={titleElement}\r\n open={open}\r\n {...otherProps}\r\n >\r\n {children}\r\n <ResizeHandle onMouseDown={onMouseResize}/>\r\n </Modal>\r\n )\r\n }\r\n);\r\n\r\nif (process.env.NODE_ENV !== 'production') {\r\n DraggableModalInner.displayName = 'DraggableModalInner'\r\n}\r\n"]}
|
|
@@ -1,62 +1,66 @@
|
|
|
1
|
-
export
|
|
2
|
-
export interface ModalState {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
zIndex: number;
|
|
8
|
-
visible: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface ModalsState {
|
|
11
|
-
maxZIndex: number;
|
|
12
|
-
windowSize: {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
};
|
|
16
|
-
modals: {
|
|
17
|
-
[key: string]: ModalState;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export declare const initialModalsState: ModalsState;
|
|
21
|
-
export declare const initialModalState: ModalState;
|
|
22
|
-
export
|
|
23
|
-
type: 'show';
|
|
24
|
-
id: ModalID;
|
|
25
|
-
} | {
|
|
26
|
-
type: 'hide';
|
|
27
|
-
id: ModalID;
|
|
28
|
-
} | {
|
|
29
|
-
type: 'focus';
|
|
30
|
-
id: ModalID;
|
|
31
|
-
} | {
|
|
32
|
-
type: 'unmount';
|
|
33
|
-
id: ModalID;
|
|
34
|
-
} | {
|
|
35
|
-
type: 'mount';
|
|
36
|
-
id: ModalID;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
|
-
type: 'windowResize';
|
|
43
|
-
size: {
|
|
44
|
-
width: number;
|
|
45
|
-
height: number;
|
|
46
|
-
};
|
|
47
|
-
} | {
|
|
48
|
-
type: 'drag';
|
|
49
|
-
id: ModalID;
|
|
50
|
-
x: number;
|
|
51
|
-
y: number;
|
|
52
|
-
} | {
|
|
53
|
-
type: 'resize';
|
|
54
|
-
id: ModalID;
|
|
55
|
-
x: number;
|
|
56
|
-
y: number;
|
|
57
|
-
width: number;
|
|
58
|
-
height: number;
|
|
59
|
-
};
|
|
60
|
-
export declare const
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
export type ModalID = string;
|
|
2
|
+
export interface ModalState {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
zIndex: number;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModalsState {
|
|
11
|
+
maxZIndex: number;
|
|
12
|
+
windowSize: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
modals: {
|
|
17
|
+
[key: string]: ModalState;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const initialModalsState: ModalsState;
|
|
21
|
+
export declare const initialModalState: ModalState;
|
|
22
|
+
export type Action = {
|
|
23
|
+
type: 'show';
|
|
24
|
+
id: ModalID;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'hide';
|
|
27
|
+
id: ModalID;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'focus';
|
|
30
|
+
id: ModalID;
|
|
31
|
+
} | {
|
|
32
|
+
type: 'unmount';
|
|
33
|
+
id: ModalID;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'mount';
|
|
36
|
+
id: ModalID;
|
|
37
|
+
intialState: {
|
|
38
|
+
initialWidth?: number;
|
|
39
|
+
initialHeight?: number;
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
type: 'windowResize';
|
|
43
|
+
size: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
};
|
|
47
|
+
} | {
|
|
48
|
+
type: 'drag';
|
|
49
|
+
id: ModalID;
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'resize';
|
|
54
|
+
id: ModalID;
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
};
|
|
60
|
+
export declare const getModalState: ({ state, id, initialWidth, initialHeight, }: {
|
|
61
|
+
state: ModalsState;
|
|
62
|
+
id: ModalID;
|
|
63
|
+
initialWidth?: number;
|
|
64
|
+
initialHeight?: number;
|
|
65
|
+
}) => ModalState;
|
|
66
|
+
export declare const draggableModalReducer: (state: ModalsState, action: Action) => ModalsState;
|