jky-component-lib 0.0.100 → 0.0.103

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 (35) hide show
  1. package/dist/es/_virtual/_plugin-vue_export-helper.js +10 -0
  2. package/dist/es/amap/style2.css +2 -13
  3. package/dist/es/amap/style3.css +13 -2
  4. package/dist/es/components.d.ts +1 -0
  5. package/dist/es/components.js +3 -0
  6. package/dist/es/index.js +2 -0
  7. package/dist/es/package.json.js +1 -1
  8. package/dist/es/page-layout/PageLayout.vue.js +6 -0
  9. package/dist/es/page-table/PageTable.vue.d.ts +10 -10
  10. package/dist/es/page-table/PageTable.vue.js +4 -4
  11. package/dist/es/page-table-v2/PageTableV2.vue.d.ts +974 -0
  12. package/dist/es/page-table-v2/PageTableV2.vue.js +7 -0
  13. package/dist/es/page-table-v2/PageTableV2.vue2.js +321 -0
  14. package/dist/es/page-table-v2/index.d.ts +4 -0
  15. package/dist/es/page-table-v2/index.js +7 -0
  16. package/dist/es/page-table-v2/style.css +13 -0
  17. package/dist/es/style.css +8 -0
  18. package/dist/lib/_virtual/_plugin-vue_export-helper.js +10 -0
  19. package/dist/lib/amap/style2.css +2 -13
  20. package/dist/lib/amap/style3.css +13 -2
  21. package/dist/lib/components.d.ts +1 -0
  22. package/dist/lib/components.js +12 -9
  23. package/dist/lib/index.js +8 -6
  24. package/dist/lib/package.json.js +1 -1
  25. package/dist/lib/page-layout/PageLayout.vue.js +6 -0
  26. package/dist/lib/page-table/PageTable.vue.d.ts +10 -10
  27. package/dist/lib/page-table/PageTable.vue.js +4 -4
  28. package/dist/lib/page-table-v2/PageTableV2.vue.d.ts +974 -0
  29. package/dist/lib/page-table-v2/PageTableV2.vue.js +7 -0
  30. package/dist/lib/page-table-v2/PageTableV2.vue2.js +321 -0
  31. package/dist/lib/page-table-v2/index.d.ts +4 -0
  32. package/dist/lib/page-table-v2/index.js +7 -0
  33. package/dist/lib/page-table-v2/style.css +13 -0
  34. package/dist/lib/style.css +8 -0
  35. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const PageTableV2_vue_vue_type_script_setup_true_lang = require("./PageTableV2.vue2.js");
