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,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="inputNumberValue">
|
|
3
|
+
<template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
|
|
4
|
+
<slot :name="key" v-bind="scope"></slot>
|
|
5
|
+
</template>
|
|
6
|
+
</ElInputNumber>
|
|
7
|
+
</template>
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ElInputNumber } from 'element-plus'
|
|
10
|
+
import { useAttrs, computed, ref, useSlots } from 'vue'
|
|
11
|
+
import { commonPropsType, isDate } from '../../utils/index.js'
|
|
12
|
+
|
|
13
|
+
const slots = useSlots()
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
textAlign: {
|
|
16
|
+
type: String, // left、right
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
19
|
+
...ElInputNumber.props,
|
|
20
|
+
...commonPropsType,
|
|
21
|
+
step: [String, Number],
|
|
22
|
+
precision: [String, Number],
|
|
23
|
+
modeValue: [String, Number]
|
|
24
|
+
})
|
|
25
|
+
const textAlignClass = computed(() => {
|
|
26
|
+
return props.textAlign === 'right' ? 'text-right' :
|
|
27
|
+
props.textAlign === 'left' ? 'text-left' : ''
|
|
28
|
+
})
|
|
29
|
+
const inputNumberProps = computed(() => {
|
|
30
|
+
const ret = Object.keys(ElInputNumber.props).reduce((ret, key) => {
|
|
31
|
+
ret[key] = props[key]
|
|
32
|
+
return ret
|
|
33
|
+
}, {})
|
|
34
|
+
if (props.config?.maxValue && !isNaN(props.config.maxValue)) {
|
|
35
|
+
ret.max =parseFloat(props.config.maxValue)
|
|
36
|
+
}
|
|
37
|
+
if (props.config?.minValue && !isNaN(props.config.minValue)) {
|
|
38
|
+
ret.min = parseFloat(props.config.minValue)
|
|
39
|
+
}
|
|
40
|
+
if (props.config?.precise && !isNaN(props.config.precise)) {
|
|
41
|
+
ret.precision = parseInt(props.config.precise)
|
|
42
|
+
}
|
|
43
|
+
if (ret.step) {
|
|
44
|
+
ret.step = parseFloat(ret.step)
|
|
45
|
+
}
|
|
46
|
+
return ret
|
|
47
|
+
})
|
|
48
|
+
const attrs = useAttrs()
|
|
49
|
+
const modeValue = defineModel()
|
|
50
|
+
const inputNumberValue = computed({
|
|
51
|
+
get() {
|
|
52
|
+
return parseFloat(modeValue.value)
|
|
53
|
+
},
|
|
54
|
+
set(val) {
|
|
55
|
+
modeValue.value = val
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
// 目前有问题,可以输入--跟e字符串
|
|
59
|
+
const updateKey = ref(false)
|
|
60
|
+
const normalValue = () => {
|
|
61
|
+
if (modeValue.value === null) {
|
|
62
|
+
updateKey.value = !updateKey.value
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
<style lang="scss">
|
|
67
|
+
.text-right {
|
|
68
|
+
.el-input__wrapper {
|
|
69
|
+
input {
|
|
70
|
+
text-align: right;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.text-left {
|
|
75
|
+
.el-input__wrapper {
|
|
76
|
+
input {
|
|
77
|
+
text-align: left;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ElPagination } from 'element-plus'
|
|
3
|
+
import { computed, defineProps, useAttrs, useSlots } from 'vue'
|
|
4
|
+
import { commonPropsType, hasOwn } from '../../utils/index.js'
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
...commonPropsType,
|
|
8
|
+
...ElPagination.props,
|
|
9
|
+
})
|
|
10
|
+
const slots = useSlots()
|
|
11
|
+
const calcProps = computed(() => {
|
|
12
|
+
const ret = Object.keys(ElPagination.props).reduce((total, key) => {
|
|
13
|
+
total[key] = props[key]
|
|
14
|
+
return total
|
|
15
|
+
}, {})
|
|
16
|
+
if (!props.config['page-sizes'] && !props.config['pageSizes']) {
|
|
17
|
+
ret['pageSizes'] = [5, 10, 20, 30]
|
|
18
|
+
}
|
|
19
|
+
if (!ret.layout || typeof ret.layout !== 'string') {
|
|
20
|
+
ret.layout = 'total'
|
|
21
|
+
}
|
|
22
|
+
if (props.config?.showSizer == '1' || props.config?.showJumper == '1') {
|
|
23
|
+
const layoutArr = ret.layout ? ret.layout.split(',') : []
|
|
24
|
+
if (props.config?.showSizer == '1') {
|
|
25
|
+
if (!layoutArr.some(item => item.trim() === 'sizes')) {
|
|
26
|
+
layoutArr.splice(1, 0, 'sizes')
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!layoutArr.some(item => item.trim() === 'prev')) {
|
|
30
|
+
layoutArr.splice(2, 0, 'prev')
|
|
31
|
+
}
|
|
32
|
+
if (!layoutArr.some(item => item.trim() === 'pager')) {
|
|
33
|
+
layoutArr.splice(3, 0, 'pager')
|
|
34
|
+
}
|
|
35
|
+
if (!layoutArr.some(item => item.trim() === 'next')) {
|
|
36
|
+
layoutArr.splice(4, 0, 'next')
|
|
37
|
+
}
|
|
38
|
+
if (props.config?.showJumper == '1') {
|
|
39
|
+
if (!layoutArr.some(item => item.trim() === 'jumper')) {
|
|
40
|
+
layoutArr.push('jumper')
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
ret.layout = layoutArr.join(',')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!hasOwn(props.config, 'background')) {
|
|
47
|
+
ret.background = true
|
|
48
|
+
}
|
|
49
|
+
return ret
|
|
50
|
+
})
|
|
51
|
+
const attrs = useAttrs()
|
|
52
|
+
const modelValue = defineModel()
|
|
53
|
+
|
|
54
|
+
</script>
|
|
55
|
+
<template>
|
|
56
|
+
<ElPagination v-bind="{...attrs, ...calcProps}">
|
|
57
|
+
<template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
|
|
58
|
+
<slot :name="key" v-bind="scope"></slot>
|
|
59
|
+
</template>
|
|
60
|
+
</ElPagination>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-radio-group v-bind="{...radioGroupProps, ...attrs}" v-model="modeValue">
|
|
3
|
+
<CurrentRadio v-for="option in props.options"
|
|
4
|
+
:key="option.columnValue"
|
|
5
|
+
:value="option.columnValue"
|
|
6
|
+
>
|
|
7
|
+
{{lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}}
|
|
8
|
+
<template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
|
|
9
|
+
<slot :name="key" v-bind="scope"></slot>
|
|
10
|
+
</template>
|
|
11
|
+
</CurrentRadio>
|
|
12
|
+
</el-radio-group>
|
|
13
|
+
</template>
|
|
14
|
+
<script setup>
|
|
15
|
+
import { ElRadioGroup, ElRadio, ElRadioButton } from 'element-plus'
|
|
16
|
+
import { useAttrs, computed, inject, useSlots } from 'vue'
|
|
17
|
+
import { commonPropsType, hasOwn } from '../../utils/index.js'
|
|
18
|
+
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
...ElRadioGroup.props,
|
|
21
|
+
...commonPropsType,
|
|
22
|
+
})
|
|
23
|
+
const slots = useSlots()
|
|
24
|
+
// 两种样式,一种是button,一种是default,默认为default
|
|
25
|
+
const type = computed(() => {
|
|
26
|
+
return props.config.type || 'default'
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const CurrentRadio = computed(() => {
|
|
30
|
+
return type.value === 'button' ? ElRadioButton : ElRadio
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const lang = inject('lang')
|
|
34
|
+
|
|
35
|
+
const radioGroupProps = computed(() => {
|
|
36
|
+
const ret = Object.keys(ElRadioGroup.props).reduce((ret, key) => {
|
|
37
|
+
ret[key] = props[key]
|
|
38
|
+
return ret
|
|
39
|
+
}, {})
|
|
40
|
+
if (!hasOwn(ret, 'value')) {
|
|
41
|
+
ret.value = '1'
|
|
42
|
+
}
|
|
43
|
+
return ret
|
|
44
|
+
})
|
|
45
|
+
const attrs = useAttrs()
|
|
46
|
+
const modeValue = defineModel()
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { ElSelect, ElOption, ElSelectV2 } from 'element-plus'
|
|
2
|
+
import { computed, inject, onMounted, watch} from 'vue'
|
|
3
|
+
import { commonPropsType, hasOwn, isArray, isNumber, isPlainObject, isString, VALUE_TYPES } from '../../utils/index.js'
|
|
4
|
+
import OptionsDefault from '../options/optionsDefault.vue'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
props: {
|
|
9
|
+
...ElSelectV2.props,
|
|
10
|
+
...ElSelect.props,
|
|
11
|
+
...commonPropsType,
|
|
12
|
+
multiple: [String, Boolean, Number],
|
|
13
|
+
filterable: [String, Boolean, Number],
|
|
14
|
+
multipleLimit: [String, Number],
|
|
15
|
+
rangeOptions: Array,
|
|
16
|
+
excludeOptions: Array,
|
|
17
|
+
// 多选的分割符号
|
|
18
|
+
separator: {
|
|
19
|
+
type: [String],
|
|
20
|
+
default: ','
|
|
21
|
+
},
|
|
22
|
+
virtualized: {
|
|
23
|
+
type: [String, Boolean, Number],
|
|
24
|
+
default: ''
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
emits: ['update:modelValue'],
|
|
28
|
+
setup(props, { emit, attrs, expose, slots }) {
|
|
29
|
+
// 这个是真实的值
|
|
30
|
+
const modelValue = computed({
|
|
31
|
+
get() {
|
|
32
|
+
let val = props.modelValue
|
|
33
|
+
if (!props.hidden) {
|
|
34
|
+
if (isStrVal.value) {
|
|
35
|
+
if (isPlainObject(val) || isArray(val)) {
|
|
36
|
+
try {
|
|
37
|
+
val = Object.values(val).join(props.separator)
|
|
38
|
+
emit('update:modelValue', val)
|
|
39
|
+
} catch (error) {
|
|
40
|
+
val = val
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if ((val && isString(val)) || isNumber(val)) {
|
|
45
|
+
val = `${val}`?.split(props.separator)
|
|
46
|
+
if (isObject.value) {
|
|
47
|
+
val = val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {})
|
|
48
|
+
}
|
|
49
|
+
emit('update:modelValue', val)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return val
|
|
54
|
+
},
|
|
55
|
+
set(val) {
|
|
56
|
+
emit('update:modelValue', val)
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
const separator = computed(() => {
|
|
60
|
+
return props.separator
|
|
61
|
+
})
|
|
62
|
+
const valueTypes = computed(() => {
|
|
63
|
+
return props.config?.valueType
|
|
64
|
+
})
|
|
65
|
+
// 值是list 还是,连起来的string
|
|
66
|
+
const isStrVal = computed(() => {
|
|
67
|
+
// valueType 值为 list 或者 string
|
|
68
|
+
return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
|
|
69
|
+
})
|
|
70
|
+
const isObject = computed(() => {
|
|
71
|
+
return valueTypes.value === VALUE_TYPES.OBJECT
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
// 是否为多选
|
|
75
|
+
const isMutiple = computed(() => {
|
|
76
|
+
if (typeof props.multiple === 'boolean') {
|
|
77
|
+
return props.multiple
|
|
78
|
+
}
|
|
79
|
+
return props.multiple == '1'
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const options = computed(() => {
|
|
83
|
+
let list = props.options
|
|
84
|
+
if (props.rangeOptions && props.rangeOptions.length) {
|
|
85
|
+
list = list?.filter?.(item => props.rangeOptions?.some(subValue => subValue == item.columnValue))
|
|
86
|
+
}
|
|
87
|
+
if (props.excludeOptions && props.excludeOptions.length) {
|
|
88
|
+
list = list?.filter?.(item => !(props.excludeOptions?.some(subValue => subValue == item.columnValue)))
|
|
89
|
+
}
|
|
90
|
+
return list
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const isVirtualized = computed(() => {
|
|
94
|
+
if (typeof props.virtualized === 'boolean') {
|
|
95
|
+
return props.virtualized
|
|
96
|
+
}
|
|
97
|
+
return props.virtualized == '1'
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const currentComp = computed(() => {
|
|
101
|
+
return isVirtualized.value ? ElSelectV2 : ElSelect
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
const value = computed({
|
|
105
|
+
get() {
|
|
106
|
+
if (isMutiple.value) {
|
|
107
|
+
if (hasOwn(props.config, 'isMatch')) {
|
|
108
|
+
// 如果是多选情况,不需要使用isMatch进行判断,所以这里需要进行清除
|
|
109
|
+
props.config.isMatch = true
|
|
110
|
+
}
|
|
111
|
+
const val = modelValue.value || ''
|
|
112
|
+
return val ?
|
|
113
|
+
(
|
|
114
|
+
isStrVal.value ?
|
|
115
|
+
val.split(separator.value) :
|
|
116
|
+
(
|
|
117
|
+
isObject.value ?
|
|
118
|
+
Object.values(val || {}) :
|
|
119
|
+
val
|
|
120
|
+
)
|
|
121
|
+
) :
|
|
122
|
+
[]
|
|
123
|
+
} else {
|
|
124
|
+
if (modelValue.value !== null && modelValue.value !== undefined) {
|
|
125
|
+
if (options.value?.some(item => item.columnValue == modelValue.value)) {
|
|
126
|
+
props.config.isMatch = true
|
|
127
|
+
return `${modelValue.value}`
|
|
128
|
+
} else {
|
|
129
|
+
props.config.isMatch = false
|
|
130
|
+
return ''
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
return ''
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
set(val) {
|
|
138
|
+
if (isMutiple.value) {
|
|
139
|
+
modelValue.value = isStrVal.value ?
|
|
140
|
+
val.join(separator.value) :
|
|
141
|
+
(
|
|
142
|
+
isObject.value ?
|
|
143
|
+
val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
|
|
144
|
+
val
|
|
145
|
+
)
|
|
146
|
+
} else {
|
|
147
|
+
modelValue.value = val
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
const selectProps = computed(() => {
|
|
153
|
+
// let props = ElSelect.props
|
|
154
|
+
// if (isVirtualized.value) {
|
|
155
|
+
// props = ElSelectV2.props
|
|
156
|
+
// }
|
|
157
|
+
// 不同通过上面注释代码进行赋值,可能是ElSelectV2.props、ElSelect.props不能复制给其他的
|
|
158
|
+
|
|
159
|
+
const attrs = Object.keys(isVirtualized.value ? ElSelectV2.props : ElSelect.props).reduce((ret, key) => {
|
|
160
|
+
ret[key] = props[key]
|
|
161
|
+
return ret
|
|
162
|
+
}, {})
|
|
163
|
+
if (attrs.placeholder === null || attrs.placeholder === undefined) {
|
|
164
|
+
attrs.placeholder = ''
|
|
165
|
+
}
|
|
166
|
+
if (typeof attrs.filterable !== 'boolean') {
|
|
167
|
+
attrs.filterable = attrs.filterable == '1'
|
|
168
|
+
}
|
|
169
|
+
if (typeof attrs.multiple === 'string') {
|
|
170
|
+
attrs.multiple = attrs.multiple == '1'
|
|
171
|
+
}
|
|
172
|
+
if (!attrs['suffix-icon'] && !attrs.suffixIcon) {
|
|
173
|
+
delete attrs.suffixIcon
|
|
174
|
+
delete attrs['suffix-icon']
|
|
175
|
+
}
|
|
176
|
+
attrs.multipleLimit = Number(parseInt(attrs.multipleLimit || 0))
|
|
177
|
+
if (isVirtualized.value) {
|
|
178
|
+
// 返回虚拟select需要的options
|
|
179
|
+
attrs.options = options.value?.map(option => {
|
|
180
|
+
return {
|
|
181
|
+
...option,
|
|
182
|
+
value: option.columnValue,
|
|
183
|
+
label: lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc,
|
|
184
|
+
disabled: option.columnStatus == '0' || option.columnStatus == '2'
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
return attrs
|
|
189
|
+
})
|
|
190
|
+
const lang = inject('lang')
|
|
191
|
+
const clear = () => {
|
|
192
|
+
modelValue.value = ''
|
|
193
|
+
}
|
|
194
|
+
const getRenderSlots = function () {
|
|
195
|
+
const optionsSlotKeys = {
|
|
196
|
+
optionDefault: 'default'
|
|
197
|
+
}
|
|
198
|
+
const optionsSlots = {}
|
|
199
|
+
const selectSlots = {}
|
|
200
|
+
Object.keys(slots).forEach(key => {
|
|
201
|
+
if (Object.keys(optionsSlotKeys).includes(key)) {
|
|
202
|
+
optionsSlots[optionsSlotKeys[key]] = slots[key]
|
|
203
|
+
} else {
|
|
204
|
+
selectSlots[key] = slots[key]
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
if (isVirtualized.value) {
|
|
209
|
+
const originDef = selectSlots.default
|
|
210
|
+
selectSlots.default = ({ item: option }) => {
|
|
211
|
+
return (
|
|
212
|
+
<OptionsDefault label={lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}>
|
|
213
|
+
{
|
|
214
|
+
originDef?.(option)
|
|
215
|
+
}
|
|
216
|
+
</OptionsDefault>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
selectSlots.default = () => options.value?.map(option => {
|
|
221
|
+
return (
|
|
222
|
+
<ElOption
|
|
223
|
+
key={option.columnValue}
|
|
224
|
+
label={lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}
|
|
225
|
+
value={option.columnValue}
|
|
226
|
+
disabled={option.columnStatus == '0' || option.columnStatus == '2'}
|
|
227
|
+
>
|
|
228
|
+
<OptionsDefault label={lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}>
|
|
229
|
+
{
|
|
230
|
+
optionsSlots?.default?.(option)
|
|
231
|
+
}
|
|
232
|
+
</OptionsDefault>
|
|
233
|
+
</ElOption>
|
|
234
|
+
)
|
|
235
|
+
})
|
|
236
|
+
}
|
|
237
|
+
return selectSlots
|
|
238
|
+
}
|
|
239
|
+
return () => {
|
|
240
|
+
return (
|
|
241
|
+
<currentComp.value class="custom-self-select" { ...{...attrs, ...selectProps.value }} v-model={value.value} onClear={clear}>
|
|
242
|
+
{
|
|
243
|
+
getRenderSlots()
|
|
244
|
+
}
|
|
245
|
+
</currentComp.value>
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ElSelect class="custom-self-select" v-bind="{...attrs, ...selectProps }" v-model="value" @clear="clear">
|
|
3
|
+
<ElOption v-for="option in options"
|
|
4
|
+
:key="option.columnValue"
|
|
5
|
+
:label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
|
|
6
|
+
:value="option.columnValue"
|
|
7
|
+
:disabled="option.columnStatus == '0' || option.columnStatus == '2'"
|
|
8
|
+
>
|
|
9
|
+
<template v-for="(_, key) in optionsSlots" :key="key" v-slot:[key]="scope">
|
|
10
|
+
<slot :name="key" v-bind="scope"></slot>
|
|
11
|
+
</template>
|
|
12
|
+
</ElOption>
|
|
13
|
+
<template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
|
|
14
|
+
<slot :name="key" v-bind="scope"></slot>
|
|
15
|
+
</template>
|
|
16
|
+
</ElSelect>
|
|
17
|
+
</template>
|
|
18
|
+
<script setup>
|
|
19
|
+
import { ElSelect, ElOption } from 'element-plus'
|
|
20
|
+
import { computed, defineProps, inject, useAttrs, useSlots } from 'vue'
|
|
21
|
+
import { commonPropsType, getComponentSolt } from '../../utils/index.js'
|
|
22
|
+
|
|
23
|
+
const VALUE_TYPES = {
|
|
24
|
+
LIST: 'list',
|
|
25
|
+
OBJECT: 'object',
|
|
26
|
+
STRING: 'string',
|
|
27
|
+
}
|
|
28
|
+
const slots = useSlots()
|
|
29
|
+
const optionsSlots = computed(() => {
|
|
30
|
+
return getComponentSolt({
|
|
31
|
+
config: props.config,
|
|
32
|
+
slotKey: 'optionsSlots'
|
|
33
|
+
}) || {}
|
|
34
|
+
})
|
|
35
|
+
const modelValue = defineModel()
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
...ElSelect.props,
|
|
38
|
+
...commonPropsType,
|
|
39
|
+
multiple: [String, Boolean],
|
|
40
|
+
filterable: [String, Boolean],
|
|
41
|
+
multipleLimit: [String, Number],
|
|
42
|
+
rangeOptions: Array,
|
|
43
|
+
excludeOptions: Array,
|
|
44
|
+
// 多选的分割符号
|
|
45
|
+
separator: {
|
|
46
|
+
type: [String],
|
|
47
|
+
default: ','
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
const attrs = useAttrs()
|
|
51
|
+
const separator = computed(() => {
|
|
52
|
+
return props.separator
|
|
53
|
+
})
|
|
54
|
+
const valueTypes = computed(() => {
|
|
55
|
+
return props.config?.valueType
|
|
56
|
+
})
|
|
57
|
+
// 值是list 还是,连起来的string
|
|
58
|
+
const isStrVal = computed(() => {
|
|
59
|
+
// valueType 值为 list 或者 string
|
|
60
|
+
return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
|
|
61
|
+
})
|
|
62
|
+
const isObject = computed(() => {
|
|
63
|
+
return valueTypes.value === VALUE_TYPES.OBJECT
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
// 是否为多选
|
|
67
|
+
const isMutiple = computed(() => {
|
|
68
|
+
return props.multiple == '1'
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const options = computed(() => {
|
|
72
|
+
let list = props.options
|
|
73
|
+
if (props.rangeOptions && props.rangeOptions.length) {
|
|
74
|
+
list = list?.filter?.(item => props.rangeOptions?.some(subValue => subValue == item.columnValue))
|
|
75
|
+
}
|
|
76
|
+
if (props.excludeOptions && props.excludeOptions.length) {
|
|
77
|
+
list = list?.filter?.(item => !(props.excludeOptions?.some(subValue => subValue == item.columnValue)))
|
|
78
|
+
}
|
|
79
|
+
return list
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const value = computed({
|
|
83
|
+
get() {
|
|
84
|
+
if (isMutiple.value) {
|
|
85
|
+
const val = modelValue.value || ''
|
|
86
|
+
return val ?
|
|
87
|
+
(
|
|
88
|
+
isStrVal.value ?
|
|
89
|
+
val.split(separator.value) :
|
|
90
|
+
(
|
|
91
|
+
isObject.value ?
|
|
92
|
+
Object.values(val || {}) :
|
|
93
|
+
val
|
|
94
|
+
)
|
|
95
|
+
) :
|
|
96
|
+
[]
|
|
97
|
+
} else {
|
|
98
|
+
if (modelValue.value !== null && modelValue.value !== undefined) {
|
|
99
|
+
if (options.value?.some(item => item.columnValue == modelValue.value)) {
|
|
100
|
+
props.config.isMatch = true
|
|
101
|
+
return `${modelValue.value}`
|
|
102
|
+
} else {
|
|
103
|
+
props.config.isMatch = false
|
|
104
|
+
return ''
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
return ''
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
set(val) {
|
|
112
|
+
if (isMutiple.value) {
|
|
113
|
+
modelValue.value = isStrVal.value ?
|
|
114
|
+
val.join(separator.value) :
|
|
115
|
+
(
|
|
116
|
+
isObject.value ?
|
|
117
|
+
val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
|
|
118
|
+
val
|
|
119
|
+
)
|
|
120
|
+
} else {
|
|
121
|
+
modelValue.value = val
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const selectProps = computed(() => {
|
|
127
|
+
const attrs = Object.keys(ElSelect.props).reduce((ret, key) => {
|
|
128
|
+
ret[key] = props[key]
|
|
129
|
+
return ret
|
|
130
|
+
}, {})
|
|
131
|
+
if (attrs.placeholder === null || attrs.placeholder === undefined) {
|
|
132
|
+
attrs.placeholder = ''
|
|
133
|
+
}
|
|
134
|
+
if (typeof attrs.filterable === 'string') {
|
|
135
|
+
attrs.filterable = attrs.filterable == '1'
|
|
136
|
+
}
|
|
137
|
+
if (typeof attrs.multiple === 'string') {
|
|
138
|
+
attrs.multiple = attrs.multiple == '1'
|
|
139
|
+
}
|
|
140
|
+
if (!attrs['suffix-icon'] && !attrs.suffixIcon) {
|
|
141
|
+
delete attrs.suffixIcon
|
|
142
|
+
delete attrs['suffix-icon']
|
|
143
|
+
}
|
|
144
|
+
attrs.multipleLimit = Number(parseInt(attrs.multipleLimit || 0))
|
|
145
|
+
return attrs
|
|
146
|
+
})
|
|
147
|
+
const lang = inject('lang')
|
|
148
|
+
const clear = () => {
|
|
149
|
+
modelValue.value = ''
|
|
150
|
+
}
|
|
151
|
+
</script>
|
|
152
|
+
<style lang="scss">
|
|
153
|
+
.custom-self-select {
|
|
154
|
+
}
|
|
155
|
+
</style>
|