@gct-paas/render 0.1.5-dev.3 → 0.1.5-dev.4

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.
Files changed (27) hide show
  1. package/dist/index.min.css +1 -1
  2. package/dist/loader.esm.min.js +1 -1
  3. package/es/Event/Dependency/controller.mjs +2 -2
  4. package/es/Event/Dependency/displayRule.mjs +2 -2
  5. package/es/Event/Dependency/useDependency.mjs +2 -2
  6. package/es/Event/baseEvent.mjs +5 -5
  7. package/es/Event/utils/runGlobalByPage.d.ts +4 -4
  8. package/es/Event/utils/runGlobalByPage.mjs +1 -1
  9. package/es/controller/design-render/design-render.controller.d.ts +1 -1
  10. package/es/hooks/useStorageRef.mjs +1 -1
  11. package/es/hooks/widgets/useFileAttrsHooks.d.ts +6 -6
  12. package/es/hooks/widgets/useFileAttrsHooks.mjs +1 -1
  13. package/es/index.d.ts +4 -2
  14. package/es/index.mjs +12 -9
  15. package/es/modules/vue3-dnd/components/vue3-dnd-draggable/vue3-dnd-draggable.css +73 -0
  16. package/es/modules/vue3-dnd/components/vue3-dnd-draggable/vue3-dnd-draggable.d.ts +70 -0
  17. package/es/modules/vue3-dnd/components/vue3-dnd-draggable/vue3-dnd-draggable.mjs +119 -0
  18. package/es/modules/vue3-dnd/components/vue3-dnd-draggable-item/vue3-dnd-draggable-item.css +74 -0
  19. package/es/modules/vue3-dnd/components/vue3-dnd-draggable-item/vue3-dnd-draggable-item.d.ts +69 -0
  20. package/es/modules/vue3-dnd/components/vue3-dnd-draggable-item/vue3-dnd-draggable-item.mjs +165 -0
  21. package/es/modules/vue3-dnd/index.d.ts +3 -0
  22. package/es/modules/vue3-dnd/index.mjs +2 -0
  23. package/es/modules/vue3-dnd/interface/i-vue3-dnd-draggable-options.d.ts +294 -0
  24. package/es/modules/vue3-dnd/interface/index.d.ts +1 -0
  25. package/es/utils/expression/index.mjs +1 -1
  26. package/es/utils/expression/regularExpression/methods.mjs +1 -1
  27. package/package.json +13 -12