4
+ ;/* empty css */
5
+ const _pluginVue_exportHelper = require("../_virtual/_plugin-vue_export-helper.js");
6
+ const PageTableV2 = /* @__PURE__ */ _pluginVue_exportHelper.default(PageTableV2_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-6a04e384"]]);
7
+ exports.default = PageTableV2;
@@ -0,0 +1,321 @@
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 __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+ var __async = (__this, __arguments, generator) => {
34
+ return new Promise((resolve, reject) => {
35
+ var fulfilled = (value) => {
36
+ try {
37
+ step(generator.next(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ };
42
+ var rejected = (value) => {
43
+ try {
44
+ step(generator.throw(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
+ step((generator = generator.apply(__this, __arguments)).next());
51
+ });
52
+ };
53
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
54
+ const vue = require("vue");
55
+ const core = require("@vueuse/core");
56
+ const ElementPlus = require("element-plus");
57
+ const index = require("../form/index.js");
58
+ const Toolbar_vue_vue_type_script_setup_true_lang = require("../page-table/Toolbar.vue.js");
59
+ ;/* empty css */
60
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
61
+ name: "JkyPageTableV2"
62
+ }), {
63
+ __name: "PageTableV2",
64
+ props: {
65
+ title: { default: "" },
66
+ withCard: { type: Boolean, default: true },
67
+ filterItems: { default: () => [] },
68
+ form: {},
69
+ showSearchButton: { type: Boolean, default: true },
70
+ searchText: { default: "查询" },
71
+ resetText: { default: "重置" },
72
+ dataSource: {},
73
+ width: {},
74
+ height: {},
75
+ columns: {},
76
+ tableProps: { default: () => ({}) },
77
+ formProps: { default: () => ({}) },
78
+ toolbarButtons: {},
79
+ toolbarButtonLimit: { default: 0 },
80
+ class: {},
81
+ loading: { type: Boolean, default: false },
82
+ emptyText: { default: "暂无数据" },
83
+ autoSearchDelay: { default: 500 }
84
+ },
85
+ emits: ["search", "reset", "pageChange", "refresh", "rowClick", "rowDblclick", "cellClick", "selectionChange", "update:form"],
86
+ setup(__props, { expose: __expose, emit: __emit }) {
87
+ const props = __props;
88
+ const emit = __emit;
89
+ const form = vue.ref(props.form || {});
90
+ vue.watch(() => props.form, (newVal) => {
91
+ if (newVal) {
92
+ form.value = newVal;
93
+ }
94
+ }, { deep: true });
95
+ vue.watch(
96
+ () => form.value,
97
+ (newVal) => {
98
+ emit("update:form", newVal);
99
+ },
100
+ { deep: true }
101
+ );
102
+ const internalData = vue.ref([]);
103
+ const tableRef = vue.ref(null);
104
+ const formRef = vue.ref(null);
105
+ const isLoading = vue.ref(props.loading);
106
+ let debounceTimer = null;
107
+ function _debouncedLoadData() {
108
+ if (debounceTimer)
109
+ clearTimeout(debounceTimer);
110
+ if (props.autoSearchDelay === 0)
111
+ return;
112
+ debounceTimer = setTimeout(() => {
113
+ loadData();
114
+ }, props.autoSearchDelay);
115
+ }
116
+ const pageTableV2Ref = vue.ref(null);
117
+ const { isFullscreen: _isFullscreen, toggle: toggleFullscreen } = core.useFullscreen(pageTableV2Ref);
118
+ function handleRefresh() {
119
+ var _a;
120
+ if ((_a = props.dataSource) == null ? void 0 : _a.api) {
121
+ loadData();
122
+ } else {
123
+ emit("refresh");
124
+ }
125
+ }
126
+ const defaultRightButtons = vue.computed(() => {
127
+ const refreshButton = {
128
+ label: "刷新",
129
+ icon: "icon-[mdi--refresh]",
130
+ class: "ml-3",
131
+ onClick: handleRefresh
132
+ };
133
+ const fullscreenButton = {
134
+ label: _isFullscreen.value ? "退出全屏" : "全屏",
135
+ icon: _isFullscreen.value ? "icon-[mdi--fullscreen-exit]" : "icon-[mdi--fullscreen]",
136
+ class: "ml-3",
137
+ onClick: () => toggleFullscreen()
138
+ };
139
+ return [refreshButton, fullscreenButton];
140
+ });
141
+ const selectedCount = vue.computed(() => {
142
+ var _a, _b;
143
+ return ((_b = (_a = tableRef.value) == null ? void 0 : _a.getSelectedRows) == null ? void 0 : _b.call(_a).length) || 0;
144
+ });
145
+ function buildApiParams() {
146
+ var _a, _b;
147
+ if ((_a = props.dataSource) == null ? void 0 : _a.getApiParams) {
148
+ return props.dataSource.getApiParams(form.value);
149
+ }
150
+ if ((_b = props.dataSource) == null ? void 0 : _b.apiParams) {
151
+ return __spreadValues(__spreadValues({}, form.value), props.dataSource.apiParams);
152
+ }
153
+ return __spreadValues({}, form.value);
154
+ }
155
+ function loadData() {
156
+ return __async(this, null, function* () {
157
+ var _a;
158
+ if (!((_a = props.dataSource) == null ? void 0 : _a.api)) {
159
+ console.warn("PageTableV2: 没有配置 dataSource.api");
160
+ return;
161
+ }
162
+ isLoading.value = true;
163
+ try {
164
+ const apiParams = buildApiParams();
165
+ const result = yield props.dataSource.api(apiParams);
166
+ if (Array.isArray(result)) {
167
+ internalData.value = result;
168
+ } else {
169
+ internalData.value = [];
170
+ }
171
+ } catch (error) {
172
+ console.error("PageTableV2: 加载数据失败:", error);
173
+ internalData.value = [];
174
+ } finally {
175
+ isLoading.value = false;
176
+ }
177
+ });
178
+ }
179
+ function handleSearch() {
180
+ var _a;
181
+ emit("search", __spreadValues({}, form.value));
182
+ if ((_a = props.dataSource) == null ? void 0 : _a.api) {
183
+ loadData();
184
+ }
185
+ }
186
+ function handleReset() {
187
+ var _a, _b, _c;
188
+ emit("reset");
189
+ form.value = {};
190
+ if (formRef.value) {
191
+ (_b = (_a = formRef.value) == null ? void 0 : _a.form) == null ? void 0 : _b.resetFields();
192
+ }
193
+ if ((_c = props.dataSource) == null ? void 0 : _c.api) {
194
+ loadData();
195
+ }
196
+ }
197
+ function handleRowClick(row, event) {
198
+ emit("rowClick", row, event);
199
+ }
200
+ function handleRowDblclick(row, event) {
201
+ emit("rowDblclick", row, event);
202
+ }
203
+ function handleCellClick(row, column, event) {
204
+ emit("cellClick", row, column, event);
205
+ }
206
+ __expose({
207
+ refresh: loadData,
208
+ getFilterData: () => __spreadValues({}, form.value),
209
+ setFilterData: (data) => {
210
+ form.value = __spreadValues({}, data);
211
+ },
212
+ resetFilter: handleReset,
213
+ getSelectedRows: () => {
214
+ var _a;
215
+ return ((_a = tableRef.value) == null ? void 0 : _a.getSelectedRows()) || [];
216
+ },
217
+ clearSelection: () => {
218
+ var _a;
219
+ (_a = tableRef.value) == null ? void 0 : _a.clearSelection();
220
+ },
221
+ tableRef,
222
+ formRef
223
+ });
224
+ vue.onMounted(() => {
225
+ var _a;
226
+ if ((_a = props.dataSource) == null ? void 0 : _a.api) {
227
+ loadData();
228
+ }
229
+ });
230
+ vue.watch(
231
+ () => form.value,
232
+ () => {
233
+ var _a;
234
+ if (!props.showSearchButton && ((_a = props.dataSource) == null ? void 0 : _a.api)) {
235
+ _debouncedLoadData();
236
+ }
237
+ },
238
+ { deep: true }
239
+ );
240
+ const processedColumns = vue.computed(() => {
241
+ return props.columns.map((column) => {
242
+ const _a = column, { cellRenderer, hidden, dataKey } = _a, rest = __objRest(_a, ["cellRenderer", "hidden", "dataKey"]);
243
+ return __spreadProps(__spreadValues({}, rest), {
244
+ hidden,
245
+ cellRenderer: cellRenderer || (dataKey ? ({ rowData }) => rowData[dataKey] : void 0)
246
+ });
247
+ });
248
+ });
249
+ return (_ctx, _cache) => {
250
+ const _directive_loading = vue.resolveDirective("loading");
251
+ return vue.openBlock(), vue.createElementBlock("div", {
252
+ ref_key: "pageTableV2Ref",
253
+ ref: pageTableV2Ref,
254
+ class: vue.normalizeClass(["bg-transparent flex flex-col jky-page-table-v2", [props.class]])
255
+ }, [
256
+ __props.filterItems && __props.filterItems.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElCard), {
257
+ key: 0,
258
+ class: "mb-3 flex-none jky-page-table-v2__filter-card"
259
+ }, {
260
+ default: vue.withCtx(() => [
261
+ vue.createVNode(vue.unref(index.JkyForm), vue.mergeProps({
262
+ ref_key: "formRef",
263
+ ref: formRef
264
+ }, __spreadValues({ inline: true, grid: true }, __props.formProps), {
265
+ modelValue: form.value,
266
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value = $event),
267
+ "show-footer": true,
268
+ items: __props.filterItems,
269
+ disabled: isLoading.value,
270
+ "submit-text": "搜索",
271
+ "cancel-text": "重置",
272
+ onReset: handleReset,
273
+ onSubmit: handleSearch
274
+ }), null, 16, ["modelValue", "items", "disabled"])
275
+ ]),
276
+ _: 1
277
+ })) : vue.createCommentVNode("", true),
278
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(props.withCard ? vue.unref(ElementPlus.ElCard) : "div"), { class: "flex-1 min-h-0 jky-page-table-v2__table-card" }, {
279
+ default: vue.withCtx(() => {
280
+ var _a, _b, _c;
281
+ return [
282
+ vue.createVNode(Toolbar_vue_vue_type_script_setup_true_lang.default, {
283
+ "left-buttons": ((_a = props.toolbarButtons) == null ? void 0 : _a.left) || [],
284
+ "batch-buttons": ((_b = props.toolbarButtons) == null ? void 0 : _b.batch) || [],
285
+ "right-buttons": ((_c = props.toolbarButtons) == null ? void 0 : _c.right) || [],
286
+ "default-buttons": defaultRightButtons.value,
287
+ "selected-count": selectedCount.value,
288
+ "toolbar-button-limit": __props.toolbarButtonLimit,
289
+ payload: {
290
+ pageNo: 1,
291
+ pageSize: 10,
292
+ total: 0,
293
+ tableData: internalData.value,
294
+ selectedRows: [],
295
+ filterData: __spreadValues({}, form.value)
296
+ }
297
+ }, null, 8, ["left-buttons", "batch-buttons", "right-buttons", "default-buttons", "selected-count", "toolbar-button-limit", "payload"]),
298
+ vue.withDirectives(vue.createVNode(vue.unref(ElementPlus.ElTableV2), vue.mergeProps({
299
+ ref_key: "tableRef",
300
+ ref: tableRef,
301
+ data: internalData.value,
302
+ columns: processedColumns.value,
303
+ width: props.width,
304
+ height: props.height,
305
+ "empty-text": __props.emptyText
306
+ }, __props.tableProps, {
307
+ onRowClick: handleRowClick,
308
+ onRowDblClick: handleRowDblclick,
309
+ onCellClick: handleCellClick
310
+ }), null, 16, ["data", "columns", "width", "height", "empty-text"]), [
311
+ [_directive_loading, isLoading.value]
312
+ ])
313
+ ];
314
+ }),
315
+ _: 1
316
+ }))
317
+ ], 2);
318
+ };
319
+ }
320
+ }));
321
+ exports.default = _sfc_main;
@@ -0,0 +1,4 @@
1
+ import { InstallWithSFC } from '../utils/types';
2
+ import { default as PageTableV2 } from './PageTableV2.vue';
3
+ export declare const JkyPageTableV2: InstallWithSFC<typeof PageTableV2>;
4
+ export default JkyPageTableV2;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const withInstall = require("../utils/with-install.js");
4
+ const PageTableV2 = require("./PageTableV2.vue.js");
5
+ const JkyPageTableV2 = withInstall.installWithSFC(PageTableV2.default);
6
+ exports.JkyPageTableV2 = JkyPageTableV2;
7
+ exports.default = JkyPageTableV2;
@@ -0,0 +1,13 @@
1
+ /* PageTableV2 组件样式 */
2
+ .jky-page-table-v2[data-v-6a04e384] {
3
+ /* 基础样式 */
4
+ }
5
+ .jky-page-table-v2__filter-card[data-v-6a04e384] {
6
+ /* 筛选项卡片样式 */
7
+ }
8
+ .jky-page-table-v2__table-card[data-v-6a04e384] {
9
+ /* 表格卡片样式 */
10
+ }
11
+ .jky-page-table-v2-toolbar[data-v-6a04e384] {
12
+ /* 工具栏样式 */
13
+ }
@@ -2915,10 +2915,18 @@
2915
2915
  color: var(--el-color-primary);
2916
2916
  }
2917
2917
 
2918
+ .hover\:text-blue-700:hover {
2919
+ color: var(--color-blue-700);
2920
+ }
2921
+
2918
2922
  .hover\:text-blue-900:hover {
2919
2923
  color: var(--color-blue-900);
2920
2924
  }
2921
2925
 
2926
+ .hover\:text-red-700:hover {
2927
+ color: var(--color-red-700);
2928
+ }
2929
+
2922
2930
  .hover\:text-red-900:hover {
2923
2931
  color: var(--color-red-900);
2924
2932
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jky-component-lib",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.103",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },