icarys-form-create-vant 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +21 -17787
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/package.json +5 -2
- package/src/components/common/subform/LICENSE +21 -0
- package/src/components/common/subform/README.md +6 -0
- package/src/components/common/subform/package.json +48 -0
- package/src/components/common/subform/src/component.jsx +75 -0
- package/src/components/common/subform/src/index.js +3 -0
- package/src/components/common/wangeditor/LICENSE +21 -0
- package/src/components/common/wangeditor/README.md +14 -0
- package/src/components/common/wangeditor/package-lock.json +114 -0
- package/src/components/common/wangeditor/package.json +52 -0
- package/src/components/common/wangeditor/src/component.jsx +74 -0
- package/src/components/common/wangeditor/src/index.js +3 -0
- package/src/core/LICENSE +21 -0
- package/src/core/README.md +120 -0
- package/src/core/babel.config.js +13 -0
- package/src/core/bili.config.js +34 -0
- package/src/core/package-lock.json +13 -0
- package/src/core/package.json +61 -0
- package/src/core/src/components/formCreate.js +287 -0
- package/src/core/src/components/fragment.js +12 -0
- package/src/core/src/factory/context.js +264 -0
- package/src/core/src/factory/creator.js +63 -0
- package/src/core/src/factory/maker.js +17 -0
- package/src/core/src/factory/manager.js +87 -0
- package/src/core/src/factory/node.js +89 -0
- package/src/core/src/factory/parser.js +28 -0
- package/src/core/src/frame/api.js +691 -0
- package/src/core/src/frame/attrs.js +12 -0
- package/src/core/src/frame/dataDriver.js +76 -0
- package/src/core/src/frame/fetch.js +128 -0
- package/src/core/src/frame/index.js +792 -0
- package/src/core/src/frame/language.js +50 -0
- package/src/core/src/frame/provider.js +297 -0
- package/src/core/src/frame/util.js +311 -0
- package/src/core/src/handler/context.js +573 -0
- package/src/core/src/handler/effect.js +122 -0
- package/src/core/src/handler/index.js +143 -0
- package/src/core/src/handler/inject.js +199 -0
- package/src/core/src/handler/input.js +199 -0
- package/src/core/src/handler/lifecycle.js +55 -0
- package/src/core/src/handler/loader.js +375 -0
- package/src/core/src/handler/page.js +46 -0
- package/src/core/src/handler/render.js +29 -0
- package/src/core/src/index.js +12 -0
- package/src/core/src/parser/html.js +17 -0
- package/src/core/src/render/cache.js +47 -0
- package/src/core/src/render/index.js +33 -0
- package/src/core/src/render/render.js +418 -0
- package/src/core/types/index.d.ts +842 -0
- package/src/index.js +5 -0
- package/src/utils/LICENSE +21 -0
- package/src/utils/README.md +24 -0
- package/src/utils/lib/console.js +16 -0
- package/src/utils/lib/debounce.js +9 -0
- package/src/utils/lib/deepextend.js +51 -0
- package/src/utils/lib/deepset.js +14 -0
- package/src/utils/lib/extend.js +20 -0
- package/src/utils/lib/index.js +14 -0
- package/src/utils/lib/json.js +90 -0
- package/src/utils/lib/mergeprops.js +62 -0
- package/src/utils/lib/mitt.js +43 -0
- package/src/utils/lib/modify.js +8 -0
- package/src/utils/lib/slot.js +8 -0
- package/src/utils/lib/toarray.js +5 -0
- package/src/utils/lib/tocase.js +11 -0
- package/src/utils/lib/todate.js +10 -0
- package/src/utils/lib/toline.js +10 -0
- package/src/utils/lib/topromise.js +10 -0
- package/src/utils/lib/tostring.js +7 -0
- package/src/utils/lib/type.js +45 -0
- package/src/utils/lib/unique.js +6 -0
- package/src/utils/package.json +32 -0
- package/src/vant/LICENSE +21 -0
- package/src/vant/README.md +137 -0
- package/src/vant/auto-import.d.ts +5 -0
- package/src/vant/auto-import.js +50 -0
- package/src/vant/babel.config.js +10 -0
- package/src/vant/bili.config.js +40 -0
- package/src/vant/examples/App.vue +96 -0
- package/src/vant/examples/main.js +13 -0
- package/src/vant/examples/rule.js +366 -0
- package/src/vant/package-lock.json +11367 -0
- package/src/vant/package.json +83 -0
- package/src/vant/public/index.html +14 -0
- package/src/vant/src/components/calendar.jsx +128 -0
- package/src/vant/src/components/cascader.jsx +120 -0
- package/src/vant/src/components/checkbox.jsx +38 -0
- package/src/vant/src/components/datePicker.jsx +87 -0
- package/src/vant/src/components/group.jsx +384 -0
- package/src/vant/src/components/icon/IconWarning.vue +12 -0
- package/src/vant/src/components/index.js +26 -0
- package/src/vant/src/components/radio.jsx +38 -0
- package/src/vant/src/components/select.jsx +81 -0
- package/src/vant/src/components/timePicker.jsx +76 -0
- package/src/vant/src/components/uploader.jsx +99 -0
- package/src/vant/src/core/alias.js +31 -0
- package/src/vant/src/core/api.js +135 -0
- package/src/vant/src/core/config.js +35 -0
- package/src/vant/src/core/index.js +45 -0
- package/src/vant/src/core/manager.js +282 -0
- package/src/vant/src/core/provider.js +63 -0
- package/src/vant/src/core/utils.js +15 -0
- package/src/vant/src/index.js +13 -0
- package/src/vant/src/parsers/hidden.js +12 -0
- package/src/vant/src/parsers/index.js +59 -0
- package/src/vant/src/parsers/row.js +10 -0
- package/src/vant/src/style/index.css +495 -0
- package/src/vant/types/config.d.ts +99 -0
- package/src/vant/types/index.d.ts +27 -0
- package/src/vant/vue.config.js +21 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import extend, {copy} from '@form-create/utils/lib/extend';
|
|
2
|
+
import mergeProps from '@form-create/utils/lib/mergeprops';
|
|
3
|
+
import is from '@form-create/utils/lib/type';
|
|
4
|
+
import {invoke, makeSlotBag, mergeRule} from '../frame/util';
|
|
5
|
+
import toCase, {lower} from '@form-create/utils/lib/tocase';
|
|
6
|
+
import {deepSet, toLine} from '@form-create/utils';
|
|
7
|
+
import {computed, nextTick} from 'vue';
|
|
8
|
+
|
|
9
|
+
export default function useRender(Render) {
|
|
10
|
+
extend(Render.prototype, {
|
|
11
|
+
initRender() {
|
|
12
|
+
this.cacheConfig = {};
|
|
13
|
+
},
|
|
14
|
+
getTypeSlot(ctx) {
|
|
15
|
+
const _fn = (vm) => {
|
|
16
|
+
if (vm) {
|
|
17
|
+
let slot = undefined;
|
|
18
|
+
if (ctx.rule.field) {
|
|
19
|
+
slot = vm.slots['field-' + toLine(ctx.rule.field)] || vm.slots['field-' + ctx.rule.field];
|
|
20
|
+
}
|
|
21
|
+
if (!slot) {
|
|
22
|
+
slot = vm.slots['type-' + toLine(ctx.type)] || vm.slots['type-' + ctx.type];
|
|
23
|
+
}
|
|
24
|
+
if (slot) {
|
|
25
|
+
return slot;
|
|
26
|
+
}
|
|
27
|
+
return _fn(vm.setupState.parent);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return _fn(this.vm);
|
|
31
|
+
},
|
|
32
|
+
render() {
|
|
33
|
+
// console.warn('renderrrrr', this.id);
|
|
34
|
+
if (!this.vm.setupState.isShow) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.$manager.beforeRender();
|
|
38
|
+
const slotBag = makeSlotBag();
|
|
39
|
+
this.sort.forEach((k) => {
|
|
40
|
+
this.renderSlot(slotBag, this.$handle.ctxs[k]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return this.$manager.render(slotBag);
|
|
44
|
+
},
|
|
45
|
+
renderSlot(slotBag, ctx, parent) {
|
|
46
|
+
if (this.isFragment(ctx)) {
|
|
47
|
+
ctx.initProp();
|
|
48
|
+
this.mergeGlobal(ctx);
|
|
49
|
+
ctx.initNone();
|
|
50
|
+
const slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
|
|
51
|
+
const def = slots.default;
|
|
52
|
+
def && slotBag.setSlot(ctx.rule.slot, () => def());
|
|
53
|
+
delete slots.default;
|
|
54
|
+
slotBag.mergeBag(slots);
|
|
55
|
+
} else {
|
|
56
|
+
slotBag.setSlot(ctx.rule.slot, this.renderCtx(ctx, parent));
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
mergeGlobal(ctx) {
|
|
60
|
+
const g = this.$handle.options.global;
|
|
61
|
+
if (!g) return;
|
|
62
|
+
if (!this.cacheConfig[ctx.trueType]) {
|
|
63
|
+
this.cacheConfig[ctx.trueType] = computed(() => {
|
|
64
|
+
const g = this.$handle.options.global;
|
|
65
|
+
return mergeRule({}, [g['*'] || g.default || {}, g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
|
|
69
|
+
},
|
|
70
|
+
setOptions(ctx) {
|
|
71
|
+
const opt = ctx.loadPending({key: 'options', origin: ctx.prop.options, def: []});
|
|
72
|
+
ctx.prop.options = opt;
|
|
73
|
+
if (ctx.prop.optionsTo && opt) {
|
|
74
|
+
deepSet(ctx.prop, ctx.prop.optionsTo, opt);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
deepSet(ctx) {
|
|
78
|
+
const deep = ctx.prop.deep;
|
|
79
|
+
deep && Object.keys(deep).sort((a, b) => a.length < b.length ? -1 : 1).forEach(str => {
|
|
80
|
+
deepSet(ctx.prop, str, deep[str]);
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
parseSide(side, ctx) {
|
|
84
|
+
return is.Object(side) ? mergeRule({props: {formCreateInject: ctx.prop.props.formCreateInject}}, side) : side;
|
|
85
|
+
},
|
|
86
|
+
renderSides(vn, ctx, temp) {
|
|
87
|
+
const prop = ctx[temp ? 'rule' : 'prop'];
|
|
88
|
+
return [this.renderRule(this.parseSide(prop.prefix, ctx)), vn, this.renderRule(this.parseSide(prop.suffix, ctx))];
|
|
89
|
+
},
|
|
90
|
+
renderId(name, type) {
|
|
91
|
+
const ctxs = this.$handle[type === 'field' ? 'fieldCtx' : 'nameCtx'][name]
|
|
92
|
+
return ctxs ? ctxs.map(ctx => this.renderCtx(ctx, ctx.parent)) : undefined;
|
|
93
|
+
},
|
|
94
|
+
renderCtx(ctx, parent) {
|
|
95
|
+
try {
|
|
96
|
+
if (ctx.type === 'hidden') return;
|
|
97
|
+
const rule = ctx.rule;
|
|
98
|
+
if (this.force || (!this.cache[ctx.id]) || this.cache[ctx.id].slot !== rule.slot) {
|
|
99
|
+
let vn;
|
|
100
|
+
ctx.initProp();
|
|
101
|
+
this.mergeGlobal(ctx);
|
|
102
|
+
ctx.initNone();
|
|
103
|
+
this.$manager.tidyRule(ctx);
|
|
104
|
+
this.deepSet(ctx);
|
|
105
|
+
this.setOptions(ctx);
|
|
106
|
+
this.ctxProp(ctx);
|
|
107
|
+
let prop = ctx.prop;
|
|
108
|
+
prop.preview = !!(prop.preview != null ? prop.preview : this.$handle.preview);
|
|
109
|
+
prop.props.formCreateInject = this.injectProp(ctx);
|
|
110
|
+
let cacheFlag = prop.cache !== false;
|
|
111
|
+
const preview = prop.preview;
|
|
112
|
+
|
|
113
|
+
if (prop.hidden) {
|
|
114
|
+
this.setCache(ctx, undefined, parent);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
vn = (...slotValue) => {
|
|
118
|
+
const inject = {
|
|
119
|
+
rule,
|
|
120
|
+
prop,
|
|
121
|
+
preview,
|
|
122
|
+
api: this.$handle.api,
|
|
123
|
+
model: prop.model || {},
|
|
124
|
+
slotValue
|
|
125
|
+
}
|
|
126
|
+
if (slotValue.length && rule.slotUpdate) {
|
|
127
|
+
invoke(() => rule.slotUpdate(inject))
|
|
128
|
+
}
|
|
129
|
+
let children = {};
|
|
130
|
+
const _load = ctx.loadChildrenPending();
|
|
131
|
+
if (ctx.parser.renderChildren) {
|
|
132
|
+
children = ctx.parser.renderChildren(_load, ctx);
|
|
133
|
+
} else if (ctx.parser.loadChildren !== false) {
|
|
134
|
+
children = this.renderChildren(_load, ctx);
|
|
135
|
+
}
|
|
136
|
+
Object.keys(prop.renderSlots || {}).forEach(key => {
|
|
137
|
+
children[key] = (...args) => {
|
|
138
|
+
if (is.Function(prop.renderSlots[key])) {
|
|
139
|
+
return invoke(() => prop.renderSlots[key](...args));
|
|
140
|
+
}
|
|
141
|
+
const rule = this.parseSide(prop.renderSlots[key], ctx);
|
|
142
|
+
return this.renderRule(rule);
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
const slot = this.getTypeSlot(ctx);
|
|
146
|
+
let _vn;
|
|
147
|
+
if (slot) {
|
|
148
|
+
inject.children = children;
|
|
149
|
+
_vn = slot(inject)
|
|
150
|
+
} else {
|
|
151
|
+
_vn = preview ? ctx.parser.preview(copy(children), ctx) : ctx.parser.render(copy(children), ctx);
|
|
152
|
+
}
|
|
153
|
+
_vn = this.renderSides(_vn, ctx);
|
|
154
|
+
if ((!(!ctx.input && is.Undef(prop.native))) && prop.native !== true) {
|
|
155
|
+
this.fc.targetFormDriver('updateWrap', ctx)
|
|
156
|
+
_vn = this.$manager.makeWrap(ctx, _vn);
|
|
157
|
+
}
|
|
158
|
+
if (ctx.none) {
|
|
159
|
+
if (Array.isArray(_vn)) {
|
|
160
|
+
_vn = _vn.map(v => {
|
|
161
|
+
if (!v || !v.__v_isVNode) {
|
|
162
|
+
return v;
|
|
163
|
+
}
|
|
164
|
+
return this.none(v);
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
_vn = this.none(_vn);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
cacheFlag && this.setCache(ctx, () => {
|
|
171
|
+
return this.stable(_vn);
|
|
172
|
+
}, parent);
|
|
173
|
+
return _vn
|
|
174
|
+
};
|
|
175
|
+
this.setCache(ctx, vn, parent);
|
|
176
|
+
}
|
|
177
|
+
return (...args) => {
|
|
178
|
+
const cache = this.getCache(ctx);
|
|
179
|
+
if (cache) {
|
|
180
|
+
return cache(...args);
|
|
181
|
+
} else if (this.cache[ctx.id]) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const _vn = this.renderCtx(ctx, ctx.parent);
|
|
185
|
+
if (_vn) {
|
|
186
|
+
return _vn();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
} catch (e) {
|
|
190
|
+
console.error(e);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
none(vn) {
|
|
195
|
+
if (vn) {
|
|
196
|
+
vn.props.class = this.mergeClass(vn.props.class, 'fc-none')
|
|
197
|
+
return vn;
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
mergeClass(target, value) {
|
|
201
|
+
if (Array.isArray(target)) {
|
|
202
|
+
target.push(value);
|
|
203
|
+
} else {
|
|
204
|
+
return target ? [target, value] : value;
|
|
205
|
+
}
|
|
206
|
+
return target;
|
|
207
|
+
},
|
|
208
|
+
stable(vn) {
|
|
209
|
+
const list = Array.isArray(vn) ? vn : [vn];
|
|
210
|
+
list.forEach(v => {
|
|
211
|
+
if (v && v.__v_isVNode && v.children && typeof v.children === 'object') {
|
|
212
|
+
v.children.$stable = true;
|
|
213
|
+
this.stable(v.children);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
return vn;
|
|
217
|
+
},
|
|
218
|
+
getModelField(ctx) {
|
|
219
|
+
return ctx.prop.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.type]] || this.fc.modelFields[ctx.type] || this.fc.modelFields[ctx.originType] || 'modelValue';
|
|
220
|
+
},
|
|
221
|
+
isFragment(ctx) {
|
|
222
|
+
return ctx.type === 'fragment' || ctx.type === 'template';
|
|
223
|
+
},
|
|
224
|
+
injectProp(ctx) {
|
|
225
|
+
const state = this.vm.setupState;
|
|
226
|
+
if (!state.ctxInject[ctx.id]) {
|
|
227
|
+
state.ctxInject[ctx.id] = {
|
|
228
|
+
api: this.$handle.api,
|
|
229
|
+
form: this.fc.create,
|
|
230
|
+
subForm: subForm => {
|
|
231
|
+
this.$handle.addSubForm(ctx, subForm);
|
|
232
|
+
},
|
|
233
|
+
getSubForm: () => {
|
|
234
|
+
return this.$handle.subForm[ctx.id];
|
|
235
|
+
},
|
|
236
|
+
slots: () => {
|
|
237
|
+
return this.vm.setupState.top.slots;
|
|
238
|
+
},
|
|
239
|
+
getWrap: () => {
|
|
240
|
+
return this.vm.refs[ctx.wrapRef];
|
|
241
|
+
},
|
|
242
|
+
options: [],
|
|
243
|
+
children: [],
|
|
244
|
+
preview: false,
|
|
245
|
+
id: ctx.id,
|
|
246
|
+
field: ctx.field,
|
|
247
|
+
rule: ctx.rule,
|
|
248
|
+
input: ctx.input,
|
|
249
|
+
t: (...args) => {
|
|
250
|
+
return this.$handle.api.t(...args);
|
|
251
|
+
},
|
|
252
|
+
updateValue: (data) => {
|
|
253
|
+
this.$handle.onUpdateValue(ctx, data);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const inject = state.ctxInject[ctx.id];
|
|
258
|
+
extend(inject, {
|
|
259
|
+
preview: ctx.prop.preview,
|
|
260
|
+
options: ctx.prop.options,
|
|
261
|
+
children: ctx.loadChildrenPending()
|
|
262
|
+
});
|
|
263
|
+
return inject;
|
|
264
|
+
},
|
|
265
|
+
ctxProp(ctx) {
|
|
266
|
+
const {ref, key, rule} = ctx;
|
|
267
|
+
this.$manager.mergeProp(ctx);
|
|
268
|
+
ctx.parser.mergeProp(ctx);
|
|
269
|
+
const props = [
|
|
270
|
+
{
|
|
271
|
+
ref: ref,
|
|
272
|
+
key: rule.key || `${key}fc`,
|
|
273
|
+
slot: undefined,
|
|
274
|
+
on: {
|
|
275
|
+
vnodeMounted: (vn) => {
|
|
276
|
+
vn.el.__rule__ = ctx.rule;
|
|
277
|
+
this.onMounted(ctx, vn.el);
|
|
278
|
+
},
|
|
279
|
+
'fc.updateValue': (data) => {
|
|
280
|
+
this.$handle.onUpdateValue(ctx, data);
|
|
281
|
+
},
|
|
282
|
+
'fc.el': (el) => {
|
|
283
|
+
ctx.exportEl = el;
|
|
284
|
+
if (el) {
|
|
285
|
+
(el.$el || el).__rule__ = ctx.rule;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
|
|
292
|
+
if (ctx.input) {
|
|
293
|
+
const tmpInput = this.tmpInput;
|
|
294
|
+
if (this.vm.props.disabled === true) {
|
|
295
|
+
ctx.prop.props.disabled = true;
|
|
296
|
+
}
|
|
297
|
+
const field = this.getModelField(ctx);
|
|
298
|
+
const model = {
|
|
299
|
+
callback: (value) => {
|
|
300
|
+
tmpInput && tmpInput(ctx.field, value, ctx.rule);
|
|
301
|
+
this.onInput(ctx, value);
|
|
302
|
+
},
|
|
303
|
+
modelField: field,
|
|
304
|
+
value: this.$handle.getFormData(ctx)
|
|
305
|
+
};
|
|
306
|
+
props.push({
|
|
307
|
+
on: {
|
|
308
|
+
[`update:${field}`]: model.callback,
|
|
309
|
+
...(ctx.prop.modelEmit ? {
|
|
310
|
+
[ctx.prop.modelEmit]: () => this.onEmitInput(ctx)
|
|
311
|
+
} : {}),
|
|
312
|
+
},
|
|
313
|
+
props: {
|
|
314
|
+
[field]: model.value
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
ctx.prop.model = model;
|
|
318
|
+
}
|
|
319
|
+
mergeProps(props, ctx.prop);
|
|
320
|
+
return ctx.prop;
|
|
321
|
+
},
|
|
322
|
+
onMounted(ctx, el) {
|
|
323
|
+
ctx.el = this.vm.refs[ctx.ref] || el;
|
|
324
|
+
ctx.parser.mounted(ctx);
|
|
325
|
+
this.$handle.effect(ctx, 'mounted');
|
|
326
|
+
this.$handle.targetHook(ctx, 'mounted');
|
|
327
|
+
},
|
|
328
|
+
onInput(ctx, value) {
|
|
329
|
+
if (ctx.prop.modelEmit) {
|
|
330
|
+
this.$handle.onBaseInput(ctx, value);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
this.$handle.onInput(ctx, value);
|
|
334
|
+
},
|
|
335
|
+
onEmitInput(ctx) {
|
|
336
|
+
this.$handle.setValue(ctx, ctx.parser.toValue(ctx.modelValue, ctx), ctx.modelValue);
|
|
337
|
+
},
|
|
338
|
+
renderChildren(children, ctx) {
|
|
339
|
+
if (!is.trueArray(children)) return {};
|
|
340
|
+
const slotBag = makeSlotBag()
|
|
341
|
+
children.map(child => {
|
|
342
|
+
if (!child) return;
|
|
343
|
+
if (is.String(child) || is.Number(child)) return slotBag.setSlot(null, `${child}`);
|
|
344
|
+
if (child.__fc__) {
|
|
345
|
+
return this.renderSlot(slotBag, child.__fc__, ctx);
|
|
346
|
+
}
|
|
347
|
+
if (child.type) {
|
|
348
|
+
nextTick(() => {
|
|
349
|
+
this.$handle.loadChildren(children, ctx);
|
|
350
|
+
this.$handle.refresh();
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
return slotBag.getSlots();
|
|
355
|
+
},
|
|
356
|
+
defaultRender(ctx, children) {
|
|
357
|
+
const prop = ctx.prop;
|
|
358
|
+
if (prop.component) {
|
|
359
|
+
if (typeof prop.component === 'string') {
|
|
360
|
+
return this.vNode.make(prop.component, prop, children);
|
|
361
|
+
} else {
|
|
362
|
+
return this.vNode.makeComponent(prop.component, prop, children);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (this.vNode[ctx.type])
|
|
366
|
+
return this.vNode[ctx.type](prop, children);
|
|
367
|
+
if (this.vNode[ctx.originType])
|
|
368
|
+
return this.vNode[ctx.originType](prop, children);
|
|
369
|
+
return this.vNode.make(lower(prop.type), prop, children);
|
|
370
|
+
},
|
|
371
|
+
createChildrenVnodes(ctx, onInput, force) {
|
|
372
|
+
this.force = force !== false;
|
|
373
|
+
this.tmpInput = onInput;
|
|
374
|
+
const res = this.renderChildren(ctx.rule.children, ctx);
|
|
375
|
+
this.force = false;
|
|
376
|
+
this.tmpInput = null;
|
|
377
|
+
return res;
|
|
378
|
+
},
|
|
379
|
+
createRuleVnode(ctx, onInput, force) {
|
|
380
|
+
this.force = force !== false;
|
|
381
|
+
this.tmpInput = onInput;
|
|
382
|
+
const slotBag = makeSlotBag();
|
|
383
|
+
this.renderSlot(slotBag, ctx, ctx.parent);
|
|
384
|
+
this.force = false;
|
|
385
|
+
this.tmpInput = null;
|
|
386
|
+
return slotBag.getSlots();
|
|
387
|
+
},
|
|
388
|
+
renderRule(rule, children, origin) {
|
|
389
|
+
if (!rule) return undefined;
|
|
390
|
+
if (is.String(rule) || is.Number(rule)) return `${rule}`;
|
|
391
|
+
|
|
392
|
+
let type;
|
|
393
|
+
if (origin) {
|
|
394
|
+
type = rule.type;
|
|
395
|
+
} else {
|
|
396
|
+
type = rule.is;
|
|
397
|
+
if (rule.type) {
|
|
398
|
+
type = toCase(rule.type);
|
|
399
|
+
const alias = this.vNode.aliasMap[type];
|
|
400
|
+
if (alias) type = toCase(alias);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (!type) return undefined;
|
|
405
|
+
|
|
406
|
+
const slotBag = makeSlotBag();
|
|
407
|
+
if (is.trueArray(rule.children)) {
|
|
408
|
+
rule.children.forEach(v => {
|
|
409
|
+
v && slotBag.setSlot(v?.slot, () => this.renderRule(v));
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
const props = {...rule};
|
|
413
|
+
delete props.type;
|
|
414
|
+
delete props.is;
|
|
415
|
+
return this.vNode.make(type, props, slotBag.mergeBag(children).getSlots());
|
|
416
|
+
}
|
|
417
|
+
})
|
|
418
|
+
}
|