resolver-egretimp-plus 0.0.109 → 0.0.111

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.109",
3
+ "version": "0.0.111",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -16,7 +16,7 @@ module.exports = {
16
16
  path: path.resolve(__dirname, '../dist'),
17
17
  filename: '[name]/index.js'
18
18
  },
19
- devtool: 'inline-source-map',
19
+ // devtool: 'inline-source-map',
20
20
  module: {
21
21
  rules: [
22
22
  {
@@ -65,6 +65,7 @@ module.exports = {
65
65
  }
66
66
  ]
67
67
  },
68
+ // devtool: 'source-map',
68
69
  resolve: {
69
70
  extensions: ['.js', '.json', '.vue', '.jsx'],
70
71
  modules: [path.resolve(__dirname, '../node_modules')]
@@ -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, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, 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)
@@ -186,7 +187,6 @@ export default {
186
187
  const lang = inject('lang')
187
188
  const rootValue = inject('rootValue')
188
189
  const onClick = (e, { beforeRequestService, afterRequestService } = {}) => {
189
- e?.stopPropagation?.()
190
190
  const context = {
191
191
  props,
192
192
  dynamicMapComp,
@@ -200,7 +200,9 @@ export default {
200
200
  appContext
201
201
  }
202
202
  attrs?.onClick?.call(context, e) // 如果配置中有点击事件
203
- executeClickEvents({ beforeRequestService, afterRequestService })
203
+ if (findComponent(EXECTE_CLICK_EVENT_COMPONENTS, props.config?.renderby || props.config?.metaType) !== -1 ) {
204
+ executeClickEvents({ beforeRequestService, afterRequestService })
205
+ }
204
206
  }
205
207
  function executeClickEvents({ beforeRequestService, afterRequestService } = {}) {
206
208
  executeEventOrchestration({
@@ -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"
@@ -226,8 +226,8 @@ export default {
226
226
  }, (length) => {
227
227
  let list = []
228
228
  if (length) {
229
- const newVal = tableData?.value
230
- list = newVal.map((row, idx) => {
229
+ const newVal = tableData.value
230
+ list = newVal?.map?.((row, idx) => {
231
231
  const columnsCgs = rowColumnConfgsMap.get(row)
232
232
  if (columnsCgs) {
233
233
  columnsCgs.forEach(config => {
@@ -16,7 +16,8 @@ const appContext = getCurrentInstance()?.appContext
16
16
 
17
17
  const props = defineProps({
18
18
  ...commonPropsType,
19
- ...ElButton.props
19
+ ...ElButton.props,
20
+ plain: [String, Boolean]
20
21
  })
21
22
  const calcPorps = computed(() => {
22
23
  const ret = {
@@ -16,7 +16,8 @@ import { commonPropsType } from '../../utils/index.js'
16
16
  const modelValue = defineModel()
17
17
  const props = defineProps({
18
18
  ...ElSelect.props,
19
- ...commonPropsType
19
+ ...commonPropsType,
20
+ multiple: [String, Boolean]
20
21
  })
21
22
  const attrs = useAttrs()
22
23
 
@@ -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
+ }
@@ -35,6 +35,7 @@ export const NOT_NEED_FORM_ITEM_META_TYPE = [
35
35
  'cmi-dropdown-menu',
36
36
  'cmi-divider'
37
37
  ]
38
+ export const EXECTE_CLICK_EVENT_COMPONENTS = ['ElInput', 'ElButton', 'CmiInput', 'CmiButton']
38
39
  export const TRANS_CELL_COMPONETS = ['CmiInput', 'CmiSelect']
39
40
  export const NOT_NEED_COL_ITEM_META_TYPE = ['CustomComponentTabPane', 'CustomComponentDialog', 'CustomComponentCol', 'CustomComponentTabPaneH5']
40
41
  export const MULTI_PAGE_META_LIST_TYPES = ['CustomComponentTable']
@@ -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) {