jky-component-lib 0.0.56 → 0.0.61

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.
Files changed (79) hide show
  1. package/dist/es/add-input/AddInput.vue.d.ts +27 -0
  2. package/dist/es/add-input/AddInput.vue.js +151 -0
  3. package/dist/es/add-input/AddInput.vue3.js +5 -0
  4. package/dist/es/add-input/index.d.ts +4 -0
  5. package/dist/es/add-input/index.js +8 -0
  6. package/dist/es/add-input/style.css +35 -0
  7. package/dist/es/button-nav/ButtonNav.vue.d.ts +4 -4
  8. package/dist/es/code-mirror-editor/CodeMirrorEditor.vue.d.ts +4 -4
  9. package/dist/es/components.d.ts +3 -0
  10. package/dist/es/components.js +10 -1
  11. package/dist/es/form/Form.vue.d.ts +2 -2
  12. package/dist/es/form/FormItem.vue.js +12 -0
  13. package/dist/es/index.js +6 -0
  14. package/dist/es/node_modules/@element-plus/icons-vue/dist/index.js +32 -0
  15. package/dist/es/package.json.js +1 -1
  16. package/dist/es/page-header/PageHeader.vue.js +1 -1
  17. package/dist/es/page-header/PopoverMenu.vue.d.ts +1 -1
  18. package/dist/es/page-header/PopoverMenu.vue.js +1 -1
  19. package/dist/es/page-table/PageTable.vue.d.ts +6087 -0
  20. package/dist/es/page-table/PageTable.vue.js +374 -0
  21. package/dist/es/page-table/PageTable.vue3.js +5 -0
  22. package/dist/es/page-table/Toolbar.vue.d.ts +32 -0
  23. package/dist/es/page-table/Toolbar.vue.js +268 -0
  24. package/dist/es/page-table/Toolbar.vue3.js +5 -0
  25. package/dist/es/page-table/index.d.ts +4 -0
  26. package/dist/es/page-table/index.js +8 -0
  27. package/dist/es/page-table/style.css +4 -0
  28. package/dist/es/rich-editor/RichEditor.vue.d.ts +78 -0
  29. package/dist/es/rich-editor/RichEditor.vue.js +105 -0
  30. package/dist/es/rich-editor/RichEditor.vue3.js +5 -0
  31. package/dist/es/rich-editor/index.d.ts +4 -0
  32. package/dist/es/rich-editor/index.js +8 -0
  33. package/dist/es/rich-editor/style.css +34 -0
  34. package/dist/es/style.css +28 -0
  35. package/dist/es/styles.css +1 -1
  36. package/dist/es/utils/index.d.ts +1 -0
  37. package/dist/es/utils/responsive-toolbar.d.ts +78 -0
  38. package/dist/es/utils/responsive-toolbar.js +64 -0
  39. package/dist/lib/add-input/AddInput.vue.d.ts +27 -0
  40. package/dist/lib/add-input/AddInput.vue.js +151 -0
  41. package/dist/lib/add-input/AddInput.vue3.js +5 -0
  42. package/dist/lib/add-input/index.d.ts +4 -0
  43. package/dist/lib/add-input/index.js +8 -0
  44. package/dist/lib/add-input/style.css +35 -0
  45. package/dist/lib/button-nav/ButtonNav.vue.d.ts +4 -4
  46. package/dist/lib/code-mirror-editor/CodeMirrorEditor.vue.d.ts +4 -4
  47. package/dist/lib/components.d.ts +3 -0
  48. package/dist/lib/components.js +30 -21
  49. package/dist/lib/form/Form.vue.d.ts +2 -2
  50. package/dist/lib/form/FormItem.vue.js +20 -8
  51. package/dist/lib/index.js +20 -14
  52. package/dist/lib/node_modules/@element-plus/icons-vue/dist/index.js +32 -0
  53. package/dist/lib/package.json.js +1 -1
  54. package/dist/lib/page-header/PageHeader.vue.js +2 -2
  55. package/dist/lib/page-header/PopoverMenu.vue.d.ts +1 -1
  56. package/dist/lib/page-header/PopoverMenu.vue.js +1 -1
  57. package/dist/lib/page-table/PageTable.vue.d.ts +6087 -0
  58. package/dist/lib/page-table/PageTable.vue.js +374 -0
  59. package/dist/lib/page-table/PageTable.vue3.js +5 -0
  60. package/dist/lib/page-table/Toolbar.vue.d.ts +32 -0
  61. package/dist/lib/page-table/Toolbar.vue.js +268 -0
  62. package/dist/lib/page-table/Toolbar.vue3.js +5 -0
  63. package/dist/lib/page-table/index.d.ts +4 -0
  64. package/dist/lib/page-table/index.js +8 -0
  65. package/dist/lib/page-table/style.css +4 -0
  66. package/dist/lib/rich-editor/RichEditor.vue.d.ts +78 -0
  67. package/dist/lib/rich-editor/RichEditor.vue.js +105 -0
  68. package/dist/lib/rich-editor/RichEditor.vue3.js +5 -0
  69. package/dist/lib/rich-editor/index.d.ts +4 -0
  70. package/dist/lib/rich-editor/index.js +8 -0
  71. package/dist/lib/rich-editor/style.css +34 -0
  72. package/dist/lib/style.css +28 -0
  73. package/dist/lib/styles.css +1 -1
  74. package/dist/lib/utils/index.d.ts +1 -0
  75. package/dist/lib/utils/responsive-toolbar.d.ts +78 -0
  76. package/dist/lib/utils/responsive-toolbar.js +64 -0
  77. package/package.json +4 -1
  78. package/dist/umd/index.js +0 -3966
  79. package/dist/umd/styles.css +0 -1
