@fangzhongya/fang-ui 0.1.39 → 0.1.40
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/components/common/use.cjs +145 -98
- package/dist/components/common/use.d.ts +26 -6
- package/dist/components/common/use.js +146 -99
- package/dist/components/company-select/src/index2.cjs +1 -2
- package/dist/components/company-select/src/index2.js +1 -2
- package/dist/components/double/src/index2.cjs +2 -2
- package/dist/components/double/src/index2.js +2 -2
- package/dist/components/forms/index.css +18 -0
- package/dist/components/forms/src/index2.cjs +9 -6
- package/dist/components/forms/src/index2.js +9 -6
- package/dist/components/forms/src/setup.cjs +9 -12
- package/dist/components/forms/src/setup.js +9 -12
- package/dist/components/forms/src/util.cjs +6 -8
- package/dist/components/forms/src/util.js +6 -8
- package/dist/components/forms-div/src/data.cjs +8 -5
- package/dist/components/forms-div/src/data.d.ts +21 -3
- package/dist/components/forms-div/src/data.js +8 -5
- package/dist/components/forms-div/src/index2.cjs +41 -70
- package/dist/components/forms-div/src/index2.js +43 -72
- package/dist/components/forms-item/index.css +49 -0
- package/dist/components/forms-item/src/data.cjs +6 -0
- package/dist/components/forms-item/src/data.d.ts +19 -0
- package/dist/components/forms-item/src/data.js +6 -0
- package/dist/components/forms-item/src/index2.cjs +11 -7
- package/dist/components/forms-item/src/index2.js +11 -7
- package/dist/components/forms-item/src/indexts.d.ts +40 -1
- package/dist/components/forms-item/src/label.cjs +7 -1
- package/dist/components/forms-item/src/label.d.ts +40 -1
- package/dist/components/forms-item/src/label.js +7 -1
- package/dist/components/forms-items/index.css +18 -0
- package/dist/components/forms-items/index.scss +21 -0
- package/dist/components/forms-items/src/data.cjs +9 -0
- package/dist/components/forms-items/src/data.d.ts +22 -0
- package/dist/components/forms-items/src/data.js +9 -0
- package/dist/components/forms-items/src/index2.cjs +22 -10
- package/dist/components/forms-items/src/index2.js +22 -10
- package/dist/components/forms-items/style/index2.scss +1 -0
- package/dist/components/icon/src/index2.cjs +1 -2
- package/dist/components/icon/src/index2.js +1 -2
- package/dist/components/input-history/src/index2.cjs +1 -1
- package/dist/components/input-history/src/index2.js +1 -1
- package/dist/components/input-select/src/index2.cjs +0 -2
- package/dist/components/input-select/src/index2.js +0 -2
- package/dist/components/inputs/src/index2.cjs +1 -1
- package/dist/components/inputs/src/index2.js +1 -1
- package/dist/components/list/src/index2.cjs +4 -8
- package/dist/components/list/src/index2.js +4 -8
- package/dist/components/list/src/util.cjs +7 -5
- package/dist/components/list/src/util.d.ts +29 -1
- package/dist/components/list/src/util.js +7 -5
- package/dist/components/lists/src/index2.cjs +1 -2
- package/dist/components/lists/src/index2.js +1 -2
- package/dist/components/menus/src/util.cjs +8 -24
- package/dist/components/menus/src/util.js +9 -25
- package/dist/components/page/index.css +18 -0
- package/dist/components/right-key/src/index2.cjs +3 -3
- package/dist/components/right-key/src/index2.js +3 -3
- package/dist/components/seamless-scroll/src/index2.cjs +1 -1
- package/dist/components/seamless-scroll/src/index2.js +1 -1
- package/dist/components/selects/src/index2.cjs +2 -2
- package/dist/components/selects/src/index2.js +2 -2
- package/dist/components/stick-edge/src/index2.cjs +2 -2
- package/dist/components/stick-edge/src/index2.js +2 -2
- package/dist/components/switchs/src/index2.cjs +1 -1
- package/dist/components/switchs/src/index2.js +1 -1
- package/dist/components/tables/common/com-color2.cjs +0 -3
- package/dist/components/tables/common/com-color2.js +0 -3
- package/dist/components/tables/common/com-lis2.cjs +0 -1
- package/dist/components/tables/common/com-lis2.js +0 -1
- package/dist/components/tables/common/pagin.d.ts +6 -0
- package/dist/components/tables/common/tooltip.cjs +1 -1
- package/dist/components/tables/common/tooltip.js +1 -1
- package/dist/components/tables/common/util.cjs +2 -4
- package/dist/components/tables/common/util.js +2 -4
- package/dist/components/tables/src/column.cjs +11 -3
- package/dist/components/tables/src/column.d.ts +29 -0
- package/dist/components/tables/src/column.js +11 -3
- package/dist/components/tables/src/columns.d.ts +7 -0
- package/dist/components/tables/src/columns3.cjs +1 -7
- package/dist/components/tables/src/columns3.js +1 -7
- package/dist/components/tables/src/index2.cjs +2 -2
- package/dist/components/tables/src/index2.js +2 -2
- package/dist/components/tablesv/src/column.cjs +11 -3
- package/dist/components/tablesv/src/column.d.ts +25 -0
- package/dist/components/tablesv/src/column.js +11 -3
- package/dist/components/tablesv/src/columns.d.ts +7 -0
- package/dist/components/tablesv/src/columns3.cjs +1 -7
- package/dist/components/tablesv/src/columns3.js +1 -7
- package/dist/components/tablesv/src/index2.cjs +2 -2
- package/dist/components/tablesv/src/index2.js +2 -2
- package/dist/components/uploads/src/util.cjs +2 -3
- package/dist/components/uploads/src/util.d.ts +7 -0
- package/dist/components/uploads/src/util.js +2 -3
- package/dist/css/forms-item.css +49 -0
- package/dist/css/forms-items.css +18 -0
- package/dist/css/forms.css +18 -0
- package/dist/css/index.css +18 -0
- package/dist/css/page.css +18 -0
- package/dist/directives/adjust/index.cjs +4 -8
- package/dist/directives/adjust/index.js +4 -8
- package/dist/directives/drag/index.cjs +6 -1
- package/dist/directives/drag/index.js +6 -1
- package/dist/directives/expose/index.cjs +6 -0
- package/dist/directives/expose/index.js +6 -0
- package/dist/directives/inserted/index.cjs +5 -0
- package/dist/directives/inserted/index.js +5 -0
- package/dist/directives/locus/index.cjs +5 -0
- package/dist/directives/locus/index.js +5 -0
- package/dist/directives/scroll/index.cjs +10 -0
- package/dist/directives/scroll/index.d.ts +0 -5
- package/dist/directives/scroll/index.js +10 -0
- package/dist/directives/sortable/index.cjs +5 -0
- package/dist/directives/sortable/index.js +5 -0
- package/dist/directives/stick/index.cjs +13 -8
- package/dist/directives/stick/index.js +13 -8
- package/dist/hooks/attrs-default/index.d.ts +5 -3
- package/dist/hooks/compons/index.d.ts +13 -0
- package/dist/hooks/cssname/index.cjs +1 -1
- package/dist/hooks/cssname/index.d.ts +22 -1
- package/dist/hooks/cssname/index.js +1 -1
- package/dist/hooks/default-config/index.d.ts +10 -0
- package/dist/hooks/expose/index.cjs +2 -0
- package/dist/hooks/expose/index.d.ts +6 -0
- package/dist/hooks/expose/index.js +2 -0
- package/dist/hooks/full-screen/index.d.ts +6 -0
- package/dist/hooks/global-config/index.d.ts +16 -0
- package/dist/hooks/inherit/index.cjs +2 -0
- package/dist/hooks/inherit/index.d.ts +8 -0
- package/dist/hooks/inherit/index.js +2 -0
- package/dist/hooks/locale/index.d.ts +24 -0
- package/dist/hooks/props-default/index.d.ts +14 -5
- package/dist/icons/iconify.d.ts +7 -0
- package/dist/icons/iconifyCss.d.ts +6 -0
- package/dist/icons/index.json +1 -1
- package/dist/index.css +18 -0
- package/dist/type.d.ts +8 -0
- package/dist/utils/local.cjs +12 -6
- package/dist/utils/local.js +12 -6
- package/dist/utils/util.cjs +7 -5
- package/dist/utils/util.js +7 -5
- package/package.json +1 -1
- /package/dist/components/{draggable → keep-com}/index.css +0 -0
- /package/dist/css/{draggable.css → keep-com.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, resolveComponent, computed,
|
|
1
|
+
import { isVNode, h, resolveComponent, computed, Fragment, render } from "vue";
|
|
2
2
|
import { isHTMLTag, isSVGTag } from "@vue/shared";
|
|
3
3
|
import { getFathers, getChildrenData } from "../../utils/util.js";
|
|
4
4
|
import { isObject } from "@fangzhongya/utils/basic/object/isObject";
|
|
@@ -88,17 +88,26 @@ function handleComputedWithoutDefault(obj, v) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
function setFormDefaultValue(obj, value) {
|
|
91
|
-
let v = getChildrenData(obj, value
|
|
91
|
+
let v = getChildrenData(obj, value);
|
|
92
92
|
if (obj.orig) {
|
|
93
|
-
v = value;
|
|
93
|
+
v = value ?? {};
|
|
94
94
|
}
|
|
95
95
|
setComputed(obj, v);
|
|
96
96
|
const prop = obj.prop;
|
|
97
97
|
if (prop) {
|
|
98
|
-
if (
|
|
99
|
-
|
|
98
|
+
if (v) {
|
|
99
|
+
if (obj.pars) {
|
|
100
|
+
setObjValue(v, prop, getObjValue(prop, v) ?? obj.default);
|
|
101
|
+
} else {
|
|
102
|
+
v[prop] = v[prop] ?? obj.default;
|
|
103
|
+
}
|
|
100
104
|
} else {
|
|
101
|
-
v
|
|
105
|
+
v = getChildrenData(obj, value, true);
|
|
106
|
+
if (obj.pars) {
|
|
107
|
+
setObjValue(v, prop, getObjValue(prop, v) ?? obj.default);
|
|
108
|
+
} else {
|
|
109
|
+
v[prop] = v[prop] ?? obj.default;
|
|
110
|
+
}
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
}
|
|
@@ -148,48 +157,46 @@ function getValueObjs(value, multiple, options, config) {
|
|
|
148
157
|
return value;
|
|
149
158
|
}
|
|
150
159
|
}
|
|
151
|
-
function setOptionsValue(value, obj, data,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
options = value2(optionss, value2, obj, data) || [];
|
|
159
|
-
} else {
|
|
160
|
-
options = value2 || [];
|
|
161
|
-
}
|
|
162
|
-
} else if (typeof opt == "function") {
|
|
163
|
-
options = opt(optionss, value, obj, data) || [];
|
|
164
|
-
} else {
|
|
165
|
-
options = opt || [];
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return getValueObjs(value, obj.multiple, options, obj.config);
|
|
160
|
+
function setOptionsValue(value, obj, data, options = {}) {
|
|
161
|
+
return getValueObjs(
|
|
162
|
+
value,
|
|
163
|
+
obj.multiple,
|
|
164
|
+
processOptions(value, obj, data, options),
|
|
165
|
+
obj.config
|
|
166
|
+
);
|
|
169
167
|
}
|
|
170
168
|
function setValue(value, obj, data) {
|
|
171
|
-
let v = getChildrenData(obj, data)
|
|
169
|
+
let v = getChildrenData(obj, data);
|
|
172
170
|
if (obj.orig) {
|
|
173
171
|
v = data ?? {};
|
|
174
172
|
}
|
|
175
173
|
const prop = obj.prop;
|
|
176
174
|
if (prop) {
|
|
177
|
-
if (
|
|
178
|
-
|
|
175
|
+
if (v) {
|
|
176
|
+
if (obj.pars) {
|
|
177
|
+
setObjValue(v, prop, value);
|
|
178
|
+
} else {
|
|
179
|
+
v[prop] = value;
|
|
180
|
+
}
|
|
179
181
|
} else {
|
|
180
|
-
v
|
|
182
|
+
v = getChildrenData(obj, data, true);
|
|
183
|
+
if (obj.pars) {
|
|
184
|
+
setObjValue(v, prop, value);
|
|
185
|
+
} else {
|
|
186
|
+
v[prop] = value;
|
|
187
|
+
}
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
}
|
|
184
191
|
function getValue(obj, data, index) {
|
|
185
192
|
const prop = obj.prop;
|
|
186
|
-
const cdata = getChildrenData(obj, data
|
|
193
|
+
const cdata = getChildrenData(obj, data);
|
|
187
194
|
let cellValue;
|
|
188
195
|
if (prop) {
|
|
189
196
|
if (obj.pars) {
|
|
190
197
|
cellValue = getObjValue(prop, cdata);
|
|
191
198
|
} else {
|
|
192
|
-
cellValue = cdata[prop];
|
|
199
|
+
cellValue = cdata == null ? void 0 : cdata[prop];
|
|
193
200
|
}
|
|
194
201
|
} else {
|
|
195
202
|
cellValue = obj.value;
|
|
@@ -200,36 +207,51 @@ function getValue(obj, data, index) {
|
|
|
200
207
|
return cellValue ?? obj.default;
|
|
201
208
|
}
|
|
202
209
|
}
|
|
203
|
-
function setComponString(value, obj, componObj,
|
|
204
|
-
processOptions(obj, componObj, optionss, value, data);
|
|
210
|
+
function setComponString(value, obj, componObj, compons) {
|
|
205
211
|
const compon = obj.compon;
|
|
206
212
|
const tcom = lineToLargeHump(compon);
|
|
207
|
-
return renderComponent(tcom, compon, componObj, value, compons);
|
|
213
|
+
return renderComponent(obj, tcom, compon, componObj, value, compons);
|
|
208
214
|
}
|
|
209
|
-
function processOptions(
|
|
210
|
-
if (!(obj == null ? void 0 : obj.options)) return;
|
|
211
|
-
let
|
|
215
|
+
function processOptions(value, obj, data, options) {
|
|
216
|
+
if (!(obj == null ? void 0 : obj.options)) return [];
|
|
217
|
+
let option = [];
|
|
212
218
|
const opt = obj.options;
|
|
213
219
|
if (typeof opt === "string") {
|
|
214
|
-
const optionsvalue =
|
|
215
|
-
|
|
220
|
+
const optionsvalue = options[opt];
|
|
221
|
+
option = typeof optionsvalue == "function" ? optionsvalue(options, value, obj, data) || [] : optionsvalue || [];
|
|
216
222
|
} else if (typeof opt == "function") {
|
|
217
|
-
|
|
223
|
+
option = opt(options, value, obj, data) || [];
|
|
218
224
|
} else {
|
|
219
|
-
|
|
225
|
+
option = opt || [];
|
|
220
226
|
}
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
return option;
|
|
228
|
+
}
|
|
229
|
+
function setSlots(obj) {
|
|
230
|
+
const slots = obj.slots;
|
|
231
|
+
if (isVNode(slots)) {
|
|
232
|
+
return {
|
|
233
|
+
default: () => slots
|
|
234
|
+
};
|
|
235
|
+
} else if (typeof slots === "function") {
|
|
236
|
+
return {
|
|
237
|
+
default: slots
|
|
238
|
+
};
|
|
239
|
+
} else if (isObject(slots)) {
|
|
240
|
+
return slots;
|
|
241
|
+
} else if (slots) {
|
|
242
|
+
return {
|
|
243
|
+
default: () => slots
|
|
244
|
+
};
|
|
223
245
|
}
|
|
224
246
|
}
|
|
225
|
-
function renderComponent(tcom, compon, componObj, value, compons) {
|
|
247
|
+
function renderComponent(obj, tcom, compon, componObj, value, compons) {
|
|
226
248
|
if (Object.keys(compons).includes(tcom)) {
|
|
227
|
-
return h(compons[tcom], componObj);
|
|
249
|
+
return h(compons[tcom], componObj, setSlots(obj));
|
|
228
250
|
}
|
|
229
251
|
if (isHTMLTag(compon) || isSVGTag(compon)) {
|
|
230
252
|
return h(compon, componObj, value);
|
|
231
253
|
}
|
|
232
|
-
return h(resolveComponent(compon), componObj);
|
|
254
|
+
return h(resolveComponent(compon), componObj, setSlots(obj));
|
|
233
255
|
}
|
|
234
256
|
function getOnObjs(obj, data, emit, ...arrs) {
|
|
235
257
|
const objs = {};
|
|
@@ -250,7 +272,7 @@ function getOnObjs(obj, data, emit, ...arrs) {
|
|
|
250
272
|
}
|
|
251
273
|
return objs;
|
|
252
274
|
}
|
|
253
|
-
function useSetSlot(obj, data, slots, index, scope) {
|
|
275
|
+
function useSetSlot(obj, data, slots, options, emit, index, scope) {
|
|
254
276
|
const slotname = obj.slot ?? obj.prop;
|
|
255
277
|
if (slotname) {
|
|
256
278
|
const slot = slots[slotname];
|
|
@@ -263,50 +285,61 @@ function useSetSlot(obj, data, slots, index, scope) {
|
|
|
263
285
|
setValue(value2, obj, data);
|
|
264
286
|
}
|
|
265
287
|
});
|
|
288
|
+
const componObj = getComponObj(
|
|
289
|
+
value.value,
|
|
290
|
+
obj,
|
|
291
|
+
data,
|
|
292
|
+
options,
|
|
293
|
+
emit,
|
|
294
|
+
scope
|
|
295
|
+
);
|
|
266
296
|
return slot({
|
|
267
|
-
comscope: scope,
|
|
268
297
|
column: obj,
|
|
269
298
|
row: data,
|
|
270
299
|
value,
|
|
271
|
-
index
|
|
300
|
+
index,
|
|
301
|
+
...componObj
|
|
272
302
|
});
|
|
273
303
|
}
|
|
274
304
|
}
|
|
275
305
|
}
|
|
276
|
-
function
|
|
306
|
+
function getComponObj(value, obj, data, options, emit, scope) {
|
|
307
|
+
const componValueName = obj.componValueName || "modelValue";
|
|
308
|
+
const componObj = {
|
|
309
|
+
// ...attrs,
|
|
310
|
+
[componValueName]: value,
|
|
311
|
+
["onUpdate:" + componValueName]: (v) => setValue(v, obj, data),
|
|
312
|
+
listobj: obj,
|
|
313
|
+
valueobj: data,
|
|
314
|
+
comscope: scope,
|
|
315
|
+
...obj.config,
|
|
316
|
+
...getOnObjs(obj, data, emit, scope)
|
|
317
|
+
};
|
|
318
|
+
if (obj.multiple) {
|
|
319
|
+
componObj.multiple = obj.multiple;
|
|
320
|
+
}
|
|
321
|
+
const option = processOptions(value, obj, data, options);
|
|
322
|
+
if (option.length > 0) {
|
|
323
|
+
componObj.options = option;
|
|
324
|
+
}
|
|
325
|
+
return componObj;
|
|
326
|
+
}
|
|
327
|
+
function useSetCompon(obj, data, options, compons, emit, index, scope) {
|
|
277
328
|
if (obj.compon) {
|
|
278
329
|
const value = getValue(obj, data, index);
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
componObj.multiple = obj.multiple;
|
|
293
|
-
}
|
|
294
|
-
if (typeof obj.compon == "string") {
|
|
295
|
-
return setComponString(
|
|
296
|
-
value,
|
|
297
|
-
obj,
|
|
298
|
-
componObj,
|
|
299
|
-
data,
|
|
300
|
-
optionss,
|
|
301
|
-
compons
|
|
302
|
-
);
|
|
303
|
-
} else if (typeof obj.compon == "function") {
|
|
304
|
-
return obj.compon(componObj);
|
|
305
|
-
} else if (isVNode(obj.compon)) {
|
|
306
|
-
return obj.compon;
|
|
307
|
-
} else {
|
|
308
|
-
return h(obj.compon, componObj);
|
|
309
|
-
}
|
|
330
|
+
const componObj = getComponObj(value, obj, data, options, emit, scope);
|
|
331
|
+
return useGetCompon(obj.compon, componObj, obj, compons, value);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function useGetCompon(compon, componObj, obj, compons, value) {
|
|
335
|
+
if (typeof compon == "string") {
|
|
336
|
+
return setComponString(value, obj, componObj, compons);
|
|
337
|
+
} else if (typeof compon == "function") {
|
|
338
|
+
return compon(componObj, setSlots(obj));
|
|
339
|
+
} else if (isVNode(compon)) {
|
|
340
|
+
return compon;
|
|
341
|
+
} else {
|
|
342
|
+
return h(compon, componObj, setSlots(obj));
|
|
310
343
|
}
|
|
311
344
|
}
|
|
312
345
|
const useGetDomValue = (obj, data, options, index) => {
|
|
@@ -316,7 +349,7 @@ const useGetDomValue = (obj, data, options, index) => {
|
|
|
316
349
|
}
|
|
317
350
|
return value;
|
|
318
351
|
};
|
|
319
|
-
const useGetDomLabel = (obj, data, slots,
|
|
352
|
+
const useGetDomLabel = (obj, data, slots, options, compons, emit, index) => {
|
|
320
353
|
const label = obj.label;
|
|
321
354
|
if (!label) {
|
|
322
355
|
return label;
|
|
@@ -331,48 +364,46 @@ const useGetDomLabel = (obj, data, slots, optionss, compons, emit, index) => {
|
|
|
331
364
|
return label;
|
|
332
365
|
}
|
|
333
366
|
if (Array.isArray(label)) {
|
|
334
|
-
return renderLabelArray(label, data,
|
|
367
|
+
return renderLabelArray(label, data, options, compons, emit, index);
|
|
335
368
|
}
|
|
336
|
-
return
|
|
337
|
-
|
|
338
|
-
data,
|
|
339
|
-
slots,
|
|
340
|
-
optionss,
|
|
369
|
+
return useVNodeComponDom(label, data, slots, emit, {
|
|
370
|
+
options,
|
|
341
371
|
compons,
|
|
342
|
-
emit,
|
|
343
372
|
index
|
|
344
|
-
);
|
|
373
|
+
});
|
|
345
374
|
};
|
|
346
|
-
const renderLabelArray = (labels, data,
|
|
375
|
+
const renderLabelArray = (labels, data, options, compons, emit, index) => {
|
|
347
376
|
return h(
|
|
348
377
|
"div",
|
|
349
378
|
{ class: "com-lable-array" },
|
|
350
379
|
labels.map((v) => {
|
|
351
380
|
const labelObj = typeof v === "string" ? { value: v, compon: "div" } : v;
|
|
352
|
-
return useSetCompon(labelObj, data,
|
|
381
|
+
return useSetCompon(labelObj, data, options, compons, emit, index);
|
|
353
382
|
})
|
|
354
383
|
);
|
|
355
384
|
};
|
|
356
|
-
|
|
357
|
-
const
|
|
385
|
+
function useVNodeComponDom(obj, data, slots, emit, config) {
|
|
386
|
+
const { options, compons, index, scope } = config;
|
|
387
|
+
const slot = useSetSlot(obj, data, slots, options, emit, index, scope);
|
|
358
388
|
if (slot) {
|
|
359
389
|
return slot;
|
|
360
390
|
}
|
|
361
|
-
if (
|
|
391
|
+
if (obj.compon) {
|
|
362
392
|
const column = useSetCompon(
|
|
363
|
-
|
|
393
|
+
obj,
|
|
364
394
|
data,
|
|
365
|
-
|
|
395
|
+
options,
|
|
366
396
|
compons,
|
|
367
397
|
emit,
|
|
368
|
-
index
|
|
398
|
+
index,
|
|
399
|
+
scope
|
|
369
400
|
);
|
|
370
401
|
if (column) {
|
|
371
402
|
return column;
|
|
372
403
|
}
|
|
373
404
|
}
|
|
374
|
-
return useGetDomValue(
|
|
375
|
-
}
|
|
405
|
+
return useGetDomValue(obj, data, options, index);
|
|
406
|
+
}
|
|
376
407
|
function useObjComponSelected(obj, props) {
|
|
377
408
|
const arrs = [obj];
|
|
378
409
|
getFathers(obj, arrs);
|
|
@@ -415,6 +446,19 @@ function getLabelText(obj) {
|
|
|
415
446
|
if (obj.labelText) {
|
|
416
447
|
return obj.labelText;
|
|
417
448
|
}
|
|
449
|
+
if (!obj.label) {
|
|
450
|
+
const farrs = [];
|
|
451
|
+
getFathers(obj, farrs);
|
|
452
|
+
farrs.reverse();
|
|
453
|
+
for (const v of farrs) {
|
|
454
|
+
if (v.labelText) {
|
|
455
|
+
return v.labelText;
|
|
456
|
+
} else if (v.label) {
|
|
457
|
+
obj = v;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
418
462
|
const label = useGetDomLabel(obj, {}, {}, {}, {}, () => {
|
|
419
463
|
}, 0);
|
|
420
464
|
if (isVNode(label)) {
|
|
@@ -424,11 +468,13 @@ function getLabelText(obj) {
|
|
|
424
468
|
}
|
|
425
469
|
}
|
|
426
470
|
export {
|
|
471
|
+
getComponObj,
|
|
427
472
|
getFormRule,
|
|
428
473
|
getLabelText,
|
|
429
474
|
getOnObjs,
|
|
430
475
|
getVNodeContent,
|
|
431
476
|
setFormDefaultValue,
|
|
477
|
+
useGetCompon,
|
|
432
478
|
useGetDomLabel,
|
|
433
479
|
useGetDomValue,
|
|
434
480
|
useHide,
|
|
@@ -438,5 +484,6 @@ export {
|
|
|
438
484
|
useSetCompon,
|
|
439
485
|
useSetSlot,
|
|
440
486
|
useSetValue,
|
|
487
|
+
useVNodeComponDom,
|
|
441
488
|
useVueValue
|
|
442
489
|
};
|
|
@@ -71,8 +71,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
71
71
|
}
|
|
72
72
|
function getArrKyeObj(arr, key, value) {
|
|
73
73
|
if (arr) {
|
|
74
|
-
for (
|
|
75
|
-
const element = arr[index2];
|
|
74
|
+
for (const element of arr) {
|
|
76
75
|
if (element[key] === value) {
|
|
77
76
|
return element;
|
|
78
77
|
}
|
|
@@ -69,8 +69,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
69
|
}
|
|
70
70
|
function getArrKyeObj(arr, key, value) {
|
|
71
71
|
if (arr) {
|
|
72
|
-
for (
|
|
73
|
-
const element = arr[index];
|
|
72
|
+
for (const element of arr) {
|
|
74
73
|
if (element[key] === value) {
|
|
75
74
|
return element;
|
|
76
75
|
}
|
|
@@ -201,9 +201,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
201
201
|
clearTimeout(timeout);
|
|
202
202
|
}
|
|
203
203
|
vue.onMounted(() => {
|
|
204
|
-
if (
|
|
204
|
+
if (globalThis) {
|
|
205
205
|
console.log("onMounted");
|
|
206
|
-
|
|
206
|
+
globalThis.addEventListener("click", () => {
|
|
207
207
|
console.log("click");
|
|
208
208
|
isfocus.value = false;
|
|
209
209
|
});
|
|
@@ -199,9 +199,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
199
199
|
clearTimeout(timeout);
|
|
200
200
|
}
|
|
201
201
|
onMounted(() => {
|
|
202
|
-
if (
|
|
202
|
+
if (globalThis) {
|
|
203
203
|
console.log("onMounted");
|
|
204
|
-
|
|
204
|
+
globalThis.addEventListener("click", () => {
|
|
205
205
|
console.log("click");
|
|
206
206
|
isfocus.value = false;
|
|
207
207
|
});
|
|
@@ -49,6 +49,24 @@
|
|
|
49
49
|
display: grid;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
.forms-items {
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
.forms-items.row {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
}
|
|
59
|
+
.forms-items.column {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
}
|
|
63
|
+
.forms-items-li.no-error {
|
|
64
|
+
--el-color-danger: var(--el-border-color);
|
|
65
|
+
}
|
|
66
|
+
.forms-items-li.no-error .el-input__wrapper.is-focus {
|
|
67
|
+
--el-color-danger: var(--el-input-focus-border);
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
.double {
|
|
53
71
|
width: 100%;
|
|
54
72
|
display: inline-flex;
|
|
@@ -44,6 +44,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
44
44
|
function setKey(value, index2) {
|
|
45
45
|
return [index2, value.label, value.prop, value.compon].join(",");
|
|
46
46
|
}
|
|
47
|
+
const onUpform = (...arr) => emit("upform", ...arr);
|
|
47
48
|
__expose({
|
|
48
49
|
/**
|
|
49
50
|
* @expose { Element } dom
|
|
@@ -104,7 +105,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
104
105
|
"label-position": vue.unref(props).labelPosition == "auto" ? void 0 : vue.unref(props).labelPosition,
|
|
105
106
|
ref_key: "refForm",
|
|
106
107
|
ref: refForm,
|
|
107
|
-
onSubmit: _cache[
|
|
108
|
+
onSubmit: _cache[2] || (_cache[2] = vue.withModifiers(() => {
|
|
108
109
|
}, ["prevent"]))
|
|
109
110
|
}), {
|
|
110
111
|
default: vue.withCtx(() => [
|
|
@@ -122,11 +123,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
122
123
|
(item == null ? void 0 : item.isdiv) ? (vue.openBlock(), vue.createBlock(vue.unref(index$5.FormsDiv), {
|
|
123
124
|
key: 0,
|
|
124
125
|
listobj: item,
|
|
126
|
+
index: [index2],
|
|
125
127
|
optionss: vue.unref(props).options,
|
|
126
128
|
valueobj: vue.unref(dataForm),
|
|
127
129
|
modelValue: vue.unref(dataForm),
|
|
128
130
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(dataForm) ? dataForm.value = $event : null),
|
|
129
|
-
onUpform
|
|
131
|
+
onUpform
|
|
130
132
|
}, vue.createSlots({ _: 2 }, [
|
|
131
133
|
vue.renderList(Object.keys(vue.unref(slots)), (k) => {
|
|
132
134
|
return {
|
|
@@ -136,14 +138,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
136
138
|
])
|
|
137
139
|
};
|
|
138
140
|
})
|
|
139
|
-
]), 1032, ["listobj", "optionss", "valueobj", "modelValue"])) : (vue.openBlock(), vue.createBlock(vue.unref(index$6.FormsItem), {
|
|
141
|
+
]), 1032, ["listobj", "index", "optionss", "valueobj", "modelValue"])) : (vue.openBlock(), vue.createBlock(vue.unref(index$6.FormsItem), {
|
|
140
142
|
key: 1,
|
|
141
143
|
listobj: item,
|
|
144
|
+
index: [index2],
|
|
142
145
|
optionss: vue.unref(props).options,
|
|
143
146
|
valueobj: vue.unref(dataForm),
|
|
144
147
|
modelValue: vue.unref(dataForm),
|
|
145
|
-
"onUpdate:modelValue": _cache[
|
|
146
|
-
onUpform
|
|
148
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(dataForm) ? dataForm.value = $event : null),
|
|
149
|
+
onUpform
|
|
147
150
|
}, vue.createSlots({ _: 2 }, [
|
|
148
151
|
vue.renderList(Object.keys(vue.unref(slots)), (k) => {
|
|
149
152
|
return {
|
|
@@ -153,7 +156,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
153
156
|
])
|
|
154
157
|
};
|
|
155
158
|
})
|
|
156
|
-
]), 1032, ["listobj", "optionss", "valueobj", "modelValue"]))
|
|
159
|
+
]), 1032, ["listobj", "index", "optionss", "valueobj", "modelValue"]))
|
|
157
160
|
], 6)), [
|
|
158
161
|
[vue.vShow, !vue.unref(use.useHide)(item, vue.unref(dataForm))]
|
|
159
162
|
]);
|
|
@@ -42,6 +42,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
42
42
|
function setKey(value, index) {
|
|
43
43
|
return [index, value.label, value.prop, value.compon].join(",");
|
|
44
44
|
}
|
|
45
|
+
const onUpform = (...arr) => emit("upform", ...arr);
|
|
45
46
|
__expose({
|
|
46
47
|
/**
|
|
47
48
|
* @expose { Element } dom
|
|
@@ -102,7 +103,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
102
103
|
"label-position": unref(props).labelPosition == "auto" ? void 0 : unref(props).labelPosition,
|
|
103
104
|
ref_key: "refForm",
|
|
104
105
|
ref: refForm,
|
|
105
|
-
onSubmit: _cache[
|
|
106
|
+
onSubmit: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
106
107
|
}, ["prevent"]))
|
|
107
108
|
}), {
|
|
108
109
|
default: withCtx(() => [
|
|
@@ -120,11 +121,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
120
121
|
(item == null ? void 0 : item.isdiv) ? (openBlock(), createBlock(unref(FormsDiv), {
|
|
121
122
|
key: 0,
|
|
122
123
|
listobj: item,
|
|
124
|
+
index: [index],
|
|
123
125
|
optionss: unref(props).options,
|
|
124
126
|
valueobj: unref(dataForm),
|
|
125
127
|
modelValue: unref(dataForm),
|
|
126
128
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(dataForm) ? dataForm.value = $event : null),
|
|
127
|
-
onUpform
|
|
129
|
+
onUpform
|
|
128
130
|
}, createSlots({ _: 2 }, [
|
|
129
131
|
renderList(Object.keys(unref(slots)), (k) => {
|
|
130
132
|
return {
|
|
@@ -134,14 +136,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
134
136
|
])
|
|
135
137
|
};
|
|
136
138
|
})
|
|
137
|
-
]), 1032, ["listobj", "optionss", "valueobj", "modelValue"])) : (openBlock(), createBlock(unref(FormsItem), {
|
|
139
|
+
]), 1032, ["listobj", "index", "optionss", "valueobj", "modelValue"])) : (openBlock(), createBlock(unref(FormsItem), {
|
|
138
140
|
key: 1,
|
|
139
141
|
listobj: item,
|
|
142
|
+
index: [index],
|
|
140
143
|
optionss: unref(props).options,
|
|
141
144
|
valueobj: unref(dataForm),
|
|
142
145
|
modelValue: unref(dataForm),
|
|
143
|
-
"onUpdate:modelValue": _cache[
|
|
144
|
-
onUpform
|
|
146
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(dataForm) ? dataForm.value = $event : null),
|
|
147
|
+
onUpform
|
|
145
148
|
}, createSlots({ _: 2 }, [
|
|
146
149
|
renderList(Object.keys(unref(slots)), (k) => {
|
|
147
150
|
return {
|
|
@@ -151,7 +154,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
151
154
|
])
|
|
152
155
|
};
|
|
153
156
|
})
|
|
154
|
-
]), 1032, ["listobj", "optionss", "valueobj", "modelValue"]))
|
|
157
|
+
]), 1032, ["listobj", "index", "optionss", "valueobj", "modelValue"]))
|
|
155
158
|
], 6)), [
|
|
156
159
|
[vShow, !unref(useHide)(item, unref(dataForm))]
|
|
157
160
|
]);
|
|
@@ -14,7 +14,7 @@ const Components = {
|
|
|
14
14
|
};
|
|
15
15
|
function setUp(props, emit, cs, refForm, getLocale) {
|
|
16
16
|
const buts = vue.computed(() => {
|
|
17
|
-
if (
|
|
17
|
+
if (props.buts === void 0) {
|
|
18
18
|
return [
|
|
19
19
|
{
|
|
20
20
|
_id: "2",
|
|
@@ -138,12 +138,9 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
138
138
|
return rules;
|
|
139
139
|
}
|
|
140
140
|
const dataRules = vue.ref(getRules());
|
|
141
|
-
vue.watch(
|
|
142
|
-
()
|
|
143
|
-
|
|
144
|
-
dataRules.value = getRules();
|
|
145
|
-
}
|
|
146
|
-
);
|
|
141
|
+
vue.watch([() => props.list, () => props.list.length], () => {
|
|
142
|
+
dataRules.value = getRules();
|
|
143
|
+
});
|
|
147
144
|
function validate() {
|
|
148
145
|
return new Promise((resolve, reject) => {
|
|
149
146
|
if (refForm.value) {
|
|
@@ -166,18 +163,18 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
166
163
|
if (callback) {
|
|
167
164
|
callback(list, true);
|
|
168
165
|
}
|
|
169
|
-
emit("submit", list);
|
|
170
|
-
}).catch((
|
|
166
|
+
emit("submit", list, true);
|
|
167
|
+
}).catch((error) => {
|
|
171
168
|
if (callback) {
|
|
172
|
-
callback(
|
|
169
|
+
callback(error, false);
|
|
173
170
|
}
|
|
174
|
-
emit("submit",
|
|
171
|
+
emit("submit", error, false);
|
|
175
172
|
});
|
|
176
173
|
} else {
|
|
177
174
|
if (callback) {
|
|
178
175
|
callback(obj);
|
|
179
176
|
}
|
|
180
|
-
emit("submit", obj);
|
|
177
|
+
emit("submit", obj, true, true);
|
|
181
178
|
}
|
|
182
179
|
}).catch(() => {
|
|
183
180
|
});
|
|
@@ -12,7 +12,7 @@ const Components = {
|
|
|
12
12
|
};
|
|
13
13
|
function setUp(props, emit, cs, refForm, getLocale) {
|
|
14
14
|
const buts = computed(() => {
|
|
15
|
-
if (
|
|
15
|
+
if (props.buts === void 0) {
|
|
16
16
|
return [
|
|
17
17
|
{
|
|
18
18
|
_id: "2",
|
|
@@ -136,12 +136,9 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
136
136
|
return rules;
|
|
137
137
|
}
|
|
138
138
|
const dataRules = ref(getRules());
|
|
139
|
-
watch(
|
|
140
|
-
()
|
|
141
|
-
|
|
142
|
-
dataRules.value = getRules();
|
|
143
|
-
}
|
|
144
|
-
);
|
|
139
|
+
watch([() => props.list, () => props.list.length], () => {
|
|
140
|
+
dataRules.value = getRules();
|
|
141
|
+
});
|
|
145
142
|
function validate() {
|
|
146
143
|
return new Promise((resolve, reject) => {
|
|
147
144
|
if (refForm.value) {
|
|
@@ -164,18 +161,18 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
164
161
|
if (callback) {
|
|
165
162
|
callback(list, true);
|
|
166
163
|
}
|
|
167
|
-
emit("submit", list);
|
|
168
|
-
}).catch((
|
|
164
|
+
emit("submit", list, true);
|
|
165
|
+
}).catch((error) => {
|
|
169
166
|
if (callback) {
|
|
170
|
-
callback(
|
|
167
|
+
callback(error, false);
|
|
171
168
|
}
|
|
172
|
-
emit("submit",
|
|
169
|
+
emit("submit", error, false);
|
|
173
170
|
});
|
|
174
171
|
} else {
|
|
175
172
|
if (callback) {
|
|
176
173
|
callback(obj);
|
|
177
174
|
}
|
|
178
|
-
emit("submit", obj);
|
|
175
|
+
emit("submit", obj, true, true);
|
|
179
176
|
}
|
|
180
177
|
}).catch(() => {
|
|
181
178
|
});
|