gi-component 0.0.1
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/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/dist/index.es.js +2241 -0
- package/dist/dist/index.es.js.map +1 -0
- package/dist/dist/index.umd.js +2 -0
- package/dist/dist/index.umd.js.map +1 -0
- package/dist/gi.css +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +56 -0
- package/packages/components/button/index.ts +5 -0
- package/packages/components/button/src/button.vue +59 -0
- package/packages/components/button/src/type.ts +15 -0
- package/packages/components/card/index.ts +5 -0
- package/packages/components/card/src/card.vue +166 -0
- package/packages/components/card/src/type.ts +12 -0
- package/packages/components/dialog/index.ts +6 -0
- package/packages/components/dialog/src/dialog.ts +87 -0
- package/packages/components/dialog/src/dialog.vue +122 -0
- package/packages/components/dialog/src/type.ts +16 -0
- package/packages/components/edit-table/index.ts +5 -0
- package/packages/components/edit-table/src/edit-table.vue +207 -0
- package/packages/components/edit-table/src/type.ts +69 -0
- package/packages/components/form/index.ts +5 -0
- package/packages/components/form/src/form.vue +465 -0
- package/packages/components/form/src/type.ts +98 -0
- package/packages/components/grid/index.ts +8 -0
- package/packages/components/grid/src/context.ts +30 -0
- package/packages/components/grid/src/grid-item.vue +143 -0
- package/packages/components/grid/src/grid.vue +151 -0
- package/packages/components/grid/src/hook/use-index.ts +63 -0
- package/packages/components/grid/src/hook/use-responsive-state.ts +66 -0
- package/packages/components/grid/src/hook/use-responsive-value.ts +36 -0
- package/packages/components/grid/src/interface.ts +74 -0
- package/packages/components/grid/src/type.ts +0 -0
- package/packages/components/grid/src/utils/global-config.ts +6 -0
- package/packages/components/grid/src/utils/index.ts +73 -0
- package/packages/components/grid/src/utils/is.ts +9 -0
- package/packages/components/grid/src/utils/responsive-observe.ts +135 -0
- package/packages/components/input-group/index.ts +5 -0
- package/packages/components/input-group/src/input-group.vue +92 -0
- package/packages/components/input-group/src/type.ts +1 -0
- package/packages/components/input-search/index.ts +5 -0
- package/packages/components/input-search/src/input-search.vue +62 -0
- package/packages/components/input-search/src/type.ts +6 -0
- package/packages/components/page-layout/index.ts +5 -0
- package/packages/components/page-layout/src/page-layout.vue +180 -0
- package/packages/components/page-layout/src/split-button.vue +106 -0
- package/packages/components/page-layout/src/type.ts +12 -0
- package/packages/components/table/index.ts +5 -0
- package/packages/components/table/src/TableColumn.vue +49 -0
- package/packages/components/table/src/table.vue +85 -0
- package/packages/components/table/src/type.ts +22 -0
- package/packages/components/tabs/index.ts +5 -0
- package/packages/components/tabs/src/tabs.vue +148 -0
- package/packages/components/tabs/src/type.ts +15 -0
- package/packages/components.d.ts +26 -0
- package/packages/hooks/index.ts +1 -0
- package/packages/hooks/useBemClass.ts +11 -0
- package/packages/index.ts +78 -0
- package/packages/styles/index.scss +176 -0
- package/packages/styles/var.scss +1 -0
- package/packages/utils/createSelectDialog.ts +67 -0
- package/packages/utils/index.ts +1 -0
|
@@ -0,0 +1,2241 @@
|
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createElementVNode, getCurrentInstance, useAttrs, computed, resolveComponent, createBlock, mergeProps, unref, withCtx, renderSlot, createTextVNode, toDisplayString, useSlots, normalizeClass, createCommentVNode, normalizeStyle, mergeModels, useModel, ref, createSlots, resolveDynamicComponent, createVNode, createApp, h, Fragment, renderList, watch, onMounted, onUpdated, onUnmounted, inject, toRefs, watchEffect, reactive, provide, toRaw, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import * as El from "element-plus";
|
|
3
|
+
import El__default, { ElMessage } from "element-plus";
|
|
4
|
+
/*! Element Plus Icons Vue v2.3.2 */
|
|
5
|
+
var _sfc_main6 = /* @__PURE__ */ defineComponent({
|
|
6
|
+
name: "ArrowDown",
|
|
7
|
+
__name: "arrow-down",
|
|
8
|
+
setup(__props) {
|
|
9
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
viewBox: "0 0 1024 1024"
|
|
12
|
+
}, [
|
|
13
|
+
createElementVNode("path", {
|
|
14
|
+
fill: "currentColor",
|
|
15
|
+
d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"
|
|
16
|
+
})
|
|
17
|
+
]));
|
|
18
|
+
}
|
|
19
|
+
}), arrow_down_default = _sfc_main6;
|
|
20
|
+
var _sfc_main7 = /* @__PURE__ */ defineComponent({
|
|
21
|
+
name: "ArrowLeftBold",
|
|
22
|
+
__name: "arrow-left-bold",
|
|
23
|
+
setup(__props) {
|
|
24
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
viewBox: "0 0 1024 1024"
|
|
27
|
+
}, [
|
|
28
|
+
createElementVNode("path", {
|
|
29
|
+
fill: "currentColor",
|
|
30
|
+
d: "M685.248 104.704a64 64 0 0 1 0 90.496L368.448 512l316.8 316.8a64 64 0 0 1-90.496 90.496L232.704 557.248a64 64 0 0 1 0-90.496l362.048-362.048a64 64 0 0 1 90.496 0"
|
|
31
|
+
})
|
|
32
|
+
]));
|
|
33
|
+
}
|
|
34
|
+
}), arrow_left_bold_default = _sfc_main7;
|
|
35
|
+
var _sfc_main9 = /* @__PURE__ */ defineComponent({
|
|
36
|
+
name: "ArrowRightBold",
|
|
37
|
+
__name: "arrow-right-bold",
|
|
38
|
+
setup(__props) {
|
|
39
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
viewBox: "0 0 1024 1024"
|
|
42
|
+
}, [
|
|
43
|
+
createElementVNode("path", {
|
|
44
|
+
fill: "currentColor",
|
|
45
|
+
d: "M338.752 104.704a64 64 0 0 0 0 90.496l316.8 316.8-316.8 316.8a64 64 0 0 0 90.496 90.496l362.048-362.048a64 64 0 0 0 0-90.496L429.248 104.704a64 64 0 0 0-90.496 0"
|
|
46
|
+
})
|
|
47
|
+
]));
|
|
48
|
+
}
|
|
49
|
+
}), arrow_right_bold_default = _sfc_main9;
|
|
50
|
+
var _sfc_main12 = /* @__PURE__ */ defineComponent({
|
|
51
|
+
name: "ArrowUp",
|
|
52
|
+
__name: "arrow-up",
|
|
53
|
+
setup(__props) {
|
|
54
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
55
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
56
|
+
viewBox: "0 0 1024 1024"
|
|
57
|
+
}, [
|
|
58
|
+
createElementVNode("path", {
|
|
59
|
+
fill: "currentColor",
|
|
60
|
+
d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
|
|
61
|
+
})
|
|
62
|
+
]));
|
|
63
|
+
}
|
|
64
|
+
}), arrow_up_default = _sfc_main12;
|
|
65
|
+
var _sfc_main56 = /* @__PURE__ */ defineComponent({
|
|
66
|
+
name: "Close",
|
|
67
|
+
__name: "close",
|
|
68
|
+
setup(__props) {
|
|
69
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
70
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
71
|
+
viewBox: "0 0 1024 1024"
|
|
72
|
+
}, [
|
|
73
|
+
createElementVNode("path", {
|
|
74
|
+
fill: "currentColor",
|
|
75
|
+
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
76
|
+
})
|
|
77
|
+
]));
|
|
78
|
+
}
|
|
79
|
+
}), close_default = _sfc_main56;
|
|
80
|
+
var _sfc_main80 = /* @__PURE__ */ defineComponent({
|
|
81
|
+
name: "Delete",
|
|
82
|
+
__name: "delete",
|
|
83
|
+
setup(__props) {
|
|
84
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
85
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
86
|
+
viewBox: "0 0 1024 1024"
|
|
87
|
+
}, [
|
|
88
|
+
createElementVNode("path", {
|
|
89
|
+
fill: "currentColor",
|
|
90
|
+
d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
|
|
91
|
+
})
|
|
92
|
+
]));
|
|
93
|
+
}
|
|
94
|
+
}), delete_default = _sfc_main80;
|
|
95
|
+
var _sfc_main91 = /* @__PURE__ */ defineComponent({
|
|
96
|
+
name: "Download",
|
|
97
|
+
__name: "download",
|
|
98
|
+
setup(__props) {
|
|
99
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
100
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101
|
+
viewBox: "0 0 1024 1024"
|
|
102
|
+
}, [
|
|
103
|
+
createElementVNode("path", {
|
|
104
|
+
fill: "currentColor",
|
|
105
|
+
d: "M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"
|
|
106
|
+
})
|
|
107
|
+
]));
|
|
108
|
+
}
|
|
109
|
+
}), download_default = _sfc_main91;
|
|
110
|
+
var _sfc_main94 = /* @__PURE__ */ defineComponent({
|
|
111
|
+
name: "Edit",
|
|
112
|
+
__name: "edit",
|
|
113
|
+
setup(__props) {
|
|
114
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
115
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
116
|
+
viewBox: "0 0 1024 1024"
|
|
117
|
+
}, [
|
|
118
|
+
createElementVNode("path", {
|
|
119
|
+
fill: "currentColor",
|
|
120
|
+
d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"
|
|
121
|
+
}),
|
|
122
|
+
createElementVNode("path", {
|
|
123
|
+
fill: "currentColor",
|
|
124
|
+
d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
|
|
125
|
+
})
|
|
126
|
+
]));
|
|
127
|
+
}
|
|
128
|
+
}), edit_default = _sfc_main94;
|
|
129
|
+
var _sfc_main201 = /* @__PURE__ */ defineComponent({
|
|
130
|
+
name: "Plus",
|
|
131
|
+
__name: "plus",
|
|
132
|
+
setup(__props) {
|
|
133
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
134
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
135
|
+
viewBox: "0 0 1024 1024"
|
|
136
|
+
}, [
|
|
137
|
+
createElementVNode("path", {
|
|
138
|
+
fill: "currentColor",
|
|
139
|
+
d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
|
|
140
|
+
})
|
|
141
|
+
]));
|
|
142
|
+
}
|
|
143
|
+
}), plus_default = _sfc_main201;
|
|
144
|
+
var _sfc_main208 = /* @__PURE__ */ defineComponent({
|
|
145
|
+
name: "Printer",
|
|
146
|
+
__name: "printer",
|
|
147
|
+
setup(__props) {
|
|
148
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
149
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
150
|
+
viewBox: "0 0 1024 1024"
|
|
151
|
+
}, [
|
|
152
|
+
createElementVNode("path", {
|
|
153
|
+
fill: "currentColor",
|
|
154
|
+
d: "M256 768H105.024c-14.272 0-19.456-1.472-24.64-4.288a29.06 29.06 0 0 1-12.16-12.096C65.536 746.432 64 741.248 64 727.04V379.072c0-42.816 4.48-58.304 12.8-73.984 8.384-15.616 20.672-27.904 36.288-36.288 15.68-8.32 31.168-12.8 73.984-12.8H256V64h512v192h68.928c42.816 0 58.304 4.48 73.984 12.8 15.616 8.384 27.904 20.672 36.288 36.288 8.32 15.68 12.8 31.168 12.8 73.984v347.904c0 14.272-1.472 19.456-4.288 24.64a29.06 29.06 0 0 1-12.096 12.16c-5.184 2.752-10.368 4.224-24.64 4.224H768v192H256zm64-192v320h384V576zm-64 128V512h512v192h128V379.072c0-29.376-1.408-36.48-5.248-43.776a23.3 23.3 0 0 0-10.048-10.048c-7.232-3.84-14.4-5.248-43.776-5.248H187.072c-29.376 0-36.48 1.408-43.776 5.248a23.3 23.3 0 0 0-10.048 10.048c-3.84 7.232-5.248 14.4-5.248 43.776V704zm64-448h384V128H320zm-64 128h64v64h-64zm128 0h64v64h-64z"
|
|
155
|
+
})
|
|
156
|
+
]));
|
|
157
|
+
}
|
|
158
|
+
}), printer_default = _sfc_main208;
|
|
159
|
+
var _sfc_main225 = /* @__PURE__ */ defineComponent({
|
|
160
|
+
name: "Search",
|
|
161
|
+
__name: "search",
|
|
162
|
+
setup(__props) {
|
|
163
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
164
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
165
|
+
viewBox: "0 0 1024 1024"
|
|
166
|
+
}, [
|
|
167
|
+
createElementVNode("path", {
|
|
168
|
+
fill: "currentColor",
|
|
169
|
+
d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
|
|
170
|
+
})
|
|
171
|
+
]));
|
|
172
|
+
}
|
|
173
|
+
}), search_default = _sfc_main225;
|
|
174
|
+
var _sfc_main275 = /* @__PURE__ */ defineComponent({
|
|
175
|
+
name: "Upload",
|
|
176
|
+
__name: "upload",
|
|
177
|
+
setup(__props) {
|
|
178
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
179
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
180
|
+
viewBox: "0 0 1024 1024"
|
|
181
|
+
}, [
|
|
182
|
+
createElementVNode("path", {
|
|
183
|
+
fill: "currentColor",
|
|
184
|
+
d: "M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z"
|
|
185
|
+
})
|
|
186
|
+
]));
|
|
187
|
+
}
|
|
188
|
+
}), upload_default = _sfc_main275;
|
|
189
|
+
function useBemClass() {
|
|
190
|
+
var _a;
|
|
191
|
+
const instance = getCurrentInstance();
|
|
192
|
+
const configPrefix = ((_a = instance == null ? void 0 : instance.appContext.config.globalProperties.$config) == null ? void 0 : _a.prefix) || "gi";
|
|
193
|
+
const prefix = configPrefix.toLowerCase();
|
|
194
|
+
const b = (name = "") => `${prefix}-${name ? `${name}` : ""}`;
|
|
195
|
+
return { b };
|
|
196
|
+
}
|
|
197
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
198
|
+
__name: "button",
|
|
199
|
+
props: {
|
|
200
|
+
type: { default: "" },
|
|
201
|
+
size: {},
|
|
202
|
+
disabled: { type: Boolean },
|
|
203
|
+
icon: {},
|
|
204
|
+
nativeType: {},
|
|
205
|
+
loading: { type: Boolean },
|
|
206
|
+
loadingIcon: {},
|
|
207
|
+
plain: { type: Boolean },
|
|
208
|
+
text: { type: Boolean },
|
|
209
|
+
link: { type: Boolean },
|
|
210
|
+
bg: { type: Boolean },
|
|
211
|
+
autofocus: { type: Boolean },
|
|
212
|
+
round: { type: Boolean },
|
|
213
|
+
circle: { type: Boolean },
|
|
214
|
+
color: {},
|
|
215
|
+
dark: { type: Boolean },
|
|
216
|
+
autoInsertSpace: { type: Boolean },
|
|
217
|
+
tag: {}
|
|
218
|
+
},
|
|
219
|
+
emits: ["click"],
|
|
220
|
+
setup(__props, { emit: __emit }) {
|
|
221
|
+
const props = __props;
|
|
222
|
+
const emit = __emit;
|
|
223
|
+
const attrs = useAttrs();
|
|
224
|
+
const { b } = useBemClass();
|
|
225
|
+
const obj = {
|
|
226
|
+
add: { btnProps: { icon: plus_default, type: "primary" }, btnText: "新增" },
|
|
227
|
+
edit: { btnProps: { icon: edit_default, type: "primary" }, btnText: "编辑" },
|
|
228
|
+
delete: { btnProps: { icon: delete_default, type: "danger" }, btnText: "删除" },
|
|
229
|
+
search: { btnProps: { icon: search_default, type: "primary" }, btnText: "搜索" },
|
|
230
|
+
reset: { btnProps: { type: void 0 }, btnText: "重置" },
|
|
231
|
+
upload: { btnProps: { icon: upload_default, type: "primary" }, btnText: "上传" },
|
|
232
|
+
download: {
|
|
233
|
+
btnProps: { icon: download_default, type: "primary" },
|
|
234
|
+
btnText: "下载"
|
|
235
|
+
},
|
|
236
|
+
print: { btnProps: { icon: printer_default, type: "primary" }, btnText: "打印" }
|
|
237
|
+
};
|
|
238
|
+
const bindProps = computed(() => {
|
|
239
|
+
var _a;
|
|
240
|
+
const btnProps = ((_a = obj == null ? void 0 : obj[props.type]) == null ? void 0 : _a.btnProps) || { type: props.type };
|
|
241
|
+
return { ...attrs, ...props, ...btnProps };
|
|
242
|
+
});
|
|
243
|
+
const btnText = computed(() => {
|
|
244
|
+
return obj[props.type].btnText;
|
|
245
|
+
});
|
|
246
|
+
return (_ctx, _cache) => {
|
|
247
|
+
const _component_el_button = resolveComponent("el-button");
|
|
248
|
+
return openBlock(), createBlock(_component_el_button, mergeProps({
|
|
249
|
+
class: unref(b)("button")
|
|
250
|
+
}, bindProps.value, {
|
|
251
|
+
onClick: _cache[0] || (_cache[0] = (e) => emit("click", e))
|
|
252
|
+
}), {
|
|
253
|
+
default: withCtx(() => [
|
|
254
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
255
|
+
createTextVNode(toDisplayString(btnText.value), 1)
|
|
256
|
+
])
|
|
257
|
+
]),
|
|
258
|
+
_: 3
|
|
259
|
+
}, 16, ["class"]);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
264
|
+
__name: "card",
|
|
265
|
+
props: {
|
|
266
|
+
title: { default: "" },
|
|
267
|
+
extra: { default: "" },
|
|
268
|
+
bordered: { type: Boolean, default: false },
|
|
269
|
+
size: { default: "middle" },
|
|
270
|
+
headerBordered: { type: Boolean, default: true },
|
|
271
|
+
headerStyle: { default: () => ({}) },
|
|
272
|
+
bodyStyle: { default: () => ({}) },
|
|
273
|
+
inner: { type: Boolean, default: false }
|
|
274
|
+
},
|
|
275
|
+
setup(__props) {
|
|
276
|
+
const props = __props;
|
|
277
|
+
const slot = useSlots();
|
|
278
|
+
const { b } = useBemClass();
|
|
279
|
+
const getCardClass = computed(() => {
|
|
280
|
+
const arr = [b("card")];
|
|
281
|
+
if (props.bordered) {
|
|
282
|
+
arr.push(b("card--bordered"));
|
|
283
|
+
}
|
|
284
|
+
if (props.inner) {
|
|
285
|
+
arr.push(b("card--inner"));
|
|
286
|
+
}
|
|
287
|
+
arr.push(b(`card--${props.size}`));
|
|
288
|
+
return arr.join(" ");
|
|
289
|
+
});
|
|
290
|
+
const getHeaderClass = computed(() => {
|
|
291
|
+
const arr = [b("card-header")];
|
|
292
|
+
if (props.headerBordered) {
|
|
293
|
+
arr.push(b("card-header--bordered"));
|
|
294
|
+
}
|
|
295
|
+
return arr.join(" ");
|
|
296
|
+
});
|
|
297
|
+
return (_ctx, _cache) => {
|
|
298
|
+
return openBlock(), createElementBlock("div", {
|
|
299
|
+
class: normalizeClass(getCardClass.value)
|
|
300
|
+
}, [
|
|
301
|
+
createElementVNode("section", {
|
|
302
|
+
class: normalizeClass(getHeaderClass.value),
|
|
303
|
+
style: normalizeStyle(props.headerStyle)
|
|
304
|
+
}, [
|
|
305
|
+
createElementVNode("div", {
|
|
306
|
+
class: normalizeClass(unref(b)("card-header__title"))
|
|
307
|
+
}, [
|
|
308
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
309
|
+
createTextVNode(toDisplayString(props.title), 1)
|
|
310
|
+
], true)
|
|
311
|
+
], 2),
|
|
312
|
+
createElementVNode("div", {
|
|
313
|
+
class: normalizeClass(unref(b)("card-header__extra"))
|
|
314
|
+
}, [
|
|
315
|
+
renderSlot(_ctx.$slots, "extra", {}, () => [
|
|
316
|
+
createTextVNode(toDisplayString(props.extra), 1)
|
|
317
|
+
], true)
|
|
318
|
+
], 2)
|
|
319
|
+
], 6),
|
|
320
|
+
createElementVNode("section", {
|
|
321
|
+
class: normalizeClass(unref(b)("card-body")),
|
|
322
|
+
style: normalizeStyle(props.bodyStyle)
|
|
323
|
+
}, [
|
|
324
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
325
|
+
], 6),
|
|
326
|
+
unref(slot).footer ? (openBlock(), createElementBlock("section", {
|
|
327
|
+
key: 0,
|
|
328
|
+
class: normalizeClass(unref(b)("card-footer"))
|
|
329
|
+
}, [
|
|
330
|
+
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
331
|
+
], 2)) : createCommentVNode("", true)
|
|
332
|
+
], 2);
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
const _export_sfc = (sfc, props) => {
|
|
337
|
+
const target = sfc.__vccOpts || sfc;
|
|
338
|
+
for (const [key, val] of props) {
|
|
339
|
+
target[key] = val;
|
|
340
|
+
}
|
|
341
|
+
return target;
|
|
342
|
+
};
|
|
343
|
+
const Card = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-c2f199fb"]]);
|
|
344
|
+
const _hoisted_1$1 = { key: 0 };
|
|
345
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
346
|
+
__name: "dialog",
|
|
347
|
+
props: /* @__PURE__ */ mergeModels({
|
|
348
|
+
content: {},
|
|
349
|
+
footer: { type: [Boolean, Function], default: true },
|
|
350
|
+
okText: { default: "确认" },
|
|
351
|
+
cancelText: { default: "取消" },
|
|
352
|
+
okButtonProps: {},
|
|
353
|
+
cancelButtonProps: {},
|
|
354
|
+
style: {},
|
|
355
|
+
simple: { type: Boolean },
|
|
356
|
+
onOk: {},
|
|
357
|
+
onBeforeOk: {},
|
|
358
|
+
onCancel: {},
|
|
359
|
+
appendToBody: { type: Boolean },
|
|
360
|
+
appendTo: {},
|
|
361
|
+
beforeClose: {},
|
|
362
|
+
destroyOnClose: { type: Boolean },
|
|
363
|
+
closeOnClickModal: { type: Boolean, default: true },
|
|
364
|
+
closeOnPressEscape: { type: Boolean },
|
|
365
|
+
lockScroll: { type: Boolean },
|
|
366
|
+
modal: { type: Boolean },
|
|
367
|
+
modalPenetrable: { type: Boolean },
|
|
368
|
+
openDelay: {},
|
|
369
|
+
closeDelay: {},
|
|
370
|
+
top: {},
|
|
371
|
+
modelValue: { type: Boolean },
|
|
372
|
+
modalClass: {},
|
|
373
|
+
headerClass: {},
|
|
374
|
+
bodyClass: {},
|
|
375
|
+
footerClass: {},
|
|
376
|
+
width: { default: "calc(100% - 20px)" },
|
|
377
|
+
zIndex: {},
|
|
378
|
+
trapFocus: { type: Boolean },
|
|
379
|
+
headerAriaLevel: {},
|
|
380
|
+
transition: {},
|
|
381
|
+
center: { type: Boolean },
|
|
382
|
+
alignCenter: { type: Boolean, default: true },
|
|
383
|
+
closeIcon: {},
|
|
384
|
+
draggable: { type: Boolean },
|
|
385
|
+
overflow: { type: Boolean },
|
|
386
|
+
fullscreen: { type: Boolean },
|
|
387
|
+
showClose: { type: Boolean, default: true },
|
|
388
|
+
title: {},
|
|
389
|
+
ariaLevel: {}
|
|
390
|
+
}, {
|
|
391
|
+
"modelValue": {
|
|
392
|
+
type: Boolean,
|
|
393
|
+
default: false
|
|
394
|
+
},
|
|
395
|
+
"modelModifiers": {}
|
|
396
|
+
}),
|
|
397
|
+
emits: ["update:modelValue"],
|
|
398
|
+
setup(__props) {
|
|
399
|
+
const visible = useModel(__props, "modelValue");
|
|
400
|
+
const props = __props;
|
|
401
|
+
const { b } = useBemClass();
|
|
402
|
+
const getClass = computed(() => {
|
|
403
|
+
const arr = [b("dialog")];
|
|
404
|
+
if (props.simple) {
|
|
405
|
+
arr.push(b("dialog--simple"));
|
|
406
|
+
}
|
|
407
|
+
return arr.join(" ");
|
|
408
|
+
});
|
|
409
|
+
const dialogProps = computed(() => {
|
|
410
|
+
return {
|
|
411
|
+
...props,
|
|
412
|
+
content: void 0,
|
|
413
|
+
footer: void 0,
|
|
414
|
+
okText: void 0,
|
|
415
|
+
cancelText: void 0,
|
|
416
|
+
okButtonProps: void 0,
|
|
417
|
+
cancelButtonProps: void 0,
|
|
418
|
+
onOk: void 0,
|
|
419
|
+
onBeforeOk: void 0,
|
|
420
|
+
onCancel: void 0,
|
|
421
|
+
simple: void 0
|
|
422
|
+
};
|
|
423
|
+
});
|
|
424
|
+
const okLoading = ref(false);
|
|
425
|
+
const handleCancel = () => {
|
|
426
|
+
var _a;
|
|
427
|
+
(_a = props.onCancel) == null ? void 0 : _a.call(props);
|
|
428
|
+
visible.value = false;
|
|
429
|
+
};
|
|
430
|
+
const handleOk = async () => {
|
|
431
|
+
var _a;
|
|
432
|
+
if (props.onBeforeOk) {
|
|
433
|
+
try {
|
|
434
|
+
okLoading.value = true;
|
|
435
|
+
const flag = await props.onBeforeOk();
|
|
436
|
+
okLoading.value = false;
|
|
437
|
+
if (flag) {
|
|
438
|
+
visible.value = false;
|
|
439
|
+
}
|
|
440
|
+
} catch (error) {
|
|
441
|
+
console.error("error", error);
|
|
442
|
+
okLoading.value = false;
|
|
443
|
+
}
|
|
444
|
+
} else {
|
|
445
|
+
(_a = props.onOk) == null ? void 0 : _a.call(props);
|
|
446
|
+
visible.value = false;
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
return (_ctx, _cache) => {
|
|
450
|
+
const _component_el_button = resolveComponent("el-button");
|
|
451
|
+
const _component_el_space = resolveComponent("el-space");
|
|
452
|
+
const _component_el_dialog = resolveComponent("el-dialog");
|
|
453
|
+
return openBlock(), createBlock(_component_el_dialog, mergeProps(dialogProps.value, {
|
|
454
|
+
modelValue: visible.value,
|
|
455
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
|
|
456
|
+
class: getClass.value,
|
|
457
|
+
title: props.title,
|
|
458
|
+
style: { maxWidth: !props.fullscreen ? "480px" : "100%", ...props.style }
|
|
459
|
+
}), createSlots({
|
|
460
|
+
default: withCtx(() => [
|
|
461
|
+
renderSlot(_ctx.$slots, "default", {}, () => {
|
|
462
|
+
var _a;
|
|
463
|
+
return [
|
|
464
|
+
typeof props.content === "string" ? (openBlock(), createElementBlock("p", _hoisted_1$1, toDisplayString(props.content), 1)) : createCommentVNode("", true),
|
|
465
|
+
typeof props.content === "function" ? (openBlock(), createBlock(resolveDynamicComponent((_a = props == null ? void 0 : props.content) == null ? void 0 : _a.call(props)), { key: 1 })) : createCommentVNode("", true)
|
|
466
|
+
];
|
|
467
|
+
})
|
|
468
|
+
]),
|
|
469
|
+
_: 2
|
|
470
|
+
}, [
|
|
471
|
+
props.footer ? {
|
|
472
|
+
name: "footer",
|
|
473
|
+
fn: withCtx(() => [
|
|
474
|
+
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
475
|
+
typeof props.footer === "boolean" ? (openBlock(), createBlock(_component_el_space, {
|
|
476
|
+
key: 0,
|
|
477
|
+
size: 10
|
|
478
|
+
}, {
|
|
479
|
+
default: withCtx(() => [
|
|
480
|
+
createVNode(_component_el_button, mergeProps(props.cancelButtonProps, { onClick: handleCancel }), {
|
|
481
|
+
default: withCtx(() => [
|
|
482
|
+
createTextVNode(toDisplayString(props.cancelText), 1)
|
|
483
|
+
]),
|
|
484
|
+
_: 1
|
|
485
|
+
}, 16),
|
|
486
|
+
createVNode(_component_el_button, mergeProps({ type: "primary" }, props.okButtonProps, {
|
|
487
|
+
loading: okLoading.value,
|
|
488
|
+
onClick: handleOk
|
|
489
|
+
}), {
|
|
490
|
+
default: withCtx(() => [
|
|
491
|
+
createTextVNode(toDisplayString(props.okText), 1)
|
|
492
|
+
]),
|
|
493
|
+
_: 1
|
|
494
|
+
}, 16, ["loading"])
|
|
495
|
+
]),
|
|
496
|
+
_: 1
|
|
497
|
+
})) : (openBlock(), createBlock(resolveDynamicComponent(props.footer()), { key: 1 }))
|
|
498
|
+
])
|
|
499
|
+
]),
|
|
500
|
+
key: "0"
|
|
501
|
+
} : void 0
|
|
502
|
+
]), 1040, ["modelValue", "class", "title", "style"]);
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
const DEF_OPTIONS = {
|
|
507
|
+
// width: '600px',
|
|
508
|
+
// center: false,
|
|
509
|
+
// footer: true,
|
|
510
|
+
// closeOnClickModal: true
|
|
511
|
+
};
|
|
512
|
+
function createDialog() {
|
|
513
|
+
const Dialog2 = {
|
|
514
|
+
_context: {},
|
|
515
|
+
// 核心创建方法
|
|
516
|
+
create(options) {
|
|
517
|
+
const mergedOptions = { ...DEF_OPTIONS, ...options };
|
|
518
|
+
const container = document.createElement("div");
|
|
519
|
+
document.body.appendChild(container);
|
|
520
|
+
const visible = ref(true);
|
|
521
|
+
const dialogOptions = ref(mergedOptions || {});
|
|
522
|
+
const dialogApp = createApp({
|
|
523
|
+
setup() {
|
|
524
|
+
const closed = () => {
|
|
525
|
+
dialogApp.unmount();
|
|
526
|
+
container.remove();
|
|
527
|
+
};
|
|
528
|
+
return () => h(_sfc_main$b, {
|
|
529
|
+
...dialogOptions.value,
|
|
530
|
+
modelValue: visible.value,
|
|
531
|
+
"onUpdate:modelValue": (val) => visible.value = val,
|
|
532
|
+
onClosed: () => closed()
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
dialogApp.use(El__default);
|
|
537
|
+
Object.assign(dialogApp._context, Dialog2._context);
|
|
538
|
+
dialogApp.mount(container);
|
|
539
|
+
return {
|
|
540
|
+
/** 关闭对话框 */
|
|
541
|
+
close: () => {
|
|
542
|
+
visible.value = false;
|
|
543
|
+
setTimeout(() => {
|
|
544
|
+
dialogApp.unmount();
|
|
545
|
+
container.remove();
|
|
546
|
+
}, 300);
|
|
547
|
+
},
|
|
548
|
+
/** 更新对话框 */
|
|
549
|
+
update: (newProps) => {
|
|
550
|
+
dialogOptions.value = { ...dialogOptions.value, ...newProps };
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
},
|
|
554
|
+
/** 对话框-打开 */
|
|
555
|
+
open(options) {
|
|
556
|
+
return this.create(options);
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
return Dialog2;
|
|
560
|
+
}
|
|
561
|
+
const Dialog = createDialog();
|
|
562
|
+
const clearable = false;
|
|
563
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
564
|
+
__name: "edit-table",
|
|
565
|
+
props: {
|
|
566
|
+
rowKey: { default: "id" },
|
|
567
|
+
data: { default: () => [] },
|
|
568
|
+
columns: { default: () => [] },
|
|
569
|
+
cellDisabled: {}
|
|
570
|
+
},
|
|
571
|
+
setup(__props, { expose: __expose }) {
|
|
572
|
+
const props = __props;
|
|
573
|
+
const attrs = useAttrs();
|
|
574
|
+
const { b } = useBemClass();
|
|
575
|
+
const COMP_MAP = {
|
|
576
|
+
input: El.ElInput,
|
|
577
|
+
textarea: El.ElInput,
|
|
578
|
+
"input-number": El.ElInputNumber,
|
|
579
|
+
"input-tag": El.ElInputTag,
|
|
580
|
+
select: El.ElSelect,
|
|
581
|
+
"select-v2": El.ElSelectV2,
|
|
582
|
+
"tree-select": El.ElTreeSelect,
|
|
583
|
+
cascader: El.ElCascader,
|
|
584
|
+
slider: El.ElSlider,
|
|
585
|
+
switch: El.ElSwitch,
|
|
586
|
+
rate: El.ElRate,
|
|
587
|
+
"checkbox-group": El.ElCheckboxGroup,
|
|
588
|
+
checkbox: El.ElCheckbox,
|
|
589
|
+
"radio-group": El.ElRadioGroup,
|
|
590
|
+
radio: El.ElRadio,
|
|
591
|
+
"date-picker": El.ElDatePicker,
|
|
592
|
+
"time-picker": El.ElTimePicker,
|
|
593
|
+
"time-select": El.ElTimeSelect,
|
|
594
|
+
"color-picker": El.ElColorPicker,
|
|
595
|
+
transfer: El.ElTransfer,
|
|
596
|
+
autocomplete: El.ElAutocomplete,
|
|
597
|
+
upload: El.ElUpload
|
|
598
|
+
};
|
|
599
|
+
const formRef = ref();
|
|
600
|
+
const form = computed(() => ({ tableData: props.data }));
|
|
601
|
+
const STATIC_PROPS = /* @__PURE__ */ new Map([
|
|
602
|
+
["input", { clearable, maxlength: 20 }],
|
|
603
|
+
[
|
|
604
|
+
"textarea",
|
|
605
|
+
{
|
|
606
|
+
clearable,
|
|
607
|
+
type: "textarea",
|
|
608
|
+
rows: 1,
|
|
609
|
+
maxlength: 200,
|
|
610
|
+
showWordLimit: true
|
|
611
|
+
}
|
|
612
|
+
],
|
|
613
|
+
["input-number", {}],
|
|
614
|
+
["input-tag", { clearable }],
|
|
615
|
+
["select", { clearable }],
|
|
616
|
+
["select-v2", { clearable }],
|
|
617
|
+
["tree-select", { clearable }],
|
|
618
|
+
["cascader", { clearable }],
|
|
619
|
+
["slider", {}],
|
|
620
|
+
["switch", {}],
|
|
621
|
+
["rate", {}],
|
|
622
|
+
["checkbox-group", {}],
|
|
623
|
+
["checkbox", {}],
|
|
624
|
+
["radio-group", {}],
|
|
625
|
+
["radio", {}],
|
|
626
|
+
["date-picker", { clearable }],
|
|
627
|
+
["time-picker", { clearable }],
|
|
628
|
+
["time-select", { clearable }],
|
|
629
|
+
["color-picker", {}],
|
|
630
|
+
["transfer", {}],
|
|
631
|
+
["autocomplete", {}],
|
|
632
|
+
["upload", {}],
|
|
633
|
+
["title", {}]
|
|
634
|
+
]);
|
|
635
|
+
const getPlaceholder = (item) => {
|
|
636
|
+
if (!item.type) return void 0;
|
|
637
|
+
if (["input", "input-number", "input-tag"].includes(item.type)) {
|
|
638
|
+
return `请输入${item.title}`;
|
|
639
|
+
}
|
|
640
|
+
if (["textarea"].includes(item.type)) {
|
|
641
|
+
return `请填写${item.title}`;
|
|
642
|
+
}
|
|
643
|
+
if (["select", "select-v2", "tree-select", "cascader", "time-select"].includes(
|
|
644
|
+
item.type
|
|
645
|
+
)) {
|
|
646
|
+
return `请选择${item.title}`;
|
|
647
|
+
}
|
|
648
|
+
if (["date-picker"].includes(item.type)) {
|
|
649
|
+
return `请选择日期`;
|
|
650
|
+
}
|
|
651
|
+
if (["time-picker"].includes(item.type)) {
|
|
652
|
+
return `请选择时间`;
|
|
653
|
+
}
|
|
654
|
+
return void 0;
|
|
655
|
+
};
|
|
656
|
+
function getComponentBindProps(item) {
|
|
657
|
+
var _a;
|
|
658
|
+
const defaultProps = STATIC_PROPS.get(item.type || "") || {};
|
|
659
|
+
defaultProps.placeholder = getPlaceholder(item);
|
|
660
|
+
if (item.type === "date-picker") {
|
|
661
|
+
defaultProps.valueFormat = ((_a = item == null ? void 0 : item.props) == null ? void 0 : _a.type) === "datetime" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
662
|
+
}
|
|
663
|
+
return { ...defaultProps, ...item.props };
|
|
664
|
+
}
|
|
665
|
+
function getFormItemRules(item) {
|
|
666
|
+
if (item.required) {
|
|
667
|
+
return [
|
|
668
|
+
{ required: true, message: `${item.title}为必填项` },
|
|
669
|
+
...Array.isArray(item.rules) ? item.rules : []
|
|
670
|
+
];
|
|
671
|
+
}
|
|
672
|
+
return item.rules;
|
|
673
|
+
}
|
|
674
|
+
function getLabelClassName(item) {
|
|
675
|
+
if (item.required) return "column-required";
|
|
676
|
+
return "";
|
|
677
|
+
}
|
|
678
|
+
const isDisabled = (p) => {
|
|
679
|
+
if (typeof (props == null ? void 0 : props.cellDisabled) === "function") return props.cellDisabled(p);
|
|
680
|
+
return false;
|
|
681
|
+
};
|
|
682
|
+
__expose({ formRef });
|
|
683
|
+
return (_ctx, _cache) => {
|
|
684
|
+
const _component_el_form_item = resolveComponent("el-form-item");
|
|
685
|
+
const _component_el_table_column = resolveComponent("el-table-column");
|
|
686
|
+
const _component_el_table = resolveComponent("el-table");
|
|
687
|
+
const _component_el_form = resolveComponent("el-form");
|
|
688
|
+
return openBlock(), createBlock(_component_el_form, {
|
|
689
|
+
ref_key: "formRef",
|
|
690
|
+
ref: formRef,
|
|
691
|
+
model: form.value,
|
|
692
|
+
class: normalizeClass(unref(b)("edit-table"))
|
|
693
|
+
}, {
|
|
694
|
+
default: withCtx(() => [
|
|
695
|
+
createVNode(_component_el_table, mergeProps({
|
|
696
|
+
data: form.value.tableData,
|
|
697
|
+
border: ""
|
|
698
|
+
}, unref(attrs)), {
|
|
699
|
+
default: withCtx(() => [
|
|
700
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(props.columns, (column, index2) => {
|
|
701
|
+
return openBlock(), createBlock(_component_el_table_column, mergeProps({
|
|
702
|
+
key: column.dataIndex + index2,
|
|
703
|
+
width: column.width
|
|
704
|
+
}, { ref_for: true }, column.columnProps, {
|
|
705
|
+
prop: column.dataIndex,
|
|
706
|
+
label: column.title,
|
|
707
|
+
"label-class-name": getLabelClassName(column)
|
|
708
|
+
}), {
|
|
709
|
+
default: withCtx((scope) => [
|
|
710
|
+
createVNode(_component_el_form_item, mergeProps({ ref_for: true }, column.formItemProps, {
|
|
711
|
+
label: column.title,
|
|
712
|
+
prop: `tableData[${scope.$index}].${column.dataIndex}`,
|
|
713
|
+
rules: getFormItemRules(column)
|
|
714
|
+
}), {
|
|
715
|
+
default: withCtx(() => [
|
|
716
|
+
column.slotName ? renderSlot(_ctx.$slots, column.slotName, mergeProps({
|
|
717
|
+
key: 0,
|
|
718
|
+
ref_for: true
|
|
719
|
+
}, scope), void 0, true) : (openBlock(), createBlock(resolveDynamicComponent(COMP_MAP[column.type] || column.type), mergeProps({
|
|
720
|
+
key: 1,
|
|
721
|
+
ref_for: true
|
|
722
|
+
}, getComponentBindProps(column), {
|
|
723
|
+
modelValue: scope.row[column.dataIndex],
|
|
724
|
+
"onUpdate:modelValue": ($event) => scope.row[column.dataIndex] = $event,
|
|
725
|
+
class: "w-full",
|
|
726
|
+
disabled: isDisabled(scope)
|
|
727
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
|
|
728
|
+
]),
|
|
729
|
+
_: 2
|
|
730
|
+
}, 1040, ["label", "prop", "rules"])
|
|
731
|
+
]),
|
|
732
|
+
_: 2
|
|
733
|
+
}, 1040, ["width", "prop", "label", "label-class-name"]);
|
|
734
|
+
}), 128))
|
|
735
|
+
]),
|
|
736
|
+
_: 3
|
|
737
|
+
}, 16, ["data"])
|
|
738
|
+
]),
|
|
739
|
+
_: 3
|
|
740
|
+
}, 8, ["model", "class"]);
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
const EditTable = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-079a9f8e"]]);
|
|
745
|
+
const GridContextInjectionKey = Symbol(
|
|
746
|
+
"GridContextInjectionKey"
|
|
747
|
+
);
|
|
748
|
+
const GridDataCollectorInjectionKey = Symbol("GridDataCollectorInjectionKey");
|
|
749
|
+
function isUndefined(obj) {
|
|
750
|
+
return obj === void 0;
|
|
751
|
+
}
|
|
752
|
+
function useIndex({
|
|
753
|
+
itemRef,
|
|
754
|
+
selector,
|
|
755
|
+
index: index2,
|
|
756
|
+
parentClassName
|
|
757
|
+
}) {
|
|
758
|
+
const _index = ref(-1);
|
|
759
|
+
const computedIndex = computed(() => (index2 == null ? void 0 : index2.value) ?? _index.value);
|
|
760
|
+
const parent = ref();
|
|
761
|
+
const getParent = () => {
|
|
762
|
+
var _a;
|
|
763
|
+
let parent2 = ((_a = itemRef.value) == null ? void 0 : _a.parentElement) ?? void 0;
|
|
764
|
+
if (parentClassName) {
|
|
765
|
+
while (parent2 && !parent2.className.includes(parentClassName)) {
|
|
766
|
+
parent2 = parent2.parentElement ?? void 0;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return parent2;
|
|
770
|
+
};
|
|
771
|
+
const getIndex = () => {
|
|
772
|
+
if (isUndefined(index2 == null ? void 0 : index2.value) && parent.value && itemRef.value) {
|
|
773
|
+
const index22 = Array.from(parent.value.querySelectorAll(selector)).indexOf(
|
|
774
|
+
itemRef.value
|
|
775
|
+
);
|
|
776
|
+
if (index22 !== _index.value) {
|
|
777
|
+
_index.value = index22;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
watch(itemRef, () => {
|
|
782
|
+
if (itemRef.value && !parent.value) {
|
|
783
|
+
parent.value = getParent();
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
onMounted(() => {
|
|
787
|
+
if (itemRef.value) {
|
|
788
|
+
parent.value = getParent();
|
|
789
|
+
}
|
|
790
|
+
getIndex();
|
|
791
|
+
});
|
|
792
|
+
onUpdated(() => getIndex());
|
|
793
|
+
return {
|
|
794
|
+
computedIndex
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
const opt = Object.prototype.toString;
|
|
798
|
+
function isObject(obj) {
|
|
799
|
+
return opt.call(obj) === "[object Object]";
|
|
800
|
+
}
|
|
801
|
+
const responsiveArray = [
|
|
802
|
+
"xxl",
|
|
803
|
+
"xl",
|
|
804
|
+
"lg",
|
|
805
|
+
"md",
|
|
806
|
+
"sm",
|
|
807
|
+
"xs"
|
|
808
|
+
];
|
|
809
|
+
const responsiveMap = {
|
|
810
|
+
xs: "(max-width: 575px)",
|
|
811
|
+
sm: "(min-width: 576px)",
|
|
812
|
+
md: "(min-width: 768px)",
|
|
813
|
+
lg: "(min-width: 992px)",
|
|
814
|
+
xl: "(min-width: 1200px)",
|
|
815
|
+
xxl: "(min-width: 1600px)"
|
|
816
|
+
};
|
|
817
|
+
let subscribers = [];
|
|
818
|
+
let subUid = -1;
|
|
819
|
+
let screens = {};
|
|
820
|
+
const responsiveObserve = {
|
|
821
|
+
matchHandlers: {},
|
|
822
|
+
dispatch(pointMap, breakpointChecked) {
|
|
823
|
+
screens = pointMap;
|
|
824
|
+
if (subscribers.length < 1) {
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
subscribers.forEach((item) => {
|
|
828
|
+
item.func(screens, breakpointChecked);
|
|
829
|
+
});
|
|
830
|
+
return true;
|
|
831
|
+
},
|
|
832
|
+
subscribe(func) {
|
|
833
|
+
if (subscribers.length === 0) {
|
|
834
|
+
this.register();
|
|
835
|
+
}
|
|
836
|
+
const token = (++subUid).toString();
|
|
837
|
+
subscribers.push({
|
|
838
|
+
token,
|
|
839
|
+
func
|
|
840
|
+
});
|
|
841
|
+
func(screens, null);
|
|
842
|
+
return token;
|
|
843
|
+
},
|
|
844
|
+
unsubscribe(token) {
|
|
845
|
+
subscribers = subscribers.filter((item) => item.token !== token);
|
|
846
|
+
if (subscribers.length === 0) {
|
|
847
|
+
this.unregister();
|
|
848
|
+
}
|
|
849
|
+
},
|
|
850
|
+
unregister() {
|
|
851
|
+
Object.keys(responsiveMap).forEach(
|
|
852
|
+
(screen) => {
|
|
853
|
+
const matchMediaQuery = responsiveMap[screen];
|
|
854
|
+
if (!matchMediaQuery) return;
|
|
855
|
+
const handler = this.matchHandlers[matchMediaQuery];
|
|
856
|
+
if (handler && handler.mql && handler.listener) {
|
|
857
|
+
if (handler.mql.removeEventListener) {
|
|
858
|
+
handler.mql.removeEventListener("change", handler.listener);
|
|
859
|
+
} else {
|
|
860
|
+
handler.mql.removeListener(handler.listener);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
);
|
|
865
|
+
},
|
|
866
|
+
register() {
|
|
867
|
+
Object.keys(responsiveMap).forEach(
|
|
868
|
+
(screen) => {
|
|
869
|
+
const matchMediaQuery = responsiveMap[screen];
|
|
870
|
+
if (!matchMediaQuery) return;
|
|
871
|
+
const listener = ({ matches }) => {
|
|
872
|
+
this.dispatch(
|
|
873
|
+
{
|
|
874
|
+
...screens,
|
|
875
|
+
[screen]: matches
|
|
876
|
+
},
|
|
877
|
+
screen
|
|
878
|
+
);
|
|
879
|
+
};
|
|
880
|
+
const mql = window.matchMedia(matchMediaQuery);
|
|
881
|
+
if (mql.addEventListener) {
|
|
882
|
+
mql.addEventListener("change", listener);
|
|
883
|
+
} else {
|
|
884
|
+
mql.addListener(listener);
|
|
885
|
+
}
|
|
886
|
+
this.matchHandlers[matchMediaQuery] = {
|
|
887
|
+
mql,
|
|
888
|
+
listener
|
|
889
|
+
};
|
|
890
|
+
listener(mql);
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
function isResponsiveValue(val) {
|
|
896
|
+
return isObject(val);
|
|
897
|
+
}
|
|
898
|
+
function useResponsiveState(val, defaultVal, fallbackToXs = false) {
|
|
899
|
+
const screens2 = ref({
|
|
900
|
+
xs: true,
|
|
901
|
+
sm: true,
|
|
902
|
+
md: true,
|
|
903
|
+
lg: true,
|
|
904
|
+
xl: true,
|
|
905
|
+
xxl: true
|
|
906
|
+
});
|
|
907
|
+
const result = computed(() => {
|
|
908
|
+
let res = defaultVal;
|
|
909
|
+
if (isResponsiveValue(val.value)) {
|
|
910
|
+
for (let i = 0; i < responsiveArray.length; i++) {
|
|
911
|
+
const breakpoint = responsiveArray[i];
|
|
912
|
+
if ((screens2.value[breakpoint] || breakpoint === "xs" && fallbackToXs) && val.value[breakpoint] !== void 0) {
|
|
913
|
+
res = val.value[breakpoint];
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
} else {
|
|
918
|
+
res = val.value;
|
|
919
|
+
}
|
|
920
|
+
return res;
|
|
921
|
+
});
|
|
922
|
+
let subscribeToken = "";
|
|
923
|
+
onMounted(() => {
|
|
924
|
+
subscribeToken = responsiveObserve.subscribe((screensVal) => {
|
|
925
|
+
if (isResponsiveValue(val.value)) {
|
|
926
|
+
screens2.value = screensVal;
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
});
|
|
930
|
+
onUnmounted(() => {
|
|
931
|
+
if (subscribeToken) {
|
|
932
|
+
responsiveObserve.unsubscribe(subscribeToken);
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
return result;
|
|
936
|
+
}
|
|
937
|
+
function resolveItemData(cols, props) {
|
|
938
|
+
const originSpan = props.span ?? 1;
|
|
939
|
+
const originOffset = props.offset ?? 0;
|
|
940
|
+
const offset = Math.min(originOffset, cols);
|
|
941
|
+
const span = Math.min(
|
|
942
|
+
offset > 0 ? originSpan + originOffset : originSpan,
|
|
943
|
+
cols
|
|
944
|
+
);
|
|
945
|
+
return {
|
|
946
|
+
span,
|
|
947
|
+
offset,
|
|
948
|
+
suffix: "suffix" in props ? props.suffix !== false : false
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function setItemVisible({
|
|
952
|
+
cols,
|
|
953
|
+
collapsed,
|
|
954
|
+
collapsedRows,
|
|
955
|
+
itemDataList
|
|
956
|
+
}) {
|
|
957
|
+
let overflow = false;
|
|
958
|
+
let displayIndexList = [];
|
|
959
|
+
function isOverflow(span) {
|
|
960
|
+
return Math.ceil(span / cols) > collapsedRows;
|
|
961
|
+
}
|
|
962
|
+
if (collapsed) {
|
|
963
|
+
let spanSum = 0;
|
|
964
|
+
for (let i = 0; i < itemDataList.length; i++) {
|
|
965
|
+
if (itemDataList[i].suffix) {
|
|
966
|
+
spanSum += itemDataList[i].span;
|
|
967
|
+
displayIndexList.push(i);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
if (!isOverflow(spanSum)) {
|
|
971
|
+
let current = 0;
|
|
972
|
+
while (current < itemDataList.length) {
|
|
973
|
+
const item = itemDataList[current];
|
|
974
|
+
if (!item.suffix) {
|
|
975
|
+
spanSum += item.span;
|
|
976
|
+
if (isOverflow(spanSum)) {
|
|
977
|
+
break;
|
|
978
|
+
}
|
|
979
|
+
displayIndexList.push(current);
|
|
980
|
+
}
|
|
981
|
+
current++;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
overflow = itemDataList.some(
|
|
985
|
+
(item, index2) => !item.suffix && !displayIndexList.includes(index2)
|
|
986
|
+
);
|
|
987
|
+
} else {
|
|
988
|
+
displayIndexList = itemDataList.map((_, index2) => index2);
|
|
989
|
+
}
|
|
990
|
+
return {
|
|
991
|
+
overflow,
|
|
992
|
+
displayIndexList
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
function getPrefixCls(name) {
|
|
996
|
+
const { b } = useBemClass();
|
|
997
|
+
return b(name);
|
|
998
|
+
}
|
|
999
|
+
const _sfc_main$9 = defineComponent({
|
|
1000
|
+
name: "GridItem",
|
|
1001
|
+
props: {
|
|
1002
|
+
/**
|
|
1003
|
+
* @zh 跨越的格数
|
|
1004
|
+
* @en Number of grids spanned
|
|
1005
|
+
*/
|
|
1006
|
+
span: {
|
|
1007
|
+
type: [Number, Object],
|
|
1008
|
+
default: 1
|
|
1009
|
+
},
|
|
1010
|
+
/**
|
|
1011
|
+
* @zh 左侧的间隔格数
|
|
1012
|
+
* @en Number of grids on the left
|
|
1013
|
+
*/
|
|
1014
|
+
offset: {
|
|
1015
|
+
type: [Number, Object],
|
|
1016
|
+
default: 0
|
|
1017
|
+
},
|
|
1018
|
+
/**
|
|
1019
|
+
* @zh 是否是后缀元素
|
|
1020
|
+
* @en Is it a suffix element
|
|
1021
|
+
*/
|
|
1022
|
+
suffix: {
|
|
1023
|
+
type: Boolean,
|
|
1024
|
+
default: false
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
setup(props) {
|
|
1028
|
+
const prefixCls = getPrefixCls("grid-item");
|
|
1029
|
+
const domRef = ref();
|
|
1030
|
+
const { computedIndex } = useIndex({
|
|
1031
|
+
itemRef: domRef,
|
|
1032
|
+
selector: `.${prefixCls}`
|
|
1033
|
+
});
|
|
1034
|
+
const gridContext = inject(GridContextInjectionKey, {
|
|
1035
|
+
overflow: false,
|
|
1036
|
+
displayIndexList: [],
|
|
1037
|
+
cols: 24,
|
|
1038
|
+
colGap: 0
|
|
1039
|
+
});
|
|
1040
|
+
const gridDataCollector = inject(GridDataCollectorInjectionKey);
|
|
1041
|
+
const visible = computed(
|
|
1042
|
+
() => {
|
|
1043
|
+
var _a;
|
|
1044
|
+
return (_a = gridContext == null ? void 0 : gridContext.displayIndexList) == null ? void 0 : _a.includes(computedIndex.value);
|
|
1045
|
+
}
|
|
1046
|
+
);
|
|
1047
|
+
const { span: propSpan, offset: propOffset } = toRefs(props);
|
|
1048
|
+
const rSpan = useResponsiveState(propSpan, 1);
|
|
1049
|
+
const rOffset = useResponsiveState(propOffset, 0);
|
|
1050
|
+
const itemData = computed(
|
|
1051
|
+
() => resolveItemData(gridContext.cols, {
|
|
1052
|
+
...props,
|
|
1053
|
+
span: rSpan.value,
|
|
1054
|
+
offset: rOffset.value
|
|
1055
|
+
})
|
|
1056
|
+
);
|
|
1057
|
+
const classNames = computed(() => [prefixCls]);
|
|
1058
|
+
const offsetStyle = computed(() => {
|
|
1059
|
+
const { offset, span } = itemData.value;
|
|
1060
|
+
const { colGap } = gridContext;
|
|
1061
|
+
if (offset > 0) {
|
|
1062
|
+
const oneSpan = `(100% - ${colGap * (span - 1)}px) / ${span}`;
|
|
1063
|
+
return {
|
|
1064
|
+
"margin-left": `calc((${oneSpan} * ${offset}) + ${colGap * offset}px)`
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
return {};
|
|
1068
|
+
});
|
|
1069
|
+
const columnStart = computed(() => {
|
|
1070
|
+
const { suffix, span } = itemData.value;
|
|
1071
|
+
const { cols } = gridContext;
|
|
1072
|
+
if (suffix) {
|
|
1073
|
+
return `${cols - span + 1}`;
|
|
1074
|
+
}
|
|
1075
|
+
return `span ${span}`;
|
|
1076
|
+
});
|
|
1077
|
+
const style = computed(() => {
|
|
1078
|
+
const { span } = itemData.value;
|
|
1079
|
+
if (domRef.value) {
|
|
1080
|
+
return [
|
|
1081
|
+
{
|
|
1082
|
+
"grid-column": `${columnStart.value} / span ${span}`
|
|
1083
|
+
},
|
|
1084
|
+
offsetStyle.value,
|
|
1085
|
+
!visible.value || span === 0 ? { display: "none" } : {}
|
|
1086
|
+
];
|
|
1087
|
+
}
|
|
1088
|
+
return [];
|
|
1089
|
+
});
|
|
1090
|
+
watchEffect(() => {
|
|
1091
|
+
if (computedIndex.value !== -1) {
|
|
1092
|
+
gridDataCollector == null ? void 0 : gridDataCollector.collectItemData(computedIndex.value, itemData.value);
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
onUnmounted(() => {
|
|
1096
|
+
if (computedIndex.value !== -1) {
|
|
1097
|
+
gridDataCollector == null ? void 0 : gridDataCollector.removeItemData(computedIndex.value);
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
return {
|
|
1101
|
+
classNames,
|
|
1102
|
+
style,
|
|
1103
|
+
domRef,
|
|
1104
|
+
overflow: computed(() => gridContext.overflow)
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1109
|
+
return openBlock(), createElementBlock("div", {
|
|
1110
|
+
ref: "domRef",
|
|
1111
|
+
class: normalizeClass(_ctx.classNames),
|
|
1112
|
+
style: normalizeStyle(_ctx.style)
|
|
1113
|
+
}, [
|
|
1114
|
+
renderSlot(_ctx.$slots, "default", { overflow: _ctx.overflow })
|
|
1115
|
+
], 6);
|
|
1116
|
+
}
|
|
1117
|
+
const GridItem = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$1]]);
|
|
1118
|
+
const _sfc_main$8 = defineComponent({
|
|
1119
|
+
name: "Grid",
|
|
1120
|
+
props: {
|
|
1121
|
+
/**
|
|
1122
|
+
* @zh 每一行展示的列数
|
|
1123
|
+
* @en Number of columns displayed in each row
|
|
1124
|
+
*/
|
|
1125
|
+
cols: {
|
|
1126
|
+
type: [Number, Object],
|
|
1127
|
+
default: 24
|
|
1128
|
+
},
|
|
1129
|
+
/**
|
|
1130
|
+
* @zh 行与行之间的间距
|
|
1131
|
+
* @en The space in row-to-row
|
|
1132
|
+
*/
|
|
1133
|
+
rowGap: {
|
|
1134
|
+
type: [Number, Object],
|
|
1135
|
+
default: 0
|
|
1136
|
+
},
|
|
1137
|
+
/**
|
|
1138
|
+
* @zh 列与列之间的间距
|
|
1139
|
+
* @en The space in column-to-column
|
|
1140
|
+
*/
|
|
1141
|
+
colGap: {
|
|
1142
|
+
type: [Number, Object],
|
|
1143
|
+
default: 0
|
|
1144
|
+
},
|
|
1145
|
+
/**
|
|
1146
|
+
* @zh 是否折叠
|
|
1147
|
+
* @en Whether to collapsed
|
|
1148
|
+
*/
|
|
1149
|
+
collapsed: {
|
|
1150
|
+
type: Boolean,
|
|
1151
|
+
default: false
|
|
1152
|
+
},
|
|
1153
|
+
/**
|
|
1154
|
+
* @zh 折叠时显示的行数
|
|
1155
|
+
* @en Number of rows displayed when collapsed
|
|
1156
|
+
*/
|
|
1157
|
+
collapsedRows: {
|
|
1158
|
+
type: Number,
|
|
1159
|
+
default: 1
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
setup(props) {
|
|
1163
|
+
const {
|
|
1164
|
+
cols: propCols,
|
|
1165
|
+
rowGap: propRowGap,
|
|
1166
|
+
colGap: propColGap,
|
|
1167
|
+
collapsedRows,
|
|
1168
|
+
collapsed
|
|
1169
|
+
} = toRefs(props);
|
|
1170
|
+
const cols = useResponsiveState(propCols, 24);
|
|
1171
|
+
const colGap = useResponsiveState(propColGap, 0);
|
|
1172
|
+
const rowGap = useResponsiveState(propRowGap, 0);
|
|
1173
|
+
const prefixCls = getPrefixCls("grid");
|
|
1174
|
+
const classNames = computed(() => [prefixCls]);
|
|
1175
|
+
const style = computed(() => [
|
|
1176
|
+
{
|
|
1177
|
+
gap: `${rowGap.value}px ${colGap.value}px`,
|
|
1178
|
+
"grid-template-columns": `repeat(${cols.value}, minmax(0px, 1fr))`
|
|
1179
|
+
}
|
|
1180
|
+
]);
|
|
1181
|
+
const itemDataMap = reactive(/* @__PURE__ */ new Map());
|
|
1182
|
+
const itemDataList = computed(() => {
|
|
1183
|
+
const list = [];
|
|
1184
|
+
for (const [index2, itemData] of itemDataMap.entries()) {
|
|
1185
|
+
list[index2] = itemData;
|
|
1186
|
+
}
|
|
1187
|
+
return list;
|
|
1188
|
+
});
|
|
1189
|
+
const gridContext = reactive({
|
|
1190
|
+
overflow: false,
|
|
1191
|
+
displayIndexList: [],
|
|
1192
|
+
cols: cols.value,
|
|
1193
|
+
colGap: colGap.value
|
|
1194
|
+
});
|
|
1195
|
+
watchEffect(() => {
|
|
1196
|
+
gridContext.cols = cols.value;
|
|
1197
|
+
gridContext.colGap = colGap.value;
|
|
1198
|
+
});
|
|
1199
|
+
watchEffect(() => {
|
|
1200
|
+
const displayInfo = setItemVisible({
|
|
1201
|
+
cols: cols.value,
|
|
1202
|
+
collapsed: collapsed.value,
|
|
1203
|
+
collapsedRows: collapsedRows.value,
|
|
1204
|
+
itemDataList: itemDataList.value
|
|
1205
|
+
});
|
|
1206
|
+
gridContext.overflow = displayInfo.overflow;
|
|
1207
|
+
gridContext.displayIndexList = displayInfo.displayIndexList;
|
|
1208
|
+
});
|
|
1209
|
+
provide(GridContextInjectionKey, gridContext);
|
|
1210
|
+
provide(GridDataCollectorInjectionKey, {
|
|
1211
|
+
collectItemData(index2, itemData) {
|
|
1212
|
+
itemDataMap.set(index2, itemData);
|
|
1213
|
+
},
|
|
1214
|
+
removeItemData(index2) {
|
|
1215
|
+
itemDataMap.delete(index2);
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
return {
|
|
1219
|
+
classNames,
|
|
1220
|
+
style
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1225
|
+
return openBlock(), createElementBlock("div", {
|
|
1226
|
+
class: normalizeClass(_ctx.classNames),
|
|
1227
|
+
style: normalizeStyle(_ctx.style)
|
|
1228
|
+
}, [
|
|
1229
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1230
|
+
], 6);
|
|
1231
|
+
}
|
|
1232
|
+
const Grid = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render], ["__scopeId", "data-v-4f2b02b0"]]);
|
|
1233
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1234
|
+
__name: "input-group",
|
|
1235
|
+
setup(__props) {
|
|
1236
|
+
const { b } = useBemClass();
|
|
1237
|
+
return (_ctx, _cache) => {
|
|
1238
|
+
return openBlock(), createElementBlock("div", {
|
|
1239
|
+
class: normalizeClass(unref(b)("input-group"))
|
|
1240
|
+
}, [
|
|
1241
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1242
|
+
], 2);
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
const InputGroup = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-cd21cbfd"]]);
|
|
1247
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1248
|
+
__name: "input-search",
|
|
1249
|
+
props: /* @__PURE__ */ mergeModels({
|
|
1250
|
+
disabled: { type: Boolean, default: false },
|
|
1251
|
+
readonly: { type: Boolean, default: false },
|
|
1252
|
+
placeholder: { default: "请选择" },
|
|
1253
|
+
disabledHideButton: { type: Boolean, default: false }
|
|
1254
|
+
}, {
|
|
1255
|
+
"modelValue": { type: String },
|
|
1256
|
+
"modelModifiers": {}
|
|
1257
|
+
}),
|
|
1258
|
+
emits: /* @__PURE__ */ mergeModels(["search", "clear"], ["update:modelValue"]),
|
|
1259
|
+
setup(__props, { emit: __emit }) {
|
|
1260
|
+
const model = useModel(__props, "modelValue");
|
|
1261
|
+
const props = __props;
|
|
1262
|
+
const emit = __emit;
|
|
1263
|
+
const { b } = useBemClass();
|
|
1264
|
+
const showButton = computed(() => {
|
|
1265
|
+
if (props.readonly) return false;
|
|
1266
|
+
if (props.disabled) {
|
|
1267
|
+
return !props.disabledHideButton;
|
|
1268
|
+
}
|
|
1269
|
+
return true;
|
|
1270
|
+
});
|
|
1271
|
+
return (_ctx, _cache) => {
|
|
1272
|
+
const _component_el_input = resolveComponent("el-input");
|
|
1273
|
+
const _component_el_button = resolveComponent("el-button");
|
|
1274
|
+
return openBlock(), createBlock(InputGroup, {
|
|
1275
|
+
class: normalizeClass(unref(b)("input-search"))
|
|
1276
|
+
}, {
|
|
1277
|
+
default: withCtx(() => [
|
|
1278
|
+
createVNode(_component_el_input, {
|
|
1279
|
+
modelValue: model.value,
|
|
1280
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
1281
|
+
disabled: props.disabled,
|
|
1282
|
+
readonly: !props.disabled,
|
|
1283
|
+
placeholder: props.placeholder
|
|
1284
|
+
}, null, 8, ["modelValue", "disabled", "readonly", "placeholder"]),
|
|
1285
|
+
showButton.value ? (openBlock(), createBlock(_component_el_button, {
|
|
1286
|
+
key: 0,
|
|
1287
|
+
icon: unref(search_default),
|
|
1288
|
+
disabled: props.disabled,
|
|
1289
|
+
onClick: _cache[1] || (_cache[1] = ($event) => emit("search"))
|
|
1290
|
+
}, null, 8, ["icon", "disabled"])) : createCommentVNode("", true),
|
|
1291
|
+
showButton.value ? (openBlock(), createBlock(_component_el_button, {
|
|
1292
|
+
key: 1,
|
|
1293
|
+
icon: unref(close_default),
|
|
1294
|
+
disabled: props.disabled,
|
|
1295
|
+
onClick: _cache[2] || (_cache[2] = ($event) => emit("clear"))
|
|
1296
|
+
}, null, 8, ["icon", "disabled"])) : createCommentVNode("", true)
|
|
1297
|
+
]),
|
|
1298
|
+
_: 1
|
|
1299
|
+
}, 8, ["class"]);
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
const InputSearch = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-788824ed"]]);
|
|
1304
|
+
const _hoisted_1 = {
|
|
1305
|
+
key: 0,
|
|
1306
|
+
class: "w-full"
|
|
1307
|
+
};
|
|
1308
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1309
|
+
__name: "form",
|
|
1310
|
+
props: {
|
|
1311
|
+
modelValue: {},
|
|
1312
|
+
columns: {
|
|
1313
|
+
default: () => []
|
|
1314
|
+
},
|
|
1315
|
+
fc: {
|
|
1316
|
+
default: () => ({})
|
|
1317
|
+
},
|
|
1318
|
+
gridProps: {},
|
|
1319
|
+
gridItemProps: {
|
|
1320
|
+
default: () => ({
|
|
1321
|
+
span: {
|
|
1322
|
+
xs: 24,
|
|
1323
|
+
sm: 24,
|
|
1324
|
+
md: 12
|
|
1325
|
+
}
|
|
1326
|
+
})
|
|
1327
|
+
},
|
|
1328
|
+
search: {
|
|
1329
|
+
type: Boolean,
|
|
1330
|
+
default: false
|
|
1331
|
+
},
|
|
1332
|
+
searchText: {
|
|
1333
|
+
default: "查询"
|
|
1334
|
+
},
|
|
1335
|
+
hideFoldBtn: {
|
|
1336
|
+
type: Boolean,
|
|
1337
|
+
default: false
|
|
1338
|
+
},
|
|
1339
|
+
defaultCollapsed: {
|
|
1340
|
+
type: Boolean,
|
|
1341
|
+
default: void 0
|
|
1342
|
+
},
|
|
1343
|
+
model: {},
|
|
1344
|
+
rules: {},
|
|
1345
|
+
labelPosition: {},
|
|
1346
|
+
requireAsteriskPosition: {},
|
|
1347
|
+
labelWidth: {
|
|
1348
|
+
default: "auto"
|
|
1349
|
+
},
|
|
1350
|
+
labelSuffix: {},
|
|
1351
|
+
inline: {
|
|
1352
|
+
type: Boolean
|
|
1353
|
+
},
|
|
1354
|
+
inlineMessage: {
|
|
1355
|
+
type: Boolean
|
|
1356
|
+
},
|
|
1357
|
+
statusIcon: {
|
|
1358
|
+
type: Boolean
|
|
1359
|
+
},
|
|
1360
|
+
showMessage: {
|
|
1361
|
+
type: Boolean
|
|
1362
|
+
},
|
|
1363
|
+
validateOnRuleChange: {
|
|
1364
|
+
type: Boolean
|
|
1365
|
+
},
|
|
1366
|
+
hideRequiredAsterisk: {
|
|
1367
|
+
type: Boolean
|
|
1368
|
+
},
|
|
1369
|
+
scrollToError: {
|
|
1370
|
+
type: Boolean,
|
|
1371
|
+
default: true
|
|
1372
|
+
},
|
|
1373
|
+
scrollIntoViewOptions: {},
|
|
1374
|
+
size: {},
|
|
1375
|
+
disabled: {
|
|
1376
|
+
type: Boolean
|
|
1377
|
+
}
|
|
1378
|
+
},
|
|
1379
|
+
emits: ["update:modelValue", "search", "reset"],
|
|
1380
|
+
setup(__props, {
|
|
1381
|
+
expose: __expose,
|
|
1382
|
+
emit: __emit
|
|
1383
|
+
}) {
|
|
1384
|
+
const props = __props;
|
|
1385
|
+
const emit = __emit;
|
|
1386
|
+
const attrs = useAttrs();
|
|
1387
|
+
const {
|
|
1388
|
+
b
|
|
1389
|
+
} = useBemClass();
|
|
1390
|
+
const collapsed = ref((props == null ? void 0 : props.defaultCollapsed) ?? props.search);
|
|
1391
|
+
const instance = getCurrentInstance();
|
|
1392
|
+
const globalConfig = instance == null ? void 0 : instance.appContext.config.globalProperties.$config;
|
|
1393
|
+
const clearable2 = (globalConfig == null ? void 0 : globalConfig.clearable) ?? false;
|
|
1394
|
+
const dictData = ref({});
|
|
1395
|
+
const STATIC_PROPS = /* @__PURE__ */ new Map([["input", {
|
|
1396
|
+
clearable: clearable2,
|
|
1397
|
+
maxlength: 20
|
|
1398
|
+
}], ["textarea", {
|
|
1399
|
+
clearable: clearable2,
|
|
1400
|
+
type: "textarea",
|
|
1401
|
+
maxlength: 200,
|
|
1402
|
+
showWordLimit: true
|
|
1403
|
+
}], ["input-number", {}], ["input-tag", {
|
|
1404
|
+
clearable: clearable2
|
|
1405
|
+
}], ["select", {
|
|
1406
|
+
clearable: clearable2
|
|
1407
|
+
}], ["select-v2", {
|
|
1408
|
+
clearable: clearable2
|
|
1409
|
+
}], ["tree-select", {
|
|
1410
|
+
clearable: clearable2
|
|
1411
|
+
}], ["cascader", {
|
|
1412
|
+
clearable: clearable2
|
|
1413
|
+
}], ["slider", {}], ["switch", {}], ["rate", {}], ["checkbox-group", {}], ["checkbox", {}], ["radio-group", {}], ["radio", {}], ["date-picker", {
|
|
1414
|
+
clearable: clearable2
|
|
1415
|
+
}], ["time-picker", {
|
|
1416
|
+
clearable: clearable2
|
|
1417
|
+
}], ["time-select", {
|
|
1418
|
+
clearable: clearable2
|
|
1419
|
+
}], ["color-picker", {}], ["transfer", {}], ["autocomplete", {}], ["upload", {}], ["title", {}]]);
|
|
1420
|
+
const loadDictData = async () => {
|
|
1421
|
+
var _a;
|
|
1422
|
+
const dictCodes = [];
|
|
1423
|
+
(_a = props.columns) == null ? void 0 : _a.forEach((item) => {
|
|
1424
|
+
if (item.dictCode) {
|
|
1425
|
+
dictCodes.push(item.dictCode);
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
if (!dictCodes.length) return;
|
|
1429
|
+
if (!(globalConfig == null ? void 0 : globalConfig.dictRequest)) {
|
|
1430
|
+
return El.ElMessage.error("请配置全局字典请求方法dictRequest");
|
|
1431
|
+
}
|
|
1432
|
+
try {
|
|
1433
|
+
const dictResponses = await Promise.all(dictCodes.map((code) => globalConfig.dictRequest(code).then((response) => ({
|
|
1434
|
+
code,
|
|
1435
|
+
response
|
|
1436
|
+
}))));
|
|
1437
|
+
dictResponses.forEach(({
|
|
1438
|
+
code,
|
|
1439
|
+
response
|
|
1440
|
+
}) => {
|
|
1441
|
+
dictData.value[code] = response;
|
|
1442
|
+
});
|
|
1443
|
+
} catch (error) {
|
|
1444
|
+
console.error("获取字典数据失败:", error);
|
|
1445
|
+
El.ElMessage.error("获取字典数据失败");
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
onMounted(() => {
|
|
1449
|
+
loadDictData();
|
|
1450
|
+
});
|
|
1451
|
+
function getComponentBindProps(item) {
|
|
1452
|
+
var _a;
|
|
1453
|
+
const defaultProps = STATIC_PROPS.get(item.type) || {};
|
|
1454
|
+
defaultProps.placeholder = getPlaceholder(item);
|
|
1455
|
+
if (item.type === "date-picker") {
|
|
1456
|
+
defaultProps.valueFormat = ((_a = item == null ? void 0 : item.props) == null ? void 0 : _a.type) === "datetime" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
1457
|
+
}
|
|
1458
|
+
if (item.dictCode && dictData.value[item.dictCode]) {
|
|
1459
|
+
defaultProps.options = dictData.value[item.dictCode];
|
|
1460
|
+
}
|
|
1461
|
+
return {
|
|
1462
|
+
...defaultProps,
|
|
1463
|
+
...item.props
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
const formProps = computed(() => {
|
|
1467
|
+
return {
|
|
1468
|
+
...attrs,
|
|
1469
|
+
...props,
|
|
1470
|
+
columns: void 0,
|
|
1471
|
+
gridProps: void 0,
|
|
1472
|
+
gridItemProps: void 0,
|
|
1473
|
+
search: void 0,
|
|
1474
|
+
searchText: void 0,
|
|
1475
|
+
hideFoldBtn: void 0,
|
|
1476
|
+
defaultCollapsed: void 0
|
|
1477
|
+
};
|
|
1478
|
+
});
|
|
1479
|
+
const getClass = computed(() => {
|
|
1480
|
+
const arr = [b("form")];
|
|
1481
|
+
if (props.search) {
|
|
1482
|
+
arr.push(b("form--search"));
|
|
1483
|
+
}
|
|
1484
|
+
return arr.join(" ");
|
|
1485
|
+
});
|
|
1486
|
+
const CompMap = {
|
|
1487
|
+
input: El.ElInput,
|
|
1488
|
+
textarea: El.ElInput,
|
|
1489
|
+
"input-number": El.ElInputNumber,
|
|
1490
|
+
"input-tag": El.ElInputTag,
|
|
1491
|
+
"input-search": InputSearch,
|
|
1492
|
+
select: El.ElSelect,
|
|
1493
|
+
"select-v2": El.ElSelectV2,
|
|
1494
|
+
"tree-select": El.ElTreeSelect,
|
|
1495
|
+
cascader: El.ElCascader,
|
|
1496
|
+
slider: El.ElSlider,
|
|
1497
|
+
switch: El.ElSwitch,
|
|
1498
|
+
rate: El.ElRate,
|
|
1499
|
+
"checkbox-group": El.ElCheckboxGroup,
|
|
1500
|
+
checkbox: El.ElCheckbox,
|
|
1501
|
+
"radio-group": El.ElRadioGroup,
|
|
1502
|
+
radio: El.ElRadio,
|
|
1503
|
+
"date-picker": El.ElDatePicker,
|
|
1504
|
+
"time-picker": El.ElTimePicker,
|
|
1505
|
+
"time-select": El.ElTimeSelect,
|
|
1506
|
+
"color-picker": El.ElColorPicker,
|
|
1507
|
+
transfer: El.ElTransfer,
|
|
1508
|
+
autocomplete: El.ElAutocomplete,
|
|
1509
|
+
upload: El.ElUpload,
|
|
1510
|
+
title: El.ElAlert
|
|
1511
|
+
};
|
|
1512
|
+
const formRef = ref();
|
|
1513
|
+
const getPlaceholder = (item) => {
|
|
1514
|
+
if (!item.type) return void 0;
|
|
1515
|
+
if (["input", "input-number", "input-tag"].includes(item.type)) {
|
|
1516
|
+
return `请输入${item.label}`;
|
|
1517
|
+
}
|
|
1518
|
+
if (["textarea"].includes(item.type)) {
|
|
1519
|
+
return `请填写${item.label}`;
|
|
1520
|
+
}
|
|
1521
|
+
if (["select", "select-v2", "tree-select", "cascader", "time-select", "input-search"].includes(item.type)) {
|
|
1522
|
+
return `请选择${item.label}`;
|
|
1523
|
+
}
|
|
1524
|
+
if (["date-picker"].includes(item.type)) {
|
|
1525
|
+
return `请选择日期`;
|
|
1526
|
+
}
|
|
1527
|
+
if (["time-picker"].includes(item.type)) {
|
|
1528
|
+
return `请选择时间`;
|
|
1529
|
+
}
|
|
1530
|
+
return void 0;
|
|
1531
|
+
};
|
|
1532
|
+
function getFormItemRules(item) {
|
|
1533
|
+
var _a, _b, _c, _d;
|
|
1534
|
+
if (item.required) {
|
|
1535
|
+
return [{
|
|
1536
|
+
required: true,
|
|
1537
|
+
message: `${item.label}为必填项`
|
|
1538
|
+
}, ...Array.isArray(item.rules) ? item.rules : []];
|
|
1539
|
+
}
|
|
1540
|
+
if ((_b = (_a = props.fc) == null ? void 0 : _a[item.field]) == null ? void 0 : _b.required) {
|
|
1541
|
+
return [{
|
|
1542
|
+
required: (_d = (_c = props.fc) == null ? void 0 : _c[item.field]) == null ? void 0 : _d.required,
|
|
1543
|
+
message: `${item.label}为必填项`
|
|
1544
|
+
}, ...Array.isArray(item.rules) ? item.rules : []];
|
|
1545
|
+
}
|
|
1546
|
+
return item.rules;
|
|
1547
|
+
}
|
|
1548
|
+
function isHide(item) {
|
|
1549
|
+
var _a, _b;
|
|
1550
|
+
if (typeof item.hide === "boolean") return item.hide;
|
|
1551
|
+
if (typeof item.hide === "function") {
|
|
1552
|
+
return item.hide(props.modelValue);
|
|
1553
|
+
}
|
|
1554
|
+
if ((_b = (_a = props.fc) == null ? void 0 : _a[item.field]) == null ? void 0 : _b.hidden) return true;
|
|
1555
|
+
if (item.hide === void 0) return false;
|
|
1556
|
+
}
|
|
1557
|
+
function isDisabled(item) {
|
|
1558
|
+
var _a, _b, _c, _d;
|
|
1559
|
+
if (((_a = item == null ? void 0 : item.props) == null ? void 0 : _a.disabled) !== void 0) return (_b = item == null ? void 0 : item.props) == null ? void 0 : _b.disabled;
|
|
1560
|
+
if (((_d = (_c = props.fc) == null ? void 0 : _c[item.field]) == null ? void 0 : _d.edit) === false) return true;
|
|
1561
|
+
return false;
|
|
1562
|
+
}
|
|
1563
|
+
function updateModelValue(value, item) {
|
|
1564
|
+
emit("update:modelValue", Object.assign(props.modelValue, {
|
|
1565
|
+
[item.field]: value
|
|
1566
|
+
}));
|
|
1567
|
+
}
|
|
1568
|
+
watch(() => props.modelValue, () => {
|
|
1569
|
+
console.log("form", toRaw(props.modelValue));
|
|
1570
|
+
}, {
|
|
1571
|
+
deep: true
|
|
1572
|
+
});
|
|
1573
|
+
__expose({
|
|
1574
|
+
formRef
|
|
1575
|
+
});
|
|
1576
|
+
return (_ctx, _cache) => {
|
|
1577
|
+
const _component_el_form_item = resolveComponent("el-form-item");
|
|
1578
|
+
const _component_el_text = resolveComponent("el-text");
|
|
1579
|
+
const _component_el_button = resolveComponent("el-button");
|
|
1580
|
+
const _component_el_space = resolveComponent("el-space");
|
|
1581
|
+
const _component_el_form = resolveComponent("el-form");
|
|
1582
|
+
return openBlock(), createBlock(_component_el_form, mergeProps({
|
|
1583
|
+
ref_key: "formRef",
|
|
1584
|
+
ref: formRef,
|
|
1585
|
+
class: getClass.value
|
|
1586
|
+
}, formProps.value, {
|
|
1587
|
+
model: props.modelValue
|
|
1588
|
+
}), {
|
|
1589
|
+
default: withCtx(() => [createVNode(unref(Grid), mergeProps({
|
|
1590
|
+
class: "w-full",
|
|
1591
|
+
"col-gap": 12
|
|
1592
|
+
}, props.gridProps, {
|
|
1593
|
+
collapsed: collapsed.value
|
|
1594
|
+
}), {
|
|
1595
|
+
default: withCtx(() => {
|
|
1596
|
+
var _a;
|
|
1597
|
+
return [(openBlock(true), createElementBlock(Fragment, null, renderList(props.columns, (item, index2) => {
|
|
1598
|
+
var _a2, _b;
|
|
1599
|
+
return openBlock(), createElementBlock(Fragment, null, [item.type === "title" ? (openBlock(), createBlock(unref(GridItem), {
|
|
1600
|
+
key: `title${index2}`,
|
|
1601
|
+
span: 100
|
|
1602
|
+
}, {
|
|
1603
|
+
default: withCtx(() => [createVNode(_component_el_form_item, {
|
|
1604
|
+
"label-width": "0"
|
|
1605
|
+
}, {
|
|
1606
|
+
default: withCtx(() => [createVNode(unref(Card), {
|
|
1607
|
+
title: typeof item.label === "string" ? item.label : "",
|
|
1608
|
+
"header-style": {
|
|
1609
|
+
padding: 0
|
|
1610
|
+
},
|
|
1611
|
+
"body-style": {
|
|
1612
|
+
display: "none"
|
|
1613
|
+
}
|
|
1614
|
+
}, null, 8, ["title"])]),
|
|
1615
|
+
_: 2
|
|
1616
|
+
}, 1024)]),
|
|
1617
|
+
_: 2
|
|
1618
|
+
}, 1024)) : (openBlock(), createElementBlock(Fragment, {
|
|
1619
|
+
key: 1
|
|
1620
|
+
}, [!isHide(item) ? (openBlock(), createBlock(unref(GridItem), mergeProps({
|
|
1621
|
+
key: item.field + index2
|
|
1622
|
+
}, {
|
|
1623
|
+
ref_for: true
|
|
1624
|
+
}, item.gridItemProps || props.gridItemProps, {
|
|
1625
|
+
span: item.span || ((_a2 = item.gridItemProps) == null ? void 0 : _a2.span) || ((_b = props == null ? void 0 : props.gridItemProps) == null ? void 0 : _b.span)
|
|
1626
|
+
}), {
|
|
1627
|
+
default: withCtx(() => [(openBlock(), createBlock(_component_el_form_item, mergeProps({
|
|
1628
|
+
key: item.field + index2,
|
|
1629
|
+
prop: item.field,
|
|
1630
|
+
label: item.label,
|
|
1631
|
+
rules: getFormItemRules(item)
|
|
1632
|
+
}, {
|
|
1633
|
+
ref_for: true
|
|
1634
|
+
}, item.formItemProps), createSlots({
|
|
1635
|
+
default: withCtx(() => [item.type === "slot" ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, item.field, {
|
|
1636
|
+
item
|
|
1637
|
+
}, void 0, true)])) : (openBlock(), createElementBlock("div", {
|
|
1638
|
+
key: 1,
|
|
1639
|
+
class: normalizeClass(unref(b)("form-item__content"))
|
|
1640
|
+
}, [createElementVNode("div", {
|
|
1641
|
+
class: normalizeClass(unref(b)("form-item__component"))
|
|
1642
|
+
}, [(openBlock(), createBlock(resolveDynamicComponent(CompMap[item.type] || item.type), mergeProps({
|
|
1643
|
+
disabled: isDisabled(item),
|
|
1644
|
+
class: "w-full"
|
|
1645
|
+
}, {
|
|
1646
|
+
ref_for: true
|
|
1647
|
+
}, getComponentBindProps(item), {
|
|
1648
|
+
"model-value": props.modelValue[item.fieldName || item.field],
|
|
1649
|
+
"onUpdate:modelValue": ($event) => updateModelValue($event, item)
|
|
1650
|
+
}), createSlots({
|
|
1651
|
+
_: 2
|
|
1652
|
+
}, [renderList((item == null ? void 0 : item.slots) || {}, (slotValue, slotKey) => {
|
|
1653
|
+
return {
|
|
1654
|
+
name: slotKey,
|
|
1655
|
+
fn: withCtx((scope) => [typeof slotValue === "string" ? (openBlock(), createElementBlock(Fragment, {
|
|
1656
|
+
key: 0
|
|
1657
|
+
}, [createTextVNode(toDisplayString(slotValue), 1)], 64)) : slotValue ? (openBlock(), createBlock(resolveDynamicComponent(slotValue(scope)), {
|
|
1658
|
+
key: 1
|
|
1659
|
+
})) : createCommentVNode("", true)])
|
|
1660
|
+
};
|
|
1661
|
+
})]), 1040, ["disabled", "model-value", "onUpdate:modelValue"])), item.tip ? (openBlock(), createBlock(_component_el_text, {
|
|
1662
|
+
key: 0,
|
|
1663
|
+
class: normalizeClass(unref(b)("form-item__tip")),
|
|
1664
|
+
type: "info",
|
|
1665
|
+
size: "small"
|
|
1666
|
+
}, {
|
|
1667
|
+
default: withCtx(() => [createTextVNode(toDisplayString(item.tip), 1)]),
|
|
1668
|
+
_: 2
|
|
1669
|
+
}, 1032, ["class"])) : createCommentVNode("", true)], 2), item.extra ? (openBlock(), createElementBlock("div", {
|
|
1670
|
+
key: 0,
|
|
1671
|
+
class: normalizeClass(unref(b)("form-item__extra"))
|
|
1672
|
+
}, [typeof item.extra === "string" ? (openBlock(), createBlock(_component_el_text, {
|
|
1673
|
+
key: 0,
|
|
1674
|
+
type: "info",
|
|
1675
|
+
size: "small"
|
|
1676
|
+
}, {
|
|
1677
|
+
default: withCtx(() => [createTextVNode(toDisplayString(item.extra), 1)]),
|
|
1678
|
+
_: 2
|
|
1679
|
+
}, 1024)) : item.extra ? (openBlock(), createBlock(resolveDynamicComponent(item.extra), {
|
|
1680
|
+
key: 1
|
|
1681
|
+
})) : createCommentVNode("", true)], 2)) : createCommentVNode("", true)], 2))]),
|
|
1682
|
+
_: 2
|
|
1683
|
+
}, [(item == null ? void 0 : item.labelRender) ? {
|
|
1684
|
+
name: "label",
|
|
1685
|
+
fn: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(item.labelRender)))]),
|
|
1686
|
+
key: "0"
|
|
1687
|
+
} : void 0]), 1040, ["prop", "label", "rules"]))]),
|
|
1688
|
+
_: 2
|
|
1689
|
+
}, 1040, ["span"])) : createCommentVNode("", true)], 64))], 64);
|
|
1690
|
+
}), 256)), props.search ? (openBlock(), createBlock(unref(GridItem), {
|
|
1691
|
+
key: 0,
|
|
1692
|
+
suffix: props.search,
|
|
1693
|
+
span: (_a = props == null ? void 0 : props.gridItemProps) == null ? void 0 : _a.span
|
|
1694
|
+
}, {
|
|
1695
|
+
default: withCtx(() => [createVNode(_component_el_space, {
|
|
1696
|
+
class: normalizeClass(unref(b)("form__search-btns"))
|
|
1697
|
+
}, {
|
|
1698
|
+
default: withCtx(() => [createVNode(_component_el_button, {
|
|
1699
|
+
type: "primary",
|
|
1700
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("search"))
|
|
1701
|
+
}, {
|
|
1702
|
+
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.searchText), 1)]),
|
|
1703
|
+
_: 1
|
|
1704
|
+
}), createVNode(_component_el_button, {
|
|
1705
|
+
onClick: _cache[1] || (_cache[1] = ($event) => emit("reset"))
|
|
1706
|
+
}, {
|
|
1707
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode(" 重置 ", -1)])]),
|
|
1708
|
+
_: 1
|
|
1709
|
+
}), !props.hideFoldBtn ? (openBlock(), createBlock(_component_el_button, {
|
|
1710
|
+
key: 0,
|
|
1711
|
+
class: "form__fold-btn",
|
|
1712
|
+
type: "primary",
|
|
1713
|
+
icon: collapsed.value ? unref(arrow_down_default) : unref(arrow_up_default),
|
|
1714
|
+
text: "",
|
|
1715
|
+
size: "small",
|
|
1716
|
+
onClick: _cache[2] || (_cache[2] = ($event) => collapsed.value = !collapsed.value)
|
|
1717
|
+
}, {
|
|
1718
|
+
default: withCtx(() => [createTextVNode(toDisplayString(collapsed.value ? "展开" : "收起"), 1)]),
|
|
1719
|
+
_: 1
|
|
1720
|
+
}, 8, ["icon"])) : createCommentVNode("", true)]),
|
|
1721
|
+
_: 1
|
|
1722
|
+
}, 8, ["class"])]),
|
|
1723
|
+
_: 1
|
|
1724
|
+
}, 8, ["suffix", "span"])) : createCommentVNode("", true)];
|
|
1725
|
+
}),
|
|
1726
|
+
_: 3
|
|
1727
|
+
}, 16, ["collapsed"])]),
|
|
1728
|
+
_: 3
|
|
1729
|
+
}, 16, ["class", "model"]);
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1733
|
+
const Form = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c2aac7b9"]]);
|
|
1734
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1735
|
+
__name: "split-button",
|
|
1736
|
+
props: {
|
|
1737
|
+
collapsed: { type: Boolean, default: false },
|
|
1738
|
+
type: { default: "circle" },
|
|
1739
|
+
iconSize: { default: 10 },
|
|
1740
|
+
disabled: { type: Boolean, default: false }
|
|
1741
|
+
},
|
|
1742
|
+
emits: ["click", "update:collapsed"],
|
|
1743
|
+
setup(__props, { emit: __emit }) {
|
|
1744
|
+
const props = __props;
|
|
1745
|
+
const emit = __emit;
|
|
1746
|
+
const { b } = useBemClass();
|
|
1747
|
+
const getClass = computed(() => {
|
|
1748
|
+
const arr = [b("split-button"), b(`split-button--${props.type}`)];
|
|
1749
|
+
if (props.collapsed) {
|
|
1750
|
+
arr.push(b("split-button--collapsed"));
|
|
1751
|
+
}
|
|
1752
|
+
if (props.disabled) {
|
|
1753
|
+
arr.push(b("split-button--disabled"));
|
|
1754
|
+
}
|
|
1755
|
+
return arr.join(" ");
|
|
1756
|
+
});
|
|
1757
|
+
const handleClick = () => {
|
|
1758
|
+
if (props.disabled) return;
|
|
1759
|
+
emit("click");
|
|
1760
|
+
emit("update:collapsed", !props.collapsed);
|
|
1761
|
+
};
|
|
1762
|
+
return (_ctx, _cache) => {
|
|
1763
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
1764
|
+
return openBlock(), createElementBlock("div", {
|
|
1765
|
+
class: normalizeClass(getClass.value),
|
|
1766
|
+
onClick: handleClick
|
|
1767
|
+
}, [
|
|
1768
|
+
createVNode(_component_el_icon, {
|
|
1769
|
+
size: props.iconSize
|
|
1770
|
+
}, {
|
|
1771
|
+
default: withCtx(() => [
|
|
1772
|
+
_ctx.collapsed ? (openBlock(), createBlock(unref(arrow_right_bold_default), {
|
|
1773
|
+
key: 0,
|
|
1774
|
+
size: _ctx.iconSize
|
|
1775
|
+
}, null, 8, ["size"])) : (openBlock(), createBlock(unref(arrow_left_bold_default), {
|
|
1776
|
+
key: 1,
|
|
1777
|
+
size: _ctx.iconSize
|
|
1778
|
+
}, null, 8, ["size"]))
|
|
1779
|
+
]),
|
|
1780
|
+
_: 1
|
|
1781
|
+
}, 8, ["size"])
|
|
1782
|
+
], 2);
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
const SplitButton = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-097d86cb"]]);
|
|
1787
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1788
|
+
__name: "page-layout",
|
|
1789
|
+
props: {
|
|
1790
|
+
size: { default: 270 },
|
|
1791
|
+
bordered: { type: Boolean, default: false },
|
|
1792
|
+
collapse: { type: Boolean, default: true },
|
|
1793
|
+
leftStyle: { default: () => ({}) },
|
|
1794
|
+
headerStyle: { default: () => ({}) },
|
|
1795
|
+
toolStyle: { default: () => ({}) },
|
|
1796
|
+
bodyStyle: { default: () => ({}) }
|
|
1797
|
+
},
|
|
1798
|
+
setup(__props) {
|
|
1799
|
+
const props = __props;
|
|
1800
|
+
const slots = useSlots();
|
|
1801
|
+
const { b } = useBemClass();
|
|
1802
|
+
const size = ref(props.size);
|
|
1803
|
+
const collapsing = ref(false);
|
|
1804
|
+
const getClass = computed(() => {
|
|
1805
|
+
const arr = [b("page-layout")];
|
|
1806
|
+
if (props.bordered) {
|
|
1807
|
+
arr.push(b("page-layout--bordered"));
|
|
1808
|
+
}
|
|
1809
|
+
if (slots.header) {
|
|
1810
|
+
arr.push(b("page-layout--has-header"));
|
|
1811
|
+
}
|
|
1812
|
+
if (slots.tool) {
|
|
1813
|
+
arr.push(b("page-layout--has-tool"));
|
|
1814
|
+
}
|
|
1815
|
+
if (collapsing.value) {
|
|
1816
|
+
arr.push(b("page-layout--collapsing"));
|
|
1817
|
+
}
|
|
1818
|
+
return arr.join(" ");
|
|
1819
|
+
});
|
|
1820
|
+
function handleClick() {
|
|
1821
|
+
collapsing.value = true;
|
|
1822
|
+
setTimeout(() => {
|
|
1823
|
+
collapsing.value = false;
|
|
1824
|
+
}, 300);
|
|
1825
|
+
size.value = Number(size.value) > 30 ? 0 : props.size;
|
|
1826
|
+
}
|
|
1827
|
+
return (_ctx, _cache) => {
|
|
1828
|
+
const _component_el_splitter_panel = resolveComponent("el-splitter-panel");
|
|
1829
|
+
const _component_el_splitter = resolveComponent("el-splitter");
|
|
1830
|
+
return openBlock(), createBlock(_component_el_splitter, {
|
|
1831
|
+
class: normalizeClass(getClass.value)
|
|
1832
|
+
}, {
|
|
1833
|
+
default: withCtx(() => [
|
|
1834
|
+
unref(slots).left ? (openBlock(), createBlock(_component_el_splitter_panel, {
|
|
1835
|
+
key: 0,
|
|
1836
|
+
size: size.value,
|
|
1837
|
+
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event)
|
|
1838
|
+
}, {
|
|
1839
|
+
default: withCtx(() => [
|
|
1840
|
+
createElementVNode("div", {
|
|
1841
|
+
class: normalizeClass(unref(b)("page-layout__left")),
|
|
1842
|
+
style: normalizeStyle(props.leftStyle)
|
|
1843
|
+
}, [
|
|
1844
|
+
renderSlot(_ctx.$slots, "left", {}, void 0, true)
|
|
1845
|
+
], 6)
|
|
1846
|
+
]),
|
|
1847
|
+
_: 3
|
|
1848
|
+
}, 8, ["size"])) : createCommentVNode("", true),
|
|
1849
|
+
unref(slots).left && props.collapse ? (openBlock(), createElementBlock("div", {
|
|
1850
|
+
key: 1,
|
|
1851
|
+
class: normalizeClass(unref(b)("page-layout__split"))
|
|
1852
|
+
}, [
|
|
1853
|
+
createVNode(SplitButton, {
|
|
1854
|
+
collapsed: Number(size.value) === 0,
|
|
1855
|
+
onClick: handleClick
|
|
1856
|
+
}, null, 8, ["collapsed"])
|
|
1857
|
+
], 2)) : createCommentVNode("", true),
|
|
1858
|
+
createVNode(_component_el_splitter_panel, null, {
|
|
1859
|
+
default: withCtx(() => [
|
|
1860
|
+
createElementVNode("div", {
|
|
1861
|
+
class: normalizeClass(unref(b)("page-layout__right"))
|
|
1862
|
+
}, [
|
|
1863
|
+
unref(slots).header ? (openBlock(), createElementBlock("div", {
|
|
1864
|
+
key: 0,
|
|
1865
|
+
class: normalizeClass(unref(b)("page-layout__header")),
|
|
1866
|
+
style: normalizeStyle(props.headerStyle)
|
|
1867
|
+
}, [
|
|
1868
|
+
renderSlot(_ctx.$slots, "header", {}, void 0, true)
|
|
1869
|
+
], 6)) : createCommentVNode("", true),
|
|
1870
|
+
unref(slots).tool ? (openBlock(), createElementBlock("div", {
|
|
1871
|
+
key: 1,
|
|
1872
|
+
class: normalizeClass(unref(b)("page-layout__tool")),
|
|
1873
|
+
style: normalizeStyle(props.toolStyle)
|
|
1874
|
+
}, [
|
|
1875
|
+
renderSlot(_ctx.$slots, "tool", {}, void 0, true)
|
|
1876
|
+
], 6)) : createCommentVNode("", true),
|
|
1877
|
+
createElementVNode("div", {
|
|
1878
|
+
class: normalizeClass(unref(b)("page-layout__body")),
|
|
1879
|
+
style: normalizeStyle(props.bodyStyle)
|
|
1880
|
+
}, [
|
|
1881
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1882
|
+
], 6)
|
|
1883
|
+
], 2)
|
|
1884
|
+
]),
|
|
1885
|
+
_: 3
|
|
1886
|
+
})
|
|
1887
|
+
]),
|
|
1888
|
+
_: 3
|
|
1889
|
+
}, 8, ["class"]);
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
const PageLayout = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-ae1c9bf4"]]);
|
|
1894
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1895
|
+
__name: "TableColumn",
|
|
1896
|
+
props: {
|
|
1897
|
+
column: {}
|
|
1898
|
+
},
|
|
1899
|
+
setup(__props) {
|
|
1900
|
+
const props = __props;
|
|
1901
|
+
const columnProps = computed(() => {
|
|
1902
|
+
const { slotName, render, children, ...restProps } = props.column;
|
|
1903
|
+
return restProps;
|
|
1904
|
+
});
|
|
1905
|
+
return (_ctx, _cache) => {
|
|
1906
|
+
const _component_el_table_column = resolveComponent("el-table-column");
|
|
1907
|
+
return openBlock(), createBlock(_component_el_table_column, normalizeProps(guardReactiveProps(columnProps.value)), createSlots({
|
|
1908
|
+
default: withCtx(() => [
|
|
1909
|
+
_ctx.column.children && _ctx.column.children.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.column.children, (child) => {
|
|
1910
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
1911
|
+
key: child.prop || child.label,
|
|
1912
|
+
column: child
|
|
1913
|
+
}, createSlots({ _: 2 }, [
|
|
1914
|
+
renderList(_ctx.$slots, (_, slotName) => {
|
|
1915
|
+
return {
|
|
1916
|
+
name: slotName,
|
|
1917
|
+
fn: withCtx((scope) => [
|
|
1918
|
+
renderSlot(_ctx.$slots, slotName, mergeProps({ ref_for: true }, scope))
|
|
1919
|
+
])
|
|
1920
|
+
};
|
|
1921
|
+
})
|
|
1922
|
+
]), 1032, ["column"]);
|
|
1923
|
+
}), 128)) : createCommentVNode("", true)
|
|
1924
|
+
]),
|
|
1925
|
+
_: 2
|
|
1926
|
+
}, [
|
|
1927
|
+
_ctx.column.render ? {
|
|
1928
|
+
name: "default",
|
|
1929
|
+
fn: withCtx((scope) => [
|
|
1930
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.column.render(scope))))
|
|
1931
|
+
]),
|
|
1932
|
+
key: "0"
|
|
1933
|
+
} : _ctx.column.slotName ? {
|
|
1934
|
+
name: "default",
|
|
1935
|
+
fn: withCtx((scope) => [
|
|
1936
|
+
renderSlot(_ctx.$slots, _ctx.column.slotName, normalizeProps(guardReactiveProps(scope)))
|
|
1937
|
+
]),
|
|
1938
|
+
key: "1"
|
|
1939
|
+
} : void 0
|
|
1940
|
+
]), 1040);
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
});
|
|
1944
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1945
|
+
__name: "table",
|
|
1946
|
+
props: {
|
|
1947
|
+
columns: { default: () => [] },
|
|
1948
|
+
pagination: { default: () => ({}) },
|
|
1949
|
+
data: {},
|
|
1950
|
+
size: {},
|
|
1951
|
+
width: {},
|
|
1952
|
+
height: {},
|
|
1953
|
+
maxHeight: {},
|
|
1954
|
+
fit: {},
|
|
1955
|
+
stripe: {},
|
|
1956
|
+
border: {},
|
|
1957
|
+
rowKey: {},
|
|
1958
|
+
context: {},
|
|
1959
|
+
showHeader: {},
|
|
1960
|
+
showSummary: {},
|
|
1961
|
+
sumText: {},
|
|
1962
|
+
summaryMethod: {},
|
|
1963
|
+
rowClassName: {},
|
|
1964
|
+
rowStyle: {},
|
|
1965
|
+
cellClassName: {},
|
|
1966
|
+
cellStyle: {},
|
|
1967
|
+
headerRowClassName: {},
|
|
1968
|
+
headerRowStyle: {},
|
|
1969
|
+
headerCellClassName: {},
|
|
1970
|
+
headerCellStyle: {},
|
|
1971
|
+
highlightCurrentRow: {},
|
|
1972
|
+
currentRowKey: {},
|
|
1973
|
+
emptyText: {},
|
|
1974
|
+
expandRowKeys: {},
|
|
1975
|
+
defaultExpandAll: {},
|
|
1976
|
+
defaultSort: {},
|
|
1977
|
+
tooltipEffect: {},
|
|
1978
|
+
tooltipOptions: {},
|
|
1979
|
+
spanMethod: {},
|
|
1980
|
+
selectOnIndeterminate: {},
|
|
1981
|
+
indent: {},
|
|
1982
|
+
treeProps: {},
|
|
1983
|
+
lazy: {},
|
|
1984
|
+
load: {},
|
|
1985
|
+
className: {},
|
|
1986
|
+
style: {},
|
|
1987
|
+
tableLayout: {},
|
|
1988
|
+
scrollbarAlwaysOn: {},
|
|
1989
|
+
flexible: {},
|
|
1990
|
+
showOverflowTooltip: {},
|
|
1991
|
+
tooltipFormatter: {},
|
|
1992
|
+
appendFilterPanelTo: {},
|
|
1993
|
+
scrollbarTabindex: {},
|
|
1994
|
+
nativeScrollbar: {}
|
|
1995
|
+
},
|
|
1996
|
+
setup(__props) {
|
|
1997
|
+
const props = __props;
|
|
1998
|
+
const attrs = useAttrs();
|
|
1999
|
+
const { b } = useBemClass();
|
|
2000
|
+
const tableProps = computed(() => {
|
|
2001
|
+
return {
|
|
2002
|
+
...attrs,
|
|
2003
|
+
...props,
|
|
2004
|
+
columns: void 0,
|
|
2005
|
+
pagination: void 0
|
|
2006
|
+
};
|
|
2007
|
+
});
|
|
2008
|
+
const paginationProps = computed(() => {
|
|
2009
|
+
return {
|
|
2010
|
+
background: true,
|
|
2011
|
+
layout: "prev, pager, next, sizes, total",
|
|
2012
|
+
pageSizes: [10, 20, 50, 100],
|
|
2013
|
+
...props.pagination
|
|
2014
|
+
};
|
|
2015
|
+
});
|
|
2016
|
+
function handleSizeChange(size) {
|
|
2017
|
+
props.pagination.pageSize = size;
|
|
2018
|
+
}
|
|
2019
|
+
function handleCurrentChange(page) {
|
|
2020
|
+
props.pagination.currentPage = page;
|
|
2021
|
+
}
|
|
2022
|
+
return (_ctx, _cache) => {
|
|
2023
|
+
const _component_el_table = resolveComponent("el-table");
|
|
2024
|
+
const _component_el_pagination = resolveComponent("el-pagination");
|
|
2025
|
+
const _component_el_row = resolveComponent("el-row");
|
|
2026
|
+
return openBlock(), createElementBlock("div", null, [
|
|
2027
|
+
createVNode(_component_el_table, mergeProps(tableProps.value, {
|
|
2028
|
+
data: props.data
|
|
2029
|
+
}), {
|
|
2030
|
+
default: withCtx(() => [
|
|
2031
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(props.columns, (item) => {
|
|
2032
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
2033
|
+
key: item.prop || item.label,
|
|
2034
|
+
column: item
|
|
2035
|
+
}, createSlots({ _: 2 }, [
|
|
2036
|
+
renderList(_ctx.$slots, (_, slotName) => {
|
|
2037
|
+
return {
|
|
2038
|
+
name: slotName,
|
|
2039
|
+
fn: withCtx((scope) => [
|
|
2040
|
+
renderSlot(_ctx.$slots, slotName, mergeProps({ ref_for: true }, scope), void 0, true)
|
|
2041
|
+
])
|
|
2042
|
+
};
|
|
2043
|
+
})
|
|
2044
|
+
]), 1032, ["column"]);
|
|
2045
|
+
}), 128))
|
|
2046
|
+
]),
|
|
2047
|
+
_: 3
|
|
2048
|
+
}, 16, ["data"]),
|
|
2049
|
+
createVNode(_component_el_row, {
|
|
2050
|
+
justify: "end",
|
|
2051
|
+
class: normalizeClass(unref(b)("table-pagination"))
|
|
2052
|
+
}, {
|
|
2053
|
+
default: withCtx(() => [
|
|
2054
|
+
createVNode(_component_el_pagination, mergeProps(paginationProps.value, {
|
|
2055
|
+
"current-page": paginationProps.value.currentPage,
|
|
2056
|
+
"onUpdate:currentPage": _cache[0] || (_cache[0] = ($event) => paginationProps.value.currentPage = $event),
|
|
2057
|
+
"page-size": paginationProps.value.pageSize,
|
|
2058
|
+
"onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => paginationProps.value.pageSize = $event),
|
|
2059
|
+
onSizeChange: handleSizeChange,
|
|
2060
|
+
onCurrentChange: handleCurrentChange
|
|
2061
|
+
}), null, 16, ["current-page", "page-size"])
|
|
2062
|
+
]),
|
|
2063
|
+
_: 1
|
|
2064
|
+
}, 8, ["class"])
|
|
2065
|
+
]);
|
|
2066
|
+
};
|
|
2067
|
+
}
|
|
2068
|
+
});
|
|
2069
|
+
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b15a0f4d"]]);
|
|
2070
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2071
|
+
__name: "tabs",
|
|
2072
|
+
props: /* @__PURE__ */ mergeModels({
|
|
2073
|
+
type: { default: "" },
|
|
2074
|
+
options: { default: () => [] },
|
|
2075
|
+
size: { default: "medium" },
|
|
2076
|
+
inner: { type: Boolean, default: false },
|
|
2077
|
+
stretch: { type: Boolean }
|
|
2078
|
+
}, {
|
|
2079
|
+
"modelValue": {},
|
|
2080
|
+
"modelModifiers": {}
|
|
2081
|
+
}),
|
|
2082
|
+
emits: /* @__PURE__ */ mergeModels(["tabClick", "tabChange"], ["update:modelValue"]),
|
|
2083
|
+
setup(__props, { emit: __emit }) {
|
|
2084
|
+
const model = useModel(__props, "modelValue");
|
|
2085
|
+
const props = __props;
|
|
2086
|
+
const emits = __emit;
|
|
2087
|
+
const slots = useSlots();
|
|
2088
|
+
const { b } = useBemClass();
|
|
2089
|
+
const getClass = computed(() => {
|
|
2090
|
+
const arr = [b("tabs")];
|
|
2091
|
+
arr.push(b(`tabs--${props.size}`));
|
|
2092
|
+
if (props.inner) {
|
|
2093
|
+
arr.push(b("tabs--inner"));
|
|
2094
|
+
}
|
|
2095
|
+
return arr.join(" ");
|
|
2096
|
+
});
|
|
2097
|
+
return (_ctx, _cache) => {
|
|
2098
|
+
const _component_el_tab_pane = resolveComponent("el-tab-pane");
|
|
2099
|
+
const _component_el_tabs = resolveComponent("el-tabs");
|
|
2100
|
+
return openBlock(), createElementBlock("div", {
|
|
2101
|
+
class: normalizeClass(getClass.value)
|
|
2102
|
+
}, [
|
|
2103
|
+
createElementVNode("div", {
|
|
2104
|
+
class: normalizeClass(unref(b)("tabs__default"))
|
|
2105
|
+
}, [
|
|
2106
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
2107
|
+
createVNode(_component_el_tabs, {
|
|
2108
|
+
modelValue: model.value,
|
|
2109
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
2110
|
+
type: props.type,
|
|
2111
|
+
stretch: props.stretch,
|
|
2112
|
+
onTabClick: _cache[1] || (_cache[1] = (p, e) => emits("tabClick", p, e)),
|
|
2113
|
+
onTabChange: _cache[2] || (_cache[2] = ($event) => emits("tabChange", $event))
|
|
2114
|
+
}, {
|
|
2115
|
+
default: withCtx(() => [
|
|
2116
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(props.options, (item) => {
|
|
2117
|
+
return openBlock(), createBlock(_component_el_tab_pane, {
|
|
2118
|
+
key: item.name,
|
|
2119
|
+
name: item.name,
|
|
2120
|
+
disabled: item == null ? void 0 : item.disabled
|
|
2121
|
+
}, {
|
|
2122
|
+
label: withCtx(() => [
|
|
2123
|
+
renderSlot(_ctx.$slots, "label", { data: item }, () => [
|
|
2124
|
+
createTextVNode(toDisplayString(item.label), 1)
|
|
2125
|
+
], true)
|
|
2126
|
+
]),
|
|
2127
|
+
_: 2
|
|
2128
|
+
}, 1032, ["name", "disabled"]);
|
|
2129
|
+
}), 128))
|
|
2130
|
+
]),
|
|
2131
|
+
_: 3
|
|
2132
|
+
}, 8, ["modelValue", "type", "stretch"])
|
|
2133
|
+
], true)
|
|
2134
|
+
], 2),
|
|
2135
|
+
unref(slots).extra ? (openBlock(), createElementBlock("div", {
|
|
2136
|
+
key: 0,
|
|
2137
|
+
class: normalizeClass(unref(b)("tabs__extra"))
|
|
2138
|
+
}, [
|
|
2139
|
+
renderSlot(_ctx.$slots, "extra", {}, void 0, true)
|
|
2140
|
+
], 2)) : createCommentVNode("", true)
|
|
2141
|
+
], 2);
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
});
|
|
2145
|
+
const Tabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-81f370ec"]]);
|
|
2146
|
+
const createSelectDialog = (params) => {
|
|
2147
|
+
return function(options) {
|
|
2148
|
+
const { multiple = false, onOk, onBeforeOk, queryParams } = options;
|
|
2149
|
+
const DialogTableRef = ref();
|
|
2150
|
+
Dialog.open({
|
|
2151
|
+
title: params.title || options.title,
|
|
2152
|
+
content: () => h(params.component, {
|
|
2153
|
+
ref: (e) => DialogTableRef.value = e,
|
|
2154
|
+
multiple,
|
|
2155
|
+
queryParams,
|
|
2156
|
+
...params.componentProps
|
|
2157
|
+
}),
|
|
2158
|
+
style: { maxWidth: "960px" },
|
|
2159
|
+
bodyClass: params.bodyClass,
|
|
2160
|
+
onBeforeOk: async () => {
|
|
2161
|
+
var _a;
|
|
2162
|
+
if (!DialogTableRef.value.getSelectedData) {
|
|
2163
|
+
ElMessage.error("组件必须暴露getSelectedData方法");
|
|
2164
|
+
return false;
|
|
2165
|
+
}
|
|
2166
|
+
const data = (_a = DialogTableRef.value) == null ? void 0 : _a.getSelectedData();
|
|
2167
|
+
if (!data.length) {
|
|
2168
|
+
ElMessage.warning(params.tip || "请选择数据");
|
|
2169
|
+
return false;
|
|
2170
|
+
}
|
|
2171
|
+
if (onBeforeOk) {
|
|
2172
|
+
return await onBeforeOk(data);
|
|
2173
|
+
} else {
|
|
2174
|
+
onOk == null ? void 0 : onOk(data);
|
|
2175
|
+
return true;
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
});
|
|
2179
|
+
};
|
|
2180
|
+
};
|
|
2181
|
+
const components = {
|
|
2182
|
+
Button: _sfc_main$d,
|
|
2183
|
+
Card,
|
|
2184
|
+
Tabs,
|
|
2185
|
+
InputGroup,
|
|
2186
|
+
InputSearch,
|
|
2187
|
+
Grid,
|
|
2188
|
+
GridItem,
|
|
2189
|
+
Form,
|
|
2190
|
+
PageLayout,
|
|
2191
|
+
Dialog: _sfc_main$b,
|
|
2192
|
+
EditTable,
|
|
2193
|
+
Table
|
|
2194
|
+
};
|
|
2195
|
+
const GiButton = _sfc_main$d;
|
|
2196
|
+
const GiCard = Card;
|
|
2197
|
+
const GiTabs = Tabs;
|
|
2198
|
+
const GiInputGroup = InputGroup;
|
|
2199
|
+
const GiInputSearch = InputSearch;
|
|
2200
|
+
const GiGrid = Grid;
|
|
2201
|
+
const GiGridItem = GridItem;
|
|
2202
|
+
const GiForm = Form;
|
|
2203
|
+
const GiPageLayout = PageLayout;
|
|
2204
|
+
const GiDialog = _sfc_main$b;
|
|
2205
|
+
const GiEditTable = EditTable;
|
|
2206
|
+
const GiTable = Table;
|
|
2207
|
+
function capitalizeWord(word) {
|
|
2208
|
+
if (typeof word !== "string" || word.length === 0) {
|
|
2209
|
+
return word;
|
|
2210
|
+
}
|
|
2211
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
2212
|
+
}
|
|
2213
|
+
const index = {
|
|
2214
|
+
install(app, options) {
|
|
2215
|
+
const prefix = (options == null ? void 0 : options.prefix) || "Gi";
|
|
2216
|
+
Object.entries(components).forEach(([name, component]) => {
|
|
2217
|
+
app.component(`${capitalizeWord(prefix)}${name}`, component);
|
|
2218
|
+
});
|
|
2219
|
+
app.config.globalProperties.$config = options;
|
|
2220
|
+
}
|
|
2221
|
+
};
|
|
2222
|
+
export {
|
|
2223
|
+
Dialog,
|
|
2224
|
+
GiButton,
|
|
2225
|
+
GiCard,
|
|
2226
|
+
GiDialog,
|
|
2227
|
+
GiEditTable,
|
|
2228
|
+
GiForm,
|
|
2229
|
+
GiGrid,
|
|
2230
|
+
GiGridItem,
|
|
2231
|
+
GiInputGroup,
|
|
2232
|
+
GiInputSearch,
|
|
2233
|
+
GiPageLayout,
|
|
2234
|
+
GiTable,
|
|
2235
|
+
GiTabs,
|
|
2236
|
+
createDialog,
|
|
2237
|
+
createSelectDialog,
|
|
2238
|
+
index as default,
|
|
2239
|
+
useBemClass
|
|
2240
|
+
};
|
|
2241
|
+
//# sourceMappingURL=index.es.js.map
|