resolver-egretimp-plus 0.1.17 → 0.1.19

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.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -62,15 +62,17 @@ export class Bpm {
62
62
  }
63
63
  setNativeMethods() {
64
64
  const { validate: nativeValidate, dynamicMapComp, bpmSubmitBtn, toExecuteLoadServices } = this.params
65
- const { getDetailReq, customValidate } = this.bpmConfigs
65
+ const { getDetailReq, customValidate, saveValidate } = this.bpmConfigs
66
66
 
67
- const toSave = (cb, eventData) => {
67
+ const toSave = async (eventData) => {
68
+ if (saveValidate && typeof saveValidate === 'function') {
69
+ const saveVliad = await saveValidate()
70
+ if (!saveVliad) {
71
+ return
72
+ }
73
+ }
68
74
  const saveButton = dynamicMapComp[bpmSubmitBtn]
69
75
  if (saveButton) {
70
- if (!eventData && typeof cb !== 'function') {
71
- eventData = cb
72
- cb = null
73
- }
74
76
  const createAfterRequestService = (fn) => {
75
77
  return async (ret) => {
76
78
  const { saveAfter } = this.bpmConfigs
@@ -85,18 +87,12 @@ export class Bpm {
85
87
  }, 0);
86
88
  }
87
89
  }
88
- if (cb && typeof cb === 'function') {
90
+ return new Promise((resolve) => {
89
91
  saveButton?.vm?.click({
90
- afterRequestService: createAfterRequestService((ret) => { cb(ret) })
91
- })
92
- } else {
93
- return new Promise((resolve) => {
94
- saveButton?.vm?.click({
95
- // 保存成功的回调
96
- afterRequestService: createAfterRequestService((ret) => { resolve(ret) })
97
- })
92
+ // 保存成功的回调
93
+ afterRequestService: createAfterRequestService((ret) => { resolve(ret) })
98
94
  })
99
- }
95
+ })
100
96
  } else {
101
97
  messageInstance?.warning?.('no set bpmSubmitBtn, or bpmSubmitBtn is invalid, at preset, bpmSubmitBtn:', props.bpmSubmitBtn)
102
98
  }
@@ -320,6 +316,16 @@ export class Bpm {
320
316
  })
321
317
  })
322
318
  }
319
+ insertBtn(btns, position = 3) {
320
+ this.getSdkInstance().then((instance) => {
321
+ console.log('insert btns==:', btns, position)
322
+ instance?.getCustomApi()?.insertBtnForToolbar({
323
+ // 按钮插入位置
324
+ position,
325
+ btns,
326
+ })
327
+ })
328
+ }
323
329
  destroy() {
324
330
  window.removeEventListener("message", this.messageListener)
325
331
  this.sdkInstance = null
@@ -1,7 +1,17 @@
1
1
  <template>
2
2
  <TabPane v-for="(pageMetaList, $index) in (multiPmPageMetaList || [])" v-bind="{...tabPaneProps}" :key="pageMetaListKeys[pageMetaList.id]" :label="`${lang.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn}-${$index}`" :name="`${props.config?.metaCode}-${$index}`">
3
3
  <template #label v-if="labelRenderContentFn || pageMetaList.filter(config => config.collapseSlot).length">
4
- <component :is="labelRenderContentFn(getLableRenderParams(modelValue?.[$index]))" v-if="labelRenderContentFn"></component>
4
+ <component
5
+ v-if="labelRenderContentFn"
6
+ :is="labelRenderContentFn(
7
+ getLableRenderParams(
8
+ modelValue?.[$index],
9
+ props.activeNames === `${props.config?.metaCode}-${$index}`,
10
+ multiPmPageMetaList.length,
11
+ $index
12
+ )
13
+ )"
14
+ ></component>
5
15
  <Renderer v-else :modelValue="modelValue?.[$index]" :rowScope="{row: modelValue?.[$index], $index}" @update:modelValues="onUpdateModelValue($event, $index)" :config="pageMetaList.filter(config => config.collapseSlot)"></Renderer>
6
16
  </template>
7
17
  <ElRow>
