m-eleplus-crud 0.0.13 → 0.0.15
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.
- package/dist/index.full.js +3 -2
- package/dist/index.full.min.js +1 -1
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +1 -1
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +3 -2
- package/es/components/crud/src/crud.d.ts +7 -0
- package/es/components/table/src/table.d.ts +7 -0
- package/es/index.mjs +5 -5
- package/es/packages/components/barcode/index.mjs +2 -2
- package/es/packages/components/barcode/src/barcode.mjs +18 -53
- package/es/packages/components/barcode/src/barcode.mjs.map +1 -1
- package/es/packages/components/barcode/src/barcode2.mjs +53 -18
- package/es/packages/components/barcode/src/barcode2.mjs.map +1 -1
- package/es/packages/components/crud/src/crud.mjs.map +1 -1
- package/es/packages/components/dialog/index.mjs +2 -2
- package/es/packages/components/dialog/src/dialog.mjs +75 -116
- package/es/packages/components/dialog/src/dialog.mjs.map +1 -1
- package/es/packages/components/dialog/src/dialog2.mjs +116 -75
- package/es/packages/components/dialog/src/dialog2.mjs.map +1 -1
- package/es/packages/components/form/index.mjs +2 -2
- package/es/packages/components/form/src/form.mjs +25 -640
- package/es/packages/components/form/src/form.mjs.map +1 -1
- package/es/packages/components/form/src/form2.mjs +640 -25
- package/es/packages/components/form/src/form2.mjs.map +1 -1
- package/es/packages/components/index.mjs +5 -5
- package/es/packages/components/picture/index.mjs +2 -2
- package/es/packages/components/picture/src/picture.mjs +26 -19
- package/es/packages/components/picture/src/picture.mjs.map +1 -1
- package/es/packages/components/picture/src/picture2.mjs +19 -26
- package/es/packages/components/picture/src/picture2.mjs.map +1 -1
- package/es/packages/components/search/index.mjs +2 -2
- package/es/packages/components/search/src/search.mjs +25 -438
- package/es/packages/components/search/src/search.mjs.map +1 -1
- package/es/packages/components/search/src/search2.mjs +438 -25
- package/es/packages/components/search/src/search2.mjs.map +1 -1
- package/es/packages/components/table/src/table.mjs.map +1 -1
- package/es/packages/components/table/src/table2.mjs +3 -2
- package/es/packages/components/table/src/table2.mjs.map +1 -1
- package/lib/components/crud/src/crud.d.ts +7 -0
- package/lib/components/table/src/table.d.ts +7 -0
- package/lib/index.js +5 -5
- package/lib/packages/components/barcode/index.js +2 -2
- package/lib/packages/components/barcode/src/barcode.js +19 -57
- package/lib/packages/components/barcode/src/barcode.js.map +1 -1
- package/lib/packages/components/barcode/src/barcode2.js +57 -19
- package/lib/packages/components/barcode/src/barcode2.js.map +1 -1
- package/lib/packages/components/crud/src/crud.js.map +1 -1
- package/lib/packages/components/dialog/index.js +2 -2
- package/lib/packages/components/dialog/src/dialog.js +76 -116
- package/lib/packages/components/dialog/src/dialog.js.map +1 -1
- package/lib/packages/components/dialog/src/dialog2.js +116 -76
- package/lib/packages/components/dialog/src/dialog2.js.map +1 -1
- package/lib/packages/components/form/index.js +2 -2
- package/lib/packages/components/form/src/form.js +26 -640
- package/lib/packages/components/form/src/form.js.map +1 -1
- package/lib/packages/components/form/src/form2.js +640 -26
- package/lib/packages/components/form/src/form2.js.map +1 -1
- package/lib/packages/components/index.js +5 -5
- package/lib/packages/components/picture/index.js +2 -2
- package/lib/packages/components/picture/src/picture.js +26 -20
- package/lib/packages/components/picture/src/picture.js.map +1 -1
- package/lib/packages/components/picture/src/picture2.js +20 -26
- package/lib/packages/components/picture/src/picture2.js.map +1 -1
- package/lib/packages/components/search/index.js +2 -2
- package/lib/packages/components/search/src/search.js +26 -438
- package/lib/packages/components/search/src/search.js.map +1 -1
- package/lib/packages/components/search/src/search2.js +438 -26
- package/lib/packages/components/search/src/search2.js.map +1 -1
- package/lib/packages/components/table/src/table.js.map +1 -1
- package/lib/packages/components/table/src/table2.js +3 -2
- package/lib/packages/components/table/src/table2.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
package/dist/index.full.mjs
CHANGED
|
@@ -18336,7 +18336,8 @@ const _sfc_main = defineComponent({
|
|
|
18336
18336
|
prop: column.prop,
|
|
18337
18337
|
align: column.align || "center",
|
|
18338
18338
|
"show-overflow-tooltip": column.overHidden,
|
|
18339
|
-
formatter: column.formatter ? (row, col, cellValue, index) => column.formatter(row, column, index) : null
|
|
18339
|
+
formatter: column.formatter ? (row, col, cellValue, index) => column.formatter(row, column, index) : null,
|
|
18340
|
+
selectable: column.selectable
|
|
18340
18341
|
}, createSlots({
|
|
18341
18342
|
_: 2
|
|
18342
18343
|
}, [
|
|
@@ -18440,7 +18441,7 @@ const _sfc_main = defineComponent({
|
|
|
18440
18441
|
]),
|
|
18441
18442
|
key: "2"
|
|
18442
18443
|
} : void 0
|
|
18443
|
-
]), 1032, ["type", "width", "label", "prop", "align", "show-overflow-tooltip", "formatter"]);
|
|
18444
|
+
]), 1032, ["type", "width", "label", "prop", "align", "show-overflow-tooltip", "formatter", "selectable"]);
|
|
18444
18445
|
}),
|
|
18445
18446
|
128
|
|
18446
18447
|
)),
|
|
@@ -106,6 +106,13 @@ export interface ICrudCommonColumn extends ICommonColumn, ITableCommonColumn, Wi
|
|
|
106
106
|
}
|
|
107
107
|
export interface ICrudColumn extends ICrudCommonColumn {
|
|
108
108
|
type?: ColumnType | 'index' | 'single' | 'selection';
|
|
109
|
+
/**
|
|
110
|
+
* @description 仅对 type=selection 的列有效,类型为 Function,Function 的返回值用来决定这一行的 CheckBox 是否可以勾选
|
|
111
|
+
* @param row 行数据
|
|
112
|
+
* @param index 索引
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
selectable?: (row: any, index: number) => boolean;
|
|
109
116
|
}
|
|
110
117
|
/**
|
|
111
118
|
* @description crud配置
|
|
@@ -50,6 +50,13 @@ export interface ITableColumn extends ICommonColumn, ITableCommonColumn {
|
|
|
50
50
|
* @description 类型
|
|
51
51
|
*/
|
|
52
52
|
type?: ColumnType | 'index' | 'single' | 'selection';
|
|
53
|
+
/**
|
|
54
|
+
* @description 仅对 type=selection 的列有效,类型为 Function,Function 的返回值用来决定这一行的 CheckBox 是否可以勾选
|
|
55
|
+
* @param row 行数据
|
|
56
|
+
* @param index 索引
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
selectable?: (row: any, index: number) => boolean;
|
|
53
60
|
}
|
|
54
61
|
/**
|
|
55
62
|
* @description 公开的table配置
|
package/es/index.mjs
CHANGED
|
@@ -7,17 +7,17 @@ export { provideGlobalConfig, useGlobalComponentSettings, useGlobalConfig } from
|
|
|
7
7
|
export { MConfigProvider } from './packages/components/config-provider/index.mjs';
|
|
8
8
|
export { tableEmits, tableProps } from './packages/components/table/src/table.mjs';
|
|
9
9
|
export { MTable } from './packages/components/table/index.mjs';
|
|
10
|
-
export { searchEmits, searchProps } from './packages/components/search/src/
|
|
10
|
+
export { searchEmits, searchProps } from './packages/components/search/src/search.mjs';
|
|
11
11
|
export { MSearch } from './packages/components/search/index.mjs';
|
|
12
|
-
export { pictureEmits, pictureProps } from './packages/components/picture/src/
|
|
12
|
+
export { pictureEmits, pictureProps } from './packages/components/picture/src/picture2.mjs';
|
|
13
13
|
export { MPicture } from './packages/components/picture/index.mjs';
|
|
14
|
-
export { dialogEmits, dialogProps } from './packages/components/dialog/src/
|
|
14
|
+
export { dialogEmits, dialogProps } from './packages/components/dialog/src/dialog.mjs';
|
|
15
15
|
export { MDialog } from './packages/components/dialog/index.mjs';
|
|
16
16
|
export { qrcodeEmits, qrcodeProps } from './packages/components/qrcode/src/qrcode2.mjs';
|
|
17
17
|
export { MQrcode } from './packages/components/qrcode/index.mjs';
|
|
18
|
-
export { barcodeEmits, barcodeProps } from './packages/components/barcode/src/
|
|
18
|
+
export { barcodeEmits, barcodeProps } from './packages/components/barcode/src/barcode.mjs';
|
|
19
19
|
export { MBarcode } from './packages/components/barcode/index.mjs';
|
|
20
|
-
export { formEmits, formProps } from './packages/components/form/src/
|
|
20
|
+
export { formEmits, formProps } from './packages/components/form/src/form.mjs';
|
|
21
21
|
export { MForm } from './packages/components/form/index.mjs';
|
|
22
22
|
export { crudEmits, crudProps } from './packages/components/crud/src/crud.mjs';
|
|
23
23
|
export { MCrud } from './packages/components/crud/index.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Barcode from './src/
|
|
2
|
-
export { barcodeEmits, barcodeProps } from './src/
|
|
1
|
+
import Barcode from './src/barcode2.mjs';
|
|
2
|
+
export { barcodeEmits, barcodeProps } from './src/barcode.mjs';
|
|
3
3
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
4
4
|
|
|
5
5
|
const MBarcode = withInstall(Barcode);
|
|
@@ -1,58 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { barcodeProps, barcodeEmits } from './barcode2.mjs';
|
|
4
|
-
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
|
|
1
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
2
|
+
import { isString } from '@vue/shared';
|
|
5
3
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
watch(
|
|
19
|
-
() => props.text,
|
|
20
|
-
(newVal) => {
|
|
21
|
-
if (!newVal)
|
|
22
|
-
return;
|
|
23
|
-
setTimeout(() => {
|
|
24
|
-
barcodeRef.value.innerHTML = "";
|
|
25
|
-
JsBarcode(barcodeRef.value, newVal, {
|
|
26
|
-
format: "CODE128",
|
|
27
|
-
lineColor: "#000",
|
|
28
|
-
width: props.barcodeWidth,
|
|
29
|
-
height: props.barcodeHeight,
|
|
30
|
-
displayValue: false
|
|
31
|
-
});
|
|
32
|
-
barcodeRef.value.onclick = () => {
|
|
33
|
-
emit("click", newVal);
|
|
34
|
-
};
|
|
35
|
-
}, 0);
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
immediate: true
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
return (_ctx, _cache) => {
|
|
42
|
-
return openBlock(), createElementBlock(
|
|
43
|
-
"img",
|
|
44
|
-
{
|
|
45
|
-
ref_key: "barcodeRef",
|
|
46
|
-
ref: barcodeRef,
|
|
47
|
-
class: "m-barcode-box"
|
|
48
|
-
},
|
|
49
|
-
null,
|
|
50
|
-
512
|
|
51
|
-
);
|
|
52
|
-
};
|
|
4
|
+
const barcodeProps = buildProps({
|
|
5
|
+
text: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
barcodeWidth: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 2
|
|
12
|
+
},
|
|
13
|
+
barcodeHeight: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 50
|
|
53
16
|
}
|
|
54
17
|
});
|
|
55
|
-
|
|
18
|
+
const barcodeEmits = {
|
|
19
|
+
click: (val) => isString(val)
|
|
20
|
+
};
|
|
56
21
|
|
|
57
|
-
export {
|
|
22
|
+
export { barcodeEmits, barcodeProps };
|
|
58
23
|
//# sourceMappingURL=barcode.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barcode.mjs","sources":["../../../../../../../packages/components/barcode/src/barcode.
|
|
1
|
+
{"version":3,"file":"barcode.mjs","sources":["../../../../../../../packages/components/barcode/src/barcode.ts"],"sourcesContent":["import { buildProps, isString } from '@m-eleplus-crud/utils'\r\n\r\nimport type { ExtractPropTypes } from 'vue'\r\n\r\nexport const barcodeProps = buildProps({\r\n /**\r\n * @description 一维码内容\r\n */\r\n text: {\r\n type: String,\r\n required: true,\r\n },\r\n /**\r\n * @description 宽度\r\n */\r\n barcodeWidth: {\r\n type: Number,\r\n default: 2,\r\n },\r\n /**\r\n * @description 高度\r\n */\r\n barcodeHeight: {\r\n type: Number,\r\n default: 50,\r\n },\r\n} as const)\r\nexport type BarcodeProps = ExtractPropTypes<typeof barcodeProps>\r\n\r\nexport const barcodeEmits = {\r\n click: (val: string) => isString(val),\r\n}\r\nexport type BarcodeEmits = typeof barcodeEmits\r\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,UAAW,CAAA;AAAA,EAIrC,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EAIA,YAAc,EAAA;AAAA,IACZ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,CAAA;AAAA,GACX;AAAA,EAIA,aAAe,EAAA;AAAA,IACb,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AACF,CAAU,EAAA;AAGH,MAAM,YAAe,GAAA;AAAA,EAC1B,KAAO,EAAA,CAAC,GAAgB,KAAA,QAAA,CAAS,GAAG,CAAA;AACtC;;;;"}
|
|
@@ -1,23 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent, ref, watch, openBlock, createElementBlock } from 'vue';
|
|
2
|
+
import JsBarcode from 'jsbarcode';
|
|
3
|
+
import { barcodeProps, barcodeEmits } from './barcode.mjs';
|
|
4
|
+
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
|
|
3
5
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
const COMPONENT_NAME = "MBarcode";
|
|
7
|
+
const __default__ = defineComponent({
|
|
8
|
+
name: COMPONENT_NAME
|
|
9
|
+
});
|
|
10
|
+
const _sfc_main = defineComponent({
|
|
11
|
+
...__default__,
|
|
12
|
+
props: barcodeProps,
|
|
13
|
+
emits: barcodeEmits,
|
|
14
|
+
setup(__props, { emit: __emit }) {
|
|
15
|
+
const props = __props;
|
|
16
|
+
const emit = __emit;
|
|
17
|
+
const barcodeRef = ref();
|
|
18
|
+
watch(
|
|
19
|
+
() => props.text,
|
|
20
|
+
(newVal) => {
|
|
21
|
+
if (!newVal)
|
|
22
|
+
return;
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
barcodeRef.value.innerHTML = "";
|
|
25
|
+
JsBarcode(barcodeRef.value, newVal, {
|
|
26
|
+
format: "CODE128",
|
|
27
|
+
lineColor: "#000",
|
|
28
|
+
width: props.barcodeWidth,
|
|
29
|
+
height: props.barcodeHeight,
|
|
30
|
+
displayValue: false
|
|
31
|
+
});
|
|
32
|
+
barcodeRef.value.onclick = () => {
|
|
33
|
+
emit("click", newVal);
|
|
34
|
+
};
|
|
35
|
+
}, 0);
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
immediate: true
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return (_ctx, _cache) => {
|
|
42
|
+
return openBlock(), createElementBlock(
|
|
43
|
+
"img",
|
|
44
|
+
{
|
|
45
|
+
ref_key: "barcodeRef",
|
|
46
|
+
ref: barcodeRef,
|
|
47
|
+
class: "m-barcode-box"
|
|
48
|
+
},
|
|
49
|
+
null,
|
|
50
|
+
512
|
|
51
|
+
);
|
|
52
|
+
};
|
|
16
53
|
}
|
|
17
54
|
});
|
|
18
|
-
|
|
19
|
-
click: (val) => isString(val)
|
|
20
|
-
};
|
|
55
|
+
var Barcode = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "barcode.vue"]]);
|
|
21
56
|
|
|
22
|
-
export {
|
|
57
|
+
export { Barcode as default };
|
|
23
58
|
//# sourceMappingURL=barcode2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barcode2.mjs","sources":["../../../../../../../packages/components/barcode/src/barcode.
|
|
1
|
+
{"version":3,"file":"barcode2.mjs","sources":["../../../../../../../packages/components/barcode/src/barcode.vue"],"sourcesContent":["<template>\r\n <img ref=\"barcodeRef\" class=\"m-barcode-box\" />\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { ref, watch } from 'vue'\r\nimport JsBarcode from 'jsbarcode'\r\nimport { barcodeEmits, barcodeProps } from './barcode'\r\n\r\nconst COMPONENT_NAME = 'MBarcode'\r\ndefineOptions({\r\n name: COMPONENT_NAME,\r\n})\r\n\r\nconst props = defineProps(barcodeProps)\r\nconst emit = defineEmits(barcodeEmits)\r\n\r\nconst barcodeRef = ref<any>()\r\n\r\nwatch(\r\n () => props.text as string,\r\n (newVal: string) => {\r\n if (!newVal) return\r\n setTimeout(() => {\r\n barcodeRef.value.innerHTML = ''\r\n JsBarcode(barcodeRef.value, newVal, {\r\n format: 'CODE128',\r\n lineColor: '#000',\r\n width: props.barcodeWidth,\r\n height: props.barcodeHeight,\r\n displayValue: false,\r\n })\r\n barcodeRef.value.onclick = () => {\r\n emit('click', newVal)\r\n }\r\n }, 0)\r\n },\r\n {\r\n immediate: true,\r\n }\r\n)\r\n</script>\r\n"],"names":["DO_defineComponent"],"mappings":";;;;;;AAUc,MAAA,cAAAA,eAAA,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;AAEA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AAEb,IAAA,MAAM,aAAa,GAAS,EAAA,CAAA;AAE5B,IAAA,KAAA;AAAA,MACE,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,CAAC,MAAmB,KAAA;AAClB,QAAA,IAAI,CAAC,MAAA;AAAQ,UAAA,OAAA;AACb,QAAA,UAAA,CAAW,MAAM;AACf,UAAA,UAAA,CAAW,MAAM,SAAY,GAAA,EAAA,CAAA;AACnB,UAAA,SAAA,CAAA,UAAA,CAAW,OAAO,MAAQ,EAAA;AAAA,YAClC,MAAQ,EAAA,SAAA;AAAA,YACR,SAAW,EAAA,MAAA;AAAA,YACX,OAAO,KAAM,CAAA,YAAA;AAAA,YACb,QAAQ,KAAM,CAAA,aAAA;AAAA,YACd,YAAc,EAAA,KAAA;AAAA,WACf,CAAA,CAAA;AACU,UAAA,UAAA,CAAA,KAAA,CAAM,UAAU,MAAM;AAC/B,YAAA,IAAA,CAAK,SAAS,MAAM,CAAA,CAAA;AAAA,WACtB,CAAA;AAAA,WACC,CAAC,CAAA,CAAA;AAAA,OACN;AAAA,MACA;AAAA,QACE,SAAW,EAAA,IAAA;AAAA,OACb;AAAA,KACF,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.mjs","sources":["../../../../../../../packages/components/crud/src/crud.ts"],"sourcesContent":["import {\r\n buildProps,\r\n definePropType,\r\n isArray,\r\n isFunction,\r\n isNumber,\r\n isObject,\r\n isString,\r\n} from '@m-eleplus-crud/utils'\r\nimport { useSizeProp } from '@m-eleplus-crud/hooks'\r\nimport { ColumnType, ICommonColumn } from '../../common'\r\nimport type { ExtractPropTypes } from 'vue'\r\nimport type { FormItemRule } from 'element-plus'\r\nimport type { ITableCommonColumn, ITableCommonOption } from '../../table'\r\nimport type { ISearchCommonColumn, ISearchCommonOption } from '../../search'\r\nimport type { IFormCommonColumn, IFormCommonOption } from '../../form'\r\n\r\n// crud不需要继承form的column属性\r\ntype WithoutFormColumn = Omit<\r\n IFormCommonColumn,\r\n 'order' | 'value' | 'placeholder' | 'rules' | 'span' | 'labelWidth'\r\n>\r\n// crud不需要继承search的column属性\r\ntype WithoutSearchColumn = Omit<\r\n ISearchCommonColumn,\r\n 'order' | 'value' | 'placeholder' | 'rules' | 'span' | 'labelWidth'\r\n>\r\n\r\nexport interface ICrudCommonColumn\r\n extends ICommonColumn,\r\n ITableCommonColumn,\r\n // IFormCommonColumn,\r\n // ISearchCommonColumn,\r\n WithoutFormColumn,\r\n WithoutSearchColumn {\r\n /**\r\n * @description 搜索排序\r\n */\r\n searchOrder?: number\r\n /**\r\n * @description 表单排序\r\n */\r\n formOrder?: number\r\n /**\r\n * @description 是否开启搜索\r\n */\r\n search?: boolean\r\n /**\r\n * @description 搜索默认值\r\n */\r\n searchValue?: any\r\n /**\r\n * @description 表单默认值\r\n */\r\n formValue?: any\r\n /**\r\n * @description 搜索占位文本\r\n */\r\n searchPlaceholder?: string\r\n /**\r\n * @description 表单占位文本\r\n */\r\n formPlaceholder?: string\r\n /**\r\n * @description 搜索下拉组件等可清除\r\n */\r\n searchClearable?: boolean\r\n /**\r\n * @description 表单下拉组件等可清除\r\n */\r\n formClearable?: boolean\r\n /**\r\n * @description 搜索标签宽度\r\n */\r\n searchLabelWidth?: string\r\n /**\r\n * @description 表单标签宽度\r\n */\r\n formLabelWidth?: string\r\n /**\r\n * @description 搜索校验规则\r\n */\r\n searchRules?: FormItemRule[]\r\n /**\r\n * @description 表单校验规则\r\n */\r\n formRules?: FormItemRule[]\r\n /**\r\n * @description 列表是否显示\r\n */\r\n hide?: boolean\r\n /**\r\n * @description 新增对话框是否显示\r\n */\r\n addHide?: boolean\r\n /**\r\n * @description 查看对话框是否显示\r\n */\r\n viewHide?: boolean\r\n /**\r\n * @description 编辑对话框是否显示\r\n */\r\n editHide?: boolean\r\n /**\r\n * @description 搜索项框栅列\r\n */\r\n searchSpan?: number\r\n /**\r\n * @description 新增项框栅列\r\n */\r\n addSpan?: number\r\n /**\r\n * @description 编辑项框栅列\r\n */\r\n editSpan?: number\r\n /**\r\n * @description 查看项框栅列\r\n */\r\n viewSpan?: number\r\n /**\r\n * @description 表单项框栅列\r\n */\r\n formSpan?: number\r\n /**\r\n * @description 新增表单禁用\r\n */\r\n addDisabled?: boolean\r\n /**\r\n * @description 编辑表单禁用\r\n */\r\n editDisabled?: boolean\r\n}\r\n\r\nexport interface ICrudColumn extends ICrudCommonColumn {\r\n type?: ColumnType | 'index' | 'single' | 'selection'\r\n}\r\n\r\n/**\r\n * @description crud配置\r\n */\r\nexport interface ICrudOption\r\n extends ITableCommonOption,\r\n IFormCommonOption,\r\n ISearchCommonOption {\r\n /**\r\n * @description 新增按钮是否需要\r\n */\r\n addBtn?: boolean\r\n /**\r\n * @description 编辑按钮是否需要\r\n */\r\n editBtn?: boolean\r\n /**\r\n * @description 删除按钮是否需要\r\n */\r\n delBtn?: boolean\r\n /**\r\n * @description 新增按钮文字\r\n */\r\n addBtnText?: string\r\n /**\r\n * @description 新增按钮图标\r\n */\r\n addBtnIcon?: string\r\n /**\r\n * @description 搜索label宽度\r\n */\r\n searchLabelWidth?: string\r\n /**\r\n * @description 表单label宽度\r\n */\r\n formLabelWidth?: string\r\n /**\r\n * @description 新增弹窗标题\r\n */\r\n addDialogTitle?: string\r\n /**\r\n * @description 编辑弹窗标题\r\n */\r\n editDialogTitle?: string\r\n /**\r\n * @description 查看弹窗标题\r\n */\r\n viewDialogTitle?: string\r\n /**\r\n * @description 弹窗宽度\r\n */\r\n dialogWidth?: string\r\n /**\r\n * @description 表格高度\r\n */\r\n height?: string\r\n /**\r\n * @description 表格最大高度\r\n */\r\n maxHeight?: string\r\n /**\r\n * @description 表格高度调节(px)\r\n */\r\n calcHeight?: number\r\n /**\r\n * @description crud列配置\r\n */\r\n column: ICrudColumn[]\r\n}\r\n\r\nexport const crudProps = buildProps({\r\n /**\r\n * @description 组件尺寸大小\r\n */\r\n size: useSizeProp,\r\n /**\r\n * @description 加载状态\r\n */\r\n loading: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n /**\r\n * @description 表格数据\r\n */\r\n data: {\r\n type: Array,\r\n required: true,\r\n },\r\n /**\r\n * @description 搜索参数\r\n */\r\n search: {\r\n type: Object,\r\n default: () => ({}),\r\n },\r\n /**\r\n * @description 数据总数\r\n */\r\n total: {\r\n type: Number,\r\n default: 0,\r\n },\r\n /**\r\n * @description 表单绑定的值\r\n */\r\n modelValue: {\r\n type: Object,\r\n required: true,\r\n },\r\n /**\r\n * @description 权限配置\r\n */\r\n permission: {\r\n type: Object,\r\n default: () => ({\r\n // 新增按钮权限\r\n addBtn: true,\r\n // 编辑按钮权限\r\n editBtn: true,\r\n // 删除按钮权限\r\n delBtn: true,\r\n }),\r\n },\r\n /**\r\n * @description 选择的数据\r\n */\r\n select: {\r\n type: Array,\r\n default: () => [],\r\n },\r\n /**\r\n * @description 表单提交前\r\n */\r\n beforeEnter: {\r\n type: Function,\r\n },\r\n /**\r\n * @description crud配置项\r\n */\r\n option: {\r\n type: definePropType<ICrudOption>(Object),\r\n required: false,\r\n },\r\n} as const)\r\nexport type CrudProps = ExtractPropTypes<typeof crudProps>\r\n\r\nexport const crudEmits = {\r\n /**\r\n * @description 更新选择数据\r\n * @param arr 选择的数据\r\n * @returns\r\n */\r\n 'update:select': (arr: any[]) => isArray(arr),\r\n /**\r\n * @description 更新表单数据\r\n * @param value 表单数据\r\n * @returns\r\n */\r\n 'update:modelValue': (value: any) => isObject(value),\r\n /**\r\n * 查询事件触发\r\n * @param form 查询表单数据\r\n * @returns\r\n */\r\n search: (form: any) => isObject(form),\r\n /**\r\n * 重置事件触发\r\n * @returns\r\n */\r\n reset: () => true,\r\n /**\r\n * 新增\r\n * @param form 表单数据\r\n * @param done 完成\r\n * @param loading 加载\r\n * @returns\r\n */\r\n rowSave: (form: any, done: () => void, loading: () => void) =>\r\n isObject(form) && isFunction(done) && isFunction(loading),\r\n /**\r\n * 编辑\r\n * @param form 表单数据\r\n * @param done 完成\r\n * @param loading 加载\r\n * @returns\r\n */\r\n rowEdit: (form: any, done: () => void, loading: () => void) =>\r\n isObject(form) && isFunction(done) && isFunction(loading),\r\n\r\n /**\r\n * 取消\r\n * @param form 表单数据\r\n * @param index 索引\r\n * @param type 类型\r\n * @returns\r\n */\r\n rowCancel: (form: any, index: number, type: 'add' | 'edit' | 'view') =>\r\n isObject(form) && isNumber(index) && isString(type),\r\n\r\n /**\r\n * 删除\r\n * @param row 行数据\r\n * @param index 索引\r\n * @returns\r\n */\r\n rowDel: (row: any, index: number) => isObject(row) && isNumber(index),\r\n}\r\nexport type CrudEmits = typeof crudEmits\r\n"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"crud.mjs","sources":["../../../../../../../packages/components/crud/src/crud.ts"],"sourcesContent":["import {\r\n buildProps,\r\n definePropType,\r\n isArray,\r\n isFunction,\r\n isNumber,\r\n isObject,\r\n isString,\r\n} from '@m-eleplus-crud/utils'\r\nimport { useSizeProp } from '@m-eleplus-crud/hooks'\r\nimport { ColumnType, ICommonColumn } from '../../common'\r\nimport type { ExtractPropTypes } from 'vue'\r\nimport type { FormItemRule } from 'element-plus'\r\nimport type { ITableCommonColumn, ITableCommonOption } from '../../table'\r\nimport type { ISearchCommonColumn, ISearchCommonOption } from '../../search'\r\nimport type { IFormCommonColumn, IFormCommonOption } from '../../form'\r\n\r\n// crud不需要继承form的column属性\r\ntype WithoutFormColumn = Omit<\r\n IFormCommonColumn,\r\n 'order' | 'value' | 'placeholder' | 'rules' | 'span' | 'labelWidth'\r\n>\r\n// crud不需要继承search的column属性\r\ntype WithoutSearchColumn = Omit<\r\n ISearchCommonColumn,\r\n 'order' | 'value' | 'placeholder' | 'rules' | 'span' | 'labelWidth'\r\n>\r\n\r\nexport interface ICrudCommonColumn\r\n extends ICommonColumn,\r\n ITableCommonColumn,\r\n // IFormCommonColumn,\r\n // ISearchCommonColumn,\r\n WithoutFormColumn,\r\n WithoutSearchColumn {\r\n /**\r\n * @description 搜索排序\r\n */\r\n searchOrder?: number\r\n /**\r\n * @description 表单排序\r\n */\r\n formOrder?: number\r\n /**\r\n * @description 是否开启搜索\r\n */\r\n search?: boolean\r\n /**\r\n * @description 搜索默认值\r\n */\r\n searchValue?: any\r\n /**\r\n * @description 表单默认值\r\n */\r\n formValue?: any\r\n /**\r\n * @description 搜索占位文本\r\n */\r\n searchPlaceholder?: string\r\n /**\r\n * @description 表单占位文本\r\n */\r\n formPlaceholder?: string\r\n /**\r\n * @description 搜索下拉组件等可清除\r\n */\r\n searchClearable?: boolean\r\n /**\r\n * @description 表单下拉组件等可清除\r\n */\r\n formClearable?: boolean\r\n /**\r\n * @description 搜索标签宽度\r\n */\r\n searchLabelWidth?: string\r\n /**\r\n * @description 表单标签宽度\r\n */\r\n formLabelWidth?: string\r\n /**\r\n * @description 搜索校验规则\r\n */\r\n searchRules?: FormItemRule[]\r\n /**\r\n * @description 表单校验规则\r\n */\r\n formRules?: FormItemRule[]\r\n /**\r\n * @description 列表是否显示\r\n */\r\n hide?: boolean\r\n /**\r\n * @description 新增对话框是否显示\r\n */\r\n addHide?: boolean\r\n /**\r\n * @description 查看对话框是否显示\r\n */\r\n viewHide?: boolean\r\n /**\r\n * @description 编辑对话框是否显示\r\n */\r\n editHide?: boolean\r\n /**\r\n * @description 搜索项框栅列\r\n */\r\n searchSpan?: number\r\n /**\r\n * @description 新增项框栅列\r\n */\r\n addSpan?: number\r\n /**\r\n * @description 编辑项框栅列\r\n */\r\n editSpan?: number\r\n /**\r\n * @description 查看项框栅列\r\n */\r\n viewSpan?: number\r\n /**\r\n * @description 表单项框栅列\r\n */\r\n formSpan?: number\r\n /**\r\n * @description 新增表单禁用\r\n */\r\n addDisabled?: boolean\r\n /**\r\n * @description 编辑表单禁用\r\n */\r\n editDisabled?: boolean\r\n}\r\n\r\nexport interface ICrudColumn extends ICrudCommonColumn {\r\n type?: ColumnType | 'index' | 'single' | 'selection'\r\n /**\r\n * @description 仅对 type=selection 的列有效,类型为 Function,Function 的返回值用来决定这一行的 CheckBox 是否可以勾选\r\n * @param row 行数据\r\n * @param index 索引\r\n * @returns \r\n */\r\n selectable?: (row: any, index: number) => boolean\r\n}\r\n\r\n/**\r\n * @description crud配置\r\n */\r\nexport interface ICrudOption\r\n extends ITableCommonOption,\r\n IFormCommonOption,\r\n ISearchCommonOption {\r\n /**\r\n * @description 新增按钮是否需要\r\n */\r\n addBtn?: boolean\r\n /**\r\n * @description 编辑按钮是否需要\r\n */\r\n editBtn?: boolean\r\n /**\r\n * @description 删除按钮是否需要\r\n */\r\n delBtn?: boolean\r\n /**\r\n * @description 新增按钮文字\r\n */\r\n addBtnText?: string\r\n /**\r\n * @description 新增按钮图标\r\n */\r\n addBtnIcon?: string\r\n /**\r\n * @description 搜索label宽度\r\n */\r\n searchLabelWidth?: string\r\n /**\r\n * @description 表单label宽度\r\n */\r\n formLabelWidth?: string\r\n /**\r\n * @description 新增弹窗标题\r\n */\r\n addDialogTitle?: string\r\n /**\r\n * @description 编辑弹窗标题\r\n */\r\n editDialogTitle?: string\r\n /**\r\n * @description 查看弹窗标题\r\n */\r\n viewDialogTitle?: string\r\n /**\r\n * @description 弹窗宽度\r\n */\r\n dialogWidth?: string\r\n /**\r\n * @description 表格高度\r\n */\r\n height?: string\r\n /**\r\n * @description 表格最大高度\r\n */\r\n maxHeight?: string\r\n /**\r\n * @description 表格高度调节(px)\r\n */\r\n calcHeight?: number\r\n /**\r\n * @description crud列配置\r\n */\r\n column: ICrudColumn[]\r\n}\r\n\r\nexport const crudProps = buildProps({\r\n /**\r\n * @description 组件尺寸大小\r\n */\r\n size: useSizeProp,\r\n /**\r\n * @description 加载状态\r\n */\r\n loading: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n /**\r\n * @description 表格数据\r\n */\r\n data: {\r\n type: Array,\r\n required: true,\r\n },\r\n /**\r\n * @description 搜索参数\r\n */\r\n search: {\r\n type: Object,\r\n default: () => ({}),\r\n },\r\n /**\r\n * @description 数据总数\r\n */\r\n total: {\r\n type: Number,\r\n default: 0,\r\n },\r\n /**\r\n * @description 表单绑定的值\r\n */\r\n modelValue: {\r\n type: Object,\r\n required: true,\r\n },\r\n /**\r\n * @description 权限配置\r\n */\r\n permission: {\r\n type: Object,\r\n default: () => ({\r\n // 新增按钮权限\r\n addBtn: true,\r\n // 编辑按钮权限\r\n editBtn: true,\r\n // 删除按钮权限\r\n delBtn: true,\r\n }),\r\n },\r\n /**\r\n * @description 选择的数据\r\n */\r\n select: {\r\n type: Array,\r\n default: () => [],\r\n },\r\n /**\r\n * @description 表单提交前\r\n */\r\n beforeEnter: {\r\n type: Function,\r\n },\r\n /**\r\n * @description crud配置项\r\n */\r\n option: {\r\n type: definePropType<ICrudOption>(Object),\r\n required: false,\r\n },\r\n} as const)\r\nexport type CrudProps = ExtractPropTypes<typeof crudProps>\r\n\r\nexport const crudEmits = {\r\n /**\r\n * @description 更新选择数据\r\n * @param arr 选择的数据\r\n * @returns\r\n */\r\n 'update:select': (arr: any[]) => isArray(arr),\r\n /**\r\n * @description 更新表单数据\r\n * @param value 表单数据\r\n * @returns\r\n */\r\n 'update:modelValue': (value: any) => isObject(value),\r\n /**\r\n * 查询事件触发\r\n * @param form 查询表单数据\r\n * @returns\r\n */\r\n search: (form: any) => isObject(form),\r\n /**\r\n * 重置事件触发\r\n * @returns\r\n */\r\n reset: () => true,\r\n /**\r\n * 新增\r\n * @param form 表单数据\r\n * @param done 完成\r\n * @param loading 加载\r\n * @returns\r\n */\r\n rowSave: (form: any, done: () => void, loading: () => void) =>\r\n isObject(form) && isFunction(done) && isFunction(loading),\r\n /**\r\n * 编辑\r\n * @param form 表单数据\r\n * @param done 完成\r\n * @param loading 加载\r\n * @returns\r\n */\r\n rowEdit: (form: any, done: () => void, loading: () => void) =>\r\n isObject(form) && isFunction(done) && isFunction(loading),\r\n\r\n /**\r\n * 取消\r\n * @param form 表单数据\r\n * @param index 索引\r\n * @param type 类型\r\n * @returns\r\n */\r\n rowCancel: (form: any, index: number, type: 'add' | 'edit' | 'view') =>\r\n isObject(form) && isNumber(index) && isString(type),\r\n\r\n /**\r\n * 删除\r\n * @param row 行数据\r\n * @param index 索引\r\n * @returns\r\n */\r\n rowDel: (row: any, index: number) => isObject(row) && isNumber(index),\r\n}\r\nexport type CrudEmits = typeof crudEmits\r\n"],"names":[],"mappings":";;;;;AAqNO,MAAM,YAAY,UAAW,CAAA;AAAA,EAIlC,IAAM,EAAA,WAAA;AAAA,EAIN,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA,EAIA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,KAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EAIA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,OAAA,EAAS,OAAO,EAAC,CAAA;AAAA,GACnB;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,CAAA;AAAA,GACX;AAAA,EAIA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EAIA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,MAAA;AAAA,IACN,SAAS,OAAO;AAAA,MAEd,MAAQ,EAAA,IAAA;AAAA,MAER,OAAS,EAAA,IAAA;AAAA,MAET,MAAQ,EAAA,IAAA;AAAA,KACV,CAAA;AAAA,GACF;AAAA,EAIA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,KAAA;AAAA,IACN,OAAA,EAAS,MAAM,EAAC;AAAA,GAClB;AAAA,EAIA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,QAAA;AAAA,GACR;AAAA,EAIA,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,eAA4B,MAAM,CAAA;AAAA,IACxC,QAAU,EAAA,KAAA;AAAA,GACZ;AACF,CAAU,EAAA;AAGH,MAAM,SAAY,GAAA;AAAA,EAMvB,eAAiB,EAAA,CAAC,GAAe,KAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,EAM5C,mBAAqB,EAAA,CAAC,KAAe,KAAA,QAAA,CAAS,KAAK,CAAA;AAAA,EAMnD,MAAQ,EAAA,CAAC,IAAc,KAAA,QAAA,CAAS,IAAI,CAAA;AAAA,EAKpC,OAAO,MAAM,IAAA;AAAA,EAQb,OAAS,EAAA,CAAC,IAAW,EAAA,IAAA,EAAkB,OACrC,KAAA,QAAA,CAAS,IAAI,CAAA,IAAK,UAAW,CAAA,IAAI,CAAK,IAAA,UAAA,CAAW,OAAO,CAAA;AAAA,EAQ1D,OAAS,EAAA,CAAC,IAAW,EAAA,IAAA,EAAkB,OACrC,KAAA,QAAA,CAAS,IAAI,CAAA,IAAK,UAAW,CAAA,IAAI,CAAK,IAAA,UAAA,CAAW,OAAO,CAAA;AAAA,EAS1D,SAAW,EAAA,CAAC,IAAW,EAAA,KAAA,EAAe,IACpC,KAAA,QAAA,CAAS,IAAI,CAAA,IAAK,QAAS,CAAA,KAAK,CAAK,IAAA,QAAA,CAAS,IAAI,CAAA;AAAA,EAQpD,MAAA,EAAQ,CAAC,GAAU,EAAA,KAAA,KAAkB,SAAS,GAAG,CAAA,IAAK,SAAS,KAAK,CAAA;AACtE;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Dialog from './src/
|
|
2
|
-
export { dialogEmits, dialogProps } from './src/
|
|
1
|
+
import Dialog from './src/dialog2.mjs';
|
|
2
|
+
export { dialogEmits, dialogProps } from './src/dialog.mjs';
|
|
3
3
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
4
4
|
|
|
5
5
|
const MDialog = withInstall(Dialog);
|
|
@@ -1,121 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { useGlobalConfig } from '../../config-provider/src/hooks/use-global-config.mjs';
|
|
1
|
+
import { isBoolean } from '../../../utils/types.mjs';
|
|
2
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
3
|
+
import { useSizeProp } from '../../../hooks/use-size/index.mjs';
|
|
4
|
+
import { isFunction } from '@vue/shared';
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class: "dialog-footer"
|
|
72
|
-
}, [
|
|
73
|
-
_ctx.cancelBtn ? (openBlock(), createBlock(_component_el_button, {
|
|
74
|
-
key: 0,
|
|
75
|
-
size: _ctx.size || unref(globalConfig).size,
|
|
76
|
-
icon: _ctx.cancelBtnIcon,
|
|
77
|
-
loading: dialogLoading.value,
|
|
78
|
-
onClick: close
|
|
79
|
-
}, {
|
|
80
|
-
default: withCtx(() => [
|
|
81
|
-
createTextVNode(
|
|
82
|
-
toDisplayString(_ctx.cancelBtnText || unref(t)("m.dialog.cancelText")),
|
|
83
|
-
1
|
|
84
|
-
)
|
|
85
|
-
]),
|
|
86
|
-
_: 1
|
|
87
|
-
}, 8, ["size", "icon", "loading"])) : createCommentVNode("v-if", true),
|
|
88
|
-
_ctx.saveBtn ? (openBlock(), createBlock(_component_el_button, {
|
|
89
|
-
key: 1,
|
|
90
|
-
size: _ctx.size || unref(globalConfig).size,
|
|
91
|
-
icon: _ctx.saveBtnIcon,
|
|
92
|
-
loading: dialogLoading.value,
|
|
93
|
-
type: "primary",
|
|
94
|
-
onClick: enter
|
|
95
|
-
}, {
|
|
96
|
-
default: withCtx(() => [
|
|
97
|
-
createTextVNode(
|
|
98
|
-
toDisplayString(_ctx.saveBtnText || unref(t)("m.dialog.confirmText")),
|
|
99
|
-
1
|
|
100
|
-
)
|
|
101
|
-
]),
|
|
102
|
-
_: 1
|
|
103
|
-
}, 8, ["size", "icon", "loading"])) : createCommentVNode("v-if", true)
|
|
104
|
-
])) : renderSlot(_ctx.$slots, "btns", {
|
|
105
|
-
key: 1,
|
|
106
|
-
loading: dialogLoading.value
|
|
107
|
-
})
|
|
108
|
-
]),
|
|
109
|
-
default: withCtx(() => [
|
|
110
|
-
renderSlot(_ctx.$slots, "default", { loading: dialogLoading.value })
|
|
111
|
-
]),
|
|
112
|
-
_: 3
|
|
113
|
-
}, 8, ["model-value", "title", "width", "top", "append-to-body", "close-on-click-modal", "close-onn-press-escape", "draggable", "destroy-on-close"])
|
|
114
|
-
]);
|
|
115
|
-
};
|
|
6
|
+
const dialogProps = buildProps({
|
|
7
|
+
size: useSizeProp,
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
title: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
width: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "600px"
|
|
19
|
+
},
|
|
20
|
+
top: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "2vh"
|
|
23
|
+
},
|
|
24
|
+
appendToBody: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
28
|
+
closeOnClickModal: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
closeOnnPressEscape: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
beforeClose: {
|
|
37
|
+
type: Function
|
|
38
|
+
},
|
|
39
|
+
draggable: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true
|
|
42
|
+
},
|
|
43
|
+
destroyOnClose: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true
|
|
46
|
+
},
|
|
47
|
+
saveBtn: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true
|
|
50
|
+
},
|
|
51
|
+
cancelBtn: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
55
|
+
saveBtnText: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: ""
|
|
58
|
+
},
|
|
59
|
+
saveBtnIcon: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "CircleCheck"
|
|
62
|
+
},
|
|
63
|
+
cancelBtnIcon: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "CircleClose"
|
|
66
|
+
},
|
|
67
|
+
cancelBtnText: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: ""
|
|
116
70
|
}
|
|
117
71
|
});
|
|
118
|
-
|
|
72
|
+
const dialogEmits = {
|
|
73
|
+
"update:modelValue": (value) => isBoolean(value),
|
|
74
|
+
close: () => true,
|
|
75
|
+
cancel: () => true,
|
|
76
|
+
enter: (done, loading) => isFunction(done) && isFunction(loading)
|
|
77
|
+
};
|
|
119
78
|
|
|
120
|
-
export {
|
|
79
|
+
export { dialogEmits, dialogProps };
|
|
121
80
|
//# sourceMappingURL=dialog.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.mjs","sources":["../../../../../../../packages/components/dialog/src/dialog.
|
|
1
|
+
{"version":3,"file":"dialog.mjs","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":[],"mappings":";;;;;AAKO,MAAM,cAAc,UAAW,CAAA;AAAA,EAIpC,IAAM,EAAA,WAAA;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,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,OAAA;AAAA,GACX;AAAA,EAIA,GAAK,EAAA;AAAA,IACH,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA,EAIA,YAAc,EAAA;AAAA,IACZ,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EAIA,iBAAmB,EAAA;AAAA,IACjB,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA,EAIA,mBAAqB,EAAA;AAAA,IACnB,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA,EAIA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,QAAA;AAAA,GACR;AAAA,EAIA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EAIA,cAAgB,EAAA;AAAA,IACd,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EAIA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EAIA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EAIA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EAIA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,aAAA;AAAA,GACX;AAAA,EAIA,aAAe,EAAA;AAAA,IACb,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,aAAA;AAAA,GACX;AAAA,EAIA,aAAe,EAAA;AAAA,IACb,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AACF,CAAU,EAAA;AAGH,MAAM,WAAc,GAAA;AAAA,EAMzB,mBAAqB,EAAA,CAAC,KAAmB,KAAA,SAAA,CAAU,KAAK,CAAA;AAAA,EAKxD,OAAO,MAAM,IAAA;AAAA,EAKb,QAAQ,MAAM,IAAA;AAAA,EAOd,KAAA,EAAO,CAAC,IAAkB,EAAA,OAAA,KACxB,WAAW,IAAI,CAAA,IAAK,WAAW,OAAO,CAAA;AAC1C;;;;"}
|