resolver-egretimp-plus 0.0.44 → 0.0.45

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.44",
3
+ "version": "0.0.45",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -201,7 +201,8 @@ export default {
201
201
  lang,
202
202
  rootValue,
203
203
  dynamicMapComp,
204
- props
204
+ props,
205
+ messageInstance: messageInstance?.value
205
206
  }) // 生成formItem()的辅助函数
206
207
  return formItemPolyfill(
207
208
  <currentComponent.value
@@ -0,0 +1 @@
1
+ export { default as default} from './src/index.vue'
@@ -0,0 +1,106 @@
1
+ <script setup>
2
+ import { computed, useAttrs } from 'vue';
3
+
4
+ const props = defineProps({
5
+ messageInstance: {
6
+ type: [Object, Function],
7
+ default: () => null
8
+ },
9
+ config: [Object, Array],
10
+ lang: String,
11
+ labelWidth: [String, Number]
12
+ })
13
+ const attrs = useAttrs()
14
+ const label = computed(() => {
15
+ if (props.config.labelHidden == '1' || props.config.labelWidth === 0 || props.config.labelWidth === '0') {
16
+ return ''
17
+ }
18
+ return (props.lang.indexOf('zh') > -1 ? props.config.metaNameZh : props.config.metaNameEn) || ''
19
+ })
20
+ const labelWidth = computed(() => {
21
+ if (!!props.config.labelPosition) {
22
+ return props.config.labelPosition
23
+ }
24
+ return 'left'
25
+ })
26
+ function handleClickTip() {
27
+ messageInstance?.text(props.lang.indexOf('zh') > -1 ? props.config.hintContentZh : props.config.hintContentEn)
28
+ }
29
+
30
+ </script>
31
+ <template>
32
+ <cmi-form-item v-bind="attrs" class="custom-form-item-h5"
33
+ :class="[{'--required': props.config.requiredFlag == '1', '--label-hide': !labelWidth,
34
+ '--label-text-left': labelPosition === 'left', '--label-text-right': labelPosition === 'right'
35
+ }, customClass]"
36
+ :labelWidth="props.labelWidth"
37
+ >
38
+ <div slot="label" class="custom-label--formItem">
39
+ <div class="custom-label-content">
40
+ <span class="label-required" v-if="props.config.requiredFlag == '1'">*</span>
41
+ <span class="label-text">{{ label }}</span>
42
+ <span class="label-tip" v-if="props.config.hintFlag == '1'" @click="handleClickTip"><cmi-icon-question-circle size="14"/></span>
43
+ </div>
44
+ </div>
45
+ <slot></slot>
46
+ </cmi-form-item>
47
+ </template>
48
+ <style lang="scss" scoped>
49
+ cmi-form-item {
50
+ position: relative;
51
+
52
+ .custom-label--formItem {
53
+ display: inline-flex;
54
+ align-items: center;
55
+ width: 100%;
56
+ // height: 16px;
57
+
58
+ .custom-label-content {
59
+ width: 100%;
60
+ display: -webkit-box;
61
+ line-height: 16px;
62
+ overflow: hidden;
63
+ text-overflow: ellipsis;
64
+ -webkit-line-clamp: 2;
65
+ -webkit-box-orient: vertical;
66
+ text-align: left;
67
+ .label-required {
68
+ color: #f5222d;
69
+ position: relative;
70
+ right: 3px;
71
+ top: 3px;
72
+ }
73
+ .label-text {
74
+ padding-right: 3px;
75
+ }
76
+ .label-tip {
77
+ position: absolute;
78
+ right: 16px;
79
+ top: 2px;
80
+ }
81
+ }
82
+ }
83
+
84
+ &.--label-text-left {
85
+ .custom-label--formItem {
86
+ .custom-label-content {
87
+ text-align: left;
88
+ }
89
+ }
90
+ }
91
+
92
+ &.--label-text-right {
93
+ .custom-label--formItem {
94
+ .custom-label-content {
95
+ text-align: right;
96
+ }
97
+ }
98
+ }
99
+
100
+ &.--required {
101
+ .custom-label-content {
102
+ padding-left: 3px;
103
+ }
104
+ }
105
+ }
106
+ </style>
@@ -30,16 +30,6 @@ const checkboxProps = computed(() => {
30
30
  const attrs = useAttrs()
31
31
  const modeValue = defineModel()
32
32
 
33
- const aa = [
34
- {
35
- columnValue: 'aaa',
36
- columnDesc_zh: 'aaa',
37
- },
38
- {
39
- columnValue: 'bbb',
40
- columnDesc_zh: 'bbb',
41
- }
42
- ]
43
33
  const onChange = ({ detail }) => {
44
34
  modeValue.value = detail.value
45
35
  }
@@ -49,11 +39,11 @@ const onSigleChange = ({ detail }) => {
49
39
  </script>
50
40
 
51
41
  <template>
52
- <cmi-checkbox-group :value="modeValue" @change="onChange" v-if="props.options && props.options.length" v-bind="{...checkboxGroupProps, ...attrs}">
42
+ <cmi-checkbox-group :value="modeValue" @change="onChange" v-if="props.options && props.options.length" v-bind="{...attrs, ...checkboxGroupProps}">
53
43
  <cmi-checkbox
54
44
  class="mr-20"
55
45
  v-for="option in props.options" :key="option.columnValue"
56
- :disabled="option.columnStatus == '0' || option.columnStatus == '2'"
46
+ :disabled="props.disabled || option.columnStatus == '0' || option.columnStatus == '2'"
57
47
  :name="option.columnValue" :label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
58
48
  >
59
49
  {{lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}}
@@ -9,7 +9,7 @@ const props = defineProps({
9
9
  const inputProps = computed(() => {
10
10
  return {
11
11
  label: props.config?.label,
12
- type: props.config?.type,
12
+ type: props.config?.displayType,
13
13
  name: props.config?.name,
14
14
  placeholder: lang?.value?.indexOf('zh') > -1 ? props.config?.defPlacehold : props.config?.defPlaceholdEn,
15
15
  min: props.config?.min,
@@ -54,7 +54,7 @@ const selectProps = computed(() => {
54
54
  multiple: isMutiple.value,
55
55
  placeholder: lang?.value?.indexOf('zh') > -1 ? props.config?.defPlacehold : props.config?.defPlaceholdEn,
56
56
  'max-options-visible': props.config?.['max-options-visible'] || props.config?.maxOptionsVisible,
57
- required: props.required,
57
+ // required: props.required,
58
58
  }
59
59
  })
60
60
  const clear = () => {
@@ -16,8 +16,8 @@ const attrs = useAttrs()
16
16
  const lang = inject('lang')
17
17
  const cmiProps = computed(() => {
18
18
  return {
19
- title: lang?.value?.indexOf('zh') ? props.config?.metaNameZh : props.config?.metaNameEn,
20
- subtitle: lang?.value?.indexOf('zh') ? props.config.subtitleZh : props.config.subtitleEn,
19
+ title: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
20
+ subtitle: lang?.value?.indexOf('zh') > -1 ? props.config.subtitleZh : props.config.subtitleEn,
21
21
  content: props.content,
22
22
  noborder: props.noborder == '1' ? true : false,
23
23
  cardbgcolor: props.cardbgcolor || '#FAFAFA',
@@ -16,7 +16,7 @@ const tableProps = computed(() => {
16
16
  card: props.config?.displayType === 'card',
17
17
  display: props.config?.display,
18
18
  open: props.config?.open === '1',
19
- showlandscape: props.config?.showlandscape === '1',
19
+ showlandscape: props.config?.showLandscape === '1',
20
20
  }
21
21
  })
22
22
 
@@ -12,6 +12,9 @@ const inputProps = computed(() => {
12
12
  total[key] = props[key]
13
13
  return total
14
14
  }, {})
15
+ if (props.config?.icon) {
16
+ ret.suffixIcon = props.config?.icon
17
+ }
15
18
  return ret
16
19
  })
17
20
  const attrs = useAttrs()
@@ -1,6 +1,6 @@
1
1
  import { getCodeMapRules } from '../rules/rulesDriver.js'
2
2
  import { resolveAssetComponents, findComponent, compareComponet, normalPixel, isPlainObject, hasOwn, isFnStr, normalCapitalizeComponent, capitalize, camelize, formatDate} from './common.js'
3
- import { resolveComponent, inject } from 'vue'
3
+ import { resolveComponent, inject, defineAsyncComponent } from 'vue'
4
4
  import CustomComponentColH5 from '../components/packages-H5/CustomComponentColH5.vue'
5
5
  import {
6
6
  commonPropsType,
@@ -26,6 +26,7 @@ import { isArray, isFunction, isString } from './is.js'
26
26
  import CustomComponentPlain from '../components/packages-web/CustomComponentPlain.vue'
27
27
  import QuestionFilled from '../components/icons/question-filled.vue'
28
28
  import { dispatchClickEvent, dispatchClickEvents, getTableConfig } from '../components/helper/eventOrchestration.js'
29
+ import CmiFormItem from '../components/cmiFormItem'
29
30
 
30
31
  // 解析配置中的defStyle属性
31
32
  export function parseDefStyle(defStyle) {
@@ -582,20 +583,27 @@ function generateFormItemPc (config, lang, compProps, params,) {
582
583
  }
583
584
  }
584
585
 
585
- function generateFormItemH5(config, lang, compProps, params) {
586
+ function generateFormItemH5(config, lang, compProps, params = {}) {
587
+ const { messageInstance } = params
588
+ const props = {
589
+ config,
590
+ lang,
591
+ messageInstance,
592
+ hidemessage: config?.hidemessage == '1' ? true : false,
593
+ hideasterisk: config?.hideasterisk == '1' ? true : false,
594
+ ...getFormItemExtendProps(config, lang, params),
595
+ }
596
+ // labelWidth 需要特殊处理
597
+ if (hasOwn(config, 'labelWidth')) {
598
+ props.labelWidth = props.labelWidth && `${props.labelWidth}` !== '-1' ? props.labelWidth : undefined
599
+ }
600
+
586
601
  return node => {
587
602
  if (!config.needformItem && !config.showFormItem) {
588
603
  return node
589
604
  }
590
- const props = {
591
- label: lang.indexOf('zh') > -1 ? config.metaNameZh : config.metaNameEn,
592
- hidemessage: config?.hidemessage == '1' ? true : false,
593
- hideasterisk: config?.hideasterisk == '1' ? true : false,
594
- ...getFormItemExtendProps(config, lang, params),
595
- }
596
-
597
605
  return (
598
- <cmi-form-item class="custom-form-item-h5" {...props}>{node}</cmi-form-item>
606
+ <CmiFormItem {...props}>{node}</CmiFormItem>
599
607
  )
600
608
  }
601
609
  }