m-eleplus-crud 0.0.12 → 0.0.14

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 (54) hide show
  1. package/dist/index.full.js +4 -3
  2. package/dist/index.full.min.js +2 -2
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +2 -2
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +4 -3
  7. package/es/components/table/src/table.d.ts +7 -0
  8. package/es/index.mjs +3 -3
  9. package/es/packages/components/barcode/index.mjs +2 -2
  10. package/es/packages/components/barcode/src/barcode.mjs +18 -53
  11. package/es/packages/components/barcode/src/barcode.mjs.map +1 -1
  12. package/es/packages/components/barcode/src/barcode2.mjs +53 -18
  13. package/es/packages/components/barcode/src/barcode2.mjs.map +1 -1
  14. package/es/packages/components/dialog/index.mjs +2 -2
  15. package/es/packages/components/dialog/src/dialog.mjs +75 -116
  16. package/es/packages/components/dialog/src/dialog.mjs.map +1 -1
  17. package/es/packages/components/dialog/src/dialog2.mjs +116 -75
  18. package/es/packages/components/dialog/src/dialog2.mjs.map +1 -1
  19. package/es/packages/components/form/src/form.mjs +1 -1
  20. package/es/packages/components/form/src/form.mjs.map +1 -1
  21. package/es/packages/components/index.mjs +3 -3
  22. package/es/packages/components/picture/index.mjs +2 -2
  23. package/es/packages/components/picture/src/picture.mjs +19 -26
  24. package/es/packages/components/picture/src/picture.mjs.map +1 -1
  25. package/es/packages/components/picture/src/picture2.mjs +26 -19
  26. package/es/packages/components/picture/src/picture2.mjs.map +1 -1
  27. package/es/packages/components/table/src/table.mjs +3 -2
  28. package/es/packages/components/table/src/table.mjs.map +1 -1
  29. package/es/packages/components/table/src/table2.mjs.map +1 -1
  30. package/lib/components/table/src/table.d.ts +7 -0
  31. package/lib/index.js +3 -3
  32. package/lib/packages/components/barcode/index.js +2 -2
  33. package/lib/packages/components/barcode/src/barcode.js +19 -57
  34. package/lib/packages/components/barcode/src/barcode.js.map +1 -1
  35. package/lib/packages/components/barcode/src/barcode2.js +57 -19
  36. package/lib/packages/components/barcode/src/barcode2.js.map +1 -1
  37. package/lib/packages/components/dialog/index.js +2 -2
  38. package/lib/packages/components/dialog/src/dialog.js +76 -116
  39. package/lib/packages/components/dialog/src/dialog.js.map +1 -1
  40. package/lib/packages/components/dialog/src/dialog2.js +116 -76
  41. package/lib/packages/components/dialog/src/dialog2.js.map +1 -1
  42. package/lib/packages/components/form/src/form.js +1 -1
  43. package/lib/packages/components/form/src/form.js.map +1 -1
  44. package/lib/packages/components/index.js +3 -3
  45. package/lib/packages/components/picture/index.js +2 -2
  46. package/lib/packages/components/picture/src/picture.js +20 -26
  47. package/lib/packages/components/picture/src/picture.js.map +1 -1
  48. package/lib/packages/components/picture/src/picture2.js +26 -20
  49. package/lib/packages/components/picture/src/picture2.js.map +1 -1
  50. package/lib/packages/components/table/src/table.js +3 -2
  51. package/lib/packages/components/table/src/table.js.map +1 -1
  52. package/lib/packages/components/table/src/table2.js.map +1 -1
  53. package/package.json +1 -1
  54. package/web-types.json +1 -1
@@ -2,124 +2,84 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vue = require('vue');
6
- var dialog = require('./dialog2.js');
7
- var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
8
- var index = require('../../../hooks/use-locale/index.js');
9
- var useGlobalConfig = require('../../config-provider/src/hooks/use-global-config.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');
10
9
 
11
- const COMPONENT_NAME = "MDialog";
12
- const __default__ = vue.defineComponent({
13
- name: COMPONENT_NAME
14
- });
15
- const _sfc_main = vue.defineComponent({
16
- ...__default__,
17
- props: dialog.dialogProps,
18
- emits: dialog.dialogEmits,
19
- setup(__props, { emit: __emit }) {
20
- const props = __props;
21
- const emit = __emit;
22
- const slots = vue.useSlots();
23
- const { t } = index.useLocale();
24
- const globalConfig = useGlobalConfig.useGlobalConfig();
25
- const dialogLoading = vue.ref(false);
26
- const closeDialog = () => {
27
- emit("update:modelValue", false);
28
- emit("close");
29
- };
30
- const enter = () => {
31
- dialogLoading.value = true;
32
- const done = () => {
33
- emit("update:modelValue", false);
34
- };
35
- const loading = () => {
36
- dialogLoading.value = false;
37
- };
38
- emit("enter", done, loading);
39
- };
40
- const close = () => {
41
- emit("update:modelValue", false);
42
- emit("cancel");
43
- };
44
- const onBeforeClose = (done) => {
45
- if (dialogLoading.value) {
46
- return false;
47
- }
48
- if (props.beforeClose) {
49
- props.beforeClose(done);
50
- } else {
51
- done();
52
- }
53
- };
54
- return (_ctx, _cache) => {
55
- const _component_el_button = vue.resolveComponent("el-button");
56
- const _component_el_dialog = vue.resolveComponent("el-dialog");
57
- return vue.openBlock(), vue.createElementBlock("div", { class: "m-dialog" }, [
58
- vue.createVNode(_component_el_dialog, {
59
- class: "m-dialog",
60
- "model-value": _ctx.modelValue,
61
- title: _ctx.title,
62
- width: _ctx.width,
63
- top: _ctx.top,
64
- "append-to-body": _ctx.appendToBody,
65
- "close-on-click-modal": _ctx.closeOnClickModal,
66
- "close-onn-press-escape": _ctx.closeOnnPressEscape,
67
- "before-close": onBeforeClose,
68
- draggable: _ctx.draggable,
69
- "destroy-on-close": _ctx.destroyOnClose,
70
- onClose: closeDialog
71
- }, {
72
- footer: vue.withCtx(() => [
73
- !vue.unref(slots).btns ? (vue.openBlock(), vue.createElementBlock("div", {
74
- key: 0,
75
- class: "dialog-footer"
76
- }, [
77
- _ctx.cancelBtn ? (vue.openBlock(), vue.createBlock(_component_el_button, {
78
- key: 0,
79
- size: _ctx.size || vue.unref(globalConfig).size,
80
- icon: _ctx.cancelBtnIcon,
81
- loading: dialogLoading.value,
82
- onClick: close
83
- }, {
84
- default: vue.withCtx(() => [
85
- vue.createTextVNode(
86
- vue.toDisplayString(_ctx.cancelBtnText || vue.unref(t)("m.dialog.cancelText")),
87
- 1
88
- )
89
- ]),
90
- _: 1
91
- }, 8, ["size", "icon", "loading"])) : vue.createCommentVNode("v-if", true),
92
- _ctx.saveBtn ? (vue.openBlock(), vue.createBlock(_component_el_button, {
93
- key: 1,
94
- size: _ctx.size || vue.unref(globalConfig).size,
95
- icon: _ctx.saveBtnIcon,
96
- loading: dialogLoading.value,
97
- type: "primary",
98
- onClick: enter
99
- }, {
100
- default: vue.withCtx(() => [
101
- vue.createTextVNode(
102
- vue.toDisplayString(_ctx.saveBtnText || vue.unref(t)("m.dialog.confirmText")),
103
- 1
104
- )
105
- ]),
106
- _: 1
107
- }, 8, ["size", "icon", "loading"])) : vue.createCommentVNode("v-if", true)
108
- ])) : vue.renderSlot(_ctx.$slots, "btns", {
109
- key: 1,
110
- loading: dialogLoading.value
111
- })
112
- ]),
113
- default: vue.withCtx(() => [
114
- vue.renderSlot(_ctx.$slots, "default", { loading: dialogLoading.value })
115
- ]),
116
- _: 3
117
- }, 8, ["model-value", "title", "width", "top", "append-to-body", "close-on-click-modal", "close-onn-press-escape", "draggable", "destroy-on-close"])
118
- ]);
119
- };
10
+ const dialogProps = runtime.buildProps({
11
+ size: index.useSizeProp,
12
+ modelValue: {
13
+ type: Boolean,
14
+ required: true
15
+ },
16
+ title: {
17
+ type: String,
18
+ default: ""
19
+ },
20
+ width: {
21
+ type: String,
22
+ default: "600px"
23
+ },
24
+ top: {
25
+ type: String,
26
+ default: "2vh"
27
+ },
28
+ appendToBody: {
29
+ type: Boolean,
30
+ default: true
31
+ },
32
+ closeOnClickModal: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ closeOnnPressEscape: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ beforeClose: {
41
+ type: Function
42
+ },
43
+ draggable: {
44
+ type: Boolean,
45
+ default: true
46
+ },
47
+ destroyOnClose: {
48
+ type: Boolean,
49
+ default: true
50
+ },
51
+ saveBtn: {
52
+ type: Boolean,
53
+ default: true
54
+ },
55
+ cancelBtn: {
56
+ type: Boolean,
57
+ default: true
58
+ },
59
+ saveBtnText: {
60
+ type: String,
61
+ default: ""
62
+ },
63
+ saveBtnIcon: {
64
+ type: String,
65
+ default: "CircleCheck"
66
+ },
67
+ cancelBtnIcon: {
68
+ type: String,
69
+ default: "CircleClose"
70
+ },
71
+ cancelBtnText: {
72
+ type: String,
73
+ default: ""
120
74
  }
121
75
  });
122
- var Dialog = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "dialog.vue"]]);
76
+ const dialogEmits = {
77
+ "update:modelValue": (value) => types.isBoolean(value),
78
+ close: () => true,
79
+ cancel: () => true,
80
+ enter: (done, loading) => shared.isFunction(done) && shared.isFunction(loading)
81
+ };
123
82
 
124
- exports["default"] = Dialog;
83
+ exports.dialogEmits = dialogEmits;
84
+ exports.dialogProps = dialogProps;
125
85
  //# sourceMappingURL=dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sources":["../../../../../../../packages/components/dialog/src/dialog.vue"],"sourcesContent":["<template>\r\n <div class=\"m-dialog\">\r\n <el-dialog\r\n class=\"m-dialog\"\r\n :model-value=\"modelValue\"\r\n :title=\"title\"\r\n :width=\"width\"\r\n :top=\"top\"\r\n :append-to-body=\"appendToBody\"\r\n :close-on-click-modal=\"closeOnClickModal\"\r\n :close-onn-press-escape=\"closeOnnPressEscape\"\r\n :before-close=\"onBeforeClose\"\r\n :draggable=\"draggable\"\r\n :destroy-on-close=\"destroyOnClose\"\r\n @close=\"closeDialog\"\r\n >\r\n <slot :loading=\"dialogLoading\" />\r\n <template #footer>\r\n <div v-if=\"!slots.btns\" class=\"dialog-footer\">\r\n <el-button\r\n v-if=\"cancelBtn\"\r\n :size=\"size || globalConfig.size\"\r\n :icon=\"cancelBtnIcon\"\r\n :loading=\"dialogLoading\"\r\n @click=\"close\"\r\n >\r\n {{ cancelBtnText || t('m.dialog.cancelText') }}\r\n </el-button>\r\n <el-button\r\n v-if=\"saveBtn\"\r\n :size=\"size || globalConfig.size\"\r\n :icon=\"saveBtnIcon\"\r\n :loading=\"dialogLoading\"\r\n type=\"primary\"\r\n @click=\"enter\"\r\n >\r\n {{ saveBtnText || t('m.dialog.confirmText') }}\r\n </el-button>\r\n </div>\r\n <slot v-else :loading=\"dialogLoading\" name=\"btns\" />\r\n </template>\r\n </el-dialog>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, useSlots } from 'vue'\r\nimport { useGlobalConfig } from '@m-eleplus-crud/components'\r\nimport { useLocale } from '@m-eleplus-crud/hooks'\r\nimport { dialogEmits, dialogProps } from './dialog'\r\n\r\nconst COMPONENT_NAME = 'MDialog'\r\ndefineOptions({\r\n name: COMPONENT_NAME,\r\n})\r\n\r\nconst props = defineProps(dialogProps)\r\nconst emit = defineEmits(dialogEmits)\r\n\r\n// 插槽信息\r\nconst slots = useSlots()\r\n// 国际化\r\nconst { t } = useLocale()\r\n// 全局配置\r\nconst globalConfig = useGlobalConfig()\r\n\r\n// 弹窗内是否loading\r\nconst dialogLoading = ref(false)\r\n\r\n/**\r\n * @description 弹窗关闭\r\n */\r\nconst closeDialog = () => {\r\n emit('update:modelValue', false)\r\n emit('close')\r\n}\r\n\r\n/**\r\n * 确认\r\n */\r\nconst enter = () => {\r\n // 弹窗开始加载\r\n dialogLoading.value = true\r\n // 关闭表单\r\n const done = () => {\r\n emit('update:modelValue', false)\r\n }\r\n // 关闭加载\r\n const loading = () => {\r\n dialogLoading.value = false\r\n }\r\n\r\n emit('enter', done, loading)\r\n}\r\n\r\n/**\r\n * 关闭\r\n */\r\nconst close = () => {\r\n emit('update:modelValue', false)\r\n emit('cancel')\r\n}\r\n\r\n/**\r\n * 弹窗关闭前\r\n * @param done 完成回调\r\n */\r\nconst onBeforeClose = (done: () => void) => {\r\n if (dialogLoading.value) {\r\n return false\r\n }\r\n if (props.beforeClose) {\r\n props.beforeClose(done)\r\n } else {\r\n done()\r\n }\r\n}\r\n</script>\r\n"],"names":["DO_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B,QAAA,KAAA,CAAM,YAAY,IAAI,CAAA,CAAA;AAAA,OACjB,MAAA;AACA,QAAA,IAAA,EAAA,CAAA;AAAA,OACP;AAAA,KACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"dialog.js","sources":["../../../../../../../packages/components/dialog/src/dialog.ts"],"sourcesContent":["import { buildProps, isBoolean, isFunction } from '@m-eleplus-crud/utils'\r\nimport { useSizeProp } from '@m-eleplus-crud/hooks'\r\n\r\nimport type { ExtractPropTypes } from 'vue'\r\n\r\nexport const dialogProps = buildProps({\r\n /**\r\n * @description 弹窗尺寸\r\n */\r\n size: useSizeProp,\r\n /**\r\n * @description 弹窗显示状态\r\n */\r\n modelValue: {\r\n type: Boolean,\r\n required: true,\r\n },\r\n /**\r\n * @description 弹窗标题\r\n */\r\n title: {\r\n type: String,\r\n default: '',\r\n },\r\n /**\r\n * @description 弹窗宽度\r\n */\r\n width: {\r\n type: String,\r\n default: '600px',\r\n },\r\n /**\r\n * @description 顶部距离\r\n */\r\n top: {\r\n type: String,\r\n default: '2vh',\r\n },\r\n /**\r\n * @description 插入body\r\n */\r\n appendToBody: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 是否可以通过点击modal关闭Dialog\r\n */\r\n closeOnClickModal: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n /**\r\n * @description 是否可以通过按下ESC关闭Dialog\r\n */\r\n closeOnnPressEscape: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n /**\r\n * @description 弹窗关闭前回调\r\n */\r\n beforeClose: {\r\n type: Function,\r\n },\r\n /**\r\n * @description 为dialog开启拖拽功能\r\n */\r\n draggable: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 当关闭Dialog时,销毁其中的元素\r\n */\r\n destroyOnClose: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 保存按钮是否展示\r\n */\r\n saveBtn: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 取消按钮是否展示\r\n */\r\n cancelBtn: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 保存按钮文字\r\n */\r\n saveBtnText: {\r\n type: String,\r\n default: '',\r\n },\r\n /**\r\n * @description 保存按钮图标\r\n */\r\n saveBtnIcon: {\r\n type: String,\r\n default: 'CircleCheck',\r\n },\r\n /**\r\n * @description 取消按钮图标\r\n */\r\n cancelBtnIcon: {\r\n type: String,\r\n default: 'CircleClose',\r\n },\r\n /**\r\n * @description 取消按钮文字\r\n */\r\n cancelBtnText: {\r\n type: String,\r\n default: '',\r\n },\r\n} as const)\r\nexport type DialogProps = ExtractPropTypes<typeof dialogProps>\r\n\r\nexport const dialogEmits = {\r\n /**\r\n * @description 更新弹窗状态\r\n * @param value 弹窗显示状态\r\n * @returns\r\n */\r\n 'update:modelValue': (value: boolean) => isBoolean(value),\r\n /**\r\n * @description 弹窗关闭\r\n * @returns\r\n */\r\n close: () => true,\r\n /**\r\n * @description 弹窗取消\r\n * @returns\r\n */\r\n cancel: () => true,\r\n /**\r\n * @description 弹窗确认\r\n * @param done 完成\r\n * @param loading 加载完毕\r\n * @returns\r\n */\r\n enter: (done: () => void, loading: () => void) =>\r\n isFunction(done) && isFunction(loading),\r\n}\r\nexport type DialogEmits = typeof dialogEmits\r\n"],"names":["buildProps","useSizeProp","isBoolean","isFunction"],"mappings":";;;;;;;;;AAKO,MAAM,cAAcA,kBAAW,CAAA;AAAA,EAIpC,IAAM,EAAAC,iBAAA;AAAA,EAIN,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,OAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAM,EA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X;AACF,CAAU,EAAA;AAGH,MAAM,WAAc,GAAA;AAAA,EAMzB,mBAAqB,EAAA,CAAC,KAAmB,KAAAC,eAAA,CAAU,KAAK,CAAA;AAAA,EAKxD,OAAO,MAAM,IAAA;AAAA,EAKb,QAAQ,MAAM,IAAA;AAAA,EAOd,KAAA,EAAO,CAAC,IAAkB,EAAA,OAAA,KACxBC,kBAAW,IAAI,CAAA,IAAKA,kBAAW,OAAO,CAAA;AAC1C;;;;;"}
@@ -2,84 +2,124 @@
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 dialog = require('./dialog.js');
7
+ var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
8
+ var index = require('../../../hooks/use-locale/index.js');
9
+ var useGlobalConfig = require('../../config-provider/src/hooks/use-global-config.js');
9
10
 
10
- const dialogProps = runtime.buildProps({
11
- size: index.useSizeProp,
12
- modelValue: {
13
- type: Boolean,
14
- required: true
15
- },
16
- title: {
17
- type: String,
18
- default: ""
19
- },
20
- width: {
21
- type: String,
22
- default: "600px"
23
- },
24
- top: {
25
- type: String,
26
- default: "2vh"
27
- },
28
- appendToBody: {
29
- type: Boolean,
30
- default: true
31
- },
32
- closeOnClickModal: {
33
- type: Boolean,
34
- default: false
35
- },
36
- closeOnnPressEscape: {
37
- type: Boolean,
38
- default: false
39
- },
40
- beforeClose: {
41
- type: Function
42
- },
43
- draggable: {
44
- type: Boolean,
45
- default: true
46
- },
47
- destroyOnClose: {
48
- type: Boolean,
49
- default: true
50
- },
51
- saveBtn: {
52
- type: Boolean,
53
- default: true
54
- },
55
- cancelBtn: {
56
- type: Boolean,
57
- default: true
58
- },
59
- saveBtnText: {
60
- type: String,
61
- default: ""
62
- },
63
- saveBtnIcon: {
64
- type: String,
65
- default: "CircleCheck"
66
- },
67
- cancelBtnIcon: {
68
- type: String,
69
- default: "CircleClose"
70
- },
71
- cancelBtnText: {
72
- type: String,
73
- default: ""
11
+ const COMPONENT_NAME = "MDialog";
12
+ const __default__ = vue.defineComponent({
13
+ name: COMPONENT_NAME
14
+ });
15
+ const _sfc_main = vue.defineComponent({
16
+ ...__default__,
17
+ props: dialog.dialogProps,
18
+ emits: dialog.dialogEmits,
19
+ setup(__props, { emit: __emit }) {
20
+ const props = __props;
21
+ const emit = __emit;
22
+ const slots = vue.useSlots();
23
+ const { t } = index.useLocale();
24
+ const globalConfig = useGlobalConfig.useGlobalConfig();
25
+ const dialogLoading = vue.ref(false);
26
+ const closeDialog = () => {
27
+ emit("update:modelValue", false);
28
+ emit("close");
29
+ };
30
+ const enter = () => {
31
+ dialogLoading.value = true;
32
+ const done = () => {
33
+ emit("update:modelValue", false);
34
+ };
35
+ const loading = () => {
36
+ dialogLoading.value = false;
37
+ };
38
+ emit("enter", done, loading);
39
+ };
40
+ const close = () => {
41
+ emit("update:modelValue", false);
42
+ emit("cancel");
43
+ };
44
+ const onBeforeClose = (done) => {
45
+ if (dialogLoading.value) {
46
+ return false;
47
+ }
48
+ if (props.beforeClose) {
49
+ props.beforeClose(done);
50
+ } else {
51
+ done();
52
+ }
53
+ };
54
+ return (_ctx, _cache) => {
55
+ const _component_el_button = vue.resolveComponent("el-button");
56
+ const _component_el_dialog = vue.resolveComponent("el-dialog");
57
+ return vue.openBlock(), vue.createElementBlock("div", { class: "m-dialog" }, [
58
+ vue.createVNode(_component_el_dialog, {
59
+ class: "m-dialog",
60
+ "model-value": _ctx.modelValue,
61
+ title: _ctx.title,
62
+ width: _ctx.width,
63
+ top: _ctx.top,
64
+ "append-to-body": _ctx.appendToBody,
65
+ "close-on-click-modal": _ctx.closeOnClickModal,
66
+ "close-onn-press-escape": _ctx.closeOnnPressEscape,
67
+ "before-close": onBeforeClose,
68
+ draggable: _ctx.draggable,
69
+ "destroy-on-close": _ctx.destroyOnClose,
70
+ onClose: closeDialog
71
+ }, {
72
+ footer: vue.withCtx(() => [
73
+ !vue.unref(slots).btns ? (vue.openBlock(), vue.createElementBlock("div", {
74
+ key: 0,
75
+ class: "dialog-footer"
76
+ }, [
77
+ _ctx.cancelBtn ? (vue.openBlock(), vue.createBlock(_component_el_button, {
78
+ key: 0,
79
+ size: _ctx.size || vue.unref(globalConfig).size,
80
+ icon: _ctx.cancelBtnIcon,
81
+ loading: dialogLoading.value,
82
+ onClick: close
83
+ }, {
84
+ default: vue.withCtx(() => [
85
+ vue.createTextVNode(
86
+ vue.toDisplayString(_ctx.cancelBtnText || vue.unref(t)("m.dialog.cancelText")),
87
+ 1
88
+ )
89
+ ]),
90
+ _: 1
91
+ }, 8, ["size", "icon", "loading"])) : vue.createCommentVNode("v-if", true),
92
+ _ctx.saveBtn ? (vue.openBlock(), vue.createBlock(_component_el_button, {
93
+ key: 1,
94
+ size: _ctx.size || vue.unref(globalConfig).size,
95
+ icon: _ctx.saveBtnIcon,
96
+ loading: dialogLoading.value,
97
+ type: "primary",
98
+ onClick: enter
99
+ }, {
100
+ default: vue.withCtx(() => [
101
+ vue.createTextVNode(
102
+ vue.toDisplayString(_ctx.saveBtnText || vue.unref(t)("m.dialog.confirmText")),
103
+ 1
104
+ )
105
+ ]),
106
+ _: 1
107
+ }, 8, ["size", "icon", "loading"])) : vue.createCommentVNode("v-if", true)
108
+ ])) : vue.renderSlot(_ctx.$slots, "btns", {
109
+ key: 1,
110
+ loading: dialogLoading.value
111
+ })
112
+ ]),
113
+ default: vue.withCtx(() => [
114
+ vue.renderSlot(_ctx.$slots, "default", { loading: dialogLoading.value })
115
+ ]),
116
+ _: 3
117
+ }, 8, ["model-value", "title", "width", "top", "append-to-body", "close-on-click-modal", "close-onn-press-escape", "draggable", "destroy-on-close"])
118
+ ]);
119
+ };
74
120
  }
75
121
  });
76
- const dialogEmits = {
77
- "update:modelValue": (value) => types.isBoolean(value),
78
- close: () => true,
79
- cancel: () => true,
80
- enter: (done, loading) => shared.isFunction(done) && shared.isFunction(loading)
81
- };
122
+ var Dialog = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "dialog.vue"]]);
82
123
 
