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