@king-one/form-design 0.0.28 → 0.0.29
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/CHANGELOG.md +6 -0
- package/dist/es/index.mjs +10 -8
- package/dist/es/src/components/form-material.vue.mjs +44 -49
- package/dist/es/src/components/panel/widget/grid.vue2.mjs +1 -1
- package/dist/es/src/components/props/widget/GridProps.vue2.mjs +15 -20
- package/dist/es/src/config/index.mjs +197 -149
- package/dist/es/src/core/FormSchema.mjs +14 -61
- package/dist/es/src/index.mjs +15 -14
- package/dist/es/src/plugins/modules/drag-add.mjs +1 -1
- package/dist/es/src/utils/index.mjs +15 -13
- package/dist/es/src/utils/schema.mjs +29 -0
- package/dist/lib/index.js +1 -1
- package/dist/lib/src/components/form-material.vue.js +1 -1
- package/dist/lib/src/components/panel/widget/grid.vue2.js +1 -1
- package/dist/lib/src/components/props/widget/GridProps.vue2.js +1 -1
- package/dist/lib/src/config/index.js +1 -15
- package/dist/lib/src/core/FormSchema.js +1 -1
- package/dist/lib/src/index.js +1 -1
- package/dist/lib/src/plugins/modules/drag-add.js +1 -1
- package/dist/lib/src/utils/index.js +1 -1
- package/dist/lib/src/utils/schema.js +1 -0
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/types/src/core/Design.d.ts +522 -187
- package/dist/types/src/core/FormSchema.d.ts +235 -64
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/types.d.ts +34 -30
- package/dist/types/src/utils/index.d.ts +1 -0
- package/dist/types/src/utils/schema.d.ts +2 -0
- package/package.json +1 -1
|
@@ -12,10 +12,6 @@ const o = {
|
|
|
12
12
|
"x-component-props": {
|
|
13
13
|
gutter: 20
|
|
14
14
|
},
|
|
15
|
-
"x-design-props": {
|
|
16
|
-
"convert-key": "properties",
|
|
17
|
-
"convert-type": "base"
|
|
18
|
-
},
|
|
19
15
|
"x-decorator": "Void"
|
|
20
16
|
}
|
|
21
17
|
]
|
|
@@ -117,17 +113,27 @@ const o = {
|
|
|
117
113
|
type: e.object,
|
|
118
114
|
icon: "form-area",
|
|
119
115
|
"x-component": "FormArea",
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
type: e.string
|
|
123
|
-
|
|
124
|
-
city: {
|
|
125
|
-
type: e.string
|
|
116
|
+
children: [
|
|
117
|
+
{
|
|
118
|
+
type: e.string,
|
|
119
|
+
name: "province"
|
|
126
120
|
},
|
|
127
|
-
|
|
128
|
-
type: e.string
|
|
121
|
+
{
|
|
122
|
+
type: e.string,
|
|
123
|
+
name: "city"
|
|
129
124
|
}
|
|
130
|
-
|
|
125
|
+
]
|
|
126
|
+
// 'properties': {
|
|
127
|
+
// province: {
|
|
128
|
+
// type: valueTypeMap.string
|
|
129
|
+
// },
|
|
130
|
+
// city: {
|
|
131
|
+
// type: valueTypeMap.string
|
|
132
|
+
// },
|
|
133
|
+
// county: {
|
|
134
|
+
// type: valueTypeMap.string
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
131
137
|
}
|
|
132
138
|
]
|
|
133
139
|
}, a = {
|
|
@@ -139,11 +145,7 @@ const o = {
|
|
|
139
145
|
key: "k-object",
|
|
140
146
|
type: e.object,
|
|
141
147
|
icon: "form-object",
|
|
142
|
-
children: []
|
|
143
|
-
"x-design-props": {
|
|
144
|
-
"convert-key": "properties",
|
|
145
|
-
"convert-type": "base"
|
|
146
|
-
}
|
|
148
|
+
children: []
|
|
147
149
|
},
|
|
148
150
|
{
|
|
149
151
|
title: "列表容器",
|
|
@@ -152,11 +154,7 @@ const o = {
|
|
|
152
154
|
icon: "form-list",
|
|
153
155
|
children: [],
|
|
154
156
|
"x-component": "ArrayCard",
|
|
155
|
-
"x-decorator": "Void"
|
|
156
|
-
"x-design-props": {
|
|
157
|
-
"convert-key": "items",
|
|
158
|
-
"convert-type": "object"
|
|
159
|
-
}
|
|
157
|
+
"x-decorator": "Void"
|
|
160
158
|
},
|
|
161
159
|
{
|
|
162
160
|
title: "明细表",
|
|
@@ -164,12 +162,9 @@ const o = {
|
|
|
164
162
|
type: e.array,
|
|
165
163
|
icon: "form-table",
|
|
166
164
|
"x-component": "ArrayTable",
|
|
165
|
+
children: [],
|
|
167
166
|
"x-decorator-props": {
|
|
168
167
|
labelAlign: "top"
|
|
169
|
-
},
|
|
170
|
-
"x-design-props": {
|
|
171
|
-
"convert-key": "items",
|
|
172
|
-
"convert-type": "object"
|
|
173
168
|
}
|
|
174
169
|
}
|
|
175
170
|
]
|
|
@@ -190,67 +185,35 @@ const o = {
|
|
|
190
185
|
message: ""
|
|
191
186
|
}
|
|
192
187
|
},
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
children: [
|
|
189
|
+
{
|
|
195
190
|
type: e.array,
|
|
191
|
+
name: "details",
|
|
196
192
|
title: "加班明细",
|
|
197
193
|
"x-component": "ArrayCard",
|
|
198
194
|
"x-decorator": "Void",
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
type: e.
|
|
205
|
-
|
|
206
|
-
format: "date",
|
|
207
|
-
items: {
|
|
208
|
-
type: e.string,
|
|
209
|
-
format: "date"
|
|
210
|
-
},
|
|
211
|
-
name: "date",
|
|
212
|
-
"x-component": "DateRange",
|
|
213
|
-
"x-component-props": {
|
|
214
|
-
valueFormat: "YYYY-MM-DD HH:mm:ss",
|
|
215
|
-
showTime: !0,
|
|
216
|
-
placeholder: [
|
|
217
|
-
"开始日期",
|
|
218
|
-
"结束日期"
|
|
219
|
-
]
|
|
220
|
-
}
|
|
195
|
+
children: [
|
|
196
|
+
{
|
|
197
|
+
type: e.array,
|
|
198
|
+
title: "加班日期",
|
|
199
|
+
items: {
|
|
200
|
+
type: e.string,
|
|
201
|
+
format: "date"
|
|
221
202
|
},
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
"x-validator": [
|
|
231
|
-
{
|
|
232
|
-
validator: `{{const sourceValue = $parent.date
|
|
233
|
-
if (!sourceValue || !sourceValue.length) {
|
|
234
|
-
return true
|
|
235
|
-
}else{
|
|
236
|
-
const [start, end] = sourceValue
|
|
237
|
-
const s = new Date(start)
|
|
238
|
-
const e = new Date(end)
|
|
239
|
-
const hoursDiff = Math.abs(e - s) / (1000 * 60 * 60)
|
|
240
|
-
const actualHours = Math.round(hoursDiff * 100) / 100
|
|
241
|
-
if ( $value> actualHours) {
|
|
242
|
-
return new Error(\`不得超过\${actualHours}小时\`)
|
|
243
|
-
}
|
|
244
|
-
return true
|
|
245
|
-
}
|
|
246
|
-
}}`
|
|
247
|
-
}
|
|
203
|
+
name: "date",
|
|
204
|
+
"x-component": "DateRange",
|
|
205
|
+
"x-component-props": {
|
|
206
|
+
valueFormat: "YYYY-MM-DD HH:mm:ss",
|
|
207
|
+
showTime: !0,
|
|
208
|
+
placeholder: [
|
|
209
|
+
"开始日期",
|
|
210
|
+
"结束日期"
|
|
248
211
|
]
|
|
249
212
|
}
|
|
250
213
|
}
|
|
251
|
-
|
|
214
|
+
]
|
|
252
215
|
},
|
|
253
|
-
|
|
216
|
+
{
|
|
254
217
|
type: e.number,
|
|
255
218
|
title: "总时长",
|
|
256
219
|
name: "total",
|
|
@@ -274,78 +237,163 @@ const o = {
|
|
|
274
237
|
}
|
|
275
238
|
}
|
|
276
239
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
240
|
+
]
|
|
241
|
+
// 'properties': {
|
|
242
|
+
// details: {
|
|
243
|
+
// 'type': valueTypeMap.array,
|
|
244
|
+
// 'title': '加班明细',
|
|
245
|
+
// 'x-component': 'ArrayCard',
|
|
246
|
+
// 'x-decorator': 'Void',
|
|
247
|
+
// 'name': 'details',
|
|
248
|
+
// 'items': {
|
|
249
|
+
// type: valueTypeMap.object,
|
|
250
|
+
// properties: {
|
|
251
|
+
// date: {
|
|
252
|
+
// 'type': valueTypeMap.array,
|
|
253
|
+
// 'title': '加班日期',
|
|
254
|
+
// 'format': 'date',
|
|
255
|
+
// 'items': {
|
|
256
|
+
// type: valueTypeMap.string,
|
|
257
|
+
// format: 'date'
|
|
258
|
+
// },
|
|
259
|
+
// 'name': 'date',
|
|
260
|
+
// 'x-component': 'DateRange',
|
|
261
|
+
// 'x-component-props': {
|
|
262
|
+
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
263
|
+
// showTime: true,
|
|
264
|
+
// placeholder: [
|
|
265
|
+
// '开始日期',
|
|
266
|
+
// '结束日期'
|
|
267
|
+
// ]
|
|
268
|
+
// }
|
|
269
|
+
// },
|
|
270
|
+
// hours: {
|
|
271
|
+
// 'type': valueTypeMap.number,
|
|
272
|
+
// 'title': '加班时长',
|
|
273
|
+
// 'name': 'hours',
|
|
274
|
+
// 'x-component': 'InputNumber',
|
|
275
|
+
// 'x-component-props': {
|
|
276
|
+
// placeholder: '请输入'
|
|
277
|
+
// },
|
|
278
|
+
// 'x-validator': [
|
|
279
|
+
// {
|
|
280
|
+
// validator: `{{const sourceValue = \$parent.date
|
|
281
|
+
// if (!sourceValue || !sourceValue.length) {
|
|
282
|
+
// return true
|
|
283
|
+
// }else{
|
|
284
|
+
// const [start, end] = sourceValue
|
|
285
|
+
// const s = new Date(start)
|
|
286
|
+
// const e = new Date(end)
|
|
287
|
+
// const hoursDiff = Math.abs(e - s) / (1000 * 60 * 60)
|
|
288
|
+
// const actualHours = Math.round(hoursDiff * 100) / 100
|
|
289
|
+
// if ( \$value> actualHours) {
|
|
290
|
+
// return new Error(\`不得超过\${actualHours}小时\`)
|
|
291
|
+
// }
|
|
292
|
+
// return true
|
|
293
|
+
// }
|
|
294
|
+
// }}`
|
|
295
|
+
// }
|
|
296
|
+
// ]
|
|
297
|
+
// }
|
|
298
|
+
// }
|
|
299
|
+
// }
|
|
300
|
+
// },
|
|
301
|
+
// total: {
|
|
302
|
+
// 'type': valueTypeMap.number,
|
|
303
|
+
// 'title': '总时长',
|
|
304
|
+
// 'name': 'total',
|
|
305
|
+
// 'x-component': 'InputNumber',
|
|
306
|
+
// 'x-component-props': {
|
|
307
|
+
// placeholder: '请输入'
|
|
308
|
+
// },
|
|
309
|
+
// 'x-reactions': {
|
|
310
|
+
// dependencies: [
|
|
311
|
+
// {
|
|
312
|
+
// property: 'value',
|
|
313
|
+
// type: 'string',
|
|
314
|
+
// source: '.details',
|
|
315
|
+
// name: 'details'
|
|
316
|
+
// }
|
|
317
|
+
// ],
|
|
318
|
+
// fulfill: {
|
|
319
|
+
// state: {
|
|
320
|
+
// value: '{{$deps.details.reduce((acc, cur) => acc + cur.hours, 0)}}'
|
|
321
|
+
// }
|
|
322
|
+
// }
|
|
323
|
+
// }
|
|
324
|
+
// }
|
|
325
|
+
// }
|
|
347
326
|
}
|
|
348
327
|
}
|
|
328
|
+
// {
|
|
329
|
+
// name: '请假模版',
|
|
330
|
+
// key: 'liveTime',
|
|
331
|
+
// icon: 'form-kit-liveTime',
|
|
332
|
+
// schema: {
|
|
333
|
+
// 'title': '请假模版',
|
|
334
|
+
// 'key': 'k-liveTime',
|
|
335
|
+
// 'type': valueTypeMap.object,
|
|
336
|
+
// 'name': 'liveTime',
|
|
337
|
+
// 'id': 'liveTime',
|
|
338
|
+
// 'x-design-props': {
|
|
339
|
+
// validate: {
|
|
340
|
+
// status: '',
|
|
341
|
+
// message: ''
|
|
342
|
+
// }
|
|
343
|
+
// },
|
|
344
|
+
// 'properties': {
|
|
345
|
+
// details: {
|
|
346
|
+
// 'type': valueTypeMap.array,
|
|
347
|
+
// 'title': '加班明细',
|
|
348
|
+
// 'x-component': 'ArrayCard',
|
|
349
|
+
// 'x-decorator': 'Void',
|
|
350
|
+
// 'name': 'details',
|
|
351
|
+
// 'items': {
|
|
352
|
+
// type: valueTypeMap.object,
|
|
353
|
+
// properties: {
|
|
354
|
+
// date: {
|
|
355
|
+
// 'type': valueTypeMap.array,
|
|
356
|
+
// 'title': '加班日期',
|
|
357
|
+
// 'format': 'date',
|
|
358
|
+
// 'items': {
|
|
359
|
+
// type: valueTypeMap.string,
|
|
360
|
+
// format: 'date'
|
|
361
|
+
// },
|
|
362
|
+
// 'name': 'date',
|
|
363
|
+
// 'x-component': 'DateRange',
|
|
364
|
+
// 'x-component-props': {
|
|
365
|
+
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
366
|
+
// showTime: true,
|
|
367
|
+
// placeholder: [
|
|
368
|
+
// '开始日期',
|
|
369
|
+
// '结束日期'
|
|
370
|
+
// ]
|
|
371
|
+
// }
|
|
372
|
+
// },
|
|
373
|
+
// hours: {
|
|
374
|
+
// 'type': valueTypeMap.number,
|
|
375
|
+
// 'title': '加班时长',
|
|
376
|
+
// 'name': 'hours',
|
|
377
|
+
// 'x-component': 'InputNumber',
|
|
378
|
+
// 'x-component-props': {
|
|
379
|
+
// placeholder: '请输入'
|
|
380
|
+
// }
|
|
381
|
+
// }
|
|
382
|
+
// }
|
|
383
|
+
// }
|
|
384
|
+
// },
|
|
385
|
+
// total: {
|
|
386
|
+
// 'type': valueTypeMap.number,
|
|
387
|
+
// 'title': '总时长',
|
|
388
|
+
// 'name': 'total',
|
|
389
|
+
// 'x-component': 'InputNumber',
|
|
390
|
+
// 'x-component-props': {
|
|
391
|
+
// placeholder: '请输入'
|
|
392
|
+
// }
|
|
393
|
+
// }
|
|
394
|
+
// }
|
|
395
|
+
// }
|
|
396
|
+
// }
|
|
349
397
|
];
|
|
350
398
|
export {
|
|
351
399
|
r as BaseSchema,
|
|
@@ -1,79 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
class F {
|
|
1
|
+
var t = Object.defineProperty;
|
|
2
|
+
var l = (s, e, i) => e in s ? t(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i;
|
|
3
|
+
var r = (s, e, i) => l(s, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { ref as o, toRaw as a } from "vue";
|
|
5
|
+
import { Field as m } from "./Field.mjs";
|
|
6
|
+
class n {
|
|
8
7
|
constructor() {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
r(this, "version", "1.0.0");
|
|
9
|
+
r(this, "fields", o([]));
|
|
11
10
|
}
|
|
12
11
|
getSchema() {
|
|
13
|
-
const
|
|
14
|
-
console.log(t, "s");
|
|
15
|
-
const s = this.jsonToschema(t);
|
|
12
|
+
const e = a(this.fields.value);
|
|
16
13
|
return {
|
|
17
14
|
version: this.version,
|
|
18
15
|
form: {
|
|
19
|
-
schema:
|
|
16
|
+
schema: e
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
19
|
}
|
|
23
20
|
getFieldList() {
|
|
24
|
-
return this.fields.value.map((
|
|
21
|
+
return this.fields.value.map((e) => new m(e));
|
|
25
22
|
}
|
|
26
23
|
clearFields() {
|
|
27
24
|
return this.fields.value = [];
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const e = this.omit(i, ["children"]), o = i.children || [];
|
|
32
|
-
e.type === "object" && o.length ? s[e.name] = {
|
|
33
|
-
...e,
|
|
34
|
-
properties: this.jsonToschema(o)
|
|
35
|
-
} : e.type === "void" && o.length ? s[e.name] = {
|
|
36
|
-
...e,
|
|
37
|
-
properties: this.jsonToschema(o)
|
|
38
|
-
} : e.type === "array" && o.length ? s[e.name] = {
|
|
39
|
-
...e,
|
|
40
|
-
items: e.items || {
|
|
41
|
-
type: "object",
|
|
42
|
-
id: u(),
|
|
43
|
-
properties: this.jsonToschema(o)
|
|
44
|
-
}
|
|
45
|
-
} : s[e.name] = e;
|
|
46
|
-
}), s;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 将 schema 对象格式还原为数组格式
|
|
50
|
-
* @param schema schema 对象
|
|
51
|
-
* @returns FieldSchema[] 数组格式
|
|
52
|
-
*/
|
|
53
|
-
schemaToJson(t) {
|
|
54
|
-
const s = [];
|
|
55
|
-
return Object.keys(t).forEach((i) => {
|
|
56
|
-
var h;
|
|
57
|
-
const e = t[i], o = e["x-design-props"], l = o == null ? void 0 : o["convert-key"], p = o == null ? void 0 : o["convert-type"];
|
|
58
|
-
if (!l || !p) {
|
|
59
|
-
s.push(e);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const n = this.omit(e, ["properties", "items"]);
|
|
63
|
-
e.type === "object" || e.type === "void" ? n.children = e.properties ? this.schemaToJson(e.properties) : [] : e.type === "array" && ((h = e.items) != null && h.properties) && (n.children = this.schemaToJson(e.items.properties)), s.push(n);
|
|
64
|
-
}), s;
|
|
65
|
-
}
|
|
66
|
-
setFields(t) {
|
|
67
|
-
const s = this.schemaToJson(t);
|
|
68
|
-
this.fields.value = s;
|
|
69
|
-
}
|
|
70
|
-
omit(t, s) {
|
|
71
|
-
const i = { ...t };
|
|
72
|
-
return s.forEach((e) => {
|
|
73
|
-
delete i[e];
|
|
74
|
-
}), i;
|
|
26
|
+
setFields(e) {
|
|
27
|
+
this.fields.value = e;
|
|
75
28
|
}
|
|
76
29
|
}
|
|
77
30
|
export {
|
|
78
|
-
|
|
31
|
+
n as FormSchema
|
|
79
32
|
};
|
package/dist/es/src/index.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import "./components/base/Carousel.vue2.mjs";
|
|
2
2
|
import "./components/panel/panel-item.vue2.mjs";
|
|
3
|
-
import { useInjectDesignContext as
|
|
4
|
-
import { default as
|
|
5
|
-
import { CreateFormDesign as
|
|
3
|
+
import { useInjectDesignContext as i } from "./context/design.mjs";
|
|
4
|
+
import { default as p } from "./components/form-desgin.mjs";
|
|
5
|
+
import { CreateFormDesign as x } from "./core/index.mjs";
|
|
6
6
|
import "./components/index.mjs";
|
|
7
|
-
import { BaseSchema as
|
|
8
|
-
import { onDesignFieldChange as
|
|
7
|
+
import { BaseSchema as g, ExtendSchema as c, LayoutSchema as h, tempSchema as D } from "./config/index.mjs";
|
|
8
|
+
import { onDesignFieldChange as d, onDesignInit as u } from "./effects/onEffects.mjs";
|
|
9
|
+
import "./utils/index.mjs";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
g as BaseSchema,
|
|
12
|
+
x as CreateFormDesign,
|
|
13
|
+
c as ExtendSchema,
|
|
14
|
+
p as FormDesign,
|
|
15
|
+
h as LayoutSchema,
|
|
16
|
+
d as onDesignFieldChange,
|
|
17
|
+
u as onDesignInit,
|
|
18
|
+
D as tempSchema,
|
|
19
|
+
i as useInjectDesignContext
|
|
19
20
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { getType as s, isArr as
|
|
2
|
-
import { debounce as
|
|
1
|
+
import { getType as s, isArr as o, isBool as r, isFn as t, isHTMLElement as m, isMap as a, isNum as p, isNumberLike as n, isObj as b, isPlainObj as l, isReactElement as x, isRegExp as S, isSet as c, isStr as f, isWeakMap as j, isWeakSet as k } from "./checkers.mjs";
|
|
2
|
+
import { debounce as E } from "./debounce.mjs";
|
|
3
|
+
import { jsonToSchema as T } from "./schema.mjs";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
E as debounce,
|
|
5
6
|
s as getType,
|
|
6
|
-
|
|
7
|
+
o as isArr,
|
|
7
8
|
r as isBool,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
t as isFn,
|
|
10
|
+
m as isHTMLElement,
|
|
11
|
+
a as isMap,
|
|
11
12
|
p as isNum,
|
|
12
13
|
n as isNumberLike,
|
|
13
14
|
b as isObj,
|
|
14
15
|
l as isPlainObj,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
x as isReactElement,
|
|
17
|
+
S as isRegExp,
|
|
18
|
+
c as isSet,
|
|
19
|
+
f as isStr,
|
|
20
|
+
j as isWeakMap,
|
|
21
|
+
k as isWeakSet,
|
|
22
|
+
T as jsonToSchema
|
|
21
23
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { uid as p } from "@king-one/utils";
|
|
2
|
+
function l(o, t) {
|
|
3
|
+
const n = { ...o };
|
|
4
|
+
return t.forEach((e) => {
|
|
5
|
+
delete n[e];
|
|
6
|
+
}), n;
|
|
7
|
+
}
|
|
8
|
+
function i(o, t = {}) {
|
|
9
|
+
return o.forEach((n) => {
|
|
10
|
+
const e = l(n, ["children"]), r = n.children || [];
|
|
11
|
+
e.type === "object" && r.length ? t[e.name] = {
|
|
12
|
+
...e,
|
|
13
|
+
properties: i(r)
|
|
14
|
+
} : e.type === "void" && r.length ? t[e.name] = {
|
|
15
|
+
...e,
|
|
16
|
+
properties: i(r)
|
|
17
|
+
} : e.type === "array" && r.length ? t[e.name] = {
|
|
18
|
+
...e,
|
|
19
|
+
items: e.items || {
|
|
20
|
+
type: "object",
|
|
21
|
+
id: p(),
|
|
22
|
+
properties: i(r)
|
|
23
|
+
}
|
|
24
|
+
} : t[e.name] = e;
|
|
25
|
+
}), t;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
i as jsonToSchema
|
|
29
|
+
};
|
package/dist/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./src/index.js");const n=require("./src/components/base/Carousel.vue.js"),r=require("./src/components/panel/panel-item.vue.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./src/index.js");const n=require("./src/components/base/Carousel.vue.js"),r=require("./src/components/panel/panel-item.vue.js"),s=require("./src/context/design.js"),o=require("./src/components/form-desgin.js"),i=require("./src/core/index.js"),u=require("./src/components/props/form-config.vue.js"),a=require("./src/utils/schema.js"),e=require("./src/config/index.js"),t=require("./src/effects/onEffects.js");exports.Carousel=n.default;exports.FormPanelItem=r.default;exports.useInjectDesignContext=s.useInjectDesignContext;exports.FormDesign=o.default;exports.CreateFormDesign=i.CreateFormDesign;exports.FormConfig=u.default;exports.jsonToSchema=a.jsonToSchema;exports.BaseSchema=e.BaseSchema;exports.ExtendSchema=e.ExtendSchema;exports.LayoutSchema=e.LayoutSchema;exports.tempSchema=e.tempSchema;exports.onDesignFieldChange=t.onDesignFieldChange;exports.onDesignInit=t.onDesignInit;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../internal.js");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../internal.js");const c=require("ant-design-vue"),k=require("vuedraggable"),_=require("@king-one/utils"),C=require("../context/design.js");require("./base/Carousel.vue2.js");const N=require("./base/widget-icon.js"),r=require("../hooks/use-namespace/index.js"),q=require("./base/Carousel.vue.js"),D={class:"widget-group-name"},z={class:"widget-col"},R={class:"widget-item"},$={key:0,class:"widget-item-icon"},j={class:"widget-item-title"},I={class:"template-item"},O={key:0,class:"template-item-icon"},T={class:"template-item-name"},M=e.defineComponent({name:"FormMaterial",__name:"form-material",setup(F){const u=e.ref(),{updateDrag:s}=C.useInjectDragContext(),{b:y}=r.useNamespace("material"),{b:V}=r.useNamespace("toolbar"),{b:x}=r.useNamespace("widget"),{b:w}=r.useNamespace("temp"),l=C.useInjectDesignContext(),{schema:h,tempSchema:E}=l,m=e.ref("1");function b(i){const{icon:t,...n}=i,o=JSON.parse(JSON.stringify(n)),p=_.uid(),a={...o,name:p,id:p,"x-design-props":Object.assign({validate:{status:"",message:""}},i["x-design-props"]||{})};if(o.key==="k-grid"){const g=[];let d=0;for(;d<2;){const v=_.uid();g.push({title:`栅格容器${d+1}`,name:v,id:v,key:"k-grid-column",type:"void",children:[],"x-component":"GridColumn","x-decorator":"Void","x-component-props":{span:12}}),d++}a.children=g}const{shared:f}=l;return f.draggedContext.field=a,f.draggedContext.key=a.key,a}function B(i){const{schema:t}=i,{shared:n}=l;return n.draggedContext.field=t,n.draggedContext.key=t.key||"",t}function S(i){var t;(t=u.value)==null||t.goTo(Number(i.target.value)-1)}return(i,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(y)())},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(V)())},[e.createVNode(e.unref(c.RadioGroup),{value:m.value,"onUpdate:value":t[0]||(t[0]=n=>m.value=n),"button-style":"solid",size:"default",onChange:S},{default:e.withCtx(()=>[e.createVNode(e.unref(c.RadioButton),{class:"toolbar-button",value:"1"},{default:e.withCtx(()=>t[5]||(t[5]=[e.createTextVNode(" 组件库 ")])),_:1,__:[5]}),e.createVNode(e.unref(c.RadioButton),{class:"toolbar-button",value:"2"},{default:e.withCtx(()=>t[6]||(t[6]=[e.createTextVNode(" 业务套件 ")])),_:1,__:[6]})]),_:1},8,["value"])],2),e.createVNode(q.default,{ref_key:"carouselRef",ref:u,"model-value":0},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(x)())},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),n=>(e.openBlock(),e.createElementBlock("div",{key:n.key,class:"widget-group"},[e.createElementVNode("div",D,e.toDisplayString(n.name),1),n.widget?(e.openBlock(),e.createBlock(e.unref(k),{key:0,list:n.widget,class:"widget-list-drag","item-key":"key",group:{name:"form",pull:"clone",put:!1},sort:!1,options:{animation:150},clone:b,onStart:t[1]||(t[1]=o=>e.unref(s)(!0)),onEnd:t[2]||(t[2]=o=>e.unref(s)(!1))},{item:e.withCtx(({element:o})=>[e.createElementVNode("div",z,[e.createElementVNode("div",R,[o.icon?(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(N.default),{icon:o.icon},null,8,["icon"])])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",j,e.toDisplayString(o.title),1)])])]),_:2},1032,["list"])):e.createCommentVNode("v-if",!0)]))),128))],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(w)())},[e.createVNode(e.unref(k),{list:e.unref(E),class:"template-list-drag","item-key":"key",group:{name:"form",pull:"clone",put:!1},sort:!1,options:{animation:150},clone:B,onStart:t[3]||(t[3]=n=>e.unref(s)(!0)),onEnd:t[4]||(t[4]=n=>e.unref(s)(!1))},{item:e.withCtx(({element:n})=>[e.createElementVNode("div",I,[n.icon?(e.openBlock(),e.createElementBlock("div",O,[e.createVNode(e.unref(N.default),{icon:n.icon},null,8,["icon"])])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",T,e.toDisplayString(n.name),1)])]),_:1},8,["list"]),e.createCommentVNode(` <div class="template-list">
|
|
2
2
|
<div v-for="g in tempSchema" :key="g.key" class="template-item">
|
|
3
3
|
<div v-if="g.icon" class="template-item-icon">
|
|
4
4
|
<WidgetIcon :icon="g.icon" />
|