jky-component-lib 0.0.61 → 0.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components.d.ts +1 -0
- package/dist/es/components.js +4 -1
- package/dist/es/form/Form.vue.d.ts +1 -1
- package/dist/es/form/Form.vue.js +64 -10
- package/dist/es/form/FormItem.vue.js +21 -11
- package/dist/es/index.js +2 -0
- package/dist/es/package.json.js +1 -1
- package/dist/es/page-layout/PageLayout.vue.d.ts +36 -0
- package/dist/es/page-layout/PageLayout.vue.js +152 -0
- package/dist/es/page-layout/PageLayout.vue3.js +5 -0
- package/dist/es/page-layout/index.d.ts +4 -0
- package/dist/es/page-layout/index.js +8 -0
- package/dist/es/page-layout/style.css +8 -0
- package/dist/es/page-table/PageTable.vue.d.ts +22 -270
- package/dist/es/page-table/PageTable.vue.js +146 -112
- package/dist/es/page-table/Toolbar.vue.d.ts +1 -0
- package/dist/es/page-table/Toolbar.vue.js +40 -10
- package/dist/es/page-table/style.css +1 -3
- package/dist/es/style.css +334 -58
- package/dist/es/styles.css +1 -1
- package/dist/lib/components.d.ts +1 -0
- package/dist/lib/components.js +12 -9
- package/dist/lib/form/Form.vue.d.ts +1 -1
- package/dist/lib/form/Form.vue.js +63 -9
- package/dist/lib/form/FormItem.vue.js +21 -11
- package/dist/lib/index.js +8 -6
- package/dist/lib/package.json.js +1 -1
- package/dist/lib/page-layout/PageLayout.vue.d.ts +36 -0
- package/dist/lib/page-layout/PageLayout.vue.js +152 -0
- package/dist/lib/page-layout/PageLayout.vue3.js +5 -0
- package/dist/lib/page-layout/index.d.ts +4 -0
- package/dist/lib/page-layout/index.js +8 -0
- package/dist/lib/page-layout/style.css +8 -0
- package/dist/lib/page-table/PageTable.vue.d.ts +22 -270
- package/dist/lib/page-table/PageTable.vue.js +144 -110
- package/dist/lib/page-table/Toolbar.vue.d.ts +1 -0
- package/dist/lib/page-table/Toolbar.vue.js +38 -8
- package/dist/lib/page-table/style.css +1 -3
- package/dist/lib/style.css +334 -58
- package/dist/lib/styles.css +1 -1
- package/package.json +1 -1
|
@@ -37,24 +37,22 @@ var __async = (__this, __arguments, generator) => {
|
|
|
37
37
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
import { defineComponent, ref, computed,
|
|
41
|
-
import {
|
|
40
|
+
import { defineComponent, useModel, ref, computed, onMounted, resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, createBlock, unref, withCtx, createVNode, mergeProps, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, resolveDynamicComponent, withDirectives, Fragment, renderList, renderSlot, mergeModels } from "vue";
|
|
41
|
+
import { useFullscreen } from "@vueuse/core";
|
|
42
|
+
import { ElCard, ElTable, ElTableColumn, ElScrollbar, ElPagination } from "element-plus";
|
|
42
43
|
import { JkyForm } from "../form/index.js";
|
|
43
44
|
import _sfc_main$1 from "./Toolbar.vue.js";
|
|
44
45
|
/* empty css */
|
|
45
46
|
const _hoisted_1 = { class: "jky-page-table__filter-actions" };
|
|
46
|
-
const _hoisted_2 = {
|
|
47
|
-
key: 0,
|
|
48
|
-
class: "flex flex-end mt-4 jky-page-table__pagination"
|
|
49
|
-
};
|
|
50
47
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
51
48
|
name: "JkyPageTable"
|
|
52
49
|
}), {
|
|
53
50
|
__name: "PageTable",
|
|
54
|
-
props: {
|
|
51
|
+
props: /* @__PURE__ */ mergeModels({
|
|
52
|
+
withCard: { type: Boolean, default: true },
|
|
55
53
|
title: { default: "" },
|
|
56
54
|
filterItems: { default: () => [] },
|
|
57
|
-
|
|
55
|
+
form: {},
|
|
58
56
|
columns: {},
|
|
59
57
|
dataSource: {},
|
|
60
58
|
showSearchButton: { type: Boolean, default: true },
|
|
@@ -69,121 +67,142 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
69
67
|
maxHeight: {},
|
|
70
68
|
emptyText: { default: "暂无数据" },
|
|
71
69
|
loading: { type: Boolean, default: false },
|
|
72
|
-
className: {
|
|
70
|
+
className: {},
|
|
73
71
|
formProps: { default: () => ({}) },
|
|
74
72
|
tableProps: { default: () => ({}) },
|
|
75
73
|
paginationProps: { default: () => ({}) },
|
|
76
74
|
toolbarButtonLimit: { default: 0 },
|
|
77
75
|
toolbarButtons: {}
|
|
78
|
-
},
|
|
79
|
-
|
|
76
|
+
}, {
|
|
77
|
+
"form": {
|
|
78
|
+
default: () => ({})
|
|
79
|
+
},
|
|
80
|
+
"formModifiers": {},
|
|
81
|
+
"pagination": {
|
|
82
|
+
default: () => ({
|
|
83
|
+
currentPage: 1,
|
|
84
|
+
pageSize: 10,
|
|
85
|
+
total: 0
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
"paginationModifiers": {}
|
|
89
|
+
}),
|
|
90
|
+
emits: /* @__PURE__ */ mergeModels(["search", "reset", "refresh", "rowClick", "rowDblclick", "selectionChange", "pageChange", "sortChange"], ["update:form", "update:pagination"]),
|
|
80
91
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
81
|
-
var _a, _b, _c;
|
|
82
92
|
const props = __props;
|
|
83
93
|
const emit = __emit;
|
|
84
|
-
const
|
|
94
|
+
const form = useModel(__props, "form");
|
|
95
|
+
const pagination = useModel(__props, "pagination");
|
|
85
96
|
const internalData = ref([]);
|
|
86
|
-
const internalPagination = ref({
|
|
87
|
-
currentPage: ((_a = props.pagination) == null ? void 0 : _a.currentPage) || 1,
|
|
88
|
-
pageSize: ((_b = props.pagination) == null ? void 0 : _b.pageSize) || 10,
|
|
89
|
-
total: ((_c = props.pagination) == null ? void 0 : _c.total) || 0
|
|
90
|
-
});
|
|
91
97
|
const tableRef = ref(null);
|
|
92
98
|
const formRef = ref(null);
|
|
93
|
-
const paginationRef = ref(null);
|
|
94
99
|
const isLoading = ref(props.loading);
|
|
100
|
+
const pageTableRef = ref(null);
|
|
101
|
+
const { isFullscreen: _isFullscreen, toggle: toggleFullscreen } = useFullscreen(pageTableRef);
|
|
102
|
+
function handleRefresh() {
|
|
103
|
+
var _a;
|
|
104
|
+
if ((_a = props.dataSource) == null ? void 0 : _a.api) {
|
|
105
|
+
loadData();
|
|
106
|
+
} else {
|
|
107
|
+
emit("refresh");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const defaultRightButtons = computed(() => {
|
|
111
|
+
const refreshButton = {
|
|
112
|
+
label: "刷新",
|
|
113
|
+
icon: "icon-[mdi--refresh]",
|
|
114
|
+
class: "ml-3",
|
|
115
|
+
onClick: handleRefresh
|
|
116
|
+
};
|
|
117
|
+
const fullscreenButton = {
|
|
118
|
+
label: _isFullscreen.value ? "退出全屏" : "全屏",
|
|
119
|
+
icon: _isFullscreen.value ? "icon-[mdi--fullscreen-exit]" : "icon-[mdi--fullscreen]",
|
|
120
|
+
class: "ml-3",
|
|
121
|
+
onClick: () => toggleFullscreen()
|
|
122
|
+
};
|
|
123
|
+
return [refreshButton, fullscreenButton];
|
|
124
|
+
});
|
|
95
125
|
const showPagination = computed(() => {
|
|
96
|
-
var
|
|
97
|
-
return !!((
|
|
126
|
+
var _a, _b;
|
|
127
|
+
return !!((_a = props.dataSource) == null ? void 0 : _a.api) || (((_b = pagination.value) == null ? void 0 : _b.total) || 0) > 0;
|
|
98
128
|
});
|
|
99
129
|
function getColumnProps(column) {
|
|
100
130
|
return __spreadValues({}, column);
|
|
101
131
|
}
|
|
102
|
-
watch(
|
|
103
|
-
() => props.pagination,
|
|
104
|
-
(newPagination) => {
|
|
105
|
-
if (newPagination) {
|
|
106
|
-
internalPagination.value.currentPage = newPagination.currentPage || 1;
|
|
107
|
-
internalPagination.value.pageSize = newPagination.pageSize || 10;
|
|
108
|
-
internalPagination.value.total = newPagination.total || 0;
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{ deep: true }
|
|
112
|
-
);
|
|
113
132
|
function loadData() {
|
|
114
133
|
return __async(this, null, function* () {
|
|
115
|
-
var
|
|
116
|
-
if (!((
|
|
134
|
+
var _a;
|
|
135
|
+
if (!((_a = props.dataSource) == null ? void 0 : _a.api))
|
|
117
136
|
return;
|
|
118
137
|
isLoading.value = true;
|
|
119
138
|
try {
|
|
120
139
|
const result = yield props.dataSource.api(__spreadValues({
|
|
121
|
-
currentPage:
|
|
122
|
-
pageSize:
|
|
123
|
-
},
|
|
140
|
+
currentPage: pagination.value.currentPage || 1,
|
|
141
|
+
pageSize: pagination.value.pageSize || 10
|
|
142
|
+
}, form.value));
|
|
124
143
|
const responseProps = props.dataSource.responseProps || {};
|
|
125
144
|
const recordsField = responseProps.recordsField || "records";
|
|
126
145
|
const totalField = responseProps.totalField || "total";
|
|
127
146
|
internalData.value = result[recordsField] || [];
|
|
128
|
-
|
|
147
|
+
pagination.value.total = result[totalField] || 0;
|
|
129
148
|
emit("pageChange", {
|
|
130
|
-
currentPage:
|
|
131
|
-
pageSize:
|
|
149
|
+
currentPage: pagination.value.currentPage,
|
|
150
|
+
pageSize: pagination.value.pageSize
|
|
132
151
|
});
|
|
133
152
|
} catch (error) {
|
|
134
153
|
console.error("加载数据失败:", error);
|
|
135
154
|
internalData.value = [];
|
|
136
|
-
|
|
155
|
+
pagination.value.total = 0;
|
|
137
156
|
} finally {
|
|
138
157
|
isLoading.value = false;
|
|
139
158
|
}
|
|
140
159
|
});
|
|
141
160
|
}
|
|
142
161
|
function handleSearch() {
|
|
143
|
-
var
|
|
144
|
-
emit("search", __spreadValues({},
|
|
145
|
-
if ((
|
|
146
|
-
|
|
162
|
+
var _a;
|
|
163
|
+
emit("search", __spreadValues({}, form.value));
|
|
164
|
+
if ((_a = props.dataSource) == null ? void 0 : _a.api) {
|
|
165
|
+
pagination.value.currentPage = 1;
|
|
147
166
|
loadData();
|
|
148
167
|
}
|
|
149
168
|
}
|
|
150
169
|
function handleReset() {
|
|
151
|
-
var
|
|
152
|
-
|
|
170
|
+
var _a;
|
|
171
|
+
form.value = {};
|
|
153
172
|
emit("reset");
|
|
154
173
|
if (formRef.value) {
|
|
155
174
|
formRef.value.resetFields();
|
|
156
175
|
}
|
|
157
|
-
if ((
|
|
158
|
-
|
|
176
|
+
if ((_a = props.dataSource) == null ? void 0 : _a.api) {
|
|
177
|
+
pagination.value.currentPage = 1;
|
|
159
178
|
loadData();
|
|
160
179
|
}
|
|
161
180
|
}
|
|
162
181
|
function handlePageChange(page) {
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
if ((
|
|
182
|
+
var _a;
|
|
183
|
+
pagination.value.currentPage = page;
|
|
184
|
+
if ((_a = props.dataSource) == null ? void 0 : _a.api) {
|
|
166
185
|
loadData();
|
|
167
|
-
} else if (
|
|
168
|
-
|
|
186
|
+
} else if (pagination.value.onPageChange) {
|
|
187
|
+
pagination.value.onPageChange(page);
|
|
169
188
|
}
|
|
170
189
|
emit("pageChange", {
|
|
171
|
-
currentPage:
|
|
172
|
-
pageSize:
|
|
190
|
+
currentPage: pagination.value.currentPage,
|
|
191
|
+
pageSize: pagination.value.pageSize
|
|
173
192
|
});
|
|
174
193
|
}
|
|
175
194
|
function handlePageSizeChange(size) {
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if ((
|
|
195
|
+
var _a;
|
|
196
|
+
pagination.value.pageSize = size;
|
|
197
|
+
pagination.value.currentPage = 1;
|
|
198
|
+
if ((_a = props.dataSource) == null ? void 0 : _a.api) {
|
|
180
199
|
loadData();
|
|
181
|
-
} else if (
|
|
182
|
-
|
|
200
|
+
} else if (pagination.value.onPageSizeChange) {
|
|
201
|
+
pagination.value.onPageSizeChange(size);
|
|
183
202
|
}
|
|
184
203
|
emit("pageChange", {
|
|
185
|
-
currentPage:
|
|
186
|
-
pageSize:
|
|
204
|
+
currentPage: pagination.value.currentPage,
|
|
205
|
+
pageSize: pagination.value.pageSize
|
|
187
206
|
});
|
|
188
207
|
}
|
|
189
208
|
const selectedCount = ref(0);
|
|
@@ -202,42 +221,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
202
221
|
}
|
|
203
222
|
__expose({
|
|
204
223
|
refresh: loadData,
|
|
205
|
-
getFilterData: () => __spreadValues({},
|
|
224
|
+
getFilterData: () => __spreadValues({}, form.value),
|
|
206
225
|
setFilterData: (data) => {
|
|
207
|
-
|
|
226
|
+
form.value = __spreadValues({}, data);
|
|
208
227
|
},
|
|
209
228
|
resetFilter: handleReset,
|
|
210
229
|
getSelectedRows: () => {
|
|
211
|
-
var
|
|
212
|
-
return ((
|
|
230
|
+
var _a;
|
|
231
|
+
return ((_a = tableRef.value) == null ? void 0 : _a.getSelectionRows()) || [];
|
|
213
232
|
},
|
|
214
233
|
clearSelection: () => {
|
|
215
|
-
var
|
|
216
|
-
(
|
|
234
|
+
var _a;
|
|
235
|
+
(_a = tableRef.value) == null ? void 0 : _a.clearSelection();
|
|
217
236
|
},
|
|
218
237
|
toggleRowSelection: (row, selected) => {
|
|
219
|
-
var
|
|
220
|
-
(
|
|
238
|
+
var _a;
|
|
239
|
+
(_a = tableRef.value) == null ? void 0 : _a.toggleRowSelection(row, selected);
|
|
221
240
|
},
|
|
222
241
|
sort: (prop, order) => {
|
|
223
|
-
var
|
|
224
|
-
(
|
|
242
|
+
var _a;
|
|
243
|
+
(_a = tableRef.value) == null ? void 0 : _a.sort(prop, order);
|
|
225
244
|
},
|
|
226
245
|
formRef,
|
|
227
|
-
tableRef
|
|
228
|
-
paginationRef
|
|
246
|
+
tableRef
|
|
229
247
|
});
|
|
230
248
|
onMounted(() => {
|
|
231
|
-
var
|
|
232
|
-
if ((
|
|
249
|
+
var _a;
|
|
250
|
+
if ((_a = props.dataSource) == null ? void 0 : _a.api) {
|
|
233
251
|
loadData();
|
|
234
252
|
}
|
|
235
253
|
});
|
|
236
254
|
return (_ctx, _cache) => {
|
|
255
|
+
var _a, _b;
|
|
237
256
|
const _component_ElButton = resolveComponent("ElButton");
|
|
238
257
|
const _directive_loading = resolveDirective("loading");
|
|
239
258
|
return openBlock(), createElementBlock("div", {
|
|
240
|
-
|
|
259
|
+
ref_key: "pageTableRef",
|
|
260
|
+
ref: pageTableRef,
|
|
261
|
+
class: normalizeClass(["bg-transparent jky-page-table", [props.class]])
|
|
241
262
|
}, [
|
|
242
263
|
__props.filterItems && __props.filterItems.length > 0 ? (openBlock(), createBlock(unref(ElCard), {
|
|
243
264
|
key: 0,
|
|
@@ -247,12 +268,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
247
268
|
createVNode(unref(JkyForm), mergeProps({
|
|
248
269
|
ref_key: "formRef",
|
|
249
270
|
ref: formRef,
|
|
250
|
-
modelValue:
|
|
251
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
271
|
+
modelValue: form.value,
|
|
272
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value = $event),
|
|
252
273
|
items: __props.filterItems,
|
|
253
274
|
inline: true,
|
|
254
275
|
disabled: isLoading.value
|
|
255
|
-
}, __props.formProps), null, 16, ["modelValue", "items", "disabled"]),
|
|
276
|
+
}, __spreadProps(__spreadValues({}, __props.formProps), { inline: true })), null, 16, ["modelValue", "items", "disabled"]),
|
|
256
277
|
createElementVNode("div", _hoisted_1, [
|
|
257
278
|
createVNode(_component_ElButton, {
|
|
258
279
|
type: "primary",
|
|
@@ -274,25 +295,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
274
295
|
]),
|
|
275
296
|
_: 1
|
|
276
297
|
})) : createCommentVNode("", true),
|
|
277
|
-
|
|
298
|
+
(openBlock(), createBlock(resolveDynamicComponent(props.withCard ? unref(ElCard) : "div"), { class: "jky-page-table__table-card min-h-0" }, {
|
|
278
299
|
default: withCtx(() => {
|
|
279
|
-
var _a2, _b2,
|
|
300
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
280
301
|
return [
|
|
281
302
|
createVNode(_sfc_main$1, {
|
|
282
303
|
"left-buttons": ((_a2 = props.toolbarButtons) == null ? void 0 : _a2.left) || [],
|
|
283
304
|
"batch-buttons": ((_b2 = props.toolbarButtons) == null ? void 0 : _b2.batch) || [],
|
|
284
|
-
"right-buttons": ((
|
|
305
|
+
"right-buttons": ((_c = props.toolbarButtons) == null ? void 0 : _c.right) || [],
|
|
306
|
+
"default-buttons": defaultRightButtons.value,
|
|
285
307
|
"selected-count": selectedCount.value,
|
|
286
308
|
"toolbar-button-limit": __props.toolbarButtonLimit,
|
|
287
309
|
payload: {
|
|
288
|
-
currentPage:
|
|
289
|
-
pageSize:
|
|
290
|
-
total:
|
|
310
|
+
currentPage: ((_d = pagination.value) == null ? void 0 : _d.currentPage) || 1,
|
|
311
|
+
pageSize: ((_e = pagination.value) == null ? void 0 : _e.pageSize) || 10,
|
|
312
|
+
total: ((_f = pagination.value) == null ? void 0 : _f.total) || 0,
|
|
291
313
|
tableData: internalData.value,
|
|
292
|
-
selectedRows: ((
|
|
293
|
-
filterData: __spreadValues({},
|
|
314
|
+
selectedRows: ((_g = tableRef.value) == null ? void 0 : _g.getSelectionRows()) || [],
|
|
315
|
+
filterData: __spreadValues({}, form.value)
|
|
294
316
|
}
|
|
295
|
-
}, null, 8, ["left-buttons", "batch-buttons", "right-buttons", "selected-count", "toolbar-button-limit", "payload"]),
|
|
317
|
+
}, null, 8, ["left-buttons", "batch-buttons", "right-buttons", "default-buttons", "selected-count", "toolbar-button-limit", "payload"]),
|
|
296
318
|
withDirectives((openBlock(), createBlock(unref(ElTable), mergeProps({
|
|
297
319
|
ref_key: "tableRef",
|
|
298
320
|
ref: tableRef,
|
|
@@ -341,30 +363,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
341
363
|
_: 3
|
|
342
364
|
}, 16, ["data", "border", "stripe", "height", "max-height", "empty-text"])), [
|
|
343
365
|
[_directive_loading, isLoading.value]
|
|
344
|
-
])
|
|
345
|
-
showPagination.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
346
|
-
createVNode(unref(ElPagination), mergeProps({
|
|
347
|
-
ref_key: "paginationRef",
|
|
348
|
-
ref: paginationRef,
|
|
349
|
-
"current-page": internalPagination.value.currentPage,
|
|
350
|
-
"onUpdate:currentPage": _cache[1] || (_cache[1] = ($event) => internalPagination.value.currentPage = $event),
|
|
351
|
-
"page-size": internalPagination.value.pageSize,
|
|
352
|
-
"onUpdate:pageSize": _cache[2] || (_cache[2] = ($event) => internalPagination.value.pageSize = $event),
|
|
353
|
-
total: internalPagination.value.total,
|
|
354
|
-
"page-sizes": ((_e = __props.pagination) == null ? void 0 : _e.pageSizes) || [10, 20, 50, 100],
|
|
355
|
-
layout: ((_f = __props.pagination) == null ? void 0 : _f.layout) || "total, sizes, prev, pager, next, jumper",
|
|
356
|
-
"show-size-picker": (_h = (_g = __props.pagination) == null ? void 0 : _g.showSizePicker) != null ? _h : true,
|
|
357
|
-
"show-total": (_j = (_i = __props.pagination) == null ? void 0 : _i.showTotal) != null ? _j : true,
|
|
358
|
-
"show-jumper": (_l = (_k = __props.pagination) == null ? void 0 : _k.showJumper) != null ? _l : true
|
|
359
|
-
}, __props.paginationProps, {
|
|
360
|
-
onSizeChange: handlePageSizeChange,
|
|
361
|
-
onCurrentChange: handlePageChange
|
|
362
|
-
}), null, 16, ["current-page", "page-size", "total", "page-sizes", "layout", "show-size-picker", "show-total", "show-jumper"])
|
|
363
|
-
])) : createCommentVNode("", true)
|
|
366
|
+
])
|
|
364
367
|
];
|
|
365
368
|
}),
|
|
366
369
|
_: 3
|
|
367
|
-
})
|
|
370
|
+
})),
|
|
371
|
+
showPagination.value ? (openBlock(), createBlock(resolveDynamicComponent(((_a = pagination.value) == null ? void 0 : _a.withCard) ? unref(ElCard) : "div"), {
|
|
372
|
+
key: 1,
|
|
373
|
+
class: normalizeClass(["flex flex-end bg-white justify-center mt-4 p-2 z-30 sticky bottom-0 jky-page-table__pagination", [((_b = pagination.value) == null ? void 0 : _b.class) || ""]])
|
|
374
|
+
}, {
|
|
375
|
+
default: withCtx(() => [
|
|
376
|
+
createVNode(unref(ElScrollbar), { class: "w-full" }, {
|
|
377
|
+
default: withCtx(() => {
|
|
378
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
379
|
+
return [
|
|
380
|
+
createVNode(unref(ElPagination), mergeProps({
|
|
381
|
+
"current-page": pagination.value.currentPage,
|
|
382
|
+
"onUpdate:currentPage": _cache[1] || (_cache[1] = ($event) => pagination.value.currentPage = $event),
|
|
383
|
+
"page-size": pagination.value.pageSize,
|
|
384
|
+
"onUpdate:pageSize": _cache[2] || (_cache[2] = ($event) => pagination.value.pageSize = $event),
|
|
385
|
+
total: pagination.value.total,
|
|
386
|
+
"page-sizes": ((_a2 = pagination.value) == null ? void 0 : _a2.pageSizes) || [10, 20, 50, 100],
|
|
387
|
+
layout: ((_b2 = pagination.value) == null ? void 0 : _b2.layout) || "total, sizes, prev, pager, next, jumper",
|
|
388
|
+
"show-size-picker": (_d = (_c = pagination.value) == null ? void 0 : _c.showSizePicker) != null ? _d : true,
|
|
389
|
+
"show-total": (_f = (_e = pagination.value) == null ? void 0 : _e.showTotal) != null ? _f : true,
|
|
390
|
+
"show-jumper": (_h = (_g = pagination.value) == null ? void 0 : _g.showJumper) != null ? _h : true
|
|
391
|
+
}, __props.paginationProps, {
|
|
392
|
+
onSizeChange: handlePageSizeChange,
|
|
393
|
+
onCurrentChange: handlePageChange
|
|
394
|
+
}), null, 16, ["current-page", "page-size", "total", "page-sizes", "layout", "show-size-picker", "show-total", "show-jumper"])
|
|
395
|
+
];
|
|
396
|
+
}),
|
|
397
|
+
_: 1
|
|
398
|
+
})
|
|
399
|
+
]),
|
|
400
|
+
_: 1
|
|
401
|
+
}, 8, ["class"])) : createCommentVNode("", true)
|
|
368
402
|
], 2);
|
|
369
403
|
};
|
|
370
404
|
}
|
|
@@ -16,6 +16,7 @@ declare const _default: import('vue').DefineComponent<ToolbarProps, {
|
|
|
16
16
|
leftButtons: ToolbarButtonConfig[];
|
|
17
17
|
batchButtons: ToolbarButtonConfig[];
|
|
18
18
|
rightButtons: ToolbarButtonConfig[];
|
|
19
|
+
defaultButtons: ToolbarButtonConfig[];
|
|
19
20
|
selectedCount: number;
|
|
20
21
|
toolbarButtonLimit: number;
|
|
21
22
|
payload: {
|
|
@@ -17,20 +17,24 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, ref, computed,
|
|
20
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, createBlock, resolveDynamicComponent, unref, withCtx, createVNode, normalizeClass, createTextVNode, toDisplayString, createCommentVNode, Fragment, renderList, withModifiers, h } from "vue";
|
|
21
21
|
import { ArrowDown as arrow_down_default } from "../node_modules/@element-plus/icons-vue/dist/index.js";
|
|
22
|
-
import { ElDropdown, ElButton, ElDropdownMenu, ElDropdownItem } from "element-plus";
|
|
22
|
+
import { ElDropdown, ElButton, ElIcon, ElDropdownMenu, ElDropdownItem } from "element-plus";
|
|
23
23
|
import { useResponsiveToolbar } from "../utils/responsive-toolbar.js";
|
|
24
24
|
const _hoisted_1 = { class: "flex items-center justify-between mb-2 py-2 jky-page-table__toolbar" };
|
|
25
25
|
const _hoisted_2 = { class: "flex items-center" };
|
|
26
|
+
const _hoisted_3 = { class: "flex items-center ml-2 text-gray-500" };
|
|
27
|
+
const _hoisted_4 = ["title", "onClick"];
|
|
26
28
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
27
29
|
name: "JkyPageTableToolbar"
|
|
28
30
|
}), {
|
|
29
31
|
__name: "Toolbar",
|
|
30
32
|
props: {
|
|
33
|
+
class: {},
|
|
31
34
|
leftButtons: { default: () => [] },
|
|
32
35
|
batchButtons: { default: () => [] },
|
|
33
36
|
rightButtons: { default: () => [] },
|
|
37
|
+
defaultButtons: { default: () => [] },
|
|
34
38
|
selectedCount: { default: 0 },
|
|
35
39
|
toolbarButtonLimit: { default: 0 },
|
|
36
40
|
payload: { default: () => ({
|
|
@@ -96,6 +100,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
96
100
|
const buttons = [];
|
|
97
101
|
if (props.leftButtons) {
|
|
98
102
|
props.leftButtons.forEach((button, index) => {
|
|
103
|
+
const iconSpan = button.icon ? h("span", {
|
|
104
|
+
class: `${button.icon} text-[1em] inline-block`
|
|
105
|
+
}) : null;
|
|
99
106
|
buttons.push(
|
|
100
107
|
h(
|
|
101
108
|
ElButton,
|
|
@@ -105,10 +112,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
105
112
|
size: button.size,
|
|
106
113
|
disabled: button.disabled,
|
|
107
114
|
plain: button.plain,
|
|
108
|
-
class: button.
|
|
115
|
+
class: button.class,
|
|
116
|
+
icon: iconSpan || void 0,
|
|
109
117
|
onClick: () => handleToolbarButtonClick(button)
|
|
110
118
|
},
|
|
111
|
-
{
|
|
119
|
+
{
|
|
120
|
+
default: () => button.label
|
|
121
|
+
}
|
|
112
122
|
)
|
|
113
123
|
);
|
|
114
124
|
});
|
|
@@ -126,7 +136,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
126
136
|
key: index,
|
|
127
137
|
type: button.type,
|
|
128
138
|
disabled: button.disabled,
|
|
129
|
-
class: button.
|
|
139
|
+
class: button.class,
|
|
130
140
|
command: index
|
|
131
141
|
},
|
|
132
142
|
{ default: () => button.label }
|
|
@@ -142,6 +152,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
142
152
|
props.rightButtons.forEach((button, index) => {
|
|
143
153
|
const isVisible = index < visibleRightCount.value || !needCollapseRight.value;
|
|
144
154
|
if (isVisible) {
|
|
155
|
+
const iconSpan = button.icon ? h("span", {
|
|
156
|
+
class: `${button.icon} text-[1em]`,
|
|
157
|
+
style: { display: "inline-block" }
|
|
158
|
+
}) : null;
|
|
145
159
|
buttons.push(
|
|
146
160
|
h(
|
|
147
161
|
ElButton,
|
|
@@ -151,10 +165,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
151
165
|
size: button.size,
|
|
152
166
|
disabled: button.disabled,
|
|
153
167
|
plain: button.plain,
|
|
154
|
-
class: button.
|
|
168
|
+
class: button.class,
|
|
169
|
+
icon: iconSpan || void 0,
|
|
155
170
|
onClick: () => handleToolbarButtonClick(button)
|
|
156
171
|
},
|
|
157
|
-
{
|
|
172
|
+
{
|
|
173
|
+
default: () => button.label
|
|
174
|
+
}
|
|
158
175
|
)
|
|
159
176
|
);
|
|
160
177
|
}
|
|
@@ -186,7 +203,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
186
203
|
handleRightCommand
|
|
187
204
|
});
|
|
188
205
|
return (_ctx, _cache) => {
|
|
189
|
-
const _component_ElIcon = resolveComponent("ElIcon");
|
|
190
206
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
191
207
|
createElementVNode("div", _hoisted_2, [
|
|
192
208
|
(openBlock(), createBlock(resolveDynamicComponent(renderLeftButtons))),
|
|
@@ -210,7 +226,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
210
226
|
class: normalizeClass([((_a = props.leftButtons) == null ? void 0 : _a.length) ? "ml-3" : ""])
|
|
211
227
|
}, {
|
|
212
228
|
suffix: withCtx(() => [
|
|
213
|
-
createVNode(
|
|
229
|
+
createVNode(unref(ElIcon), { class: "text-white" }, {
|
|
214
230
|
default: withCtx(() => [
|
|
215
231
|
createVNode(unref(arrow_down_default))
|
|
216
232
|
]),
|
|
@@ -257,7 +273,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
257
273
|
})
|
|
258
274
|
]),
|
|
259
275
|
_: 1
|
|
260
|
-
})) : createCommentVNode("", true)
|
|
276
|
+
})) : createCommentVNode("", true),
|
|
277
|
+
createElementVNode("div", _hoisted_3, [
|
|
278
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(props.defaultButtons, (button) => {
|
|
279
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
280
|
+
key: button.label + button.icon
|
|
281
|
+
}, [
|
|
282
|
+
button.icon ? (openBlock(), createElementBlock("span", {
|
|
283
|
+
key: 0,
|
|
284
|
+
title: button.label,
|
|
285
|
+
class: normalizeClass(["text-2xl inline-flex items-center justify-center cursor-pointer hover:opacity-70 ml-1", [button.icon]]),
|
|
286
|
+
onClick: withModifiers(($event) => handleToolbarButtonClick(button), ["stop"])
|
|
287
|
+
}, null, 10, _hoisted_4)) : createCommentVNode("", true)
|
|
288
|
+
], 64);
|
|
289
|
+
}), 128))
|
|
290
|
+
])
|
|
261
291
|
], 512)
|
|
262
292
|
]);
|
|
263
293
|
};
|