resolver-egretimp-plus 0.0.136 → 0.0.138

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.0.136",
3
+ "version": "0.0.138",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -185,18 +185,14 @@ export default {
185
185
 
186
186
  const configLinks = [parent, ...props.additionConfigs, props.config]
187
187
  configLinks.reduce((parent, config) => {
188
- definePrivatelyProp(props.config, 'parent', parent)
188
+ definePrivatelyProp(config, 'parent', parent)
189
189
 
190
190
  config.dynamicMapComp = dynamicMapComp
191
- config.dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(props.config, 'rowIndex') ? `[${props.config.rowIndex}]` : ''}->${(props.config.metaCode || '')}` : props.config.metaCode
192
- config.dynamicHireRelat && (dynamicMapComp[props.config.dynamicHireRelat] = props.config)
193
- return parent
191
+ config.dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(config, 'rowIndex') ? `[${config.rowIndex}]` : ''}->${(config.metaCode || '')}` : config.metaCode
192
+ config.dynamicHireRelat && (dynamicMapComp[config.dynamicHireRelat] = config)
193
+ return config
194
194
  })
195
195
 
196
- // props.config.parent = parent
197
- // props.config.dynamicMapComp = dynamicMapComp
198
- // props.config.dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(props.config, 'rowIndex') ? `[${props.config.rowIndex}]` : ''}->${(props.config.metaCode || '')}` : props.config.metaCode
199
- // props.config.dynamicHireRelat && (dynamicMapComp[props.config.dynamicHireRelat] = props.config)
200
196
  provide('parent', props.config)
201
197
 
202
198
  const _isH5 = inject('_isH5')
@@ -1,38 +1,39 @@
1
1
  import ChildDialog from './src/index.vue'
2
2
  import { createVNode, render } from 'vue'
3
3
 