83
- exports.dialogEmits = dialogEmits;
84
- exports.dialogProps = dialogProps;
124
+ exports["default"] = Dialog;
85
125
  //# sourceMappingURL=dialog2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog2.js","sources":["../../../../../../../packages/components/dialog/src/dialog.ts"],"sourcesContent":["import { buildProps, isBoolean, isFunction } from '@m-eleplus-crud/utils'\r\nimport { useSizeProp } from '@m-eleplus-crud/hooks'\r\n\r\nimport type { ExtractPropTypes } from 'vue'\r\n\r\nexport const dialogProps = buildProps({\r\n /**\r\n * @description 弹窗尺寸\r\n */\r\n size: useSizeProp,\r\n /**\r\n * @description 弹窗显示状态\r\n */\r\n modelValue: {\r\n type: Boolean,\r\n required: true,\r\n },\r\n /**\r\n * @description 弹窗标题\r\n */\r\n title: {\r\n type: String,\r\n default: '',\r\n },\r\n /**\r\n * @description 弹窗宽度\r\n */\r\n width: {\r\n type: String,\r\n default: '600px',\r\n },\r\n /**\r\n * @description 顶部距离\r\n */\r\n top: {\r\n type: String,\r\n default: '2vh',\r\n },\r\n /**\r\n * @description 插入body\r\n */\r\n appendToBody: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 是否可以通过点击modal关闭Dialog\r\n */\r\n closeOnClickModal: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n /**\r\n * @description 是否可以通过按下ESC关闭Dialog\r\n */\r\n closeOnnPressEscape: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n /**\r\n * @description 弹窗关闭前回调\r\n */\r\n beforeClose: {\r\n type: Function,\r\n },\r\n /**\r\n * @description 为dialog开启拖拽功能\r\n */\r\n draggable: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 当关闭Dialog时,销毁其中的元素\r\n */\r\n destroyOnClose: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 保存按钮是否展示\r\n */\r\n saveBtn: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 取消按钮是否展示\r\n */\r\n cancelBtn: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n /**\r\n * @description 保存按钮文字\r\n */\r\n saveBtnText: {\r\n type: String,\r\n default: '',\r\n },\r\n /**\r\n * @description 保存按钮图标\r\n */\r\n saveBtnIcon: {\r\n type: String,\r\n default: 'CircleCheck',\r\n },\r\n /**\r\n * @description 取消按钮图标\r\n */\r\n cancelBtnIcon: {\r\n type: String,\r\n default: 'CircleClose',\r\n },\r\n /**\r\n * @description 取消按钮文字\r\n */\r\n cancelBtnText: {\r\n type: String,\r\n default: '',\r\n },\r\n} as const)\r\nexport type DialogProps = ExtractPropTypes<typeof dialogProps>\r\n\r\nexport const dialogEmits = {\r\n /**\r\n * @description 更新弹窗状态\r\n * @param value 弹窗显示状态\r\n * @returns\r\n */\r\n 'update:modelValue': (value: boolean) => isBoolean(value),\r\n /**\r\n * @description 弹窗关闭\r\n * @returns\r\n */\r\n close: () => true,\r\n /**\r\n * @description 弹窗取消\r\n * @returns\r\n */\r\n cancel: () => true,\r\n /**\r\n * @description 弹窗确认\r\n * @param done 完成\r\n * @param loading 加载完毕\r\n * @returns\r\n */\r\n enter: (done: () => void, loading: () => void) =>\r\n isFunction(done) && isFunction(loading),\r\n}\r\nexport type DialogEmits = typeof dialogEmits\r\n"],"names":["buildProps","useSizeProp","isBoolean","isFunction"],"mappings":";;;;;;;;;AAKO,MAAM,cAAcA,kBAAW,CAAA;AAAA,EAIpC,IAAM,EAAAC,iBAAA;AAAA,EAIN,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,OAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EAIA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,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AACF,CAAU,EAAA;AAGH,MAAM,WAAc,GAAA;AAAA,EAMzB,mBAAqB,EAAA,CAAC,KAAmB,KAAAC,eAAA,CAAU,KAAK,CAAA;AAAA,EAKxD,OAAO,MAAM,IAAA;AAAA,EAKb,QAAQ,MAAM,IAAA;AAAA,EAOd,KAAA,EAAO,CAAC,IAAkB,EAAA,OAAA,KACxBC,kBAAW,IAAI,CAAA,IAAKA,kBAAW,OAAO,CAAA;AAC1C;;;;;"}
