resolver-egretimp-plus 0.0.59 → 0.0.60

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.59",
3
+ "version": "0.0.60",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -195,7 +195,7 @@ export default {
195
195
  })
196
196
  }
197
197
  return () => {
198
- const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects})
198
+ const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects, lang: lang.value})
199
199
  const compPropsOnClick = compProps?.onClick
200
200
  delete compProps.onClick
201
201
  const formItemPolyfill = generateFormItemPolyfill(props.config, lang.value, compProps, _isH5?.value, {
@@ -10,6 +10,7 @@ export function openChildDialog(options = {}, appContext) {
10
10
 
11
11
  instance.vm.exposed.dialogVisible.value = true
12
12
  })
13
+ instance?.vm?.exposed?.clearData()
13
14
  return instance.close
14
15
  }
15
16
  const container = document.createElement('div')
@@ -64,7 +64,10 @@ function rootStoreChange(rootStore) {
64
64
 
65
65
 
66
66
  defineExpose({
67
- dialogVisible
67
+ dialogVisible,
68
+ clearData: () => {
69
+ formData.value = {}
70
+ }
68
71
  })
69
72
  </script>
70
73
  <template>
@@ -1,4 +1,4 @@
1
- import { isArray } from "../../utils/is"
1
+ import { isArray, isHasVal } 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"
@@ -45,7 +45,7 @@ export async function dispatchClickEvent(service, { dynamicMapComp, mixinService
45
45
  // ret.data = {result: {pageTotalCount: 100, result: [{},{},{},{},{}]}}
46
46
  initOutParamData(service.outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult: ret.data})
47
47
  if (tableConfig?.vm) {
48
- const total = parseInt(ret.data?.result?.[service.pageTotalCount || 'pageTotalCount'])
48
+ const total = parseInt(ret.data?.result?.[service.pageTotalCount || 'pageCount'])
49
49
  tableConfig.vm.page.total = total
50
50
  // tableConfig.vm?.changePage(total, 'total')
51
51
  }
@@ -98,7 +98,8 @@ function initOutParamData(outParamMappingList = [], { dynamicMapComp, dynamicMap
98
98
  val = isArray(compConfig.refValue) ? compConfig.refValue : []
99
99
  } else if (isArray(compConfig.refValue) && isArray(val)) {
100
100
  val = unionWith(compConfig.refValue, val, (arrVal, othVal) => {
101
- return (primaryKeys && primaryKeys.length) ? primaryKeys.map(key => arrVal[key] == othVal[key])?.every(item => item) : false
101
+ const ret = (primaryKeys && primaryKeys.length) ? primaryKeys.map(key => ((isHasVal(arrVal[key]) || isHasVal(othVal[key])) && arrVal[key] == othVal[key]))?.every(item => item) : false
102
+ return ret
102
103
  })
103
104
  }
104
105
  }
@@ -139,17 +140,25 @@ export function openDailg({
139
140
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
140
141
  const reqData = getReqData(pagePopupMap.inParamMappingList || [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
141
142
 
143
+ let outParamMappingList = pagePopupMap?.outParamMappingList?.map(item => {
144
+ const orignParamArr = item.orignParam ? item.orignParam.split('->') : []
145
+ return {
146
+ ...item,
147
+ orignParam: item.orignParam ? orignParamArr[orignParamArr.length - 1] : ''
148
+ }
149
+ }) || []
142
150
  let mapList = {}
143
- let outParamMappingList = []
144
151
  // 是表格还是list
145
152
  const isList = pagePopupMap?.objOrList == '1'
146
153
  if (isList ) {
147
154
  const primaryKeys = []
148
155
  mapList = pagePopupMap?.outParamMappingList?.reduce((ret, item) => {
149
156
  const { orignParam, destParam, primaryKeyFlag = '' } = item
150
- ret[destParam] = orignParam
157
+ const destParamArr = destParam ? destParam.split('->') : []
158
+ const transDestParam = destParam ? destParamArr[destParamArr.length - 1] : ''
159
+ ret[transDestParam] = orignParam
151
160
  if (primaryKeyFlag == '1') {
152
- primaryKeys.push(destParam)
161
+ primaryKeys.push(transDestParam)
153
162
  }
154
163
  return ret
155
164
  }, {})
@@ -162,14 +171,6 @@ export function openDailg({
162
171
  isList: true
163
172
  }
164
173
  ]
165
- } else {
166
- outParamMappingList = pagePopupMap?.outParamMappingList?.map(item => {
167
- const orignParamArr = item.orignParam ? item.orignParam.split('->') : []
168
- return {
169
- ...item,
170
- orignParam: item.orignParam ? orignParamArr[orignParamArr.length - 1] : ''
171
- }
172
- }) || []
173
174
  }
174
175
 
175
176
 
@@ -185,7 +186,9 @@ export function openDailg({
185
186
  ...item
186
187
  }
187
188
  Object.keys(mapList).forEach(key => {
188
- retItem[key] = item[mapList[key]]
189
+ if (mapList[key]) {
190
+ retItem[key] = item[mapList[key]]
191
+ }
189
192
  })
190
193
  return retItem
191
194
  })
@@ -36,7 +36,7 @@ export default {
36
36
  emitKeys = Object.keys(emitKeys)
37
37
  }
38
38
  return emitKeys.reduce((ret, key) => {
39
- const eventKey = capitalize(camelize(eventKey))
39
+ const eventKey = `on${capitalize(camelize(key))}`
40
40
  if (hasOwn(attrs, eventKey)) {
41
41
  ret[eventKey] = attrs[eventKey]
42
42
  }
@@ -47,10 +47,16 @@ export default {
47
47
  const tableEvents = computed(() => {
48
48
  return getCompEvents(ElTable)
49
49
  })
50
+ const sliceTableEvents = computed(() => {
51
+ const ret = {
52
+ ...(tableEvents.value || {})
53
+ }
54
+ delete ret.onSortChange
55
+ return ret
56
+ })
50
57
  const pagenationEvents = computed(() => {
51
58
  return getCompEvents(ElPagination)
52
59
  })
53
-
54
60
  const rootStore = inject('_rootStore', {})
55
61
  const lang = inject('lang')
56
62
  const rootValue = inject('rootValue')
@@ -65,6 +71,34 @@ export default {
65
71
  return normalColumnConfig(config)
66
72
  })
67
73
  })
74
+ /** 自定义排序逻辑 ===start==== */
75
+ const sortObj = ref(null)
76
+ // "ascending", "descending", null
77
+ const onSortChange = ({ prop, order }) => {
78
+ tableEvents.value?.onSortChange?.(data)
79
+
80
+ sortObj.value = null
81
+ if (order) {
82
+ sortObj.value = {prop, order}
83
+ }
84
+ }
85
+ const sortTable = computed(() => {
86
+ if (!sortObj.value) {
87
+ return []
88
+ }
89
+ const sortList = [sortObj.value]
90
+ const ret = sortList.reduce((ret, item) => {
91
+ ret = ret.sort((a, b) => (a[item.prop] > b[item.prop] ? (item.order === 'descending' ? 1 : -1) : a[item.prop] === b[item.prop] ? 0 : (item.order === 'descending' ? -1 : 1)))
92
+ return ret
93
+ }, [...(props.refValue.value || [])])
94
+ return ret
95
+ })
96
+
97
+ const tableData = computed(() => {
98
+ return sortObj.value ? sortTable.value : (props.refValue.value || [])
99
+ })
100
+ /** 自定义排序逻辑 ===end==== */
101
+
68
102
 
69
103
  // 获取表格列的属性配置
70
104
  const getTableColumnProps = (config, idx) => {
@@ -114,9 +148,10 @@ export default {
114
148
  const metaTypeNotRender = TABLE_COLUMN_NOT_RENDER_META_TYPE.some(metaType => compareComponet(metaType, config.metaType)) || !config.metaType
115
149
  return !config.renderby && metaTypeNotRender
116
150
  }
151
+
117
152
 
118
153
  const getValue = (idx) => {
119
- return props.refValue.value?.[idx]
154
+ return tableData.value?.[idx]
120
155
  }
121
156
  const onUpdateModelValue = (val, idx) => {
122
157
  if (!props.refValue.value) {
@@ -136,11 +171,11 @@ export default {
136
171
  */
137
172
  const rowColumnConfgsMap = new Map()
138
173
  watch(() => {
139
- return props.refValue?.value?.length
174
+ return tableData?.value?.length
140
175
  }, (length) => {
141
176
  let list = []
142
177
  if (length) {
143
- const newVal = props.refValue?.value
178
+ const newVal = tableData?.value
144
179
  list = newVal.map((row, idx) => {
145
180
  const columnsCgs = rowColumnConfgsMap.get(row)
146
181
  if (columnsCgs) {
@@ -219,11 +254,11 @@ export default {
219
254
  return total + (numFlag ? Number(val) : val)
220
255
  }
221
256
  const totalRow = computed(() => {
222
- if (!props.refValue.value?.length || !totalMetaCodes.value.length || !normalTotalCodes.value.length) {
257
+ if (!tableData.value?.length || !totalMetaCodes.value.length || !normalTotalCodes.value.length) {
223
258
  return []
224
259
  }
225
260
  // 进行统计的计算
226
- const row = (props.refValue.value || []).reduce((total, row) => {
261
+ const row = (tableData.value || []).reduce((total, row) => {
227
262
  normalTotalCodes.value.forEach(codeInfo => {
228
263
  const { code, totalFn } = codeInfo
229
264
  total[code] = totalFn(total[code], row[code], row)
@@ -357,12 +392,13 @@ export default {
357
392
  return () => {
358
393
  return (
359
394
  <div class="custom-component-table">
360
- <ElTable {...tableProps.value} {...tableEvents}
395
+ <ElTable {...tableProps.value} {...sliceTableEvents.value}
361
396
  ref={(e) => {tableRef.value = e}}
362
397
  highlight-current-row={selectable.value || tableProps.value?.highlightCurrentRow ? true : false}
363
398
  onCurrentChange={selectable.value || tableProps.value?.highlightCurrentRow ? currentChange : () => {}}
364
- data={[...(props.refValue.value || []), ...totalRow.value]}
399
+ data={[...tableData.value, ...totalRow.value]}
365
400
  onSelectionChange={handleSelectionChange}
401
+ onSortChange={onSortChange}
366
402
  >
367
403
  {
368
404
  tableColumnConfigs.value.map((columnConfg, configIdx) => {
@@ -391,7 +427,7 @@ export default {
391
427
  const config = multiPmPageMetaList.value?.[$index]?.[configIdx]
392
428
  return (
393
429
  tableColumnNotRender(config) ? null :
394
- <Renderer key={`${config.columnId}-${config.rowIndex}`} class="error-tip-block" modelValue={getValue($index)} rowScope={{row, $index}} onUpdate:modelValue={(val) => { onUpdateModelValue(val, $index) }} config={config}></Renderer>
430
+ <Renderer key={`${config.columnId}-${config.rowIndex}`} class="error-tip-block" modelValue={getValue($index)} rowScope={{row, $index}} onUpdate:modelValue={(val) => { onUpdateModelValue(val, $index) }} config={config}></Renderer>
395
431
  )
396
432
  }
397
433
  }}
package/src/index.jsx CHANGED
@@ -133,7 +133,7 @@ export default {
133
133
  instance,
134
134
  isH5: props.isH5,
135
135
  rootValue: props.modelValue,
136
- axiosInstance,
136
+ axiosInstance: axiosInstance.value,
137
137
  messageInstance: props.messageInstance,
138
138
  messageCb: props.messageCb
139
139
  })
@@ -160,7 +160,7 @@ export default {
160
160
  instance,
161
161
  isH5: props.isH5,
162
162
  rootValue: props.modelValue,
163
- axiosInstance,
163
+ axiosInstance: axiosInstance.value,
164
164
  messageInstance: props.messageInstance,
165
165
  messageCb: props.messageCb
166
166
  })
@@ -45,7 +45,8 @@ export const H5_PREFIX_FLAG = 'cmi-'
45
45
  export const H5_REPLACE_PREFIX_FLAG = 'H5-'
46
46
  export const DISPLAY_SHOW = '1'
47
47
  export const DISPLAY_HIDDEN = '0'
48
- export const PLAIN_TYPE_COLUMNS = ['ElText', 'ElInput', 'ElDatePicker', 'ElInputNumber']
48
+ export const PLAIN_TYPE_ALONG_COLUMNS = ['ElText']
49
+ export const PLAIN_TYPE_COLUMNS = ['ElInput', 'ElDatePicker', 'ElInputNumber']
49
50
  export const PLAIN_TYPE_OPTIONS_COLUMNS = ['ElSelect']
50
51
  export const MAIL_SEND_URL = '/gcweb/External_Mail'
51
52
  export const commonPropsType = {
@@ -160,7 +161,21 @@ export const commonPropsType = {
160
161
  const options = (selects?.value && selects?.value?.[selectKey]) || (selects?.value && selects?.value?.[`${config.metaCode}ListValue`]) || (selects?.value && selects?.value?.[referenceOptions]) || optionItemsList || []
161
162
  return options
162
163
  }
163
- }
164
+ },
165
+ placeholder: {
166
+ type: String,
167
+ default: () => [],
168
+ getValue(config, props, modelValue, selects, lang) {
169
+ return (lang?.indexOf('zh') > -1 ? config.defPlacehold : config.defPlaceholdEn) || ''
170
+ }
171
+ },
172
+ placeholderEn: {
173
+ type: String,
174
+ default: () => [],
175
+ getValue(config, props, modelValue, selects, lang) {
176
+ return config.defPlaceholdEn
177
+ }
178
+ },
164
179
  }
165
180
 
166
181
  export function calcDisable(config, mode) {
package/src/utils/is.js CHANGED
@@ -54,6 +54,10 @@ export function isWindow(val) {
54
54
  return typeof window !== 'undefined' && is(val, 'Window');
55
55
  }
56
56
 
57
+ export function isHasVal(val) {
58
+ return val !== null && val !== undefined
59
+ }
60
+
57
61
  export const isServer = typeof window === 'undefined';
58
62
 
59
63
  export const isClient = !isServer;
@@ -20,6 +20,7 @@ import {
20
20
  META_TYPE_MAP,
21
21
  H5_REPLACE_PREFIX_FLAG,
22
22
  H5_PREFIX_FLAG,
23
+ PLAIN_TYPE_ALONG_COLUMNS,
23
24
  } from './const.js'
24
25
  import { preserveCheck } from './preserveFunc.js'
25
26
  import { isArray, isFunction, isString } from './is.js'
@@ -289,7 +290,9 @@ function normalMetaType(metaType) {
289
290
 
290
291
  export function isPlainColumn(config, disabled) {
291
292
  // 表格中中的列,可以根据配置进行转换为普通形式,表格原生支持的tooltip
292
-
293
+ if (findComponent(PLAIN_TYPE_ALONG_COLUMNS, config.renderby || config.metaType) !== -1) {
294
+ return true
295
+ }
293
296
  if (config.isColumn && disabled) {
294
297
  if (config.plainColumn) {
295
298
  return true
@@ -350,7 +353,7 @@ export function getComponentForConfig({config, disabled, getNativeComps}) {
350
353
  }
351
354
 
352
355
  // 获取渲染组件的props配置数据
353
- export function getRenderComponentProps({ props, component, modelValue, selects }) {
356
+ export function getRenderComponentProps({ props, component, modelValue, selects, lang }) {
354
357
  if (!component) return {}
355
358
  let config = props.config
356
359
  if (findComponent(['CustomComponentTabs'], config.renderby || config.metaType) !== -1) {
@@ -373,7 +376,7 @@ export function getRenderComponentProps({ props, component, modelValue, selects
373
376
  }
374
377
  })
375
378
  }
376
- const commonProps = getCommonProps(config, props, modelValue, selects)
379
+ const commonProps = getCommonProps(config, props, modelValue, selects, lang)
377
380
  defprops.style = {
378
381
  ...config.style,
379
382
  ...getRenderCompMargins(config),
@@ -393,9 +396,9 @@ function getBuildCompDefaultWidth(config) {
393
396
  }
394
397
  }
395
398
  // 获取渲染组件开放的配置props,提供给所有自定义组件
396
- function getCommonProps(config, props, modelValue, selects) {
399
+ function getCommonProps(config, props, modelValue, selects, lang) {
397
400
  return Object.keys(commonPropsType).reduce((ret, key) => {
398
- ret[key] = commonPropsType[key].getValue(config, props, modelValue, selects)
401
+ ret[key] = commonPropsType[key].getValue(config, props, modelValue, selects, lang)
399
402
  return ret
400
403
  }, {})
401
404
  }