resolver-egretimp-plus 0.1.143 → 0.1.145

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.1.143",
3
+ "version": "0.1.145",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -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,110 @@ export default {
264
264
  provide('parent', props.config)
265
265
 
266
266
  if (OPEN_DATA_RULES) {
267
- if (!_isH5?.value && props.config.renderby) {
268
- provide(formContextKey, reactive({
269
- ...formContext,
270
- addField(field) {
271
- if (!props.config?._formFields) {
272
- definePrivatelyProp(props.config, '_formFields', [])
273
- }
274
- props.config?._formFields?.push(field)
275
- formContext.addField(field)
276
- },
277
- removeField(field) {
278
- const fields = props.config?._formFields
279
- if (field.prop && fields) {
280
- const idx = fields.indexOf(field)
281
- if (idx !== -1) {
282
- fields.splice(idx, 1)
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 = async 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
- formContext.removeField(field)
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 && props.config.renderby) {
292
- provide(formContextKey, reactive({
293
- ...formContext,
294
- addField(field) {
295
- if (field.validate && isFunction(field.validate)) {
296
- const originValidate = field.validate
297
- field.validate = function (...arg) {
298
- const ret = originValidate.apply(this, arg)
299
- return ret?.then(ret => ret)?.catch(err => {
300
- if (isPlainObject(err)) {
301
- Object.keys(err).forEach(key => {
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 = async function (...arg) {
328
+ if (!assertNeedToValid()) {
329
+ return
307
330
  }
308
- return Promise.reject(err)
309
- }) || true
331
+ const ret = originValidate.apply(this, arg)
332
+ return ret?.then(ret => ret)?.catch(err => {
333
+ if (isPlainObject(err)) {
334
+ Object.keys(err).forEach(key => {
335
+ // 在自定义组件中form-item 校验失败之后,err 中绑定的 prop 属性手动替换成config 的dynamicHireRelat
336
+ const copyVal = err[key]
337
+ delete err[key]
338
+ err[props.config.dynamicHireRelat] = copyVal
339
+ })
340
+ }
341
+ return Promise.reject(err)
342
+ }) || true
343
+ }
310
344
  }
345
+ formContext.addField(field)
311
346
  }
312
- formContext.addField(field)
313
- }
314
- }))
347
+ }))
348
+ } else {
349
+ provide(formContextKey, reactive({
350
+ ...formContext,
351
+ originAddField,
352
+ addField(...arg) {
353
+ return originAddField?.apply(this, arg)
354
+ },
355
+ }))
356
+ }
315
357
  }
316
358
  }
317
359
 
360
+ function assertNeedToValid() {
361
+ const compProps = {
362
+ disabled: calcDisable(props.config, props.mode)
363
+ }
364
+ const needToValid = !(
365
+ (compProps?.disabled || isPlainColumn(props.config, compProps?.disabled)) && props.config.alongValidate != '1' ||
366
+ isChainHidden({ config: props.config })
367
+ )
368
+ return needToValid
369
+ }
370
+
318
371
  const onClick = (e, params) => {
319
372
  const context = {
320
373
  props,
@@ -2,7 +2,7 @@ import { isArray, isHasVal, isNull, isUndefined } from "../../utils/is"
2
2
  import { DATA_VALID_RULE_EXECUTE } from "../../api/builtIn"
3
3
  import { getRelateConfigKeys } from "../../rules/ruleUtils"
4
4
  import { RESULT_CODE, resultToast } from "../../utils/respone"
5
- import { assignmentPathVal, definePrivatelyProp, getPathVal, isPromise, modelValueDeepMerge, parseExtendAttr, unionWith } from "../../utils/index"
5
+ import { assignmentPathVal, cloneDeep, definePrivatelyProp, getPathVal, isPromise, modelValueDeepMerge, parseExtendAttr, unionWith } from "../../utils/index"
6
6
  import { buildInRequest } from "../../utils/request"
7
7
  import { bpmInstance } from "../../bpm/bpmInstance"
8
8
 
@@ -34,7 +34,7 @@ export async function dispatchClickEvent(service, {
34
34
  }
35
35
  // 把执行逻辑封装成一个方法
36
36
  async function toExecute(resetPageNum = true) {
37
- let reqData = rootValue || {}
37
+ let reqData = cloneDeep(rootValue || {})
38
38
  let tableConfig = null
39
39
  const serviceCustomProps = parseExtendAttr({extendAttr: service.extendAttr})
40
40
 
@@ -121,24 +121,17 @@
121
121
  margin-bottom: 16px;
122
122
  }
123
123
 
124
- // 选择第一个
125
- // :not(.CustomComponentCollapse.is-card) + .CustomComponentCollapse.is-card {
126
- // background: red;
127
- // }
128
- .CustomComponentCollapse.is-card:has(+ .CustomComponentCollapse.is-card) {
124
+ // 当卡片组件、被包裹的折叠组件、页签组件相邻排列时,给前面的组件添加 16px 底部间距
125
+ // 卡片组件后面紧跟被包裹的折叠组件、卡片组件或页签组件时
126
+ .CustomComponentCard.is-card:has(+ .CustomComponentCollapse.is-card, + .CustomComponentCard.is-card, + .CustomComponentTabs) {
129
127
  margin-bottom: 16px;
130
128
  }
131
-
132
- .CustomComponentCollapse.is-card:has(+ .CustomComponentCard.is-card) {
133
- margin-bottom: 16px;
134
- }
135
-
136
- .CustomComponentCard.is-card:has(+ .CustomComponentCollapse.is-card) {
129
+ // 被包裹的折叠组件后面紧跟同类组件、卡片组件或页签组件时
130
+ .CustomComponentCollapse.is-card:has(+ .CustomComponentCollapse.is-card, + .CustomComponentCard.is-card, + .CustomComponentTabs) {
137
131
  margin-bottom: 16px;
138
132
  }
139
-
140
-
141
- .CustomComponentCard.is-card:has(+ .CustomComponentCard.is-card) {
133
+ // 页签组件后面紧跟被包裹的折叠组件、卡片组件或页签组件时
134
+ .CustomComponentTabs:has(+ .CustomComponentCollapse.is-card, + .CustomComponentCard.is-card, + .CustomComponentTabs) {
142
135
  margin-bottom: 16px;
143
136
  }
144
137
 
@@ -1435,7 +1435,7 @@ function isTransCellMobile(config, disabled) {
1435
1435
  }
1436
1436
 
1437
1437
  // 如果父级有一个是hidden了,那就表示hidden了
1438
- function isChainHidden({config}) {
1438
+ export function isChainHidden({config}) {
1439
1439
  if (isHidden({config})) {
1440
1440
  return true
1441
1441
  }