resolver-egretimp-plus 0.1.142 → 0.1.144
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/h5/index.js +2 -2
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/analysisComponent.jsx +95 -41
- package/src/rules/parseCondition.js +1 -1
- package/src/utils/render.jsx +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, defineAsyncComponent, getCurrentInstance, inject, onBeforeMount, provide, ref, Teleport, watch } from 'vue'
|
|
2
|
-
import { COFNGI_KEY_EVENT_FLAG, commonPropsType, definePrivatelyProp, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, getComponentPropsKeys, getComponentSolt, hasOwn, isFunction, isPlainObject } from './utils/index.js'
|
|
2
|
+
import { calcDisable, COFNGI_KEY_EVENT_FLAG, commonPropsType, definePrivatelyProp, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, getComponentPropsKeys, getComponentSolt, hasOwn, isChainHidden, isFunction, isPlainColumn, isPlainObject } from './utils/index.js'
|
|
3
3
|
import { useVmodels } from './hooks/index.js'
|
|
4
4
|
import { getRenderComponentProps, generateFormItemPolyfill } from './utils/index.js'
|
|
5
5
|
import rulesDriver, { recoverCb } from './rules/rulesDriver'
|
|
@@ -264,57 +264,111 @@ export default {
|
|
|
264
264
|
provide('parent', props.config)
|
|
265
265
|
|
|
266
266
|
if (OPEN_DATA_RULES) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
267
|
+
// 改了什么配置那就需要进行备份;这个只是自定义组件需要;如果自定义组件是容器,容器里面的组件开始还是使用原来的定义
|
|
268
|
+
const originAddField = formContext.originAddField || formContext.addField
|
|
269
|
+
const originRemoveField = formContext.originRemoveField || formContext.removeField
|
|
270
|
+
if (!_isH5?.value) {
|
|
271
|
+
if (props.config.renderby) {
|
|
272
|
+
provide(formContextKey, reactive({
|
|
273
|
+
...formContext,
|
|
274
|
+
originAddField,
|
|
275
|
+
addField(field) {
|
|
276
|
+
if (!props.config?._formFields) {
|
|
277
|
+
definePrivatelyProp(props.config, '_formFields', [])
|
|
278
|
+
}
|
|
279
|
+
const originValidate = field.validate
|
|
280
|
+
field.validate = function (...arg) {
|
|
281
|
+
if (!assertNeedToValid()) {
|
|
282
|
+
return
|
|
283
|
+
}
|
|
284
|
+
return originValidate.apply(this, arg)
|
|
285
|
+
}
|
|
286
|
+
props.config?._formFields?.push(field)
|
|
287
|
+
formContext.addField(field)
|
|
288
|
+
},
|
|
289
|
+
originRemoveField,
|
|
290
|
+
removeField(field) {
|
|
291
|
+
const fields = props.config?._formFields
|
|
292
|
+
if (field.prop && fields) {
|
|
293
|
+
const idx = fields.indexOf(field)
|
|
294
|
+
if (idx !== -1) {
|
|
295
|
+
fields.splice(idx, 1)
|
|
296
|
+
}
|
|
283
297
|
}
|
|
298
|
+
formContext.removeField(field)
|
|
284
299
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
300
|
+
}))
|
|
301
|
+
} else {
|
|
302
|
+
provide(formContextKey, reactive({
|
|
303
|
+
...formContext,
|
|
304
|
+
originAddField,
|
|
305
|
+
addField(...arg) {
|
|
306
|
+
return originAddField?.apply(this, arg)
|
|
307
|
+
},
|
|
308
|
+
originRemoveField,
|
|
309
|
+
removeField(...arg) {
|
|
310
|
+
return originRemoveField?.apply(this, arg)
|
|
311
|
+
}
|
|
312
|
+
}))
|
|
313
|
+
}
|
|
288
314
|
}
|
|
289
315
|
} else {
|
|
316
|
+
// 改了什么配置那就需要进行备份;这个只是自定义组件需要;如果自定义组件是容器,容器里面的组件开始还是使用原来的定义
|
|
317
|
+
const originAddField = formContext.originAddField || formContext.addField
|
|
290
318
|
// 在自定义组件中使用 form-item 进行声明的校验,这边进行兼容,可以在校验住的时候支持跳转
|
|
291
|
-
if (!_isH5?.value
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
field.validate
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
// 在自定义组件中form-item 校验失败之后,err 中绑定的 prop 属性手动替换成config 的dynamicHireRelat
|
|
303
|
-
const copyVal = err[key]
|
|
304
|
-
delete err[key]
|
|
305
|
-
err[props.config.dynamicHireRelat] = copyVal
|
|
306
|
-
})
|
|
319
|
+
if (!_isH5?.value) {
|
|
320
|
+
if (props.config.renderby) {
|
|
321
|
+
provide(formContextKey, reactive({
|
|
322
|
+
...formContext,
|
|
323
|
+
originAddField,
|
|
324
|
+
addField(field) {
|
|
325
|
+
if (field.validate && isFunction(field.validate)) {
|
|
326
|
+
const originValidate = field.validate
|
|
327
|
+
field.validate = function (...arg) {
|
|
328
|
+
if (!assertNeedToValid()) {
|
|
329
|
+
return
|
|
307
330
|
}
|
|
308
|
-
|
|
309
|
-
|
|
331
|
+
const ret = originValidate.apply(this, arg)
|
|
332
|
+
return ret?.then(ret => ret)?.catch(err => {
|
|
333
|
+
debugger
|
|
334
|
+
if (isPlainObject(err)) {
|
|
335
|
+
Object.keys(err).forEach(key => {
|
|
336
|
+
// 在自定义组件中form-item 校验失败之后,err 中绑定的 prop 属性手动替换成config 的dynamicHireRelat
|
|
337
|
+
const copyVal = err[key]
|
|
338
|
+
delete err[key]
|
|
339
|
+
err[props.config.dynamicHireRelat] = copyVal
|
|
340
|
+
})
|
|
341
|
+
}
|
|
342
|
+
return Promise.reject(err)
|
|
343
|
+
}) || true
|
|
344
|
+
}
|
|
310
345
|
}
|
|
346
|
+
formContext.addField(field)
|
|
311
347
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
348
|
+
}))
|
|
349
|
+
} else {
|
|
350
|
+
provide(formContextKey, reactive({
|
|
351
|
+
...formContext,
|
|
352
|
+
originAddField,
|
|
353
|
+
addField(...arg) {
|
|
354
|
+
return originAddField?.apply(this, arg)
|
|
355
|
+
},
|
|
356
|
+
}))
|
|
357
|
+
}
|
|
315
358
|
}
|
|
316
359
|
}
|
|
317
360
|
|
|
361
|
+
function assertNeedToValid() {
|
|
362
|
+
const compProps = {
|
|
363
|
+
disabled: calcDisable(props.config, props.mode)
|
|
364
|
+
}
|
|
365
|
+
const needToValid = !(
|
|
366
|
+
(compProps?.disabled || isPlainColumn(props.config, compProps?.disabled)) && props.config.alongValidate != '1' ||
|
|
367
|
+
isChainHidden({ config: props.config })
|
|
368
|
+
)
|
|
369
|
+
return needToValid
|
|
370
|
+
}
|
|
371
|
+
|
|
318
372
|
const onClick = (e, params) => {
|
|
319
373
|
const context = {
|
|
320
374
|
props,
|
package/src/utils/render.jsx
CHANGED