@vunk/form 0.0.0-alpha.2 → 0.0.0-alpha.3

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 (118) hide show
  1. package/components/config/src/ctx.d.ts +1 -1
  2. package/components/config-renderer/src/ctx.d.ts +1 -1
  3. package/components/confirm-input/index.js +3 -3
  4. package/components/confirm-input/src/ctx.d.ts +79 -37
  5. package/components/confirm-input/src/index.vue.d.ts +210 -131
  6. package/components/drop-wrapper/index.js +2 -2
  7. package/components/drop-wrapper/src/index.vue.d.ts +2 -2
  8. package/components/form/index.js +39 -4
  9. package/components/form/src/ctx.d.ts +21 -16
  10. package/components/form/src/index.vue.d.ts +51 -43
  11. package/components/form-item/index.d.ts +5 -0
  12. package/components/form-item/index.js +71 -0
  13. package/components/form-item/src/ctx.d.ts +44 -0
  14. package/components/form-item/src/index.vue.d.ts +102 -0
  15. package/components/form-item/src/types.d.ts +6 -0
  16. package/components/ground/index.css +64 -29
  17. package/components/ground/index.js +433 -97
  18. package/components/ground/src/ground-config/src/index.vue.d.ts +4 -1
  19. package/components/ground/src/ground-main/src/editing-wrapper.vue.d.ts +35 -5
  20. package/components/ground/src/ground-main/src/index.vue.d.ts +19 -5
  21. package/components/ground/src/ground-widget/src/form-item-widget/src/index.vue.d.ts +400 -138
  22. package/components/ground/src/ground-widget/src/index.vue.d.ts +21 -5
  23. package/components/ground/src/ground-widget/src/static.d.ts +2 -2
  24. package/components/ground/src/index.vue.d.ts +23 -4
  25. package/components/input/index.js +12 -32
  26. package/components/input/src/ctx.d.ts +81 -43
  27. package/components/input/src/index.vue.d.ts +209 -136
  28. package/components/input/src/types.d.ts +1 -6
  29. package/components/input-config/index.js +102 -23
  30. package/components/input-config/src/ctx.d.ts +19 -15
  31. package/components/input-config/src/index.vue.d.ts +70 -50
  32. package/components/rules-config/index.d.ts +3 -0
  33. package/components/rules-config/index.js +63 -0
  34. package/components/rules-config/src/ctx.d.ts +38 -0
  35. package/components/rules-config/src/index.vue.d.ts +113 -0
  36. package/components/select/index.d.ts +4 -0
  37. package/components/select/index.js +75 -0
  38. package/components/select/src/ctx.d.ts +188 -0
  39. package/components/select/src/index.vue.d.ts +580 -0
  40. package/components/select/src/types.d.ts +3 -0
  41. package/components/select-config/index.d.ts +4 -0
  42. package/components/select-config/index.js +43 -0
  43. package/components/select-config/src/ctx.d.ts +11 -0
  44. package/components/select-config/src/index.vue.d.ts +18 -0
  45. package/components/select-config/src/types.d.ts +3 -0
  46. package/components/switch/index.d.ts +4 -0
  47. package/components/switch/index.js +61 -0
  48. package/components/switch/src/ctx.d.ts +62 -0
  49. package/components/switch/src/index.vue.d.ts +184 -0
  50. package/components/switch/src/types.d.ts +3 -0
  51. package/full-entry/main.d.ts +5 -0
  52. package/index.css +64 -29
  53. package/index.d.ts +34 -24
  54. package/index.esm.js +5 -0
  55. package/package.json +1 -1
  56. package/shared/element-plus/ctx/index.d.ts +8 -4
  57. package/shared/element-plus/ctx/index.js +1267 -2
  58. package/shared/element-plus/instances/select.d.ts +91 -0
  59. package/shared/element-plus/instances/select.js +1264 -0
  60. package/shared/helper/index.d.ts +2 -2
  61. package/shared/helper/index.js +1 -1
  62. package/shared/types/drag/index.d.ts +7 -0
  63. package/shared/types/drag/index.js +1 -0
  64. package/shared/types/form-item/index.d.ts +2 -0
  65. package/shared/types/form-item/select.d.ts +8 -0
  66. package/shared/types/form-item/select.js +1 -0
  67. package/shared/types/form-item/switch.d.ts +8 -0
  68. package/shared/types/form-item/switch.js +1 -0
  69. package/shared/types/index.d.ts +2 -2
  70. package/shared/types/shared/index.d.ts +1 -0
  71. package/types/components/config/src/ctx.d.ts +1 -1
  72. package/types/components/config-renderer/src/ctx.d.ts +1 -1
  73. package/types/components/confirm-input/src/ctx.d.ts +79 -37
  74. package/types/components/confirm-input/src/index.vue.d.ts +210 -131
  75. package/types/components/drop-wrapper/src/index.vue.d.ts +2 -2
  76. package/types/components/form/src/ctx.d.ts +21 -16
  77. package/types/components/form/src/index.vue.d.ts +51 -43
  78. package/types/components/form-item/index.d.ts +5 -0
  79. package/types/components/form-item/src/ctx.d.ts +44 -0
  80. package/types/components/form-item/src/index.vue.d.ts +102 -0
  81. package/types/components/form-item/src/types.d.ts +6 -0
  82. package/types/components/ground/src/ground-config/src/index.vue.d.ts +4 -1
  83. package/types/components/ground/src/ground-main/src/editing-wrapper.vue.d.ts +35 -5
  84. package/types/components/ground/src/ground-main/src/index.vue.d.ts +19 -5
  85. package/types/components/ground/src/ground-widget/src/form-item-widget/src/index.vue.d.ts +400 -138
  86. package/types/components/ground/src/ground-widget/src/index.vue.d.ts +21 -5
  87. package/types/components/ground/src/ground-widget/src/static.d.ts +2 -2
  88. package/types/components/ground/src/index.vue.d.ts +23 -4
  89. package/types/components/input/src/ctx.d.ts +81 -43
  90. package/types/components/input/src/index.vue.d.ts +209 -136
  91. package/types/components/input/src/types.d.ts +1 -6
  92. package/types/components/input-config/src/ctx.d.ts +19 -15
  93. package/types/components/input-config/src/index.vue.d.ts +70 -50
  94. package/types/components/rules-config/index.d.ts +3 -0
  95. package/types/components/rules-config/src/ctx.d.ts +38 -0
  96. package/types/components/rules-config/src/index.vue.d.ts +113 -0
  97. package/types/components/select/index.d.ts +4 -0
  98. package/types/components/select/src/ctx.d.ts +188 -0
  99. package/types/components/select/src/index.vue.d.ts +580 -0
  100. package/types/components/select/src/types.d.ts +3 -0
  101. package/types/components/select-config/index.d.ts +4 -0
  102. package/types/components/select-config/src/ctx.d.ts +11 -0
  103. package/types/components/select-config/src/index.vue.d.ts +18 -0
  104. package/types/components/select-config/src/types.d.ts +3 -0
  105. package/types/components/switch/index.d.ts +4 -0
  106. package/types/components/switch/src/ctx.d.ts +62 -0
  107. package/types/components/switch/src/index.vue.d.ts +184 -0
  108. package/types/components/switch/src/types.d.ts +3 -0
  109. package/types/full-entry/main.d.ts +5 -0
  110. package/types/shared/element-plus/ctx/index.d.ts +8 -4
  111. package/types/shared/element-plus/instances/select.d.ts +91 -0
  112. package/types/shared/helper/index.d.ts +2 -2
  113. package/types/shared/types/drag/index.d.ts +7 -0
  114. package/types/shared/types/form-item/index.d.ts +2 -0
  115. package/types/shared/types/form-item/select.d.ts +8 -0
  116. package/types/shared/types/form-item/switch.d.ts +8 -0
  117. package/types/shared/types/index.d.ts +2 -2
  118. package/types/shared/types/shared/index.d.ts +1 -0
