china-mobile-international-custom-components 0.0.37 → 0.0.38
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/es/PageContainer.mjs +315 -318
- package/es/assets/PageContainer.css +1 -1
- package/lib/PageContainer.js +1 -1
- package/lib/assets/PageContainer.css +1 -1
- package/package.json +4 -4
package/es/PageContainer.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { w as
|
|
2
|
-
import { ref as
|
|
3
|
-
import { C as
|
|
4
|
-
import { SearchBar as
|
|
5
|
-
import { IconZuo as
|
|
6
|
-
import { emitsMap as
|
|
7
|
-
import { ElIcon as
|
|
8
|
-
import { useRouter as
|
|
9
|
-
import { _ as
|
|
10
|
-
import './assets/PageContainer.css';const
|
|
1
|
+
import { w as ye } from "./chunks/index.bCzIhWFw.js";
|
|
2
|
+
import { ref as m, useSlots as he, computed as N, watch as W, onMounted as be, createElementBlock as v, openBlock as i, createCommentVNode as y, createElementVNode as S, renderSlot as E, createVNode as h, unref as n, withCtx as d, createBlock as c, resolveDynamicComponent as ke, toDisplayString as R, normalizeClass as J, mergeProps as Q, toHandlers as we, createSlots as X, normalizeStyle as Se, Fragment as O, renderList as D, createTextVNode as _, normalizeProps as Ce, guardReactiveProps as xe } from "vue";
|
|
3
|
+
import { C as ee } from "./chunks/layout.CWL6NVjA.js";
|
|
4
|
+
import { SearchBar as Ee } from "color-star-custom-components";
|
|
5
|
+
import { IconZuo as ze, IconMore as Pe, IconZuoCopy as Ie, IconYou as Ae } from "color-message-aibox-vue";
|
|
6
|
+
import { emitsMap as u, paginationConfig as T, pageParams as I, operationConfigMap as te } from "color-star-custom-methods";
|
|
7
|
+
import { ElIcon as K, ElAutoResizer as Ne, ElTable as De, ElTableColumn as U, ElButton as Re, ElDropdown as Oe, ElDropdownMenu as Te, ElDropdownItem as Be, ElScrollbar as Ve, ElPagination as $e } from "element-plus";
|
|
8
|
+
import { useRouter as je } from "vue-router";
|
|
9
|
+
import { _ as Fe } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
10
|
+
import './assets/PageContainer.css';const ae = {
|
|
11
11
|
ACTION: "action"
|
|
12
|
-
},
|
|
12
|
+
}, A = {
|
|
13
13
|
TABLE: "table",
|
|
14
14
|
CARD_INFINITE: "card-infinite"
|
|
15
|
-
},
|
|
15
|
+
}, Me = { class: "page-container flex flex-col overflow-hidden h-full" }, Le = { class: "text-1f2329 pd-l-4" }, We = { class: "action-buttons flex items-center" }, Ke = { class: "flex items-center w-full" }, Ue = { class: "flex-1" }, He = { class: "card-list" }, Ye = {
|
|
16
16
|
key: 3,
|
|
17
17
|
class: "pagination-section pd-t-16 flex justify-center"
|
|
18
|
-
},
|
|
18
|
+
}, Ze = /* @__PURE__ */ Object.assign({
|
|
19
19
|
name: "PageContainer"
|
|
20
20
|
}, {
|
|
21
21
|
__name: "layout",
|
|
@@ -81,8 +81,8 @@ import './assets/PageContainer.css';const le = {
|
|
|
81
81
|
pagination: {
|
|
82
82
|
type: Object,
|
|
83
83
|
default: () => ({
|
|
84
|
-
page:
|
|
85
|
-
size:
|
|
84
|
+
page: I.pageNum,
|
|
85
|
+
size: I.pageSize,
|
|
86
86
|
total: 0,
|
|
87
87
|
pageSizes: T.pageSizes,
|
|
88
88
|
layout: T.layout
|
|
@@ -120,8 +120,8 @@ import './assets/PageContainer.css';const le = {
|
|
|
120
120
|
// 显示模式:MODES.TABLE(表格) | MODES.CARD_INFINITE(无限滚动卡片)
|
|
121
121
|
mode: {
|
|
122
122
|
type: String,
|
|
123
|
-
default:
|
|
124
|
-
validator: (
|
|
123
|
+
default: A.TABLE,
|
|
124
|
+
validator: (l) => Object.values(A).includes(l)
|
|
125
125
|
},
|
|
126
126
|
// 是否显示复选框
|
|
127
127
|
showSelection: {
|
|
@@ -140,125 +140,125 @@ import './assets/PageContainer.css';const le = {
|
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
emits: [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
u.search,
|
|
144
|
+
u.reset,
|
|
145
|
+
u.actionClick,
|
|
146
|
+
u.paginationChange,
|
|
147
|
+
u.sizeChange,
|
|
148
|
+
u.dataLoaded,
|
|
149
|
+
u.dataError,
|
|
150
|
+
u.updateModelValue,
|
|
151
151
|
"selection-change"
|
|
152
152
|
],
|
|
153
|
-
setup(
|
|
154
|
-
const
|
|
155
|
-
page:
|
|
156
|
-
size:
|
|
153
|
+
setup(l, { expose: le, emit: ne }) {
|
|
154
|
+
const oe = je(), o = l, C = ne, re = m(null), B = m(null), ie = m(null), se = he(), V = m(!1), b = m([]), k = m({
|
|
155
|
+
page: I.pageNum,
|
|
156
|
+
size: I.pageSize,
|
|
157
157
|
total: 0,
|
|
158
158
|
pageSizes: T.pageSizes,
|
|
159
159
|
layout: T.layout
|
|
160
|
-
}), w =
|
|
161
|
-
() =>
|
|
162
|
-
),
|
|
163
|
-
() =>
|
|
160
|
+
}), w = m({ ...o.modelValue }), z = m(!1), P = m(!0), $ = m([...o.selection]), j = N(
|
|
161
|
+
() => o.api ? b.value : o.tableData
|
|
162
|
+
), p = N(
|
|
163
|
+
() => o.api ? k.value : o.pagination
|
|
164
164
|
), F = N(
|
|
165
|
-
() =>
|
|
166
|
-
), M = N(() =>
|
|
167
|
-
if (e.type ===
|
|
165
|
+
() => o.api ? V.value || z.value : o.tableProps.loading || z.value || !1
|
|
166
|
+
), M = N(() => o.mode === A.CARD_INFINITE), H = N(() => o.columns?.map((e) => {
|
|
167
|
+
if (e.type === ae.ACTION && (Array.isArray(e.actions) || typeof e.actions == "function"))
|
|
168
168
|
return {
|
|
169
169
|
...e,
|
|
170
170
|
align: "center",
|
|
171
171
|
fixed: "right"
|
|
172
172
|
};
|
|
173
|
-
const { width: t, ...
|
|
173
|
+
const { width: t, ...r } = e;
|
|
174
174
|
return {
|
|
175
|
-
...
|
|
175
|
+
...r,
|
|
176
176
|
minWidth: t
|
|
177
177
|
};
|
|
178
178
|
})), de = (e) => {
|
|
179
179
|
!M.value || !P.value || F.value || x({}, !0);
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
},
|
|
183
|
-
if (!
|
|
180
|
+
}, ue = (e, t) => e.id || e.bnid || e.key || `item-${t}`, fe = () => {
|
|
181
|
+
oe.back();
|
|
182
|
+
}, ce = (e, t) => t.formatter ? t.formatter(e[t.prop], e, t) : e[t.prop], pe = (e) => se[e] !== void 0, L = (e, t) => typeof e.actions == "function" ? e.actions(t) || [] : e.actions || [], ge = (e) => e.length < 3 ? e : e.slice(0, 1), Y = (e) => e.length < 3 ? [] : e.slice(1), x = (e = {}, t = !1) => {
|
|
183
|
+
if (!o.api) return;
|
|
184
184
|
if (t) {
|
|
185
185
|
if (!P.value || z.value) return;
|
|
186
186
|
z.value = !0;
|
|
187
187
|
} else
|
|
188
188
|
V.value = !0, M.value && (P.value = !0, z.value = !1);
|
|
189
|
-
const
|
|
189
|
+
const r = {
|
|
190
190
|
...e,
|
|
191
191
|
// 搜索参数等
|
|
192
|
-
...
|
|
192
|
+
...o.apiParams,
|
|
193
193
|
...w.value
|
|
194
194
|
};
|
|
195
|
-
|
|
196
|
-
const
|
|
195
|
+
o.showPagination && (t ? r.page = p.value.page + 1 : r.page = p.value.page, r.size = p.value.size), o.api(r).then((a) => {
|
|
196
|
+
const g = a?.data?.memberSo?.data || a?.data?.data || a?.data || [];
|
|
197
197
|
if (t) {
|
|
198
|
-
if (!
|
|
198
|
+
if (!g || g.length === 0) {
|
|
199
199
|
P.value = !1;
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
|
-
b.value = [...b.value, ...
|
|
202
|
+
b.value = [...b.value, ...g], k.value.page = r.page, k.value.total = a?.data?.memberSo?.total || a?.data?.total || b.value.length, g.length < p.value.size && (P.value = !1);
|
|
203
203
|
} else
|
|
204
|
-
console.log("newData",
|
|
205
|
-
C(
|
|
204
|
+
console.log("newData", g), b.value = g, k.value.total = a?.data?.memberSo?.total || a?.data?.total || 0;
|
|
205
|
+
C(u.dataLoaded, {
|
|
206
206
|
data: b.value,
|
|
207
207
|
pagination: k.value,
|
|
208
|
-
params:
|
|
209
|
-
response:
|
|
208
|
+
params: r,
|
|
209
|
+
response: a?.data,
|
|
210
210
|
isLoadMore: t
|
|
211
211
|
});
|
|
212
|
-
}).catch((
|
|
213
|
-
t ? P.value = !1 : (b.value = [], k.value.total = 0), C(
|
|
212
|
+
}).catch((a) => {
|
|
213
|
+
t ? P.value = !1 : (b.value = [], k.value.total = 0), C(u.dataError, a);
|
|
214
214
|
}).finally(() => {
|
|
215
215
|
t ? z.value = !1 : V.value = !1;
|
|
216
216
|
});
|
|
217
|
+
}, Z = () => {
|
|
218
|
+
o.api ? (k.value.page = I.pageNum, x()) : C(u.search, w.value);
|
|
217
219
|
}, q = () => {
|
|
218
|
-
n.api ? (k.value.page = A.pageNum, x()) : C(d.search, w.value);
|
|
219
|
-
}, G = () => {
|
|
220
220
|
const e = {};
|
|
221
221
|
Object.keys(w.value).forEach((t) => {
|
|
222
222
|
e[t] = void 0;
|
|
223
|
-
}), w.value = e,
|
|
224
|
-
},
|
|
225
|
-
C(
|
|
226
|
-
},
|
|
223
|
+
}), w.value = e, o.api ? (k.value.page = I.pageNum, x()) : C(u.reset);
|
|
224
|
+
}, G = (e, t, r) => {
|
|
225
|
+
C(u.actionClick, { action: e, row: t, index: r });
|
|
226
|
+
}, me = (e) => {
|
|
227
227
|
$.value = e, C("selection-change", e);
|
|
228
|
-
},
|
|
229
|
-
switch (
|
|
230
|
-
case
|
|
231
|
-
|
|
228
|
+
}, ve = (e, t) => {
|
|
229
|
+
switch (o.mode === A.CARD_INFINITE && (b.value = []), e) {
|
|
230
|
+
case te.search:
|
|
231
|
+
Z();
|
|
232
232
|
break;
|
|
233
|
-
case
|
|
234
|
-
|
|
233
|
+
case te.reset:
|
|
234
|
+
q();
|
|
235
235
|
break;
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
|
-
return
|
|
239
|
-
() =>
|
|
238
|
+
return W(
|
|
239
|
+
() => o.modelValue,
|
|
240
240
|
(e) => {
|
|
241
241
|
w.value = { ...e };
|
|
242
242
|
},
|
|
243
243
|
{ deep: !0, immediate: !0 }
|
|
244
|
-
),
|
|
245
|
-
() =>
|
|
244
|
+
), W(
|
|
245
|
+
() => o.selection,
|
|
246
246
|
(e) => {
|
|
247
247
|
$.value = [...e];
|
|
248
248
|
},
|
|
249
249
|
{ deep: !0, immediate: !0 }
|
|
250
|
-
),
|
|
250
|
+
), W(
|
|
251
251
|
() => w.value,
|
|
252
252
|
(e) => {
|
|
253
|
-
C(
|
|
253
|
+
C(u.updateModelValue, { ...e });
|
|
254
254
|
},
|
|
255
255
|
{ deep: !0 }
|
|
256
|
-
),
|
|
257
|
-
|
|
258
|
-
}),
|
|
256
|
+
), be(() => {
|
|
257
|
+
o.autoLoad && o.api && x();
|
|
258
|
+
}), le({
|
|
259
259
|
loadData: x,
|
|
260
|
-
handleSearch:
|
|
261
|
-
handleReset:
|
|
260
|
+
handleSearch: Z,
|
|
261
|
+
handleReset: q,
|
|
262
262
|
// 复选框相关方法
|
|
263
263
|
clearSelection: () => B.value?.clearSelection?.(),
|
|
264
264
|
toggleAllSelection: () => B.value?.toggleAllSelection?.(),
|
|
@@ -274,253 +274,250 @@ import './assets/PageContainer.css';const le = {
|
|
|
274
274
|
// handleReset()
|
|
275
275
|
// }
|
|
276
276
|
// },
|
|
277
|
-
}), (e, t) =>
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
277
|
+
}), (e, t) => (i(), v("div", Me, [
|
|
278
|
+
l.breadcrumb.show ? (i(), v("div", {
|
|
279
|
+
key: 0,
|
|
280
|
+
class: "flex items-center fz-14 pd-b-20 pointer",
|
|
281
|
+
onClick: fe
|
|
282
|
+
}, [
|
|
283
|
+
h(n(K), { size: 16 }, {
|
|
284
|
+
default: d(() => [
|
|
285
|
+
(i(), c(ke(l.breadcrumb.icon || n(ze))))
|
|
286
|
+
]),
|
|
287
|
+
_: 1
|
|
288
|
+
}),
|
|
289
|
+
S("span", Le, R(l.breadcrumb.text), 1)
|
|
290
|
+
])) : y("", !0),
|
|
291
|
+
l.searchFields?.length ? (i(), v("div", {
|
|
292
|
+
key: 1,
|
|
293
|
+
class: J({
|
|
294
|
+
"search-section pd-b-12 mg-b-12": !l.isSeparate,
|
|
295
|
+
"bg-fff radius-4 pd-l-16 pd-r-16 pd-t-16 pd-b-16": l.isSeparate
|
|
296
|
+
})
|
|
297
|
+
}, [
|
|
298
|
+
h(ee, { title: "查询" }),
|
|
299
|
+
h(n(Ee), {
|
|
300
|
+
ref_key: "searchFormRef",
|
|
301
|
+
ref: re,
|
|
302
|
+
items: l.searchFields,
|
|
303
|
+
"filter-mode": !1,
|
|
304
|
+
minWidth: l.minWidth,
|
|
305
|
+
hideExpandButton: !1,
|
|
306
|
+
fixedWidth: !0,
|
|
307
|
+
maxHeight: 32,
|
|
308
|
+
modelValue: w.value,
|
|
309
|
+
"onUpdate:modelValue": t[0] || (t[0] = (r) => w.value = r),
|
|
310
|
+
onOperation: ve
|
|
311
|
+
}, null, 8, ["items", "minWidth", "modelValue"])
|
|
312
|
+
], 2)) : y("", !0),
|
|
313
|
+
S("div", {
|
|
314
|
+
class: J(["data-section flex-1 overflow-hidden flex flex-col", {
|
|
315
|
+
"bg-fff radius-4 pd-l-16 pd-r-16 pd-t-16 pd-b-16 mg-t-16": l.isSeparate
|
|
316
|
+
}])
|
|
317
|
+
}, [
|
|
318
|
+
l.title ? E(e.$slots, "title", { key: 0 }, () => [
|
|
319
|
+
h(ee, { title: l.title }, {
|
|
320
|
+
default: d(() => [
|
|
321
|
+
E(e.$slots, "title-actions", {}, void 0, !0)
|
|
288
322
|
]),
|
|
289
|
-
_:
|
|
290
|
-
})
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
a.searchFields?.length ? (r(), v("div", {
|
|
323
|
+
_: 3
|
|
324
|
+
}, 8, ["title"])
|
|
325
|
+
], !0) : y("", !0),
|
|
326
|
+
l.mode === n(A).TABLE ? (i(), c(n(Ne), {
|
|
294
327
|
key: 1,
|
|
295
|
-
class:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
328
|
+
class: "flex-1 overflow-hidden"
|
|
329
|
+
}, {
|
|
330
|
+
default: d(({ width: r }) => [
|
|
331
|
+
h(n(De), Q({
|
|
332
|
+
ref_key: "tableRef",
|
|
333
|
+
ref: B,
|
|
334
|
+
data: j.value,
|
|
335
|
+
columns: H.value,
|
|
336
|
+
"tree-props": l.treeProps,
|
|
337
|
+
"show-overflow-tooltip": !0,
|
|
338
|
+
"row-key": l.treeProps.value || l.tableProps.rowKey
|
|
339
|
+
}, { ...l.tableProps, loading: F.value }, we(l.tableEvents), {
|
|
340
|
+
class: "w-full h-full admin-dashboard-table",
|
|
341
|
+
border: "",
|
|
342
|
+
onSelectionChange: me
|
|
343
|
+
}), X({
|
|
344
|
+
default: d(() => [
|
|
345
|
+
l.showSelection ? (i(), c(n(U), {
|
|
346
|
+
key: 0,
|
|
347
|
+
type: "selection",
|
|
348
|
+
width: "55",
|
|
349
|
+
fixed: "left"
|
|
350
|
+
})) : y("", !0),
|
|
351
|
+
l.hasExpand ? (i(), c(n(U), {
|
|
352
|
+
key: 1,
|
|
353
|
+
width: "1",
|
|
354
|
+
type: "expand",
|
|
355
|
+
fixed: "left"
|
|
356
|
+
}, {
|
|
357
|
+
default: d((a) => [
|
|
358
|
+
S("div", {
|
|
359
|
+
class: "sticky-left",
|
|
360
|
+
style: Se({ width: r + "px" })
|
|
361
|
+
}, [
|
|
362
|
+
E(e.$slots, "expand", {
|
|
363
|
+
row: a.row
|
|
364
|
+
}, void 0, !0)
|
|
365
|
+
], 4)
|
|
366
|
+
]),
|
|
367
|
+
_: 2
|
|
368
|
+
}, 1024)) : y("", !0),
|
|
369
|
+
(i(!0), v(O, null, D(H.value, (a, g) => (i(), c(n(U), Q({
|
|
370
|
+
key: a.prop
|
|
371
|
+
}, { ref_for: !0 }, a), X({ _: 2 }, [
|
|
372
|
+
a.type === n(ae).ACTION ? {
|
|
373
|
+
name: "default",
|
|
374
|
+
fn: d((f) => [
|
|
375
|
+
S("div", We, [
|
|
376
|
+
(i(!0), v(O, null, D(ge(
|
|
377
|
+
L(a, f.row)
|
|
378
|
+
), (s) => (i(), c(n(Re), {
|
|
379
|
+
key: s.key || s.label,
|
|
380
|
+
type: s.type || "primary",
|
|
381
|
+
size: s.size || "small",
|
|
382
|
+
disabled: s.disabled,
|
|
383
|
+
loading: s.loading,
|
|
384
|
+
text: s.text,
|
|
385
|
+
link: s.link,
|
|
386
|
+
icon: s.icon,
|
|
387
|
+
onClick: (Ge) => G(s, f.row, f.$index)
|
|
388
|
+
}, {
|
|
389
|
+
default: d(() => [
|
|
390
|
+
_(R(s.label), 1)
|
|
391
|
+
]),
|
|
392
|
+
_: 2
|
|
393
|
+
}, 1032, ["type", "size", "disabled", "loading", "text", "link", "icon", "onClick"]))), 128)),
|
|
394
|
+
Y(L(a, f.row)).length > 0 ? (i(), c(n(Oe), {
|
|
395
|
+
key: 0,
|
|
396
|
+
onCommand: (s) => G(s, f.row, f.$index),
|
|
397
|
+
trigger: "click"
|
|
398
|
+
}, {
|
|
399
|
+
dropdown: d(() => [
|
|
400
|
+
h(n(Te), null, {
|
|
401
|
+
default: d(() => [
|
|
402
|
+
(i(!0), v(O, null, D(Y(
|
|
403
|
+
L(a, f.row)
|
|
404
|
+
), (s) => (i(), c(n(Be), {
|
|
405
|
+
key: s.key || s.label,
|
|
406
|
+
command: s,
|
|
407
|
+
disabled: s.disabled
|
|
408
|
+
}, {
|
|
409
|
+
default: d(() => [
|
|
410
|
+
_(R(s.label), 1)
|
|
411
|
+
]),
|
|
412
|
+
_: 2
|
|
413
|
+
}, 1032, ["command", "disabled"]))), 128))
|
|
414
|
+
]),
|
|
415
|
+
_: 2
|
|
416
|
+
}, 1024)
|
|
417
|
+
]),
|
|
418
|
+
default: d(() => [
|
|
419
|
+
h(n(K), null, {
|
|
420
|
+
default: d(() => [
|
|
421
|
+
h(n(Pe))
|
|
422
|
+
]),
|
|
423
|
+
_: 1
|
|
424
|
+
})
|
|
425
|
+
]),
|
|
426
|
+
_: 2
|
|
427
|
+
}, 1032, ["onCommand"])) : y("", !0)
|
|
428
|
+
])
|
|
368
429
|
]),
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
key:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
loading: s.loading,
|
|
386
|
-
text: s.text,
|
|
387
|
-
link: s.link,
|
|
388
|
-
icon: s.icon,
|
|
389
|
-
onClick: (Je) => J(s, f.row, f.$index)
|
|
390
|
-
}, {
|
|
391
|
-
default: u(() => [
|
|
392
|
-
ee(D(s.label), 1)
|
|
393
|
-
]),
|
|
394
|
-
_: 2
|
|
395
|
-
}, 1032, ["type", "size", "disabled", "loading", "text", "link", "icon", "onClick"]))), 128)),
|
|
396
|
-
Z(L(l, f.row)).length > 0 ? (r(), p(i(Te), {
|
|
397
|
-
key: 0,
|
|
398
|
-
onCommand: (s) => J(s, f.row, f.$index),
|
|
399
|
-
trigger: "click"
|
|
400
|
-
}, {
|
|
401
|
-
dropdown: u(() => [
|
|
402
|
-
h(i(Be), null, {
|
|
403
|
-
default: u(() => [
|
|
404
|
-
(r(!0), v(O, null, R(Z(
|
|
405
|
-
L(l, f.row)
|
|
406
|
-
), (s) => (r(), p(i(Ve), {
|
|
407
|
-
key: s.key || s.label,
|
|
408
|
-
command: s,
|
|
409
|
-
disabled: s.disabled
|
|
410
|
-
}, {
|
|
411
|
-
default: u(() => [
|
|
412
|
-
ee(D(s.label), 1)
|
|
413
|
-
]),
|
|
414
|
-
_: 2
|
|
415
|
-
}, 1032, ["command", "disabled"]))), 128))
|
|
416
|
-
]),
|
|
417
|
-
_: 2
|
|
418
|
-
}, 1024)
|
|
419
|
-
]),
|
|
420
|
-
default: u(() => [
|
|
421
|
-
h(i(U), null, {
|
|
422
|
-
default: u(() => [
|
|
423
|
-
h(i(Ie))
|
|
424
|
-
]),
|
|
425
|
-
_: 1
|
|
426
|
-
})
|
|
427
|
-
]),
|
|
428
|
-
_: 2
|
|
429
|
-
}, 1032, ["onCommand"])) : y("", !0)
|
|
430
|
-
])
|
|
431
|
-
]),
|
|
432
|
-
key: "0"
|
|
433
|
-
} : me(l.prop) ? {
|
|
434
|
-
name: "default",
|
|
435
|
-
fn: u((f) => [
|
|
430
|
+
key: "0"
|
|
431
|
+
} : pe(a.prop) ? {
|
|
432
|
+
name: "default",
|
|
433
|
+
fn: d((f) => [
|
|
434
|
+
S("div", Ke, [
|
|
435
|
+
g === 0 && l.hasExpand ? (i(), c(n(K), {
|
|
436
|
+
key: 0,
|
|
437
|
+
class: "mg-r-10"
|
|
438
|
+
}, {
|
|
439
|
+
default: d(() => [
|
|
440
|
+
l.tableProps?.expandRowKeys?.includes(
|
|
441
|
+
f.row[l.tableProps.rowKey]
|
|
442
|
+
) ? (i(), c(n(Ie), { key: 0 })) : (i(), c(n(Ae), { key: 1 }))
|
|
443
|
+
]),
|
|
444
|
+
_: 2
|
|
445
|
+
}, 1024)) : y("", !0),
|
|
436
446
|
S("div", Ue, [
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
a.tableProps?.expandRowKeys?.includes(
|
|
443
|
-
f.row[a.tableProps.rowKey]
|
|
444
|
-
) ? (r(), p(i(Ne), { key: 0 })) : (r(), p(i(Re), { key: 1 }))
|
|
445
|
-
]),
|
|
446
|
-
_: 2
|
|
447
|
-
}, 1024)) : y("", !0),
|
|
448
|
-
S("div", He, [
|
|
449
|
-
E(e.$slots, l.prop, {
|
|
450
|
-
row: f.row,
|
|
451
|
-
index: f.$index,
|
|
452
|
-
column: l
|
|
453
|
-
}, void 0, !0)
|
|
454
|
-
])
|
|
447
|
+
E(e.$slots, a.prop, {
|
|
448
|
+
row: f.row,
|
|
449
|
+
index: f.$index,
|
|
450
|
+
column: a
|
|
451
|
+
}, void 0, !0)
|
|
455
452
|
])
|
|
456
|
-
])
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
]),
|
|
467
|
-
|
|
453
|
+
])
|
|
454
|
+
]),
|
|
455
|
+
key: "1"
|
|
456
|
+
} : {
|
|
457
|
+
name: "default",
|
|
458
|
+
fn: d((f) => [
|
|
459
|
+
S("span", null, R(ce(f.row, a)), 1)
|
|
460
|
+
]),
|
|
461
|
+
key: "2"
|
|
462
|
+
}
|
|
463
|
+
]), 1040))), 128))
|
|
464
|
+
]),
|
|
465
|
+
_: 2
|
|
466
|
+
}, [
|
|
467
|
+
D(l.customSlots, (a) => ({
|
|
468
|
+
name: a,
|
|
469
|
+
fn: d((g) => [
|
|
470
|
+
E(e.$slots, a, Ce(xe(g)), void 0, !0)
|
|
471
|
+
])
|
|
472
|
+
}))
|
|
473
|
+
]), 1040, ["data", "columns", "tree-props", "row-key"])
|
|
474
|
+
]),
|
|
475
|
+
_: 3
|
|
476
|
+
})) : l.mode === n(A).CARD_INFINITE ? (i(), c(n(Ve), {
|
|
477
|
+
key: 2,
|
|
478
|
+
ref_key: "scrollbarRef",
|
|
479
|
+
ref: ie,
|
|
480
|
+
class: "card-container flex-1",
|
|
481
|
+
onEndReached: de
|
|
482
|
+
}, {
|
|
483
|
+
default: d(() => [
|
|
484
|
+
S("div", He, [
|
|
485
|
+
(i(!0), v(O, null, D(j.value, (r, a) => (i(), v("div", {
|
|
486
|
+
key: ue(r, a),
|
|
487
|
+
class: "card-item"
|
|
468
488
|
}, [
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
})
|
|
475
|
-
]),
|
|
476
|
-
])
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}, void 0, !0)
|
|
497
|
-
]))), 128))
|
|
498
|
-
])
|
|
499
|
-
]),
|
|
500
|
-
_: 3
|
|
501
|
-
}, 512)) : y("", !0),
|
|
502
|
-
a.showPagination && !M.value ? (r(), v("div", Ze, [
|
|
503
|
-
h(i(je), {
|
|
504
|
-
"current-page": m.value.page,
|
|
505
|
-
"onUpdate:currentPage": t[1] || (t[1] = (o) => m.value.page = o),
|
|
506
|
-
"page-size": m.value.size,
|
|
507
|
-
"onUpdate:pageSize": t[2] || (t[2] = (o) => m.value.size = o),
|
|
508
|
-
"page-sizes": m.value.pageSizes,
|
|
509
|
-
total: m.value.total,
|
|
510
|
-
layout: m.value.layout,
|
|
511
|
-
onSizeChange: x,
|
|
512
|
-
onCurrentChange: x
|
|
513
|
-
}, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"])
|
|
514
|
-
])) : y("", !0)
|
|
515
|
-
], 2),
|
|
516
|
-
E(e.$slots, "default", {}, void 0, !0)
|
|
517
|
-
]);
|
|
518
|
-
};
|
|
489
|
+
E(e.$slots, "card", {
|
|
490
|
+
item: r,
|
|
491
|
+
index: a,
|
|
492
|
+
data: j.value,
|
|
493
|
+
loading: F.value
|
|
494
|
+
}, void 0, !0)
|
|
495
|
+
]))), 128))
|
|
496
|
+
])
|
|
497
|
+
]),
|
|
498
|
+
_: 3
|
|
499
|
+
}, 512)) : y("", !0),
|
|
500
|
+
l.showPagination && !M.value ? (i(), v("div", Ye, [
|
|
501
|
+
h(n($e), {
|
|
502
|
+
"current-page": p.value.page,
|
|
503
|
+
"onUpdate:currentPage": t[1] || (t[1] = (r) => p.value.page = r),
|
|
504
|
+
"page-size": p.value.size,
|
|
505
|
+
"onUpdate:pageSize": t[2] || (t[2] = (r) => p.value.size = r),
|
|
506
|
+
"page-sizes": p.value.pageSizes,
|
|
507
|
+
total: p.value.total,
|
|
508
|
+
layout: p.value.layout,
|
|
509
|
+
onSizeChange: x,
|
|
510
|
+
onCurrentChange: x
|
|
511
|
+
}, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout"])
|
|
512
|
+
])) : y("", !0)
|
|
513
|
+
], 2),
|
|
514
|
+
E(e.$slots, "default", {}, void 0, !0)
|
|
515
|
+
]));
|
|
519
516
|
}
|
|
520
|
-
}),
|
|
517
|
+
}), qe = /* @__PURE__ */ Fe(Ze, [["__scopeId", "data-v-d9594fc8"]]), ot = ye(qe);
|
|
521
518
|
export {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
519
|
+
ae as COLUMN_TYPES,
|
|
520
|
+
A as MODES,
|
|
521
|
+
ot as PageContainer,
|
|
522
|
+
ot as default
|
|
526
523
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.search-section[data-v-
|
|
1
|
+
.search-section[data-v-d9594fc8]{border-bottom:1px solid var(--border-color)}.action-buttons[data-v-d9594fc8]{gap:8px;flex-wrap:wrap}.bg-fff[data-v-d9594fc8]{background-color:var(--background-color-2);border:1px solid var(--border-color)}.card-list[data-v-d9594fc8]{display:grid;grid-template-columns:repeat(auto-fill,minmax(306px,1fr));gap:16px}[data-v-d9594fc8] .el-table__expand-column .el-icon{display:none}[data-v-d9594fc8] .el-table__cell.el-table__expanded-cell{position:relative}[data-v-d9594fc8] .el-table__cell.el-table__expanded-cell .sticky-left{position:sticky;left:0;top:0;z-index:10}
|
package/lib/PageContainer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/PageContainer.css');const X=require("./chunks/index.CkihWzK6.js"),e=require("vue"),R=require("./chunks/layout.DC4lrADH.js"),_=require("color-star-custom-components"),C=require("color-message-aibox-vue"),o=require("color-star-custom-methods"),d=require("element-plus"),ee=require("vue-router"),te=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),z={ACTION:"action"},y={TABLE:"table",CARD_INFINITE:"card-infinite"},ae={class:"page-container flex flex-col overflow-hidden h-full"},le={class:"text-1f2329 pd-l-4"},oe={class:"action-buttons flex items-center"},ne={class:"flex items-center w-full"},re={class:"flex-1"},ie={class:"card-list"},se={key:3,class:"pagination-section pd-t-16 flex justify-center"},ue=Object.assign({name:"PageContainer"},{__name:"layout",props:{breadcrumb:{type:Object,default:()=>({show:!1,text:""})},title:{type:String,default:""},searchFields:{type:Array,default:()=>[]},modelValue:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},tableProps:{type:Object,default:()=>({stripe:!0,border:!1})},treeProps:{type:Object,default:()=>({})},tableEvents:{type:Object,default:()=>({})},showPagination:{type:Boolean,default:!0},pagination:{type:Object,default:()=>({page:o.pageParams.pageNum,size:o.pageParams.pageSize,total:0,pageSizes:o.paginationConfig.pageSizes,layout:o.paginationConfig.layout})},customSlots:{type:Array,default:()=>[]},api:{type:Function,default:null},autoLoad:{type:Boolean,default:!0},apiParams:{type:Object,default:()=>({})},isSeparate:{type:Boolean,default:!1},minWidth:{type:Number,default:290},mode:{type:String,default:y.TABLE,validator:l=>Object.values(y).includes(l)},showSelection:{type:Boolean,default:!1},selection:{type:Array,default:()=>[]},hasExpand:{type:Boolean,default:!1}},emits:[o.emitsMap.search,o.emitsMap.reset,o.emitsMap.actionClick,o.emitsMap.paginationChange,o.emitsMap.sizeChange,o.emitsMap.dataLoaded,o.emitsMap.dataError,o.emitsMap.updateModelValue,"selection-change"],setup(l,{expose:F,emit:j}){const L=ee.useRouter(),r=l,h=j,$=e.ref(null),w=e.ref(null),q=e.ref(null),W=e.useSlots(),S=e.ref(!1),p=e.ref([]),m=e.ref({page:o.pageParams.pageNum,size:o.pageParams.pageSize,total:0,pageSizes:o.paginationConfig.pageSizes,layout:o.paginationConfig.layout}),g=e.ref({...r.modelValue}),k=e.ref(!1),b=e.ref(!0),B=e.ref([...r.selection]),E=e.computed(()=>r.api?p.value:r.tableData),f=e.computed(()=>r.api?m.value:r.pagination),x=e.computed(()=>r.api?S.value||k.value:r.tableProps.loading||k.value||!1),N=e.computed(()=>r.mode===y.CARD_INFINITE),M=e.computed(()=>r.columns?.map(t=>{if(t.type===z.ACTION&&(Array.isArray(t.actions)||typeof t.actions=="function"))return{...t,align:"center",fixed:"right"};const{width:a,...c}=t;return{...c,minWidth:a}})),U=t=>{!N.value||!b.value||x.value||v({},!0)},K=(t,a)=>t.id||t.bnid||t.key||`item-${a}`,H=()=>{L.back()},Y=(t,a)=>a.formatter?a.formatter(t[a.prop],t,a):t[a.prop],Z=t=>W[t]!==void 0,V=(t,a)=>typeof t.actions=="function"?t.actions(a)||[]:t.actions||[],G=t=>t.length<3?t:t.slice(0,1),I=t=>t.length<3?[]:t.slice(1),v=(t={},a=!1)=>{if(!r.api)return;if(a){if(!b.value||k.value)return;k.value=!0}else S.value=!0,N.value&&(b.value=!0,k.value=!1);const c={...t,...r.apiParams,...g.value};r.showPagination&&(a?c.page=f.value.page+1:c.page=f.value.page,c.size=f.value.size),r.api(c).then(i=>{const n=i?.data?.memberSo?.data||i?.data?.data||i?.data||[];if(a){if(!n||n.length===0){b.value=!1;return}p.value=[...p.value,...n],m.value.page=c.page,m.value.total=i?.data?.memberSo?.total||i?.data?.total||p.value.length,n.length<f.value.size&&(b.value=!1)}else console.log("newData",n),p.value=n,m.value.total=i?.data?.memberSo?.total||i?.data?.total||0;h(o.emitsMap.dataLoaded,{data:p.value,pagination:m.value,params:c,response:i?.data,isLoadMore:a})}).catch(i=>{a?b.value=!1:(p.value=[],m.value.total=0),h(o.emitsMap.dataError,i)}).finally(()=>{a?k.value=!1:S.value=!1})},A=()=>{r.api?(m.value.page=o.pageParams.pageNum,v()):h(o.emitsMap.search,g.value)},D=()=>{const t={};Object.keys(g.value).forEach(a=>{t[a]=void 0}),g.value=t,r.api?(m.value.page=o.pageParams.pageNum,v()):h(o.emitsMap.reset)},T=(t,a,c)=>{h(o.emitsMap.actionClick,{action:t,row:a,index:c})},J=t=>{B.value=t,h("selection-change",t)},Q=(t,a)=>{switch(r.mode===y.CARD_INFINITE&&(p.value=[]),t){case o.operationConfigMap.search:A();break;case o.operationConfigMap.reset:D();break}};return e.watch(()=>r.modelValue,t=>{g.value={...t}},{deep:!0,immediate:!0}),e.watch(()=>r.selection,t=>{B.value=[...t]},{deep:!0,immediate:!0}),e.watch(()=>g.value,t=>{h(o.emitsMap.updateModelValue,{...t})},{deep:!0}),e.onMounted(()=>{r.autoLoad&&r.api&&v()}),F({loadData:v,handleSearch:A,handleReset:D,clearSelection:()=>w.value?.clearSelection?.(),toggleAllSelection:()=>w.value?.toggleAllSelection?.(),getSelectionRows:()=>B.value}),(t,a)=>{const c=e.resolveComponent("ElAutoResizer");return e.openBlock(),e.createElementBlock("div",ae,[l.breadcrumb.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:"flex items-center fz-14 pd-b-20 pointer",onClick:H},[e.createVNode(e.unref(d.ElIcon),{size:16},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.breadcrumb.icon||e.unref(C.IconZuo))))]),_:1}),e.createElementVNode("span",le,e.toDisplayString(l.breadcrumb.text),1)])):e.createCommentVNode("",!0),l.searchFields?.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"search-section pd-b-12 mg-b-12":!l.isSeparate,"bg-fff radius-4 pd-l-16 pd-r-16 pd-t-16 pd-b-16":l.isSeparate})},[e.createVNode(R.CustomTitle,{title:"查询"}),e.createVNode(e.unref(_.SearchBar),{ref_key:"searchFormRef",ref:$,items:l.searchFields,"filter-mode":!1,minWidth:l.minWidth,hideExpandButton:!1,fixedWidth:!0,maxHeight:32,modelValue:g.value,"onUpdate:modelValue":a[0]||(a[0]=i=>g.value=i),onOperation:Q},null,8,["items","minWidth","modelValue"])],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["data-section flex-1 overflow-hidden flex flex-col",{"bg-fff radius-4 pd-l-16 pd-r-16 pd-t-16 pd-b-16 mg-t-16":l.isSeparate}])},[l.title?e.renderSlot(t.$slots,"title",{key:0},()=>[e.createVNode(R.CustomTitle,{title:l.title},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"title-actions",{},void 0,!0)]),_:3},8,["title"])],!0):e.createCommentVNode("",!0),l.mode===e.unref(y).TABLE?(e.openBlock(),e.createBlock(c,{key:1,class:"flex-1 overflow-hidden"},{default:e.withCtx(({width:i})=>[e.createVNode(e.unref(d.ElTable),e.mergeProps({ref_key:"tableRef",ref:w,data:E.value,columns:M.value,"tree-props":l.treeProps,"show-overflow-tooltip":!0,"row-key":l.treeProps.value||l.tableProps.rowKey},{...l.tableProps,loading:x.value},e.toHandlers(l.tableEvents),{class:"w-full h-full admin-dashboard-table",border:"",onSelectionChange:J}),e.createSlots({default:e.withCtx(()=>[l.showSelection?(e.openBlock(),e.createBlock(e.unref(d.ElTableColumn),{key:0,type:"selection",width:"55",fixed:"left"})):e.createCommentVNode("",!0),l.hasExpand?(e.openBlock(),e.createBlock(e.unref(d.ElTableColumn),{key:1,width:"1",type:"expand",fixed:"left"},{default:e.withCtx(n=>[e.createElementVNode("div",{class:"sticky-left",style:e.normalizeStyle({width:i+"px"})},[e.renderSlot(t.$slots,"expand",{row:n.row},void 0,!0)],4)]),_:2},1024)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,(n,P)=>(e.openBlock(),e.createBlock(e.unref(d.ElTableColumn),e.mergeProps({key:n.prop},{ref_for:!0},n),e.createSlots({_:2},[n.type===e.unref(z).ACTION?{name:"default",fn:e.withCtx(u=>[e.createElementVNode("div",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(G(V(n,u.row)),s=>(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:s.key||s.label,type:s.type||"primary",size:s.size||"small",disabled:s.disabled,loading:s.loading,text:s.text,link:s.link,icon:s.icon,onClick:ce=>T(s,u.row,u.$index)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.label),1)]),_:2},1032,["type","size","disabled","loading","text","link","icon","onClick"]))),128)),I(V(n,u.row)).length>0?(e.openBlock(),e.createBlock(e.unref(d.ElDropdown),{key:0,onCommand:s=>T(s,u.row,u.$index),trigger:"click"},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(d.ElDropdownMenu),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I(V(n,u.row)),s=>(e.openBlock(),e.createBlock(e.unref(d.ElDropdownItem),{key:s.key||s.label,command:s,disabled:s.disabled},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.label),1)]),_:2},1032,["command","disabled"]))),128))]),_:2},1024)]),default:e.withCtx(()=>[e.createVNode(e.unref(d.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(C.IconMore))]),_:1})]),_:2},1032,["onCommand"])):e.createCommentVNode("",!0)])]),key:"0"}:Z(n.prop)?{name:"default",fn:e.withCtx(u=>[e.createElementVNode("div",ne,[P===0&&l.hasExpand?(e.openBlock(),e.createBlock(e.unref(d.ElIcon),{key:0,class:"mg-r-10"},{default:e.withCtx(()=>[l.tableProps?.expandRowKeys?.includes(u.row[l.tableProps.rowKey])?(e.openBlock(),e.createBlock(e.unref(C.IconZuoCopy),{key:0})):(e.openBlock(),e.createBlock(e.unref(C.IconYou),{key:1}))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("div",re,[e.renderSlot(t.$slots,n.prop,{row:u.row,index:u.$index,column:n},void 0,!0)])])]),key:"1"}:{name:"default",fn:e.withCtx(u=>[e.createElementVNode("span",null,e.toDisplayString(Y(u.row,n)),1)]),key:"2"}]),1040))),128))]),_:2},[e.renderList(l.customSlots,n=>({name:n,fn:e.withCtx(P=>[e.renderSlot(t.$slots,n,e.normalizeProps(e.guardReactiveProps(P)),void 0,!0)])}))]),1040,["data","columns","tree-props","row-key"])]),_:3})):l.mode===e.unref(y).CARD_INFINITE?(e.openBlock(),e.createBlock(e.unref(d.ElScrollbar),{key:2,ref_key:"scrollbarRef",ref:q,class:"card-container flex-1",onEndReached:U},{default:e.withCtx(()=>[e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,(i,n)=>(e.openBlock(),e.createElementBlock("div",{key:K(i,n),class:"card-item"},[e.renderSlot(t.$slots,"card",{item:i,index:n,data:E.value,loading:x.value},void 0,!0)]))),128))])]),_:3},512)):e.createCommentVNode("",!0),l.showPagination&&!N.value?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(d.ElPagination),{"current-page":f.value.page,"onUpdate:currentPage":a[1]||(a[1]=i=>f.value.page=i),"page-size":f.value.size,"onUpdate:pageSize":a[2]||(a[2]=i=>f.value.size=i),"page-sizes":f.value.pageSizes,total:f.value.total,layout:f.value.layout,onSizeChange:v,onCurrentChange:v},null,8,["current-page","page-size","page-sizes","total","layout"])])):e.createCommentVNode("",!0)],2),e.renderSlot(t.$slots,"default",{},void 0,!0)])}}}),de=te._export_sfc(ue,[["__scopeId","data-v-5b5cf5e5"]]),O=X.withInstall(de);exports.COLUMN_TYPES=z;exports.MODES=y;exports.PageContainer=O;exports.default=O;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/PageContainer.css');const Q=require("./chunks/index.CkihWzK6.js"),e=require("vue"),T=require("./chunks/layout.DC4lrADH.js"),X=require("color-star-custom-components"),C=require("color-message-aibox-vue"),o=require("color-star-custom-methods"),s=require("element-plus"),_=require("vue-router"),ee=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),P={ACTION:"action"},y={TABLE:"table",CARD_INFINITE:"card-infinite"},te={class:"page-container flex flex-col overflow-hidden h-full"},ae={class:"text-1f2329 pd-l-4"},le={class:"action-buttons flex items-center"},ne={class:"flex items-center w-full"},oe={class:"flex-1"},re={class:"card-list"},ie={key:3,class:"pagination-section pd-t-16 flex justify-center"},ue=Object.assign({name:"PageContainer"},{__name:"layout",props:{breadcrumb:{type:Object,default:()=>({show:!1,text:""})},title:{type:String,default:""},searchFields:{type:Array,default:()=>[]},modelValue:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},tableProps:{type:Object,default:()=>({stripe:!0,border:!1})},treeProps:{type:Object,default:()=>({})},tableEvents:{type:Object,default:()=>({})},showPagination:{type:Boolean,default:!0},pagination:{type:Object,default:()=>({page:o.pageParams.pageNum,size:o.pageParams.pageSize,total:0,pageSizes:o.paginationConfig.pageSizes,layout:o.paginationConfig.layout})},customSlots:{type:Array,default:()=>[]},api:{type:Function,default:null},autoLoad:{type:Boolean,default:!0},apiParams:{type:Object,default:()=>({})},isSeparate:{type:Boolean,default:!1},minWidth:{type:Number,default:290},mode:{type:String,default:y.TABLE,validator:n=>Object.values(y).includes(n)},showSelection:{type:Boolean,default:!1},selection:{type:Array,default:()=>[]},hasExpand:{type:Boolean,default:!1}},emits:[o.emitsMap.search,o.emitsMap.reset,o.emitsMap.actionClick,o.emitsMap.paginationChange,o.emitsMap.sizeChange,o.emitsMap.dataLoaded,o.emitsMap.dataError,o.emitsMap.updateModelValue,"selection-change"],setup(n,{expose:R,emit:F}){const j=_.useRouter(),r=n,h=F,L=e.ref(null),w=e.ref(null),$=e.ref(null),q=e.useSlots(),S=e.ref(!1),p=e.ref([]),m=e.ref({page:o.pageParams.pageNum,size:o.pageParams.pageSize,total:0,pageSizes:o.paginationConfig.pageSizes,layout:o.paginationConfig.layout}),g=e.ref({...r.modelValue}),k=e.ref(!1),b=e.ref(!0),B=e.ref([...r.selection]),x=e.computed(()=>r.api?p.value:r.tableData),c=e.computed(()=>r.api?m.value:r.pagination),E=e.computed(()=>r.api?S.value||k.value:r.tableProps.loading||k.value||!1),N=e.computed(()=>r.mode===y.CARD_INFINITE),z=e.computed(()=>r.columns?.map(t=>{if(t.type===P.ACTION&&(Array.isArray(t.actions)||typeof t.actions=="function"))return{...t,align:"center",fixed:"right"};const{width:a,...i}=t;return{...i,minWidth:a}})),W=t=>{!N.value||!b.value||E.value||v({},!0)},U=(t,a)=>t.id||t.bnid||t.key||`item-${a}`,K=()=>{j.back()},H=(t,a)=>a.formatter?a.formatter(t[a.prop],t,a):t[a.prop],Y=t=>q[t]!==void 0,V=(t,a)=>typeof t.actions=="function"?t.actions(a)||[]:t.actions||[],Z=t=>t.length<3?t:t.slice(0,1),M=t=>t.length<3?[]:t.slice(1),v=(t={},a=!1)=>{if(!r.api)return;if(a){if(!b.value||k.value)return;k.value=!0}else S.value=!0,N.value&&(b.value=!0,k.value=!1);const i={...t,...r.apiParams,...g.value};r.showPagination&&(a?i.page=c.value.page+1:i.page=c.value.page,i.size=c.value.size),r.api(i).then(l=>{const f=l?.data?.memberSo?.data||l?.data?.data||l?.data||[];if(a){if(!f||f.length===0){b.value=!1;return}p.value=[...p.value,...f],m.value.page=i.page,m.value.total=l?.data?.memberSo?.total||l?.data?.total||p.value.length,f.length<c.value.size&&(b.value=!1)}else console.log("newData",f),p.value=f,m.value.total=l?.data?.memberSo?.total||l?.data?.total||0;h(o.emitsMap.dataLoaded,{data:p.value,pagination:m.value,params:i,response:l?.data,isLoadMore:a})}).catch(l=>{a?b.value=!1:(p.value=[],m.value.total=0),h(o.emitsMap.dataError,l)}).finally(()=>{a?k.value=!1:S.value=!1})},I=()=>{r.api?(m.value.page=o.pageParams.pageNum,v()):h(o.emitsMap.search,g.value)},A=()=>{const t={};Object.keys(g.value).forEach(a=>{t[a]=void 0}),g.value=t,r.api?(m.value.page=o.pageParams.pageNum,v()):h(o.emitsMap.reset)},D=(t,a,i)=>{h(o.emitsMap.actionClick,{action:t,row:a,index:i})},G=t=>{B.value=t,h("selection-change",t)},J=(t,a)=>{switch(r.mode===y.CARD_INFINITE&&(p.value=[]),t){case o.operationConfigMap.search:I();break;case o.operationConfigMap.reset:A();break}};return e.watch(()=>r.modelValue,t=>{g.value={...t}},{deep:!0,immediate:!0}),e.watch(()=>r.selection,t=>{B.value=[...t]},{deep:!0,immediate:!0}),e.watch(()=>g.value,t=>{h(o.emitsMap.updateModelValue,{...t})},{deep:!0}),e.onMounted(()=>{r.autoLoad&&r.api&&v()}),R({loadData:v,handleSearch:I,handleReset:A,clearSelection:()=>w.value?.clearSelection?.(),toggleAllSelection:()=>w.value?.toggleAllSelection?.(),getSelectionRows:()=>B.value}),(t,a)=>(e.openBlock(),e.createElementBlock("div",te,[n.breadcrumb.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:"flex items-center fz-14 pd-b-20 pointer",onClick:K},[e.createVNode(e.unref(s.ElIcon),{size:16},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.breadcrumb.icon||e.unref(C.IconZuo))))]),_:1}),e.createElementVNode("span",ae,e.toDisplayString(n.breadcrumb.text),1)])):e.createCommentVNode("",!0),n.searchFields?.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"search-section pd-b-12 mg-b-12":!n.isSeparate,"bg-fff radius-4 pd-l-16 pd-r-16 pd-t-16 pd-b-16":n.isSeparate})},[e.createVNode(T.CustomTitle,{title:"查询"}),e.createVNode(e.unref(X.SearchBar),{ref_key:"searchFormRef",ref:L,items:n.searchFields,"filter-mode":!1,minWidth:n.minWidth,hideExpandButton:!1,fixedWidth:!0,maxHeight:32,modelValue:g.value,"onUpdate:modelValue":a[0]||(a[0]=i=>g.value=i),onOperation:J},null,8,["items","minWidth","modelValue"])],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["data-section flex-1 overflow-hidden flex flex-col",{"bg-fff radius-4 pd-l-16 pd-r-16 pd-t-16 pd-b-16 mg-t-16":n.isSeparate}])},[n.title?e.renderSlot(t.$slots,"title",{key:0},()=>[e.createVNode(T.CustomTitle,{title:n.title},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"title-actions",{},void 0,!0)]),_:3},8,["title"])],!0):e.createCommentVNode("",!0),n.mode===e.unref(y).TABLE?(e.openBlock(),e.createBlock(e.unref(s.ElAutoResizer),{key:1,class:"flex-1 overflow-hidden"},{default:e.withCtx(({width:i})=>[e.createVNode(e.unref(s.ElTable),e.mergeProps({ref_key:"tableRef",ref:w,data:x.value,columns:z.value,"tree-props":n.treeProps,"show-overflow-tooltip":!0,"row-key":n.treeProps.value||n.tableProps.rowKey},{...n.tableProps,loading:E.value},e.toHandlers(n.tableEvents),{class:"w-full h-full admin-dashboard-table",border:"",onSelectionChange:G}),e.createSlots({default:e.withCtx(()=>[n.showSelection?(e.openBlock(),e.createBlock(e.unref(s.ElTableColumn),{key:0,type:"selection",width:"55",fixed:"left"})):e.createCommentVNode("",!0),n.hasExpand?(e.openBlock(),e.createBlock(e.unref(s.ElTableColumn),{key:1,width:"1",type:"expand",fixed:"left"},{default:e.withCtx(l=>[e.createElementVNode("div",{class:"sticky-left",style:e.normalizeStyle({width:i+"px"})},[e.renderSlot(t.$slots,"expand",{row:l.row},void 0,!0)],4)]),_:2},1024)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,(l,f)=>(e.openBlock(),e.createBlock(e.unref(s.ElTableColumn),e.mergeProps({key:l.prop},{ref_for:!0},l),e.createSlots({_:2},[l.type===e.unref(P).ACTION?{name:"default",fn:e.withCtx(d=>[e.createElementVNode("div",le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z(V(l,d.row)),u=>(e.openBlock(),e.createBlock(e.unref(s.ElButton),{key:u.key||u.label,type:u.type||"primary",size:u.size||"small",disabled:u.disabled,loading:u.loading,text:u.text,link:u.link,icon:u.icon,onClick:de=>D(u,d.row,d.$index)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label),1)]),_:2},1032,["type","size","disabled","loading","text","link","icon","onClick"]))),128)),M(V(l,d.row)).length>0?(e.openBlock(),e.createBlock(e.unref(s.ElDropdown),{key:0,onCommand:u=>D(u,d.row,d.$index),trigger:"click"},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(s.ElDropdownMenu),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M(V(l,d.row)),u=>(e.openBlock(),e.createBlock(e.unref(s.ElDropdownItem),{key:u.key||u.label,command:u,disabled:u.disabled},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label),1)]),_:2},1032,["command","disabled"]))),128))]),_:2},1024)]),default:e.withCtx(()=>[e.createVNode(e.unref(s.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(C.IconMore))]),_:1})]),_:2},1032,["onCommand"])):e.createCommentVNode("",!0)])]),key:"0"}:Y(l.prop)?{name:"default",fn:e.withCtx(d=>[e.createElementVNode("div",ne,[f===0&&n.hasExpand?(e.openBlock(),e.createBlock(e.unref(s.ElIcon),{key:0,class:"mg-r-10"},{default:e.withCtx(()=>[n.tableProps?.expandRowKeys?.includes(d.row[n.tableProps.rowKey])?(e.openBlock(),e.createBlock(e.unref(C.IconZuoCopy),{key:0})):(e.openBlock(),e.createBlock(e.unref(C.IconYou),{key:1}))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("div",oe,[e.renderSlot(t.$slots,l.prop,{row:d.row,index:d.$index,column:l},void 0,!0)])])]),key:"1"}:{name:"default",fn:e.withCtx(d=>[e.createElementVNode("span",null,e.toDisplayString(H(d.row,l)),1)]),key:"2"}]),1040))),128))]),_:2},[e.renderList(n.customSlots,l=>({name:l,fn:e.withCtx(f=>[e.renderSlot(t.$slots,l,e.normalizeProps(e.guardReactiveProps(f)),void 0,!0)])}))]),1040,["data","columns","tree-props","row-key"])]),_:3})):n.mode===e.unref(y).CARD_INFINITE?(e.openBlock(),e.createBlock(e.unref(s.ElScrollbar),{key:2,ref_key:"scrollbarRef",ref:$,class:"card-container flex-1",onEndReached:W},{default:e.withCtx(()=>[e.createElementVNode("div",re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,(i,l)=>(e.openBlock(),e.createElementBlock("div",{key:U(i,l),class:"card-item"},[e.renderSlot(t.$slots,"card",{item:i,index:l,data:x.value,loading:E.value},void 0,!0)]))),128))])]),_:3},512)):e.createCommentVNode("",!0),n.showPagination&&!N.value?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(s.ElPagination),{"current-page":c.value.page,"onUpdate:currentPage":a[1]||(a[1]=i=>c.value.page=i),"page-size":c.value.size,"onUpdate:pageSize":a[2]||(a[2]=i=>c.value.size=i),"page-sizes":c.value.pageSizes,total:c.value.total,layout:c.value.layout,onSizeChange:v,onCurrentChange:v},null,8,["current-page","page-size","page-sizes","total","layout"])])):e.createCommentVNode("",!0)],2),e.renderSlot(t.$slots,"default",{},void 0,!0)]))}}),se=ee._export_sfc(ue,[["__scopeId","data-v-d9594fc8"]]),O=Q.withInstall(se);exports.COLUMN_TYPES=P;exports.MODES=y;exports.PageContainer=O;exports.default=O;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.search-section[data-v-
|
|
1
|
+
.search-section[data-v-d9594fc8]{border-bottom:1px solid var(--border-color)}.action-buttons[data-v-d9594fc8]{gap:8px;flex-wrap:wrap}.bg-fff[data-v-d9594fc8]{background-color:var(--background-color-2);border:1px solid var(--border-color)}.card-list[data-v-d9594fc8]{display:grid;grid-template-columns:repeat(auto-fill,minmax(306px,1fr));gap:16px}[data-v-d9594fc8] .el-table__expand-column .el-icon{display:none}[data-v-d9594fc8] .el-table__cell.el-table__expanded-cell{position:relative}[data-v-d9594fc8] .el-table__cell.el-table__expanded-cell .sticky-left{position:sticky;left:0;top:0;z-index:10}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "china-mobile-international-custom-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"components",
|
|
6
6
|
"vue",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
"axios": "^1.8.2",
|
|
108
108
|
"vue": "^3.5.26",
|
|
109
109
|
"color-message-lingyun-vue": "0.0.30",
|
|
110
|
-
"color-star-atom-style": "0.0.2",
|
|
111
|
-
"color-star-custom-methods": "0.0.17",
|
|
112
110
|
"color-star-custom-components": "0.0.20",
|
|
113
|
-
"color-
|
|
111
|
+
"color-star-custom-methods": "0.0.17",
|
|
112
|
+
"color-message-aibox-vue": "0.0.80",
|
|
113
|
+
"color-star-atom-style": "0.0.2"
|
|
114
114
|
},
|
|
115
115
|
"optionalDependencies": {
|
|
116
116
|
"@ast-grep/napi-linux-x64-musl": "^0.39.6",
|