resolver-egretimp-plus 0.0.124 → 0.0.125

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.124",
3
+ "version": "0.0.125",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -49,9 +49,10 @@
49
49
  "vue-loader": "^17.4.2",
50
50
  "vue-style-loader": "^4.1.3",
51
51
  "vue3-quill": "^0.3.1",
52
+ "vue3-sfc-loader": "^0.9.5",
52
53
  "webpack": "^5.90.0",
53
- "webpack-cli": "^5.1.4",
54
- "vue3-sfc-loader": "^0.9.5"
54
+ "json-rules-engine": "^7.2.1",
55
+ "webpack-cli": "^5.1.4"
55
56
  },
56
57
  "dependencies": {}
57
58
  }
@@ -49,6 +49,7 @@ export default {
49
49
  delete ret.onClick
50
50
  return ret
51
51
  })
52
+ const ruleExecuter = inject('_ruleExecuter')
52
53
  const dialogReq = inject('_dialogReq', {})
53
54
  const requestTraceId = inject('requestTraceId')
54
55
  const polyfillConfigs = inject('_polyfillConfigs', {})
@@ -113,9 +114,21 @@ export default {
113
114
  })
114
115
  penddingRules[hireRelat] = null
115
116
  }
117
+ // 使用json-rules-engine书写的规则,打开这边,需要对之前的规则进行注释,并且需要再index.js文件中进行开启 ====start====
118
+ if (ruleExecuter?.penddingRules?.[hireRelat]?.length) {
119
+ ruleExecuter?.penddingRules[hireRelat].forEach(context => {
120
+ const rules = context.rules
121
+ delete context.rules
122
+ setTimeout(() => {
123
+ rulesDriver.call(context, rules)
124
+ }, 0)
125
+ })
126
+ ruleExecuter.penddingRules[hireRelat] = null
127
+ }
116
128
  if (props.config?.immediateClickEvent) {
117
129
  executeClickEvents()
118
130
  }
131
+ // 使用json-rules-engine书写的规则,打开这边,需要对之前的规则进行注释,并且需要再index.js文件中进行开启 ====end====
119
132
  }