@@ -0,0 +1,165 @@
1
+ import './vue3-dnd-draggable-item.css';/* empty css */
2
+ import { useNamespace } from "@gct-paas/core";
3
+ import { createVNode, defineComponent, nextTick, onMounted, ref } from "vue";
4
+ import { useDrag, useDrop } from "vue3-dnd";
5
+ //#region src/modules/vue3-dnd/components/vue3-dnd-draggable-item/vue3-dnd-draggable-item.tsx
6
+ var Vue3DndDraggableItem = /* @__PURE__ */ defineComponent({
7
+ name: "Vue3DndDraggableItem",
8
+ props: {
9
+ group: {
10
+ type: String,
11
+ required: true
12
+ },
13
+ index: {
14
+ type: Number,
15
+ required: true
16
+ },
17
+ item: {
18
+ type: Object,
19
+ required: true
20
+ },
21
+ config: {
22
+ type: Object,
23
+ required: true
24
+ },
25
+ add: {
26
+ type: Function,
27
+ required: true
28
+ },
29
+ remove: {
30
+ type: Function,
31
+ required: true
32
+ },
33
+ move: {
34
+ type: Function,
35
+ required: true
36
+ }
37
+ },
38
+ setup(props) {
39
+ const ns = useNamespace("vue3-dnd-draggable-item");
40
+ const elRef = ref(null);
41
+ const isBeforeHover = ref(false);
42
+ const { config } = props;
43
+ const [dragCollect, drag, preview] = useDrag({
44
+ type: config.type,
45
+ item: () => {
46
+ return {
47
+ group: props.group,
48
+ item: props.item
49
+ };
50
+ },
51
+ collect: (monitor) => {
52
+ return {
53
+ canDrag: monitor.canDrag(),
54
+ isDragging: monitor.isDragging()
55
+ };
56
+ },
57
+ canDrag(monitor) {
58
+ if (config.canDrag) return config.canDrag(monitor);
59
+ return true;
60
+ },
61
+ end(item, monitor) {
62
+ if (config.end) return config.end(item, monitor);
63
+ const result = monitor.getDropResult();
64
+ if (result && result.group !== props.group) props.remove(item);
65
+ },
66
+ options: config.dragOptions,
67
+ previewOptions: config.previewOptions
68
+ });
69
+ const [dropCollect, drop] = useDrop({
70
+ accept: config.type,
71
+ collect(monitor) {
72
+ return {
73
+ handlerId: monitor.getHandlerId(),
74
+ canDrop: monitor.canDrop(),
75
+ isShallowOver: monitor.isOver({ shallow: true }),
76
+ isOver: monitor.isOver()
77
+ };
78
+ },
79
+ hover(item, monitor) {
80
+ if (config.hover) return config.hover(item, monitor);
81
+ if (monitor.canDrop() === false || dragCollect.value.isDragging === true) return;
82
+ if (props.item === item.item) return;
83
+ if (monitor.isOver({ shallow: true })) {
84
+ const rect = elRef.value.getBoundingClientRect();
85
+ const offset = monitor.getClientOffset();
86
+ const dropOffset = config.offset ?? 0;
87
+ let difference = 0;
88
+ if (config.direction === "vertical") {
89
+ const { top, height } = rect;
90
+ const { y } = offset;
91
+ const half = height / 2;
92
+ difference = y - top - half;
93
+ if (Math.abs(difference) < dropOffset) return;
94
+ if (difference < 0) isBeforeHover.value = true;
95
+ else isBeforeHover.value = false;
96
+ } else if (config.direction === "horizontal") {
97
+ const { left, width } = rect;
98
+ const { x } = offset;
99
+ const half = width / 2;
100
+ difference = x - left - half;
101
+ if (Math.abs(difference) < dropOffset) return;
102
+ if (difference < 0) isBeforeHover.value = true;
103
+ else isBeforeHover.value = false;
104
+ }
105
+ const key = config.key ?? "id";
106
+ if (item.group === props.group) props.move(isBeforeHover.value, props.item[key], item.item[key]);
107
+ else props.add(isBeforeHover.value, props.item[key], item.item);
108
+ }
109
+ },
110
+ canDrop(item, monitor) {
111
+ if (config.canDrop) return config.canDrop(item, monitor);
112
+ if (dragCollect.value.isDragging === true) return false;
113
+ return true;
114
+ },
115
+ drop(item, monitor) {
116
+ if (config.drop) return config.drop(item, monitor);
117
+ return { group: props.group };
118
+ },
119
+ options: config.dropOptions
120
+ });
121
+ if (props.config.isCustomHandle !== true && !props.config.handle) drag(elRef);
122
+ drop(elRef);
123
+ preview(elRef);
124
+ onMounted(() => {
125
+ nextTick(() => {
126
+ if (props.config.handle && elRef.value) {
127
+ const el = elRef.value.querySelector(props.config.handle);
128
+ if (el) drag(el);
129
+ }
130
+ });
131
+ });
132
+ return {
133
+ ns,
134
+ elRef,
135
+ dragCollect,
136
+ dropCollect,
137
+ isBeforeHover,
138
+ drag,
139
+ preview
140
+ };
141
+ },
142
+ render() {
143
+ return createVNode("div", {
144
+ "ref": "elRef",
145
+ "class": [
146
+ this.ns.b(),
147
+ this.ns.is("dragging", this.dragCollect.isDragging),
148
+ this.ns.is("shallow-over", this.dropCollect.isShallowOver)
149
+ ]
150
+ }, [this.$slots.default?.({
151
+ item: this.item,
152
+ index: this.index,
153
+ isDragging: this.dragCollect.isDragging,
154
+ isShallowOver: this.dropCollect.isShallowOver,
155
+ isOver: this.dropCollect.isOver,
156
+ isBeforeHover: this.isBeforeHover,
157
+ isAfterHover: !this.isBeforeHover,
158
+ direction: this.config.direction,
159
+ drag: this.drag,
160
+ preview: this.preview
161
+ })]);
162
+ }
163
+ });
164
+ //#endregion
165
+ export { Vue3DndDraggableItem };
@@ -0,0 +1,3 @@
1
+ export { Vue3DndDraggableItem } from './components/vue3-dnd-draggable-item/vue3-dnd-draggable-item';
2
+ export { Vue3DndDraggable } from './components/vue3-dnd-draggable/vue3-dnd-draggable';
3
+ export type * from './interface';
@@ -0,0 +1,2 @@
1
+ import "./components/vue3-dnd-draggable-item/vue3-dnd-draggable-item.mjs";
2
+ import "./components/vue3-dnd-draggable/vue3-dnd-draggable.mjs";
@@ -0,0 +1,294 @@
1
+ import { ConnectDragPreview, ConnectDragSource, DragPreviewOptions, DragSourceMonitor, DragSourceOptions, DropTargetMonitor, DropTargetOptions } from 'vue3-dnd';
2
+ /**
3
+ * 拖拽绘制项参数
4
+ *
5
+ * @author zhanghanrui
6
+ * @date 2024-08-20 16:08:30
7
+ * @export
8
+ * @interface IRenderOptions
9
+ * @template O
10
+ */
11
+ export interface IRenderOptions<O = unknown> {
12
+ /**
13
+ * 节点数据
14
+ *
15
+ * @author zhanghanrui
16
+ * @date 2024-08-20 16:08:42
17
+ * @type {O}
18
+ */
19
+ item: O;
20
+ /**
21
+ * 当前排序
22
+ *
23
+ * @author zhanghanrui
24
+ * @date 2024-08-20 16:08:47
25
+ * @type {number}
26
+ */
27
+ index: number;
28
+ /**
29
+ * 是否正在拖拽
30
+ *
31
+ * @author zhanghanrui
32
+ * @date 2024-08-20 16:08:53
33
+ * @type {boolean}
34
+ */
35
+ isDragging: boolean;
36
+ /**
37
+ * 是否悬浮于当前元素内,并且只有当前元素。多层悬浮时,以最底层触发此参数
38
+ *
39
+ * @author zhanghanrui
40
+ * @date 2024-08-20 16:08:00
41
+ * @type {boolean}
42
+ */
43
+ isShallowOver: boolean;
44
+ /**
45
+ * 是否在此元素上
46
+ *
47
+ * @author zhanghanrui
48
+ * @date 2024-08-20 16:08:57
49
+ * @type {boolean}
50
+ */
51
+ isOver: boolean;
52
+ /**
53
+ * 是否悬浮于此元素前半段(需要根据拖拽线方向,判断是上下还是左右)
54
+ *
55
+ * @author zhanghanrui
56
+ * @date 2024-08-20 16:08:07
57
+ * @type {boolean}
58
+ */
59
+ isBeforeHover: boolean;
60
+ /**
61
+ * 是否悬浮于此元素后半段(需要根据拖拽线方向,判断是上下还是左右)
62
+ *
63
+ * @author zhanghanrui
64
+ * @date 2024-08-20 16:08:29
65
+ * @type {boolean}
66
+ */
67
+ isAfterHover: boolean;
68
+ /**
69
+ * 放置线方向
70
+ *
71
+ * @author zhanghanrui
72
+ * @date 2024-08-20 16:08:34
73
+ * @type {('vertical' | 'horizontal')}
74
+ */
75
+ direction: 'vertical' | 'horizontal';
76
+ /**
77
+ * 自定义拖拽 handle 元素
78
+ *
79
+ * @author zhanghanrui
80
+ * @date 2024-08-20 17:08:35
81
+ * @type {ConnectDragSource<DragSourceOptions>}
82
+ */
83
+ drag?: ConnectDragSource<DragSourceOptions>;
84
+ /**
85
+ * 自定义拖拽预览
86
+ *
87
+ * @author zhanghanrui
88
+ * @date 2024-09-26 17:09:42
89
+ * @type {ConnectDragPreview<DragPreviewOptions>}
90
+ */
91
+ preview?: ConnectDragPreview<DragPreviewOptions>;
92
+ }
93
+ /**
94
+ * 放置结果回执
95
+ *
96
+ * @author zhanghanrui
97
+ * @date 2024-08-20 16:08:38
98
+ * @export
99
+ * @interface IDropResult
100
+ */
101
+ export interface IDropResult {
102
+ /**
103
+ * 放置分组标识
104
+ *
105
+ * @author zhanghanrui
106
+ * @date 2024-08-20 16:08:52
107
+ * @type {string}
108
+ */
109
+ group: string;
110
+ }
111
+ /**
112
+ * 拖拽数据项
113
+ *
114
+ * @author zhanghanrui
115
+ * @date 2024-08-20 16:08:57
116
+ * @export
117
+ * @interface IDragDataItem
118
+ * @template O
119
+ */
120
+ export interface IDragDataItem<O = unknown> {
121
+ /**
122
+ * 拖拽分组实例标识
123
+ *
124
+ * @author zhanghanrui
125
+ * @date 2024-08-20 16:08:03
126
+ * @type {string}
127
+ */
128
+ group: string;
129
+ /**
130
+ * 当前拖拽数据
131
+ *
132
+ * @author zhanghanrui
133
+ * @date 2024-08-20 16:08:22
134
+ * @type {O}
135
+ */
136
+ item: O;
137
+ }
138
+ /**
139
+ * 拖拽配置
140
+ *
141
+ * @author zhanghanrui
142
+ * @date 2024-08-20 14:08:48
143
+ * @export
144
+ * @interface IVue3DndDraggableOptions
145
+ * @template O
146
+ * @template R
147
+ */
148
+ export interface IVue3DndDraggableOptions<O = unknown, R extends IDropResult = IDropResult> {
149
+ /**
150
+ * 拖拽分组类型(同类型下,可跨分组拖拽)
151
+ *
152
+ * @author zhanghanrui
153
+ * @date 2024-08-20 14:08:26
154
+ * @type {string}
155
+ */
156
+ type: string;
157
+ /**
158
+ * 放置线方向
159
+ *
160
+ * @author zhanghanrui
161
+ * @date 2024-08-20 14:08:09
162
+ * @type {('vertical' | 'horizontal')} 垂直方向 | 水平方向
163
+ */
164
+ direction: 'vertical' | 'horizontal';
165
+ /**
166
+ * 放置线偏移量
167
+ *
168
+ * @author zhanghanrui
169
+ * @date 2024-09-22 10:09:36
170
+ * @type {number}
171
+ */
172
+ offset?: number;
173
+ /**
174
+ * 自定义拖拽元素选择器
175
+ *
176
+ * @author zhanghanrui
177
+ * @date 2024-08-20 19:08:30
178
+ * @type {string}
179
+ */
180
+ handle?: string;
181
+ /**
182
+ * 项数据标识
183
+ *
184
+ * @default 'id'
185
+ * @author zhanghanrui
186
+ * @date 2024-09-22 10:09:43
187
+ * @type {string}
188
+ */
189
+ key?: string;
190
+ /**
191
+ * 是否自定义拖拽节点
192
+ *
193
+ * @default false
194
+ * @author zhanghanrui
195
+ * @date 2024-08-20 17:08:41
196
+ * @type {boolean}
197
+ */
198
+ isCustomHandle?: boolean;
199
+ /**
200
+ * 是否允许拖拽
201
+ *
202
+ * @author zhanghanrui
203
+ * @date 2024-08-20 14:08:35
204
+ * @template O
205
+ * @template R
206
+ * @param {DragSourceMonitor<IDragDataItem<O>, R>} monitor
207
+ * @return {*} {boolean}
208
+ */
209
+ canDrag?(monitor: DragSourceMonitor<IDragDataItem<O>, R>): boolean;
210
+ /**
211
+ * 是否允许放置
212
+ *
213
+ * @author zhanghanrui
214
+ * @date 2024-08-20 14:08:45
215
+ * @template O
216
+ * @template R
217
+ * @param {O} item
218
+ * @param {DropTargetMonitor<IDragDataItem<O>, R>} monitor
219
+ * @return {*} {boolean}
220
+ */
221
+ canDrop?(item: IDragDataItem<O>, monitor: DropTargetMonitor<IDragDataItem<O>, R>): boolean;
222
+ /**
223
+ * 是否允许放置容器内
224
+ *
225
+ * @author zhanghanrui
226
+ * @date 2024-08-20 15:08:22
227
+ * @param {O} item
228
+ * @param {DropTargetMonitor<IDragDataItem<O>, R>} monitor
229
+ * @return {*} {boolean}
230
+ */
231
+ canDropContainer?(item: IDragDataItem<O>, monitor: DropTargetMonitor<IDragDataItem<O>, R>): boolean;
232
+ /**
233
+ * 放置钩子
234
+ *
235
+ * @author zhanghanrui
236
+ * @date 2024-08-20 14:08:36
237
+ * @param {O} item
238
+ * @param {DropTargetMonitor<IDragDataItem<O>, R>} monitor
239
+ * @return {*} {(O | undefined)}
240
+ */
241
+ drop?(item: IDragDataItem<O>, monitor: DropTargetMonitor<IDragDataItem<O>, R>): R | undefined;
242
+ /**
243
+ * 放置容器钩子
244
+ *
245
+ * @author zhanghanrui
246
+ * @date 2024-08-20 15:08:26
247
+ * @param {O} item
248
+ * @param {DropTargetMonitor<IDragDataItem<O>, R>} monitor
249
+ * @return {*} {(O | undefined)}
250
+ */
251
+ dropContainer?(item: IDragDataItem<O>, monitor: DropTargetMonitor<IDragDataItem<O>, R>): O | undefined;
252
+ /**
253
+ * 放置悬浮钩子
254
+ *
255
+ * @author zhanghanrui
256
+ * @date 2024-08-20 14:08:34
257
+ * @param {O} item
258
+ * @param {DropTargetMonitor<IDragDataItem<O>, R>} monitor
259
+ */
260
+ hover?(item: IDragDataItem<O>, monitor: DropTargetMonitor<IDragDataItem<O>, R>): void;
261
+ /**
262
+ * 拖拽结束
263
+ *
264
+ * @author zhanghanrui
265
+ * @date 2024-08-20 14:08:02
266
+ * @param {O} item
267
+ * @param {DragSourceMonitor<IDragDataItem<O>, R>} monitor
268
+ */
269
+ end?(item: IDragDataItem<O>, monitor: DragSourceMonitor<IDragDataItem<O>, R>): void;
270
+ /**
271
+ * 预览配置
272
+ *
273
+ * @author zhanghanrui
274
+ * @date 2024-08-20 14:08:41
275
+ * @type {DragPreviewOptions}
276
+ */
277
+ previewOptions?: DragPreviewOptions;
278
+ /**
279
+ * 拖拽配置
280
+ *
281
+ * @author zhanghanrui
282
+ * @date 2024-08-20 14:08:46
283
+ * @type {DragSourceOptions}
284
+ */
285
+ dragOptions?: DragSourceOptions;
286
+ /**
287
+ * 放置配置
288
+ *
289
+ * @author zhanghanrui
290
+ * @date 2024-08-20 14:08:58
291
+ * @type {DropTargetOptions}
292
+ */
293
+ dropOptions?: DropTargetOptions;
294
+ }
@@ -0,0 +1 @@
1
+ export type { IVue3DndDraggableOptions, IRenderOptions, IDragDataItem, } from './i-vue3-dnd-draggable-options';
@@ -1,8 +1,8 @@
1
1
  import { methods_exports } from "./regularExpression/methods.mjs";