4
- let instance = null
5
-
6
- export function openChildDialog(options = {}, appContext) {
7
- const initData = options.initData || {}
8
- if (instance) {
9
- Object.keys(options).forEach(key => {
10
- instance.props[key] = options[key]
11
-
4
+ export function generateOpenChildDialog() {
5
+ let instance = null
6
+ return function openChildDialog(options = {}, appContext) {
7
+ const initData = options.initData || {}
8
+ if (instance) {
9
+ Object.keys(options).forEach(key => {
10
+ instance.props[key] = options[key]
11
+
12
+ })
13
+ instance.vm.exposed.dialogVisible.value = true
14
+ // instance?.vm?.exposed?.clearData()
15
+ instance?.vm?.exposed?.initData(initData)
16
+ return instance.close
17
+ }
18
+ const container = document.createElement('div')
19
+ const vnode = createVNode(ChildDialog, {
20
+ ...options,
12
21
  })
13
- instance.vm.exposed.dialogVisible.value = true
14
- // instance?.vm?.exposed?.clearData()
15
- instance?.vm?.exposed?.initData(initData)
16
- return instance.close
17
- }
18
- const container = document.createElement('div')
19
- const vnode = createVNode(ChildDialog, {
20
- ...options,
21
- })
22
- vnode.appContext = appContext
23
- render(vnode, container)
24
- document.body.appendChild(container.firstElementChild)
25
-
26
- instance = {
27
- vnode,
28
- vm: vnode.component,
29
- props: vnode.component?.props,
30
- close: () => {
31
- vnode.component.exposed.dialogVisible.value = false
22
+ vnode.appContext = appContext
23
+ render(vnode, container)
24
+ document.body.appendChild(container.firstElementChild)
25
+
26
+ instance = {
27
+ vnode,
28
+ vm: vnode.component,
29
+ props: vnode.component?.props,
30
+ close: () => {
31
+ vnode.component.exposed.dialogVisible.value = false
32
+ }
32
33
  }
34
+ vnode.component.exposed.dialogVisible.value = true
35
+ vnode.component.exposed?.initData(initData)
36
+
37
+ return instance.close
33
38
  }
34
- vnode.component.exposed.dialogVisible.value = true
35
- vnode.component.exposed?.initData(initData)
36
-
37
- return instance.close
38
- }
39
+ }
@@ -113,12 +113,12 @@ export default {
113
113
  const ret = sortList.reduce((ret, item) => {
114
114
  ret = ret.sort((a, b) => {
115
115
  if (a[item.prop] === '' || a[item.prop] === undefined || a[item.prop] === null) {
116
- return item.order === 'descending' ? -1 : 1
116
+ return item.order === 'descending' ? 1 : -1
117
117
  }
118
118
  if (b[item.prop] === '' || b[item.prop] === undefined || b[item.prop] === null) {
119
- return item.order === 'descending' ? 1 : -1
119
+ return item.order === 'descending' ? -1 : 1
120
120
  }
121
- return (a[item.prop] > b[item.prop] ? (item.order === 'descending' ? 1 : -1) : a[item.prop] === b[item.prop] ? 0 : (item.order === 'descending' ? -1 : 1))
121
+ return (a[item.prop] > b[item.prop] ? (item.order === 'descending' ? -1 : 1) : a[item.prop] === b[item.prop] ? 0 : (item.order === 'descending' ? 1 : -1))
122
122
  })
123
123
  return ret
124
124
  }, [...(normalTableData.value || [])])
@@ -17,7 +17,8 @@ const appContext = getCurrentInstance()?.appContext
17
17
  const props = defineProps({
18
18
  ...commonPropsType,
19
19
  ...ElButton.props,
20
- plain: [String, Boolean]
20
+ plain: [String, Boolean],
21
+ circle: [String, Boolean]
21
22
  })
22
23
  const calcPorps = computed(() => {
23
24
  const ret = Object.keys(ElButton.props).reduce((total, key) => {
@@ -173,7 +173,7 @@ export default {
173
173
  <span ref={(e) => calcSpanRef.value = e} class="calc-span">{ modelValue.value }</span>
174
174
  {
175
175
  polyfillInputWrap(
176
- <div v-else class="input-wrap" ref={(e) => inputWrapRef.value = e}>
176
+ <div class="input-wrap" ref={(e) => inputWrapRef.value = e}>
177
177
  <ElInput {...vmodelProps.value} {...{...normalAttrs.value, ...normalInputProps.value}}>
178
178
  {
179
179
  getInputSolts()
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="modeValue"></ElInputNumber>
2
+ <ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="inputNumberValue"></ElInputNumber>
3
3
  </template>
4
4
  <script setup>
5
5
  import { ElInputNumber } from 'element-plus'
@@ -13,6 +13,8 @@ const props = defineProps({
13
13
  },
14
14
  ...ElInputNumber.props,
15
15
  ...commonPropsType,
16
+ step: [String, Number],
17
+ modeValue: [String, Number]
16
18
  })
17
19
  const textAlignClass = computed(() => {
18
20
  return props.textAlign === 'right' ? 'text-right' :
@@ -32,10 +34,21 @@ const inputNumberProps = computed(() => {
32
34
  if (props.config?.precise && !isNaN(props.config.minValue)) {
33
35
  ret.precision = props.config.precise
34
36
  }
37
+ if (ret.step) {
38
+ ret.step = parseFloat(ret.step)
39
+ }
35
40
  return ret
36
41
  })
37
42
  const attrs = useAttrs()
38
43
  const modeValue = defineModel()
44
+ const inputNumberValue = computed({
45
+ get() {
46
+ return parseFloat(modeValue.value)
47
+ },
48
+ set(val) {
49
+ modeValue.value = val
50
+ }
51
+ })
39
52
  // 目前有问题,可以输入--跟e字符串
40
53
  const updateKey = ref(false)
41
54
  const normalValue = () => {
@@ -17,7 +17,9 @@ const modelValue = defineModel()
17
17
  const props = defineProps({
18
18
  ...ElSelect.props,
19
19
  ...commonPropsType,
20
- multiple: [String, Boolean]
20
+ multiple: [String, Boolean],
21
+ filterable: [String, Boolean],
22
+ multipleLimit: [String, Number],
21
23
  })
22
24
  const attrs = useAttrs()
23
25
 
@@ -1,8 +1,7 @@
1
1
  import { computed, inject, nextTick, reactive } from "vue"
2
2
  import rulesDriver from '../rules/rulesDriver'
3
3
  import defaultVal from '../utils/defaultVal.js'
4
- import { getValueDeep, isNonRefType, setValueDeep } from "../utils"
5
- // import { deepMerge } from '../utils'
4
+ import {isNonRefType, modelValueDeepMerge } from "../utils"
6
5
 
7
6
  export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
8
7
  const { hireRelatMapRules, messageInstance, rootValue, ruleExecuter, dataLoad, dynamicMapComp, lang, _mapComp } = this
@@ -23,10 +22,7 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
23
22
  // 如果使用v-model:[]方式绑定非modelValue,可能会出现没有对应的config
24
23
  return
25
24
  }
26
- const dynamicHireRelat = config.dynamicHireRelat
27
- const val = getValueDeep(rootValue.value, dynamicHireRelat)
28
-
29
- // const val = (metaCodeKey ? props.modelValue?.[metaCodeKey] : props.modelValue) ?? null
25
+ const val = (metaCodeKey ? props.modelValue?.[metaCodeKey] : props.modelValue) ?? null
30
26
  if (modelKey === 'update:modelValue' && !val) {
31
27
  setTimeout(() => {
32
28
  defaultVal(config)
@@ -64,30 +60,25 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
64
60
  if (!config) {
65
61
  return
66
62
  }
67
- const dynamicHireRelat = config.dynamicHireRelat
68
- if (!setValueDeep(rootValue, dynamicHireRelat, val)) {
69
- return
63
+ const modelValue = props.modelValue
64
+ const metaCode = metaCodeKey
65
+ if (!metaCode) return
66
+ if (!modelValue) {
67
+ emit('update:modelValue', {
68
+ [metaCode]: val
69
+ })
70
+ } else {
71
+ if (modelValue?.[metaCode]) {
72
+ if (typeof modelValue[metaCode] === 'object' || typeof val === 'object') {
73
+ val = modelValueDeepMerge(val, modelValue[metaCode])
74
+ }
75
+ }
76
+ if (isNonRefType(modelValue[metaCode]) && isNonRefType(val) && modelValue[metaCode] === val) {
77
+ // 这边的值没有变,就不用出触发下面的其他动作了
78
+ return
79
+ }
80
+ props.modelValue[metaCode] = val
70
81
  }
71
-
72
- // const modelValue = props.modelValue
73
- // const metaCode = metaCodeKey
74
- // if (!metaCode) return
75
- // if (!modelValue) {
76
- // emit('update:modelValue', {
77
- // [metaCode]: val
78
- // })
79
- // } else {
80
- // // if (modelValue?.[metaCode]) {
81
- // // if (typeof modelValue?.[metaCode] === 'object' || typeof val === 'object') {
82
- // // val = deepMerge(val, modelValue?.[metaCode], 'union')
83
- // // }
84
- // // }
85
- // if (isNonRefType(modelValue[metaCode]) && isNonRefType(val) && modelValue[metaCode] === val) {
86
- // // 这边的值没有变,就不用出触发下面的其他动作了
87
- // return
88
- // }
89
- // props.modelValue[metaCode] = val
90
- // }
91
82
  if (config) {
92
83
  setTimeout(() => {
93
84
  ruleExecuter?.run({
package/src/index.jsx CHANGED
@@ -128,7 +128,7 @@ export default {
128
128
  type: String,
129
129
  }
130
130
  },
131
- emits: ['update:modelValue'],
131
+ emits: ['update:modelValue', 'rootStoreChange'],
132
132
  setup(props, { emit, attrs, expose }) {
133
133
  const ruleExecuter = null
134
134
  // const ruleExecuter = new RuleExecuter()
@@ -235,7 +235,14 @@ export default {
235
235
  provide('buttonActions', props.buttonActions)
236
236
  provide('components', toRef(props, 'components'))
237
237
  provide('selects', toRef(props, 'selects'))
238
- provide('rootValue', toRef(props, 'modelValue')) // 绑定进入的跟数据
238
+ provide('rootValue', computed({
239
+ get() {
240
+ return props.modelValue
241
+ },
242
+ set(val) {
243
+ emit('update:modelValue', val)
244
+ }
245
+ })) // 绑定进入的跟数据
239
246
  provide('lang', toRef(props, 'lang'))
240
247
  provide('dataLoad', dataLoad) // 是否可以开始执行规则初始化
241
248
  provide('dialogComponents', props.dialogComponents) // 是否可以开始执行规则初始化
@@ -4,7 +4,7 @@ import { ElMessage, ElMessageBox } from "element-plus"
4
4
  import { loadingInstance } from './components/loading'
5
5
  import { computed, ref, useAttrs } from 'vue';
6
6
  import Resolver from './resolver-common.vue'
7
- import { openChildDialog } from './components/childDialog';
7
+ import { generateOpenChildDialog } from './components/childDialog';
8
8
  import { generateUniqueId } from './utils/common.js';
9
9
 
10
10
  const props = defineProps({
@@ -26,7 +26,7 @@ const props = defineProps({
26
26
  openChildDialogInstance: {
27
27
  type: [Function],
28
28
  default: () => {
29
- return openChildDialog
29
+ return generateOpenChildDialog()
30
30
  }
31
31
  },
32
32
  requestTraceId: {
@@ -199,9 +199,6 @@ export function parseCondition(rule) {
199
199
  // } else {
200
200
  conditionsRet = conditions.map(condition => {
201
201
  const { refType, refValue, targetType, targetValue } = condition
202
- if (refValue?.indexOf('onlyDisplayPricingParameters') > -1) {
203
- debugger
204
- }
205
202
  // if (refValue === 'studentId') {
206
203
  // debugger
207
204
  // }
@@ -210,6 +210,53 @@ export function deepMerge(
210
210
  return ret
211
211
  }
212
212
 
213
+ export function modelValueDeepMerge(
214
+ source,
215
+ target,
216
+ ) {
217
+ if (!target) {
218
+ return source;
219
+ }
220
+ if (!source) {
221
+ return target;
222
+ }
223
+ let ret = mergeWith(source, target, (sourceValue, targetValue) => {
224
+ if (!targetValue) {
225
+ return sourceValue
226
+ }
227
+ if (!sourceValue) {
228
+ return targetValue
229
+ }
230
+ if (isArray(sourceValue) && isArray(targetValue)) {
231
+ const ret = []
232
+ let idx = 0
233
+ for(;idx < sourceValue.length && idx < targetValue.length; i ++) {
234
+ ret.push(modelValueDeepMerge[sourceValue[idx], targetValue[idx]])
235
+ }
236
+ if (idx < sourceValue.length) {
237
+ ret.push(...sourceValue.slice(idx))
238
+ } else {
239
+ ret.push(...targetValue.slice(idx))
240
+ }
241
+ return ret
242
+ }
243
+ if (isPlainObject(targetValue) && isPlainObject(sourceValue)) {
244
+ return deepMerge(sourceValue, targetValue, mergeArrays);
245
+ }
246
+ return targetValue;
247
+ });
248
+ if (Array.isArray(source)) {
249
+ if (ret && !Array.isArray(ret)) {
250
+ let arr = []
251
+ Object.keys(ret).forEach(key => {
252
+ arr[key] = ret[key]
253
+ })
254
+ ret = arr
255
+ }
256
+ }
257
+ return ret
258
+ }
259
+
213
260
  export function isFnStr(str) {
214
261
  // 匹配具名函数和匿名函数(但不包括箭头函数)
215
262
  const functionRegex = /^\s*(?:function\s*(?:\w+\s*)?\([^()]*\)\s*\{[\s\S]*?\})\s*$/
@@ -151,14 +151,14 @@ export const commonPropsType = {
151
151
  },
152
152
  placeholder: {
153
153
  type: String,
154
- default: () => [],
154
+ default: () => '',
155
155
  getValue(config, props, modelValue, selects, lang) {
156
156
  return (lang?.indexOf('zh') > -1 ? config.defPlacehold : config.defPlaceholdEn) || ''
157
157
  }
158
158
  },
159
159
  placeholderEn: {
160
160
  type: String,
161
- default: () => [],
161
+ default: () => '',
162
162
  getValue(config, props, modelValue, selects, lang) {
163
163
  return config.defPlaceholdEn
164
164
  }
@@ -831,15 +831,13 @@ function createFormLable(config, lang = 'zh') {
831
831
  {required ? <span style="color: #f5222d; margin-right: 3px">*</span> : null}
832
832
  <span>{lang.indexOf('zh') > -1 ? config.metaNameZh : config.metaNameEn}</span>
833
833
  </span>
834
- <ElTooltip
835
- effect="dark"
836
- content={lang.indexOf('zh') > -1 ? config.hintContentZh : config.hintContentEn}
837
- placement="top"
838
- >
839
- {
840
- config.hintFlag == '1' ? <span class="label-tip"><elIcon><QuestionFilled /></elIcon></span> : null
841
- }
842
- </ElTooltip>
834
+ {
835
+ config.hintFlag == '1' ? (
836
+ <ElTooltip effect="dark" content={lang.indexOf('zh') > -1 ? config.hintContentZh : config.hintContentEn} placement="top">
837
+ <span class="label-tip"><elIcon><QuestionFilled /></elIcon></span>
838
+ </ElTooltip>
839
+ ) : null
840
+ }
843
841
  </div>
844
842
  )
845
843
  }