resolver-egretimp-plus 0.0.276 → 0.0.278

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.276",
3
+ "version": "0.0.278",
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, watch } from 'vue'
2
- import { commonPropsType, definePrivatelyProp, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, getComponentPropsKeys, hasOwn, isPlainObject } from './utils/index.js'
2
+ import { commonPropsType, definePrivatelyProp, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, getComponentPropsKeys, getComponentSolt, hasOwn, 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 from './rules/rulesDriver'
@@ -308,7 +308,11 @@ export default {
308
308
  {...componentProps}
309
309
  {...compProps}
310
310
  {...vModelObjs}
311
- ></currentComponent.value>
311
+ >
312
+ {
313
+ getComponentSolt({config: props.config})
314
+ }
315
+ </currentComponent.value>
312
316
  )
313
317
  }
314
318
  }
@@ -134,9 +134,4 @@ function toCollapse() {
134
134
  .CustomComponentCollapseH5.CustomComponentCollapseH5.CustomComponentCollapseH5:last-child {
135
135
  margin-bottom: 0;
136
136
  }
137
- .CustomComponentTabsH5 {
138
- .CustomComponentCollapseH5 {
139
- margin-bottom: 0;
140
- }
141
- }
142
137
  </style>
@@ -229,7 +229,8 @@ onMounted(() => {
229
229
  watch(() => {
230
230
  return {
231
231
  val: normalTableData.value,
232
- pageNum: page.pageNum
232
+ pageNum: page.pageNum,
233
+ collapseHidden: props?.config?.collapseHidden
233
234
  }
234
235
  }, ({ val }) => {
235
236
  try {
@@ -66,10 +66,21 @@ const onUpdateModelValue = (val, code) => {
66
66
  }
67
67
  }
68
68
 
69
+ const gap = computed(() => {
70
+ return props.config.gap ?? '1'
71
+ })
72
+
73
+ const customClass = computed(() => {
74
+ return {
75
+ "custom-component-tabs-h5": true,
76
+ "--gap": gap.value == '1'
77
+ }
78
+ })
79
+
69
80
  </script>
70
81
 
71
82
  <template>
72
- <cmi-tabs class="custom-component-tabs-h5" v-bind="{...attrs, ...tabProps}">
83
+ <cmi-tabs :class="customClass" v-bind="{...attrs, ...tabProps}">
73
84
  <CustomComponentTabPaneH5
74
85
  v-for="tabpane in tabpanes" :config="tabpane" :key="tabpane.metaId"
75
86
  >
@@ -85,3 +96,24 @@ const onUpdateModelValue = (val, code) => {
85
96
  // }
86
97
  }
87
98
  </style>
99
+
100
+ <style lang="scss">
101
+ .CustomComponentTabsH5 {
102
+ margin-bottom: 16px;
103
+ &:last-child {
104
+ margin-bottom: 0;
105
+ }
106
+ .CustomComponentCollapseH5 {
107
+ margin-bottom: 0;
108
+ }
109
+ .--gap {
110
+ --cmi-tabs-background-color: transparent;
111
+ .CustomComponentCollapseH5 {
112
+ margin-bottom: 16px;
113
+ &:last-child {
114
+ margin-bottom: 0;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ </style>
@@ -7,16 +7,20 @@
7
7
  <ElRow>
8
8
  <Renderer :config="(props.config.pmPageMetaList || []).filter(config => !config.collapseSlot)" v-model="props.refValue.value"></Renderer>
9
9
  </ElRow>
10
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
11
+ <slot :name="key" v-bind="scope"></slot>
12
+ </template>
10
13
  </TabPane>
11
14
  </template>
12
15
  <script setup>
13
16
  import { ElTabPane, ElRow } from 'element-plus'
14
17
  import Renderer from '../../renderer.jsx'
15
- import { computed, inject, useAttrs } from 'vue'
18
+ import { computed, inject, useAttrs, useSlots } from 'vue'
16
19
  import { commonPropsType } from '../../utils/index.js'
17
20
  import { TabPane } from '../tabs'
18
21
  import { h } from 'vue'
19
22
 
23
+ const slots = useSlots()
20
24
  const props = defineProps({
21
25
  ...commonPropsType,
22
26
  ...TabPane.props,
@@ -1,17 +1,21 @@
1
1
  <template>
2
2
  <Tabs :class="[`tabs-level-${level}`, isHeaderAuto ? 'tabpane-auto-header' : '', fullBorder ? 'full-border' : '']" v-bind="transTabsProps" v-model="activeNames">
3
3
  <Renderer :config="tabpanes" v-model="props.refValue.value"></Renderer>
4
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
5
+ <slot :name="key" v-bind="scope"></slot>
6
+ </template>
4
7
  </Tabs>
5
8
  </template>
6
9
  <script setup>
7
10
  import { ElTabs } from 'element-plus'
8
11
  import Tabs from '../tabs'
9
12
  import Renderer from '../../renderer.jsx'
10
- import { computed, useAttrs } from 'vue'
13
+ import { computed, useAttrs, useSlots } from 'vue'
11
14
  import { commonPropsType, hasOwn } from '../../utils/index.js'
12
15
 
13
16
  // import * as lib from 'element-plus/es/utils/index.mjs'
14
17
 
18
+ const slots = useSlots()
15
19
  const props = defineProps({
16
20
  ...ElTabs.props,
17
21
  ...commonPropsType,
@@ -1,11 +1,14 @@
1
1
  <template>
2
2
  <ElButton @click.stop="buttonAction" v-bind="{...calcAttrs, ...calcPorps}">
3
3
  {{label}}
4
+ <template v-for="(_, keyaa) in slots" :key="keyaa" v-slot:[keyaa]="scope">
5
+ <slot :name="keyaa" v-bind="scope"></slot>
6
+ </template>
4
7
  </ElButton>
5
8
  </template>
6
9
  <script setup>
7
10
  import { ElButton } from 'element-plus'
8
- import { defineProps, inject, getCurrentInstance, computed, useAttrs } from 'vue'
11
+ import { defineProps, inject, getCurrentInstance, computed, useAttrs, useSlots } from 'vue'
9
12
  import { commonPropsType, isPromise } from '../../utils/index.js'
10
13
  import { useRoute } from 'vue-router'
11
14
 
@@ -13,7 +16,7 @@ defineOptions({
13
16
  inheritAttrs: false
14
17
  })
15
18
  const appContext = getCurrentInstance()?.appContext
16
-
19
+ const slots = useSlots()
17
20
  const props = defineProps({
18
21
  ...commonPropsType,
19
22
  ...ElButton.props,
@@ -6,17 +6,24 @@
6
6
  :value="option.columnValue"
7
7
  >
8
8
  {{lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}}
9
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
10
+ <slot :name="key" v-bind="scope"></slot>
11
+ </template>
9
12
  </ElCheckbox>
10
13
  </ElCheckboxGroup>
11
14
  <ElCheckbox v-else v-bind="{...checkboxProps, ...attrs}" v-model="proxyValue">
12
15
  {{ label }}
16
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
17
+ <slot :name="key" v-bind="scope"></slot>
18
+ </template>
13
19
  </ElCheckbox>
14
20
  </template>
15
21
  <script setup>
16
22
  import { ElCheckbox, ElCheckboxGroup } from 'element-plus'
17
- import { useAttrs, computed, inject, ref } from 'vue'
23
+ import { useAttrs, computed, inject, useSlots } from 'vue'
18
24
  import { commonPropsType, hasOwn } from '../../utils/index.js'
19
25
 
26
+ const slots = useSlots()
20
27
  const props = defineProps({
21
28
  ...ElCheckbox.props,
22
29
  ...commonPropsType,
@@ -1,13 +1,18 @@
1
1
  <template>
2
- <ElDatePicker v-bind="{ ...attrs, ...datePickerProps}" :disabledDate="disabledDate" v-model="value"></ElDatePicker>
2
+ <ElDatePicker v-bind="{ ...attrs, ...datePickerProps}" :disabledDate="disabledDate" v-model="value">
3
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
4
+ <slot :name="key" v-bind="scope"></slot>
5
+ </template>
6
+ </ElDatePicker>
3
7
  </template>
4
8
  <script setup>
5
9
  import { ElDatePicker } from 'element-plus'
6
- import { useAttrs, computed, watch, nextTick } from 'vue'
10
+ import { useAttrs, computed, watch, nextTick, useSlots } from 'vue'
7
11
  import { commonPropsType, formatDate, isDate, hasOwn } from '../../utils/index.js'
8
12
  import { useFormItem } from 'element-plus'
9
13
  import dateIcon from '../icons/date.vue'
10
14
 
15
+ const slots = useSlots()
11
16
  const { formItem: elFormItem } = useFormItem()
12
17
  const props = defineProps({
13
18
  ...ElDatePicker.props,
@@ -61,7 +61,7 @@ export default {
61
61
  },
62
62
  },
63
63
  emits: ['update:modelValue'],
64
- setup(props, { emit, attrs, expose }) {
64
+ setup(props, { emit, attrs, expose, slots }) {
65
65
  const isOverflow = ref(false)
66
66
  const inputWrapRef = ref(null)
67
67
  const calcSpanRef = ref(null)
@@ -232,7 +232,9 @@ export default {
232
232
  return node
233
233
  }
234
234
  const getInputSolts = () => {
235
- const ret = {}
235
+ const ret = {
236
+ ...slots
237
+ }
236
238
  if (inputProps.value?.suffixIcon) {
237
239
  const suffixIcon = resolveComponent(inputProps.value.suffixIcon)
238
240
  ret.suffix = () => {
@@ -1,11 +1,16 @@
1
1
  <template>
2
- <ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="inputNumberValue"></ElInputNumber>
2
+ <ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="inputNumberValue">
3
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
4
+ <slot :name="key" v-bind="scope"></slot>
5
+ </template>
6
+ </ElInputNumber>
3
7
  </template>
4
8
  <script setup>
5
9
  import { ElInputNumber } from 'element-plus'
6
- import { useAttrs, computed, ref } from 'vue'
10
+ import { useAttrs, computed, ref, useSlots } from 'vue'
7
11
  import { commonPropsType, isDate } from '../../utils/index.js'
8
12
 
13
+ const slots = useSlots()
9
14
  const props = defineProps({
10
15
  textAlign: {
11
16
  type: String, // left、right
@@ -1,12 +1,13 @@
1
1
  <script setup>
2
2
  import { ElPagination } from 'element-plus'
3
- import { computed, defineProps, useAttrs } from 'vue'
3
+ import { computed, defineProps, useAttrs, useSlots } from 'vue'
4
4
  import { commonPropsType, hasOwn } from '../../utils/index.js'
5
5
 
6
6
  const props = defineProps({
7
7
  ...commonPropsType,
8
8
  ...ElPagination.props,
9
9
  })
10
+ const slots = useSlots()
10
11
  const calcProps = computed(() => {
11
12
  const ret = Object.keys(ElPagination.props).reduce((total, key) => {
12
13
  total[key] = props[key]
@@ -52,5 +53,9 @@ const modelValue = defineModel()
52
53
 
53
54
  </script>
54
55
  <template>
55
- <ElPagination v-bind="{...attrs, ...calcProps}"></ElPagination>
56
+ <ElPagination v-bind="{...attrs, ...calcProps}">
57
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
58
+ <slot :name="key" v-bind="scope"></slot>
59
+ </template>
60
+ </ElPagination>
56
61
  </template>
@@ -5,19 +5,22 @@
5
5
  :value="option.columnValue"
6
6
  >
7
7
  {{lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}}
8
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
9
+ <slot :name="key" v-bind="scope"></slot>
10
+ </template>
8
11
  </CurrentRadio>
9
12
  </el-radio-group>
10
13
  </template>
11
14
  <script setup>
12
15
  import { ElRadioGroup, ElRadio, ElRadioButton } from 'element-plus'
13
- import { useAttrs, computed, inject, ref } from 'vue'
16
+ import { useAttrs, computed, inject, useSlots } from 'vue'
14
17
  import { commonPropsType, hasOwn } from '../../utils/index.js'
15
18
 
16
19
  const props = defineProps({
17
20
  ...ElRadioGroup.props,
18
21
  ...commonPropsType,
19
22
  })
20
-
23
+ const slots = useSlots()
21
24
  // 两种样式,一种是button,一种是default,默认为default
22
25
  const type = computed(() => {
23
26
  return props.config.type || 'default'
@@ -0,0 +1,158 @@
1
+ import { ElSelect, ElOption } from 'element-plus'
2
+ import { computed, inject} from 'vue'
3
+ import { commonPropsType } from '../../utils/index.js'
4
+
5
+ export default {
6
+ inheritAttrs: false,
7
+ props: {
8
+ ...ElSelect.props,
9
+ ...commonPropsType,
10
+ multiple: [String, Boolean],
11
+ filterable: [String, Boolean],
12
+ multipleLimit: [String, Number],
13
+ rangeOptions: Array,
14
+ excludeOptions: Array,
15
+ // 多选的分割符号
16
+ separator: {
17
+ type: [String],
18
+ default: ','
19
+ }
20
+ },
21
+ emits: ['update:modelValue'],
22
+ setup(props, { emit, attrs, expose, slots }) {
23
+ const VALUE_TYPES = {
24
+ LIST: 'list',
25
+ OBJECT: 'object',
26
+ STRING: 'string',
27
+ }
28
+ // 这个是真实的值
29
+ const modelValue = computed({
30
+ get() {
31
+ return props.modelValue
32
+ },
33
+ set(val) {
34
+ emit('update:modelValue', val)
35
+ }
36
+ })
37
+ const separator = computed(() => {
38
+ return props.separator
39
+ })
40
+ const valueTypes = computed(() => {
41
+ return props.config?.valueType
42
+ })
43
+ // 值是list 还是,连起来的string
44
+ const isStrVal = computed(() => {
45
+ // valueType 值为 list 或者 string
46
+ return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
47
+ })
48
+ const isObject = computed(() => {
49
+ return valueTypes.value === VALUE_TYPES.OBJECT
50
+ })
51
+
52
+ // 是否为多选
53
+ const isMutiple = computed(() => {
54
+ return props.multiple == '1'
55
+ })
56
+
57
+ const options = computed(() => {
58
+ let list = props.options
59
+ if (props.rangeOptions && props.rangeOptions.length) {
60
+ list = list?.filter?.(item => props.rangeOptions?.some(subValue => subValue == item.columnValue))
61
+ }
62
+ if (props.excludeOptions && props.excludeOptions.length) {
63
+ list = list?.filter?.(item => !(props.excludeOptions?.some(subValue => subValue == item.columnValue)))
64
+ }
65
+ return list
66
+ })
67
+
68
+ const value = computed({
69
+ get() {
70
+ if (isMutiple.value) {
71
+ const val = modelValue.value || ''
72
+ return val ?
73
+ (
74
+ isStrVal.value ?
75
+ val.split(separator.value) :
76
+ (
77
+ isObject.value ?
78
+ Object.values(val || {}) :
79
+ val
80
+ )
81
+ ) :
82
+ []
83
+ } else {
84
+ if (modelValue.value !== null && modelValue.value !== undefined) {
85
+ if (options.value?.some(item => item.columnValue == modelValue.value)) {
86
+ props.config.isMatch = true
87
+ return `${modelValue.value}`
88
+ } else {
89
+ props.config.isMatch = false
90
+ return ''
91
+ }
92
+ } else {
93
+ return ''
94
+ }
95
+ }
96
+ },
97
+ set(val) {
98
+ if (isMutiple.value) {
99
+ modelValue.value = isStrVal.value ?
100
+ val.join(separator.value) :
101
+ (
102
+ isObject.value ?
103
+ val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
104
+ val
105
+ )
106
+ } else {
107
+ modelValue.value = val
108
+ }
109
+ }
110
+ })
111
+
112
+ const selectProps = computed(() => {
113
+ const attrs = Object.keys(ElSelect.props).reduce((ret, key) => {
114
+ ret[key] = props[key]
115
+ return ret
116
+ }, {})
117
+ if (attrs.placeholder === null || attrs.placeholder === undefined) {
118
+ attrs.placeholder = ''
119
+ }
120
+ if (typeof attrs.filterable === 'string') {
121
+ attrs.filterable = attrs.filterable == '1'
122
+ }
123
+ if (typeof attrs.multiple === 'string') {
124
+ attrs.multiple = attrs.multiple == '1'
125
+ }
126
+ if (!attrs['suffix-icon'] && !attrs.suffixIcon) {
127
+ delete attrs.suffixIcon
128
+ delete attrs['suffix-icon']
129
+ }
130
+ attrs.multipleLimit = Number(parseInt(attrs.multipleLimit || 0))
131
+ return attrs
132
+ })
133
+ const lang = inject('lang')
134
+ const clear = () => {
135
+ modelValue.value = ''
136
+ }
137
+
138
+ return () => {
139
+ return (
140
+ <ElSelect class="custom-self-select" { ...{...attrs, ...selectProps.value }} v-model={value.value} onClear={clear}>
141
+ {
142
+ {
143
+ default: () => options.value?.map(option => (
144
+ <ElOption
145
+ key={option.columnValue}
146
+ label={lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}
147
+ value={option.columnValue}
148
+ disabled={option.columnStatus == '0' || option.columnStatus == '2'}
149
+ />
150
+ )),
151
+ ...slots
152
+ }
153
+ }
154
+ </ElSelect>
155
+ )
156
+ }
157
+ }
158
+ }
@@ -4,10 +4,11 @@
4
4
  </template>
5
5
  <script setup>
6
6
  import { ElText } from 'element-plus'
7
- import { computed, defineProps, inject, getCurrentInstance, useAttrs } from 'vue'
7
+ import { computed, defineProps, inject, getCurrentInstance, useAttrs, useSlots } from 'vue'
8
8
  import { commonPropsType } from '../../utils/index.js'
9
9
  import { h } from 'vue'
10
10
 
11
+ const slots = useSlots()
11
12
  const lang = inject('lang')
12
13
  const modelValue = defineModel()
13
14
  const appContext = getCurrentInstance()?.appContext
@@ -60,7 +61,8 @@ const renderNode = computed(() => {
60
61
  clickAction()
61
62
  }
62
63
  }, {
63
- default: () => labelDesc.value
64
+ default: () => labelDesc.value,
65
+ ...slots,
64
66
  })
65
67
  if (props.needWrap == '1') {
66
68
  return h('div', {
@@ -1,11 +1,16 @@
1
1
  <template>
2
- <ElTimePicker v-bind="calcProps" v-model="modeValue"></ElTimePicker>
2
+ <ElTimePicker v-bind="calcProps" v-model="modeValue">
3
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
4
+ <slot :name="key" v-bind="scope"></slot>
5
+ </template>
6
+ </ElTimePicker>
3
7
  </template>
4
8
  <script setup>
5
9
  import { ElTimePicker } from "element-plus"
6
- import { useAttrs, computed, ref, watch } from "vue"
7
- import { commonPropsType, isDate } from "../../utils/index.js"
10
+ import { useAttrs, computed, useSlots } from "vue"
11
+ import { commonPropsType } from "../../utils/index.js"
8
12
 
13
+ const slots = useSlots()
9
14
  const attrs = useAttrs()
10
15
  const props = defineProps({
11
16
  min: {
@@ -986,7 +986,6 @@ function createFormLable(config, lang = 'zh') {
986
986
  )
987
987
  }
988
988
 
989
-
990
989
  export function getComponentPropsKeys(comp, config) {
991
990
  let propsKeys = []
992
991
  if (typeof comp === 'string') {
@@ -1049,3 +1048,26 @@ function generateVuePath(path) {
1049
1048
  }
1050
1049
  return new LoadModulePath(path)
1051
1050
  }
1051
+
1052
+ export function getComponentSolt({
1053
+ config,
1054
+ slotKey = 'slots'
1055
+ }) {
1056
+ const slots = config?.[slotKey]
1057
+ if (config.metaType === 'ElButton') {
1058
+ // debugger
1059
+ }
1060
+ if (slots) {
1061
+ let retSlots = null
1062
+ try {
1063
+ retSlots = Object.keys(slots).reduce((ret, key) => {
1064
+ ret[key] = slots[key]
1065
+ return ret
1066
+ }, {})
1067
+ } catch (error) {
1068
+ console.error('slots parse fail, error==:', error)
1069
+ }
1070
+ return retSlots
1071
+ }
1072
+ return {}
1073
+ }