@@ -1,10 +1,10 @@
1
- import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString, ref, createVNode, withDirectives, vShow, createTextVNode, withModifiers, renderSlot, computed, createCommentVNode, resolveDynamicComponent, normalizeClass, mergeProps, toHandlers } from 'vue';
1
+ import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString, ref, createVNode, withDirectives, renderSlot, vShow, createTextVNode, computed, createCommentVNode, resolveDynamicComponent, normalizeClass, mergeProps, toHandlers, unref, getCurrentScope, onScopeDispose, watch } from 'vue';
2
2
  import { VkTabGroup, VkTabItem, VkCard, VkBoxHandler } from 'vunk';
3
3
  import { VkFloatBlock } from 'vunk/gsap/components/float-block';
4
- import { ElCollapseItem, ElScrollbar, ElCollapse, ElIcon, ElMessage } from 'element-plus';
4
+ import { ElCollapseItem, ElScrollbar, ElCollapse, ElIcon, ElButton, ElMessage, ElMessageBox } from 'element-plus';
5
5
  import { VkfDragWrapper } from '@vunk/form/components/drag-wrapper';
6
6
  import 'vunk/gsap/components/float-block/index.css';
7
- import { _VkfFormUtils, VkfForm } from '@vunk/form/components/form';
7
+ import { VkfForm, _VkfFormUtils } from '@vunk/form/components/form';
8
8
  import { VkfDropWrapper, DragoverClasses } from '@vunk/form/components/drop-wrapper';
9
9
  import { VkfFormItemRendererTemplate } from '@vunk/form/components/form-item-renderer-template';
10
10
  import { setData, unsetData } from 'vunk/shared/helper';
@@ -25,6 +25,15 @@ var script$5 = defineComponent({
25
25
  prop: "",
26
26
  label: "inputLabel"
27
27
  }
28
+ },
29
+ {
30
+ label: "switch",
31
+ value: "VkfSwitch",
32
+ defaultOptions: {
33
+ templateType: "VkfSwitch",
34
+ prop: "",
35
+ label: "label"
36
+ }
28
37
  }
29
38
  ];
30
39
  return {
@@ -33,23 +42,24 @@ var script$5 = defineComponent({
33
42
  }
34
43
  });
35
44
 
36
- const _hoisted_1$5 = { class: "vkf-ground-widget-ul" };
45
+ const _hoisted_1$6 = { class: "vkf-ground-widget-ul" };
37
46
  function render$5(_ctx, _cache, $props, $setup, $data, $options) {
38
47
  const _component_VkfDragWrapper = resolveComponent("VkfDragWrapper");
39
48
  const _component_ElCollapseItem = resolveComponent("ElCollapseItem");
40
49
  return openBlock(), createBlock(_component_ElCollapseItem, { title: "FormItems" }, {
41
50
  default: withCtx(() => [
42
- createElementVNode("ul", _hoisted_1$5, [
51
+ createElementVNode("ul", _hoisted_1$6, [
43
52
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data, (item) => {
44
53
  return openBlock(), createBlock(_component_VkfDragWrapper, {
45
54
  key: item.value,
46
- data: JSON.stringify(item.defaultOptions)
55
+ title: JSON.stringify({ source: item.defaultOptions }),
56
+ data: JSON.stringify({ source: item.defaultOptions })
47
57
  }, {
48
58
  default: withCtx(() => [
49
59
  createElementVNode("li", null, toDisplayString(item.label), 1)
50
60
  ]),
51
61
  _: 2
52
- }, 1032, ["data"]);
62
+ }, 1032, ["title", "data"]);
53
63
  }), 128))
54
64
  ])
55
65
  ]),
