@gct-paas/core-web 0.1.4-dev.7 → 0.1.4-dev.8
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.esm.min.mjs +24472 -7434
- package/dist/index.min.cjs +59 -12
- package/dist/index.min.css +1 -0
- package/dist/index.system.min.js +59 -12
- 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/code-editor/code-editor.css +67 -0
- package/es/components/code-editor/code-editor.mjs +9 -10
- package/es/components/index.d.ts +1 -0
- package/es/components/layout/flex-container/flex-container.css +67 -0
- package/es/components/layout/view-container/view-container.css +83 -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 +2 -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 +5 -6
- package/es/index.mjs +19 -24
- 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 +24 -0
- package/es/modules/gct-dnd/constants/index.mjs +9 -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/utils/with-install.mjs +0 -1
- package/package.json +11 -8
- package/dist/index.min.css.css +0 -1
- package/es/components/code-editor/code-editor.scss +0 -3
- package/es/components/index.mjs +0 -7
- package/es/components/layout/flex-container/flex-container.mjs +0 -90
- package/es/components/layout/flex-container/flex-container.scss +0 -3
- package/es/components/layout/flex-item/flex-item.mjs +0 -53
- package/es/components/layout/flex-item/flex-item.scss +0 -17
- package/es/components/layout/grid-container/grid-container.mjs +0 -47
- package/es/components/layout/view-container/view-container.mjs +0 -39
- 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,239 @@
|
|
|
1
|
+
import { defineComponent, createVNode, ref, inject } from 'vue';
|
|
2
|
+
import { useNamespace } from '@gct-paas/core';
|
|
3
|
+
import { useDrag, useDrop } from 'vue3-dnd';
|
|
4
|
+
import { cloneDeep } from 'lodash-es';
|
|
5
|
+
import { GCT_DND_INSERT_POS } from '../../constants/index.mjs';
|
|
6
|
+
import './gct-dnd-item.css';/* empty css */
|
|
7
|
+
|
|
8
|
+
const GctDndItem = /* @__PURE__ */ defineComponent({
|
|
9
|
+
name: 'GctDndItem',
|
|
10
|
+
props: {
|
|
11
|
+
config: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
// 数据所在位置下标
|
|
16
|
+
index: {
|
|
17
|
+
type: Number,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
// 当前项数据
|
|
21
|
+
data: {
|
|
22
|
+
type: Object,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
last: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
emits: ['drop'],
|
|
31
|
+
setup(props, {
|
|
32
|
+
emit
|
|
33
|
+
}) {
|
|
34
|
+
const {
|
|
35
|
+
config
|
|
36
|
+
} = props;
|
|
37
|
+
const ns = useNamespace('dnd-item');
|
|
38
|
+
const rootRef = ref(null);
|
|
39
|
+
const isBeforeHover = ref(false);
|
|
40
|
+
const dropLineState = inject('vue3-dnd-drop-line-state');
|
|
41
|
+
// 通过悬浮时计算,放置的位置
|
|
42
|
+
const posState = ref(-1);
|
|
43
|
+
// 拖放配置,暂时无用,主要利用内部机制,避免悬浮时容器触发了放置
|
|
44
|
+
// 拖拽配置
|
|
45
|
+
const [collect, drag, preview] = useDrag({
|
|
46
|
+
type: config.group,
|
|
47
|
+
item: () => {
|
|
48
|
+
return {
|
|
49
|
+
index: props.index,
|
|
50
|
+
id: props.data.id,
|
|
51
|
+
data: props.data,
|
|
52
|
+
group: config.group,
|
|
53
|
+
mode: config.mode ?? 'move',
|
|
54
|
+
tagMap: config.tagMap ?? {},
|
|
55
|
+
types: []
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
collect: monitor => {
|
|
59
|
+
return {
|
|
60
|
+
canDrag: monitor.canDrag(),
|
|
61
|
+
isDragging: monitor.isDragging()
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
canDrag() {
|
|
65
|
+
if (config.isDrag === false) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (config.canDrag) {
|
|
69
|
+
return config.canDrag(props.data);
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
},
|
|
73
|
+
end: async (_, monitor) => {
|
|
74
|
+
const result = monitor.getDropResult();
|
|
75
|
+
if (result && result.asyncDrop) {
|
|
76
|
+
const res = await result.asyncDrop();
|
|
77
|
+
if (res.success === true && res.data) {
|
|
78
|
+
if (config.end) {
|
|
79
|
+
config.end(_, res);
|
|
80
|
+
}
|
|
81
|
+
if (config.add) {
|
|
82
|
+
config.add(res.data);
|
|
83
|
+
}
|
|
84
|
+
console.debug('drop success');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
if (props.config.isDrop !== true) {
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
91
|
+
const [_, drop] = useDrop({
|
|
92
|
+
accept: config.group,
|
|
93
|
+
canDrop() {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
drop(rootRef);
|
|
98
|
+
} else {
|
|
99
|
+
const [dropCollect, drop] = useDrop({
|
|
100
|
+
accept: config.group,
|
|
101
|
+
collect(monitor) {
|
|
102
|
+
return {
|
|
103
|
+
handlerId: monitor.getHandlerId(),
|
|
104
|
+
isOver: monitor.isOver(),
|
|
105
|
+
canDrop: monitor.canDrop(),
|
|
106
|
+
isShallowOver: monitor.isOver({
|
|
107
|
+
shallow: true
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
canDrop(item, monitor) {
|
|
112
|
+
if (collect.value.isDragging === true) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return item.id !== props.data.id && monitor.isOver({
|
|
116
|
+
shallow: true
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
hover(_item, monitor) {
|
|
120
|
+
if (monitor.canDrop() === false) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const isOver = monitor.isOver({
|
|
124
|
+
shallow: true
|
|
125
|
+
});
|
|
126
|
+
if (isOver) {
|
|
127
|
+
const rect = rootRef.value.getBoundingClientRect();
|
|
128
|
+
const offset = monitor.getClientOffset();
|
|
129
|
+
// 放置线计算偏移量
|
|
130
|
+
const dropOffset = config.offset ?? 0;
|
|
131
|
+
let difference = 0;
|
|
132
|
+
if (config.direction === 'vertical') {
|
|
133
|
+
const {
|
|
134
|
+
top,
|
|
135
|
+
height
|
|
136
|
+
} = rect;
|
|
137
|
+
const {
|
|
138
|
+
y
|
|
139
|
+
} = offset;
|
|
140
|
+
const half = height / 2;
|
|
141
|
+
difference = y - top - half;
|
|
142
|
+
// 小于偏移量,则不处理
|
|
143
|
+
if (Math.abs(difference) < dropOffset) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (difference < 0) {
|
|
147
|
+
isBeforeHover.value = true;
|
|
148
|
+
} else {
|
|
149
|
+
isBeforeHover.value = false;
|
|
150
|
+
}
|
|
151
|
+
} else if (config.direction === 'horizontal') {
|
|
152
|
+
const {
|
|
153
|
+
left,
|
|
154
|
+
width
|
|
155
|
+
} = rect;
|
|
156
|
+
const {
|
|
157
|
+
x
|
|
158
|
+
} = offset;
|
|
159
|
+
const half = width / 2;
|
|
160
|
+
difference = x - left - half;
|
|
161
|
+
// 小于偏移量,则不处理
|
|
162
|
+
if (Math.abs(difference) < dropOffset) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (difference < 0) {
|
|
166
|
+
isBeforeHover.value = true;
|
|
167
|
+
} else {
|
|
168
|
+
isBeforeHover.value = false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
dropLineState.activeKey = props.data.id;
|
|
172
|
+
dropLineState.isBeforeHover = isBeforeHover.value;
|
|
173
|
+
} else {
|
|
174
|
+
dropLineState.activeKey = '';
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
drop: (item, monitor) => {
|
|
178
|
+
// 一旦放置,操控线的激活项就置空
|
|
179
|
+
dropLineState.activeKey = '';
|
|
180
|
+
if (dropCollect.value.isShallowOver !== true || monitor.canDrop() === false) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const callback = async () => {
|
|
184
|
+
let data = item.data;
|
|
185
|
+
if (config.drop) {
|
|
186
|
+
data = await config.drop(item);
|
|
187
|
+
if (!data) {
|
|
188
|
+
return {
|
|
189
|
+
group: config.group,
|
|
190
|
+
cfg: cloneDeep(props.config),
|
|
191
|
+
success: false
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
onDrop(isBeforeHover.value ? GCT_DND_INSERT_POS.BEFORE : GCT_DND_INSERT_POS.AFTER, data);
|
|
196
|
+
return {
|
|
197
|
+
group: config.group,
|
|
198
|
+
success: true,
|
|
199
|
+
cfg: cloneDeep(props.config),
|
|
200
|
+
data
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
asyncDrop: callback
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
drop(rootRef);
|
|
209
|
+
}
|
|
210
|
+
if (!config.handle && config.isDrag !== false) {
|
|
211
|
+
drag(rootRef);
|
|
212
|
+
}
|
|
213
|
+
preview(rootRef);
|
|
214
|
+
function onDrop(insertPos, data) {
|
|
215
|
+
emit('drop', insertPos, data);
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
ns,
|
|
219
|
+
rootRef,
|
|
220
|
+
posState,
|
|
221
|
+
collect,
|
|
222
|
+
onDrop,
|
|
223
|
+
drag
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
render() {
|
|
227
|
+
const itemProps = {
|
|
228
|
+
index: this.index,
|
|
229
|
+
data: this.data,
|
|
230
|
+
drag: this.drag
|
|
231
|
+
};
|
|
232
|
+
return createVNode("div", {
|
|
233
|
+
"ref": "rootRef",
|
|
234
|
+
"class": [this.ns.b(), this.ns.is('dragging', this.collect.isDragging), this.ns.is('not-drag', this.collect.canDrag === false)]
|
|
235
|
+
}, [this.$slots.default?.(itemProps)]);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
export { GctDndItem };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 拖拽放置时的插入位置
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @enum {number}
|
|
6
|
+
*/
|
|
7
|
+
export declare enum GCT_DND_INSERT_POS {
|
|
8
|
+
/**
|
|
9
|
+
* 插入第一个
|
|
10
|
+
*/
|
|
11
|
+
FIRST = "first",
|
|
12
|
+
/**
|
|
13
|
+
* 插入前
|
|
14
|
+
*/
|
|
15
|
+
BEFORE = "before",
|
|
16
|
+
/**
|
|
17
|
+
* 插入后
|
|
18
|
+
*/
|
|
19
|
+
AFTER = "after",
|
|
20
|
+
/**
|
|
21
|
+
* 插入最后
|
|
22
|
+
*/
|
|
23
|
+
LAST = "last"
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var GCT_DND_INSERT_POS = /* @__PURE__ */ ((GCT_DND_INSERT_POS2) => {
|
|
2
|
+
GCT_DND_INSERT_POS2["FIRST"] = "first";
|
|
3
|
+
GCT_DND_INSERT_POS2["BEFORE"] = "before";
|
|
4
|
+
GCT_DND_INSERT_POS2["AFTER"] = "after";
|
|
5
|
+
GCT_DND_INSERT_POS2["LAST"] = "last";
|
|
6
|
+
return GCT_DND_INSERT_POS2;
|
|
7
|
+
})(GCT_DND_INSERT_POS || {});
|
|
8
|
+
|
|
9
|
+
export { GCT_DND_INSERT_POS };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { GctDndContainer } from './components/gct-dnd-container/gct-dnd-container';
|
|
2
|
+
export { GctDndDropLine } from './components/gct-dnd-drop-line/gct-dnd-drop-line';
|
|
3
|
+
export { GctDndItem } from './components/gct-dnd-item/gct-dnd-item';
|
|
4
|
+
export { GCT_DND_INSERT_POS } from './constants';
|
|
5
|
+
export type * from './interface';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { GCT_DND_INSERT_POS } from '../constants';
|
|
2
|
+
import { IGctDndData } from './i-gct-dnd-data';
|
|
3
|
+
import { IGctDragDndData } from './i-gct-drag-dnd-data';
|
|
4
|
+
import { IGctDropResultData } from './i-gct-drop-result';
|
|
5
|
+
/**
|
|
6
|
+
* 拖拽配置
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @interface IGctDndConfig
|
|
10
|
+
*/
|
|
11
|
+
export interface IGctDndConfig {
|
|
12
|
+
/**
|
|
13
|
+
* 拖拽分组标识
|
|
14
|
+
*
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
group: string;
|
|
18
|
+
/**
|
|
19
|
+
* 拖拽时额外携带的标签,可以用于做特殊区分
|
|
20
|
+
*
|
|
21
|
+
* @type {IObject}
|
|
22
|
+
*/
|
|
23
|
+
tagMap?: IObject;
|
|
24
|
+
/**
|
|
25
|
+
* 拖拽模式,默认移动
|
|
26
|
+
*
|
|
27
|
+
* @default 'move'
|
|
28
|
+
* @type {('copy' | 'move' | string)}
|
|
29
|
+
*/
|
|
30
|
+
mode?: 'copy' | 'move' | string;
|
|
31
|
+
/**
|
|
32
|
+
* 自定义拖拽标识
|
|
33
|
+
*
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
handle?: string;
|
|
37
|
+
/**
|
|
38
|
+
* 是否开启放置功能,默认 开启
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
isDrop?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 是否开启拖拽功能,默认 开启
|
|
46
|
+
*
|
|
47
|
+
* @default true
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
*/
|
|
50
|
+
isDrag?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 拖拽方向,默认水平方向
|
|
53
|
+
*
|
|
54
|
+
* @default 'horizontal'
|
|
55
|
+
* @type {('vertical' | 'horizontal')}
|
|
56
|
+
*/
|
|
57
|
+
direction?: 'vertical' | 'horizontal';
|
|
58
|
+
/**
|
|
59
|
+
* 拖拽放置偏移量,用于控制放置区移动鼠标的交互优化
|
|
60
|
+
*
|
|
61
|
+
* @type {number}
|
|
62
|
+
*/
|
|
63
|
+
offset?: number;
|
|
64
|
+
/**
|
|
65
|
+
* 拖入容器时,默认插入位置
|
|
66
|
+
*
|
|
67
|
+
* @default 'after'
|
|
68
|
+
* @type {('first' | 'last')}
|
|
69
|
+
*/
|
|
70
|
+
insertPos?: GCT_DND_INSERT_POS;
|
|
71
|
+
/**
|
|
72
|
+
* 是否允许放置
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
canDrop?: (data: IGctDragDndData) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 是否允许拖拽
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
canDrag?: (data: IGctDndData) => boolean;
|
|
81
|
+
/**
|
|
82
|
+
* 放置数据处理
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
drop?: (data: IGctDragDndData) => IGctDndData | null;
|
|
86
|
+
/**
|
|
87
|
+
* 放置数据处理
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
end?: (data: IGctDragDndData, res: IGctDropResultData) => void;
|
|
91
|
+
/**
|
|
92
|
+
* 新增
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
add?: (data: IGctDndData) => void;
|
|
96
|
+
/**
|
|
97
|
+
* 删除项
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
remove?: (data: IGctDndData) => void;
|
|
101
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConnectDragSource, DragSourceOptions } from 'vue3-dnd';
|
|
2
|
+
/**
|
|
3
|
+
* 拖拽项绘制 props 参数
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @interface IGctDndRenderItemOptions
|
|
7
|
+
* @template T
|
|
8
|
+
*/
|
|
9
|
+
export interface IGctDndRenderItemOptions<T = IObject> {
|
|
10
|
+
/**
|
|
11
|
+
* 当前拖拽项开始拖拽时的索引
|
|
12
|
+
*
|
|
13
|
+
* @type {number}
|
|
14
|
+
*/
|
|
15
|
+
index: number;
|
|
16
|
+
/**
|
|
17
|
+
* 拖拽数据
|
|
18
|
+
*
|
|
19
|
+
* @type {T}
|
|
20
|
+
*/
|
|
21
|
+
data: T;
|
|
22
|
+
/**
|
|
23
|
+
* 设置拖拽项的 DOM 元素
|
|
24
|
+
*
|
|
25
|
+
* @type {ConnectDragSource<DragSourceOptions>}
|
|
26
|
+
*/
|
|
27
|
+
drag: ConnectDragSource<DragSourceOptions>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 拖拽时状态
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @interface IGctDragCollect
|
|
6
|
+
*/
|
|
7
|
+
export interface IGctDragCollect {
|
|
8
|
+
/**
|
|
9
|
+
* 是否可以拖拽
|
|
10
|
+
*
|
|
11
|
+
* @author zhanghanrui
|
|
12
|
+
* @date 2024-07-05 15:07:20
|
|
13
|
+
* @type {boolean}
|
|
14
|
+
*/
|
|
15
|
+
canDrag: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 是否正在拖拽
|
|
18
|
+
*
|
|
19
|
+
* @author zhanghanrui
|
|
20
|
+
* @date 2024-07-05 15:07:26
|
|
21
|
+
* @type {boolean}
|
|
22
|
+
*/
|
|
23
|
+
isDragging: boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IGctDndData } from './i-gct-dnd-data';
|
|
2
|
+
/**
|
|
3
|
+
* 拖拽数据
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @interface IGctDragDndData
|
|
7
|
+
*/
|
|
8
|
+
export interface IGctDragDndData<T = IGctDndData> {
|
|
9
|
+
/**
|
|
10
|
+
* 当前数据标识,如果是新数据则主键为空
|
|
11
|
+
*
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* 拖拽分组实例标识
|
|
17
|
+
*
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
group: string;
|
|
21
|
+
/**
|
|
22
|
+
* 拖拽项原位置索引
|
|
23
|
+
*
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
index: number;
|
|
27
|
+
/**
|
|
28
|
+
* 当前拖拽数据
|
|
29
|
+
*
|
|
30
|
+
* @type {T}
|
|
31
|
+
*/
|
|
32
|
+
data: T;
|
|
33
|
+
/**
|
|
34
|
+
* 数据模式
|
|
35
|
+
*
|
|
36
|
+
* @type {('create' | 'move' | string)} 新建 | 移动
|
|
37
|
+
*/
|
|
38
|
+
mode: 'create' | 'move' | string;
|
|
39
|
+
/**
|
|
40
|
+
* 额外拖拽标识
|
|
41
|
+
*
|
|
42
|
+
* @type {IObject}
|
|
43
|
+
*/
|
|
44
|
+
tagMap: IObject;
|
|
45
|
+
/**
|
|
46
|
+
* 包含自身 + 所有子的类型,目前主要用于拖拽限制
|
|
47
|
+
*
|
|
48
|
+
* @type {string[]}
|
|
49
|
+
*/
|
|
50
|
+
types: string[];
|
|
51
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 放置时状态
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @interface IGctDropCollect
|
|
6
|
+
*/
|
|
7
|
+
export interface IGctDropCollect {
|
|
8
|
+
/**
|
|
9
|
+
* 拖拽元素标识
|
|
10
|
+
*
|
|
11
|
+
* @type {string}
|
|
12
|
+
*/
|
|
13
|
+
handlerId: string;
|
|
14
|
+
/**
|
|
15
|
+
* 是否可以放置
|
|
16
|
+
*
|
|
17
|
+
* @type {boolean}
|
|
18
|
+
*/
|
|
19
|
+
canDrop: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 是否只在单一元素放置
|
|
22
|
+
*
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
isShallowOver: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 是否放置中
|
|
28
|
+
*
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
*/
|
|
31
|
+
isOver: boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IGctDndConfig } from './i-gct-dnd-config';
|
|
2
|
+
import { IGctDndData } from './i-gct-dnd-data';
|
|
3
|
+
/**
|
|
4
|
+
* 放置返回值数据
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IGctDropResultData
|
|
8
|
+
*/
|
|
9
|
+
export interface IGctDropResultData {
|
|
10
|
+
/**
|
|
11
|
+
* 放置分组标识
|
|
12
|
+
*
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
group: string;
|
|
16
|
+
/**
|
|
17
|
+
* 是否成功放置
|
|
18
|
+
*
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
21
|
+
success: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 放置数据
|
|
24
|
+
*
|
|
25
|
+
* @type {IGctDndData}
|
|
26
|
+
*/
|
|
27
|
+
data?: IGctDndData;
|
|
28
|
+
/**
|
|
29
|
+
* 额外携带放置配置,用于优化放置对比
|
|
30
|
+
*
|
|
31
|
+
* @type {IGctDndConfig}
|
|
32
|
+
*/
|
|
33
|
+
cfg: IGctDndConfig;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 放置返回值
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
* @interface IGctDropResult
|
|
40
|
+
*/
|
|
41
|
+
export interface IGctDropResult {
|
|
42
|
+
/**
|
|
43
|
+
* 放置数据异步钩子
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
asyncDrop: () => Promise<IGctDropResultData>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { IGctDndConfig } from './i-gct-dnd-config';
|
|
2
|
+
export type { IGctDndData } from './i-gct-dnd-data';
|
|
3
|
+
export type { IGctDndRenderItemOptions } from './i-gct-dnd-render-item-options';
|
|
4
|
+
export type { IGctDragCollect } from './i-gct-drag-collect';
|
|
5
|
+
export type { IGctDropCollect } from './i-gct-drop-collect';
|
|
6
|
+
export type { IGctDragDndData } from './i-gct-drag-dnd-data';
|
|
7
|
+
export type { IGctDropResult, IGctDropResultData } from './i-gct-drop-result';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core-web",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台网页端核心包",
|
|
6
6
|
"main": "dist/index.min.cjs",
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"author": "gct",
|
|
33
33
|
"scripts": {
|
|
34
|
-
"dev": "
|
|
35
|
-
"build": "
|
|
34
|
+
"dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
|
|
35
|
+
"es:build": "vite build --config vite.dev.config.ts",
|
|
36
|
+
"build": "npm run lint && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
|
|
36
37
|
"lint": "eslint src/",
|
|
37
38
|
"publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
|
|
38
39
|
"publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
|
|
@@ -44,20 +45,22 @@
|
|
|
44
45
|
"gen-api:platform": "gct-paas gen-api --url=http://paas.paasdev.gct-paas.com --tag=platform -t ../cli/hbs-temp -o ./src/service/gct-platform && prettier './src/service/gct-platform' --write"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"@gct-paas/
|
|
48
|
+
"@ant-design/icons-vue": "^7.0.1",
|
|
49
|
+
"@gct-paas/core": "0.1.4-dev.8",
|
|
50
|
+
"@gct-paas/scss": "0.1.4-dev.8",
|
|
49
51
|
"@monaco-editor/loader": "^1.7.0",
|
|
50
52
|
"ant-design-vue": "3.2.20",
|
|
51
53
|
"lodash-es": "^4.17.23",
|
|
52
54
|
"monaco-editor": "^0.55.1",
|
|
53
55
|
"vue": "3.5.27",
|
|
54
|
-
"vue3-colorpicker": "^2.3.0"
|
|
56
|
+
"vue3-colorpicker": "^2.3.0",
|
|
57
|
+
"vue3-dnd": "^2.1.0"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
|
-
"@gct-paas/build": "^0.1.
|
|
60
|
+
"@gct-paas/build": "^0.1.5-dev.6"
|
|
58
61
|
},
|
|
59
62
|
"peerDependencies": {
|
|
60
63
|
"vue": "^3.x"
|
|
61
64
|
},
|
|
62
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "bf7f4f9672c3906ec834e6d58b999ce78f7cad08"
|
|
63
66
|
}
|