jky-component-lib 0.0.56 → 0.0.60

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