@@ -61,14 +71,14 @@ script$5.render = render$5;
61
71
  script$5.__file = "ground/src/ground-widget/src/form-item-widget/src/index.vue";
62
72
 
63
73
  var ComponentsType = /* @__PURE__ */ ((ComponentsType2) => {
64
- ComponentsType2[ComponentsType2["container"] = 0] = "container";
65
- ComponentsType2[ComponentsType2["formItems"] = 1] = "formItems";
74
+ ComponentsType2["container"] = "container";
75
+ ComponentsType2["formItems"] = "formItems";
66
76
  return ComponentsType2;
67
77
  })(ComponentsType || {});
68
78
 
69
79
  var WidgetTab = /* @__PURE__ */ ((WidgetTab2) => {
70
- WidgetTab2[WidgetTab2["components"] = 0] = "components";
71
- WidgetTab2[WidgetTab2["templates"] = 1] = "templates";
80
+ WidgetTab2["components"] = "components";
81
+ WidgetTab2["templates"] = "templates";
72
82
  return WidgetTab2;
73
83
  })(WidgetTab || {});
74
84
  var script$4 = defineComponent({
@@ -81,23 +91,30 @@ var script$4 = defineComponent({
81
91
  ElCollapse,
82
92
  FormItemWidget: script$5
83
93
  },
94
+ props: {
95
+ componentLibCollapseExpanded: {
96
+ type: Array,
97
+ default: () => [
98
+ ComponentsType.container,
99
+ ComponentsType.formItems
100
+ ]
101
+ }
102
+ },
103
+ emits: {
104
+ "update:componentLibCollapseExpanded": null
105
+ },
84
106
  setup() {
85
- const widgetTab = ref(0 /* components */);
86
- const componentsType = ref([
87
- ComponentsType.container,
88
- ComponentsType.formItems
89
- ]);
107
+ const widgetTab = ref("components" /* components */);
90
108
  return {
91
109
  WidgetTab,
92
110
  ComponentsType,
93
- widgetTab,
94
- componentsType
111
+ widgetTab
95
112
  };
96
113
  }
97
114
  });
98
115
 
99
- const _hoisted_1$4 = /* @__PURE__ */ createTextVNode(" \u7EC4\u4EF6\u5E93 ");
100
- const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u6A21\u677F\u5E93 ");
116
+ const _hoisted_1$5 = /* @__PURE__ */ createTextVNode(" \u7EC4\u4EF6\u5E93 ");
117
+ const _hoisted_2$4 = /* @__PURE__ */ createTextVNode(" \u6A21\u677F\u5E93 ");
101
118
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
102
119
  const _component_VkTabItem = resolveComponent("VkTabItem");
103
120
  const _component_VkFloatBlock = resolveComponent("VkFloatBlock");
@@ -115,18 +132,20 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
115
132
  }, {
116
133
  default: withCtx(() => [
117
134
  createVNode(_component_VkTabItem, {
118
- name: _ctx.WidgetTab.components
135
+ name: _ctx.WidgetTab.components,
136
+ clearable: false
119
137
  }, {
120
138
  default: withCtx(() => [
121
- _hoisted_1$4
139
+ _hoisted_1$5
122
140
  ]),
123
141
  _: 1
124
142
  }, 8, ["name"]),
125
143
  createVNode(_component_VkTabItem, {
126
- name: _ctx.WidgetTab.templates
144
+ name: _ctx.WidgetTab.templates,
145
+ clearable: false
127
146
  }, {
128
147
  default: withCtx(() => [
129
- _hoisted_2$2
148
+ _hoisted_2$4
130
149
  ]),
131
150
  _: 1
132
151
  }, 8, ["name"]),
@@ -139,23 +158,24 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
139
158
  createVNode(_component_ElScrollbar, null, {
140
159
  default: withCtx(() => [
141
160
  withDirectives(createVNode(_component_ElCollapse, {
142
- modelValue: _ctx.componentsType,
143
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.componentsType = $event)
161
+ modelValue: _ctx.componentLibCollapseExpanded,
162
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:componentLibCollapseExpanded", $event))
144
163
  }, {
145
164
  default: withCtx(() => [
146
165
  createVNode(_component_FormItemWidget, {
147
166
  name: _ctx.ComponentsType.formItems
148
- }, null, 8, ["name"])
167
+ }, null, 8, ["name"]),
168
+ renderSlot(_ctx.$slots, "componentLibCollapse")
149
169
  ]),
150
- _: 1
170
+ _: 3
151
171
  }, 8, ["modelValue"]), [
152
172
  [vShow, _ctx.widgetTab === _ctx.WidgetTab.components]
153
173
  ])
154
174
  ]),
155
- _: 1
175
+ _: 3
156
176
  })
157
177
  ]),
158
- _: 1
178
+ _: 3
159
179
  });
160
180
  }
161
181
 
@@ -170,6 +190,25 @@ var _export_sfc = (sfc, props) => {
170
190
  return target;
171
191
  };
172
192
 