1
+ {"version":3,"file":"dialog2.js","sources":["../../../../../../../packages/components/dialog/src/dialog.vue"],"sourcesContent":["<template>\r\n <div class=\"m-dialog\">\r\n <el-dialog\r\n class=\"m-dialog\"\r\n :model-value=\"modelValue\"\r\n :title=\"title\"\r\n :width=\"width\"\r\n :top=\"top\"\r\n :append-to-body=\"appendToBody\"\r\n :close-on-click-modal=\"closeOnClickModal\"\r\n :close-onn-press-escape=\"closeOnnPressEscape\"\r\n :before-close=\"onBeforeClose\"\r\n :draggable=\"draggable\"\r\n :destroy-on-close=\"destroyOnClose\"\r\n @close=\"closeDialog\"\r\n >\r\n <slot :loading=\"dialogLoading\" />\r\n <template #footer>\r\n <div v-if=\"!slots.btns\" class=\"dialog-footer\">\r\n <el-button\r\n v-if=\"cancelBtn\"\r\n :size=\"size || globalConfig.size\"\r\n :icon=\"cancelBtnIcon\"\r\n :loading=\"dialogLoading\"\r\n @click=\"close\"\r\n >\r\n {{ cancelBtnText || t('m.dialog.cancelText') }}\r\n </el-button>\r\n <el-button\r\n v-if=\"saveBtn\"\r\n :size=\"size || globalConfig.size\"\r\n :icon=\"saveBtnIcon\"\r\n :loading=\"dialogLoading\"\r\n type=\"primary\"\r\n @click=\"enter\"\r\n >\r\n {{ saveBtnText || t('m.dialog.confirmText') }}\r\n </el-button>\r\n </div>\r\n <slot v-else :loading=\"dialogLoading\" name=\"btns\" />\r\n </template>\r\n </el-dialog>\r\n </div>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, useSlots } from 'vue'\r\nimport { useGlobalConfig } from '@m-eleplus-crud/components'\r\nimport { useLocale } from '@m-eleplus-crud/hooks'\r\nimport { dialogEmits, dialogProps } from './dialog'\r\n\r\nconst COMPONENT_NAME = 'MDialog'\r\ndefineOptions({\r\n name: COMPONENT_NAME,\r\n})\r\n\r\nconst props = defineProps(dialogProps)\r\nconst emit = defineEmits(dialogEmits)\r\n\r\n// 插槽信息\r\nconst slots = useSlots()\r\n// 国际化\r\nconst { t } = useLocale()\r\n// 全局配置\r\nconst globalConfig = useGlobalConfig()\r\n\r\n// 弹窗内是否loading\r\nconst dialogLoading = ref(false)\r\n\r\n/**\r\n * @description 弹窗关闭\r\n */\r\nconst closeDialog = () => {\r\n emit('update:modelValue', false)\r\n emit('close')\r\n}\r\n\r\n/**\r\n * 确认\r\n */\r\nconst enter = () => {\r\n // 弹窗开始加载\r\n dialogLoading.value = true\r\n // 关闭表单\r\n const done = () => {\r\n emit('update:modelValue', false)\r\n }\r\n // 关闭加载\r\n const loading = () => {\r\n dialogLoading.value = false\r\n }\r\n\r\n emit('enter', done, loading)\r\n}\r\n\r\n/**\r\n * 关闭\r\n */\r\nconst close = () => {\r\n emit('update:modelValue', false)\r\n emit('cancel')\r\n}\r\n\r\n/**\r\n * 弹窗关闭前\r\n * @param done 完成回调\r\n */\r\nconst onBeforeClose = (done: () => void) => {\r\n if (dialogLoading.value) {\r\n return false\r\n }\r\n if (props.beforeClose) {\r\n props.beforeClose(done)\r\n } else {\r\n done()\r\n }\r\n}\r\n</script>\r\n"],"names":["DO_defineComponent","useSlots","useLocale","useGlobalConfig","ref"],"mappings":";;;;;;;;;;;AAoDc,MAAA,cAAAA,mBAAA,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;AAEA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AAGb,IAAA,MAAM,QAAQC,YAA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defineComponent({
577
577
  column.type === "picture" ? (vue.openBlock(), vue.createBlock(_component_MPicture, {
578
578
  key: 0,
579
579
  src: getDetailPic(vue.unref(proxys), column)[0],
580
- "preview-src-list": getDetailPic(vue.unref(proxys), column)[0],
580
+ "preview-src-list": getDetailPic(vue.unref(proxys), column),
581
581
  "img-width": "100px",
582
582
  "img-height": "100px"
583
583
  }, null, 8, ["src", "preview-src-list"])) : NEED_DIC_TYPE.includes(column.type || "") ? (vue.openBlock(), vue.createElementBlock(