@@ -0,0 +1,374 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
41
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
42
+ const vue = require("vue");
43
+ const ElementPlus = require("element-plus");
44
+ const index = require("../form/index.js");
45
+ const Toolbar_vue_vue_type_script_setup_true_lang = require("./Toolbar.vue.js");
46
+ ;/* empty css */
47
+ const _hoisted_1 = { class: "jky-page-table__filter-actions" };
48
+ const _hoisted_2 = {
49
+ key: 0,
50
+ class: "flex flex-end mt-4 jky-page-table__pagination"
51
+ };
52
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
53
+ name: "JkyPageTable"
54
+ }), {
55
+ __name: "PageTable",
56
+ props: {
57
+ title: { default: "" },
58
+ filterItems: { default: () => [] },
59
+ filterModel: { default: () => ({}) },
60
+ columns: {},
61
+ dataSource: {},
62
+ showSearchButton: { type: Boolean, default: true },
63
+ searchText: { default: "查询" },
64
+ resetText: { default: "重置" },
65
+ selection: { type: Boolean, default: false },
66
+ selectedRows: { default: () => [] },
67
+ pagination: {},
68
+ border: { type: Boolean, default: true },
69
+ stripe: { type: Boolean, default: false },
70
+ height: {},
71
+ maxHeight: {},
72
+ emptyText: { default: "暂无数据" },
73
+ loading: { type: Boolean, default: false },
74
+ className: { default: "" },
75
+ formProps: { default: () => ({}) },
76
+ tableProps: { default: () => ({}) },
77
+ paginationProps: { default: () => ({}) },
78
+ toolbarButtonLimit: { default: 0 },
79
+ toolbarButtons: {}
80
+ },
81
+ emits: ["search", "reset", "rowClick", "rowDblclick", "selectionChange", "pageChange", "sortChange"],
82
+ setup(__props, { expose: __expose, emit: __emit }) {
83
+ var _a, _b, _c;
84
+ const props = __props;
85
+ const emit = __emit;
86
+ const internalFilterModel = vue.ref(__spreadValues({}, props.filterModel));
87
+ const internalData = vue.ref([]);
88
+ const internalPagination = vue.ref({
89
+ currentPage: ((_a = props.pagination) == null ? void 0 : _a.currentPage) || 1,
90
+ pageSize: ((_b = props.pagination) == null ? void 0 : _b.pageSize) || 10,
91
+ total: ((_c = props.pagination) == null ? void 0 : _c.total) || 0
92
+ });
93
+ const tableRef = vue.ref(null);
94
+ const formRef = vue.ref(null);
95
+ const paginationRef = vue.ref(null);
96
+ const isLoading = vue.ref(props.loading);
97
+ const showPagination = vue.computed(() => {
98
+ var _a2;
99
+ return !!((_a2 = props.dataSource) == null ? void 0 : _a2.api);
100
+ });
101
+ function getColumnProps(column) {
102
+ return __spreadValues({}, column);
103
+ }
104
+ vue.watch(
105
+ () => props.pagination,
106
+ (newPagination) => {
107
+ if (newPagination) {
108
+ internalPagination.value.currentPage = newPagination.currentPage || 1;
109
+ internalPagination.value.pageSize = newPagination.pageSize || 10;
110
+ internalPagination.value.total = newPagination.total || 0;
111
+ }
112
+ },
113
+ { deep: true }
114
+ );
115
+ function loadData() {
116
+ return __async(this, null, function* () {
117
+ var _a2;
118
+ if (!((_a2 = props.dataSource) == null ? void 0 : _a2.api))
119
+ return;
120
+ isLoading.value = true;
121
+ try {
122
+ const result = yield props.dataSource.api(__spreadValues({
123
+ currentPage: internalPagination.value.currentPage,
124
+ pageSize: internalPagination.value.pageSize
125
+ }, internalFilterModel.value));
126
+ const responseProps = props.dataSource.responseProps || {};
127
+ const recordsField = responseProps.recordsField || "records";
128
+ const totalField = responseProps.totalField || "total";
129
+ internalData.value = result[recordsField] || [];
130
+ internalPagination.value.total = result[totalField] || 0;
131
+ emit("pageChange", {
132
+ currentPage: internalPagination.value.currentPage,
133
+ pageSize: internalPagination.value.pageSize
134
+ });
135
+ } catch (error) {
136
+ console.error("加载数据失败:", error);
137
+ internalData.value = [];
138
+ internalPagination.value.total = 0;
139
+ } finally {
140
+ isLoading.value = false;
141
+ }
142
+ });
143
+ }
144
+ function handleSearch() {
145
+ var _a2;
146
+ emit("search", __spreadValues({}, internalFilterModel.value));
147
+ if ((_a2 = props.dataSource) == null ? void 0 : _a2.api) {
148
+ internalPagination.value.currentPage = 1;
149
+ loadData();
150
+ }
151
+ }
152
+ function handleReset() {
153
+ var _a2;
154
+ internalFilterModel.value = {};
155
+ emit("reset");
156
+ if (formRef.value) {
157
+ formRef.value.resetFields();
158
+ }
159
+ if ((_a2 = props.dataSource) == null ? void 0 : _a2.api) {
160
+ internalPagination.value.currentPage = 1;
161
+ loadData();
162
+ }
163
+ }
164
+ function handlePageChange(page) {
165
+ var _a2, _b2;
166
+ internalPagination.value.currentPage = page;
167
+ if ((_a2 = props.dataSource) == null ? void 0 : _a2.api) {
168
+ loadData();
169
+ } else if ((_b2 = props.pagination) == null ? void 0 : _b2.onPageChange) {
170
+ props.pagination.onPageChange(page);
171
+ }
172
+ emit("pageChange", {
173
+ currentPage: internalPagination.value.currentPage,
174
+ pageSize: internalPagination.value.pageSize
175
+ });
176
+ }
177
+ function handlePageSizeChange(size) {
178
+ var _a2, _b2;
179
+ internalPagination.value.pageSize = size;
180
+ internalPagination.value.currentPage = 1;
181
+ if ((_a2 = props.dataSource) == null ? void 0 : _a2.api) {
182
+ loadData();
183
+ } else if ((_b2 = props.pagination) == null ? void 0 : _b2.onPageSizeChange) {
184
+ props.pagination.onPageSizeChange(size);
185
+ }
186
+ emit("pageChange", {
187
+ currentPage: internalPagination.value.currentPage,
188
+ pageSize: internalPagination.value.pageSize
189
+ });
190
+ }
191
+ const selectedCount = vue.ref(0);
192
+ function handleSelectionChange(selection) {
193
+ selectedCount.value = selection.length;
194
+ emit("selectionChange", selection);
195
+ }
196
+ function handleRowClick(row, column) {
197
+ emit("rowClick", row, column);
198
+ }
199
+ function handleRowDblclick(row, column) {
200
+ emit("rowDblclick", row, column);
201
+ }
202
+ function handleSortChange({ column, prop, order }) {
203
+ emit("sortChange", { column, prop, order });
204
+ }
205
+ __expose({
206
+ refresh: loadData,
207
+ getFilterData: () => __spreadValues({}, internalFilterModel.value),
208
+ setFilterData: (data) => {
209
+ internalFilterModel.value = __spreadValues({}, data);
210
+ },
211
+ resetFilter: handleReset,
212
+ getSelectedRows: () => {
213
+ var _a2;
214
+ return ((_a2 = tableRef.value) == null ? void 0 : _a2.getSelectionRows()) || [];
215
+ },
216
+ clearSelection: () => {
217
+ var _a2;
218
+ (_a2 = tableRef.value) == null ? void 0 : _a2.clearSelection();
219
+ },
220
+ toggleRowSelection: (row, selected) => {
221
+ var _a2;
222
+ (_a2 = tableRef.value) == null ? void 0 : _a2.toggleRowSelection(row, selected);
223
+ },
224
+ sort: (prop, order) => {
225
+ var _a2;
226
+ (_a2 = tableRef.value) == null ? void 0 : _a2.sort(prop, order);
227
+ },
228
+ formRef,
229
+ tableRef,
230
+ paginationRef
231
+ });
232
+ vue.onMounted(() => {
233
+ var _a2;
234
+ if ((_a2 = props.dataSource) == null ? void 0 : _a2.api) {
235
+ loadData();
236
+ }
237
+ });
238
+ return (_ctx, _cache) => {
239
+ const _component_ElButton = vue.resolveComponent("ElButton");
240
+ const _directive_loading = vue.resolveDirective("loading");
241
+ return vue.openBlock(), vue.createElementBlock("div", {
242
+ class: vue.normalizeClass(["bg-transparent jky-page-table", [__props.className]])
243
+ }, [
244
+ __props.filterItems && __props.filterItems.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElCard), {
245
+ key: 0,
246
+ class: "mb-4 jky-page-table__filter-card"
247
+ }, {
248
+ default: vue.withCtx(() => [
249
+ vue.createVNode(vue.unref(index.JkyForm), vue.mergeProps({
250
+ ref_key: "formRef",
251
+ ref: formRef,
252
+ modelValue: internalFilterModel.value,
253
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => internalFilterModel.value = $event),
254
+ items: __props.filterItems,
255
+ inline: true,
256
+ disabled: isLoading.value
257
+ }, __props.formProps), null, 16, ["modelValue", "items", "disabled"]),
258
+ vue.createElementVNode("div", _hoisted_1, [
259
+ vue.createVNode(_component_ElButton, {
260
+ type: "primary",
261
+ loading: isLoading.value,
262
+ onClick: handleSearch
263
+ }, {
264
+ default: vue.withCtx(() => [
265
+ vue.createTextVNode(vue.toDisplayString(__props.searchText), 1)
266
+ ]),
267
+ _: 1
268
+ }, 8, ["loading"]),
269
+ vue.createVNode(_component_ElButton, { onClick: handleReset }, {
270
+ default: vue.withCtx(() => [
271
+ vue.createTextVNode(vue.toDisplayString(__props.resetText), 1)
272
+ ]),
273
+ _: 1
274
+ })
275
+ ])
276
+ ]),
277
+ _: 1
278
+ })) : vue.createCommentVNode("", true),
279
+ vue.createVNode(vue.unref(ElementPlus.ElCard), { class: "jky-page-table__table-card" }, {
280
+ default: vue.withCtx(() => {
281
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l;
282
+ return [
283
+ vue.createVNode(Toolbar_vue_vue_type_script_setup_true_lang.default, {
284
+ "left-buttons": ((_a2 = props.toolbarButtons) == null ? void 0 : _a2.left) || [],
285
+ "batch-buttons": ((_b2 = props.toolbarButtons) == null ? void 0 : _b2.batch) || [],
286
+ "right-buttons": ((_c2 = props.toolbarButtons) == null ? void 0 : _c2.right) || [],
287
+ "selected-count": selectedCount.value,
288
+ "toolbar-button-limit": __props.toolbarButtonLimit,
289
+ payload: {
290
+ currentPage: internalPagination.value.currentPage,
291
+ pageSize: internalPagination.value.pageSize,
292
+ total: internalPagination.value.total,
293
+ tableData: internalData.value,
294
+ selectedRows: ((_d = tableRef.value) == null ? void 0 : _d.getSelectionRows()) || [],
295
+ filterData: __spreadValues({}, internalFilterModel.value)
296
+ }
297
+ }, null, 8, ["left-buttons", "batch-buttons", "right-buttons", "selected-count", "toolbar-button-limit", "payload"]),
298
+ vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElTable), vue.mergeProps({
299
+ ref_key: "tableRef",
300
+ ref: tableRef,
301
+ data: internalData.value,
302
+ border: __props.border,
303
+ stripe: __props.stripe,
304
+ height: __props.height,
305
+ "max-height": __props.maxHeight,
306
+ "empty-text": __props.emptyText
307
+ }, __props.tableProps, {
308
+ onSelectionChange: handleSelectionChange,
309
+ onRowClick: handleRowClick,
310
+ onRowDblclick: handleRowDblclick,
311
+ onSortChange: handleSortChange
312
+ }), {
313
+ default: vue.withCtx(() => [
314
+ __props.selection ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElTableColumn), {
315
+ key: 0,
316
+ type: "selection",
317
+ width: "55",
318
+ align: "center"
319
+ })) : vue.createCommentVNode("", true),
320
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.columns, (column) => {
321
+ return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElTableColumn), vue.mergeProps({
322
+ key: column.prop
323
+ }, { ref_for: true }, getColumnProps(column)), {
324
+ default: vue.withCtx((scope) => [
325
+ vue.renderSlot(_ctx.$slots, `column-${column.prop}`, {
326
+ row: scope.row,
327
+ column: scope.column,
328
+ index: scope.$index
329
+ }, () => {
330
+ var _a3;
331
+ return [
332
+ column.render ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent((_a3 = column.render) == null ? void 0 : _a3.call(column, scope)), { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
333
+ vue.createTextVNode(vue.toDisplayString(column.formatter ? column.formatter(scope.row, scope.column, scope.row[column.prop], scope.$index) : scope.row[column.prop]), 1)
334
+ ], 64))
335
+ ];
336
+ })
337
+ ]),
338
+ _: 2
339
+ }, 1040);
340
+ }), 128)),
341
+ vue.renderSlot(_ctx.$slots, "columns")
342
+ ]),
343
+ _: 3
344
+ }, 16, ["data", "border", "stripe", "height", "max-height", "empty-text"])), [
345
+ [_directive_loading, isLoading.value]
346
+ ]),
347
+ showPagination.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
348
+ vue.createVNode(vue.unref(ElementPlus.ElPagination), vue.mergeProps({
349
+ ref_key: "paginationRef",
350
+ ref: paginationRef,
351
+ "current-page": internalPagination.value.currentPage,
352
+ "onUpdate:currentPage": _cache[1] || (_cache[1] = ($event) => internalPagination.value.currentPage = $event),
353
+ "page-size": internalPagination.value.pageSize,
354
+ "onUpdate:pageSize": _cache[2] || (_cache[2] = ($event) => internalPagination.value.pageSize = $event),
355
+ total: internalPagination.value.total,
356
+ "page-sizes": ((_e = __props.pagination) == null ? void 0 : _e.pageSizes) || [10, 20, 50, 100],
357
+ layout: ((_f = __props.pagination) == null ? void 0 : _f.layout) || "total, sizes, prev, pager, next, jumper",
358
+ "show-size-picker": (_h = (_g = __props.pagination) == null ? void 0 : _g.showSizePicker) != null ? _h : true,
359
+ "show-total": (_j = (_i = __props.pagination) == null ? void 0 : _i.showTotal) != null ? _j : true,
360
+ "show-jumper": (_l = (_k = __props.pagination) == null ? void 0 : _k.showJumper) != null ? _l : true
361
+ }, __props.paginationProps, {
362
+ onSizeChange: handlePageSizeChange,
363
+ onCurrentChange: handlePageChange
364
+ }), null, 16, ["current-page", "page-size", "total", "page-sizes", "layout", "show-size-picker", "show-total", "show-jumper"])
365
+ ])) : vue.createCommentVNode("", true)
366
+ ];
367
+ }),
368
+ _: 3
369
+ })
370
+ ], 2);
371
+ };
372
+ }
373
+ }));
374
+ exports.default = _sfc_main;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const PageTable_vue_vue_type_script_setup_true_lang = require("./PageTable.vue.js");
4
+ ;/* empty css */
5
+ exports.default = PageTable_vue_vue_type_script_setup_true_lang.default;
@@ -0,0 +1,32 @@
1
+ import { ToolbarButtonConfig, ToolbarProps } from './types';
2
+ declare function handleBatchCommand(index: number): void;
3
+ declare function handleRightCommand(index: number): void;
4
+ declare const _default: import('vue').DefineComponent<ToolbarProps, {
5
+ handleBatchCommand: typeof handleBatchCommand;
6
+ handleRightCommand: typeof handleRightCommand;
7
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
8
+ batchCommand: (index: number) => any;
9
+ buttonClick: (button: ToolbarButtonConfig) => any;
10
+ rightCommand: (index: number) => any;
11
+ }, string, import('vue').PublicProps, Readonly<ToolbarProps> & Readonly<{
12
+ onBatchCommand?: ((index: number) => any) | undefined;
13
+ onButtonClick?: ((button: ToolbarButtonConfig) => any) | undefined;
14
+ onRightCommand?: ((index: number) => any) | undefined;
15
+ }>, {
16
+ leftButtons: ToolbarButtonConfig[];
17
+ batchButtons: ToolbarButtonConfig[];
18
+ rightButtons: ToolbarButtonConfig[];
19
+ selectedCount: number;
20
+ toolbarButtonLimit: number;
21
+ payload: {
22
+ currentPage: number;
23
+ pageSize: number;
24
+ total: number;
25
+ tableData: any[];
26
+ selectedRows: any[];
27
+ filterData: Record<string, any>;
28
+ };
29
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
30
+ toolbarRightRef: HTMLDivElement;
31
+ }, HTMLDivElement>;
32
+ export default _default;
@@ -0,0 +1,268 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
22
+ const vue = require("vue");
23
+ const index = require("../node_modules/@element-plus/icons-vue/dist/index.js");
24
+ const ElementPlus = require("element-plus");
25
+ const responsiveToolbar = require("../utils/responsive-toolbar.js");
26
+ const _hoisted_1 = { class: "flex items-center justify-between mb-2 py-2 jky-page-table__toolbar" };
27
+ const _hoisted_2 = { class: "flex items-center" };
28
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
29
+ name: "JkyPageTableToolbar"
30
+ }), {
31
+ __name: "Toolbar",
32
+ props: {
33
+ leftButtons: { default: () => [] },
34
+ batchButtons: { default: () => [] },
35
+ rightButtons: { default: () => [] },
36
+ selectedCount: { default: 0 },
37
+ toolbarButtonLimit: { default: 0 },
38
+ payload: { default: () => ({
39
+ currentPage: 1,
40
+ pageSize: 10,
41
+ total: 0,
42
+ tableData: [],
43
+ selectedRows: [],
44
+ filterData: {}
45
+ }) }
46
+ },
47
+ emits: ["batchCommand", "rightCommand", "buttonClick"],
48
+ setup(__props, { expose: __expose, emit: __emit }) {
49
+ const props = __props;
50
+ const emit = __emit;
51
+ const toolbarRightRef = vue.ref(null);
52
+ const {
53
+ visibleCount: visibleRightCount,
54
+ needCollapse: needCollapseRight
55
+ } = responsiveToolbar.useResponsiveToolbar({
56
+ toolbarRef: toolbarRightRef,
57
+ buttonLimit: props.toolbarButtonLimit > 0 ? props.toolbarButtonLimit : void 0,
58
+ minVisibleButtons: 1,
59
+ widthPercentage: 0.5
60
+ // 右侧占 50%
61
+ });
62
+ const showBatchActions = vue.computed(() => {
63
+ return props.batchButtons && props.batchButtons.length > 0 && props.selectedCount && props.selectedCount > 0;
64
+ });
65
+ function getButtonPayload() {
66
+ return props.payload || {
67
+ currentPage: 1,
68
+ pageSize: 10,
69
+ total: 0,
70
+ tableData: [],
71
+ selectedRows: [],
72
+ filterData: {}
73
+ };
74
+ }
75
+ function handleToolbarButtonClick(button) {
76
+ emit("buttonClick", button);
77
+ if (button.onClick) {
78
+ button.onClick(getButtonPayload());
79
+ }
80
+ }
81
+ function handleBatchCommand(index2) {
82
+ var _a;
83
+ emit("batchCommand", index2);
84
+ const button = (_a = props.batchButtons) == null ? void 0 : _a[index2];
85
+ if (button && button.onClick) {
86
+ button.onClick(getButtonPayload());
87
+ }
88
+ }
89
+ function handleRightCommand(index2) {
90
+ var _a;
91
+ emit("rightCommand", index2);
92
+ const button = (_a = props.rightButtons) == null ? void 0 : _a[index2];
93
+ if (button && button.onClick) {
94
+ button.onClick(getButtonPayload());
95
+ }
96
+ }
97
+ function renderLeftButtons() {
98
+ const buttons = [];
99
+ if (props.leftButtons) {
100
+ props.leftButtons.forEach((button, index2) => {
101
+ buttons.push(
102
+ vue.h(
103
+ ElementPlus.ElButton,
104
+ {
105
+ key: index2,
106
+ type: button.type,
107
+ size: button.size,
108
+ disabled: button.disabled,
109
+ plain: button.plain,
110
+ class: button.className,
111
+ onClick: () => handleToolbarButtonClick(button)
112
+ },
113
+ { default: () => button.label }
114
+ )
115
+ );
116
+ });
117
+ }
118
+ return buttons;
119
+ }
120
+ function renderBatchDropdownItems() {
121
+ const items = [];
122
+ if (props.batchButtons) {
123
+ props.batchButtons.forEach((button, index2) => {
124
+ items.push(
125
+ vue.h(
126
+ ElementPlus.ElDropdownItem,
127
+ {
128
+ key: index2,
129
+ type: button.type,
130
+ disabled: button.disabled,
131
+ class: button.className,
132
+ command: index2
133
+ },
134
+ { default: () => button.label }
135
+ )
136
+ );
137
+ });
138
+ }
139
+ return items;
140
+ }
141
+ function renderRightButtons() {
142
+ const buttons = [];
143
+ if (props.rightButtons) {
144
+ props.rightButtons.forEach((button, index2) => {
145
+ const isVisible = index2 < visibleRightCount.value || !needCollapseRight.value;
146
+ if (isVisible) {
147
+ buttons.push(
148
+ vue.h(
149
+ ElementPlus.ElButton,
150
+ {
151
+ key: index2,
152
+ type: button.type,
153
+ size: button.size,
154
+ disabled: button.disabled,
155
+ plain: button.plain,
156
+ class: button.className,
157
+ onClick: () => handleToolbarButtonClick(button)
158
+ },
159
+ { default: () => button.label }
160
+ )
161
+ );
162
+ }
163
+ });
164
+ }
165
+ return buttons;
166
+ }
167
+ function renderRightDropdownItems() {
168
+ const items = [];
169
+ if (props.rightButtons) {
170
+ props.rightButtons.slice(visibleRightCount.value).forEach((button, index2) => {
171
+ const originalIndex = visibleRightCount.value + index2;
172
+ items.push(
173
+ vue.h(
174
+ ElementPlus.ElDropdownItem,
175
+ {
176
+ key: originalIndex,
177
+ command: originalIndex
178
+ },
179
+ { default: () => button.label }
180
+ )
181
+ );
182
+ });
183
+ }
184
+ return items;
185
+ }
186
+ __expose({
187
+ handleBatchCommand,
188
+ handleRightCommand
189
+ });
190
+ return (_ctx, _cache) => {
191
+ const _component_ElIcon = vue.resolveComponent("ElIcon");
192
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
193
+ vue.createElementVNode("div", _hoisted_2, [
194
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderLeftButtons))),
195
+ showBatchActions.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElDropdown), {
196
+ key: 0,
197
+ onCommand: handleBatchCommand
198
+ }, {
199
+ dropdown: vue.withCtx(() => [
200
+ vue.createVNode(vue.unref(ElementPlus.ElDropdownMenu), null, {
201
+ default: vue.withCtx(() => [
202
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderBatchDropdownItems)))
203
+ ]),
204
+ _: 1
205
+ })
206
+ ]),
207
+ default: vue.withCtx(() => {
208
+ var _a;
209
+ return [
210
+ vue.createVNode(vue.unref(ElementPlus.ElButton), {
211
+ type: "primary",
212
+ class: vue.normalizeClass([((_a = props.leftButtons) == null ? void 0 : _a.length) ? "ml-3" : ""])
213
+ }, {
214
+ suffix: vue.withCtx(() => [
215
+ vue.createVNode(_component_ElIcon, { class: "text-white" }, {
216
+ default: vue.withCtx(() => [
217
+ vue.createVNode(vue.unref(index.ArrowDown))
218
+ ]),
219
+ _: 1
220
+ })
221
+ ]),
222
+ default: vue.withCtx(() => [
223
+ vue.createTextVNode(" 批量操作 (" + vue.toDisplayString(__props.selectedCount) + ") ", 1)
224
+ ]),
225
+ _: 1
226
+ }, 8, ["class"])
227
+ ];
228
+ }),
229
+ _: 1
230
+ })) : vue.createCommentVNode("", true)
231
+ ]),
232
+ vue.createElementVNode("div", {
233
+ ref_key: "toolbarRightRef",
234
+ ref: toolbarRightRef,
235
+ class: "flex items-center jky-page-table__toolbar-right"
236
+ }, [
237
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderRightButtons))),
238
+ vue.unref(needCollapseRight) && __props.rightButtons && __props.rightButtons.length > vue.unref(visibleRightCount) ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElDropdown), {
239
+ key: 0,
240
+ onCommand: handleRightCommand
241
+ }, {
242
+ dropdown: vue.withCtx(() => [
243
+ vue.createVNode(vue.unref(ElementPlus.ElDropdownMenu), null, {
244
+ default: vue.withCtx(() => [
245
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderRightDropdownItems)))
246
+ ]),
247
+ _: 1
248
+ })
249
+ ]),
250
+ default: vue.withCtx(() => [
251
+ vue.createVNode(vue.unref(ElementPlus.ElButton), {
252
+ type: "primary",
253
+ class: "ml-3"
254
+ }, {
255
+ default: vue.withCtx(() => [..._cache[0] || (_cache[0] = [
256
+ vue.createTextVNode(" 更多 ", -1)
257
+ ])]),
258
+ _: 1
259
+ })
260
+ ]),
261
+ _: 1
262
+ })) : vue.createCommentVNode("", true)
263
+ ], 512)
264
+ ]);
265
+ };
266
+ }
267
+ }));
268
+ exports.default = _sfc_main;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const Toolbar_vue_vue_type_script_setup_true_lang = require("./Toolbar.vue.js");
4
+ ;/* empty css */
5
+ exports.default = Toolbar_vue_vue_type_script_setup_true_lang.default;
@@ -0,0 +1,4 @@
1
+ import { InstallWithSFC } from '../utils/types';
2
+ import { default as PageTable } from './PageTable.vue';
3
+ export declare const JkyPageTable: InstallWithSFC<typeof PageTable>;
4
+ export default JkyPageTable;