m-eleplus-crud 0.0.14 → 0.0.16

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 (88) hide show
  1. package/dist/index.full.js +15 -4
  2. package/dist/index.full.min.js +16 -16
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +14 -14
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +15 -4
  7. package/es/components/crud/src/crud.d.ts +21 -0
  8. package/es/components/crud/src/crud.vue.d.ts +10 -0
  9. package/es/components/table/src/table.d.ts +14 -0
  10. package/es/components/table/src/table.vue.d.ts +10 -0
  11. package/es/index.mjs +6 -6
  12. package/es/packages/components/crud/index.mjs +2 -2
  13. package/es/packages/components/crud/src/crud.mjs +54 -621
  14. package/es/packages/components/crud/src/crud.mjs.map +1 -1
  15. package/es/packages/components/crud/src/crud2.mjs +625 -53
  16. package/es/packages/components/crud/src/crud2.mjs.map +1 -1
  17. package/es/packages/components/form/index.mjs +2 -2
  18. package/es/packages/components/form/src/form.mjs +25 -640
  19. package/es/packages/components/form/src/form.mjs.map +1 -1
  20. package/es/packages/components/form/src/form2.mjs +640 -25
  21. package/es/packages/components/form/src/form2.mjs.map +1 -1
  22. package/es/packages/components/index.mjs +6 -6
  23. package/es/packages/components/pagination/index.mjs +2 -2
  24. package/es/packages/components/pagination/src/pagination.mjs +38 -41
  25. package/es/packages/components/pagination/src/pagination.mjs.map +1 -1
  26. package/es/packages/components/pagination/src/pagination2.mjs +41 -38
  27. package/es/packages/components/pagination/src/pagination2.mjs.map +1 -1
  28. package/es/packages/components/picture/index.mjs +2 -2
  29. package/es/packages/components/picture/src/picture.mjs +26 -19
  30. package/es/packages/components/picture/src/picture.mjs.map +1 -1
  31. package/es/packages/components/picture/src/picture2.mjs +19 -26
  32. package/es/packages/components/picture/src/picture2.mjs.map +1 -1
  33. package/es/packages/components/qrcode/index.mjs +2 -2
  34. package/es/packages/components/qrcode/src/qrcode.mjs +62 -22
  35. package/es/packages/components/qrcode/src/qrcode.mjs.map +1 -1
  36. package/es/packages/components/qrcode/src/qrcode2.mjs +22 -62
  37. package/es/packages/components/qrcode/src/qrcode2.mjs.map +1 -1
  38. package/es/packages/components/search/index.mjs +2 -2
  39. package/es/packages/components/search/src/search.mjs +438 -25
  40. package/es/packages/components/search/src/search.mjs.map +1 -1
  41. package/es/packages/components/search/src/search2.mjs +25 -438
  42. package/es/packages/components/search/src/search2.mjs.map +1 -1
  43. package/es/packages/components/table/src/table.mjs +8 -3
  44. package/es/packages/components/table/src/table.mjs.map +1 -1
  45. package/es/packages/components/table/src/table2.mjs +1 -0
  46. package/es/packages/components/table/src/table2.mjs.map +1 -1
  47. package/lib/components/crud/src/crud.d.ts +21 -0
  48. package/lib/components/crud/src/crud.vue.d.ts +10 -0
  49. package/lib/components/table/src/table.d.ts +14 -0
  50. package/lib/components/table/src/table.vue.d.ts +10 -0
  51. package/lib/index.js +6 -6
  52. package/lib/packages/components/crud/index.js +2 -2
  53. package/lib/packages/components/crud/src/crud.js +55 -621
  54. package/lib/packages/components/crud/src/crud.js.map +1 -1
  55. package/lib/packages/components/crud/src/crud2.js +625 -54
  56. package/lib/packages/components/crud/src/crud2.js.map +1 -1
  57. package/lib/packages/components/form/index.js +2 -2
  58. package/lib/packages/components/form/src/form.js +26 -640
  59. package/lib/packages/components/form/src/form.js.map +1 -1
  60. package/lib/packages/components/form/src/form2.js +640 -26
  61. package/lib/packages/components/form/src/form2.js.map +1 -1
  62. package/lib/packages/components/index.js +6 -6
  63. package/lib/packages/components/pagination/index.js +2 -2
  64. package/lib/packages/components/pagination/src/pagination.js +38 -42
  65. package/lib/packages/components/pagination/src/pagination.js.map +1 -1
  66. package/lib/packages/components/pagination/src/pagination2.js +42 -38
  67. package/lib/packages/components/pagination/src/pagination2.js.map +1 -1
  68. package/lib/packages/components/picture/index.js +2 -2
  69. package/lib/packages/components/picture/src/picture.js +26 -20
  70. package/lib/packages/components/picture/src/picture.js.map +1 -1
  71. package/lib/packages/components/picture/src/picture2.js +20 -26
  72. package/lib/packages/components/picture/src/picture2.js.map +1 -1
  73. package/lib/packages/components/qrcode/index.js +2 -2
  74. package/lib/packages/components/qrcode/src/qrcode.js +66 -23
  75. package/lib/packages/components/qrcode/src/qrcode.js.map +1 -1
  76. package/lib/packages/components/qrcode/src/qrcode2.js +23 -66
  77. package/lib/packages/components/qrcode/src/qrcode2.js.map +1 -1
  78. package/lib/packages/components/search/index.js +2 -2
  79. package/lib/packages/components/search/src/search.js +438 -26
  80. package/lib/packages/components/search/src/search.js.map +1 -1
  81. package/lib/packages/components/search/src/search2.js +26 -438
  82. package/lib/packages/components/search/src/search2.js.map +1 -1
  83. package/lib/packages/components/table/src/table.js +8 -3
  84. package/lib/packages/components/table/src/table.js.map +1 -1
  85. package/lib/packages/components/table/src/table2.js +1 -0
  86. package/lib/packages/components/table/src/table2.js.map +1 -1
  87. package/package.json +1 -1
  88. package/web-types.json +1 -1
