@idooel/components 0.0.2-beta.3 → 0.0.2-beta.30
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/README.md +98 -98
- package/dist/@idooel/components.esm.js +3622 -1592
- package/dist/@idooel/components.umd.js +3676 -1647
- package/jsconfig.json +7 -7
- package/package.json +64 -50
- package/packages/alert/index.js +4 -4
- package/packages/alert/src/index.vue +45 -45
- package/packages/batch-export/index.js +4 -4
- package/packages/batch-export/src/index.vue +104 -104
- package/packages/business-components/modal-fsm/index.js +4 -4
- package/packages/business-components/modal-fsm/src/index.vue +163 -163
- package/packages/business-components/modal-import/index.js +4 -4
- package/packages/business-components/modal-import/src/index.vue +222 -139
- package/packages/business-components/modal-timeline/index.js +4 -4
- package/packages/business-components/modal-timeline/src/index.vue +77 -77
- package/packages/business-components/tabs-sub-center/index.js +4 -4
- package/packages/business-components/tabs-sub-center/src/index.vue +116 -116
- package/packages/button/index.js +4 -4
- package/packages/button/src/index.vue +65 -65
- package/packages/checkbox/index.js +4 -4
- package/packages/checkbox/src/index.vue +52 -52
- package/packages/composite-components/button-group/index.js +4 -4
- package/packages/composite-components/button-group/src/index.vue +151 -151
- package/packages/composite-components/form-attachment/src/index.vue +14 -14
- package/packages/composite-components/form-img-crop/index.js +4 -4
- package/packages/composite-components/form-img-crop/src/index.vue +131 -131
- package/packages/composite-components/modal-confirm/index.js +4 -4
- package/packages/composite-components/modal-confirm/src/index.vue +103 -103
- package/packages/composite-components/modal-form/index.js +4 -4
- package/packages/composite-components/modal-form/src/index.vue +230 -230
- package/packages/composite-components/modal-img-crop/index.js +4 -4
- package/packages/composite-components/modal-img-crop/src/index.vue +298 -298
- package/packages/composite-components/modal-table/index.js +4 -4
- package/packages/composite-components/modal-table/src/index.vue +155 -155
- package/packages/composite-components/modal-tree/index.js +4 -4
- package/packages/composite-components/modal-tree/src/index.vue +75 -75
- package/packages/composite-components/search-area/index.js +4 -4
- package/packages/composite-components/search-area/src/index.vue +239 -237
- package/packages/composite-components/search-area/src/label.vue +35 -35
- package/packages/composite-components/select-entity-modal-table/index.js +4 -4
- package/packages/composite-components/select-entity-modal-table/src/index.vue +171 -171
- package/packages/date/index.js +4 -4
- package/packages/date/src/index.vue +112 -112
- package/packages/date-range/index.js +4 -4
- package/packages/date-range/src/index.vue +47 -47
- package/packages/form/index.js +4 -4
- package/packages/form/src/index.vue +393 -319
- package/packages/icon/index.js +4 -4
- package/packages/icon/src/index.vue +31 -31
- package/packages/index.js +159 -153
- package/packages/input/index.js +4 -4
- package/packages/input/src/index.vue +35 -35
- package/packages/input-number/index.js +4 -4
- package/packages/input-number/src/index.vue +23 -23
- package/packages/loading/index.js +4 -4
- package/packages/loading/src/index.vue +36 -36
- package/packages/meta/provider.js +4 -0
- package/packages/modal/index.js +4 -4
- package/packages/modal/src/index.vue +184 -184
- package/packages/models/form-group-model/index.js +4 -4
- package/packages/models/form-group-model/src/index.vue +271 -273
- package/packages/models/form-model/index.js +4 -4
- package/packages/models/form-model/src/index.vue +236 -232
- package/packages/models/step-model/index.js +4 -4
- package/packages/models/step-model/src/index.vue +224 -224
- package/packages/models/tree-table-model/README.md +0 -0
- package/packages/models/tree-table-model/index.js +4 -4
- package/packages/models/tree-table-model/src/index.vue +964 -689
- package/packages/pagination/index.js +5 -0
- package/packages/pagination/src/index.vue +372 -0
- package/packages/radio/index.js +4 -4
- package/packages/radio/src/index.vue +56 -56
- package/packages/select/index.js +4 -4
- package/packages/select/src/index.vue +113 -105
- package/packages/select-entity/index.js +4 -4
- package/packages/select-entity/src/index.vue +119 -119
- package/packages/table/index.js +4 -4
- package/packages/table/src/action.vue +176 -172
- package/packages/table/src/index.vue +605 -319
- package/packages/tabs/index.js +4 -4
- package/packages/tabs/src/index.vue +55 -55
- package/packages/text/index.js +4 -4
- package/packages/text/src/index.vue +47 -47
- package/packages/text-editor/index.js +4 -4
- package/packages/text-editor/src/index.vue +72 -72
- package/packages/textarea/index.js +4 -4
- package/packages/textarea/src/index.vue +57 -57
- package/packages/theme/form.scss +21 -21
- package/packages/theme/index.scss +43 -43
- package/packages/theme/overrid.scss +7 -7
- package/packages/theme/styleClass.scss +2 -2
- package/packages/theme/variables.scss +55 -55
- package/packages/timeline/index.js +4 -4
- package/packages/timeline/src/index.vue +257 -257
- package/packages/tpl/index.js +4 -4
- package/packages/tpl/src/index.vue +55 -55
- package/packages/tree/index.js +4 -4
- package/packages/tree/src/TreeNode.vue +29 -29
- package/packages/tree/src/index.vue +101 -101
- package/packages/tree-select/index.js +4 -4
- package/packages/tree-select/src/index.vue +142 -142
- package/packages/upload/index.js +4 -4
- package/packages/upload/src/index.vue +998 -494
- package/packages/utils/README.md +172 -0
- package/packages/utils/index.js +66 -62
- package/packages/utils/runtime-context/dataPoolAPI.js +501 -0
- package/packages/utils/runtime-context/globalDataPool.js +279 -0
- package/packages/utils/runtime-context/index.js +76 -0
- package/packages/utils/runtime-context/modelSchema.js +174 -0
- package/scripts/rollup.config.js +42 -42
- package/scripts/rollup.esm.config.js +11 -11
- package/scripts/rollup.umd.config.js +17 -14
- package/vitest.config.js +17 -0
|
@@ -1,173 +1,177 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="g-table__action">
|
|
3
|
-
<div class="table-action__item" v-for="(item, idx) in execOperationExpression(dataSource)" :key="idx">
|
|
4
|
-
<template v-if="item.type == 'text'">
|
|
5
|
-
<span @click="handleClickText(item)">{{ item.label }}</span>
|
|
6
|
-
</template>
|
|
7
|
-
<template v-else-if="item.type == 'confirm'">
|
|
8
|
-
<div>
|
|
9
|
-
<a-popconfirm :title="item.message" @confirm="handleClickConfirm(item)">
|
|
10
|
-
{{ item.label }}
|
|
11
|
-
</a-popconfirm>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
<template v-else-if="item.type == 'dropdown'">
|
|
15
|
-
<a-dropdown>
|
|
16
|
-
<a-menu slot="overlay" @click="handleDropdownClick">
|
|
17
|
-
<a-menu-item :key="`${item.key || ''}${menuKeyDelimiter}${opt.value || ''}`" v-for="opt in execOperationExpression(item.optionList)">
|
|
18
|
-
<template v-if="opt.type == 'confirm'">
|
|
19
|
-
<a-popconfirm :title="opt.message" @confirm="handleClickConfirm(opt)">
|
|
20
|
-
{{ opt.label }}
|
|
21
|
-
</a-popconfirm>
|
|
22
|
-
</template>
|
|
23
|
-
<template v-else-if="opt.type == 'modal-confirm'">
|
|
24
|
-
<div style="width: 100%" @click="handleClickModalConfirm(opt)">{{ opt.label }}</div>
|
|
25
|
-
<ele-modal-confirm v-bind="opt.modalConfirm" v-on="$listeners" v-model="showModalConfirm"></ele-modal-confirm>
|
|
26
|
-
</template>
|
|
27
|
-
<template v-else>
|
|
28
|
-
{{ opt.label }}
|
|
29
|
-
</template>
|
|
30
|
-
</a-menu-item>
|
|
31
|
-
</a-menu>
|
|
32
|
-
<span>{{ item.label }}</span>
|
|
33
|
-
</a-dropdown>
|
|
34
|
-
</template>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<script>
|
|
40
|
-
import { v5 as uuidv5 } from 'uuid'
|
|
41
|
-
import { type, route } from '@idooel/shared'
|
|
42
|
-
import { parse } from '@idooel/expression'
|
|
43
|
-
import { CONTEXT } from '../../utils'
|
|
44
|
-
const MENU_KEY_NAMESPACE = 'f7b3b8b0-1b7b-11ec-9621-0242ac130002'
|
|
45
|
-
export default {
|
|
46
|
-
props: {
|
|
47
|
-
record: {
|
|
48
|
-
type: Object
|
|
49
|
-
},
|
|
50
|
-
dataSource: {
|
|
51
|
-
type: Array,
|
|
52
|
-
default: () => []
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
inject: {
|
|
56
|
-
requestTreeData: {
|
|
57
|
-
default: void 0
|
|
58
|
-
},
|
|
59
|
-
requestTableData: {
|
|
60
|
-
default: void 0
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="g-table__action">
|
|
3
|
+
<div class="table-action__item" v-for="(item, idx) in execOperationExpression(dataSource)" :key="idx">
|
|
4
|
+
<template v-if="item.type == 'text'">
|
|
5
|
+
<span @click="handleClickText(item)">{{ item.label }}</span>
|
|
6
|
+
</template>
|
|
7
|
+
<template v-else-if="item.type == 'confirm'">
|
|
8
|
+
<div>
|
|
9
|
+
<a-popconfirm :title="item.message" @confirm="handleClickConfirm(item)">
|
|
10
|
+
{{ item.label }}
|
|
11
|
+
</a-popconfirm>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<template v-else-if="item.type == 'dropdown'">
|
|
15
|
+
<a-dropdown>
|
|
16
|
+
<a-menu slot="overlay" @click="handleDropdownClick">
|
|
17
|
+
<a-menu-item :key="`${item.key || ''}${menuKeyDelimiter}${opt.value || ''}`" v-for="opt in execOperationExpression(item.optionList)">
|
|
18
|
+
<template v-if="opt.type == 'confirm'">
|
|
19
|
+
<a-popconfirm :title="opt.message" @confirm="handleClickConfirm(opt)">
|
|
20
|
+
{{ opt.label }}
|
|
21
|
+
</a-popconfirm>
|
|
22
|
+
</template>
|
|
23
|
+
<template v-else-if="opt.type == 'modal-confirm'">
|
|
24
|
+
<div style="width: 100%" @click="handleClickModalConfirm(opt)">{{ opt.label }}</div>
|
|
25
|
+
<ele-modal-confirm v-bind="opt.modalConfirm" v-on="$listeners" v-model="showModalConfirm"></ele-modal-confirm>
|
|
26
|
+
</template>
|
|
27
|
+
<template v-else>
|
|
28
|
+
{{ opt.label }}
|
|
29
|
+
</template>
|
|
30
|
+
</a-menu-item>
|
|
31
|
+
</a-menu>
|
|
32
|
+
<span>{{ item.label }}</span>
|
|
33
|
+
</a-dropdown>
|
|
34
|
+
</template>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import { v5 as uuidv5 } from 'uuid'
|
|
41
|
+
import { type, route } from '@idooel/shared'
|
|
42
|
+
import { parse } from '@idooel/expression'
|
|
43
|
+
import { CONTEXT } from '../../utils'
|
|
44
|
+
const MENU_KEY_NAMESPACE = 'f7b3b8b0-1b7b-11ec-9621-0242ac130002'
|
|
45
|
+
export default {
|
|
46
|
+
props: {
|
|
47
|
+
record: {
|
|
48
|
+
type: Object
|
|
49
|
+
},
|
|
50
|
+
dataSource: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => []
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
inject: {
|
|
56
|
+
requestTreeData: {
|
|
57
|
+
default: void 0
|
|
58
|
+
},
|
|
59
|
+
requestTableData: {
|
|
60
|
+
default: void 0
|
|
61
|
+
},
|
|
62
|
+
keepAliveRefresh: {
|
|
63
|
+
default: void 0
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
data() {
|
|
67
|
+
return {
|
|
68
|
+
showModalConfirm: false
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
provide () {
|
|
72
|
+
return {
|
|
73
|
+
[CONTEXT]: () => {
|
|
74
|
+
return {
|
|
75
|
+
_route: this.$route.query,
|
|
76
|
+
_routeMeta: this.$route.meta,
|
|
77
|
+
exposed: this.builtInMethods,
|
|
78
|
+
...this.record
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
menuKeyDelimiter () {
|
|
85
|
+
return uuidv5('_', MENU_KEY_NAMESPACE)
|
|
86
|
+
},
|
|
87
|
+
builtInMethods () {
|
|
88
|
+
return {
|
|
89
|
+
requestTreeData: this.requestTreeData,
|
|
90
|
+
requestTableData: this.requestTableData,
|
|
91
|
+
keepAliveRefresh: this.keepAliveRefresh,
|
|
92
|
+
closeModalConfirm: this.closeModalConfirm,
|
|
93
|
+
showModalConfirm: this.handleClickModalConfirm,
|
|
94
|
+
currentRowData: this.record
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
closeModalConfirm () {
|
|
100
|
+
this.showModalConfirm = false
|
|
101
|
+
},
|
|
102
|
+
handleClickModalConfirm () {
|
|
103
|
+
this.showModalConfirm = true
|
|
104
|
+
},
|
|
105
|
+
execOperationExpression (dataSource = []) {
|
|
106
|
+
const ret = dataSource.map(item => {
|
|
107
|
+
const { show } = item
|
|
108
|
+
if (type.isUndefined(show)) {
|
|
109
|
+
return item
|
|
110
|
+
} else if (type.isBool(show)) {
|
|
111
|
+
if (show) return item
|
|
112
|
+
} else if (type.isStr(show)) {
|
|
113
|
+
const parseRet = parse(show, {
|
|
114
|
+
...this.record,
|
|
115
|
+
_route: route.searchToQueryParams(window.location.search)
|
|
116
|
+
})
|
|
117
|
+
if (parseRet) return item
|
|
118
|
+
}
|
|
119
|
+
}).filter(item => item)
|
|
120
|
+
return ret
|
|
121
|
+
},
|
|
122
|
+
handleClickConfirm (props) {
|
|
123
|
+
//TODO generate event by special rule
|
|
124
|
+
const { eventName, value, key } = props
|
|
125
|
+
this.$emit(eventName || key, {
|
|
126
|
+
key: value || key,
|
|
127
|
+
record: this.record,
|
|
128
|
+
builtInMethods: this.builtInMethods,
|
|
129
|
+
exposed: this.builtInMethods
|
|
130
|
+
})
|
|
131
|
+
},
|
|
132
|
+
handleDropdownClick (props) {
|
|
133
|
+
const { key } = props
|
|
134
|
+
const [parent, child] = key.split(this.menuKeyDelimiter)
|
|
135
|
+
if (!parent || !child) {
|
|
136
|
+
throw new Error('key is required')
|
|
137
|
+
}
|
|
138
|
+
const currentDropdown = this.dataSource.find(item => item.key === parent)
|
|
139
|
+
const currentClickTarget = currentDropdown.optionList.find(item => item.value === child)
|
|
140
|
+
const { eventName, type, key: currentKey } = currentClickTarget
|
|
141
|
+
//TODO generate event by special rule
|
|
142
|
+
if (type === 'confirm' || type === 'modal-confirm') return
|
|
143
|
+
this.$emit(eventName || currentKey, {
|
|
144
|
+
key: child,
|
|
145
|
+
record: this.record,
|
|
146
|
+
builtInMethods: this.builtInMethods,
|
|
147
|
+
exposed: this.builtInMethods
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
handleClickText (props) {
|
|
151
|
+
const { eventName, key } = props
|
|
152
|
+
this.$emit(eventName || key, {
|
|
153
|
+
key,
|
|
154
|
+
record: this.record,
|
|
155
|
+
builtInMethods: this.builtInMethods,
|
|
156
|
+
exposed: this.builtInMethods
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<style lang="scss" scoped>
|
|
164
|
+
.g-table__action {
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: row;
|
|
167
|
+
.table-action__item {
|
|
168
|
+
font-size: 14px;
|
|
169
|
+
color: #409EFF;
|
|
170
|
+
margin-left: 16px;
|
|
171
|
+
cursor: pointer;
|
|
172
|
+
&:first-child {
|
|
173
|
+
margin-left: 0;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
173
177
|
</style>
|