@gct-paas/design 0.1.5-dev.6 → 0.1.5-dev.7
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.min.css +1 -1
- package/dist/loader.esm.min.js +1 -1
- package/es/components/design/design-content/design-content.css +76 -0
- package/es/components/design/design-content/design-content.d.ts +190 -0
- package/es/components/design/design-content/design-content.mjs +274 -0
- package/es/components/design/design-drag-item/design-drag-item.css +179 -0
- package/es/components/design/design-drag-item/design-drag-item.d.ts +56 -0
- package/es/components/design/design-drag-item/design-drag-item.mjs +237 -0
- package/es/components/design/design-drop-container/design-drop-container.css +103 -0
- package/es/components/design/design-drop-container/design-drop-container.d.ts +92 -0
- package/es/components/design/design-drop-container/design-drop-container.mjs +182 -0
- package/es/components/design/design-drop-line/design-drop-line.css +165 -0
- package/es/components/design/design-drop-line/design-drop-line.d.ts +73 -0
- package/es/components/design/design-drop-line/design-drop-line.mjs +136 -0
- package/es/components/design/design-item-actions/design-item-actions.css +97 -0
- package/es/components/design/design-item-actions/design-item-actions.d.ts +42 -0
- package/es/components/design/design-item-actions/design-item-actions.mjs +147 -0
- package/es/components/design/design-item-highlighter/design-item-highlighter.css +70 -0
- package/es/components/design/design-item-highlighter/design-item-highlighter.d.ts +168 -0
- package/es/components/design/design-item-highlighter/design-item-highlighter.mjs +155 -0
- package/es/components/design/design-item-highlighter-container/design-item-highlighter-container.css +85 -0
- package/es/components/design/design-item-highlighter-container/design-item-highlighter-container.d.ts +53 -0
- package/es/components/design/design-item-highlighter-container/design-item-highlighter-container.mjs +169 -0
- package/es/components/design/design-item-hover-title/design-item-hover-title.css +12 -0
- package/es/components/design/design-item-hover-title/design-item-hover-title.d.ts +60 -0
- package/es/components/design/design-item-hover-title/design-item-hover-title.mjs +60 -0
- package/es/components/design/design-item-preview/design-item-preview.css +91 -0
- package/es/components/design/design-item-preview/design-item-preview.d.ts +1 -0
- package/es/components/design/design-item-preview/design-item-preview.mjs +32 -0
- package/es/components/design/design-not-drag-item/design-not-drag-item.css +67 -0
- package/es/components/design/design-not-drag-item/design-not-drag-item.d.ts +50 -0
- package/es/components/design/design-not-drag-item/design-not-drag-item.mjs +68 -0
- package/es/components/design/design-not-found/design-not-found.css +68 -0
- package/es/components/design/design-not-found/design-not-found.d.ts +14 -0
- package/es/components/design/design-not-found/design-not-found.mjs +19 -0
- package/es/components/design/index.d.ts +2 -0
- package/es/components/design/index.mjs +2 -0
- package/es/components/design-save-tip/design-save-tip.mjs +1 -1
- package/es/components/editor/index.mjs +2 -0
- package/es/components/editor/length-unit-editor/length-unit-editor.vue.d.ts +13 -0
- package/es/components/editor/length-unit-editor/length-unit-editor.vue.mjs +5 -0
- package/es/components/editor/length-unit-editor/length-unit-editor.vue_vue_type_script_setup_true_name_length-unit-editor_lang.mjs +47 -0
- package/es/components/field-transfer/components/field-transfer-modal.vue.mjs +2 -2
- package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_script_setup_true_name_field-transfer-modal_lang.mjs +1 -1
- package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_281e33fe_lang.css +8 -0
- package/es/components/index.d.ts +4 -1
- package/es/components/index.mjs +9 -2
- package/es/components/material/index.d.ts +1 -0
- package/es/components/material/index.mjs +1 -0
- package/es/components/material/material-content/material-content.css +86 -0
- package/es/components/material/material-content/material-content.d.ts +1 -0
- package/es/components/material/material-content/material-content.mjs +49 -0
- package/es/components/material/material-module/material-module.css +104 -0
- package/es/components/material/material-module/material-module.d.ts +60 -0
- package/es/components/material/material-module/material-module.mjs +67 -0
- package/es/components/material/material-module-drag-container/material-module-drag-container.css +69 -0
- package/es/components/material/material-module-drag-container/material-module-drag-container.d.ts +56 -0
- package/es/components/material/material-module-drag-container/material-module-drag-container.mjs +21 -0
- package/es/components/material/material-module-drag-item/material-module-drag-item.css +83 -0
- package/es/components/material/material-module-drag-item/material-module-drag-item.d.ts +13 -0
- package/es/components/material/material-module-drag-item/material-module-drag-item.mjs +66 -0
- package/es/components/material/material-outline-tree/material-outline-tree.css +81 -0
- package/es/components/material/material-outline-tree/material-outline-tree.d.ts +13 -0
- package/es/components/material/material-outline-tree/material-outline-tree.mjs +67 -0
- package/es/components/material/material-tab-pane/material-tab-pane.css +68 -0
- package/es/components/material/material-tab-pane/material-tab-pane.d.ts +13 -0
- package/es/components/material/material-tab-pane/material-tab-pane.mjs +19 -0
- package/es/components/material/material-tabs/material-tabs.css +105 -0
- package/es/components/material/material-tabs/material-tabs.d.ts +103 -0
- package/es/components/material/material-tabs/material-tabs.mjs +44 -0
- package/es/components/modal-name-editor/modal-name-editor.d.ts +1 -11
- package/es/components/modal-name-editor/modal-name-editor.mjs +27 -38
- package/es/components/multi-field/index.d.ts +2 -0
- package/es/components/multi-field/index.mjs +1 -0
- package/es/components/multi-field/multi-field-display.vue.d.ts +8 -0
- package/es/components/multi-field/multi-field-display.vue.mjs +7 -0
- package/es/components/multi-field/multi-field-display.vue_vue_type_script_setup_true_lang.mjs +32 -0
- package/es/components/multi-field/multi-field-display.vue_vue_type_style_index_0_scoped_802ade7b_lang.css +4 -0
- package/es/components/multi-field/multi-field-item.vue.d.ts +6 -0
- package/es/components/multi-field/multi-field-item.vue.mjs +7 -0
- package/es/components/multi-field/multi-field-item.vue_vue_type_script_setup_true_lang.mjs +47 -0
- package/es/components/multi-field/multi-field-item.vue_vue_type_style_index_0_scoped_881cb08e_lang.css +31 -0
- package/es/components/panel/index.d.ts +1 -0
- package/es/components/panel/index.mjs +1 -0
- package/es/components/panel/panel-content/panel-content.css +189 -0
- package/es/components/panel/panel-content/panel-content.d.ts +19 -0
- package/es/components/panel/panel-content/panel-content.mjs +48 -0
- package/es/components/panel/panel-form/panel-form.css +67 -0
- package/es/components/panel/panel-form/panel-form.d.ts +62 -0
- package/es/components/panel/panel-form/panel-form.mjs +59 -0
- package/es/components/panel/panel-path/panel-path.css +89 -0
- package/es/components/panel/panel-path/panel-path.d.ts +35 -0
- package/es/components/panel/panel-path/panel-path.mjs +52 -0
- package/es/components/user-occupy/user-occupy.vue.mjs +2 -2
- package/es/components/user-occupy/user-occupy.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/es/components/user-occupy/{user-occupy.vue_vue_type_style_index_0_scoped_24cb9749_lang.css → user-occupy.vue_vue_type_style_index_0_scoped_9b136922_lang.css} +6 -6
- package/es/controller/index.d.ts +1 -0
- package/es/controller/index.mjs +1 -0
- package/es/controller/view/design-view.controller.d.ts +48 -0
- package/es/controller/view/design-view.controller.mjs +150 -0
- package/es/create-app-vue.mjs +2 -0
- package/es/editor/content-tag-style/content-tag-style.css +164 -0
- package/es/editor/content-tag-style/content-tag-style.d.ts +112 -0
- package/es/editor/content-tag-style/content-tag-style.mjs +80 -0
- package/es/editor/content-tag-style/index.d.ts +8 -0
- package/es/editor/content-tag-style/index.mjs +11 -0
- package/es/editor/field-info-editor/field-info-editor.css +125 -0
- package/es/editor/field-info-editor/field-info-editor.d.ts +111 -0
- package/es/editor/field-info-editor/field-info-editor.mjs +38 -0
- package/es/editor/field-info-editor/index.d.ts +8 -0
- package/es/editor/field-info-editor/index.mjs +9 -0
- package/es/editor/index.d.ts +5 -0
- package/es/editor/index.mjs +19 -0
- package/es/editor/model-field-select/index.d.ts +8 -0
- package/es/editor/model-field-select/index.mjs +9 -0
- package/es/editor/model-field-select/model-field-select.css +148 -0
- package/es/editor/model-field-select/model-field-select.d.ts +42 -0
- package/es/editor/model-field-select/model-field-select.mjs +217 -0
- package/es/editor/style-border/index.d.ts +4 -0
- package/es/editor/style-border/index.mjs +11 -0
- package/es/editor/style-border/style-border.d.ts +35 -0
- package/es/editor/style-border/style-border.mjs +38 -0
- package/es/editor/style-font/index.d.ts +4 -0
- package/es/editor/style-font/index.mjs +11 -0
- package/es/editor/style-font/style-font.css +86 -0
- package/es/editor/style-font/style-font.d.ts +35 -0
- package/es/editor/style-font/style-font.mjs +36 -0
- package/es/editor/style-position/index.d.ts +4 -0
- package/es/editor/style-position/index.mjs +11 -0
- package/es/editor/style-position/style-position.d.ts +35 -0
- package/es/editor/style-position/style-position.mjs +35 -0
- package/es/editor/style-spacing/index.d.ts +4 -0
- package/es/editor/style-spacing/index.mjs +11 -0
- package/es/editor/style-spacing/style-spacing.d.ts +34 -0
- package/es/editor/style-spacing/style-spacing.mjs +60 -0
- package/es/hooks/index.d.ts +2 -1
- package/es/hooks/index.mjs +3 -2
- package/es/hooks/use-design-view-controller/use-design-view-controller.d.ts +11 -0
- package/es/hooks/use-design-view-controller/use-design-view-controller.mjs +31 -0
- package/es/index.d.ts +5 -2
- package/es/index.mjs +22 -8
- package/es/interface/controller/i-design-view.controller.d.ts +3 -5
- package/es/interface/form-editor/child-list-editor/child-list-editor.d.ts +114 -0
- package/es/interface/form-editor/index.d.ts +9 -0
- package/es/interface/form-editor/style-border/i-style-border.controller.d.ts +11 -0
- package/es/interface/form-editor/style-border/i-style-border.d.ts +22 -0
- package/es/interface/form-editor/style-font/i-style-font.controller.d.ts +11 -0
- package/es/interface/form-editor/style-font/i-style-font.d.ts +13 -0
- package/es/interface/form-editor/style-position/i-style-position.controller.d.ts +11 -0
- package/es/interface/form-editor/style-position/i-style-position.d.ts +13 -0
- package/es/interface/form-editor/style-spacing/i-style-spacing.controller.d.ts +11 -0
- package/es/interface/form-editor/style-spacing/i-style-spacing.d.ts +22 -0
- package/es/interface/index.d.ts +2 -0
- package/es/interface/provider/i-node-provider.d.ts +140 -0
- package/es/provider/design-editor-node/design-editor-node.provider.d.ts +41 -0
- package/es/provider/design-editor-node/design-editor-node.provider.mjs +57 -0
- package/es/provider/index.d.ts +2 -0
- package/es/provider/index.mjs +2 -0
- package/es/provider/node-base/node-base.provider.d.ts +25 -0
- package/es/provider/node-base/node-base.provider.mjs +34 -0
- package/es/register/index.d.ts +1 -0
- package/es/register/index.mjs +1 -0
- package/es/register/node/node.register.d.ts +113 -0
- package/es/register/node/node.register.mjs +141 -0
- package/es/store/index.d.ts +1 -0
- package/es/store/index.mjs +1 -0
- package/es/store/view/design-view.store.d.ts +12 -0
- package/es/store/view/design-view.store.mjs +327 -0
- package/es/utils/can-drop/can-drop.d.ts +12 -0
- package/es/utils/can-drop/can-drop.mjs +48 -0
- package/es/utils/design-plugin-pkg-util/design-plugin-pkg-util.d.ts +1 -1
- package/es/utils/design-plugin-pkg-util/design-plugin-pkg-util.mjs +29 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.mjs +1 -0
- package/package.json +12 -11
- package/es/components/field-cascader/index.d.ts +0 -2
- package/es/components/field-cascader/index.mjs +0 -1
- package/es/components/field-cascader/src/FieldCascader.vue.d.ts +0 -87
- package/es/components/field-cascader/src/FieldCascader.vue.mjs +0 -6
- package/es/components/field-cascader/src/FieldCascader.vue_vue_type_script_setup_true_lang.mjs +0 -115
- package/es/components/field-cascader/src/FieldCascader.vue_vue_type_style_index_0_lang.css +0 -69
- package/es/components/field-cascader/src/SearchInput.vue.d.ts +0 -11
- package/es/components/field-cascader/src/SearchInput.vue.mjs +0 -7
- package/es/components/field-cascader/src/SearchInput.vue_vue_type_script_setup_true_lang.mjs +0 -38
- package/es/components/field-cascader/src/SearchInput.vue_vue_type_style_index_0_scoped_512c4b38_lang.css +0 -9
- package/es/components/field-cascader/src/hooks.d.ts +0 -129
- package/es/components/field-cascader/src/hooks.mjs +0 -163
- package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_0c9dd8a1_lang.css +0 -5
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { DesignViewPrefix } from "../../../constant/index.mjs";
|
|
2
|
+
import { NodeRegister } from "../../../register/node/node.register.mjs";
|
|
3
|
+
import "../../../register/index.mjs";
|
|
4
|
+
import { isCanCrop } from "../../../utils/can-drop/can-drop.mjs";
|
|
5
|
+
import "../../../utils/index.mjs";
|
|
6
|
+
import { useDesignViewController } from "../../../hooks/use-design-view-controller/use-design-view-controller.mjs";
|
|
7
|
+
import "../../../hooks/index.mjs";
|
|
8
|
+
import './design-drop-container.css';/* empty css */
|
|
9
|
+
import { clone } from "lodash-es";
|
|
10
|
+
import { t, useNamespace } from "@gct-paas/core";
|
|
11
|
+
import { computed, createVNode, defineComponent, nextTick, onMounted, onUnmounted, ref, vShow, watch, withDirectives } from "vue";
|
|
12
|
+
import { useResizeObserver } from "@vueuse/core";
|
|
13
|
+
import { useDrop } from "vue3-dnd";
|
|
14
|
+
//#region src/components/design/design-drop-container/design-drop-container.tsx
|
|
15
|
+
var DesignDropContainer = /* @__PURE__ */ defineComponent({
|
|
16
|
+
name: "DesignDropContainer",
|
|
17
|
+
props: {
|
|
18
|
+
node: {
|
|
19
|
+
type: Object,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
items: {
|
|
23
|
+
type: Array,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
parent: { type: Object },
|
|
27
|
+
showInfo: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
},
|
|
31
|
+
infoMsg: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "sys.designView.drop.info"
|
|
34
|
+
},
|
|
35
|
+
direction: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
setup(props) {
|
|
41
|
+
const ns = useNamespace("design-drop-container");
|
|
42
|
+
const rootRef = ref(null);
|
|
43
|
+
const c = useDesignViewController();
|
|
44
|
+
const group = computed(() => {
|
|
45
|
+
return props.node.id;
|
|
46
|
+
});
|
|
47
|
+
const store = c.store;
|
|
48
|
+
const provider = NodeRegister.get(props.node.type, store.prefix);
|
|
49
|
+
{
|
|
50
|
+
function onTapExpansion(keys) {
|
|
51
|
+
if (collect.value.isOver) keys.push(props.node.id);
|
|
52
|
+
}
|
|
53
|
+
c.hooks.expansion.tap(onTapExpansion);
|
|
54
|
+
onUnmounted(() => {
|
|
55
|
+
c.hooks.expansion.removeTap(onTapExpansion);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const isExpansion = ref(false);
|
|
59
|
+
watch(() => store.count, () => {
|
|
60
|
+
isExpansion.value = store.isDragging && store.expansions.has(props.node.id);
|
|
61
|
+
});
|
|
62
|
+
const isDropMask = computed(() => {
|
|
63
|
+
return provider.isDrop && collect.value && (collect.value.isShallowOver && collect.value.canDrop || collect.value.isOver && store.dropContainer && props.node.id === store.dropContainer.id);
|
|
64
|
+
});
|
|
65
|
+
const [collect, drop] = useDrop({
|
|
66
|
+
accept: DesignViewPrefix.CUSTOM_HOME,
|
|
67
|
+
collect(monitor) {
|
|
68
|
+
return {
|
|
69
|
+
handlerId: monitor.getHandlerId(),
|
|
70
|
+
canDrop: monitor.canDrop(),
|
|
71
|
+
isShallowOver: monitor.isOver({ shallow: true }),
|
|
72
|
+
isOver: monitor.isOver()
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
canDrop(item) {
|
|
76
|
+
return isCanCrop(props.node, store, item);
|
|
77
|
+
},
|
|
78
|
+
drop(item, monitor) {
|
|
79
|
+
if (monitor.canDrop() === false || monitor.isOver({ shallow: true }) === false) return;
|
|
80
|
+
const asyncDrop = async () => {
|
|
81
|
+
let data = clone(item.data);
|
|
82
|
+
const p = NodeRegister.get(data.type, c.store.prefix);
|
|
83
|
+
if (p.beforeDrop) {
|
|
84
|
+
const _data = await p.beforeDrop(c, item);
|
|
85
|
+
if (!data) return {
|
|
86
|
+
group: group.value,
|
|
87
|
+
success: false
|
|
88
|
+
};
|
|
89
|
+
data = _data;
|
|
90
|
+
}
|
|
91
|
+
const oldPKey = c.store.getParentKey(data.id, null);
|
|
92
|
+
const newPKey = props.node ? props.node.id : null;
|
|
93
|
+
c.store.disableCache();
|
|
94
|
+
const isNew = !c.store.map.has(data.id);
|
|
95
|
+
const node = c.store.setNode(newPKey, data);
|
|
96
|
+
if (node) {
|
|
97
|
+
if (isNew === false) c.store.moveTreeItem(oldPKey, newPKey, node.id);
|
|
98
|
+
c.store.enableCache();
|
|
99
|
+
c.store.cacheHistory();
|
|
100
|
+
if (p.afterDrop) {
|
|
101
|
+
if (await p.afterDrop(c, item) === false) return {
|
|
102
|
+
group: group.value,
|
|
103
|
+
success: false
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
nextTick(() => {
|
|
107
|
+
c.store.setActive(node);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
group: group.value,
|
|
112
|
+
success: true
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
return { asyncDrop: asyncDrop() };
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
drop(rootRef);
|
|
119
|
+
watch(collect, (_) => {
|
|
120
|
+
if (_.canDrop && _.isShallowOver) {
|
|
121
|
+
store.dropContainer = props.node;
|
|
122
|
+
c.setExpansion([props.node.id]);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const count = ref(0);
|
|
126
|
+
function force() {
|
|
127
|
+
count.value += 1;
|
|
128
|
+
}
|
|
129
|
+
useResizeObserver(rootRef, () => {
|
|
130
|
+
force();
|
|
131
|
+
});
|
|
132
|
+
function onScroll() {
|
|
133
|
+
force();
|
|
134
|
+
}
|
|
135
|
+
onMounted(() => {
|
|
136
|
+
if (rootRef.value) rootRef.value.onscrollend = () => {
|
|
137
|
+
force();
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
watch(() => store.expansions.size, () => {
|
|
141
|
+
if (rootRef.value) if (store.expansions.size === 0) rootRef.value.removeEventListener("scroll", onScroll);
|
|
142
|
+
else rootRef.value.addEventListener("scroll", onScroll);
|
|
143
|
+
});
|
|
144
|
+
const getMaskStyle = () => {
|
|
145
|
+
if (rootRef.value) return {
|
|
146
|
+
count: count.value,
|
|
147
|
+
width: rootRef.value.scrollWidth + "px",
|
|
148
|
+
height: rootRef.value.scrollHeight + "px"
|
|
149
|
+
};
|
|
150
|
+
return {};
|
|
151
|
+
};
|
|
152
|
+
return {
|
|
153
|
+
ns,
|
|
154
|
+
isExpansion,
|
|
155
|
+
rootRef,
|
|
156
|
+
collect,
|
|
157
|
+
isDropMask,
|
|
158
|
+
getMaskStyle
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
render() {
|
|
162
|
+
return createVNode("div", {
|
|
163
|
+
"ref": "rootRef",
|
|
164
|
+
"class": [
|
|
165
|
+
this.ns.b(),
|
|
166
|
+
this.ns.m(this.direction),
|
|
167
|
+
this.ns.is("over", this.collect.isShallowOver && this.collect.canDrop),
|
|
168
|
+
this.ns.is("expansion", this.isExpansion),
|
|
169
|
+
this.ns.is("not-children", this.items.length === 0)
|
|
170
|
+
]
|
|
171
|
+
}, [
|
|
172
|
+
this.items.length === 0 && this.showInfo !== false ? createVNode("div", { "class": this.ns.e("drag-info") }, [createVNode("span", null, [t(this.infoMsg)])]) : null,
|
|
173
|
+
this.$slots.default?.(),
|
|
174
|
+
withDirectives(createVNode("div", {
|
|
175
|
+
"style": this.getMaskStyle(),
|
|
176
|
+
"class": this.ns.e("drop-mask")
|
|
177
|
+
}, null), [[vShow, this.isDropMask]])
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
//#endregion
|
|
182
|
+
export { DesignDropContainer };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
3
|
+
/* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
|
|
4
|
+
/**
|
|
5
|
+
* 定义 Block 块
|
|
6
|
+
* @param {String} $block - Block 块名称
|
|
7
|
+
* @example
|
|
8
|
+
* @include b('button') {
|
|
9
|
+
* padding: 10px;
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 定义 Element 元素
|
|
14
|
+
* @param {String|List} $element - Element 元素名称,支持单个或多个
|
|
15
|
+
* @example
|
|
16
|
+
* @include b('button') {
|
|
17
|
+
* @include e('text') {
|
|
18
|
+
* color: #000;
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* // 或传入多个元素
|
|
22
|
+
* @include b('button') {
|
|
23
|
+
* @include e(('text', 'icon')) {
|
|
24
|
+
* margin: 5px;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 定义 Modifier 修饰符
|
|
30
|
+
* @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
|
|
31
|
+
* @example
|
|
32
|
+
* @include b('button') {
|
|
33
|
+
* @include m('primary') {
|
|
34
|
+
* background: blue;
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* // 或传入多个修饰符
|
|
38
|
+
* @include b('button') {
|
|
39
|
+
* @include m(('primary', 'large')) {
|
|
40
|
+
* background: blue;
|
|
41
|
+
* font-size: 16px;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* 定义状态选择器
|
|
47
|
+
* @param {String} $state - 状态名称
|
|
48
|
+
* @example
|
|
49
|
+
* @include b('button') {
|
|
50
|
+
* @include when('disabled') {
|
|
51
|
+
* opacity: 0.5;
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* 深色主题样式
|
|
57
|
+
* @param {String} $block - Block 块名称
|
|
58
|
+
* @example
|
|
59
|
+
* @include dark('button') {
|
|
60
|
+
* background: #333;
|
|
61
|
+
* color: #fff;
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
65
|
+
.gct-design-drop-line {
|
|
66
|
+
transition: all 0.3s ease-in-out;
|
|
67
|
+
}
|
|
68
|
+
.gct-design-drop-line__vertical {
|
|
69
|
+
display: inline-block;
|
|
70
|
+
height: auto;
|
|
71
|
+
padding: 0;
|
|
72
|
+
vertical-align: top;
|
|
73
|
+
}
|
|
74
|
+
.gct-design-drop-line__vertical.is-show {
|
|
75
|
+
padding: 0 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.gct-design-drop-line__horizontal {
|
|
79
|
+
width: 100%;
|
|
80
|
+
min-width: inherit;
|
|
81
|
+
padding: 0;
|
|
82
|
+
}
|
|
83
|
+
.gct-design-drop-line__horizontal.is-show {
|
|
84
|
+
padding: 4px 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.gct-design-drop-line-drop-container {
|
|
88
|
+
position: relative;
|
|
89
|
+
transition: all 0.3s ease-in-out;
|
|
90
|
+
--bg-color: transparent;
|
|
91
|
+
}
|
|
92
|
+
.gct-design-drop-line-drop-container.is-can-drop {
|
|
93
|
+
--bg-color: var(--ant-primary-color);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.gct-design-drop-line-drop-container__vertical {
|
|
97
|
+
width: 0;
|
|
98
|
+
height: 100%;
|
|
99
|
+
min-height: inherit;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
.gct-design-drop-line-drop-container__vertical.is-show {
|
|
103
|
+
width: var(--design-drop-line-width, 4px);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.gct-design-drop-line-drop-container__vertical--line {
|
|
107
|
+
width: 2px;
|
|
108
|
+
height: 100%;
|
|
109
|
+
min-height: inherit;
|
|
110
|
+
margin-left: 1px;
|
|
111
|
+
background-color: var(--bg-color);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.gct-design-drop-line-drop-container__vertical--start-line {
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: 0;
|
|
117
|
+
left: 0;
|
|
118
|
+
width: 100%;
|
|
119
|
+
height: 2px;
|
|
120
|
+
background-color: var(--bg-color);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.gct-design-drop-line-drop-container__vertical--end-line {
|
|
124
|
+
position: absolute;
|
|
125
|
+
bottom: 0;
|
|
126
|
+
left: 0;
|
|
127
|
+
width: 100%;
|
|
128
|
+
height: 2px;
|
|
129
|
+
background-color: var(--bg-color);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.gct-design-drop-line-drop-container__horizontal {
|
|
133
|
+
width: 100%;
|
|
134
|
+
min-width: inherit;
|
|
135
|
+
height: 0;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
}
|
|
138
|
+
.gct-design-drop-line-drop-container__horizontal.is-show {
|
|
139
|
+
height: var(--design-drop-line-width, 4px);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.gct-design-drop-line-drop-container__horizontal--line {
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 2px;
|
|
145
|
+
margin-top: 1px;
|
|
146
|
+
background-color: var(--bg-color);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.gct-design-drop-line-drop-container__horizontal--start-line {
|
|
150
|
+
position: absolute;
|
|
151
|
+
top: 0;
|
|
152
|
+
left: 0;
|
|
153
|
+
width: 2px;
|
|
154
|
+
height: 100%;
|
|
155
|
+
background-color: var(--bg-color);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.gct-design-drop-line-drop-container__horizontal--end-line {
|
|
159
|
+
position: absolute;
|
|
160
|
+
top: 0;
|
|
161
|
+
right: 0;
|
|
162
|
+
width: 2px;
|
|
163
|
+
height: 100%;
|
|
164
|
+
background-color: var(--bg-color);
|
|
165
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { IDesignNode } from '@gct-paas/schema';
|
|
3
|
+
import { IDropCollect } from '../../../interface';
|
|
4
|
+
export declare const DesignDropLine: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
5
|
+
group: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
index: {
|
|
10
|
+
type: NumberConstructor;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
parent: {
|
|
14
|
+
type: PropType<IDesignNode>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
item: {
|
|
18
|
+
type: PropType<IDesignNode>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
beforeItem: {
|
|
22
|
+
type: PropType<IDesignNode>;
|
|
23
|
+
};
|
|
24
|
+
direction: {
|
|
25
|
+
type: PropType<"vertical" | "horizontal">;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
isBefore: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
}>, {
|
|
33
|
+
ns: import('@gct-paas/core').Namespace;
|
|
34
|
+
getStyleObj: () => {
|
|
35
|
+
height: string;
|
|
36
|
+
} | {
|
|
37
|
+
height?: undefined;
|
|
38
|
+
};
|
|
39
|
+
elRef: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
40
|
+
collect: import('vue').Ref<IDropCollect, IDropCollect>;
|
|
41
|
+
isExpansion: import('vue').Ref<boolean, boolean>;
|
|
42
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
43
|
+
group: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
index: {
|
|
48
|
+
type: NumberConstructor;
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
parent: {
|
|
52
|
+
type: PropType<IDesignNode>;
|
|
53
|
+
required: true;
|
|
54
|
+
};
|
|
55
|
+
item: {
|
|
56
|
+
type: PropType<IDesignNode>;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
beforeItem: {
|
|
60
|
+
type: PropType<IDesignNode>;
|
|
61
|
+
};
|
|
62
|
+
direction: {
|
|
63
|
+
type: PropType<"vertical" | "horizontal">;
|
|
64
|
+
default: string;
|
|
65
|
+
};
|
|
66
|
+
isBefore: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
70
|
+
}>> & Readonly<{}>, {
|
|
71
|
+
direction: "horizontal" | "vertical";
|
|
72
|
+
isBefore: boolean;
|
|
73
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { DesignViewPrefix, InsertNodeMode } from "../../../constant/index.mjs";
|
|
2
|
+
import { NodeRegister } from "../../../register/node/node.register.mjs";
|
|
3
|
+
import "../../../register/index.mjs";
|
|
4
|
+
import { isCanCrop } from "../../../utils/can-drop/can-drop.mjs";
|
|
5
|
+
import "../../../utils/index.mjs";
|
|
6
|
+
import { useDesignViewController } from "../../../hooks/use-design-view-controller/use-design-view-controller.mjs";
|
|
7
|
+
import "../../../hooks/index.mjs";
|
|
8
|
+
import './design-drop-line.css';/* empty css */
|
|
9
|
+
import { useNamespace } from "@gct-paas/core";
|
|
10
|
+
import { createVNode, defineComponent, nextTick, ref, watch } from "vue";
|
|
11
|
+
import { useDrop } from "vue3-dnd";
|
|
12
|
+
//#region src/components/design/design-drop-line/design-drop-line.tsx
|
|
13
|
+
var DesignDropLine = /* @__PURE__ */ defineComponent({
|
|
14
|
+
name: "DesignDropLine",
|
|
15
|
+
props: {
|
|
16
|
+
group: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
index: {
|
|
21
|
+
type: Number,
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
parent: {
|
|
25
|
+
type: Object,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
item: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
beforeItem: { type: Object },
|
|
33
|
+
direction: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "horizontal"
|
|
36
|
+
},
|
|
37
|
+
isBefore: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
setup(props) {
|
|
43
|
+
const ns = useNamespace("design-drop-line");
|
|
44
|
+
const elRef = ref(null);
|
|
45
|
+
const c = useDesignViewController();
|
|
46
|
+
const getStyleObj = () => {
|
|
47
|
+
if (isExpansion.value === false && props.direction === "vertical") return { height: "auto" };
|
|
48
|
+
return {};
|
|
49
|
+
};
|
|
50
|
+
const isExpansion = ref(false);
|
|
51
|
+
if (props.parent) watch(() => c.store.count, () => {
|
|
52
|
+
isExpansion.value = c.store.isDragging && c.store.expansions.has(props.parent.id);
|
|
53
|
+
});
|
|
54
|
+
const [collect, drop] = useDrop({
|
|
55
|
+
accept: DesignViewPrefix.CUSTOM_HOME,
|
|
56
|
+
collect(monitor) {
|
|
57
|
+
const isShallowOver = monitor.isOver({ shallow: true });
|
|
58
|
+
return {
|
|
59
|
+
handlerId: monitor.getHandlerId(),
|
|
60
|
+
canDrop: monitor.canDrop(),
|
|
61
|
+
isShallowOver,
|
|
62
|
+
isOver: monitor.isOver()
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
canDrop(item) {
|
|
66
|
+
return isCanCrop(props.parent, c.store, item);
|
|
67
|
+
},
|
|
68
|
+
drop(item, monitor) {
|
|
69
|
+
if (!monitor.isOver({ shallow: true })) return;
|
|
70
|
+
const asyncDrop = async () => {
|
|
71
|
+
let _data = item.data;
|
|
72
|
+
const p = NodeRegister.get(_data.type, c.store.prefix);
|
|
73
|
+
if (p.beforeDrop) {
|
|
74
|
+
const data = await p.beforeDrop(c, item);
|
|
75
|
+
if (!data) return {
|
|
76
|
+
group: props.group,
|
|
77
|
+
success: false
|
|
78
|
+
};
|
|
79
|
+
_data = data;
|
|
80
|
+
}
|
|
81
|
+
if (c.store.insertNode(props.isBefore ? InsertNodeMode.BEFORE : InsertNodeMode.AFTER, props.item, _data)) {
|
|
82
|
+
if (p.afterDrop) {
|
|
83
|
+
if (!await p.afterDrop(c, item)) return {
|
|
84
|
+
group: props.group,
|
|
85
|
+
success: false
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const data = c.store.getNode(item.id);
|
|
89
|
+
if (data) nextTick(() => {
|
|
90
|
+
c.store.setActive(data);
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
group: props.group,
|
|
94
|
+
success: true
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
group: props.group,
|
|
99
|
+
success: false
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
return { asyncDrop: asyncDrop() };
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
drop(elRef);
|
|
106
|
+
return {
|
|
107
|
+
ns,
|
|
108
|
+
getStyleObj,
|
|
109
|
+
elRef,
|
|
110
|
+
collect,
|
|
111
|
+
isExpansion
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
render() {
|
|
115
|
+
return createVNode("div", {
|
|
116
|
+
"ref": "elRef",
|
|
117
|
+
"style": this.getStyleObj(),
|
|
118
|
+
"class": [
|
|
119
|
+
this.ns.b(),
|
|
120
|
+
this.ns.e(this.direction),
|
|
121
|
+
this.ns.is("show", this.isExpansion)
|
|
122
|
+
]
|
|
123
|
+
}, [createVNode("div", { "class": [
|
|
124
|
+
this.ns.b("drop-container"),
|
|
125
|
+
this.ns.be("drop-container", this.direction),
|
|
126
|
+
this.ns.is("show", this.isExpansion),
|
|
127
|
+
this.ns.is("can-drop", this.collect.canDrop && this.collect.isShallowOver)
|
|
128
|
+
] }, [
|
|
129
|
+
createVNode("div", { "class": this.ns.bem("drop-container", this.direction, "start-line") }, null),
|
|
130
|
+
createVNode("div", { "class": [this.ns.bem("drop-container", this.direction, "line")] }, null),
|
|
131
|
+
createVNode("div", { "class": this.ns.bem("drop-container", this.direction, "end-line") }, null)
|
|
132
|
+
])]);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
//#endregion
|
|
136
|
+
export { DesignDropLine };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
3
|
+
/* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
|
|
4
|
+
/**
|
|
5
|
+
* 定义 Block 块
|
|
6
|
+
* @param {String} $block - Block 块名称
|
|
7
|
+
* @example
|
|
8
|
+
* @include b('button') {
|
|
9
|
+
* padding: 10px;
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 定义 Element 元素
|
|
14
|
+
* @param {String|List} $element - Element 元素名称,支持单个或多个
|
|
15
|
+
* @example
|
|
16
|
+
* @include b('button') {
|
|
17
|
+
* @include e('text') {
|
|
18
|
+
* color: #000;
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* // 或传入多个元素
|
|
22
|
+
* @include b('button') {
|
|
23
|
+
* @include e(('text', 'icon')) {
|
|
24
|
+
* margin: 5px;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 定义 Modifier 修饰符
|
|
30
|
+
* @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
|
|
31
|
+
* @example
|
|
32
|
+
* @include b('button') {
|
|
33
|
+
* @include m('primary') {
|
|
34
|
+
* background: blue;
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* // 或传入多个修饰符
|
|
38
|
+
* @include b('button') {
|
|
39
|
+
* @include m(('primary', 'large')) {
|
|
40
|
+
* background: blue;
|
|
41
|
+
* font-size: 16px;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* 定义状态选择器
|
|
47
|
+
* @param {String} $state - 状态名称
|
|
48
|
+
* @example
|
|
49
|
+
* @include b('button') {
|
|
50
|
+
* @include when('disabled') {
|
|
51
|
+
* opacity: 0.5;
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* 深色主题样式
|
|
57
|
+
* @param {String} $block - Block 块名称
|
|
58
|
+
* @example
|
|
59
|
+
* @include dark('button') {
|
|
60
|
+
* background: #333;
|
|
61
|
+
* color: #fff;
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
65
|
+
.gct-design-item-actions {
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 0;
|
|
68
|
+
left: 0;
|
|
69
|
+
z-index: 1;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
height: 30px;
|
|
73
|
+
padding: 5px 8px;
|
|
74
|
+
color: #fff;
|
|
75
|
+
background-color: var(--ant-primary-color);
|
|
76
|
+
}
|
|
77
|
+
.gct-design-item-actions__mask {
|
|
78
|
+
position: absolute;
|
|
79
|
+
inset: 0;
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
background-color: rgba(0, 0, 0, 0.16);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.gct-design-item-actions__item {
|
|
85
|
+
z-index: 1;
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
width: 20px;
|
|
90
|
+
height: 20px;
|
|
91
|
+
padding-top: 2px;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
border-radius: 2px;
|
|
94
|
+
}
|
|
95
|
+
.gct-design-item-actions__item:hover {
|
|
96
|
+
background-color: rgba(255, 255, 255, 0.48);
|
|
97
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const DesignItemActions: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
top: {
|
|
3
|
+
type: NumberConstructor;
|
|
4
|
+
default: number;
|
|
5
|
+
};
|
|
6
|
+
left: {
|
|
7
|
+
type: NumberConstructor;
|
|
8
|
+
default: number;
|
|
9
|
+
};
|
|
10
|
+
selectEl: {
|
|
11
|
+
type: {
|
|
12
|
+
new (): HTMLDivElement;
|
|
13
|
+
prototype: HTMLDivElement;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
halfRect: {
|
|
17
|
+
type: ObjectConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
21
|
+
top: {
|
|
22
|
+
type: NumberConstructor;
|
|
23
|
+
default: number;
|
|
24
|
+
};
|
|
25
|
+
left: {
|
|
26
|
+
type: NumberConstructor;
|
|
27
|
+
default: number;
|
|
28
|
+
};
|
|
29
|
+
selectEl: {
|
|
30
|
+
type: {
|
|
31
|
+
new (): HTMLDivElement;
|
|
32
|
+
prototype: HTMLDivElement;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
halfRect: {
|
|
36
|
+
type: ObjectConstructor;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
}>> & Readonly<{}>, {
|
|
40
|
+
top: number;
|
|
41
|
+
left: number;
|
|
42
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|