193
+ const _sfc_main$1 = defineComponent({
194
+ name: "Delete"
195
+ });
196
+ const _hoisted_1$4 = {
197
+ viewBox: "0 0 1024 1024",
198
+ xmlns: "http://www.w3.org/2000/svg"
199
+ };
200
+ const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("path", {
201
+ fill: "currentColor",
202
+ d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
203
+ }, null, -1);
204
+ const _hoisted_3$2 = [
205
+ _hoisted_2$3
206
+ ];
207
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
208
+ return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_3$2);
209
+ }
210
+ var _delete = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
211
+
173
212
  const _sfc_main = defineComponent({
174
213
  name: "Sort"
175
214
  });
@@ -177,12 +216,12 @@ const _hoisted_1$3 = {
177
216
  viewBox: "0 0 1024 1024",
178
217
  xmlns: "http://www.w3.org/2000/svg"
179
218
  };
180
- const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", {
219
+ const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("path", {
181
220
  fill: "currentColor",
182
221
  d: "M384 96a32 32 0 0 1 64 0v786.752a32 32 0 0 1-54.592 22.656L95.936 608a32 32 0 0 1 0-45.312h.128a32 32 0 0 1 45.184 0L384 805.632V96zm192 45.248a32 32 0 0 1 54.592-22.592L928.064 416a32 32 0 0 1 0 45.312h-.128a32 32 0 0 1-45.184 0L640 218.496V928a32 32 0 1 1-64 0V141.248z"
183
222
  }, null, -1);
184
223
  const _hoisted_3$1 = [
185
- _hoisted_2$1
224
+ _hoisted_2$2
186
225
  ];
187
226
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
188
227
  return openBlock(), createElementBlock("svg", _hoisted_1$3, _hoisted_3$1);
@@ -198,45 +237,49 @@ var script$3 = defineComponent({
198
237
  source: {
199
238
  type: Object,
200
239
  default: () => ({})
240
+ },
241
+ attributes: {
242
+ type: Object,
243
+ default: () => ({ k: [] })
201
244
  }
202
245
  },
246
+ emits: {
247
+ drop: (e, c, data) => e || c || data,
248
+ del: (e) => e
249
+ },
203
250
  components: {
204
251
  VkBoxHandler,
205
252
  ElIcon,
206
253
  Sort: sort,
254
+ Delete: _delete,
207
255
  VkfDragWrapper,
208
256
  VkfDropWrapper
209
- },
210
- setup() {
211
- const dragover = (e) => {
212
- };
213
- const drop = (e) => {
214
- };
215
- return {
216
- dragover,
217
- drop
218
- };
219
257
  }
220
258
  });
221
259
 
222
260
  const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u62D6\u52A8\u5355\u5143 ");
