resolver-egretimp-plus 0.1.113 → 0.1.115
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/dist/h5/index.js +1 -1
- package/dist/theme/element/index.css +1 -1
- package/dist/theme/element/src/components/common.scss +4 -0
- package/dist/theme/element/src/components/text.scss +17 -0
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/analysisComponent.jsx +2 -1
- package/src/components/helper/table.jsx +26 -23
- package/src/components/packages-H5/CustomComponentCollapseH5.vue +6 -2
- package/src/components/packages-web/ElText.jsx +0 -1
- package/src/theme/element/components/common.scss +4 -0
- package/src/theme/element/components/text.scss +17 -0
- package/src-bak/analysisComponent.jsx +343 -0
- package/src-bak/api/builtIn.js +10 -0
- package/src-bak/bpm/bpmInstance.js +388 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/application.js +8 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/component.js +97 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/datasource.js +88 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/index.js +3 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/UdcComponent.js +76 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/index.js +201 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/index.js +69 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/page.js +56 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/impl/utils.js +76 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/index.js +46 -0
- package/src-bak/bpm/udc-sdk-esm/cjs/utils.js +21 -0
- package/src-bak/components/childDialog/index.js +39 -0
- package/src-bak/components/childDialog/src/index.vue +185 -0
- package/src-bak/components/cmiFormItem/index.js +1 -0
- package/src-bak/components/cmiFormItem/src/index.vue +112 -0
- package/src-bak/components/confirmInstance-H5/index.js +53 -0
- package/src-bak/components/confirmInstance-H5/src/index.vue +54 -0
- package/src-bak/components/helper/FormPolyfill.jsx +25 -0
- package/src-bak/components/helper/calcTooltip.jsx +134 -0
- package/src-bak/components/helper/dock.js +141 -0
- package/src-bak/components/helper/eventOrchestration.js +763 -0
- package/src-bak/components/helper/resolver.js +163 -0
- package/src-bak/components/helper/table.jsx +103 -0
- package/src-bak/components/icons/date.vue +33 -0
- package/src-bak/components/icons/info.vue +62 -0
- package/src-bak/components/icons/loading.vue +19 -0
- package/src-bak/components/icons/question-filled.vue +8 -0
- package/src-bak/components/loading/index.js +6 -0
- package/src-bak/components/loading/loading.js +98 -0
- package/src-bak/components/loading/loading.scss +74 -0
- package/src-bak/components/loading/loading.vue +89 -0
- package/src-bak/components/loadingComponent/LoadingComponent.vue +33 -0
- package/src-bak/components/modal/index.js +9 -0
- package/src-bak/components/modal/modal.scss +195 -0
- package/src-bak/components/modal/modal.vue +201 -0
- package/src-bak/components/options/OptionsDefault.vue +47 -0
- package/src-bak/components/packages-H5/CmiButton.vue +120 -0
- package/src-bak/components/packages-H5/CmiCalendar.vue +152 -0
- package/src-bak/components/packages-H5/CmiCell.vue +87 -0
- package/src-bak/components/packages-H5/CmiCheckbox.vue +82 -0
- package/src-bak/components/packages-H5/CmiDatetimePicker.vue +98 -0
- package/src-bak/components/packages-H5/CmiDivider.vue +30 -0
- package/src-bak/components/packages-H5/CmiDropdownMenu.vue +58 -0
- package/src-bak/components/packages-H5/CmiInput.vue +69 -0
- package/src-bak/components/packages-H5/CmiLink.vue +28 -0
- package/src-bak/components/packages-H5/CmiPicker.vue +229 -0
- package/src-bak/components/packages-H5/CmiRadio.vue +29 -0
- package/src-bak/components/packages-H5/CmiSearch.vue +39 -0
- package/src-bak/components/packages-H5/CmiSelect.vue +84 -0
- package/src-bak/components/packages-H5/CustomComponentCardH5.vue +129 -0
- package/src-bak/components/packages-H5/CustomComponentColH5.vue +8 -0
- package/src-bak/components/packages-H5/CustomComponentCollapseH5.vue +137 -0
- package/src-bak/components/packages-H5/CustomComponentFormLayoutH5.vue +54 -0
- package/src-bak/components/packages-H5/CustomComponentTabPaneH5.vue +38 -0
- package/src-bak/components/packages-H5/CustomComponentTableH5.vue +352 -0
- package/src-bak/components/packages-H5/CustomComponentTabsH5.vue +170 -0
- package/src-bak/components/packages-web/CustomComponentCard.vue +40 -0
- package/src-bak/components/packages-web/CustomComponentCol.vue +66 -0
- package/src-bak/components/packages-web/CustomComponentCollapse.vue +164 -0
- package/src-bak/components/packages-web/CustomComponentCycle.vue +95 -0
- package/src-bak/components/packages-web/CustomComponentCycleTabPane.vue +155 -0
- package/src-bak/components/packages-web/CustomComponentDialog.vue +192 -0
- package/src-bak/components/packages-web/CustomComponentEditor.vue +50 -0
- package/src-bak/components/packages-web/CustomComponentFileExport.vue +60 -0
- package/src-bak/components/packages-web/CustomComponentFileImport.vue +60 -0
- package/src-bak/components/packages-web/CustomComponentFormLayout.vue +65 -0
- package/src-bak/components/packages-web/CustomComponentGrid.vue +29 -0
- package/src-bak/components/packages-web/CustomComponentGridCol.vue +29 -0
- package/src-bak/components/packages-web/CustomComponentInputDialog.vue +144 -0
- package/src-bak/components/packages-web/CustomComponentNativeTabPane.vue +84 -0
- package/src-bak/components/packages-web/CustomComponentPlain.vue +243 -0
- package/src-bak/components/packages-web/CustomComponentRow.vue +83 -0
- package/src-bak/components/packages-web/CustomComponentSelectEmployees.vue +203 -0
- package/src-bak/components/packages-web/CustomComponentSendMail.vue +62 -0
- package/src-bak/components/packages-web/CustomComponentSteps.vue +41 -0
- package/src-bak/components/packages-web/CustomComponentTabPane.vue +20 -0
- package/src-bak/components/packages-web/CustomComponentTable.jsx +813 -0
- package/src-bak/components/packages-web/CustomComponentTabs.vue +126 -0
- package/src-bak/components/packages-web/CustomComponentTree.vue +28 -0
- package/src-bak/components/packages-web/ElButton.vue +146 -0
- package/src-bak/components/packages-web/ElCheckbox.vue +97 -0
- package/src-bak/components/packages-web/ElDatePicker.vue +93 -0
- package/src-bak/components/packages-web/ElInput copy.jsx +393 -0
- package/src-bak/components/packages-web/ElInput.jsx +312 -0
- package/src-bak/components/packages-web/ElInputNumber.vue +81 -0
- package/src-bak/components/packages-web/ElPagination.vue +61 -0
- package/src-bak/components/packages-web/ElRadio.vue +47 -0
- package/src-bak/components/packages-web/ElSelect.jsx +249 -0
- package/src-bak/components/packages-web/ElSelect_bak.vue +155 -0
- package/src-bak/components/packages-web/ElText.jsx +187 -0
- package/src-bak/components/packages-web/ElTextaa.vue +169 -0
- package/src-bak/components/packages-web/ElTimePicker.vue +39 -0
- package/src-bak/components/patchComponents-H5.js +46 -0
- package/src-bak/components/patchComponents-web.js +46 -0
- package/src-bak/components/simpleFormItemPc/index.js +1 -0
- package/src-bak/components/simpleFormItemPc/src/index.vue +94 -0
- package/src-bak/components/table/index.ts +29 -0
- package/src-bak/components/table/src/composables/use-scrollbar.ts +30 -0
- package/src-bak/components/table/src/config.ts +256 -0
- package/src-bak/components/table/src/filter-panel.vue +260 -0
- package/src-bak/components/table/src/h-helper.ts +34 -0
- package/src-bak/components/table/src/layout-observer.ts +78 -0
- package/src-bak/components/table/src/store/current.ts +85 -0
- package/src-bak/components/table/src/store/expand.ts +76 -0
- package/src-bak/components/table/src/store/helper.ts +74 -0
- package/src-bak/components/table/src/store/index.ts +246 -0
- package/src-bak/components/table/src/store/tree.ts +230 -0
- package/src-bak/components/table/src/store/watcher.ts +543 -0
- package/src-bak/components/table/src/table/defaults.ts +402 -0
- package/src-bak/components/table/src/table/key-render-helper.ts +27 -0
- package/src-bak/components/table/src/table/style-helper.ts +378 -0
- package/src-bak/components/table/src/table/utils-helper.ts +47 -0
- package/src-bak/components/table/src/table-body/defaults.ts +52 -0
- package/src-bak/components/table/src/table-body/events-helper.ts +203 -0
- package/src-bak/components/table/src/table-body/index.ts +119 -0
- package/src-bak/components/table/src/table-body/render-helper.ts +283 -0
- package/src-bak/components/table/src/table-body/styles-helper.ts +164 -0
- package/src-bak/components/table/src/table-column/defaults.ts +237 -0
- package/src-bak/components/table/src/table-column/index.ts +202 -0
- package/src-bak/components/table/src/table-column/render-helper.ts +214 -0
- package/src-bak/components/table/src/table-column/watcher-helper.ts +88 -0
- package/src-bak/components/table/src/table-footer/index.ts +128 -0
- package/src-bak/components/table/src/table-footer/mapState-helper.ts +33 -0
- package/src-bak/components/table/src/table-footer/style-helper.ts +51 -0
- package/src-bak/components/table/src/table-header/event-helper.ts +213 -0
- package/src-bak/components/table/src/table-header/index.ts +244 -0
- package/src-bak/components/table/src/table-header/style.helper.ts +119 -0
- package/src-bak/components/table/src/table-header/utils-helper.ts +94 -0
- package/src-bak/components/table/src/table-layout.ts +259 -0
- package/src-bak/components/table/src/table.vue +389 -0
- package/src-bak/components/table/src/tableColumn.ts +3 -0
- package/src-bak/components/table/src/tokens.ts +5 -0
- package/src-bak/components/table/src/util.ts +521 -0
- package/src-bak/components/table/style/css.ts +5 -0
- package/src-bak/components/table/style/index.ts +5 -0
- package/src-bak/components/tabs/index.js +8 -0
- package/src-bak/components/tabs/src/constants.js +23 -0
- package/src-bak/components/tabs/src/tab-bar.js +8 -0
- package/src-bak/components/tabs/src/tab-bar.vue +92 -0
- package/src-bak/components/tabs/src/tab-nav.jsx +424 -0
- package/src-bak/components/tabs/src/tab-pane.js +16 -0
- package/src-bak/components/tabs/src/tab-pane.vue +80 -0
- package/src-bak/components/tabs/src/tabs.jsx +223 -0
- package/src-bak/components/tabs/style/css.js +2 -0
- package/src-bak/components/tabs/style/index.js +2 -0
- package/src-bak/components/thirdPartyFrame/index.js +32 -0
- package/src-bak/components/thirdPartyFrame/src/ThirdPartyFrame.vue +125 -0
- package/src-bak/enums/index.js +16 -0
- package/src-bak/hooks/configLoad.js +45 -0
- package/src-bak/hooks/index.js +189 -0
- package/src-bak/hooks/mock.js +6960 -0
- package/src-bak/hooks/pageConfig.js +127 -0
- package/src-bak/index.jsx +440 -0
- package/src-bak/renderer.jsx +77 -0
- package/src-bak/resolver-H5.vue +88 -0
- package/src-bak/resolver-common.vue +129 -0
- package/src-bak/resolver-web.vue +91 -0
- package/src-bak/rules/eventsSupplement.js +573 -0
- package/src-bak/rules/parseCondition.js +378 -0
- package/src-bak/rules/ruleUtils.js +273 -0
- package/src-bak/rules/rulesDriver.js +118 -0
- package/src-bak/rulesImp/events.js +588 -0
- package/src-bak/rulesImp/index.js +33 -0
- package/src-bak/rulesImp/ruleInstance.js +231 -0
- package/src-bak/rulesImp/ruleUtils.js +124 -0
- package/src-bak/theme/element/components/button.scss +122 -0
- package/src-bak/theme/element/components/card.scss +8 -0
- package/src-bak/theme/element/components/checkbox.scss +19 -0
- package/src-bak/theme/element/components/collapse.scss +174 -0
- package/src-bak/theme/element/components/common.scss +30 -0
- package/src-bak/theme/element/components/cycle.scss +0 -0
- package/src-bak/theme/element/components/date.scss +13 -0
- package/src-bak/theme/element/components/dialog.scss +44 -0
- package/src-bak/theme/element/components/form.scss +104 -0
- package/src-bak/theme/element/components/index.scss +55 -0
- package/src-bak/theme/element/components/input.scss +36 -0
- package/src-bak/theme/element/components/message.scss +48 -0
- package/src-bak/theme/element/components/pagination.scss +47 -0
- package/src-bak/theme/element/components/popper.scss +3 -0
- package/src-bak/theme/element/components/radio.scss +40 -0
- package/src-bak/theme/element/components/scrollbar.scss +14 -0
- package/src-bak/theme/element/components/select.scss +82 -0
- package/src-bak/theme/element/components/steps.scss +6 -0
- package/{src/components/styles/CustomComponenTable.scss → src-bak/theme/element/components/table.scss} +90 -13
- package/src-bak/theme/element/components/tabs.scss +128 -0
- package/src-bak/theme/element/components/tag.scss +6 -0
- package/{src/components/styles → src-bak/theme/element/components}/text.scss +3 -3
- package/src-bak/theme/element/components/textarea.scss +3 -0
- package/src-bak/theme/element/components/tree.scss +0 -0
- package/src-bak/theme/element/index.scss +55 -0
- package/src-bak/utils/cipher.js +141 -0
- package/src-bak/utils/common.js +664 -0
- package/src-bak/utils/const.js +259 -0
- package/src-bak/utils/defaultVal.js +92 -0
- package/src-bak/utils/dom.js +36 -0
- package/src-bak/utils/format.js +19 -0
- package/src-bak/utils/index.js +4 -0
- package/src-bak/utils/is.js +74 -0
- package/src-bak/utils/loadModule.js +75 -0
- package/src-bak/utils/preserveFunc.js +33 -0
- package/src-bak/utils/render.jsx +1138 -0
- package/src-bak/utils/request.js +136 -0
- package/src-bak/utils/respone.js +70 -0
- package/src-bak/utils/valid.js +89 -0
|
@@ -0,0 +1,1138 @@
|
|
|
1
|
+
import { getCodeMapRules } from '../rules/rulesDriver.js'
|
|
2
|
+
import SimpleFormItemPc from '../components/simpleFormItemPc'
|
|
3
|
+
import { resolveAssetComponents, findComponent, compareComponet, normalPixel, isPlainObject, hasOwn, isFnStr, normalCapitalizeComponent, capitalize, camelize, formatDate, definePrivatelyProp, getPathVal, cloneDeep, generateUniqueId} from './common.js'
|
|
4
|
+
import { resolveComponent, inject, watch, unref } from 'vue'
|
|
5
|
+
import CustomComponentColH5 from '../components/packages-H5/CustomComponentColH5.vue'
|
|
6
|
+
import {
|
|
7
|
+
commonPropsType,
|
|
8
|
+
FORM_META_TYPE,
|
|
9
|
+
FORM_META_TYPE_H5,
|
|
10
|
+
NOT_NEED_FORM_ITEM_META_TYPE,
|
|
11
|
+
SPECIAL_SET_FULL_WIDTH_ITEM_META_TYPE,
|
|
12
|
+
NOT_NEED_COL_ITEM_META_TYPE,
|
|
13
|
+
MULTI_PAGE_META_LIST_TYPES,
|
|
14
|
+
REPLACE_PREFIX_FLAG,
|
|
15
|
+
PREFIX_FLAG,
|
|
16
|
+
ARG_FLAGS,
|
|
17
|
+
PLAIN_TYPE_COLUMNS,
|
|
18
|
+
PLAIN_TYPE_OPTIONS_COLUMNS,
|
|
19
|
+
META_TYPE_MAP,
|
|
20
|
+
H5_REPLACE_PREFIX_FLAG,
|
|
21
|
+
H5_PREFIX_FLAG,
|
|
22
|
+
PLAIN_TYPE_ALONG_COLUMNS,
|
|
23
|
+
TRANS_CELL_COMPONETS,
|
|
24
|
+
MODE,
|
|
25
|
+
isHidden,
|
|
26
|
+
CYCLE_COMPONETS
|
|
27
|
+
} from './const.js'
|
|
28
|
+
import { preserveCheck } from './preserveFunc.js'
|
|
29
|
+
import { isArray, isFunction, isString } from './is.js'
|
|
30
|
+
import CustomComponentPlain from '../components/packages-web/CustomComponentPlain.vue'
|
|
31
|
+
// import QuestionFilled from '../components/icons/question-filled.vue'
|
|
32
|
+
import infoIcon from '../components/icons/info.vue'
|
|
33
|
+
import { dispatchClickEvent, dispatchClickEvents, getTableConfig } from '../components/helper/eventOrchestration.js'
|
|
34
|
+
import CmiFormItem from '../components/cmiFormItem'
|
|
35
|
+
import loadModule from './loadModule.js'
|
|
36
|
+
import { h } from 'vue'
|
|
37
|
+
import dayjs from 'dayjs'
|
|
38
|
+
|
|
39
|
+
export const COFNGI_KEY_EVENT_FLAG = /^on[A-Z]/
|
|
40
|
+
|
|
41
|
+
// 解析配置中的defStyle属性
|
|
42
|
+
export function parseDefStyle(defStyle) {
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(defStyle)
|
|
45
|
+
} catch (error) {
|
|
46
|
+
return {}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 解析extendAttr中方法
|
|
51
|
+
function deepParseFnStr(obj, refVal) {
|
|
52
|
+
if (isPlainObject(obj) || Array.isArray(obj)) {
|
|
53
|
+
Object.keys(obj).forEach(key => {
|
|
54
|
+
if (isPlainObject(obj[key]) || Array.isArray(obj[key])) {
|
|
55
|
+
deepParseFnStr(obj[key])
|
|
56
|
+
} else if (isFnStr(obj[key])) {
|
|
57
|
+
obj[key] = eval(`(${obj[key]})`)
|
|
58
|
+
} else {
|
|
59
|
+
if (isString(obj[key])) {
|
|
60
|
+
if (obj[key] === ARG_FLAGS.REF_VAL) {
|
|
61
|
+
obj[key] = refVal || ''
|
|
62
|
+
} else if (obj[key] === ARG_FLAGS.CURRENT_DATE) {
|
|
63
|
+
obj[key] = formatDate(new Date(), 'yyyy-MM-dd')
|
|
64
|
+
} else if (obj[key] === ARG_FLAGS.CURRENT_DATE_EXCLUDE) {
|
|
65
|
+
obj[key] = dayjs(new Date()).add(1, 'day').format('YYYY-MM-DD')
|
|
66
|
+
} else {
|
|
67
|
+
const { checked, val } = preserveCheck(key, obj[key])
|
|
68
|
+
if (checked) {
|
|
69
|
+
obj[key] = val
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 解析配置中的extendAttr属性
|
|
79
|
+
export function parseExtendAttr(config, refVal) {
|
|
80
|
+
if (config.extendAttr) {
|
|
81
|
+
try {
|
|
82
|
+
// return JSON.parse(config.extendAttr, (k, v) => {
|
|
83
|
+
// if (isFnStr(v)) {
|
|
84
|
+
// return eval(`(${v})`)
|
|
85
|
+
// }
|
|
86
|
+
// return v
|
|
87
|
+
// }) || {}
|
|
88
|
+
let obj = eval('(' + config.extendAttr+ ')') || {}
|
|
89
|
+
deepParseFnStr(obj, refVal)
|
|
90
|
+
return obj
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.log(config.metaCode, '\n===JSON parse err, err==:', error, '\nextendAttr==:', config.extendAttr)
|
|
93
|
+
return {}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return {}
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 目前所有的配置都是在form表单下面,但是现在的配置数据没有form配置项,所有我们自己手动增加
|
|
101
|
+
function generateFormConfig(lang = 'zh', isH5) {
|
|
102
|
+
return {
|
|
103
|
+
metaType: isH5 ? FORM_META_TYPE_H5 : FORM_META_TYPE,
|
|
104
|
+
displayType: '1',
|
|
105
|
+
span: 24,
|
|
106
|
+
labelWidth: lang.indexOf('zh') > -1 ? '84px' : '120px',
|
|
107
|
+
'label-position': 'right',
|
|
108
|
+
rootForm: true,
|
|
109
|
+
inline: true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* @param {*} config 通过接口获取的配置对象
|
|
116
|
+
*/
|
|
117
|
+
export function parsePageConfig({
|
|
118
|
+
requestTraceId,
|
|
119
|
+
dialogReq,
|
|
120
|
+
mode,
|
|
121
|
+
route,
|
|
122
|
+
router,
|
|
123
|
+
config, lang, polyfillConfigs, instance, isH5,
|
|
124
|
+
rootValue,
|
|
125
|
+
parentRootValue,
|
|
126
|
+
parentDynamicMapComp,
|
|
127
|
+
axiosInstance,
|
|
128
|
+
messageInstance,
|
|
129
|
+
messageCb
|
|
130
|
+
}) {
|
|
131
|
+
if (!config) return {}
|
|
132
|
+
const formConfig = generateFormConfig(lang, isH5)
|
|
133
|
+
const hireRelatMapRules = getCodeMapRules(config)
|
|
134
|
+
formConfig.pmPageMetaList = config.pmPageMetaList
|
|
135
|
+
const cbs = []
|
|
136
|
+
let { pageConfig, mapComp } = normalConfig({
|
|
137
|
+
requestTraceId,
|
|
138
|
+
dialogReq,
|
|
139
|
+
lang,
|
|
140
|
+
mode,
|
|
141
|
+
route,
|
|
142
|
+
router,
|
|
143
|
+
polyfillConfigs,
|
|
144
|
+
instance,
|
|
145
|
+
cbs,
|
|
146
|
+
rootValue,
|
|
147
|
+
axiosInstance,
|
|
148
|
+
messageInstance,
|
|
149
|
+
messageCb,
|
|
150
|
+
parentRootValue,
|
|
151
|
+
parentDynamicMapComp,
|
|
152
|
+
}, formConfig)
|
|
153
|
+
cbs.forEach((cb) => {
|
|
154
|
+
cb()
|
|
155
|
+
})
|
|
156
|
+
return {
|
|
157
|
+
pageConfig,
|
|
158
|
+
mapComp,
|
|
159
|
+
hireRelatMapRules
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* {
|
|
164
|
+
* children: [], // 子元素
|
|
165
|
+
* bindValue: '', // 配置项对应的绑定值
|
|
166
|
+
* }
|
|
167
|
+
* @param {*} config
|
|
168
|
+
*/
|
|
169
|
+
export function normalConfig({
|
|
170
|
+
requestTraceId,
|
|
171
|
+
dialogReq,
|
|
172
|
+
lang,
|
|
173
|
+
mode,
|
|
174
|
+
polyfillConfigs,
|
|
175
|
+
instance,
|
|
176
|
+
cbs = [],
|
|
177
|
+
rootValue,
|
|
178
|
+
axiosInstance,
|
|
179
|
+
messageInstance,
|
|
180
|
+
messageCb,
|
|
181
|
+
parentRootValue,
|
|
182
|
+
parentDynamicMapComp,
|
|
183
|
+
}, config, hireRelat = '', mapComp = {}, needformItem = false, dynamicHireRelat = '', unWatchsList = []) {
|
|
184
|
+
const metaCode = config.metaCode || ''
|
|
185
|
+
hireRelat += hireRelat ? `->${metaCode}` : metaCode
|
|
186
|
+
dynamicHireRelat += dynamicHireRelat ? `->${metaCode}` : metaCode
|
|
187
|
+
|
|
188
|
+
const metaType = normalMetaType(config.metaType)
|
|
189
|
+
|
|
190
|
+
// 这个对象是不可以被配置进行覆盖
|
|
191
|
+
const extendNativeObj = {
|
|
192
|
+
metaType,
|
|
193
|
+
eventInit: false, // 初始渲染的时候,配置项对应的事件是否执行了
|
|
194
|
+
bindValue: '', // 这个是对应组件绑定的值
|
|
195
|
+
vmIsBind: false,
|
|
196
|
+
vm: null, // 具体渲染的组件
|
|
197
|
+
wrapVm: null, // 当前组件的实例(也就是analysisComponent)
|
|
198
|
+
hireRelat,
|
|
199
|
+
parent: null, // 这个是执行过程中,动态获取的
|
|
200
|
+
dynamicHireRelat, // 这个也是执行过程中,动态获取的层级
|
|
201
|
+
_rootValue: rootValue
|
|
202
|
+
}
|
|
203
|
+
let extendAttrObj = parseExtendAttr(config)
|
|
204
|
+
let extendObj = {
|
|
205
|
+
removeCol: findComponent(NOT_NEED_COL_ITEM_META_TYPE, extendAttrObj.renderby) !== -1 || findComponent(NOT_NEED_COL_ITEM_META_TYPE, metaType) !== -1,
|
|
206
|
+
needformItem: (findComponent(NOT_NEED_FORM_ITEM_META_TYPE, extendAttrObj.renderby) !== -1 || findComponent(NOT_NEED_FORM_ITEM_META_TYPE, metaType) !== -1) ? false : needformItem, // 表示这个配置项对应的渲染组件是否需要formItem进行包装 移动端是cmi-form-item
|
|
207
|
+
}
|
|
208
|
+
if (config.defStyle) {
|
|
209
|
+
extendObj.style = parseDefStyle(config.defStyle)
|
|
210
|
+
}
|
|
211
|
+
// 组件是根据数据进行动态循环渲染,这边需要进行特殊处理,确保config配置项独立
|
|
212
|
+
if (findComponent(MULTI_PAGE_META_LIST_TYPES, extendAttrObj.renderby) !== -1 || findComponent(MULTI_PAGE_META_LIST_TYPES, metaType) !== -1) {
|
|
213
|
+
extendObj.multiPmPageMetaList = []
|
|
214
|
+
}
|
|
215
|
+
let pageConfig = {
|
|
216
|
+
...extendObj,
|
|
217
|
+
...config,
|
|
218
|
+
...extendAttrObj,
|
|
219
|
+
...extendNativeObj,
|
|
220
|
+
}
|
|
221
|
+
if (config.metaType == 'textarea') {
|
|
222
|
+
pageConfig.type = 'textarea'
|
|
223
|
+
}
|
|
224
|
+
if (config.metaType == 'time-range') {
|
|
225
|
+
pageConfig['isRange'] = true
|
|
226
|
+
}
|
|
227
|
+
if (config.metaType == 'date-range') {
|
|
228
|
+
pageConfig.type = 'daterange'
|
|
229
|
+
}
|
|
230
|
+
if (config.metaType == 'card' && !hasOwn(pageConfig, 'needWrap')) {
|
|
231
|
+
pageConfig.needWrap = '1'
|
|
232
|
+
}
|
|
233
|
+
// 在详情的情况下,配置组件是否显示
|
|
234
|
+
if (mode === MODE.DETAIL) {
|
|
235
|
+
if (pageConfig.detailExtendAttr) {
|
|
236
|
+
const detailExtendAttrObj = parseExtendAttr({
|
|
237
|
+
extendAttr: typeof pageConfig.detailExtendAttr === 'string' ? pageConfig.detailExtendAttr : JSON.stringify(pageConfig.detailExtendAttr),
|
|
238
|
+
metaCode: `detail-${pageConfig.metaCode}`
|
|
239
|
+
})
|
|
240
|
+
pageConfig = {
|
|
241
|
+
...pageConfig,
|
|
242
|
+
...detailExtendAttrObj
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
pageConfig.hidden = pageConfig.detailHidden || pageConfig.hidden
|
|
246
|
+
}
|
|
247
|
+
// 在日志的情况下,配置组件是否显示
|
|
248
|
+
if (mode === MODE.LOG) {
|
|
249
|
+
if (pageConfig.logExtendAttr) {
|
|
250
|
+
const logExtendAttrObj = parseExtendAttr({
|
|
251
|
+
extendAttr: typeof pageConfig.logExtendAttr === 'string' ? pageConfig.logExtendAttr : JSON.stringify(pageConfig.logExtendAttr),
|
|
252
|
+
metaCode: `log-${pageConfig.metaCode}`
|
|
253
|
+
})
|
|
254
|
+
pageConfig = {
|
|
255
|
+
...pageConfig,
|
|
256
|
+
...logExtendAttrObj
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
pageConfig.hidden = pageConfig.logHidden || pageConfig.hidden
|
|
260
|
+
}
|
|
261
|
+
mapComp[hireRelat] = pageConfig
|
|
262
|
+
parsePolyfillConfigs({ polyfillConfigs, instance, parentRootValue, parentDynamicMapComp }, pageConfig)
|
|
263
|
+
|
|
264
|
+
// 如果有子项,需要进行递归遍历
|
|
265
|
+
if (pageConfig.pmPageMetaList && pageConfig.pmPageMetaList.length) {
|
|
266
|
+
normalPmPageMetaList(pageConfig)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function normalPmPageMetaList(config) {
|
|
270
|
+
const isCycleFlag = isCycleConfig(config)
|
|
271
|
+
if (isCycleFlag) {
|
|
272
|
+
config._rowColumnConfgsMap = new Map()
|
|
273
|
+
config.multiPmPageMetaList = []
|
|
274
|
+
config._unPageMetaListWatch?.() // 删除当前的监听
|
|
275
|
+
const unWatch = watch(() => getPathVal(unref(config._rootValue), config.dynamicHireRelat, '->')?.length, (val) => {
|
|
276
|
+
config?._unWatchs?.forEach(un => un?.()) // 删除子级的PmPageMetaList监听
|
|
277
|
+
if (config.metaId == "366008") {
|
|
278
|
+
debugger
|
|
279
|
+
}
|
|
280
|
+
const list = getPathVal(unref(config._rootValue), config.dynamicHireRelat, '->')
|
|
281
|
+
if (list && list.length) {
|
|
282
|
+
config.multiPmPageMetaList = list.map((row, idx) => {
|
|
283
|
+
const columnsCgs = config._rowColumnConfgsMap.get(row)
|
|
284
|
+
if (columnsCgs) {
|
|
285
|
+
columnsCgs.forEach(config => {
|
|
286
|
+
config.rowIndex = idx
|
|
287
|
+
})
|
|
288
|
+
return columnsCgs
|
|
289
|
+
} else {
|
|
290
|
+
let retColumnConfigs = config.pmPageMetaList.map((itemConfig, relIdx) => {
|
|
291
|
+
const ret = cloneDeep(itemConfig)
|
|
292
|
+
if (ret.width && !ret.columnWidth) {
|
|
293
|
+
ret.columnWidth = ret.width
|
|
294
|
+
delete ret.width
|
|
295
|
+
}
|
|
296
|
+
ret.columnId = generateUniqueId()
|
|
297
|
+
ret.rowIndex = idx
|
|
298
|
+
ret.isColumn = true
|
|
299
|
+
ret.refConfig = config.pmPageMetaList?.[relIdx]
|
|
300
|
+
ret.parent = config // 这边手动设置一下,防止组件复用的时候不会刷新,造成parent的丢失
|
|
301
|
+
return ret
|
|
302
|
+
})
|
|
303
|
+
simpleNormalPmPageMetaList(retColumnConfigs, `${dynamicHireRelat}[${idx}]`, [...unWatchsList])
|
|
304
|
+
config._rowColumnConfgsMap.set(row, retColumnConfigs)
|
|
305
|
+
return retColumnConfigs
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
}
|
|
309
|
+
}, {
|
|
310
|
+
immediate: true
|
|
311
|
+
})
|
|
312
|
+
// 这边先执行,因为当前的_unWatchs里面只放子级的watch
|
|
313
|
+
unWatchsList?.forEach(list => {
|
|
314
|
+
list?.push(unWatch)
|
|
315
|
+
})
|
|
316
|
+
config._unPageMetaListWatch = unWatch
|
|
317
|
+
config._unWatchs = []
|
|
318
|
+
unWatchsList?.push(config._unWatchs)
|
|
319
|
+
|
|
320
|
+
} else {
|
|
321
|
+
config.pmPageMetaList = simpleNormalPmPageMetaList(config.pmPageMetaList, dynamicHireRelat)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function simpleNormalPmPageMetaList(pmPageMetaList, dynamicHireRelat, unWatchsList) {
|
|
325
|
+
return pmPageMetaList.map(metaItem => {
|
|
326
|
+
const { pageConfig } = normalConfig({
|
|
327
|
+
requestTraceId,
|
|
328
|
+
dialogReq,
|
|
329
|
+
lang,
|
|
330
|
+
mode,
|
|
331
|
+
cbs,
|
|
332
|
+
polyfillConfigs,
|
|
333
|
+
instance,
|
|
334
|
+
rootValue,
|
|
335
|
+
axiosInstance,
|
|
336
|
+
messageInstance ,
|
|
337
|
+
messageCb,
|
|
338
|
+
parentRootValue,
|
|
339
|
+
parentDynamicMapComp,
|
|
340
|
+
}, metaItem, hireRelat, mapComp, needformItem || [FORM_META_TYPE, FORM_META_TYPE_H5].includes(metaType), dynamicHireRelat, unWatchsList)
|
|
341
|
+
return pageConfig
|
|
342
|
+
})?.sort((a, b) => a.seqNo - b.seqNo)
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return {
|
|
347
|
+
mapComp,
|
|
348
|
+
pageConfig
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
function isCycleConfig(config) {
|
|
354
|
+
return findComponent(CYCLE_COMPONETS, config.renderby) !== -1 || findComponent(CYCLE_COMPONETS, config.metaType) !== -1
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function parsePolyfillConfigs({ polyfillConfigs, instance, parentRootValue, parentDynamicMapComp}, config) {
|
|
358
|
+
const hireRelat = config.hireRelat
|
|
359
|
+
const findKeys = Object.keys(polyfillConfigs || {}).filter(key => hireRelat.endsWith(key))
|
|
360
|
+
if (!findKeys.length) {
|
|
361
|
+
return
|
|
362
|
+
}
|
|
363
|
+
// 层级写的越明确,就使用更明确的层级配置
|
|
364
|
+
const findKey = findKeys.reduce((ret, key) => (hireRelat.lastIndexOf(ret) < hireRelat.lastIndexOf(key) ? ret : key))
|
|
365
|
+
const polyObj = polyfillConfigs[findKey] && polyfillConfigs[findKey](config, instance, {parentRootValue, parentDynamicMapComp,})
|
|
366
|
+
polyObj && Object.keys(polyObj).forEach(key => {
|
|
367
|
+
config[key] = polyObj[key]
|
|
368
|
+
})
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// 配置化工具现在还是用aidesign组件库,这边进行统一替换一下
|
|
372
|
+
function normalMetaType(metaType) {
|
|
373
|
+
let retType = metaType
|
|
374
|
+
if (typeof retType !== 'string') return ''
|
|
375
|
+
if (retType.startsWith(REPLACE_PREFIX_FLAG)) {
|
|
376
|
+
retType = retType.replace(REPLACE_PREFIX_FLAG, PREFIX_FLAG)
|
|
377
|
+
} else if (retType.startsWith(H5_REPLACE_PREFIX_FLAG)) {
|
|
378
|
+
retType = retType.replace(H5_REPLACE_PREFIX_FLAG, H5_PREFIX_FLAG)
|
|
379
|
+
}
|
|
380
|
+
if (META_TYPE_MAP[retType]) {
|
|
381
|
+
retType = META_TYPE_MAP[retType]
|
|
382
|
+
}
|
|
383
|
+
return retType
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export function isPlainColumn(config, disabled) {
|
|
387
|
+
// 表格中中的列,可以根据配置进行转换为普通形式,表格原生支持的tooltip
|
|
388
|
+
if (config.isColumn && findComponent(PLAIN_TYPE_ALONG_COLUMNS, config.renderby || config.metaType) !== -1) {
|
|
389
|
+
return true
|
|
390
|
+
}
|
|
391
|
+
if (config.isColumn && disabled) {
|
|
392
|
+
if (config.plainColumn) {
|
|
393
|
+
return true
|
|
394
|
+
}
|
|
395
|
+
// 有些标签,在没有plainColumn属性的时候,默认表示会直接进行普通形式的转换
|
|
396
|
+
if (
|
|
397
|
+
!hasOwn(config, 'plainColumn') &&
|
|
398
|
+
(
|
|
399
|
+
findComponent([...PLAIN_TYPE_COLUMNS, ...PLAIN_TYPE_OPTIONS_COLUMNS], config.renderby || config.metaType) !== -1 ||
|
|
400
|
+
(
|
|
401
|
+
// 这边是在日期组件中,日过valueFormat属性跟format属性值一样的时候,就可以直接展示
|
|
402
|
+
findComponent(['ElDatePicker'], config?.renderby || config?.metaType) !== -1 &&
|
|
403
|
+
(
|
|
404
|
+
(config.valueFormat || 'YYYY-MM-DD') == (config.format || 'YYYY-MM-DD') ||
|
|
405
|
+
(config['value-format'] || 'YYYY-MM-DD') == (config.format || 'YYYY-MM-DD')
|
|
406
|
+
)
|
|
407
|
+
)
|
|
408
|
+
)
|
|
409
|
+
) {
|
|
410
|
+
return true
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return false
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export function getComponentForConfig({messageInstance, config, disabled, getNativeComps, loadModuleCache}) {
|
|
417
|
+
if (config.isCustom) {
|
|
418
|
+
return () => loadModule(generateVuePath(config.fileId), loadModuleCache, messageInstance)
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// 表格中中的列,是否需要转换为普通形式
|
|
422
|
+
if (isPlainColumn(config, disabled)) {
|
|
423
|
+
return CustomComponentPlain
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const components = inject('components')
|
|
427
|
+
const { composeComponents } = getNativeComps()
|
|
428
|
+
const allComps = {
|
|
429
|
+
...composeComponents,
|
|
430
|
+
...components.value
|
|
431
|
+
}
|
|
432
|
+
const metaType = config.metaType
|
|
433
|
+
let component = resolveAssetComponents(allComps, metaType) //则通过传入的获取组件
|
|
434
|
+
if (!component) {
|
|
435
|
+
component = resolveComponent(metaType) // 实例上绑定的组件
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
let renderby = config.renderby
|
|
439
|
+
if (isTransCellMobile(config, disabled)) {
|
|
440
|
+
renderby = 'CmiCell'
|
|
441
|
+
}
|
|
442
|
+
if (renderby && typeof renderby === 'string') {
|
|
443
|
+
let renderbyComp = resolveAssetComponents(allComps, renderby) //则通过传入的获取组件
|
|
444
|
+
if (!renderbyComp) {
|
|
445
|
+
try {
|
|
446
|
+
renderbyComp = resolveComponent(renderby) // 实例上绑定的组件
|
|
447
|
+
} catch (error) {
|
|
448
|
+
console.log('resolveComponent fail, config:', config)
|
|
449
|
+
renderbyComp = <div>not component</div>
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
component = renderbyComp || component
|
|
454
|
+
}
|
|
455
|
+
return component
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// 获取渲染组件的props配置数据
|
|
459
|
+
export function getRenderComponentProps({ props, component, modelValue, selects, lang, vm }) {
|
|
460
|
+
if (!component) return {}
|
|
461
|
+
let config = props.config
|
|
462
|
+
if (findComponent(['CustomComponentTabs'], config.renderby || config.metaType) !== -1) {
|
|
463
|
+
// 目前tabs组件在配置平台那边,是不能进行配置大的tabs的,目前就换一种方式
|
|
464
|
+
config.pmPageMetaList?.forEach(pane => {
|
|
465
|
+
if (pane.tabExtendAttr && isPlainObject(pane.tabExtendAttr)) {
|
|
466
|
+
config = {
|
|
467
|
+
...config,
|
|
468
|
+
...pane.tabExtendAttr
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
})
|
|
472
|
+
}
|
|
473
|
+
const propsKeys = getComponentPropsKeys(component, config)
|
|
474
|
+
const defprops = {}
|
|
475
|
+
if (propsKeys) {
|
|
476
|
+
propsKeys.forEach(key => {
|
|
477
|
+
if (hasOwn(config, key)) {
|
|
478
|
+
if (COFNGI_KEY_EVENT_FLAG.test(key) && typeof config[key] === 'function') {
|
|
479
|
+
defprops[key] = function(...arg) {
|
|
480
|
+
return config[key](...arg, vm)
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
defprops[key] = config[key]
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
})
|
|
487
|
+
}
|
|
488
|
+
const commonProps = getCommonProps(config, props, modelValue, selects, lang)
|
|
489
|
+
defprops.style = {
|
|
490
|
+
...config.style,
|
|
491
|
+
...getRenderCompMargins(config),
|
|
492
|
+
width: commonProps.width || getBuildCompDefaultWidth(config)
|
|
493
|
+
}
|
|
494
|
+
if (isHidden({ config }) || config.hiddenContext == '1') {
|
|
495
|
+
defprops.style.display = 'none'
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const retObj = {
|
|
499
|
+
...defprops,
|
|
500
|
+
...commonProps
|
|
501
|
+
}
|
|
502
|
+
if (config.class) {
|
|
503
|
+
retObj.class = config.class
|
|
504
|
+
}
|
|
505
|
+
return retObj
|
|
506
|
+
}
|
|
507
|
+
// 一些组件并且没有占居满格
|
|
508
|
+
function getBuildCompDefaultWidth(config) {
|
|
509
|
+
if (SPECIAL_SET_FULL_WIDTH_ITEM_META_TYPE.some(metaType => compareComponet(metaType, config.metaType))) {
|
|
510
|
+
return '100%'
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
// 获取渲染组件开放的配置props,提供给所有自定义组件
|
|
514
|
+
function getCommonProps(config, props, modelValue, selects, lang) {
|
|
515
|
+
return Object.keys(commonPropsType).reduce((ret, key) => {
|
|
516
|
+
ret[key] = commonPropsType[key].getValue(config, props, modelValue, selects, lang)
|
|
517
|
+
return ret
|
|
518
|
+
}, {})
|
|
519
|
+
}
|
|
520
|
+
// 获取渲染组件的margin配置数据
|
|
521
|
+
function getRenderCompMargins(config) {
|
|
522
|
+
const marginObj = {}
|
|
523
|
+
if (config.marginRight) {
|
|
524
|
+
marginObj.marginRight = normalPixel(config.marginRight)
|
|
525
|
+
}
|
|
526
|
+
if (config.marginLeft) {
|
|
527
|
+
marginObj.marginLeft = normalPixel(config.marginLeft)
|
|
528
|
+
}
|
|
529
|
+
if (config.marginTop) {
|
|
530
|
+
marginObj.marginTop = normalPixel(config.marginTop)
|
|
531
|
+
}
|
|
532
|
+
if (config.marginBottom) {
|
|
533
|
+
marginObj.marginBottom = normalPixel(config.marginBottom)
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (config.paddingRight) {
|
|
537
|
+
marginObj.paddingRight = normalPixel(config.paddingRight)
|
|
538
|
+
}
|
|
539
|
+
if (config.paddingLeft) {
|
|
540
|
+
marginObj.paddingLeft = normalPixel(config.paddingLeft)
|
|
541
|
+
}
|
|
542
|
+
if (config.paddingTop) {
|
|
543
|
+
marginObj.paddingTop = normalPixel(config.paddingTop)
|
|
544
|
+
}
|
|
545
|
+
if (config.paddingBottom) {
|
|
546
|
+
marginObj.paddingBottom = normalPixel(config.paddingBottom)
|
|
547
|
+
}
|
|
548
|
+
return marginObj
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// 生成布局框(el-col)
|
|
552
|
+
export function generateLayoutPolyfill(config, disabled, isH5) {
|
|
553
|
+
let isElCol = false
|
|
554
|
+
let props = {}
|
|
555
|
+
let propsKeys
|
|
556
|
+
let colComp = null
|
|
557
|
+
if (isH5) {
|
|
558
|
+
colComp = CustomComponentColH5
|
|
559
|
+
} else {
|
|
560
|
+
colComp = resolveComponent('el-col')
|
|
561
|
+
isElCol = true
|
|
562
|
+
propsKeys = getComponentPropsKeys(colComp)
|
|
563
|
+
}
|
|
564
|
+
if (propsKeys) {
|
|
565
|
+
propsKeys.forEach(key => {
|
|
566
|
+
if (config[key]) {
|
|
567
|
+
props[key] = config[key]
|
|
568
|
+
}
|
|
569
|
+
})
|
|
570
|
+
}
|
|
571
|
+
props.class = {
|
|
572
|
+
[normalCapitalizeComponent(config.renderby || config.metaType)]: true,
|
|
573
|
+
}
|
|
574
|
+
if (isElCol) {
|
|
575
|
+
props.class['is-card'] = config?.needWrap == '1', // 这个样式主要用于折叠上面,控制被卡片包裹的时候,下边距是16,没有被包裹的时候,是12
|
|
576
|
+
props = {
|
|
577
|
+
...props,
|
|
578
|
+
...getDefaultColProps(config),
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
}
|
|
582
|
+
props = {
|
|
583
|
+
...props,
|
|
584
|
+
...elColSpecialProsp(config),
|
|
585
|
+
}
|
|
586
|
+
return node => {
|
|
587
|
+
// 表格中中的列,是否需要转换为普通形式
|
|
588
|
+
// if (isPlainColumn(config, disabled)) {
|
|
589
|
+
// return node
|
|
590
|
+
// }
|
|
591
|
+
|
|
592
|
+
if (config.removeCol) {
|
|
593
|
+
return node
|
|
594
|
+
}
|
|
595
|
+
let ret = <colComp {...props}>
|
|
596
|
+
{node}
|
|
597
|
+
</colComp>
|
|
598
|
+
if (config.isAllRow) {
|
|
599
|
+
ret = <colComp span={24}>{ret}</colComp>
|
|
600
|
+
}
|
|
601
|
+
return ret
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// el-col 特殊的定义,目前这边进行宽度的接受
|
|
606
|
+
function elColSpecialProsp (config) {
|
|
607
|
+
const style = {
|
|
608
|
+
textAlign: config.colTextAlign
|
|
609
|
+
}
|
|
610
|
+
if (isHidden({ config })) {
|
|
611
|
+
style.display = 'none'
|
|
612
|
+
} else {
|
|
613
|
+
if (hasOwn(config, 'elWidth')) {
|
|
614
|
+
if (config.elWidth === 'auto') {
|
|
615
|
+
style.flexGrow = 1
|
|
616
|
+
style.flexShrink = 1
|
|
617
|
+
style.flexBasis = 0
|
|
618
|
+
style.maxWidth = 'unset'
|
|
619
|
+
style.minWidth = 'unset'
|
|
620
|
+
style.maxWidth = '100%'
|
|
621
|
+
} else if (config.elWidth === 'self') {
|
|
622
|
+
// style.flexGrow = 0
|
|
623
|
+
// style.flexShrink = 0
|
|
624
|
+
// style.flexBasis = 0
|
|
625
|
+
// style.maxWidth = 'unset'
|
|
626
|
+
style.flex = 'unset'
|
|
627
|
+
style.minWidth = 'unset'
|
|
628
|
+
style.maxWidth = '100%'
|
|
629
|
+
// style.whiteSpace = 'nowrap'
|
|
630
|
+
} else {
|
|
631
|
+
style.flexGrow = 0
|
|
632
|
+
style.flexShrink = 0
|
|
633
|
+
style.flexBasis = 0
|
|
634
|
+
style.maxWidth = normalPixel(config.elWidth)
|
|
635
|
+
style.minWidth = normalPixel(config.elWidth)
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return {
|
|
640
|
+
style
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
function getDefaultColProps(config) {
|
|
645
|
+
const colProps = {
|
|
646
|
+
offset: config.offset || 0
|
|
647
|
+
}
|
|
648
|
+
if (hasOwn(config, 'md') || hasOwn(config, 'lg')) {
|
|
649
|
+
colProps.md = isPlainObject(config.md) ? parseIntColProps(config.md) : parseInt(config.md, 10)
|
|
650
|
+
colProps.lg = isPlainObject(config.lg) ? parseIntColProps(config.lg) : parseInt(config.lg, 10)
|
|
651
|
+
} else if (config.span) {
|
|
652
|
+
colProps.span = config.span
|
|
653
|
+
} else {
|
|
654
|
+
colProps.md = isPlainObject(config.md) ? parseIntColProps(config.md) : parseInt(config.md || 12, 10)
|
|
655
|
+
colProps.lg = isPlainObject(config.lg) ? parseIntColProps(config.lg) : parseInt(config.lg || 8, 10)
|
|
656
|
+
}
|
|
657
|
+
return colProps
|
|
658
|
+
}
|
|
659
|
+
function parseIntColProps(obj) {
|
|
660
|
+
return obj
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function generateFormItemPc (config, lang, compProps, params,) {
|
|
664
|
+
let isFormItem = false
|
|
665
|
+
let props = {}
|
|
666
|
+
let propsKeys
|
|
667
|
+
let slotName = 'default'
|
|
668
|
+
let formItemComp = resolveComponent('el-form-item')
|
|
669
|
+
if (formItemComp) {
|
|
670
|
+
isFormItem = true
|
|
671
|
+
propsKeys = getComponentPropsKeys(formItemComp)
|
|
672
|
+
}
|
|
673
|
+
if (propsKeys) {
|
|
674
|
+
propsKeys.forEach(key => {
|
|
675
|
+
if (config[key]) {
|
|
676
|
+
props[key] = config[key]
|
|
677
|
+
}
|
|
678
|
+
})
|
|
679
|
+
}
|
|
680
|
+
if (isFormItem) {
|
|
681
|
+
if (config.formItemSlot === 'label') {
|
|
682
|
+
slotName = 'label'
|
|
683
|
+
}
|
|
684
|
+
props = {
|
|
685
|
+
...props,
|
|
686
|
+
...getFormItemExtendProps(config, lang, params, compProps)
|
|
687
|
+
}
|
|
688
|
+
// labelWidth 需要特殊处理
|
|
689
|
+
if (hasOwn(props, 'labelWidth')) {
|
|
690
|
+
props.labelWidth = props.labelWidth && `${props.labelWidth}` !== '-1' ? props.labelWidth : undefined
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return node => {
|
|
694
|
+
if (config.polyfillNode && typeof config.polyfillNode === 'function') {
|
|
695
|
+
node = (
|
|
696
|
+
<div style="width: 100%; line-height: 16px;">
|
|
697
|
+
{node}
|
|
698
|
+
{config.polyfillNode(h, { config, props: compProps, contextNode: node })}
|
|
699
|
+
</div>
|
|
700
|
+
)
|
|
701
|
+
}
|
|
702
|
+
// 表格中中的列,是否需要转换为普通形式
|
|
703
|
+
// if (isPlainColumn(config, compProps.disabled)) {
|
|
704
|
+
// return node
|
|
705
|
+
// }
|
|
706
|
+
|
|
707
|
+
let showFormItem = null
|
|
708
|
+
if (hasOwn(config, 'showFormItem')) {
|
|
709
|
+
if (typeof config.showFormItem === 'boolean') {
|
|
710
|
+
showFormItem = config.showFormItem
|
|
711
|
+
} else {
|
|
712
|
+
showFormItem = config.showFormItem == '1'
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if (showFormItem !== null) {
|
|
716
|
+
if (!showFormItem) {
|
|
717
|
+
return node
|
|
718
|
+
}
|
|
719
|
+
} else {
|
|
720
|
+
if (!config.needformItem) {
|
|
721
|
+
return node
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// 表格中的列,不需要form-item的时候,就尽可能不要,可以提升性能
|
|
726
|
+
if (!props?.rules?.length && props?.class?.['hidden-label'] && config.isColumn) {
|
|
727
|
+
return node
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
if (!props?.rules?.length) {
|
|
731
|
+
formItemComp = SimpleFormItemPc
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
const slots = {
|
|
735
|
+
error: (info) => createFormLabelErrorTip(info, config, lang)
|
|
736
|
+
}
|
|
737
|
+
slots[slotName] = () => node
|
|
738
|
+
if (isFormItem && slotName !== 'label') {
|
|
739
|
+
slots.label = () => createFormLable(config, lang)
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
return (
|
|
743
|
+
<formItemComp ref={(e) => {definePrivatelyProp(config, 'formItemVm', e)}} key={config.requiredFlag} class="custom-form-item" {...props}>{slots}</formItemComp>
|
|
744
|
+
)
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function generateFormItemH5(config, lang, compProps, params = {}) {
|
|
749
|
+
const { messageInstance } = params
|
|
750
|
+
const props = {
|
|
751
|
+
config,
|
|
752
|
+
lang,
|
|
753
|
+
messageInstance,
|
|
754
|
+
hidemessage: config?.hidemessage == '1' ? true : false,
|
|
755
|
+
hideasterisk: config?.hideasterisk == '1' ? true : false,
|
|
756
|
+
...getFormItemExtendProps(config, lang, params, compProps),
|
|
757
|
+
}
|
|
758
|
+
// labelWidth 需要特殊处理
|
|
759
|
+
if (hasOwn(config, 'labelWidth')) {
|
|
760
|
+
props.labelWidth = props.labelWidth && `${props.labelWidth}` !== '-1' ? props.labelWidth : undefined
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
return node => {
|
|
764
|
+
if (isTransCellMobile(config, compProps?.disabled)) {
|
|
765
|
+
return node
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
let showFormItem = null
|
|
769
|
+
if (hasOwn(config, 'showFormItem')) {
|
|
770
|
+
if (typeof config.showFormItem === 'boolean') {
|
|
771
|
+
showFormItem = config.showFormItem
|
|
772
|
+
} else {
|
|
773
|
+
showFormItem = config.showFormItem == '1'
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (showFormItem !== null) {
|
|
777
|
+
if (!showFormItem) {
|
|
778
|
+
return node
|
|
779
|
+
}
|
|
780
|
+
} else {
|
|
781
|
+
if (!config.needformItem) {
|
|
782
|
+
return node
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
return (
|
|
787
|
+
<CmiFormItem {...props}>{node}</CmiFormItem>
|
|
788
|
+
)
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
export function generateFormItemPolyfill(config, lang, compProps, _isH5, params) {
|
|
793
|
+
if (_isH5) {
|
|
794
|
+
return generateFormItemH5(config, lang, compProps, params)
|
|
795
|
+
} else {
|
|
796
|
+
return generateFormItemPc(config, lang, compProps, params)
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
function isHiddenLable(config) {
|
|
801
|
+
return (config.labelWidth == 0 || config.labelWidth === '0px' || config.labelHidden == '1') && config.showLabel != '1'
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function getFormItemExtendProps(config, lang, params, compProps) {
|
|
805
|
+
const prop = config.dynamicHireRelat || ''
|
|
806
|
+
// const propAttr = config.dynamicHireRelat ? config.dynamicHireRelat?.split('->') : []
|
|
807
|
+
// const prop = propAttr.join('->')
|
|
808
|
+
const style = {
|
|
809
|
+
...getFormItemMargins(config)
|
|
810
|
+
}
|
|
811
|
+
if (isHidden({ config })) {
|
|
812
|
+
style.display = 'none'
|
|
813
|
+
}
|
|
814
|
+
return {
|
|
815
|
+
prop,
|
|
816
|
+
rules: getFormItemRule(config, lang, params, compProps),
|
|
817
|
+
class: {
|
|
818
|
+
[`vertical-${config['label-vertical'] || config['labelVertical'] || 'center'}`]: true,
|
|
819
|
+
'content-right': config.contentRight,
|
|
820
|
+
'hidden-label': isHiddenLable(config),
|
|
821
|
+
[`label-position-${config['label-position'] || config['labelPosition'] || 'right'}`]: true // label-position 支持三个值,right、left、top
|
|
822
|
+
},
|
|
823
|
+
style,
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export function getFormItemRule(config, lang, params, compProps, fromCustValid) {
|
|
828
|
+
const required = config.requiredFlag == '1'
|
|
829
|
+
const onlyRequiredFlag = config.onlyRequiredFlag
|
|
830
|
+
let trigger = ['blur', 'change']
|
|
831
|
+
// 如果是input框并且开启了金额显示
|
|
832
|
+
if (config.showMoney && config.metaType == 'ElInput') {
|
|
833
|
+
trigger = 'blur'
|
|
834
|
+
}
|
|
835
|
+
const rules = []
|
|
836
|
+
// 是否需要去进行校验
|
|
837
|
+
const needToValid = !(
|
|
838
|
+
(compProps?.disabled || isPlainColumn(config, compProps?.disabled)) && config.alongValidate != '1' ||
|
|
839
|
+
isChainHidden({ config })
|
|
840
|
+
)
|
|
841
|
+
if (!needToValid) {
|
|
842
|
+
return rules
|
|
843
|
+
}
|
|
844
|
+
if (!onlyRequiredFlag && required) {
|
|
845
|
+
rules.push({
|
|
846
|
+
// required,
|
|
847
|
+
validator: (rule, value, callback) => {
|
|
848
|
+
let val = config?.refValue
|
|
849
|
+
if (fromCustValid) {
|
|
850
|
+
val = value
|
|
851
|
+
}
|
|
852
|
+
const message = lang.indexOf('zh') > -1 ? `${config.metaNameZh || ''}不能为空` : `${config.metaNameEn || ''} can not be empty`
|
|
853
|
+
if (!onlyRequiredFlag && required) {
|
|
854
|
+
if (val === '' || val === null || val === undefined || (Array.isArray(val) && !val.length)) {
|
|
855
|
+
callback(new Error(message))
|
|
856
|
+
} else {
|
|
857
|
+
// isMatch在下来框的时候,表示当前值没有在下拉选项中匹配到,就表示没有选中值;因为后端在表字段为数字类型的时候,默认返回的是0值
|
|
858
|
+
if (hasOwn(config, 'isMatch') && !config.isMatch) {
|
|
859
|
+
callback(new Error(message))
|
|
860
|
+
} else {
|
|
861
|
+
callback()
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
} else {
|
|
865
|
+
callback()
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
trigger,
|
|
869
|
+
})
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
let regexPattern = []
|
|
873
|
+
if (config.regexPattern) {
|
|
874
|
+
try {
|
|
875
|
+
regexPattern = JSON.parse(config.regexPattern)
|
|
876
|
+
regexPattern = regexPattern.map(item => ({
|
|
877
|
+
reg: item?.pattern,
|
|
878
|
+
tip: item?.message,
|
|
879
|
+
tipEn: item?.messageEn,
|
|
880
|
+
}))
|
|
881
|
+
|
|
882
|
+
} catch (error) {
|
|
883
|
+
console.log(config.metaCode, '=regexPattern JSON parse fail, error==:', error)
|
|
884
|
+
regexPattern = []
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
if (config.validRegs && (Array.isArray(config.validRegs) || isPlainObject(config.validRegs)) ) {
|
|
888
|
+
const validRegs = isPlainObject(config.validRegs) ? [config.validRegs] : config.validRegs
|
|
889
|
+
regexPattern.push(...validRegs)
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
if (regexPattern?.length) {
|
|
893
|
+
rules.push({
|
|
894
|
+
validator: (rule, value, callback) => {
|
|
895
|
+
const bingdValue = config?.refValue
|
|
896
|
+
if (fromCustValid) {
|
|
897
|
+
val = value
|
|
898
|
+
}
|
|
899
|
+
const val = (bingdValue === null || bingdValue === undefined) ? '' : bingdValue
|
|
900
|
+
if (!val) callback() // 为空不进行正则校验
|
|
901
|
+
for (let i = 0; i < regexPattern.length; i++) {
|
|
902
|
+
const validInfo = regexPattern[i]
|
|
903
|
+
const { reg, tip, tipEn } = validInfo
|
|
904
|
+
const message = lang.indexOf('zh') > -1 ? tip : tipEn
|
|
905
|
+
let validFlag = true
|
|
906
|
+
if (typeof reg === 'function') {
|
|
907
|
+
validFlag = reg(val, params)
|
|
908
|
+
} else {
|
|
909
|
+
validFlag = new RegExp(reg).test(val)
|
|
910
|
+
}
|
|
911
|
+
if (!validFlag) {
|
|
912
|
+
callback(new Error(message))
|
|
913
|
+
return
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
callback()
|
|
917
|
+
},
|
|
918
|
+
trigger,
|
|
919
|
+
})
|
|
920
|
+
}
|
|
921
|
+
let validators = config.validators
|
|
922
|
+
if (validators) {
|
|
923
|
+
validators = isArray(validators) ? validators : [validators]
|
|
924
|
+
if (validators && validators.length) {
|
|
925
|
+
validators.forEach(validator => {
|
|
926
|
+
if (isFunction(validator)) {
|
|
927
|
+
rules.push({
|
|
928
|
+
validator: (rule, value, callback) => {
|
|
929
|
+
return validator(rule, config.refValue, callback, config)
|
|
930
|
+
},
|
|
931
|
+
trigger,
|
|
932
|
+
})
|
|
933
|
+
}
|
|
934
|
+
})
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return rules
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
function getFormItemMargins(config) {
|
|
941
|
+
const marginObj = {}
|
|
942
|
+
if (config.formItemMarginRight && `${config.formItemMarginRight}` !== '-1') {
|
|
943
|
+
marginObj.marginRight = normalPixel(config.formItemMarginRight)
|
|
944
|
+
}
|
|
945
|
+
if (config.formItemMarginLeft && `${config.formItemMarginLeft}` !== '-1') {
|
|
946
|
+
marginObj.marginLeft = normalPixel(config.formItemMarginLeft)
|
|
947
|
+
}
|
|
948
|
+
if (config.formItemMarginTop && `${config.formItemMarginTop}` !== '-1') {
|
|
949
|
+
marginObj.marginTop = normalPixel(config.formItemMarginTop)
|
|
950
|
+
}
|
|
951
|
+
if (config.formItemMarginBottom && `${config.formItemMarginBottom}` !== '-1') {
|
|
952
|
+
marginObj.marginBottom = normalPixel(config.formItemMarginBottom)
|
|
953
|
+
}
|
|
954
|
+
if (config.formItemPaddingRight && `${config.formItemPaddingRight}` !== '-1') {
|
|
955
|
+
marginObj.paddingRight = normalPixel(config.formItemPaddingRight)
|
|
956
|
+
}
|
|
957
|
+
if (config.formItemPaddingLeft && `${config.formItemPaddingLeft}` !== '-1') {
|
|
958
|
+
marginObj.paddingLeft = normalPixel(config.formItemPaddingLeft)
|
|
959
|
+
}
|
|
960
|
+
if (config.formItemPaddingTop && `${config.formItemPaddingTop}` !== '-1') {
|
|
961
|
+
marginObj.paddingTop = normalPixel(config.formItemPaddingTop)
|
|
962
|
+
}
|
|
963
|
+
if (config.formItemPaddingBottom && `${config.formItemPaddingBottom}` !== '-1') {
|
|
964
|
+
marginObj.paddingBottom = normalPixel(config.formItemPaddingBottom)
|
|
965
|
+
}
|
|
966
|
+
return marginObj
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
function normalLabelTipContent(content = '') {
|
|
970
|
+
if (content) {
|
|
971
|
+
const retList = []
|
|
972
|
+
const lines = content.split('\n')
|
|
973
|
+
lines.forEach((str, idx) => {
|
|
974
|
+
retList.push(str)
|
|
975
|
+
if (idx !== lines.length - 1) {
|
|
976
|
+
retList.push(
|
|
977
|
+
<br></br>
|
|
978
|
+
)
|
|
979
|
+
}
|
|
980
|
+
})
|
|
981
|
+
return retList
|
|
982
|
+
}
|
|
983
|
+
return ''
|
|
984
|
+
}
|
|
985
|
+
function createFormLable(config, lang = 'zh') {
|
|
986
|
+
const ElTooltip = resolveComponent('el-tooltip')
|
|
987
|
+
const elIcon = resolveComponent('el-icon')
|
|
988
|
+
const required = config.requiredFlag == '1' && config.hiddenRequiredFlag != '1'
|
|
989
|
+
const slots = {}
|
|
990
|
+
slots.default = () => {
|
|
991
|
+
return <span class="label-tip"><elIcon size="17">
|
|
992
|
+
<infoIcon type={config?.hintType}></infoIcon>
|
|
993
|
+
</elIcon></span>
|
|
994
|
+
}
|
|
995
|
+
slots.content = () => {
|
|
996
|
+
return normalLabelTipContent(lang.indexOf('zh') > -1 ? config.hintContentZh : config.hintContentEn)
|
|
997
|
+
}
|
|
998
|
+
return (
|
|
999
|
+
<div title={lang.indexOf('zh') > -1 ? (config.labelZh || config.metaNameZh) : (config.labelEn || config.metaNameEn)} class="custom-label">
|
|
1000
|
+
<span
|
|
1001
|
+
onMouseenter={(e) => labelMouseEnenter(e, config, lang)}
|
|
1002
|
+
onMouseleave={() => config._labelShowTip = false}
|
|
1003
|
+
class={`custom-label-content ${required ? 'custom-label-require' : ''}`} style={config.labelStyle}
|
|
1004
|
+
onClick={() => config.onLabelClick && config.onLabelClick?.(config)}
|
|
1005
|
+
>
|
|
1006
|
+
{/* {required ? <span style="color: #f5222d; margin-right: 3px">*</span> : null} */}
|
|
1007
|
+
{/* {required ? '*' : null} */}
|
|
1008
|
+
{lang.indexOf('zh') > -1 ? (config.labelZh || config.metaNameZh) : (config.labelEn || config.metaNameEn)}
|
|
1009
|
+
</span>
|
|
1010
|
+
{
|
|
1011
|
+
config._labelShowTip ?
|
|
1012
|
+
<ElTooltip
|
|
1013
|
+
placement="top"
|
|
1014
|
+
visible={config._labelShowTip && !!config._triggerRef}
|
|
1015
|
+
content={lang.indexOf('zh') > -1 ? (config.labelZh || config.metaNameZh) : (config.labelEn || config.metaNameEn)}
|
|
1016
|
+
virtualTriggering
|
|
1017
|
+
virtualRef={config._triggerRef}
|
|
1018
|
+
></ElTooltip>
|
|
1019
|
+
: null
|
|
1020
|
+
}
|
|
1021
|
+
{
|
|
1022
|
+
config.hintFlag == '1' ? (
|
|
1023
|
+
<ElTooltip popper-class="poppper-class" effect="dark" content={lang.indexOf('zh') > -1 ? config.hintContentZh : config.hintContentEn} placement="top">
|
|
1024
|
+
{ slots }
|
|
1025
|
+
</ElTooltip>
|
|
1026
|
+
) : null
|
|
1027
|
+
}
|
|
1028
|
+
</div>
|
|
1029
|
+
)
|
|
1030
|
+
}
|
|
1031
|
+
function createFormLabelErrorTip(info, config, lang='zh') {
|
|
1032
|
+
return (
|
|
1033
|
+
<span title={info.error} class="el-form-item__error polyfill-form-item_error">{info.error}</span>
|
|
1034
|
+
)
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
export function getComponentPropsKeys(comp, config) {
|
|
1038
|
+
let propsKeys = []
|
|
1039
|
+
if (typeof comp === 'string') {
|
|
1040
|
+
propsKeys = []
|
|
1041
|
+
} else {
|
|
1042
|
+
propsKeys = Object.keys(comp.props || {})
|
|
1043
|
+
}
|
|
1044
|
+
let emitsKyes = []
|
|
1045
|
+
if (config) {
|
|
1046
|
+
Object.keys(config).forEach(key => {
|
|
1047
|
+
if (COFNGI_KEY_EVENT_FLAG.test(key) && !['onVnodeMounted'].includes(key)) {
|
|
1048
|
+
emitsKyes.push(key)
|
|
1049
|
+
}
|
|
1050
|
+
})
|
|
1051
|
+
}
|
|
1052
|
+
// if (comp?.emits) {
|
|
1053
|
+
// if (isPlainObject(comp?.emits)) {
|
|
1054
|
+
// emitsKyes = Object.keys(comp.emits)
|
|
1055
|
+
// } else if (isArray(comp.emits)) {
|
|
1056
|
+
// emitsKyes = comp.emits
|
|
1057
|
+
// }
|
|
1058
|
+
// }
|
|
1059
|
+
// emitsKyes = emitsKyes.filter(key => typeof key === 'string').map(key => `on${capitalize((camelize(key)))}`)
|
|
1060
|
+
return [...emitsKyes, ...propsKeys]
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
function isTransCellMobile(config, disabled) {
|
|
1064
|
+
return config?.alwaysNative !== '1' && disabled && findComponent(TRANS_CELL_COMPONETS, config.renderby || config.metaType) !== -1
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
// 如果父级有一个是hidden了,那就表示hidden了
|
|
1068
|
+
function isChainHidden({config}) {
|
|
1069
|
+
if (isHidden({config})) {
|
|
1070
|
+
return true
|
|
1071
|
+
}
|
|
1072
|
+
if (config?.parent) {
|
|
1073
|
+
return isChainHidden({config: config.parent})
|
|
1074
|
+
}
|
|
1075
|
+
return false
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
function generateVuePath(path) {
|
|
1079
|
+
class LoadModulePath extends String {
|
|
1080
|
+
constructor(...arg) {
|
|
1081
|
+
super(...arg)
|
|
1082
|
+
}
|
|
1083
|
+
toString(...arg) {
|
|
1084
|
+
const ret = super.toString(...arg)
|
|
1085
|
+
if (!/\.\w*$/.test(ret)) {
|
|
1086
|
+
return `${ret}.vue`
|
|
1087
|
+
}
|
|
1088
|
+
return ret
|
|
1089
|
+
}
|
|
1090
|
+
originVal() {
|
|
1091
|
+
return path
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return new LoadModulePath(path)
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
export function getComponentSolt({
|
|
1098
|
+
config,
|
|
1099
|
+
slotKey = 'slots'
|
|
1100
|
+
}) {
|
|
1101
|
+
const slots = config?.[slotKey]
|
|
1102
|
+
if (slots) {
|
|
1103
|
+
let retSlots = null
|
|
1104
|
+
try {
|
|
1105
|
+
retSlots = Object.keys(slots).reduce((ret, key) => {
|
|
1106
|
+
ret[key] = slots[key]
|
|
1107
|
+
return ret
|
|
1108
|
+
}, {})
|
|
1109
|
+
} catch (error) {
|
|
1110
|
+
console.error('slots parse fail, error==:', error)
|
|
1111
|
+
}
|
|
1112
|
+
return retSlots
|
|
1113
|
+
}
|
|
1114
|
+
return {}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
function labelMouseEnenter(e, config, lang) {
|
|
1118
|
+
const innerText = lang.indexOf('zh') > -1 ? (config.labelZh || config.metaNameZh) : (config.labelEn || config.metaNameEn)
|
|
1119
|
+
// obj为鼠标移入时的事件对象
|
|
1120
|
+
// currentwidth 为文本在页面中所占的宽度,创建标签,加入到页面,获取currentwidth,最后
|
|
1121
|
+
let TemporaryTag = document.createElement('span');
|
|
1122
|
+
TemporaryTag.innerText = innerText
|
|
1123
|
+
TemporaryTag.className = 'getTextWidth'
|
|
1124
|
+
document.querySelector('body').appendChild(TemporaryTag)
|
|
1125
|
+
let currentWidth = document.querySelector('.getTextWidth').offsetWidth
|
|
1126
|
+
document.querySelector(".getTextWidth").remove()
|
|
1127
|
+
// cellwidth为表格容器的宽度
|
|
1128
|
+
// 当文本宽度小于|等于容器宽度两倍时,代表文本显示未超过两行
|
|
1129
|
+
// 当前宽度小于等于(两倍单元格宽度)时,显示提示信息为假;否则,显示提示信息为真。
|
|
1130
|
+
const cellWidth = e.target.offsetWidth
|
|
1131
|
+
if (currentWidth <= (2 * cellWidth)) {
|
|
1132
|
+
config._labelShowTip = false
|
|
1133
|
+
config._triggerRef = null
|
|
1134
|
+
} else {
|
|
1135
|
+
config._labelShowTip = true
|
|
1136
|
+
config._triggerRef = e.target
|
|
1137
|
+
}
|
|
1138
|
+
}
|