@@ -20,6 +30,7 @@ import { h } from 'vue'
20
30
  const props = defineProps({
21
31
  ...commonPropsType,
22
32
  ...ElTabPane.props,
33
+ activeNames: String,
23
34
  })
24
35
 
25
36
  const modelValue = defineModel()
@@ -100,10 +111,13 @@ const labelRenderContentFn = computed(() => {
100
111
  return null
101
112
  }
102
113
  })
103
- function getLableRenderParams(tabPaneData) {
114
+ function getLableRenderParams(tabPaneData, isActive, total, idx) {
104
115
  return {
105
116
  config: props.config,
106
- tabPaneData
117
+ tabPaneData,
118
+ isActive,
119
+ total,
120
+ currentIndex: idx
107
121
  }
108
122
  }
109
123
  </script>
@@ -24,7 +24,8 @@ const slots = useSlots()
24
24
  const props = defineProps({
25
25
  ...commonPropsType,
26
26
  ...TabPane.props,
27
- hidden: [String, Boolean, Number]
27
+ hidden: [String, Boolean, Number],
28
+ activeNames: String,
28
29
  })
29
30
  const attrs = useAttrs()
30
31
 
@@ -62,7 +63,8 @@ const labelRenderContent = computed(() => {
62
63
  function getLableRenderParams() {
63
64
  return {
64
65
  config: props.config,
65
- tabPaneData: props.refValue.value
66
+ tabPaneData: props.refValue.value,
67
+ isActive: props.activeNames === props.config?.metaCode,
66
68
  }
67
69
  }
68
70
  </script>
@@ -157,52 +157,52 @@ export default {
157
157
  return config.displayType != DISPLAY_HIDDEN && !(config.width == 0 || config.width == '0px' || config.hidden == '1')
158
158
  })?.length
159
159
  const nextConfig = nextList.find(config => config.displayType != DISPLAY_HIDDEN)
160
- const props = Object.keys(ElTableColumn.props).reduce((ret, key) => {
160
+ const retObj = Object.keys(ElTableColumn.props).reduce((ret, key) => {
161
161
  if (hasOwn(config, key)) {
162
162
  ret[key] = config[key]
163
163
  }
164
164
  return ret
165
165
  }, {})
166
166
  if (config.showOverflowTooltip == '1' || config['show-overflow-tooltip'] == '1') {
167
- props['show-overflow-tooltip'] = true
168
- props.showOverflowTooltip = true
167
+ retObj['show-overflow-tooltip'] = true
168
+ retObj.showOverflowTooltip = true
169
169
  } else {
170
- props['show-overflow-tooltip'] = false
171
- props.showOverflowTooltip = false
170
+ retObj['show-overflow-tooltip'] = false
171
+ retObj.showOverflowTooltip = false
172
172
  }
173
- if (!props.prop) {
174
- props.prop = config.metaCode
173
+ if (!retObj.prop) {
174
+ retObj.prop = config.metaCode
175
175
  }
176
176
  if (config.columnWidth) {
177
- props.width = config.columnWidth
177
+ retObj.width = config.columnWidth
178
178
  }
179
- if (!props.width) {
180
- props.minWidth = '160px'
179
+ if (!retObj.width) {
180
+ retObj.minWidth = '160px'
181
181
  }
182
- if (props.width == 0 || props.width == '0px' || config.hidden == '1') {
183
- props.className = 'hidden-column'
184
- props.width = '1px'
182
+ if (retObj.width == 0 || retObj.width == '0px' || config.hidden == '1') {
183
+ retObj.className = 'hidden-column'
184
+ retObj.width = '1px'
185
185
  }
186
186
  if (nextConfig && (nextConfig.width == 0 || nextConfig.width == '0px' || nextConfig.hidden == '1')) {
187
- props.className = `${props.className || ''} next-hidden-column`
187
+ retObj.className = `${retObj.className || ''} next-hidden-column`
188
188
  }
189
189
  if (isEndConfig) {
190
- props.className = `${props.className || ''} end-show-column`
190
+ retObj.className = `${retObj.className || ''} end-show-column`
191
191
  }
192
192
  if (config.metaType == 'CustomComponentSelectEmployees') {
193
- props.className = `${props.className || ''} clear-index`
193
+ retObj.className = `${retObj.className || ''} clear-index`
194
194
  }
195
195
  if (
196
- isPlainColumn({...config, isColumn: true}, calcDisable(config, props.mode)) &&
196
+ isPlainColumn({...config, isColumn: true}, calcDisable(config, retObj.mode)) &&
197
197
  config.showOverflowTooltip != '0' &&
198
198
  config['show-overflow-tooltip'] != '0'
199
199
  ) {
200
- props['show-overflow-tooltip'] = true
201
- props.showOverflowTooltip = true
200
+ retObj['show-overflow-tooltip'] = true
201
+ retObj.showOverflowTooltip = true
202
202
  }
203
203
  if (config.type === 'selection') {
204
- const orginSelectable = props.selectable
205
- props.selectable = (row, index) => {
204
+ const orginSelectable = retObj.selectable
205
+ retObj.selectable = (row, index) => {
206
206
  let orginRet = true
207
207
  if (orginSelectable && typeof orginSelectable === 'function') {
208
208
  orginRet = orginSelectable(row, index, {
@@ -222,7 +222,7 @@ export default {
222
222
  return orginRet && parentSelectionsRet
223
223
  }
224
224
  }
225
- return props
225
+ return retObj
226
226
  }
227
227
 
228
228
  // 获取表格的配置,这边会做一下配置转化,表格中的不需要labelWidth
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <Tabs :class="[`tabs-level-${level}`, isHeaderAuto ? 'tabpane-auto-header' : '', fullBorder ? 'full-border' : '']" v-bind="transTabsProps" v-model="activeNames">
3
- <Renderer :config="tabpanes" v-model="props.refValue.value"></Renderer>
3
+ <Renderer :activeNames="activeNames" :config="tabpanes" v-model="props.refValue.value"></Renderer>
4
4
  <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
5
5
  <slot :name="key" v-bind="scope"></slot>
6
6
  </template>
@@ -19,6 +19,10 @@ const slots = useSlots()
19
19
  const props = defineProps({
20
20
  ...ElTabs.props,
21
21
  ...commonPropsType,
22
+ showBar: {
23
+ type: Boolean,
24
+ default: true
25
+ },
22
26
  })
23
27
  const attrs = useAttrs()
24
28
  const tabsProps = computed(() => {
@@ -39,24 +43,24 @@ const activeNames = computed({
39
43
  const currentCycleTab = tabpanes.value.find(tab => tab.currentCode)
40
44
  return (currentTab && currentTab.metaCode)
41
45
  || (currentCycleTab && currentCycleTab.currentCode)
42
- || (tabpanes.value[0] && (tabpanes.value[0].metaType === 'CustomComponentTabPane' && tabpanes.value[0].metaCode) || (tabpanes.value[0].metaType === 'CustomComponentCycleTabPane' && `${tabpanes.value[0].metaCode}-0`))
46
+ || tabpanes.value[0] && ((assertMetaType(tabpanes.value[0], 'CustomComponentCycleTabPane') && `${tabpanes.value[0].metaCode}-0`) || (tabpanes.value[0].metaType === 'CustomComponentTabPane' && tabpanes.value[0].metaCode))
43
47
  },
44
48
  set(val) {
45
49
  tabpanes.value.forEach(tab => {
46
- if (tab.metaType === 'CustomComponentTabPane') {
50
+ if (assertMetaType(tab, 'CustomComponentCycleTabPane')) {
51
+ if (/^cycleTabpane-(\d+)$/.test(val)) {
52
+ tab.currentCode = val
53
+ } else {
54
+ tab.currentCode = ''
55
+ }
56
+ } else if (tab.metaType === 'CustomComponentTabPane') {
47
57
  if (tab.metaCode === val) {
48
58
  tab.defaultShowFlag = '1'
49
59
  } else {
50
60
  tab.defaultShowFlag = '0'
51
61
  }
52
62
  }
53
- if (tab.metaType === 'CustomComponentCycleTabPane') {
54
- if (new RegExp(`^${tab.metaCode}-(\d+)$`).test(val)) {
55
- tab.currentCode = val
56
- } else {
57
- tab.currentCode = ''
58
- }
59
- }
63
+
60
64
  })
61
65
  }
62
66
  })
@@ -64,7 +68,7 @@ const isHeaderAuto = computed(() => {
64
68
  return props.config.autoHeader == '1'
65
69
  })
66
70
  const level = computed(() => {
67
- return props.config.level || tabpanes.value.find(tabpane => hasOwn(tabpane, 'level'))?.level || 1
71
+ return props.config.level ?? tabpanes.value.find(tabpane => hasOwn(tabpane, 'level'))?.level ?? 1
68
72
  })
69
73
  const transTabsProps = computed(() => {
70
74
  const polyProps = level.value == 1 ? {
@@ -76,7 +80,8 @@ const transTabsProps = computed(() => {
76
80
  } : {}
77
81
  return {
78
82
  ...tabsProps.value,
79
- ...polyProps
83
+ ...polyProps,
84
+ showBar: props.showBar,
80
85
  }
81
86
  })
82
87
  /**
@@ -86,6 +91,10 @@ const fullBorder = computed(() => {
86
91
  return tabpanes.value.length === 1 && level.value == 1
87
92
  })
88
93
 
94
+ function assertMetaType(config, metaType) {
95
+ return config.renderby === metaType || config.metaType === metaType
96
+ }
97
+
89
98
  defineExpose({
90
99
  setActiveTab(tabMetaCode) {
91
100
  activeNames.value = tabMetaCode
@@ -52,6 +52,10 @@ export const tabNavProps = buildProps({
52
52
  values: ['card', 'border-card', ''],
53
53
  default: '',
54
54
  },
55
+ showBar: {
56
+ type: Boolean,
57
+ default: true
58
+ },
55
59
  stretch: Boolean,
56
60
  })
57
61
 
@@ -379,10 +383,11 @@ const TabNav = defineComponent({
379
383
  ns.e('nav-wrap'),
380
384
  ns.is('scrollable', !!scrollable.value),
381
385
  ns.is(rootTabs.props.tabPosition),
386
+ !props.showBar ? 'hidden-bar' : ''
382
387
  ]}
383
388
  >
384
389
  {scrollBtn}
385
- <div class={ns.e('nav-scroll')} ref={navScroll$}>
390
+ <div class={[ns.e('nav-scroll')]} ref={navScroll$}>
386
391
  <div
387
392
  class={[
388
393
  ns.e('nav'),
@@ -399,7 +404,7 @@ const TabNav = defineComponent({
399
404
  onKeydown={changeTab}
400
405
  >
401
406
  {...[
402
- !props.type ? (
407
+ !props.type && props.showBar ? (
403
408
  <TabBar ref={tabBarRef} tabs={[...props.panes]} />
404
409
  ) : null,
405
410
  tabs,
@@ -49,6 +49,10 @@ export const tabsProps = buildProps({
49
49
  type: Function,
50
50
  default: () => true,
51
51
  },
52
+ showBar: {
53
+ type: Boolean,
54
+ default: true
55
+ },
52
56
  stretch: Boolean,
53
57
  })
54
58
  // export type TabsProps = ExtractPropTypes<typeof tabsProps>
@@ -177,6 +181,7 @@ const Tabs = defineComponent({
177
181
  ref={nav$}
178
182
  currentName={currentName.value}
179
183
  editable={props.editable}
184
+ showBar={props.showBar}
180
185
  type={props.type}
181
186
  panes={panes.value}
182
187
  stretch={props.stretch}
@@ -203,8 +208,8 @@ const Tabs = defineComponent({
203
208
  ]}
204
209
  >
205
210
  {...props.tabPosition !== 'bottom'
206
- ? [header, panels]
207
- : [panels, header]}
211
+ ? [panels, header]
212
+ : [header, panels]}
208
213
  </div>
209
214
  )
210
215
  }
package/src/index.jsx CHANGED
@@ -7,7 +7,7 @@ import { MODE } from "./utils/const.js"
7
7
  import { generateRequester } from "./utils/request.js"
8
8
  import { executeLoadServices, resetConfigEventInit } from "./components/helper/resolver.js"
9
9
  import { createEmptyCopy, deepMerge } from "./utils/index.js"
10
- import { initBpm, SUBMIT_TYPE } from "./bpm/bpmInstance.js"
10
+ import { initBpm, SUBMIT_TYPE, bpmInstance } from "./bpm/bpmInstance.js"
11
11
  // import { RuleExecuter } from "./rulesImp/index.js"
12
12
  export default {
13
13
  name: 'Resolver',
@@ -171,6 +171,14 @@ export default {
171
171
  bpmConfigs: {
172
172
  type: Object,
173
173
  default: {}
174
+ },
175
+ bpmBtns: {
176
+ type: Array,
177
+ default: [],
178
+ },
179
+ bpmBtnPosition: {
180
+ type: Number,
181
+ default: 3
174
182
  }
175
183
  },
176
184
  emits: ['update:modelValue', 'rootStoreChange'],
@@ -359,6 +367,9 @@ export default {
359
367
  return props.requestTraceId
360
368
  },
361
369
  toExecuteLoadServices,
370
+ getBpmInstance() {
371
+ return bpmInstance
372
+ }
362
373
  })
363
374
 
364
375
  const modelValue = computed({
@@ -377,6 +388,7 @@ export default {
377
388
  toExecuteLoadServices,
378
389
  bpmSubmitBtn: props.bpmSubmitBtn
379
390
  })
391
+ bpmInstance?.insertBtn?.(props.bpmBtns, props.bpmBtnPosition)
380
392
  }
381
393
  })
382
394
  return () => {
@@ -90,7 +90,6 @@ const allInitEvents = {
90
90
  const isReplace = /^_replace:/.test(targetObjVal)
91
91
  if (isReplace) {
92
92
  targetObjVal = replaceDefValue(targetObjVal?.replace(/^_replace:/, ''), {config, dynamicMapComp})
93
-
94
93
  }
95
94
  let val = ''
96
95
  try {
@@ -563,7 +562,7 @@ export function runEvent(events, isInit, tabpanelCode, rule) {
563
562
  const { eventId } = event
564
563
  const eventCode = eventsMap[eventId]
565
564
  // const { eventCode } = event
566
- console.log('evnet===:', event)
565
+ console.log('evnet===:', eventCode, event)
567
566
  return allInitEvents[eventCode] && allInitEvents[eventCode].call(this, event, isInit, tabpanelCode, rule)
568
567
  // return {
569
568
  // eventId,
@@ -3,6 +3,7 @@
3
3
  --el-button-hover-bg-color: #EFF0F1;
4
4
  --el-button-text-color: #1F2329;
5
5
  --el-font-size-base: 14px;
6
+ --el-font-weight-primary: 400;
6
7
  }
7
8
  .el-button--large {
8
9
  padding: 8px 12px;
@@ -23,6 +23,7 @@
23
23
  --el-border-color-lighter: #d0d3d6;
24
24
  --el-fill-color-lighter: #fafafa;
25
25
  --el-fill-color-light: #eff0f1;
26
+ --el-color-danger: #F54A45;
26
27
 
27
28
  --prmary-marign-second: 12px;
28
29
  --prmary-marign: 16px
@@ -10,6 +10,7 @@
10
10
  }
11
11
 
12
12
  .el-input__wrapper {
13
+ padding: 1px 8px;
13
14
  .el-input__clear {
14
15
  svg path {
15
16
  d: path("M 764.288 214.592 L 512 466.88 L 259.712 214.592 a 31.936 31.936 0 0 0 -45.12 45.12 L 466.752 512 L 214.528 764.224 a 31.936 31.936 0 1 0 45.12 45.184 L 512 557.184 l 252.288 252.288 a 31.936 31.936 0 0 0 45.12 -45.12 L 557.12 512.064 l 252.288 -252.352 a 31.936 31.936 0 1 0 -45.12 -45.184 Z")
@@ -3,7 +3,12 @@
3
3
 
4
4
  .resolver-tabs {
5
5
  // 这个是渲染器里面tabs
6
- display: block;
6
+ // display: block;
7
+ }
8
+ .hidden-bar {
9
+ &::after {
10
+ display: none;
11
+ }
7
12
  }
8
13
  .el-tabs {
9
14
  // display: block;
@@ -13,6 +18,10 @@
13
18
  padding: var(--prmary-marign-second) var(--prmary-marign) var(--prmary-marign) var(--prmary-marign);
14
19
  }
15
20
  }
21
+ .el-tabs__item {
22
+ min-height: var(--el-tabs-header-height);
23
+ height: unset;
24
+ }
16
25
  .tabs-level-1 {
17
26
  --el-tabs-header-height: 49px;
18
27
  &.full-border {
@@ -1,7 +1,7 @@
1
1
  @import './components/index.scss';
2
2
  * {
3
3
  font-family: PingFang SC,sans-serif;
4
- font-weight: normal;
4
+ font-weight: inherit;
5
5
  }
6
6
  .custom-form-item.hidden-label {
7
7
  & > .el-form-item__label {
@@ -18,29 +18,47 @@ function validFailAction(errInfo, dynamicMapComp) {
18
18
  let oneKey = errKyes[0]
19
19
  const referComps = []
20
20
  while (oneKey.indexOf('->') > -1) {
21
- const compInfo = dynamicMapComp[oneKey]
22
- compInfo && referComps.unshift(compInfo)
21
+ let idx = -1
22
+ let code = ''
23
+ const matchs = oneKey?.match(/^(.+)\[(\d+)\]$/)
24
+ if (matchs) {
25
+ idx = parseInt(matchs[2])
26
+ code = matchs[1]
27
+ } else {
28
+ code = oneKey
29
+ }
30
+
31
+ const compInfo = dynamicMapComp[code]
32
+ compInfo && referComps.unshift({
33
+ compInfo,
34
+ cycleIdx: idx
35
+ })
23
36
  oneKey = oneKey?.split('->')?.slice(0, -1)?.join('->') || ''
24
- // oneKey = oneKey.replace(/->[^(->)]+$/, '')
25
- // oneKey = oneKey.replace(/\[\d+\]$/, '')
26
37
  }
27
38
  const compInfo = dynamicMapComp[oneKey]
28
- compInfo && referComps.unshift(compInfo)
29
- referComps.forEach((comp, idx) => {
30
- validFail(comp, referComps?.[idx + 1])
39
+ compInfo && referComps.unshift({
40
+ compInfo,
41
+ cycleIdx: -1
42
+ })
43
+ referComps.forEach(({compInfo, cycleIdx}) => {
44
+ validFail(compInfo, cycleIdx)
31
45
  })
32
46
  // 组件对应的页面展示更新后才能获取到校验住的元素
33
47
  setTimeout(() => {
34
- const fouceErrEle = document.querySelector('.el-form-item__error')
35
- const fouceEle = fouceErrEle.parentElement
36
- fouceEle && fouceEle.scrollIntoView({ behavior: 'smooth' })
48
+ const {compInfo: config} = referComps.pop()
49
+ const veiwEl = config?.wrapVm?.vnode?.el
50
+ veiwEl && veiwEl.scrollIntoView({ behavior: 'smooth' })
51
+
52
+ // const fouceErrEle = document.querySelector('.el-form-item__error')
53
+ // const fouceEle = fouceErrEle.parentElement
54
+ // fouceEle && fouceEle.scrollIntoView({ behavior: 'smooth' })
37
55
  }, 200)
38
56
  }
39
57
  }
40
58
  // 校验不通过的时候,需要进行一下组件配置的调整,
41
59
  // 标签组件,需要进行聚焦当前页面
42
60
  // component组件,需要打开折叠
43
- function validFail(config, nextConfig) {
61
+ function validFail(config, cycleIdx) {
44
62
  const type = config.renderby || config.metaType
45
63
  switch (type) {
46
64
  case 'CustomComponentTabPane':
@@ -57,8 +75,7 @@ function validFail(config, nextConfig) {
57
75
  config.defaultShowFlag = '1'
58
76
  }
59
77
  if (type === 'CustomComponentCycleTabPane') {
60
- const rowIdx = nextConfig?.rowIndex
61
- config.currentCode = `${config.metaCode}-${rowIdx}`
78
+ config.currentCode = `${config.metaCode}-${cycleIdx}`
62
79
  }
63
80
  break
64
81
  case 'CustomComponentCollapse':