resolver-egretimp-plus 0.0.108 → 0.0.110

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.108",
3
+ "version": "0.0.110",
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 } from 'vue'
2
- import { commonPropsType, getComponentPropsKeys, hasOwn } from './utils/index.js'
2
+ import { commonPropsType, definePrivatelyProp, getComponentPropsKeys, hasOwn } 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 from './rules/rulesDriver'
@@ -70,16 +70,16 @@ export default {
70
70
  // 当前组件的实例
71
71
  const instance = getCurrentInstance()
72
72
  const appContext = instance?.appContext
73
- props.config.wrapVm = instance
73
+ definePrivatelyProp(props.config, 'wrapVm', instance)
74
74
  const refFn = e => {
75
75
  // 具体渲染的组件
76
- props.config.vm = e
76
+ definePrivatelyProp(props.config, 'vm', e)
77
77
  }
78
78
  const onVnodeMounted = (e) => {
79
79
  props.config.vmIsBind = true
80
- props.config.router = router
81
- props.config.route = route
82
- props.config.vmIsBind = true
80
+ definePrivatelyProp(props.config, 'router', router)
81
+ definePrivatelyProp(props.config, 'route', route)
82
+
83
83
  if (props.config.onVnodeMounted && typeof props.config.onVnodeMounted === 'function') {
84
84
  props.config.onVnodeMounted(props, e, selects)
85
85
  }
@@ -125,7 +125,7 @@ export default {
125
125
  }
126
126
 
127
127
  const { vModelObjs, initVmodels, modelValue } = useVmodels(props, emit) // 过个v-model绑定对象,实现可以组件过赋值
128
- props.config.refValue = modelValue
128
+ definePrivatelyProp(props.config, 'refValue', modelValue)
129
129
  // onBeforeMount(() => {
130
130
  // defaultVal(props.config, modelValue) // 设置默认值
131
131
  // })
@@ -169,7 +169,8 @@ export default {
169
169
 
170
170
  const configLinks = [parent, ...props.additionConfigs, props.config]
171
171
  configLinks.reduce((parent, config) => {
172
- config.parent = parent
172
+ definePrivatelyProp(props.config, 'parent', parent)
173
+
173
174
  config.dynamicMapComp = dynamicMapComp
174
175
  config.dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(props.config, 'rowIndex') ? `[${props.config.rowIndex}]` : ''}->${(props.config.metaCode || '')}` : props.config.metaCode
175
176
  config.dynamicHireRelat && (dynamicMapComp[props.config.dynamicHireRelat] = props.config)
@@ -26,14 +26,18 @@ const dateFormat = computed(() => {
26
26
 
27
27
  const calcProps = computed(() => {
28
28
  let desc = normalVal.value || props.config?.desc
29
- if (desc?.toString) {
30
- desc = desc.toString()
31
- }
32
- if (dateFormat.value) {
33
- desc = formatDate(desc, dateFormat.value)
34
- }
35
- if (props.formatter && typeof props.formatter === "function") {
36
- desc = props.formatter(desc)
29
+ try {
30
+ if (desc?.toString) {
31
+ desc = desc.toString()
32
+ }
33
+ if (dateFormat.value) {
34
+ desc = formatDate(desc, dateFormat.value)
35
+ }
36
+ if (props.formatter && typeof props.formatter === "function") {
37
+ desc = props.formatter(desc)
38
+ }
39
+ } catch (error) {
40
+ console.log('CmiCell, error==:', error)
37
41
  }
38
42
  return {
39
43
  title: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
@@ -5,6 +5,14 @@ import { commonPropsType } from '../../utils/index.js'
5
5
  const lang = inject('lang')
6
6
  const props = defineProps({
7
7
  ...commonPropsType,
8
+ formatter: {
9
+ type: Function,
10
+ default: null
11
+ },
12
+ parser: {
13
+ type: Function,
14
+ default: null
15
+ }
8
16
  })
9
17
  const inputProps = computed(() => {
10
18
  return {
@@ -32,14 +40,30 @@ const inputProps = computed(() => {
32
40
  const attrs = useAttrs()
33
41
  const modelValue = defineModel()
34
42
  const onChange = (e) => {
35
- modelValue.value = e.detail.value
43
+ valueProxy.value = e.detail.value
36
44
  }
45
+ const valueProxy = computed({
46
+ get() {
47
+ return typeof props.formatter === "function" ? props.formatter(modelValue.value) : modelValue.value
48
+ },
49
+ set(val) {
50
+ let value = typeof props.parser === "function" ? props.parser(val) : val
51
+ if (modelValue.value === value && typeof props.formatter === "function") {
52
+ modelValue.value += ' '
53
+ setTimeout(() => { // 如果值相等,会导致没有再次进入get取值
54
+ modelValue.value = value
55
+ }, 0)
56
+ } else {
57
+ modelValue.value = value
58
+ }
59
+ }
60
+ })
37
61
 
38
62
  </script>
39
63
 
40
64
  <template>
41
65
  <cmi-input
42
- :value="modelValue" v-bind="{ ...attrs, ...inputProps,}"
66
+ :value="valueProxy" v-bind="{ ...attrs, ...inputProps,}"
43
67
  @change="onChange"
44
68
  ></cmi-input>
45
69
  </template>
@@ -47,7 +47,7 @@ function toCollapse() {
47
47
  </script>
48
48
  <template>
49
49
  <cmi-card v-bind="{...cmiProps, ...attrs}">
50
- <div slot="content">
50
+ <div slot="content" :style="{'background-color': cmiProps.cardbgcolor}">
51
51
  <Renderer :config="showPageMeteList" v-model="modelValue"></Renderer>
52
52
  <div v-if="showCollapseBtn" class="collapse-wrap">
53
53
  <cmi-button type="text" size="small" @click="toCollapse">
@@ -62,4 +62,9 @@ function toCollapse() {
62
62
  display: flex;
63
63
  justify-content: end;
64
64
  }
65
+ cmi-card {
66
+ cmi-form-item {
67
+ background-color: transparent;
68
+ }
69
+ }
65
70
  </style>
@@ -53,7 +53,7 @@ const normalPageTotal = computed(() => {
53
53
  const paginationProps = computed(() => {
54
54
  return {
55
55
  pagesizes: props.config?.pagesizes || [3, 10, 20, 50],
56
- showHomeEnd: hasOwn(props.config, 'showHomeEnd') ? props.config.showHomeEnd === '1' : hasOwn(props.config, 'show-home-end') ? props.config['show-home-end'] === '1' : true,
56
+ showHomeEnd: hasOwn(props.config, 'showHomeEnd') ? props.config.showHomeEnd === '1' : hasOwn(props.config, 'show-home-end') ? props.config['show-home-end'] === '1' : false,
57
57
  }
58
58
  })
59
59
  const pagenationEvents = computed(() => {
@@ -213,9 +213,10 @@ function normalTableRowValue(row) {
213
213
  >
214
214
  </cmi-table-column>
215
215
  </cmi-table>
216
- <div v-if="pageable && normalPageTotal > 3" :style="{'justify-content': pageAlignEnmu[pageAlign || PAGE_RIGHT]}" style="margin-bottom: 12px;">
216
+ <div v-if="pageable && normalPageTotal > 3" :style="{'display': 'flex', 'justify-content': pageAlignEnmu[pageAlign || PAGE_CENTER]}" style="margin-bottom: 12px;">
217
217
  <cmi-pagination
218
218
  :key="normalPageTotal"
219
+ style="border-radius: 8px;border: 1px solid rgba(219,219,219,1);"
219
220
  v-bind="{...paginationProps, ...pagenationEvents}"
220
221
  @sizeChange="pagenationEvents.onSizeChange"
221
222
  @currentChange="pagenationEvents.onCurrentChange"
@@ -292,3 +292,14 @@ export function getConfigOptions(config, selects) {
292
292
  // return options.filter(item => !(item.columnStatus == '0' || item.columnStatus == '2'))
293
293
  // }
294
294
  }
295
+
296
+ export function definePrivatelyProp(obj, key, value, options) {
297
+ const op = options || {}
298
+ Object.defineProperty(obj, key, {
299
+ value,
300
+ writable: true,
301
+ enumerable: false,
302
+ configurable: true,
303
+ ...op
304
+ })
305
+ }
@@ -2,7 +2,6 @@ import { getCodeMapRules } from '../rules/rulesDriver.js'
2
2
  import { resolveAssetComponents, findComponent, compareComponet, normalPixel, isPlainObject, hasOwn, isFnStr, normalCapitalizeComponent, capitalize, camelize, formatDate} from './common.js'
3
3
  import { resolveComponent, inject, defineAsyncComponent } from 'vue'
4
4
  import CustomComponentColH5 from '../components/packages-H5/CustomComponentColH5.vue'
5
- import CmiCell from '../components/packages-H5/CmiCell.vue'
6
5
  import {
7
6
  commonPropsType,
8
7
  FORM_META_TYPE,
@@ -347,9 +346,6 @@ export function getComponentForConfig({config, disabled, getNativeComps}) {
347
346
  if (isPlainColumn(config, disabled)) {
348
347
  return CustomComponentPlain
349
348
  }
350
- if (isTransCellMobile(config, disabled)) {
351
- return CmiCell
352
- }
353
349
 
354
350
  const components = inject('components')
355
351
  const { composeComponents } = getNativeComps()
@@ -363,7 +359,10 @@ export function getComponentForConfig({config, disabled, getNativeComps}) {
363
359
  component = resolveComponent(metaType) // 实例上绑定的组件
364
360
  }
365
361
 
366
- const renderby = config.renderby
362
+ let renderby = config.renderby
363
+ if (isTransCellMobile(config, disabled)) {
364
+ renderby = 'CmiCell'
365
+ }
367
366
  if (renderby && typeof renderby === 'string') {
368
367
  let renderbyComp = resolveAssetComponents(allComps, renderby) //则通过传入的获取组件
369
368
  if (!renderbyComp) {