261
+ const _hoisted_2$1 = { class: "vkf-gmew-tools vkf-gmew-rb-x" };
223
262
  function render$3(_ctx, _cache, $props, $setup, $data, $options) {
224
263
  const _component_Sort = resolveComponent("Sort");
225
264
  const _component_el_icon = resolveComponent("el-icon");
226
265
  const _component_VkfDragWrapper = resolveComponent("VkfDragWrapper");
227
266
  const _component_VkBoxHandler = resolveComponent("VkBoxHandler");
267
+ const _component_Delete = resolveComponent("Delete");
228
268
  const _component_VkfDropWrapper = resolveComponent("VkfDropWrapper");
229
269
  return openBlock(), createBlock(_component_VkfDropWrapper, {
230
- onDragover: withModifiers(_ctx.dragover, ["stop"]),
270
+ onDrop: _cache[1] || (_cache[1] = (...arg) => _ctx.$emit("drop", ...arg, {
271
+ attributes: _ctx.attributes,
272
+ source: _ctx.source
273
+ })),
231
274
  class: "vkf-ground-main-editing-wrapper"
232
275
  }, {
233
276
  default: withCtx(() => [
234
277
  withDirectives(createVNode(_component_VkBoxHandler, null, {
235
278
  default: withCtx(() => [
236
279
  createVNode(_component_VkfDragWrapper, {
237
- title: JSON.stringify(_ctx.source),
238
- data: JSON.stringify(_ctx.source),
239
- class: "vkf-gmew-drag-wrapper"
280
+ title: JSON.stringify({ source: _ctx.source, attributes: _ctx.attributes }),
281
+ data: JSON.stringify({ source: _ctx.source, attributes: _ctx.attributes }),
282
+ class: "vkf-gmew-drag-wrapper vkf-gmew-tools"
240
283
  }, {
241
284
  default: withCtx(() => [
242
285
  createVNode(_component_el_icon, null, {
@@ -254,10 +297,22 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
254
297
  }, 512), [
255
298
  [vShow, _ctx.active]
256
299
  ]),
300
+ withDirectives(createElementVNode("div", _hoisted_2$1, [
301
+ createVNode(_component_el_icon, {
302
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("del", { k: _ctx.attributes.k }))
303
+ }, {
304
+ default: withCtx(() => [
305
+ createVNode(_component_Delete)
306
+ ]),
307
+ _: 1
308
+ })
309
+ ], 512), [
310
+ [vShow, _ctx.active]
311
+ ]),
257
312
  renderSlot(_ctx.$slots, "default")
258
313
  ]),
259
314
  _: 3
260
- }, 8, ["onDragover"]);
315
+ });
261
316
  }
262
317
 
263
318
  script$3.render = render$3;
@@ -549,7 +604,12 @@ function uniqueId(prefix) {
549
604
  return toString(prefix) + id;
550
605
  }
551
606
 
552
- const createDefaultSlots = _VkfFormUtils._VkfFormItemRendererUtils.createDefaultSlots;
607
+ const createDefaultSlots = (e) => _VkfFormUtils._VkfFormItemRendererUtils.createDefaultSlots(e);
608
+ const addDefaultProp = (source) => {
609
+ if ("prop" in source) {
610
+ source.prop ||= uniqueId("from_widget_");
611
+ }
612
+ };
553
613
  var script$2 = defineComponent({
554
614
  components: {
555
615
  VkfDropWrapper,
@@ -567,12 +627,16 @@ var script$2 = defineComponent({
567
627
  prop: {
568
628
  type: String,
569
629
  default: ""
630
+ },
631
+ k: {
632
+ type: Array,
633
+ default: () => []
570
634
  }
571
635
  },
572
636
  emits: {
573
637
  "update:prop": (e) => e,
574
- setFormItems: null,
575
- unsetFormItems: null
638
+ "setData:formItems": null,
639
+ "unsetData:formItems": null
576
640
  },
577
641
  setup(props, { emit }) {
578
642
  const formData = ref({});
@@ -608,32 +672,82 @@ var script$2 = defineComponent({
608
672
  return;
609
673
  groundEndClassName.value = DragoverClasses.normal;
610
674
  const data = JSON.parse(e.dataTransfer.getData("text"));
611
- data.prop ||= uniqueId("from_widget_");
612
- if (data.templateType === "VkfEditingSelect") {
675
+ const source = data?.source;
676
+ if (!source)
677
+ return;
678
+ addDefaultProp(source);
679
+ if (source.templateType === "VkfEditingSelect") {
613
680
  const currentLength = props.formItems.length;
614
- data.templateSlots.default.forEach((v, i) => {
615
- emit("setFormItems", {
681
+ source.templateSlots.default.forEach((v, i) => {
682
+ emit("setData:formItems", {
616
683
  k: currentLength + i,
617
684
  v
618
685
  });
619
686
  });
620
- emit("unsetFormItems", {
621
- k: data.index
687
+ emit("unsetData:formItems", {
688
+ k: source.index
622
689
  });
623
690
  } else {
624
- emit("setFormItems", {
691
+ emit("setData:formItems", {
625
692
  k: props.formItems.length,
626
- v: data
693
+ v: source
627
694
  });
628
- emit("update:prop", data.prop);
695
+ emit("update:prop", source.prop);
629
696
  }
630
697
  }
631
- function editDrop(e) {
698
+ function editDrop(e, overClass, toData) {
699
+ e.stopPropagation();
632
700
  e.preventDefault();
633
701
  if (!e.dataTransfer)
634
702
  return;
635
- const data = JSON.parse(e.dataTransfer.getData("text"));
636
- console.log(data);
703
+ const fromData = JSON.parse(e.dataTransfer.getData("text"));
704
+ const fromSource = fromData?.source;
705
+ if (!fromSource)
706
+ return;
707
+ const fromK = fromData.attributes?.k ?? [];
708
+ let toK = toData.attributes.k;
709
+ let tkl = toK.at(-1);
710
+ if (typeof tkl === "number" && overClass === DragoverClasses["is-dragover-next"]) {
711
+ tkl++;
712
+ }
713
+ let itemSource = fromSource;
714
+ if (fromSource.templateType === "VkfEditingSelect") {
715
+ itemSource = fromSource.templateSlots.default[0];
716
+ }
717
+ if (!fromK.length) {
718
+ addDefaultProp(itemSource);
719
+ emit("setData:formItems", {
720
+ k: toK.map((v, index) => index === toK.length - 1 ? tkl : v),
721
+ v: itemSource,
722
+ insert: true
723
+ });
724
+ itemSource.prop && emit("update:prop", itemSource.prop);
725
+ return;
726
+ }
727
+ if (fromK.length === toK.length) {
728
+ const fkl = fromK.at(-1);
729
+ if (typeof fkl === "number" && typeof tkl === "number") {
730
+ if (overClass === DragoverClasses["is-dragover-prev"]) {
731
+ if (fkl + 1 === tkl)
732
+ return;
733
+ }
734
+ if (overClass === DragoverClasses["is-dragover-prev"]) {
735
+ if (tkl === fkl)
736
+ return;
737
+ }
738
+ emit("unsetData:formItems", {
739
+ k: fkl
740
+ });
741
+ if (fkl < tkl) {
742
+ tkl--;
743
+ }
744
+ emit("setData:formItems", {
745
+ k: tkl,
746
+ v: itemSource,
747
+ insert: true
748
+ });
749
+ }
750
+ }
637
751
  }
638
752
  return {
639
753
  groundEndClassName,
@@ -669,17 +783,17 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
669
783
  createCommentVNode(" \u5C06formItems\u6E32\u67D3 \u4E3A\u7F16\u8F91\u65F6\u7EC4\u4EF6 "),
670
784
  createVNode(_component_VkTabGroup, {
671
785
  modelValue: _ctx.prop,
672
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:prop", $event))
786
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:prop", $event))
673
787
  }, {
674
788
  default: withCtx(() => [
675
789
  createVNode(_component_VkfForm, {
676
790
  formItems: _ctx.formItemsWithWrapper,
677
791
  data: _ctx.formData,
678
- onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.setData(_ctx.formData, $event))
792
+ onSetData: _cache[1] || (_cache[1] = ($event) => _ctx.setData(_ctx.formData, $event))
679
793
  }, {
680
794
  rendererTemplate: withCtx(() => [
681
795
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfEditingSelect" }, {
682
- default: withCtx(({ data, Renderer, raw }) => [
796
+ default: withCtx(({ data, Renderer, raw, k }) => [
683
797
  createCommentVNode(" name is prop "),
684
798
  createVNode(_component_VkTabItem, {
685
799
  name: data.name,
@@ -687,11 +801,14 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
687
801
  class: "vkf-gm-form-item-x"
688
802
  }, {
689
803
  default: withCtx(({ isActive }) => [
690
- createCommentVNode(" \u62D6\u52A8\u65F6 \u6839\u636E source \u548C data.index "),
804
+ createCommentVNode(" \u62D6\u52A8\u65F6 \u6839\u636E source \u548C attributes\u786E\u5B9A\u4F4D\u7F6E "),
805
+ createCommentVNode(" [?] \u4E3A\u4EC0\u4E48\u5220\u9664\u4E86\u4E00\u4E2A\u6570\u636E\u540E\uFF0C\u5F53\u524D\u7684prop\u53D1\u751F\u4E86\u6539\u53D8\u3002 \u53EF\u80FD\u662F\u56E0\u4E3A\u6709\u4E2A isActive \u662F true \u88AB\u4F20\u8FDB\u53BB\u4E86 \uFF1F "),
691
806
  createVNode(_component_EditingWrapper, {
692
- onDrop: withModifiers(_ctx.editDrop, ["stop"]),
807
+ onDrop: _ctx.editDrop,
808
+ attributes: { k },
693
809
  active: isActive,
694
- source: raw
810
+ source: raw,
811
+ onDel: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("unsetData:formItems", $event))
695
812
  }, {
696
813
  default: withCtx(() => [
697
814
  (openBlock(), createBlock(resolveDynamicComponent(Renderer), {
@@ -699,7 +816,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
699
816
  }, null, 8, ["source"]))
700
817
  ]),
701
818
  _: 2
702
- }, 1032, ["onDrop", "active", "source"])
819
+ }, 1032, ["onDrop", "attributes", "active", "source"])
703
820
  ]),
704
821
  _: 2
705
822
  }, 1032, ["name"])
@@ -746,15 +863,9 @@ var script$1 = defineComponent({
746
863
  setup(props, { emit }) {
747
864
  const configProps = _VkfConfigCtx.createBindProps(props, ["source"]);
748
865
  const configEmits = _VkfConfigCtx.createOnEmits(emit);
749
- const typeToConfigSource = {
750
- "VkfInput": {
751
- templateType: "VkfInput",
752
- propDisabled: false
753
- }
754
- };
755
866
  const source = computed(() => {
756
867
  return {
757
- ...typeToConfigSource[props.templateType],
868
+ templateType: props.templateType,
758
869
  propDisabled: props.propDisabled
759
870
  };
760
871
  });
@@ -777,18 +888,173 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
777
888
  return openBlock(), createBlock(_component_VkfConfig, mergeProps({
778
889
  source: _ctx.source,
779
890
  "onSetData:source": _ctx.setSource
780
- }, _ctx.configProps, toHandlers(_ctx.configEmits)), null, 16, ["source", "onSetData:source"]);
891
+ }, _ctx.configProps, toHandlers(_ctx.configEmits)), {
892
+ rendererTemplate: withCtx(() => [
893
+ renderSlot(_ctx.$slots, "rendererTemplate")
894
+ ]),
895
+ _: 3
896
+ }, 16, ["source", "onSetData:source"]);
781
897
  }
782
898
 
783
899
  script$1.render = render$1;
784
900
  script$1.__file = "ground/src/ground-config/src/index.vue";
785
901
 
902
+ function tryOnScopeDispose(fn) {
903
+ if (getCurrentScope()) {
904
+ onScopeDispose(fn);
905
+ return true;
906
+ }
907
+ return false;
908
+ }
909
+
910
+ const isClient = typeof window !== "undefined";
911
+ const isString = (val) => typeof val === "string";
912
+ const noop = () => {
913
+ };
914
+
915
+ function useTimeoutFn(cb, interval, options = {}) {
916
+ const {
917
+ immediate = true
918
+ } = options;
919
+ const isPending = ref(false);
920
+ let timer = null;
921
+ function clear() {
922
+ if (timer) {
923
+ clearTimeout(timer);
924
+ timer = null;
925
+ }
926
+ }
927
+ function stop() {
928
+ isPending.value = false;
929
+ clear();
930
+ }
931
+ function start(...args) {
932
+ clear();
933
+ isPending.value = true;
934
+ timer = setTimeout(() => {
935
+ isPending.value = false;
936
+ timer = null;
937
+ cb(...args);
938
+ }, unref(interval));
939
+ }
940
+ if (immediate) {
941
+ isPending.value = true;
942
+ if (isClient)
943
+ start();
944
+ }
945
+ tryOnScopeDispose(stop);
946
+ return {
947
+ isPending,
948
+ start,
949
+ stop
950
+ };
951
+ }
952
+
953
+ function unrefElement(elRef) {
954
+ var _a;
955
+ const plain = unref(elRef);
956
+ return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
957
+ }
958
+
959
+ const defaultWindow = isClient ? window : void 0;
960
+ isClient ? window.document : void 0;
961
+ const defaultNavigator = isClient ? window.navigator : void 0;
962
+ isClient ? window.location : void 0;
963
+
964
+ function useEventListener(...args) {
965
+ let target;
966
+ let event;
967
+ let listener;
968
+ let options;
969
+ if (isString(args[0])) {
970
+ [event, listener, options] = args;
971
+ target = defaultWindow;
972
+ } else {
973
+ [target, event, listener, options] = args;
974
+ }
975
+ if (!target)
976
+ return noop;
977
+ let cleanup = noop;
978
+ const stopWatch = watch(() => unrefElement(target), (el) => {
979
+ cleanup();
980
+ if (!el)
981
+ return;
982
+ el.addEventListener(event, listener, options);
983
+ cleanup = () => {
984
+ el.removeEventListener(event, listener, options);
985
+ cleanup = noop;
986
+ };
987
+ }, { immediate: true, flush: "post" });
988
+ const stop = () => {
989
+ stopWatch();
990
+ cleanup();
991
+ };
992
+ tryOnScopeDispose(stop);
993
+ return stop;
994
+ }
995
+
996
+ function useClipboard(options = {}) {
997
+ const {
998
+ navigator = defaultNavigator,
999
+ read = false,
1000
+ source,
1001
+ copiedDuring = 1500
1002
+ } = options;
1003
+ const events = ["copy", "cut"];
1004
+ const isSupported = Boolean(navigator && "clipboard" in navigator);
1005
+ const text = ref("");
1006
+ const copied = ref(false);
1007
+ const timeout = useTimeoutFn(() => copied.value = false, copiedDuring);
1008
+ function updateText() {
1009
+ navigator.clipboard.readText().then((value) => {
1010
+ text.value = value;
1011
+ });
1012
+ }
1013
+ if (isSupported && read) {
1014
+ for (const event of events)
1015
+ useEventListener(event, updateText);
1016
+ }
1017
+ async function copy(value = unref(source)) {
1018
+ if (isSupported && value != null) {
1019
+ await navigator.clipboard.writeText(value);
1020
+ text.value = value;
1021
+ copied.value = true;
1022
+ timeout.start();
1023
+ }
1024
+ }
1025
+ return {
1026
+ isSupported,
1027
+ text,
1028
+ copied,
1029
+ copy
1030
+ };
1031
+ }
1032
+
1033
+ const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1034
+ const globalKey = "__vueuse_ssr_handlers__";
1035
+ _global[globalKey] = _global[globalKey] || {};
1036
+ _global[globalKey];
1037
+
1038
+ var _a, _b;
1039
+ isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
1040
+
786
1041
  var script = defineComponent({
787
1042
  name: "VkfGround",
788
1043
  components: {
789
1044
  VkfGroundWidget: script$4,
790
1045
  VkfGroundMain: script$2,
791
- VkfGroundConfig: script$1
1046
+ VkfGroundConfig: script$1,
1047
+ VkCard,
1048
+ ElButton
1049
+ },
1050
+ props: {
1051
+ componentLibCollapseExpanded: {
1052
+ type: Array,
1053
+ default: void 0
1054
+ }
1055
+ },
1056
+ emits: {
1057
+ "update:componentLibCollapseExpanded": null
792
1058
  },
793
1059
  setup(props, { emit }) {
794
1060
  const formItems = ref([]);
@@ -801,7 +1067,7 @@ var script = defineComponent({
801
1067
  return a;
802
1068
  }, {});
803
1069
  });
804
- const configPropDisabled = ref(false);
1070
+ const configPropDisabled = ref(true);
805
1071
  const setFormItem = (props2, e) => {
806
1072
  if (e.k === "prop") {
807
1073
  if (e.v === props2.prop) {
@@ -812,6 +1078,11 @@ var script = defineComponent({
812
1078
  type: "warning",
813
1079
  message: "\u5B58\u5728\u76F8\u540C\u7684prop, \u8BF7\u91CD\u65B0\u4FEE\u6539"
814
1080
  });
1081
+ } else if (!e.v) {
1082
+ ElMessage({
1083
+ type: "warning",
1084
+ message: "prop\u4E0D\u80FD\u4E3A\u7A7A"
1085
+ });
815
1086
  } else {
816
1087
  props2.prop = e.v;
817
1088
  editProp.value = e.v;
@@ -822,6 +1093,30 @@ var script = defineComponent({
822
1093
  setData(props2, e);
823
1094
  }
824
1095
  };
1096
+ const formItemStr = computed(() => JSON.stringify(formItems.value));
1097
+ const formItemClip = useClipboard({
1098
+ source: formItemStr
1099
+ });
1100
+ const inputJson = () => {
1101
+ ElMessageBox.prompt("\u8F93\u5165Json", "\u63D0\u793A", {
1102
+ confirmButtonText: "\u786E\u8BA4",
1103
+ cancelButtonText: "\u53D6\u6D88"
1104
+ }).then(({ value }) => {
1105
+ let obj = [];
1106
+ try {
1107
+ obj = JSON.parse(value);
1108
+ } catch (err) {
1109
+ ElMessage({
1110
+ type: "error",
1111
+ message: "Json\u89E3\u6790\u9519\u8BEF"
1112
+ });
1113
+ throw err;
1114
+ }
1115
+ return obj;
1116
+ }).then((obj) => {
1117
+ formItems.value = obj;
1118
+ });
1119
+ };
825
1120
  return {
826
1121
  propToFormItem,
827
1122
  formItems,
@@ -829,42 +1124,83 @@ var script = defineComponent({
829
1124
  setData,
830
1125
  unsetData,
831
1126
  setFormItem,
832
- configPropDisabled
1127
+ configPropDisabled,
1128
+ formItemClip,
1129
+ inputJson
833
1130
  };
834
1131
  }
835
1132
  });
836
1133
 
837
1134
  const _hoisted_1 = { class: "vkf-ground" };
838
1135
  const _hoisted_2 = { class: "vkf-ground-main-x" };
839
- const _hoisted_3 = { class: "vkf-ground-config-x" };
1136
+ const _hoisted_3 = { key: 0 };
1137
+ const _hoisted_4 = { key: 1 };
1138
+ const _hoisted_5 = /* @__PURE__ */ createTextVNode(" \u5BFC\u5165Json ");
1139
+ const _hoisted_6 = { class: "vkf-ground-config-x" };
840
1140
  function render(_ctx, _cache, $props, $setup, $data, $options) {
841
1141
  const _component_VkfGroundWidget = resolveComponent("VkfGroundWidget");
1142
+ const _component_ElButton = resolveComponent("ElButton");
842
1143
  const _component_VkfGroundMain = resolveComponent("VkfGroundMain");
1144
+ const _component_VkCard = resolveComponent("VkCard");
843
1145
  const _component_VkfGroundConfig = resolveComponent("VkfGroundConfig");
844
1146
  return openBlock(), createElementBlock("div", _hoisted_1, [
845
- createVNode(_component_VkfGroundWidget, { class: "vkf-ground-widget-x" }),
1147
+ createVNode(_component_VkfGroundWidget, {
1148
+ class: "vkf-ground-widget-x",
1149
+ componentLibCollapseExpanded: _ctx.componentLibCollapseExpanded,
1150
+ "onUpdate:componentLibCollapseExpanded": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:componentLibCollapseExpanded", $event))
1151
+ }, {
1152
+ componentLibCollapse: withCtx(() => [
1153
+ renderSlot(_ctx.$slots, "widgetComponentLibCollapse")
1154
+ ]),
1155
+ _: 3
1156
+ }, 8, ["componentLibCollapseExpanded"]),
846
1157
  createElementVNode("div", _hoisted_2, [
847
- createCommentVNode(" {{ formItems }} "),
848
- createVNode(_component_VkfGroundMain, {
849
- prop: _ctx.editProp,
850
- "onUpdate:prop": [
851
- _cache[0] || (_cache[0] = ($event) => _ctx.editProp = $event),
852
- _cache[1] || (_cache[1] = ($event) => _ctx.configPropDisabled = false)
853
- ],
854
- formItems: _ctx.formItems,
855
- onSetFormItems: _cache[2] || (_cache[2] = ($event) => _ctx.setData(_ctx.formItems, $event)),
856
- onUnsetFormItems: _cache[3] || (_cache[3] = ($event) => _ctx.unsetData(_ctx.formItems, $event))
857
- }, null, 8, ["prop", "formItems"])
1158
+ createVNode(_component_VkCard, {
1159
+ tag: "div",
1160
+ class: "vkf-ground-main-card"
1161
+ }, {
1162
+ title: withCtx(() => [
1163
+ createVNode(_component_ElButton, {
1164
+ onClick: _cache[1] || (_cache[1] = () => _ctx.formItemClip.copy())
1165
+ }, {
1166
+ default: withCtx(() => [
1167
+ !_ctx.formItemClip.copied.value ? (openBlock(), createElementBlock("span", _hoisted_3, "\u590D\u5236Json")) : (openBlock(), createElementBlock("span", _hoisted_4, "\u5DF2\u590D\u5236!"))
1168
+ ]),
1169
+ _: 1
1170
+ }),
1171
+ createVNode(_component_ElButton, { onClick: _ctx.inputJson }, {
1172
+ default: withCtx(() => [
1173
+ _hoisted_5
1174
+ ]),
1175
+ _: 1
1176
+ }, 8, ["onClick"])
1177
+ ]),
1178
+ default: withCtx(() => [
1179
+ createVNode(_component_VkfGroundMain, {
1180
+ prop: _ctx.editProp,
1181
+ "onUpdate:prop": _cache[2] || (_cache[2] = ($event) => _ctx.editProp = $event),
1182
+ formItems: _ctx.formItems,
1183
+ "onSetData:formItems": _cache[3] || (_cache[3] = ($event) => _ctx.setData(_ctx.formItems, $event)),
1184
+ "onUnsetData:formItems": _cache[4] || (_cache[4] = ($event) => _ctx.unsetData(_ctx.formItems, $event))
1185
+ }, null, 8, ["prop", "formItems"])
1186
+ ]),
1187
+ _: 1
1188
+ })
858
1189
  ]),
859
- createElementVNode("div", _hoisted_3, [
1190
+ createElementVNode("div", _hoisted_6, [
860
1191
  _ctx.editProp && _ctx.propToFormItem[_ctx.editProp] ? (openBlock(), createBlock(_component_VkfGroundConfig, {
861
1192
  key: 0,
862
1193
  propDisabled: _ctx.configPropDisabled,
863
- "onUpdate:propDisabled": _cache[4] || (_cache[4] = ($event) => _ctx.configPropDisabled = $event),
1194
+ "onUpdate:propDisabled": _cache[5] || (_cache[5] = ($event) => _ctx.configPropDisabled = $event),
864
1195
  templateType: _ctx.propToFormItem[_ctx.editProp].templateType,
865
1196
  data: _ctx.propToFormItem[_ctx.editProp],
866
- onSetData: _cache[5] || (_cache[5] = ($event) => _ctx.setFormItem(_ctx.propToFormItem[_ctx.editProp], $event))
867
- }, null, 8, ["propDisabled", "templateType", "data"])) : createCommentVNode("v-if", true)
1197
+ onSetData: _cache[6] || (_cache[6] = ($event) => _ctx.setFormItem(_ctx.propToFormItem[_ctx.editProp], $event))
1198
+ }, {
1199
+ rendererTemplate: withCtx(() => [
1200
+ renderSlot(_ctx.$slots, "configRendererTemplate")
1201
+ ]),
1202
+ _: 3
1203
+ }, 8, ["propDisabled", "templateType", "data"])) : createCommentVNode("v-if", true)
868
1204
  ])
869
1205
  ]);
870
1206
  }