2
2
  import { SYSTEM_VAR_PREFIX, functionMap, innerVarIds, operator2FuncMap } from "@gct-paas/core";
3
+ import { useMemoize } from "@vueuse/core";
3
4
  import * as esprima from "esprima-next";
4
5
  import estraverse from "estraverse";
5
- import { useMemoize } from "@vueuse/core";
6
6
  //#region src/utils/expression/index.ts
7
7
  window._METHOD_DEBUG_ = methods_exports;
8
8
  var identify = useMemoize(_identify);
@@ -1,12 +1,12 @@
1
1
  import { __exportAll } from "../../../_virtual/_rolldown/runtime.mjs";
2
2
  import dayjs from "dayjs";
3
+ import BigNumberJS from "bignumber.js";
3
4
  import { isEqual, isNull, isUndefined } from "lodash-es";
4
5
  import utc from "dayjs/plugin/utc";
5
6
  import timezone from "dayjs/plugin/timezone";
6
7
  import quarterOfYear from "dayjs/plugin/quarterOfYear";
7
8
  import toArray from "dayjs/plugin/toArray";
8
9
  import isoWeek from "dayjs/plugin/isoWeek";
9
- import BigNumberJS from "bignumber.js";
10
10
  //#region src/utils/expression/regularExpression/methods.ts