120
133
  const onVnodeUnmounted = () => {
121
134
  props.config.vmIsBind = false
@@ -419,6 +419,7 @@ export async function executeDataValid(validConfig, {
419
419
  return
420
420
  }
421
421
  const ret = await buildInRequest(url, {
422
+ aid_language: lang,
422
423
  requestTraceId,
423
424
  ...reqData,
424
425
  pmHandleBusinessIdentity: {
@@ -1,8 +1,16 @@
1
1
  <script setup>
2
2
  import { ElInput } from 'element-plus'
3
3
  import { computed, defineProps, useAttrs } from 'vue'
4
- import { commonPropsType } from '../../utils/index.js'
4
+ import { commonPropsType, isElement } from '../../utils/index.js'
5
+ import { ref } from 'vue';
6
+ import { onMounted } from 'vue';
7
+ import { getDomWidth } from '../../utils/dom.js';
8
+ import { watch } from 'vue';
9
+ import { nextTick } from 'vue';
5
10
 
11
+ const isOverflow = ref(false)
12
+ const inputWrapRef = ref(null)
13
+ const calcSpanRef = ref(null)
6
14
  const props = defineProps({
7
15
  ...commonPropsType,
8
16
  ...ElInput.props
@@ -17,10 +25,78 @@ const inputProps = computed(() => {
17
25
  }
18
26
  return ret
19
27
  })
28
+ const showTooltip = computed(() => {
29
+ return props?.config?.showTooltip == '1' && props.disabled
30
+ })
20
31
  const attrs = useAttrs()
21
32
  const modelValue = defineModel()
22
33
 
34
+
35
+ const tooltipCalc = (() => {
36
+ let unWatch = null
37
+ let onResize = null
38
+ return {
39
+ clear: () => {
40
+ unWatch && unWatch()
41
+ onResize && window.removeEventListener('resize', onResize)
42
+ },
43
+ calc() {
44
+ this.clear()
45
+ let inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
46
+ let textLengthWidth = getDomWidth(calcSpanRef.value, -22)
47
+ isOverflow.value = inputWrapWidth < textLengthWidth
48
+ unWatch = watch(() => modelValue.value, (val) => {
49
+ nextTick(() => {
50
+ textLengthWidth = getDomWidth(calcSpanRef.value, -22)
51
+ isOverflow.value = inputWrapWidth < textLengthWidth
52
+ })
53
+ })
54
+ onResize = () => {
55
+ inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
56
+ isOverflow.value = inputWrapWidth < textLengthWidth
57
+ console.log('isOverflow==:', isOverflow.value, inputWrapWidth)
58
+ }
59
+ window.addEventListener('resize', onResize)
60
+ }
61
+ }
62
+ })()
63
+
64
+ onMounted(() => {
65
+ watch(showTooltip, (val) => {
66
+ if (val) {
67
+ tooltipCalc?.calc()
68
+ }
69
+ }, {
70
+ immediate: true
71
+ })
72
+ })
23
73
  </script>
24
74
  <template>
25
- <ElInput v-model="modelValue" v-bind="{...attrs, ...inputProps}"></ElInput>
75
+ <div class="input-contrainer">
76
+ <span ref="calcSpanRef" class="calc-span">{{ modelValue }}</span>
77
+ <el-tooltip v-if="isOverflow" :content="modelValue" placement="top">
78
+ <div class="input-wrap" :ref="(e) => inputWrapRef = e">
79
+ <ElInput v-model="modelValue" v-bind="{...attrs, ...inputProps}"></ElInput>
80
+ </div>
81
+ </el-tooltip>
82
+ <div v-else class="input-wrap" :ref="(e) => inputWrapRef = e">
83
+ <ElInput v-model="modelValue" v-bind="{...attrs, ...inputProps}"></ElInput>
84
+ </div>
85
+ </div>
26
86
  </template>
87
+
88
+ <style lang="scss" scoped>
89
+ .input-contrainer {
90
+ width: 100%;
91
+ .calc-span {
92
+ white-space: nowrap;
93
+ position: absolute;
94
+ visibility: hidden;
95
+ padding: 0 11px;
96
+ box-sizing: border-box;
97
+ }
98
+ .input-wrap{
99
+ width: 100%;
100
+ }
101
+ }
102
+ </style>
@@ -9,7 +9,7 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
9
9
  // const dataLoad = inject('dataLoad')
10
10
  // const dynamicMapComp = inject('dynamicMapComp')
11
11
  // const lang = inject('lang')
12
- const { hireRelatMapRules, dataLoad, dynamicMapComp, lang, _mapComp } = this
12
+ const { hireRelatMapRules, messageInstance, rootValue, ruleExecuter, dataLoad, dynamicMapComp, lang, _mapComp } = this
13
13
  const currentRules = hireRelatMapRules.value[config.hireRelat]
14
14
  let metaCodeKey = config.metaCode
15
15
  if (modelKey !== 'update:modelValue') {
@@ -34,11 +34,22 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
34
34
  // 事件初始化执行,在dataLoaded请求完成之后,执行一次事件
35
35
  if (dataLoad.value && !config.eventInit && !config.notInit) {
36
36
  setTimeout(() => {
37
+ ruleExecuter?.run({
38
+ rootValue,
39
+ rules: currentRules,
40
+ config,
41
+ dynamicMapComp,
42
+ lang,
43
+ messageInstance,
44
+ _mapComp,
45
+ isInit: true,
46
+ })
37
47
  rulesDriver.call({
38
48
  config,
39
49
  dynamicMapComp,
40
50
  lang,
41
- _mapComp
51
+ _mapComp,
52
+ messageInstance
42
53
  }, currentRules, true)
43
54
  config.eventInit = true
44
55
  }, 0)
@@ -68,11 +79,21 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
68
79
  }
69
80
  if (config) {
70
81
  setTimeout(() => {
82
+ ruleExecuter?.run({
83
+ rootValue,
84
+ rules: currentRules,
85
+ config,
86
+ dynamicMapComp,
87
+ lang,
88
+ messageInstance,
89
+ _mapComp,
90
+ })
71
91
  rulesDriver.call({
72
92
  config,
73
93
  dynamicMapComp,
74
94
  lang,
75
- _mapComp
95
+ _mapComp,
96
+ messageInstance
76
97
  }, currentRules)
77
98
  }, 0)
78
99
  }
@@ -86,13 +107,19 @@ export function useVmodels(props, emit) {
86
107
  const dynamicMapComp = inject('dynamicMapComp')
87
108
  const lang = inject('lang')
88
109
  const _mapComp = inject('_mapComp')
110
+ const rootValue = inject('rootValue')
111
+ const ruleExecuter = inject('_ruleExecuter')
112
+ const messageInstance = inject('_messageInstance')
89
113
 
90
114
  const thisObj = {
91
115
  hireRelatMapRules,
92
116
  dataLoad,
93
117
  dynamicMapComp,
94
118
  lang,
95
- _mapComp
119
+ rootValue,
120
+ _mapComp,
121
+ ruleExecuter,
122
+ messageInstance: messageInstance?.value
96
123
  }
97
124
 
98
125
  const vModelObjs = reactive({})
package/src/index.jsx CHANGED
@@ -7,8 +7,7 @@ import { MODE } from "./utils/const.js"
7
7
  import { generateRequester } from "./utils/request.js"
8
8
  import { executeLoadServices } from "./components/helper/resolver.js"
9
9
  import { deepMerge } from "./utils/index.js"
10
- // import { useRouter } from "vue-router"
11
- // import { useRoute } from "vue-router"
10
+ // import { RuleExecuter } from "./rulesImp/index.js"
12
11
  export default {
13
12
  name: 'Resolver',
14
13
  props: {
@@ -130,6 +129,8 @@ export default {
130
129
  }
131
130
  },
132
131
  setup(props, { emit, attrs, expose }) {
132
+ const ruleExecuter = null
133
+ // const ruleExecuter = new RuleExecuter()
133
134
  const rootStore = reactive({})
134
135
  const nativeDataLoad = ref(false)
135
136
  // const router = useRouter()
@@ -213,6 +214,7 @@ export default {
213
214
  })
214
215
  toExecuteLoadServices()
215
216
  })
217
+ provide('_ruleExecuter', ruleExecuter)
216
218
  provide('_toExecuteLoadServices', toExecuteLoadServices)
217
219
  provide('_dialogReq', props.dialogReq)
218
220
  provide('_messageCb', props.messageCb)
@@ -342,7 +342,7 @@ const allInitEvents = {
342
342
  setPopup(event, isInit, tabpanelCode) {
343
343
  const { targetMsg, targetMsgEn } = event
344
344
  const msg = this.lang.value.indexOf('zh') > -1 ? targetMsg : targetMsgEn
345
- this.$alert(msg, '', {
345
+ this.messageInstance.warning(msg, '', {
346
346
  showCancelButton: false,
347
347
  });
348
348
  // commModal({