@gct-paas/core-web 0.1.4-dev.7 → 0.1.4-dev.9
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/dist/index-BghCpvxN.js +76 -0
- package/dist/index-PLrMc0gl.cjs +76 -0
- package/dist/index-oVPMi6Ep.js +29160 -0
- package/dist/index.esm.min.mjs +34 -7924
- package/dist/index.min.cjs +1 -20
- package/dist/index.min.css +1 -0
- package/dist/index.system.min.js +1 -20
- package/dist/monaco-editor-B8X-ou0h.js +20245 -0
- package/dist/monaco-editor-Bdgpd_KL.cjs +19 -0
- package/dist/monaco-editor-NIWDtQNB.js +19 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/es/components/app-modal/app-modal-component.css +149 -0
- package/es/components/app-modal/app-modal-component.d.ts +26 -0
- package/es/components/app-modal/app-modal-component.mjs +140 -0
- package/es/components/assets-svg-icon/assets-svg-icon.css +188 -0
- package/es/components/assets-svg-icon/assets-svg-icon.d.ts +134 -0
- package/es/components/assets-svg-icon/assets-svg-icon.mjs +238 -0
- package/es/components/assets-svg-icon/request.d.ts +2 -0
- package/es/components/assets-svg-icon/request.mjs +51 -0
- package/es/components/assets-svg-icon/utils.d.ts +9 -0
- package/es/components/assets-svg-icon/utils.mjs +21 -0
- package/es/components/assets-svg-icon/validate.d.ts +4 -0
- package/es/components/assets-svg-icon/validate.mjs +43 -0
- package/es/components/base-button/base-button.css +74 -0
- package/es/components/base-button/base-button.vue.d.ts +173 -0
- package/es/components/base-button/base-button.vue.mjs +7 -0
- package/es/components/base-button/base-button.vue3.mjs +179 -0
- package/es/components/basic-button/basic-button.css +25 -0
- package/es/components/basic-button/basic-button.vue.d.ts +100 -0
- package/es/components/basic-button/basic-button.vue.mjs +7 -0
- package/es/components/basic-button/basic-button.vue3.mjs +130 -0
- package/es/components/code-editor/code-editor.css +67 -0
- package/es/components/code-editor/code-editor.d.ts +1 -1
- package/es/components/code-editor/code-editor.mjs +9 -10
- package/es/components/index.d.ts +10 -0
- package/es/components/index.mjs +21 -6
- package/es/components/layout/flex-container/flex-container.css +67 -0
- package/es/components/layout/flex-container/flex-container.mjs +13 -9
- package/es/components/layout/flex-item/flex-item.mjs +11 -9
- package/es/components/layout/grid-container/grid-container.mjs +11 -7
- package/es/components/layout/view-container/view-container.css +83 -0
- package/es/components/layout/view-container/view-container.mjs +6 -7
- package/es/components/svg-icon/svg-icon.css +73 -0
- package/es/components/svg-icon/svg-icon.vue.d.ts +40 -0
- package/es/components/svg-icon/svg-icon.vue.mjs +50 -0
- package/es/components/svg-icon/svg-icon.vue3.mjs +6 -0
- package/es/create-app-vue.d.ts +9 -0
- package/es/create-app-vue.mjs +17 -0
- package/es/directives/drag-resize.d.ts +4 -0
- package/es/directives/drag-resize.mjs +42 -0
- package/es/directives/index.d.ts +8 -0
- package/es/directives/index.mjs +9 -0
- package/es/directives/target-loading.d.ts +4 -0
- package/es/directives/target-loading.mjs +40 -0
- package/es/editor/gct-form-check-switch/gct-form-check-switch.d.ts +1 -1
- package/es/editor/gct-form-i18n/gct-form-i18n.d.ts +1 -1
- package/es/editor/gct-form-info/gct-form-info.d.ts +1 -1
- package/es/editor/gct-form-length-unit/gct-form-length-unit.d.ts +1 -1
- package/es/editor/gct-form-number/gct-form-number.d.ts +1 -1
- package/es/editor/gct-form-radio/gct-form-radio.d.ts +1 -1
- package/es/editor/gct-form-select/gct-form-select.d.ts +1 -1
- package/es/editor/gct-form-switch/gct-form-switch.d.ts +1 -1
- package/es/editor/gct-form-textarea/gct-form-textarea.d.ts +1 -1
- package/es/hooks/index.d.ts +3 -0
- package/es/hooks/useDragLine.d.ts +6 -0
- package/es/hooks/useDragLine.mjs +79 -0
- package/es/hooks/useLocale.d.ts +4 -0
- package/es/hooks/useLocale.mjs +32 -0
- package/es/hooks/useTheme.d.ts +8 -0
- package/es/hooks/useTheme.mjs +20 -0
- package/es/index.d.ts +7 -7
- package/es/index.mjs +35 -24
- package/es/modules/code-editor/index.d.ts +163 -0
- package/es/modules/code-editor/index.mjs +8 -0
- package/es/modules/code-editor/monaco-editor.css +49 -0
- package/es/modules/code-editor/monaco-editor.vue.d.ts +143 -0
- package/es/modules/code-editor/monaco-editor.vue.mjs +7 -0
- package/es/modules/code-editor/monaco-editor.vue2.mjs +440 -0
- package/es/modules/code-editor/useEditorConsole.d.ts +54 -0
- package/es/modules/code-editor/useEditorConsole.mjs +194 -0
- package/es/modules/code-editor/useMonacoEditor.d.ts +26 -0
- package/es/modules/code-editor/useMonacoEditor.mjs +26 -0
- package/es/modules/color-picker/index.d.ts +2 -0
- package/es/modules/color-picker/src/ColorPicker.css +16 -0
- package/es/modules/color-picker/src/ColorPicker.vue.d.ts +49 -0
- package/es/modules/color-picker/src/ColorPicker.vue.mjs +8 -0
- package/es/modules/color-picker/src/ColorPicker.vue2.mjs +545 -0
- package/es/modules/color-picker/src/ColorPicker2.css +156 -0
- package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.css +72 -0
- package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.d.ts +37 -0
- package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.mjs +195 -0
- package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.css +79 -0
- package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.d.ts +29 -0
- package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.mjs +98 -0
- package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.css +70 -0
- package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.d.ts +50 -0
- package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.mjs +239 -0
- package/es/modules/gct-dnd/constants/index.d.ts +22 -0
- package/es/modules/gct-dnd/constants/index.mjs +20 -0
- package/es/modules/gct-dnd/index.d.ts +5 -0
- package/es/modules/gct-dnd/interface/i-gct-dnd-config.d.ts +101 -0
- package/es/modules/gct-dnd/interface/i-gct-dnd-data.d.ts +14 -0
- package/es/modules/gct-dnd/interface/i-gct-dnd-render-item-options.d.ts +28 -0
- package/es/modules/gct-dnd/interface/i-gct-drag-collect.d.ts +24 -0
- package/es/modules/gct-dnd/interface/i-gct-drag-dnd-data.d.ts +51 -0
- package/es/modules/gct-dnd/interface/i-gct-drop-collect.d.ts +32 -0
- package/es/modules/gct-dnd/interface/i-gct-drop-result.d.ts +47 -0
- package/es/modules/gct-dnd/interface/index.d.ts +7 -0
- package/es/modules/global-modal/index.d.ts +5 -0
- package/es/modules/global-modal/index.mjs +16 -0
- package/es/modules/global-modal/src/BasicModal.vue.d.ts +518 -0
- package/es/modules/global-modal/src/BasicModal.vue.mjs +221 -0
- package/es/modules/global-modal/src/BasicModal.vue2.mjs +5 -0
- package/es/modules/global-modal/src/components/GlboalModal.d.ts +251 -0
- package/es/modules/global-modal/src/components/GlboalModal.mjs +40 -0
- package/es/modules/global-modal/src/components/ModalClose.css +95 -0
- package/es/modules/global-modal/src/components/ModalClose.vue.d.ts +27 -0
- package/es/modules/global-modal/src/components/ModalClose.vue.mjs +79 -0
- package/es/modules/global-modal/src/components/ModalClose.vue3.mjs +6 -0
- package/es/modules/global-modal/src/components/ModalFooter.vue.d.ts +270 -0
- package/es/modules/global-modal/src/components/ModalFooter.vue.mjs +44 -0
- package/es/modules/global-modal/src/components/ModalFooter.vue2.mjs +5 -0
- package/es/modules/global-modal/src/components/ModalHeader.vue.d.ts +17 -0
- package/es/modules/global-modal/src/components/ModalHeader.vue.mjs +11 -0
- package/es/modules/global-modal/src/components/ModalHeader.vue2.mjs +13 -0
- package/es/modules/global-modal/src/components/ModalWrapper.vue.d.ts +95 -0
- package/es/modules/global-modal/src/components/ModalWrapper.vue.mjs +26 -0
- package/es/modules/global-modal/src/components/ModalWrapper.vue2.mjs +136 -0
- package/es/modules/global-modal/src/hooks/useModal.d.ts +6 -0
- package/es/modules/global-modal/src/hooks/useModal.mjs +120 -0
- package/es/modules/global-modal/src/hooks/useModalContext.d.ts +5 -0
- package/es/modules/global-modal/src/hooks/useModalContext.mjs +11 -0
- package/es/modules/global-modal/src/hooks/useModalDrag.d.ts +7 -0
- package/es/modules/global-modal/src/hooks/useModalDrag.mjs +82 -0
- package/es/modules/global-modal/src/hooks/useModalFullScreen.d.ts +11 -0
- package/es/modules/global-modal/src/hooks/useModalFullScreen.mjs +16 -0
- package/es/modules/global-modal/src/index.css +153 -0
- package/es/modules/global-modal/src/props.d.ts +156 -0
- package/es/modules/global-modal/src/props.mjs +57 -0
- package/es/modules/global-modal/src/typing.d.ts +174 -0
- package/es/modules/target-loading/index.d.ts +4 -0
- package/es/modules/target-loading/src/createLoading.d.ts +13 -0
- package/es/modules/target-loading/src/createLoading.mjs +57 -0
- package/es/modules/target-loading/src/target-loading.css +18 -0
- package/es/modules/target-loading/src/target-loading.vue.d.ts +57 -0
- package/es/modules/target-loading/src/target-loading.vue.mjs +52 -0
- package/es/modules/target-loading/src/target-loading.vue3.mjs +7 -0
- package/es/modules/target-loading/src/typing.d.ts +9 -0
- package/es/modules/target-loading/src/useLoading.d.ts +9 -0
- package/es/setup-app.d.ts +1 -0
- package/es/setup-app.mjs +4 -0
- package/es/types/index.d.ts +190 -0
- package/es/utils/index.d.ts +4 -1
- package/es/utils/message-util/message-util.d.ts +7 -0
- package/es/utils/message-util/message-util.mjs +26 -0
- package/es/utils/monaco-loader/monaco-loader.d.ts +59 -0
- package/es/utils/monaco-loader/monaco-loader.mjs +88 -0
- package/es/utils/overlay-controller/overlay-controller.d.ts +18 -0
- package/es/utils/overlay-controller/overlay-controller.mjs +23 -0
- package/es/utils/with-install.mjs +0 -1
- package/es/widgets/gct-edit-form/gct-edit-form.d.ts +1 -1
- package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.d.ts +1 -1
- package/package.json +19 -8
- package/dist/index.min.css.css +0 -1
- package/es/components/code-editor/code-editor.scss +0 -3
- package/es/components/layout/flex-container/flex-container.scss +0 -3
- package/es/components/layout/flex-item/flex-item.scss +0 -17
- package/es/components/layout/view-container/view-container.scss +0 -19
- package/es/editor/gct-form-check-switch/gct-form-check-switch.mjs +0 -53
- package/es/editor/gct-form-check-switch/gct-form-check-switch.provider.mjs +0 -6
- package/es/editor/gct-form-check-switch/gct-form-check-switch.scss +0 -10
- package/es/editor/gct-form-check-switch/index.mjs +0 -12
- package/es/editor/gct-form-checkbox/gct-form-checkbox.mjs +0 -70
- package/es/editor/gct-form-checkbox/gct-form-checkbox.scss +0 -56
- package/es/editor/gct-form-checkbox/index.mjs +0 -19
- package/es/editor/gct-form-color/gct-form-color.mjs +0 -45
- package/es/editor/gct-form-color/gct-form-color.provider.mjs +0 -6
- package/es/editor/gct-form-color/gct-form-color.scss +0 -3
- package/es/editor/gct-form-color/index.mjs +0 -17
- package/es/editor/gct-form-field-select/gct-form-field-select.mjs +0 -48
- package/es/editor/gct-form-field-select/gct-form-field-select.provider.mjs +0 -6
- package/es/editor/gct-form-field-select/gct-form-field-select.scss +0 -7
- package/es/editor/gct-form-field-select/gct-model-select.vue +0 -70
- package/es/editor/gct-form-field-select/index.mjs +0 -12
- package/es/editor/gct-form-i18n/gct-form-i18n.mjs +0 -62
- package/es/editor/gct-form-i18n/gct-form-i18n.provider.mjs +0 -6
- package/es/editor/gct-form-i18n/index.mjs +0 -12
- package/es/editor/gct-form-icon-select/gct-form-icon-select.mjs +0 -74
- package/es/editor/gct-form-icon-select/gct-form-icon-select.scss +0 -14
- package/es/editor/gct-form-icon-select/index.mjs +0 -14
- package/es/editor/gct-form-info/gct-form-info.mjs +0 -40
- package/es/editor/gct-form-info/gct-form-info.scss +0 -8
- package/es/editor/gct-form-info/index.mjs +0 -14
- package/es/editor/gct-form-length-unit/gct-form-length-unit.mjs +0 -43
- package/es/editor/gct-form-length-unit/gct-form-length-unit.provider.mjs +0 -6
- package/es/editor/gct-form-length-unit/index.mjs +0 -12
- package/es/editor/gct-form-modal-select/gct-form-modal-select.mjs +0 -99
- package/es/editor/gct-form-modal-select/gct-form-modal-select.provider.mjs +0 -6
- package/es/editor/gct-form-modal-select/gct-form-modal-select.scss +0 -7
- package/es/editor/gct-form-modal-select/index.mjs +0 -12
- package/es/editor/gct-form-number/gct-form-number.mjs +0 -44
- package/es/editor/gct-form-number/gct-form-number.provider.mjs +0 -6
- package/es/editor/gct-form-number/gct-form-number.scss +0 -3
- package/es/editor/gct-form-number/index.mjs +0 -17
- package/es/editor/gct-form-picker/gct-form-picker.mjs +0 -92
- package/es/editor/gct-form-picker/gct-form-picker.provider.mjs +0 -6
- package/es/editor/gct-form-picker/index.mjs +0 -12
- package/es/editor/gct-form-radio/gct-form-radio.mjs +0 -70
- package/es/editor/gct-form-radio/gct-form-radio.scss +0 -68
- package/es/editor/gct-form-radio/index.mjs +0 -19
- package/es/editor/gct-form-select/gct-form-select.mjs +0 -50
- package/es/editor/gct-form-select/gct-form-select.provider.mjs +0 -6
- package/es/editor/gct-form-select/index.mjs +0 -12
- package/es/editor/gct-form-span/gct-form-span.mjs +0 -89
- package/es/editor/gct-form-span/gct-form-span.provider.mjs +0 -6
- package/es/editor/gct-form-span/gct-form-span.scss +0 -10
- package/es/editor/gct-form-span/index.mjs +0 -12
- package/es/editor/gct-form-switch/gct-form-switch.mjs +0 -35
- package/es/editor/gct-form-switch/gct-form-switch.provider.mjs +0 -6
- package/es/editor/gct-form-switch/index.mjs +0 -17
- package/es/editor/gct-form-text/gct-form-text.mjs +0 -45
- package/es/editor/gct-form-text/gct-form-text.provider.mjs +0 -6
- package/es/editor/gct-form-text/index.mjs +0 -17
- package/es/editor/gct-form-textarea/gct-form-textarea.mjs +0 -40
- package/es/editor/gct-form-textarea/gct-form-textarea.provider.mjs +0 -6
- package/es/editor/gct-form-textarea/index.mjs +0 -12
- package/es/editor/index.mjs +0 -51
- package/es/utils/index.mjs +0 -3
- package/es/vite-env.d.ts +0 -1
- package/es/widgets/gct-edit-form/gct-edit-form.mjs +0 -126
- package/es/widgets/gct-edit-form/index.mjs +0 -10
- package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.mjs +0 -73
- package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.provider.mjs +0 -11
- package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.scss +0 -62
- package/es/widgets/gct-form/gct-form-collapse/index.mjs +0 -15
- package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.mjs +0 -71
- package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.provider.mjs +0 -13
- package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.scss +0 -23
- package/es/widgets/gct-form/gct-form-collapse-pane/index.mjs +0 -15
- package/es/widgets/gct-form/gct-form-group/gct-form-group.mjs +0 -88
- package/es/widgets/gct-form/gct-form-group/gct-form-group.provider.mjs +0 -11
- package/es/widgets/gct-form/gct-form-group/gct-form-group.scss +0 -28
- package/es/widgets/gct-form/gct-form-group/index.mjs +0 -15
- package/es/widgets/gct-form/gct-form-hidden-item/gct-form-hidden-item.provider.mjs +0 -13
- package/es/widgets/gct-form/gct-form-item/gct-form-item.mjs +0 -141
- package/es/widgets/gct-form/gct-form-item/gct-form-item.provider.mjs +0 -11
- package/es/widgets/gct-form/gct-form-item/gct-form-item.scss +0 -115
- package/es/widgets/gct-form/gct-form-tab/gct-form-tab.mjs +0 -53
- package/es/widgets/gct-form/gct-form-tab/gct-form-tab.provider.mjs +0 -11
- package/es/widgets/gct-form/gct-form-tab/gct-form-tab.scss +0 -63
- package/es/widgets/gct-form/gct-form-tab/index.mjs +0 -12
- package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.mjs +0 -65
- package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.provider.mjs +0 -11
- package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.scss +0 -16
- package/es/widgets/gct-form/gct-form-tab-pane/index.mjs +0 -15
- package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.mjs +0 -71
- package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.provider.mjs +0 -11
- package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.scss +0 -25
- package/es/widgets/gct-form/gct-form-title-group/index.mjs +0 -16
- package/es/widgets/gct-form/gct-form.mjs +0 -112
- package/es/widgets/gct-form/gct-form.scss +0 -11
- package/es/widgets/gct-form/index.mjs +0 -31
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, computed, watchEffect, unref, onMounted, onUnmounted, nextTick } from 'vue';
|
|
2
|
+
import { useWindowSize, useMutationObserver } from '@vueuse/core';
|
|
3
|
+
import { createModalContext } from '../hooks/useModalContext.mjs';
|
|
4
|
+
|
|
5
|
+
const props = {
|
|
6
|
+
loading: { type: Boolean },
|
|
7
|
+
useWrapper: { type: Boolean, default: true },
|
|
8
|
+
modalHeaderHeight: { type: Number, default: 57 },
|
|
9
|
+
modalFooterHeight: { type: Number, default: 74 },
|
|
10
|
+
minHeight: { type: Number, default: 320 },
|
|
11
|
+
height: { type: Number },
|
|
12
|
+
footerOffset: { type: Number, default: 0 },
|
|
13
|
+
visible: { type: Boolean },
|
|
14
|
+
fullScreen: { type: Boolean },
|
|
15
|
+
loadingTip: { type: String }
|
|
16
|
+
};
|
|
17
|
+
const _sfc_main = defineComponent({
|
|
18
|
+
name: "ModalWrapper",
|
|
19
|
+
inheritAttrs: false,
|
|
20
|
+
props,
|
|
21
|
+
emits: ["height-change", "ext-height"],
|
|
22
|
+
setup(props2, { emit }) {
|
|
23
|
+
const wrapperRef = ref();
|
|
24
|
+
const spinRef = ref(null);
|
|
25
|
+
const realHeightRef = ref(0);
|
|
26
|
+
const minRealHeightRef = ref(0);
|
|
27
|
+
let realHeight = 0;
|
|
28
|
+
const spinStyle = ref();
|
|
29
|
+
const { width, height } = useWindowSize();
|
|
30
|
+
watch([height, width], () => {
|
|
31
|
+
setModalHeight();
|
|
32
|
+
});
|
|
33
|
+
useMutationObserver(
|
|
34
|
+
spinRef,
|
|
35
|
+
() => {
|
|
36
|
+
setModalHeight();
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
attributes: true,
|
|
40
|
+
subtree: true
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
createModalContext({
|
|
44
|
+
redoModalHeight: setModalHeight
|
|
45
|
+
});
|
|
46
|
+
const scrollHeight = computed(() => {
|
|
47
|
+
const modalheight = window.innerHeight * 0.88 - 120;
|
|
48
|
+
return {
|
|
49
|
+
height: `${props2.height ? modalheight > props2.height - 120 ? props2.height - 120 : modalheight : props2.height}px`
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
watchEffect(() => {
|
|
53
|
+
props2.useWrapper && setModalHeight();
|
|
54
|
+
});
|
|
55
|
+
watch(
|
|
56
|
+
() => props2.fullScreen,
|
|
57
|
+
(v) => {
|
|
58
|
+
setModalHeight();
|
|
59
|
+
if (!v) {
|
|
60
|
+
realHeightRef.value = minRealHeightRef.value;
|
|
61
|
+
} else {
|
|
62
|
+
minRealHeightRef.value = realHeightRef.value;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
const observer = new ResizeObserver((entries) => {
|
|
67
|
+
for (let entry of entries) {
|
|
68
|
+
const height2 = entry.contentRect.height;
|
|
69
|
+
const modalheight = height2 * 0.88 - 152;
|
|
70
|
+
spinStyle.value = {
|
|
71
|
+
height: `${props2.height ? modalheight > props2.height - 152 ? props2.height - 152 : modalheight : props2.height}px`,
|
|
72
|
+
minHeight: `${props2.minHeight - 152}px`,
|
|
73
|
+
[props2.fullScreen ? "height" : "maxHeight"]: `${unref(realHeightRef)}px`,
|
|
74
|
+
maxHeight: `calc(88vh - 152px)`
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
observer.observe(document.documentElement);
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
const { modalHeaderHeight, modalFooterHeight } = props2;
|
|
81
|
+
emit("ext-height", modalHeaderHeight + modalFooterHeight);
|
|
82
|
+
});
|
|
83
|
+
onUnmounted(() => {
|
|
84
|
+
});
|
|
85
|
+
async function scrollTop() {
|
|
86
|
+
nextTick(() => {
|
|
87
|
+
if (wrapperRef.value) {
|
|
88
|
+
wrapperRef.value.getElement()?.scrollTo(0, 0);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async function setModalHeight() {
|
|
93
|
+
if (!props2.visible) return;
|
|
94
|
+
if (!wrapperRef.value) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const bodyDom = wrapperRef.value?.getElement()?.parentElement;
|
|
98
|
+
if (!bodyDom) return;
|
|
99
|
+
bodyDom.style.padding = "0";
|
|
100
|
+
await nextTick();
|
|
101
|
+
try {
|
|
102
|
+
const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement;
|
|
103
|
+
if (!modalDom) return;
|
|
104
|
+
const modalRect = getComputedStyle(modalDom).top;
|
|
105
|
+
const modalTop = Number.parseInt(modalRect);
|
|
106
|
+
let maxHeight = window.innerHeight - modalTop * 2 + (props2.footerOffset || 0) - props2.modalFooterHeight - props2.modalHeaderHeight;
|
|
107
|
+
if (modalTop < 40) {
|
|
108
|
+
maxHeight -= 26;
|
|
109
|
+
}
|
|
110
|
+
await nextTick();
|
|
111
|
+
const spinEl = unref(spinRef);
|
|
112
|
+
if (!spinEl) return;
|
|
113
|
+
await nextTick();
|
|
114
|
+
realHeight = spinEl.scrollHeight;
|
|
115
|
+
if (props2.fullScreen) {
|
|
116
|
+
realHeightRef.value = window.innerHeight - props2.modalFooterHeight - props2.modalHeaderHeight - 28;
|
|
117
|
+
} else {
|
|
118
|
+
realHeightRef.value = props2.height ? props2.height : realHeight > maxHeight ? maxHeight : realHeight;
|
|
119
|
+
}
|
|
120
|
+
emit("height-change", unref(realHeightRef));
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(error);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
wrapperRef,
|
|
127
|
+
spinRef,
|
|
128
|
+
spinStyle,
|
|
129
|
+
scrollTop,
|
|
130
|
+
setModalHeight,
|
|
131
|
+
scrollHeight
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseModalReturnType, UseModalInnerReturnType } from '../typing';
|
|
2
|
+
/**
|
|
3
|
+
* @description: Applicable to independent modal and call outside
|
|
4
|
+
*/
|
|
5
|
+
export declare function useModal(): UseModalReturnType;
|
|
6
|
+
export declare const useModalInner: (callbackFn?: Fn) => UseModalInnerReturnType;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { reactive, ref, computed, unref, getCurrentInstance, watchEffect, nextTick, onUnmounted, toRaw } from 'vue';
|
|
2
|
+
import { isFunction, isEqual } from 'lodash-es';
|
|
3
|
+
import { tryOnUnmounted } from '@vueuse/core';
|
|
4
|
+
|
|
5
|
+
const dataTransfer = reactive({});
|
|
6
|
+
const visibleData = reactive({});
|
|
7
|
+
function useModal() {
|
|
8
|
+
const modal = ref(null);
|
|
9
|
+
const loaded = ref(false);
|
|
10
|
+
const uid = ref("");
|
|
11
|
+
function register(modalMethod, uuid) {
|
|
12
|
+
if (!getCurrentInstance()) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"useModal() can only be used inside setup() or functional components!"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
uid.value = uuid || "";
|
|
18
|
+
onUnmounted(() => {
|
|
19
|
+
modal.value = null;
|
|
20
|
+
loaded.value = false;
|
|
21
|
+
dataTransfer[unref(uid)] = null;
|
|
22
|
+
});
|
|
23
|
+
if (unref(loaded) && modalMethod === unref(modal)) return;
|
|
24
|
+
modal.value = modalMethod;
|
|
25
|
+
loaded.value = true;
|
|
26
|
+
modalMethod.emitVisible = (visible, uid2) => {
|
|
27
|
+
visibleData[uid2] = visible;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const getInstance = () => {
|
|
31
|
+
const instance = unref(modal);
|
|
32
|
+
if (!instance) {
|
|
33
|
+
throw new Error("useModal instance is undefined!");
|
|
34
|
+
}
|
|
35
|
+
return instance;
|
|
36
|
+
};
|
|
37
|
+
const methods = {
|
|
38
|
+
setModalProps: (props) => {
|
|
39
|
+
getInstance()?.setModalProps(props);
|
|
40
|
+
},
|
|
41
|
+
getVisible: computed(() => {
|
|
42
|
+
return visibleData[~~unref(uid)];
|
|
43
|
+
}),
|
|
44
|
+
redoModalHeight: () => {
|
|
45
|
+
getInstance()?.redoModalHeight?.();
|
|
46
|
+
},
|
|
47
|
+
openModal: (visible = true, data, openOnSet = true) => {
|
|
48
|
+
getInstance()?.setModalProps({
|
|
49
|
+
visible
|
|
50
|
+
});
|
|
51
|
+
const id = unref(uid);
|
|
52
|
+
if (openOnSet) {
|
|
53
|
+
dataTransfer[id] = null;
|
|
54
|
+
dataTransfer[id] = toRaw(data);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const equal = isEqual(toRaw(dataTransfer[id]), toRaw(data));
|
|
58
|
+
if (!equal) {
|
|
59
|
+
dataTransfer[id] = toRaw(data);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
closeModal: () => {
|
|
63
|
+
getInstance()?.setModalProps({ visible: false });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return [register, methods];
|
|
67
|
+
}
|
|
68
|
+
const useModalInner = (callbackFn) => {
|
|
69
|
+
const modalInstanceRef = ref(null);
|
|
70
|
+
const currentInstance = getCurrentInstance();
|
|
71
|
+
const uidRef = ref("");
|
|
72
|
+
const getInstance = () => {
|
|
73
|
+
const instance = unref(modalInstanceRef);
|
|
74
|
+
if (!instance) {
|
|
75
|
+
throw new Error("useModalInner instance is undefined!");
|
|
76
|
+
}
|
|
77
|
+
return instance;
|
|
78
|
+
};
|
|
79
|
+
const register = (modalInstance, uuid) => {
|
|
80
|
+
tryOnUnmounted(() => {
|
|
81
|
+
modalInstanceRef.value = null;
|
|
82
|
+
});
|
|
83
|
+
uidRef.value = uuid || "";
|
|
84
|
+
modalInstanceRef.value = modalInstance;
|
|
85
|
+
currentInstance?.emit("register", modalInstance, uuid);
|
|
86
|
+
};
|
|
87
|
+
watchEffect(() => {
|
|
88
|
+
const data = dataTransfer[unref(uidRef)];
|
|
89
|
+
if (!callbackFn || !isFunction(callbackFn)) return;
|
|
90
|
+
nextTick(() => {
|
|
91
|
+
callbackFn(data);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
return [
|
|
95
|
+
register,
|
|
96
|
+
{
|
|
97
|
+
changeLoading: (loading = true) => {
|
|
98
|
+
getInstance()?.setModalProps({ loading });
|
|
99
|
+
},
|
|
100
|
+
getVisible: computed(() => {
|
|
101
|
+
return visibleData[~~unref(uidRef)];
|
|
102
|
+
}),
|
|
103
|
+
changeOkLoading: (loading = true) => {
|
|
104
|
+
getInstance()?.setModalProps({ confirmLoading: loading });
|
|
105
|
+
},
|
|
106
|
+
closeModal: () => {
|
|
107
|
+
getInstance()?.setModalProps({ visible: false });
|
|
108
|
+
},
|
|
109
|
+
setModalProps: (props) => {
|
|
110
|
+
getInstance()?.setModalProps(props);
|
|
111
|
+
},
|
|
112
|
+
redoModalHeight: () => {
|
|
113
|
+
const callRedo = getInstance()?.redoModalHeight;
|
|
114
|
+
callRedo?.();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
];
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export { useModal, useModalInner };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { provide, inject } from 'vue';
|
|
2
|
+
|
|
3
|
+
const key = /* @__PURE__ */ Symbol();
|
|
4
|
+
function createModalContext(context) {
|
|
5
|
+
return provide(key, context);
|
|
6
|
+
}
|
|
7
|
+
function useModalContext() {
|
|
8
|
+
return inject(key);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { createModalContext, useModalContext };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useTimeoutFn } from '@vueuse/core';
|
|
2
|
+
import { watchEffect, unref } from 'vue';
|
|
3
|
+
|
|
4
|
+
function useModalDragMove(context) {
|
|
5
|
+
const getStyle = (dom, attr) => {
|
|
6
|
+
return getComputedStyle(dom)[attr];
|
|
7
|
+
};
|
|
8
|
+
const drag = (wrap) => {
|
|
9
|
+
if (!wrap) return;
|
|
10
|
+
wrap.setAttribute("data-drag", unref(context.draggable));
|
|
11
|
+
const dialogHeaderEl = wrap.querySelector(".ant-modal-header");
|
|
12
|
+
const dragDom = wrap.querySelector(".ant-modal");
|
|
13
|
+
if (!dialogHeaderEl || !dragDom || !unref(context.draggable)) return;
|
|
14
|
+
dialogHeaderEl.style.cursor = "move";
|
|
15
|
+
dialogHeaderEl.onmousedown = (e) => {
|
|
16
|
+
if (!e) return;
|
|
17
|
+
const disX = e.clientX;
|
|
18
|
+
const disY = e.clientY;
|
|
19
|
+
const screenWidth = document.body.clientWidth;
|
|
20
|
+
const screenHeight = document.documentElement.clientHeight;
|
|
21
|
+
const dragDomWidth = dragDom.offsetWidth;
|
|
22
|
+
const dragDomheight = dragDom.offsetHeight;
|
|
23
|
+
const minDragDomLeft = dragDom.offsetLeft;
|
|
24
|
+
const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth;
|
|
25
|
+
const minDragDomTop = dragDom.offsetTop;
|
|
26
|
+
const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight;
|
|
27
|
+
const domLeft = getStyle(dragDom, "left");
|
|
28
|
+
const domTop = getStyle(dragDom, "top");
|
|
29
|
+
let styL = +domLeft;
|
|
30
|
+
let styT = +domTop;
|
|
31
|
+
if (domLeft.includes("%")) {
|
|
32
|
+
styL = +document.body.clientWidth * (+domLeft.replace(/%/g, "") / 100);
|
|
33
|
+
styT = +document.body.clientHeight * (+domTop.replace(/%/g, "") / 100);
|
|
34
|
+
} else {
|
|
35
|
+
styL = +domLeft.replace(/px/g, "");
|
|
36
|
+
styT = +domTop.replace(/px/g, "");
|
|
37
|
+
}
|
|
38
|
+
document.onmousemove = function(e2) {
|
|
39
|
+
let left = e2.clientX - disX;
|
|
40
|
+
let top = e2.clientY - disY;
|
|
41
|
+
if (-left > minDragDomLeft) {
|
|
42
|
+
left = -minDragDomLeft;
|
|
43
|
+
} else if (left > maxDragDomLeft) {
|
|
44
|
+
left = maxDragDomLeft;
|
|
45
|
+
}
|
|
46
|
+
if (-top > minDragDomTop) {
|
|
47
|
+
top = -minDragDomTop;
|
|
48
|
+
} else if (top > maxDragDomTop) {
|
|
49
|
+
top = maxDragDomTop;
|
|
50
|
+
}
|
|
51
|
+
dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`;
|
|
52
|
+
};
|
|
53
|
+
document.onmouseup = () => {
|
|
54
|
+
document.onmousemove = null;
|
|
55
|
+
document.onmouseup = null;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const handleDrag = () => {
|
|
60
|
+
const dragWraps = document.querySelectorAll(".ant-modal-wrap");
|
|
61
|
+
for (const wrap of Array.from(dragWraps)) {
|
|
62
|
+
if (!wrap) continue;
|
|
63
|
+
const display = getStyle(wrap, "display");
|
|
64
|
+
const draggable = wrap.getAttribute("data-drag");
|
|
65
|
+
if (display !== "none") {
|
|
66
|
+
if (draggable === null || unref(context.destroyOnClose)) {
|
|
67
|
+
drag(wrap);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
watchEffect(() => {
|
|
73
|
+
if (!unref(context.visible) || !unref(context.draggable)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
useTimeoutFn(() => {
|
|
77
|
+
handleDrag();
|
|
78
|
+
}, 30);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { useModalDragMove };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component, Ref } from 'vue';
|
|
2
|
+
export interface UseFullScreenContext {
|
|
3
|
+
wrapClassName: Ref<string | undefined>;
|
|
4
|
+
modalWrapperRef: Ref<Component>;
|
|
5
|
+
extHeightRef: Ref<number>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useFullScreen(context: UseFullScreenContext): {
|
|
8
|
+
getWrapClassName: import('vue').ComputedRef<string>;
|
|
9
|
+
handleFullScreen: (e: Event) => void;
|
|
10
|
+
fullScreenRef: Ref<boolean, boolean>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ref, computed, unref } from 'vue';
|
|
2
|
+
|
|
3
|
+
function useFullScreen(context) {
|
|
4
|
+
const fullScreenRef = ref(false);
|
|
5
|
+
const getWrapClassName = computed(() => {
|
|
6
|
+
const clsName = unref(context.wrapClassName) || "";
|
|
7
|
+
return unref(fullScreenRef) ? `fullscreen-modal ${clsName} ` : unref(clsName);
|
|
8
|
+
});
|
|
9
|
+
function handleFullScreen(e) {
|
|
10
|
+
e?.stopPropagation();
|
|
11
|
+
fullScreenRef.value = !unref(fullScreenRef);
|
|
12
|
+
}
|
|
13
|
+
return { getWrapClassName, handleFullScreen, fullScreenRef };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { useFullScreen };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
.vben.fullscreen-modal {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
.vben.fullscreen-modal .ant-modal {
|
|
5
|
+
inset: 0 !important;
|
|
6
|
+
width: 100% !important;
|
|
7
|
+
max-width: 100vw !important;
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
.vben.fullscreen-modal .ant-modal-content {
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
.vben .ant-modal {
|
|
14
|
+
width: 520px;
|
|
15
|
+
padding-bottom: 0;
|
|
16
|
+
}
|
|
17
|
+
.vben .ant-modal .ant-modal-body > .scrollbar {
|
|
18
|
+
height: 100%;
|
|
19
|
+
padding: 14px;
|
|
20
|
+
}
|
|
21
|
+
.vben .ant-modal .ant-modal-body > .scrollbar .scrollbar__wrap {
|
|
22
|
+
max-height: calc(88vh - 152px);
|
|
23
|
+
}
|
|
24
|
+
.vben .ant-modal-title {
|
|
25
|
+
font-size: 16px;
|
|
26
|
+
font-weight: bold;
|
|
27
|
+
}
|
|
28
|
+
.vben .ant-modal-title .base-title {
|
|
29
|
+
cursor: move !important;
|
|
30
|
+
}
|
|
31
|
+
.vben .ant-modal .ant-modal-body {
|
|
32
|
+
height: calc(100% - 120px);
|
|
33
|
+
max-height: calc(88vh - 120px);
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
36
|
+
.vben .ant-modal .ant-modal-body > .scrollbar > .scrollbar__bar.is-horizontal {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
.vben .ant-modal-large {
|
|
40
|
+
top: 60px;
|
|
41
|
+
}
|
|
42
|
+
.vben .ant-modal-large--mini {
|
|
43
|
+
top: 16px;
|
|
44
|
+
}
|
|
45
|
+
.vben .ant-modal-header {
|
|
46
|
+
padding: 16px;
|
|
47
|
+
}
|
|
48
|
+
.vben .ant-modal-content {
|
|
49
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
50
|
+
}
|
|
51
|
+
.vben .ant-modal-footer {
|
|
52
|
+
padding: 16px;
|
|
53
|
+
}
|
|
54
|
+
.vben .ant-modal-footer button + button {
|
|
55
|
+
margin-left: 16px;
|
|
56
|
+
}
|
|
57
|
+
.vben .ant-modal-close {
|
|
58
|
+
outline: none;
|
|
59
|
+
font-weight: normal;
|
|
60
|
+
}
|
|
61
|
+
.vben .ant-modal-close-x {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
width: 96px;
|
|
64
|
+
height: 56px;
|
|
65
|
+
line-height: 56px;
|
|
66
|
+
}
|
|
67
|
+
.vben .ant-modal-confirm-body .ant-modal-confirm-content > * {
|
|
68
|
+
color: #909399;
|
|
69
|
+
}
|
|
70
|
+
.vben .ant-modal-confirm-confirm.error .ant-modal-confirm-body > .anticon {
|
|
71
|
+
color: var(--gct-color-error);
|
|
72
|
+
}
|
|
73
|
+
.vben .ant-modal-confirm-btns .ant-btn:last-child {
|
|
74
|
+
margin-right: 0;
|
|
75
|
+
}
|
|
76
|
+
.vben .ant-modal-confirm-info .ant-modal-confirm-body > .anticon {
|
|
77
|
+
color: var(--gct-color-warning);
|
|
78
|
+
}
|
|
79
|
+
.vben .ant-modal-confirm-confirm.success .ant-modal-confirm-body > .anticon {
|
|
80
|
+
color: var(--gct-color-success);
|
|
81
|
+
}
|
|
82
|
+
.vben .ant-modal-confirm .ant-modal-body {
|
|
83
|
+
padding: 24px !important;
|
|
84
|
+
}
|
|
85
|
+
/* stylelint-disable-next-line media-feature-range-notation */
|
|
86
|
+
@media screen and (max-height: 600px) {
|
|
87
|
+
.ant-modal {
|
|
88
|
+
top: 60px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/* stylelint-disable-next-line media-feature-range-notation */
|
|
92
|
+
@media screen and (max-height: 540px) {
|
|
93
|
+
.ant-modal {
|
|
94
|
+
top: 30px;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/* stylelint-disable-next-line media-feature-range-notation */
|
|
98
|
+
@media screen and (max-height: 480px) {
|
|
99
|
+
.ant-modal {
|
|
100
|
+
top: 10px;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
.options-field-modal.ant-modal .ant-modal-content .ant-modal-body {
|
|
104
|
+
padding-bottom: 0;
|
|
105
|
+
}
|
|
106
|
+
.ant-modal-footer .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
|
|
107
|
+
margin-left: 16px;
|
|
108
|
+
}
|
|
109
|
+
.ant-modal {
|
|
110
|
+
max-height: 88vh;
|
|
111
|
+
}
|
|
112
|
+
.ant-modal .ant-modal-content {
|
|
113
|
+
border-radius: 4px;
|
|
114
|
+
}
|
|
115
|
+
.ant-modal.ant-modal-confirm .ant-modal-body {
|
|
116
|
+
padding: 16px;
|
|
117
|
+
}
|
|
118
|
+
.ant-modal .ant-modal-confirm-body > .anticon {
|
|
119
|
+
margin-right: 8px;
|
|
120
|
+
}
|
|
121
|
+
.ant-modal .ant-modal-confirm-body > .anticon .iconfont {
|
|
122
|
+
top: 4px !important;
|
|
123
|
+
font-size: 14px;
|
|
124
|
+
}
|
|
125
|
+
.ant-modal .ant-modal-confirm-body > .anticon > svg {
|
|
126
|
+
width: 14px;
|
|
127
|
+
height: 14px;
|
|
128
|
+
margin-top: 3px;
|
|
129
|
+
}
|
|
130
|
+
.ant-modal .ant-modal-confirm-body > .ant-modal-confirm-title {
|
|
131
|
+
color: #1a1d23;
|
|
132
|
+
font-size: 14px;
|
|
133
|
+
line-height: unset;
|
|
134
|
+
}
|
|
135
|
+
.ant-modal .ant-modal-confirm-body > .ant-modal-confirm-content {
|
|
136
|
+
color: #5a5f6b;
|
|
137
|
+
font-size: 12px;
|
|
138
|
+
}
|
|
139
|
+
.ant-modal .ant-modal-confirm-body .anticon + .ant-modal-confirm-title + .ant-modal-confirm-content {
|
|
140
|
+
margin-left: 22px;
|
|
141
|
+
}
|
|
142
|
+
.ant-modal .ant-modal-confirm-btns {
|
|
143
|
+
margin-top: 12px;
|
|
144
|
+
}
|
|
145
|
+
.ant-modal .ant-modal-confirm-btns > .ant-btn {
|
|
146
|
+
height: 24px;
|
|
147
|
+
padding: 2px 10px;
|
|
148
|
+
color: #384356;
|
|
149
|
+
line-height: 16px;
|
|
150
|
+
}
|
|
151
|
+
.ant-modal .ant-modal-confirm-btns > .ant-btn.ant-btn-primary {
|
|
152
|
+
color: #fff;
|
|
153
|
+
}
|