11
11
  var methods_exports = /* @__PURE__ */ __exportAll({
12
12
  ABS: () => ABS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/render",
3
- "version": "0.1.5-dev.3",
3
+ "version": "0.1.5-dev.4",
4
4
  "type": "module",
5
5
  "description": "paas 平台网页端底包",
6
6
  "loader": "dist/loader.esm.min.js",
@@ -31,7 +31,7 @@
31
31
  "license": "MIT",
32
32
  "author": "gct",
33
33
  "dependencies": {
34
- "@gct-paas/api": "^0.1.3",
34
+ "@gct-paas/api": "0.1.4-dev.0",
35
35
  "@vueuse/core": "^14.1.0",
36
36
  "axios": "^1.13.2",
37
37
  "bignumber.js": "^10.0.2",
@@ -43,10 +43,11 @@
43
43
  "qs": "^6.15.0",
44
44
  "qx-util": "^0.4.8",
45
45
  "vue": "^3.5.30",
46
- "@gct-paas/core": "0.1.5-dev.3",
47
- "@gct-paas/core-web": "0.1.5-dev.3",
48
- "@gct-paas/scss": "0.1.5-dev.3",
49
- "@gct-paas/schema": "0.1.5-dev.3"
46
+ "vue3-dnd": "^2.1.0",
47
+ "@gct-paas/schema": "0.1.5-dev.4",
48
+ "@gct-paas/core": "0.1.5-dev.4",
49
+ "@gct-paas/core-web": "0.1.5-dev.4",
50
+ "@gct-paas/scss": "0.1.5-dev.4"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@types/escodegen": "^0.0.10",
@@ -54,17 +55,17 @@
54
55
  "@types/estree": "^1.0.8"
55
56
  },
56
57
  "peerDependencies": {
57
- "@gct-paas/api": "^0.1.3",
58
+ "@gct-paas/api": "0.1.4-dev.0",
58
59
  "vue": ">=3",
59
- "@gct-paas/core": "0.1.5-dev.3",
60
- "@gct-paas/core-web": "0.1.5-dev.3",
61
- "@gct-paas/schema": "0.1.5-dev.3",
62
- "@gct-paas/scss": "0.1.5-dev.3"
60
+ "@gct-paas/core": "0.1.5-dev.4",
61
+ "@gct-paas/schema": "0.1.5-dev.4",
62
+ "@gct-paas/scss": "0.1.5-dev.4",
63
+ "@gct-paas/core-web": "0.1.5-dev.4"
63
64
  },
64
65
  "scripts": {
65
66
  "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
66
67
  "es:build": "vite build --config vite.dev.config.ts",
67
- "build": "npm run lint && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
68
+ "build": "npm run lint && vue-tsc --noEmit && vite build --config vite.dev.config.ts && vite build --config vite.config.ts",
68
69
  "lint": "eslint src/",
69
70
  "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
70
71
  "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",