m-eleplus-crud 0.0.8 → 0.0.9

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