@@ -2,64 +2,635 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var types = require('../../../utils/types.js');
6
- var runtime = require('../../../utils/vue/props/runtime.js');
7
- var index = require('../../../hooks/use-size/index.js');
8
- var shared = require('@vue/shared');
5
+ var vue = require('vue');
6
+ var lodashUnified = require('lodash-unified');
7
+ var crud = require('./crud.js');
8
+ var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
9
+ var index$1 = require('../../../../node_modules/.pnpm/element-plus@2.9.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/message-box/index.js');
10
+ var useGlobalConfig = require('../../config-provider/src/hooks/use-global-config.js');
11
+ var index = require('../../../hooks/use-locale/index.js');
9
12
 
10
- const crudProps = runtime.buildProps({
11
- size: index.useSizeProp,
12
- loading: {
13
- type: Boolean,
14
- default: false
15
- },
16
- data: {
17
- type: Array,
18
- required: true
19
- },
20
- search: {
21
- type: Object,
22
- default: () => ({})
23
- },
24
- total: {
25
- type: Number,
26
- default: 0
27
- },
28
- modelValue: {
29
- type: Object,
30
- required: true
31
- },
32
- permission: {
33
- type: Object,
34
- default: () => ({
13
+ const COMPONENT_NAME = "MCrud";
14
+ const __default__ = vue.defineComponent({
15
+ name: COMPONENT_NAME
16
+ });
17
+ const _sfc_main = vue.defineComponent({
18
+ ...__default__,
19
+ props: crud.crudProps,
20
+ emits: crud.crudEmits,
21
+ setup(__props, { expose: __expose, emit: __emit }) {
22
+ const props = __props;
23
+ const emit = __emit;
24
+ const slots = vue.useSlots();
25
+ const globalConfig = useGlobalConfig.useGlobalConfig();
26
+ const { t } = index.useLocale();
27
+ const searchSlots = vue.computed(() => {
28
+ const keys = Object.keys(slots);
29
+ const result = {};
30
+ for (const key of keys) {
31
+ if (key.endsWith("Search")) {
32
+ result[key.replace("Search", "")] = slots[key];
33
+ }
34
+ }
35
+ return result;
36
+ });
37
+ const formSlots = vue.computed(() => {
38
+ const keys = Object.keys(slots);
39
+ const result = {};
40
+ for (const key of keys) {
41
+ if (key.endsWith("Form")) {
42
+ result[key.replace("Form", "")] = slots[key];
43
+ }
44
+ }
45
+ return result;
46
+ });
47
+ const tableSlots = vue.computed(() => {
48
+ const whites = ["topLeft", "topRight", "addBtn"];
49
+ const keys = Object.keys(slots);
50
+ const result = {};
51
+ for (const key of keys) {
52
+ if (!whites.includes(key) && !key.endsWith("Search") && !key.endsWith("Form")) {
53
+ result[key] = slots[key];
54
+ }
55
+ }
56
+ return result;
57
+ });
58
+ const crudOption = vue.ref({
35
59
  addBtn: true,
36
60
  editBtn: true,
37
- delBtn: true
38
- })
39
- },
40
- select: {
41
- type: Array,
42
- default: () => []
43
- },
44
- beforeEnter: {
45
- type: Function
46
- },
47
- option: {
48
- type: runtime.definePropType(Object),
49
- required: false
61
+ delBtn: true,
62
+ addBtnText: t("m.crud.addBtnText"),
63
+ addBtnIcon: "Plus",
64
+ addDialogTitle: t("m.crud.addDialogTitle"),
65
+ editDialogTitle: t("m.crud.editDialogTitle"),
66
+ viewDialogTitle: t("m.crud.viewDialogTitle"),
67
+ dialogWidth: "800px",
68
+ column: []
69
+ });
70
+ const dialogType = vue.ref("add");
71
+ const searchRef = vue.ref();
72
+ const formRef = vue.ref();
73
+ const tableRef = vue.ref();
74
+ const dialogVisible = vue.ref(false);
75
+ const tableHeight = vue.ref(void 0);
76
+ const _modelForm = vue.ref();
77
+ const _rowIndex = vue.ref(-1);
78
+ const dialogTitle = vue.computed(() => {
79
+ if (dialogType.value === "add") {
80
+ return crudOption.value.addDialogTitle;
81
+ }
82
+ if (dialogType.value === "edit") {
83
+ return crudOption.value.editDialogTitle;
84
+ }
85
+ return crudOption.value.viewDialogTitle;
86
+ });
87
+ const modelForm = vue.computed({
88
+ get() {
89
+ return props.modelValue;
90
+ },
91
+ set(value) {
92
+ emit("update:modelValue", value);
93
+ }
94
+ });
95
+ const __firstModelForm = vue.ref({});
96
+ __firstModelForm.value = props.modelValue;
97
+ const tableOption = vue.ref({
98
+ menu: true,
99
+ column: []
100
+ });
101
+ const searchOption = vue.ref({
102
+ column: []
103
+ });
104
+ const formOption = vue.computed(() => {
105
+ let option = {
106
+ column: []
107
+ };
108
+ option = transFormOption(
109
+ Object.assign({}, option, copyObjectExcept(crudOption.value, ["column"]))
110
+ );
111
+ for (let i = 0; i < crudOption.value.column.length; i++) {
112
+ const item = lodashUnified.cloneDeep(crudOption.value.column[i]);
113
+ const formColumn = transFormColumn(item);
114
+ if (["index", "single", "selection"].includes(item.type || "")) {
115
+ continue;
116
+ }
117
+ if (dialogType.value === "add") {
118
+ if (!item.addHide) {
119
+ option.column.push(formColumn);
120
+ }
121
+ } else if (dialogType.value === "edit") {
122
+ if (!item.editHide) {
123
+ option.column.push(formColumn);
124
+ }
125
+ } else {
126
+ if (!item.viewHide) {
127
+ option.column.push(formColumn);
128
+ }
129
+ }
130
+ }
131
+ return option;
132
+ });
133
+ const searchProxys = new Proxy(props.search, {
134
+ get(target, key) {
135
+ return lodashUnified.get(target, key);
136
+ },
137
+ set(target, key, value) {
138
+ lodashUnified.set(target, key, value);
139
+ return true;
140
+ }
141
+ });
142
+ const selectData = vue.computed({
143
+ get() {
144
+ return props.select;
145
+ },
146
+ set(value) {
147
+ emit("update:select", value);
148
+ }
149
+ });
150
+ const transSearchColumn = (column) => {
151
+ const result = lodashUnified.cloneDeep(column);
152
+ if (column.searchOrder) {
153
+ result.order = column.searchOrder;
154
+ } else {
155
+ delete result.order;
156
+ }
157
+ if (column.searchValue) {
158
+ result.value = column.searchValue;
159
+ } else {
160
+ delete result.value;
161
+ }
162
+ if (column.searchPlaceholder) {
163
+ result.placeholder = column.searchPlaceholder;
164
+ } else {
165
+ delete result.placeholder;
166
+ }
167
+ if (column.searchRules) {
168
+ result.rules = column.searchRules;
169
+ } else {
170
+ delete result.rules;
171
+ }
172
+ if (column.searchSpan) {
173
+ result.span = column.searchSpan;
174
+ } else {
175
+ delete result.span;
176
+ }
177
+ if (column.searchLabelWidth) {
178
+ result.labelWidth = column.searchLabelWidth;
179
+ } else {
180
+ delete result.labelWidth;
181
+ }
182
+ if (column.searchClearable) {
183
+ result.clearable = column.searchClearable;
184
+ } else {
185
+ delete result.clearable;
186
+ }
187
+ return result;
188
+ };
189
+ const transFormColumn = (column) => {
190
+ const result = lodashUnified.cloneDeep(column);
191
+ if (column.formOrder) {
192
+ result.order = column.formOrder;
193
+ } else {
194
+ delete result.order;
195
+ }
196
+ if (column.formValue) {
197
+ result.value = column.formValue;
198
+ } else {
199
+ delete result.value;
200
+ }
201
+ if (column.formPlaceholder) {
202
+ result.placeholder = column.formPlaceholder;
203
+ } else {
204
+ delete result.placeholder;
205
+ }
206
+ if (column.formRules) {
207
+ result.rules = column.formRules;
208
+ } else {
209
+ delete result.rules;
210
+ }
211
+ if (column.formLabelWidth) {
212
+ result.labelWidth = column.formLabelWidth;
213
+ } else {
214
+ delete result.labelWidth;
215
+ }
216
+ if (column.formClearable) {
217
+ result.clearable = column.formClearable;
218
+ } else {
219
+ delete result.clearable;
220
+ }
221
+ if (column.formSpan || column.addSpan || column.editSpan || column.viewSpan) {
222
+ if (column.formSpan) {
223
+ result.span = column.formSpan;
224
+ }
225
+ if (dialogType.value === "add" && column.addSpan) {
226
+ result.span = column.addSpan;
227
+ } else if (dialogType.value === "edit" && column.editSpan) {
228
+ result.span = column.editSpan;
229
+ } else if (dialogType.value === "view" && column.viewSpan) {
230
+ result.span = column.viewSpan;
231
+ }
232
+ } else {
233
+ delete result.span;
234
+ }
235
+ if (column.addDisabled || column.editDisabled) {
236
+ if (dialogType.value === "add" && column.addDisabled) {
237
+ result.disabled = column.addDisabled;
238
+ } else if (dialogType.value === "edit" && column.editDisabled) {
239
+ result.disabled = column.editDisabled;
240
+ }
241
+ }
242
+ return result;
243
+ };
244
+ const transSearchOption = (option) => {
245
+ const result = lodashUnified.cloneDeep(option);
246
+ if (option.searchLabelWidth) {
247
+ result.labelWidth = option.searchLabelWidth;
248
+ } else {
249
+ delete result.labelWidth;
250
+ }
251
+ return result;
252
+ };
253
+ const transFormOption = (option) => {
254
+ const result = lodashUnified.cloneDeep(option);
255
+ if (option.formLabelWidth) {
256
+ result.labelWidth = option.formLabelWidth;
257
+ } else {
258
+ delete result.labelWidth;
259
+ }
260
+ return result;
261
+ };
262
+ const currentPageChange = (page) => {
263
+ var _a;
264
+ (_a = searchRef.value) == null ? void 0 : _a.search(page);
265
+ };
266
+ const pageSizeChange = (pageSize) => {
267
+ var _a;
268
+ searchProxys.limit = pageSize;
269
+ (_a = searchRef.value) == null ? void 0 : _a.search();
270
+ };
271
+ const handleSearch = (form) => {
272
+ var _a;
273
+ (_a = tableRef.value) == null ? void 0 : _a.clearSelection();
274
+ emit("search", form);
275
+ };
276
+ const handleReset = () => {
277
+ var _a;
278
+ (_a = tableRef.value) == null ? void 0 : _a.clearSelection();
279
+ emit("reset");
280
+ };
281
+ const setTableHeight = () => {
282
+ vue.nextTick(() => {
283
+ var _a, _b;
284
+ if (crudOption.value.height === "auto") {
285
+ const tableStyle = (_a = tableRef.value) == null ? void 0 : _a.$el;
286
+ const calcHeight = crudOption.value.calcHeight || ((_b = globalConfig.value) == null ? void 0 : _b.calcHeight) || 0;
287
+ tableHeight.value = document.documentElement.clientHeight - ((tableStyle == null ? void 0 : tableStyle.offsetTop) || 0) - 72 - calcHeight;
288
+ } else {
289
+ tableHeight.value = crudOption.value.height;
290
+ }
291
+ });
292
+ };
293
+ const rowAdd = () => {
294
+ dialogType.value = "add";
295
+ dialogVisible.value = true;
296
+ };
297
+ const rowEdit = (row, index) => {
298
+ _modelForm.value = lodashUnified.cloneDeep(row);
299
+ _rowIndex.value = index;
300
+ dialogType.value = "edit";
301
+ modelForm.value = lodashUnified.cloneDeep(row);
302
+ dialogVisible.value = true;
303
+ };
304
+ const rowView = (row, index) => {
305
+ _modelForm.value = lodashUnified.cloneDeep(row);
306
+ _rowIndex.value = index;
307
+ dialogType.value = "view";
308
+ modelForm.value = lodashUnified.cloneDeep(row);
309
+ dialogVisible.value = true;
310
+ };
311
+ const rowDel = (row, index) => {
312
+ index$1.ElMessageBox.confirm("\u6B64\u64CD\u4F5C\u5C06\u5220\u9664\u8BE5\u6570\u636E, \u662F\u5426\u7EE7\u7EED?", "\u63D0\u793A", {
313
+ confirmButtonText: "\u786E\u5B9A",
314
+ cancelButtonText: "\u53D6\u6D88",
315
+ type: "warning"
316
+ }).then(() => {
317
+ emit("rowDel", row, index);
318
+ }).catch(() => {
319
+ });
320
+ };
321
+ const dialogEnter = async (done, loading) => {
322
+ const valid = await formRef.value.validForm();
323
+ if (!valid) {
324
+ loading();
325
+ return;
326
+ }
327
+ if (props.beforeEnter && !await props.beforeEnter()) {
328
+ loading();
329
+ return;
330
+ }
331
+ if (dialogType.value === "add") {
332
+ emit("rowSave", modelForm.value, done, loading);
333
+ } else if (dialogType.value === "edit") {
334
+ emit("rowEdit", modelForm.value, done, loading);
335
+ }
336
+ };
337
+ const dialogCancel = () => {
338
+ emit("rowCancel", _modelForm.value || {}, _rowIndex.value, dialogType.value);
339
+ };
340
+ const dialogClose = () => {
341
+ _modelForm.value = null;
342
+ _rowIndex.value = -1;
343
+ if (formRef.value) {
344
+ formRef.value.clear();
345
+ modelForm.value = lodashUnified.cloneDeep(__firstModelForm.value);
346
+ } else {
347
+ emit("update:modelValue", lodashUnified.cloneDeep(__firstModelForm.value));
348
+ }
349
+ };
350
+ const copyObjectExcept = (sourceObj, excludeKeys = []) => {
351
+ const result = {};
352
+ Object.keys(sourceObj).forEach((key) => {
353
+ if (!excludeKeys.includes(key)) {
354
+ result[key] = sourceObj[key];
355
+ }
356
+ });
357
+ return result;
358
+ };
359
+ const sortChange = (data) => {
360
+ emit("sortChange", data);
361
+ };
362
+ vue.watch(
363
+ () => props.option,
364
+ (newVal) => {
365
+ if (newVal) {
366
+ crudOption.value = Object.assign({}, crudOption.value, newVal);
367
+ tableOption.value = Object.assign(
368
+ {},
369
+ tableOption.value,
370
+ copyObjectExcept(crudOption.value, ["column"])
371
+ );
372
+ searchOption.value = transSearchOption(
373
+ Object.assign(
374
+ {},
375
+ searchOption.value,
376
+ copyObjectExcept(crudOption.value, ["column"])
377
+ )
378
+ );
379
+ const searchColumns = [];
380
+ const tableColumns = [];
381
+ if (newVal.column && newVal.column.length) {
382
+ for (let i = 0; i < newVal.column.length; i++) {
383
+ const item = newVal.column[i];
384
+ if (item.search && !["index", "single", "selection"].includes(item.type || "")) {
385
+ searchColumns.push(transSearchColumn(item));
386
+ }
387
+ if (!item.hide) {
388
+ tableColumns.push(item);
389
+ }
390
+ }
391
+ searchOption.value.column = searchColumns;
392
+ tableOption.value.column = tableColumns;
393
+ }
394
+ }
395
+ },
396
+ {
397
+ immediate: true,
398
+ deep: true
399
+ }
400
+ );
401
+ vue.onMounted(() => {
402
+ if (crudOption.value.height) {
403
+ setTableHeight();
404
+ }
405
+ });
406
+ __expose({
407
+ rowAdd,
408
+ rowEdit,
409
+ rowView,
410
+ rowDel
411
+ });
412
+ return (_ctx, _cache) => {
413
+ const _component_MSearch = vue.resolveComponent("MSearch");
414
+ const _component_el_button = vue.resolveComponent("el-button");
415
+ const _component_el_link = vue.resolveComponent("el-link");
416
+ const _component_MTable = vue.resolveComponent("MTable");
417
+ const _component_m_pagination = vue.resolveComponent("m-pagination");
418
+ const _component_MForm = vue.resolveComponent("MForm");
419
+ const _component_MDialog = vue.resolveComponent("MDialog");
420
+ return vue.openBlock(), vue.createElementBlock("div", { class: "m-crud" }, [
421
+ vue.createVNode(_component_MSearch, {
422
+ ref_key: "searchRef",
423
+ ref: searchRef,
424
+ model: vue.unref(searchProxys),
425
+ option: searchOption.value,
426
+ size: _ctx.size || vue.unref(globalConfig).size,
427
+ permission: _ctx.permission,
428
+ onSearch: handleSearch,
429
+ onReset: handleReset
430
+ }, vue.createSlots({
431
+ _: 2
432
+ }, [
433
+ vue.renderList(Object.keys(searchSlots.value), (slotKey, index) => {
434
+ return {
435
+ name: slotKey,
436
+ fn: vue.withCtx((scope) => [
437
+ vue.renderSlot(_ctx.$slots, slotKey + "Search", vue.normalizeProps(vue.guardReactiveProps(scope)))
438
+ ])
439
+ };
440
+ })
441
+ ]), 1032, ["model", "option", "size", "permission"]),
442
+ vue.createCommentVNode("\u9876\u90E8\u64CD\u4F5C\u533A\u57DF"),
443
+ crudOption.value.addBtn || vue.unref(slots).topLeft || vue.unref(slots).topRight ? (vue.openBlock(), vue.createElementBlock("div", {
444
+ key: 0,
445
+ class: "m-search-top"
446
+ }, [
447
+ crudOption.value.addBtn || vue.unref(slots).topLeft ? (vue.openBlock(), vue.createElementBlock("div", {
448
+ key: 0,
449
+ class: "m-search-left"
450
+ }, [
451
+ crudOption.value.addBtn && !vue.unref(slots).addBtn && _ctx.permission["add"] !== false ? (vue.openBlock(), vue.createBlock(_component_el_button, {
452
+ key: 0,
453
+ size: _ctx.size || vue.unref(globalConfig).size,
454
+ type: "primary",
455
+ icon: crudOption.value.addBtnIcon,
456
+ onClick: ($event) => rowAdd()
457
+ }, {
458
+ default: vue.withCtx(() => [
459
+ vue.createTextVNode(
460
+ vue.toDisplayString(crudOption.value.addBtnText),
461
+ 1
462
+ )
463
+ ]),
464
+ _: 1
465
+ }, 8, ["size", "icon", "onClick"])) : vue.createCommentVNode("v-if", true),
466
+ _ctx.permission["add"] !== false ? vue.renderSlot(_ctx.$slots, "addBtn", vue.normalizeProps(vue.mergeProps({ key: 1 }, { size: _ctx.size || vue.unref(globalConfig).size }))) : vue.createCommentVNode("v-if", true),
467
+ vue.renderSlot(_ctx.$slots, "topLeft", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size })))
468
+ ])) : (vue.openBlock(), vue.createElementBlock("div", {
469
+ key: 1,
470
+ class: "m-search-left"
471
+ })),
472
+ vue.createElementVNode("div", { class: "m-search-right" }, [
473
+ vue.renderSlot(_ctx.$slots, "topRight", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size })))
474
+ ])
475
+ ])) : vue.createCommentVNode("v-if", true),
476
+ vue.createCommentVNode(""),
477
+ vue.createCommentVNode("\u8868\u683C"),
478
+ vue.createVNode(_component_MTable, {
479
+ ref_key: "tableRef",
480
+ ref: tableRef,
481
+ select: selectData.value,
482
+ "onUpdate:select": ($event) => selectData.value = $event,
483
+ data: _ctx.data,
484
+ size: _ctx.size || vue.unref(globalConfig).size,
485
+ loading: _ctx.loading,
486
+ permission: _ctx.permission,
487
+ option: tableOption.value,
488
+ height: tableHeight.value,
489
+ "max-height": tableHeight.value,
490
+ onSortChange: sortChange
491
+ }, vue.createSlots({
492
+ menu: vue.withCtx((scope) => [
493
+ crudOption.value.editBtn && !vue.unref(slots).editBtn && _ctx.permission["edit"] !== false ? (vue.openBlock(), vue.createBlock(_component_el_link, {
494
+ key: 0,
495
+ class: "m-control-btns",
496
+ type: "primary",
497
+ size: _ctx.size || vue.unref(globalConfig).size,
498
+ underline: "never",
499
+ icon: "Edit",
500
+ onClick: ($event) => rowEdit(scope.row, scope.$index)
501
+ }, {
502
+ default: vue.withCtx(() => [
503
+ vue.createTextVNode(
504
+ vue.toDisplayString(vue.unref(t)("m.crud.editBtnText")),
505
+ 1
506
+ )
507
+ ]),
508
+ _: 2
509
+ }, 1032, ["size", "onClick"])) : vue.createCommentVNode("v-if", true),
510
+ crudOption.value.editBtn && vue.unref(slots).editBtn && _ctx.permission["edit"] !== false ? vue.renderSlot(_ctx.$slots, "editBtn", vue.normalizeProps(vue.mergeProps({ key: 1 }, scope))) : vue.createCommentVNode("v-if", true),
511
+ crudOption.value.delBtn && !vue.unref(slots).delBtn && _ctx.permission["del"] !== false ? (vue.openBlock(), vue.createBlock(_component_el_link, {
512
+ key: 2,
513
+ class: "m-control-btns",
514
+ type: "primary",
515
+ underline: "never",
516
+ size: _ctx.size || vue.unref(globalConfig).size,
517
+ icon: "Delete",
518
+ onClick: ($event) => rowDel(scope.row, scope.$index)
519
+ }, {
520
+ default: vue.withCtx(() => [
521
+ vue.createTextVNode(
522
+ vue.toDisplayString(vue.unref(t)("m.crud.delBtnText")),
523
+ 1
524
+ )
525
+ ]),
526
+ _: 2
527
+ }, 1032, ["size", "onClick"])) : vue.createCommentVNode("v-if", true),
528
+ crudOption.value.delBtn && vue.unref(slots).delBtn && _ctx.permission["del"] !== false ? vue.renderSlot(_ctx.$slots, "delBtn", vue.normalizeProps(vue.mergeProps({ key: 3 }, scope))) : vue.createCommentVNode("v-if", true),
529
+ crudOption.value.menu && vue.unref(slots).menu && !(vue.unref(slots).editBtn || vue.unref(slots).delBtn) ? vue.renderSlot(_ctx.$slots, "menu", vue.normalizeProps(vue.mergeProps({ key: 4 }, scope))) : vue.createCommentVNode("v-if", true)
530
+ ]),
531
+ _: 2
532
+ }, [
533
+ vue.renderList(Object.keys(tableSlots.value), (slotKey, index) => {
534
+ return {
535
+ name: slotKey,
536
+ fn: vue.withCtx((scope) => [
537
+ vue.renderSlot(_ctx.$slots, slotKey, vue.normalizeProps(vue.guardReactiveProps(scope)))
538
+ ])
539
+ };
540
+ })
541
+ ]), 1032, ["select", "onUpdate:select", "data", "size", "loading", "permission", "option", "height", "max-height"]),
542
+ vue.createCommentVNode(""),
543
+ vue.createCommentVNode("\u5206\u9875\u533A\u57DF"),
544
+ vue.unref(searchProxys).page && _ctx.total ? (vue.openBlock(), vue.createElementBlock("div", {
545
+ key: 1,
546
+ class: "m-pagination-box"
547
+ }, [
548
+ vue.createVNode(_component_m_pagination, {
549
+ small: (_ctx.size || vue.unref(globalConfig).size) === "small",
550
+ total: _ctx.total,
551
+ "current-page": vue.unref(searchProxys).page,
552
+ "page-size": vue.unref(searchProxys).limit,
553
+ disabled: _ctx.loading,
554
+ onCurrentPage: currentPageChange,
555
+ onPageSize: pageSizeChange
556
+ }, null, 8, ["small", "total", "current-page", "page-size", "disabled"])
557
+ ])) : vue.createCommentVNode("v-if", true),
558
+ vue.createCommentVNode("\u65B0\u589E/\u7F16\u8F91/\u67E5\u770B\u5BF9\u8BDD\u6846"),
559
+ vue.createVNode(_component_MDialog, {
560
+ modelValue: dialogVisible.value,
561
+ "onUpdate:modelValue": ($event) => dialogVisible.value = $event,
562
+ size: _ctx.size || vue.unref(globalConfig).size,
563
+ title: dialogTitle.value,
564
+ width: crudOption.value.dialogWidth,
565
+ "save-btn": dialogType.value !== "view",
566
+ "cancel-btn": dialogType.value !== "view",
567
+ "save-btn-text": vue.unref(t)("m.crud.dialogSaveBtnText"),
568
+ "cancel-btn-text": vue.unref(t)("m.crud.dialogCancelBtnText"),
569
+ "save-btn-icon": dialogType.value === "add" ? "CirclePlus" : "CircleCheck",
570
+ onEnter: dialogEnter,
571
+ onCancel: dialogCancel,
572
+ onClose: dialogClose
573
+ }, {
574
+ default: vue.withCtx(({ loading }) => [
575
+ vue.createCommentVNode("\u6240\u6709\u7C7B\u578B\u9876\u90E8"),
576
+ vue.renderSlot(_ctx.$slots, "allTop", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size, loading }))),
577
+ vue.createCommentVNode(""),
578
+ vue.createCommentVNode("\u65B0\u589E/\u7F16\u8F91\u7C7B\u578B\u9876\u90E8"),
579
+ dialogType.value !== "view" ? vue.renderSlot(_ctx.$slots, "formTop", vue.normalizeProps(vue.mergeProps({ key: 0 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
580
+ vue.createCommentVNode(""),
581
+ vue.createCommentVNode("\u65B0\u589E\u7C7B\u578B\u9876\u90E8"),
582
+ dialogType.value === "add" ? vue.renderSlot(_ctx.$slots, "addTop", vue.normalizeProps(vue.mergeProps({ key: 1 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
583
+ vue.createCommentVNode(""),
584
+ vue.createCommentVNode("\u7F16\u8F91\u7C7B\u578B\u9876\u90E8"),
585
+ dialogType.value === "edit" ? vue.renderSlot(_ctx.$slots, "editTop", vue.normalizeProps(vue.mergeProps({ key: 2 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
586
+ vue.createCommentVNode(""),
587
+ vue.createCommentVNode("\u67E5\u770B\u7C7B\u578B\u9876\u90E8"),
588
+ dialogType.value === "view" ? vue.renderSlot(_ctx.$slots, "viewTop", vue.normalizeProps(vue.mergeProps({ key: 3 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
589
+ vue.createCommentVNode(""),
590
+ vue.createVNode(_component_MForm, {
591
+ ref_key: "formRef",
592
+ ref: formRef,
593
+ loading,
594
+ size: _ctx.size || vue.unref(globalConfig).size,
595
+ option: formOption.value,
596
+ model: modelForm.value,
597
+ readonly: dialogType.value === "view"
598
+ }, vue.createSlots({
599
+ _: 2
600
+ }, [
601
+ vue.renderList(Object.keys(formSlots.value), (slotKey, index) => {
602
+ return {
603
+ name: slotKey,
604
+ fn: vue.withCtx((scope) => [
605
+ vue.renderSlot(_ctx.$slots, slotKey + "Form", vue.normalizeProps(vue.guardReactiveProps(scope)))
606
+ ])
607
+ };
608
+ })
609
+ ]), 1032, ["loading", "size", "option", "model", "readonly"]),
610
+ vue.createCommentVNode("\u6240\u6709\u7C7B\u578B\u5E95\u90E8"),
611
+ vue.renderSlot(_ctx.$slots, "allBottom", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size, loading }))),
612
+ vue.createCommentVNode(""),
613
+ vue.createCommentVNode("\u65B0\u589E/\u7F16\u8F91\u7C7B\u578B\u5E95\u90E8"),
614
+ dialogType.value !== "view" ? vue.renderSlot(_ctx.$slots, "formBottom", vue.normalizeProps(vue.mergeProps({ key: 4 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
615
+ vue.createCommentVNode(""),
616
+ vue.createCommentVNode("\u65B0\u589E\u7C7B\u578B\u5E95\u90E8"),
617
+ dialogType.value === "add" ? vue.renderSlot(_ctx.$slots, "addBottom", vue.normalizeProps(vue.mergeProps({ key: 5 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
618
+ vue.createCommentVNode(""),
619
+ vue.createCommentVNode("\u7F16\u8F91\u7C7B\u578B\u5E95\u90E8"),
620
+ dialogType.value === "edit" ? vue.renderSlot(_ctx.$slots, "editBottom", vue.normalizeProps(vue.mergeProps({ key: 6 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
621
+ vue.createCommentVNode(""),
622
+ vue.createCommentVNode("\u67E5\u770B\u7C7B\u578B\u5E95\u90E8"),
623
+ dialogType.value === "view" ? vue.renderSlot(_ctx.$slots, "viewBottom", vue.normalizeProps(vue.mergeProps({ key: 7 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
624
+ vue.createCommentVNode("")
625
+ ]),
626
+ _: 3
627
+ }, 8, ["modelValue", "onUpdate:modelValue", "size", "title", "width", "save-btn", "cancel-btn", "save-btn-text", "cancel-btn-text", "save-btn-icon"]),
628
+ vue.createCommentVNode("")
629
+ ]);
630
+ };
50
631
  }
51
632
  });
52
- const crudEmits = {
53
- "update:select": (arr) => shared.isArray(arr),
54
- "update:modelValue": (value) => shared.isObject(value),
55
- search: (form) => shared.isObject(form),
56
- reset: () => true,
57
- rowSave: (form, done, loading) => shared.isObject(form) && shared.isFunction(done) && shared.isFunction(loading),
58
- rowEdit: (form, done, loading) => shared.isObject(form) && shared.isFunction(done) && shared.isFunction(loading),
59
- rowCancel: (form, index, type) => shared.isObject(form) && types.isNumber(index) && shared.isString(type),
60
- rowDel: (row, index) => shared.isObject(row) && types.isNumber(index)
61
- };
633
+ var Crud = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "crud.vue"]]);
62
634
 
63
- exports.crudEmits = crudEmits;
64
- exports.crudProps = crudProps;
635
+ exports["default"] = Crud;
65
636
  //# sourceMappingURL=crud2.js.map