el-plus 0.0.47 → 0.0.50
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/CHANGELOG.md +18 -0
- package/dist/index.css +1 -1
- package/dist/index.full.js +453 -276
- 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 +453 -276
- package/es/components/attachment/index.d.ts +24 -3
- package/es/components/attachment/src/attachment.d.ts +4 -0
- package/es/components/attachment/src/attachment.mjs +5 -0
- package/es/components/attachment/src/attachment.mjs.map +1 -1
- package/es/components/attachment/src/attachment.vue.d.ts +12 -1
- package/es/components/attachment/src/attachment.vue2.mjs +69 -29
- package/es/components/attachment/src/attachment.vue2.mjs.map +1 -1
- package/es/components/attachment/src/use-attachment.d.ts +32 -24
- package/es/components/attachment/src/use-attachment.mjs +65 -12
- package/es/components/attachment/src/use-attachment.mjs.map +1 -1
- package/es/components/header/index.d.ts +15 -0
- package/es/components/header/src/header.d.ts +4 -0
- package/es/components/header/src/header.mjs +6 -1
- package/es/components/header/src/header.mjs.map +1 -1
- package/es/components/header/src/header.vue.d.ts +9 -0
- package/es/components/header/src/header.vue2.mjs +6 -1
- package/es/components/header/src/header.vue2.mjs.map +1 -1
- package/es/components/header/src/use-header.mjs +42 -44
- package/es/components/header/src/use-header.mjs.map +1 -1
- package/es/hooks/dialog/use-dialog.mjs.map +1 -1
- package/es/locale/lang/en.d.ts +12 -0
- package/es/locale/lang/en.mjs +12 -0
- package/es/locale/lang/en.mjs.map +1 -1
- package/es/locale/lang/zh-cn.d.ts +12 -0
- package/es/locale/lang/zh-cn.mjs +12 -0
- package/es/locale/lang/zh-cn.mjs.map +1 -1
- package/es/package.json.mjs +1 -1
- package/es/utils/file.d.ts +1 -1
- package/es/utils/file.mjs.map +1 -1
- package/lib/components/attachment/index.d.ts +24 -3
- package/lib/components/attachment/src/attachment.d.ts +4 -0
- package/lib/components/attachment/src/attachment.js +5 -0
- package/lib/components/attachment/src/attachment.js.map +1 -1
- package/lib/components/attachment/src/attachment.vue.d.ts +12 -1
- package/lib/components/attachment/src/attachment.vue2.js +68 -28
- package/lib/components/attachment/src/attachment.vue2.js.map +1 -1
- package/lib/components/attachment/src/use-attachment.d.ts +32 -24
- package/lib/components/attachment/src/use-attachment.js +63 -10
- package/lib/components/attachment/src/use-attachment.js.map +1 -1
- package/lib/components/header/index.d.ts +15 -0
- package/lib/components/header/src/header.d.ts +4 -0
- package/lib/components/header/src/header.js +6 -1
- package/lib/components/header/src/header.js.map +1 -1
- package/lib/components/header/src/header.vue.d.ts +9 -0
- package/lib/components/header/src/header.vue2.js +6 -1
- package/lib/components/header/src/header.vue2.js.map +1 -1
- package/lib/components/header/src/use-header.js +42 -44
- package/lib/components/header/src/use-header.js.map +1 -1
- package/lib/hooks/dialog/use-dialog.js.map +1 -1
- package/lib/locale/lang/en.d.ts +12 -0
- package/lib/locale/lang/en.js +12 -0
- package/lib/locale/lang/en.js.map +1 -1
- package/lib/locale/lang/zh-cn.d.ts +12 -0
- package/lib/locale/lang/zh-cn.js +12 -0
- package/lib/locale/lang/zh-cn.js.map +1 -1
- package/lib/package.json.js +1 -1
- package/lib/utils/file.d.ts +1 -1
- package/lib/utils/file.js.map +1 -1
- package/package.json +1 -1
- package/theme-chalk/attachment.css +1 -0
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/attachment.scss +37 -0
- package/theme-chalk/src/index.scss +2 -1
|
@@ -32,12 +32,18 @@ export declare const EpAttachment: {
|
|
|
32
32
|
readonly type: BooleanConstructor;
|
|
33
33
|
readonly default: false;
|
|
34
34
|
};
|
|
35
|
+
isShowOpenDialogButton: {
|
|
36
|
+
readonly type: BooleanConstructor;
|
|
37
|
+
readonly default: false;
|
|
38
|
+
};
|
|
35
39
|
modelValue: {
|
|
36
40
|
type: import("vue").PropType<any[]>;
|
|
37
41
|
};
|
|
38
42
|
}>> & Readonly<{
|
|
39
43
|
"onUpdate:modelValue"?: ((value: any[] | undefined) => any) | undefined;
|
|
40
|
-
}>, {
|
|
44
|
+
}>, {
|
|
45
|
+
open: () => Promise<any>;
|
|
46
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
47
|
"update:modelValue": (value: any[] | undefined) => any;
|
|
42
48
|
}, import("vue").PublicProps, {
|
|
43
49
|
formatColumns: Partial<import("element-plus").TableColumnCtx & {
|
|
@@ -57,6 +63,7 @@ export declare const EpAttachment: {
|
|
|
57
63
|
openType: "dialog" | "normal";
|
|
58
64
|
isType: boolean;
|
|
59
65
|
isNote: boolean;
|
|
66
|
+
isShowOpenDialogButton: boolean;
|
|
60
67
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
61
68
|
P: {};
|
|
62
69
|
B: {};
|
|
@@ -97,12 +104,18 @@ export declare const EpAttachment: {
|
|
|
97
104
|
readonly type: BooleanConstructor;
|
|
98
105
|
readonly default: false;
|
|
99
106
|
};
|
|
107
|
+
isShowOpenDialogButton: {
|
|
108
|
+
readonly type: BooleanConstructor;
|
|
109
|
+
readonly default: false;
|
|
110
|
+
};
|
|
100
111
|
modelValue: {
|
|
101
112
|
type: import("vue").PropType<any[]>;
|
|
102
113
|
};
|
|
103
114
|
}>> & Readonly<{
|
|
104
115
|
"onUpdate:modelValue"?: ((value: any[] | undefined) => any) | undefined;
|
|
105
|
-
}>, {
|
|
116
|
+
}>, {
|
|
117
|
+
open: () => Promise<any>;
|
|
118
|
+
}, {}, {}, {}, {
|
|
106
119
|
formatColumns: Partial<import("element-plus").TableColumnCtx & {
|
|
107
120
|
[key: string]: any;
|
|
108
121
|
required: boolean | (() => boolean);
|
|
@@ -120,6 +133,7 @@ export declare const EpAttachment: {
|
|
|
120
133
|
openType: "dialog" | "normal";
|
|
121
134
|
isType: boolean;
|
|
122
135
|
isNote: boolean;
|
|
136
|
+
isShowOpenDialogButton: boolean;
|
|
123
137
|
}>;
|
|
124
138
|
__isFragment?: never;
|
|
125
139
|
__isTeleport?: never;
|
|
@@ -144,12 +158,18 @@ export declare const EpAttachment: {
|
|
|
144
158
|
readonly type: BooleanConstructor;
|
|
145
159
|
readonly default: false;
|
|
146
160
|
};
|
|
161
|
+
isShowOpenDialogButton: {
|
|
162
|
+
readonly type: BooleanConstructor;
|
|
163
|
+
readonly default: false;
|
|
164
|
+
};
|
|
147
165
|
modelValue: {
|
|
148
166
|
type: import("vue").PropType<any[]>;
|
|
149
167
|
};
|
|
150
168
|
}>> & Readonly<{
|
|
151
169
|
"onUpdate:modelValue"?: ((value: any[] | undefined) => any) | undefined;
|
|
152
|
-
}>, {
|
|
170
|
+
}>, {
|
|
171
|
+
open: () => Promise<any>;
|
|
172
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
153
173
|
"update:modelValue": (value: any[] | undefined) => any;
|
|
154
174
|
}, string, {
|
|
155
175
|
formatColumns: Partial<import("element-plus").TableColumnCtx & {
|
|
@@ -169,6 +189,7 @@ export declare const EpAttachment: {
|
|
|
169
189
|
openType: "dialog" | "normal";
|
|
170
190
|
isType: boolean;
|
|
171
191
|
isNote: boolean;
|
|
192
|
+
isShowOpenDialogButton: boolean;
|
|
172
193
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin;
|
|
173
194
|
export default EpAttachment;
|
|
174
195
|
export * from './src/attachment';
|
|
@@ -19,5 +19,9 @@ export declare const attachmentProps: {
|
|
|
19
19
|
readonly type: BooleanConstructor;
|
|
20
20
|
readonly default: false;
|
|
21
21
|
};
|
|
22
|
+
readonly isShowOpenDialogButton: {
|
|
23
|
+
readonly type: BooleanConstructor;
|
|
24
|
+
readonly default: false;
|
|
25
|
+
};
|
|
22
26
|
};
|
|
23
27
|
export type AttachmentProps = ExtractPropTypes<typeof attachmentProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","sources":["../../../../../../packages/components/attachment/src/attachment.ts"],"sourcesContent":["import type { ExtractPropTypes, PropType } from 'vue'\nimport { tableProps } from '@el-plus/components/table'\nimport { headerProps } from '@el-plus/components/header'\nexport const attachmentProps = {\n // 格式化列\n formatColumns: {\n ...tableProps.formatColumns,\n },\n // 页面模式\n mode: {\n ...headerProps.mode,\n },\n // 展示模式\n openType: {\n type: String as PropType<'dialog' | 'normal'>,\n default: 'dialog',\n },\n // 是否需要类型\n isType: {\n type: Boolean,\n default: true,\n },\n // 是否需要备注\n isNote: {\n type: Boolean,\n default: false,\n },\n} as const\nexport type AttachmentProps = ExtractPropTypes<typeof attachmentProps>\n"],"names":["tableProps","headerProps"],"mappings":";;;;;AAGO,MAAM,eAAA,GAAkB;AAAA;AAAA,EAE7B,aAAA,EAAe;AAAA,IACb,GAAGA,gBAAA,CAAW;AAAA,GAChB;AAAA;AAAA,EAEA,IAAA,EAAM;AAAA,IACJ,GAAGC,kBAAA,CAAY;AAAA,GACjB;AAAA;AAAA,EAEA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA,EAEA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA,EAEA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA;AAEb;;;;"}
|
|
1
|
+
{"version":3,"file":"attachment.js","sources":["../../../../../../packages/components/attachment/src/attachment.ts"],"sourcesContent":["import type { ExtractPropTypes, PropType } from 'vue'\nimport { tableProps } from '@el-plus/components/table'\nimport { headerProps } from '@el-plus/components/header'\nexport const attachmentProps = {\n // 格式化列\n formatColumns: {\n ...tableProps.formatColumns,\n },\n // 页面模式\n mode: {\n ...headerProps.mode,\n },\n // 展示模式\n openType: {\n type: String as PropType<'dialog' | 'normal'>,\n default: 'dialog',\n },\n // 是否需要类型\n isType: {\n type: Boolean,\n default: true,\n },\n // 是否需要备注\n isNote: {\n type: Boolean,\n default: false,\n },\n // 是否需要打开弹窗按钮\n isShowOpenDialogButton: {\n type: Boolean,\n default: false,\n },\n} as const\nexport type AttachmentProps = ExtractPropTypes<typeof attachmentProps>\n"],"names":["tableProps","headerProps"],"mappings":";;;;;AAGO,MAAM,eAAA,GAAkB;AAAA;AAAA,EAE7B,aAAA,EAAe;AAAA,IACb,GAAGA,gBAAA,CAAW;AAAA,GAChB;AAAA;AAAA,EAEA,IAAA,EAAM;AAAA,IACJ,GAAGC,kBAAA,CAAY;AAAA,GACjB;AAAA;AAAA,EAEA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA,EAEA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA,EAEA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA,EAEA,sBAAA,EAAwB;AAAA,IACtB,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA;AAEb;;;;"}
|
|
@@ -18,10 +18,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
18
18
|
readonly type: BooleanConstructor;
|
|
19
19
|
readonly default: false;
|
|
20
20
|
};
|
|
21
|
+
isShowOpenDialogButton: {
|
|
22
|
+
readonly type: BooleanConstructor;
|
|
23
|
+
readonly default: false;
|
|
24
|
+
};
|
|
21
25
|
modelValue: {
|
|
22
26
|
type: import("vue").PropType<any[]>;
|
|
23
27
|
};
|
|
24
|
-
}>, {
|
|
28
|
+
}>, {
|
|
29
|
+
open: () => Promise<any>;
|
|
30
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
31
|
"update:modelValue": (value: any[] | undefined) => any;
|
|
26
32
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
33
|
formatColumns: {
|
|
@@ -43,6 +49,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
43
49
|
readonly type: BooleanConstructor;
|
|
44
50
|
readonly default: false;
|
|
45
51
|
};
|
|
52
|
+
isShowOpenDialogButton: {
|
|
53
|
+
readonly type: BooleanConstructor;
|
|
54
|
+
readonly default: false;
|
|
55
|
+
};
|
|
46
56
|
modelValue: {
|
|
47
57
|
type: import("vue").PropType<any[]>;
|
|
48
58
|
};
|
|
@@ -66,6 +76,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
76
|
openType: "dialog" | "normal";
|
|
67
77
|
isType: boolean;
|
|
68
78
|
isNote: boolean;
|
|
79
|
+
isShowOpenDialogButton: boolean;
|
|
69
80
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
70
81
|
declare const _default: typeof __VLS_export;
|
|
71
82
|
export default _default;
|
|
@@ -9,6 +9,8 @@ var attachment = require('./attachment.js');
|
|
|
9
9
|
var index = require('../../table/index.js');
|
|
10
10
|
var useAttachment = require('./use-attachment.js');
|
|
11
11
|
var useDialog = require('../../../hooks/dialog/use-dialog.js');
|
|
12
|
+
var useLocale = require('../../../hooks/use-locale.js');
|
|
13
|
+
var elementPlus = require('element-plus');
|
|
12
14
|
|
|
13
15
|
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
14
16
|
...{
|
|
@@ -21,46 +23,84 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
21
23
|
"modelModifiers": {}
|
|
22
24
|
}),
|
|
23
25
|
emits: ["update:modelValue"],
|
|
24
|
-
setup(__props) {
|
|
26
|
+
setup(__props, { expose: __expose }) {
|
|
27
|
+
const { t } = useLocale.useLocale();
|
|
25
28
|
const bem$1 = bem.createNameSpace("attachment");
|
|
26
29
|
const props$1 = __props;
|
|
27
30
|
const modelValue = vue.useModel(__props, "modelValue");
|
|
31
|
+
const { columns, addAttachment, isNormalOpen, onConfirm, onCancel } = useAttachment.useAttachment(props$1, {
|
|
32
|
+
data: modelValue
|
|
33
|
+
});
|
|
28
34
|
const AttachmentDialog = useDialog.useDialog({
|
|
29
|
-
class: bem$1.em("dialog", props$1.openType === "normal" ? props$1.openType : ""),
|
|
30
35
|
width: 850,
|
|
31
36
|
center: true,
|
|
32
|
-
title: "
|
|
37
|
+
title: isNormalOpen ? "" : t("ep.attachment.manageAttachment"),
|
|
38
|
+
modal: !isNormalOpen,
|
|
39
|
+
showClose: !isNormalOpen,
|
|
40
|
+
showFooter: !isNormalOpen,
|
|
41
|
+
transition: isNormalOpen ? "" : "dialog-fade",
|
|
42
|
+
modalClass: bem$1.em(
|
|
43
|
+
"dialog",
|
|
44
|
+
props$1.openType === "normal" ? props$1.openType : ""
|
|
45
|
+
),
|
|
33
46
|
onConfirm: async (resolve) => {
|
|
47
|
+
onConfirm(resolve);
|
|
48
|
+
},
|
|
49
|
+
onCancel: (resolve) => {
|
|
50
|
+
onCancel(resolve);
|
|
34
51
|
}
|
|
35
52
|
});
|
|
36
|
-
const
|
|
37
|
-
|
|
53
|
+
const open = AttachmentDialog.open;
|
|
54
|
+
if (isNormalOpen) {
|
|
55
|
+
open();
|
|
56
|
+
}
|
|
57
|
+
__expose({
|
|
58
|
+
open
|
|
38
59
|
});
|
|
39
60
|
return (_ctx, _cache) => {
|
|
40
|
-
const
|
|
41
|
-
return vue.openBlock(), vue.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
const _component_EpButtons = vue.resolveComponent("EpButtons");
|
|
62
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
63
|
+
_ctx.isShowOpenDialogButton ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
|
|
64
|
+
key: 0,
|
|
65
|
+
type: "primary",
|
|
66
|
+
plain: "",
|
|
67
|
+
size: "small",
|
|
68
|
+
class: vue.normalizeClass(vue.unref(bem$1).e("handler")),
|
|
69
|
+
onClick: vue.unref(open)
|
|
70
|
+
}, {
|
|
71
|
+
default: vue.withCtx(() => [
|
|
72
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(t)("ep.attachment.manageAttachment")) + "(" + vue.toDisplayString(modelValue.value?.length || 0) + ") ", 1)
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 8, ["class", "onClick"])) : vue.createCommentVNode("", true),
|
|
76
|
+
vue.createVNode(vue.unref(AttachmentDialog), null, {
|
|
77
|
+
default: vue.withCtx(() => [
|
|
78
|
+
vue.createElementVNode("div", { style: { "margin-bottom": "10px", "text-align": "right" } }, [
|
|
79
|
+
_ctx.openType === "dialog" ? (vue.openBlock(), vue.createBlock(_component_EpButtons, {
|
|
80
|
+
key: 0,
|
|
81
|
+
type: "primary",
|
|
82
|
+
list: [
|
|
83
|
+
{
|
|
84
|
+
name: vue.unref(t)("ep.attachment.addAttachment"),
|
|
85
|
+
type: "primary",
|
|
86
|
+
onClick: vue.unref(addAttachment)
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}, null, 8, ["list"])) : vue.createCommentVNode("", true)
|
|
50
90
|
]),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
data
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
91
|
+
vue.createVNode(vue.unref(index.EpTable), vue.mergeProps({
|
|
92
|
+
ref: "tableRef",
|
|
93
|
+
class: `${vue.unref(bem$1).b()} ${vue.unref(props.prepareClassNames)()}`,
|
|
94
|
+
style: {
|
|
95
|
+
...vue.unref(props.prepareStyles)()
|
|
96
|
+
},
|
|
97
|
+
columns: vue.unref(columns),
|
|
98
|
+
data: modelValue.value
|
|
99
|
+
}, props$1), null, 16, ["class", "style", "columns", "data"])
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
})
|
|
103
|
+
], 64);
|
|
64
104
|
};
|
|
65
105
|
}
|
|
66
106
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.vue2.js","sources":["../../../../../../packages/components/attachment/src/attachment.vue"],"sourcesContent":["<template>\n <AttachmentDialog>\n <
|
|
1
|
+
{"version":3,"file":"attachment.vue2.js","sources":["../../../../../../packages/components/attachment/src/attachment.vue"],"sourcesContent":["<template>\n <ElButton\n v-if=\"isShowOpenDialogButton\"\n type=\"primary\"\n plain\n size=\"small\"\n :class=\"bem.e('handler')\"\n @click=\"open\"\n >\n {{ t('ep.attachment.manageAttachment') }}({{ modelValue?.length || 0 }})\n </ElButton>\n <AttachmentDialog>\n <div style=\"margin-bottom: 10px; text-align: right\">\n <EpButtons\n v-if=\"openType === 'dialog'\"\n type=\"primary\"\n :list=\"[\n {\n name: t('ep.attachment.addAttachment'),\n type: 'primary',\n onClick: addAttachment,\n },\n ]\"\n />\n </div>\n\n <EpTable\n ref=\"tableRef\"\n :class=\"`${bem.b()} ${prepareClassNames()}`\"\n :style=\"{\n ...prepareStyles(),\n }\"\n :columns=\"columns\"\n :data=\"modelValue\"\n v-bind=\"props\"\n >\n </EpTable>\n </AttachmentDialog>\n</template>\n<script setup lang=\"ts\">\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { prepareClassNames, prepareStyles } from '@el-plus/utils/props'\nimport { attachmentProps } from './attachment'\nimport EpTable from '@el-plus/components/table'\nimport { useAttachment } from './use-attachment'\nimport type { TableProps } from '@el-plus/components/table'\nimport { useDialog } from '@el-plus/hooks/dialog/use-dialog'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nimport { ElButton } from 'element-plus'\nconst { t } = useLocale()\ndefineOptions({\n name: 'EpAttachment',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('attachment')\nconst props = defineProps(attachmentProps)\nconst modelValue = defineModel<TableProps['data']>()\nconst { columns, addAttachment, isNormalOpen, onConfirm, onCancel } =\n useAttachment(props, {\n data: modelValue,\n })\nconst AttachmentDialog = useDialog({\n width: 850,\n center: true,\n title: isNormalOpen ? '' : t('ep.attachment.manageAttachment'),\n modal: !isNormalOpen,\n showClose: !isNormalOpen,\n showFooter: !isNormalOpen,\n transition: isNormalOpen ? '' : 'dialog-fade',\n modalClass: bem.em(\n 'dialog',\n props.openType === 'normal' ? props.openType : '',\n ),\n onConfirm: async (resolve) => {\n onConfirm(resolve)\n },\n onCancel: (resolve) => {\n onCancel(resolve)\n },\n})\nconst open = AttachmentDialog.open\nif (isNormalOpen) {\n open()\n}\ndefineExpose({\n open,\n})\n</script>\n"],"names":["useLocale","bem","createNameSpace","props","_useModel","useAttachment","useDialog","isShowOpenDialogButton","_createBlock","_unref","ElButton","_normalizeClass","_createTextVNode","_toDisplayString","_createVNode","_createElementVNode","openType","_mergeProps","prepareClassNames","prepareStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAA,MAAM,EAAE,CAAA,EAAE,GAAIA,mBAAA,EAAU;AAKxB,IAAA,MAAMC,KAAA,GAAMC,oBAAgB,YAAY,CAAA;AACxC,IAAA,MAAMC,OAAA,GAAQ,OAAA;AACd,IAAA,MAAM,UAAA,GAAaC,YAAA,CAA+B,OAAA,EAAA,YAAC,CAAA;AACnD,IAAA,MAAM,EAAE,SAAS,aAAA,EAAe,YAAA,EAAc,WAAW,QAAA,EAAS,GAChEC,4BAAcF,OAAA,EAAO;AAAA,MACnB,IAAA,EAAM;AAAA,KACP,CAAA;AACH,IAAA,MAAM,mBAAmBG,mBAAA,CAAU;AAAA,MACjC,KAAA,EAAO,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AAA,gBAAA,CAAA,EAAA,IAAA,EAAA;AAAA,+BAzBjB,MAYM;AAAA,YAZNM,sBAAA,CAYM,KAAA,EAAA,EAZD,KAAA,EAAA,EAAA,iBAAA,MAAA,EAAA,YAAA,EAAA,OAAA,EAAA,EAA8C,EAAA;AAAA,cAEzCC,KAAAA,QAAAA,KAAQ,QAAA,qBADhBR,gBAUE,oBAAA,EAAA;AAAA;gBARA,IAAA,EAAK,SAAA;AAAA,gBACJ,IAAA,EAAI;AAAA;0BAAkCC,SAAA,CAAA,CAAA,CAAA,CAAC,6BAAA,CAAA;AAAA;6BAAmFA,UAAA,aAAA;AAAA;;;;YAU/HK,eAAA,CAUUL,SAAA,iBAVVQ,cAAA,CAUU;AAAA,cATR,GAAA,EAAI,UAAA;AAAA,cACH,KAAA,EAAK,CAAA,EAAKR,SAAA,CAAAR,KAAA,CAAA,CAAI,CAAA,MAAOQ,SAAA,CAAAS,uBAAA,CAAA,EAAiB,CAAA,CAAA;AAAA,cACtC,KAAA,EAAK;AAAA,mBAAeT,SAAA,CAAAU,mBAAA,CAAA;AAAa;cAGjC,OAAA,EAASV,UAAA,OAAA,CAAA;AAAA,cACT,MAAM,UAAA,CAAA;AAAA,eACCN,OAAK,CAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAAA;;;;;;;;;;"}
|
|
@@ -3,21 +3,22 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
3
3
|
}) => {
|
|
4
4
|
columns: import("vue").Ref<({
|
|
5
5
|
type: string;
|
|
6
|
-
label:
|
|
6
|
+
label: any;
|
|
7
7
|
width: string;
|
|
8
8
|
props: {
|
|
9
9
|
type: string;
|
|
10
10
|
list: ({
|
|
11
|
-
name:
|
|
11
|
+
name: any;
|
|
12
12
|
onClick: ({ row }: {
|
|
13
13
|
row: any;
|
|
14
14
|
}) => void;
|
|
15
15
|
disabled?: undefined;
|
|
16
16
|
} | {
|
|
17
|
-
name:
|
|
17
|
+
name: any;
|
|
18
18
|
disabled: () => boolean;
|
|
19
|
-
onClick: ({ $index }: {
|
|
19
|
+
onClick: ({ $index, row }: {
|
|
20
20
|
$index: any;
|
|
21
|
+
row: any;
|
|
21
22
|
}) => void;
|
|
22
23
|
})[];
|
|
23
24
|
desc?: undefined;
|
|
@@ -27,7 +28,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
27
28
|
show?: undefined;
|
|
28
29
|
onClick?: undefined;
|
|
29
30
|
} | {
|
|
30
|
-
label:
|
|
31
|
+
label: any;
|
|
31
32
|
prop: string;
|
|
32
33
|
type: string;
|
|
33
34
|
required: boolean;
|
|
@@ -42,7 +43,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
42
43
|
width?: undefined;
|
|
43
44
|
onClick?: undefined;
|
|
44
45
|
} | {
|
|
45
|
-
label:
|
|
46
|
+
label: any;
|
|
46
47
|
prop: string;
|
|
47
48
|
type: string;
|
|
48
49
|
onClick: ({ row }: {
|
|
@@ -53,7 +54,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
53
54
|
required?: undefined;
|
|
54
55
|
show?: undefined;
|
|
55
56
|
} | {
|
|
56
|
-
label:
|
|
57
|
+
label: any;
|
|
57
58
|
prop: string;
|
|
58
59
|
type?: undefined;
|
|
59
60
|
width?: undefined;
|
|
@@ -62,7 +63,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
62
63
|
show?: undefined;
|
|
63
64
|
onClick?: undefined;
|
|
64
65
|
} | {
|
|
65
|
-
label:
|
|
66
|
+
label: any;
|
|
66
67
|
prop: string;
|
|
67
68
|
type: string;
|
|
68
69
|
show: () => any;
|
|
@@ -72,21 +73,22 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
72
73
|
onClick?: undefined;
|
|
73
74
|
})[], ({
|
|
74
75
|
type: string;
|
|
75
|
-
label:
|
|
76
|
+
label: any;
|
|
76
77
|
width: string;
|
|
77
78
|
props: {
|
|
78
79
|
type: string;
|
|
79
80
|
list: ({
|
|
80
|
-
name:
|
|
81
|
+
name: any;
|
|
81
82
|
onClick({ row }: {
|
|
82
83
|
row: any;
|
|
83
84
|
}): void;
|
|
84
85
|
disabled?: undefined;
|
|
85
86
|
} | {
|
|
86
|
-
name:
|
|
87
|
+
name: any;
|
|
87
88
|
disabled: () => boolean;
|
|
88
|
-
onClick: ({ $index }: {
|
|
89
|
+
onClick: ({ $index, row }: {
|
|
89
90
|
$index: any;
|
|
91
|
+
row: any;
|
|
90
92
|
}) => void;
|
|
91
93
|
})[];
|
|
92
94
|
desc?: undefined;
|
|
@@ -96,7 +98,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
96
98
|
show?: undefined;
|
|
97
99
|
onClick?: undefined;
|
|
98
100
|
} | {
|
|
99
|
-
label:
|
|
101
|
+
label: any;
|
|
100
102
|
prop: string;
|
|
101
103
|
type: string;
|
|
102
104
|
required: boolean;
|
|
@@ -111,7 +113,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
111
113
|
width?: undefined;
|
|
112
114
|
onClick?: undefined;
|
|
113
115
|
} | {
|
|
114
|
-
label:
|
|
116
|
+
label: any;
|
|
115
117
|
prop: string;
|
|
116
118
|
type: string;
|
|
117
119
|
onClick({ row }: {
|
|
@@ -122,7 +124,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
122
124
|
required?: undefined;
|
|
123
125
|
show?: undefined;
|
|
124
126
|
} | {
|
|
125
|
-
label:
|
|
127
|
+
label: any;
|
|
126
128
|
prop: string;
|
|
127
129
|
type?: undefined;
|
|
128
130
|
width?: undefined;
|
|
@@ -131,7 +133,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
131
133
|
show?: undefined;
|
|
132
134
|
onClick?: undefined;
|
|
133
135
|
} | {
|
|
134
|
-
label:
|
|
136
|
+
label: any;
|
|
135
137
|
prop: string;
|
|
136
138
|
type: string;
|
|
137
139
|
show: () => any;
|
|
@@ -141,21 +143,22 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
141
143
|
onClick?: undefined;
|
|
142
144
|
})[] | ({
|
|
143
145
|
type: string;
|
|
144
|
-
label:
|
|
146
|
+
label: any;
|
|
145
147
|
width: string;
|
|
146
148
|
props: {
|
|
147
149
|
type: string;
|
|
148
150
|
list: ({
|
|
149
|
-
name:
|
|
151
|
+
name: any;
|
|
150
152
|
onClick: ({ row }: {
|
|
151
153
|
row: any;
|
|
152
154
|
}) => void;
|
|
153
155
|
disabled?: undefined;
|
|
154
156
|
} | {
|
|
155
|
-
name:
|
|
157
|
+
name: any;
|
|
156
158
|
disabled: () => boolean;
|
|
157
|
-
onClick: ({ $index }: {
|
|
159
|
+
onClick: ({ $index, row }: {
|
|
158
160
|
$index: any;
|
|
161
|
+
row: any;
|
|
159
162
|
}) => void;
|
|
160
163
|
})[];
|
|
161
164
|
desc?: undefined;
|
|
@@ -165,7 +168,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
165
168
|
show?: undefined;
|
|
166
169
|
onClick?: undefined;
|
|
167
170
|
} | {
|
|
168
|
-
label:
|
|
171
|
+
label: any;
|
|
169
172
|
prop: string;
|
|
170
173
|
type: string;
|
|
171
174
|
required: boolean;
|
|
@@ -180,7 +183,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
180
183
|
width?: undefined;
|
|
181
184
|
onClick?: undefined;
|
|
182
185
|
} | {
|
|
183
|
-
label:
|
|
186
|
+
label: any;
|
|
184
187
|
prop: string;
|
|
185
188
|
type: string;
|
|
186
189
|
onClick: ({ row }: {
|
|
@@ -191,7 +194,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
191
194
|
required?: undefined;
|
|
192
195
|
show?: undefined;
|
|
193
196
|
} | {
|
|
194
|
-
label:
|
|
197
|
+
label: any;
|
|
195
198
|
prop: string;
|
|
196
199
|
type?: undefined;
|
|
197
200
|
width?: undefined;
|
|
@@ -200,7 +203,7 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
200
203
|
show?: undefined;
|
|
201
204
|
onClick?: undefined;
|
|
202
205
|
} | {
|
|
203
|
-
label:
|
|
206
|
+
label: any;
|
|
204
207
|
prop: string;
|
|
205
208
|
type: string;
|
|
206
209
|
show: () => any;
|
|
@@ -209,4 +212,9 @@ export declare const useAttachment: (props: any, { data }: {
|
|
|
209
212
|
required?: undefined;
|
|
210
213
|
onClick?: undefined;
|
|
211
214
|
})[]>;
|
|
215
|
+
addAttachment: () => Promise<void>;
|
|
216
|
+
isNormalOpen: boolean;
|
|
217
|
+
isDialogOpen: boolean;
|
|
218
|
+
onConfirm: (resolve: any) => Promise<void>;
|
|
219
|
+
onCancel: (resolve: any) => void;
|
|
212
220
|
};
|
|
@@ -2,23 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
var vue = require('vue');
|
|
4
4
|
var useNavigation = require('../../../hooks/use-navigation.js');
|
|
5
|
+
var useLocale = require('../../../hooks/use-locale.js');
|
|
5
6
|
var file = require('../../../utils/file.js');
|
|
7
|
+
var Cookies = require('js-cookie');
|
|
6
8
|
|
|
7
9
|
const useAttachment = (props, { data }) => {
|
|
8
10
|
const { mode: defaultMode } = useNavigation.useNavigation();
|
|
11
|
+
const { t } = useLocale.useLocale();
|
|
9
12
|
const mode = vue.computed(() => {
|
|
10
13
|
return props.mode || defaultMode.value;
|
|
11
14
|
});
|
|
15
|
+
const tableRef = vue.useTemplateRef("tableRef");
|
|
16
|
+
const isNormalOpen = props.openType === "normal";
|
|
17
|
+
const isDialogOpen = props.openType === "dialog";
|
|
18
|
+
let toBeConfirmData = [];
|
|
19
|
+
let toBeDeleteData = {};
|
|
12
20
|
const columns = vue.ref([
|
|
13
21
|
{
|
|
14
22
|
type: "EpButtons",
|
|
15
|
-
label: "
|
|
23
|
+
label: t("ep.attachment.operation"),
|
|
16
24
|
width: "120px",
|
|
17
25
|
props: {
|
|
18
26
|
type: "text",
|
|
19
27
|
list: [
|
|
20
28
|
{
|
|
21
|
-
name: "
|
|
29
|
+
name: t("ep.attachment.download"),
|
|
22
30
|
onClick({ row }) {
|
|
23
31
|
file.downloadFile({
|
|
24
32
|
src: row.filePath,
|
|
@@ -27,11 +35,14 @@ const useAttachment = (props, { data }) => {
|
|
|
27
35
|
}
|
|
28
36
|
},
|
|
29
37
|
{
|
|
30
|
-
name: "
|
|
38
|
+
name: t("ep.attachment.delete"),
|
|
31
39
|
disabled: () => {
|
|
32
40
|
return mode.value === "browse";
|
|
33
41
|
},
|
|
34
|
-
onClick: ({ $index }) => {
|
|
42
|
+
onClick: ({ $index, row }) => {
|
|
43
|
+
if (isDialogOpen) {
|
|
44
|
+
toBeDeleteData[$index] = row;
|
|
45
|
+
}
|
|
35
46
|
data.value.splice($index, 1);
|
|
36
47
|
}
|
|
37
48
|
}
|
|
@@ -39,7 +50,7 @@ const useAttachment = (props, { data }) => {
|
|
|
39
50
|
}
|
|
40
51
|
},
|
|
41
52
|
{
|
|
42
|
-
label: "
|
|
53
|
+
label: t("ep.attachment.attachmentType"),
|
|
43
54
|
prop: "type",
|
|
44
55
|
type: "EpSelect",
|
|
45
56
|
required: true,
|
|
@@ -51,7 +62,7 @@ const useAttachment = (props, { data }) => {
|
|
|
51
62
|
}
|
|
52
63
|
},
|
|
53
64
|
{
|
|
54
|
-
label: "
|
|
65
|
+
label: t("ep.attachment.fileName"),
|
|
55
66
|
prop: "originalFilename",
|
|
56
67
|
type: "EpLink",
|
|
57
68
|
onClick({ row }) {
|
|
@@ -59,22 +70,64 @@ const useAttachment = (props, { data }) => {
|
|
|
59
70
|
}
|
|
60
71
|
},
|
|
61
72
|
{
|
|
62
|
-
label: "
|
|
73
|
+
label: t("ep.attachment.creator"),
|
|
63
74
|
prop: "createBy"
|
|
64
75
|
},
|
|
65
76
|
{
|
|
66
|
-
label: "
|
|
77
|
+
label: t("ep.attachment.createTime"),
|
|
67
78
|
prop: "createTime"
|
|
68
79
|
},
|
|
69
80
|
{
|
|
70
|
-
label: "
|
|
81
|
+
label: t("ep.attachment.description"),
|
|
71
82
|
prop: "note",
|
|
72
83
|
type: "EpInput",
|
|
73
84
|
show: () => props.isNote
|
|
74
85
|
}
|
|
75
86
|
]);
|
|
87
|
+
const addAttachment = async () => {
|
|
88
|
+
toBeConfirmData = [];
|
|
89
|
+
const fileData = await file.importFile({
|
|
90
|
+
api: "api-f/fast/files/save",
|
|
91
|
+
extraData: {
|
|
92
|
+
createBy: Cookies.get("accountName") || ""
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
fileData.fileId = fileData.id;
|
|
96
|
+
delete fileData.id;
|
|
97
|
+
if (isDialogOpen) {
|
|
98
|
+
toBeConfirmData.push(fileData);
|
|
99
|
+
}
|
|
100
|
+
data.value.push(fileData);
|
|
101
|
+
};
|
|
102
|
+
const onConfirm = async (resolve) => {
|
|
103
|
+
await tableRef.value?.validate();
|
|
104
|
+
resolve(data.value);
|
|
105
|
+
};
|
|
106
|
+
const onCancel = (resolve) => {
|
|
107
|
+
if (toBeConfirmData.length) {
|
|
108
|
+
const index = data.value.findIndex((item) => {
|
|
109
|
+
return item.fileId === toBeConfirmData[0].fileId;
|
|
110
|
+
});
|
|
111
|
+
if (index !== -1) {
|
|
112
|
+
data.value.splice(index, 1);
|
|
113
|
+
}
|
|
114
|
+
toBeConfirmData = [];
|
|
115
|
+
}
|
|
116
|
+
if (Object.keys(toBeDeleteData).length) {
|
|
117
|
+
Object.keys(toBeDeleteData).forEach((oldIndex) => {
|
|
118
|
+
data.value.splice(Number(oldIndex), 0, toBeDeleteData[oldIndex]);
|
|
119
|
+
});
|
|
120
|
+
toBeDeleteData = {};
|
|
121
|
+
}
|
|
122
|
+
resolve();
|
|
123
|
+
};
|
|
76
124
|
return {
|
|
77
|
-
columns
|
|
125
|
+
columns,
|
|
126
|
+
addAttachment,
|
|
127
|
+
isNormalOpen,
|
|
128
|
+
isDialogOpen,
|
|
129
|
+
onConfirm,
|
|
130
|
+
onCancel
|
|
78
131
|
};
|
|
79
132
|
};
|
|
80
133
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-attachment.js","sources":["../../../../../../packages/components/attachment/src/use-attachment.ts"],"sourcesContent":["import { ref, computed } from 'vue'\nimport { useNavigation } from '@el-plus/hooks/use-navigation'\nimport { downloadFile, previewFile } from '@el-plus/utils/file'\nexport const useAttachment = (props, { data }) => {\n const { mode: defaultMode } = useNavigation()\n const mode = computed(() => {\n return props.mode || defaultMode.value\n })\n\n const columns = ref([\n {\n type: 'EpButtons',\n label: '
|
|
1
|
+
{"version":3,"file":"use-attachment.js","sources":["../../../../../../packages/components/attachment/src/use-attachment.ts"],"sourcesContent":["import { ref, computed, useTemplateRef } from 'vue'\nimport { useNavigation } from '@el-plus/hooks/use-navigation'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nimport { downloadFile, previewFile, importFile } from '@el-plus/utils/file'\nimport { Cookies } from '@el-plus/utils/cookie'\nimport type { TableInstance } from '@el-plus/components/table'\n\nexport const useAttachment = (props, { data }) => {\n const { mode: defaultMode } = useNavigation()\n const { t } = useLocale()\n const mode = computed(() => {\n return props.mode || defaultMode.value\n })\n const tableRef = useTemplateRef<TableInstance>('tableRef')\n const isNormalOpen = props.openType === 'normal'\n const isDialogOpen = props.openType === 'dialog'\n\n // 待确认的附件列表\n let toBeConfirmData: Record<string, any>[] = []\n // 待删除的附件列表\n let toBeDeleteData: {\n [key: number]: Record<string, any> // key要存储原来索引以便保留原顺序\n } = {}\n const columns = ref([\n {\n type: 'EpButtons',\n label: t('ep.attachment.operation'),\n width: '120px',\n props: {\n type: 'text',\n list: [\n {\n name: t('ep.attachment.download'),\n onClick({ row }) {\n downloadFile({\n src: row.filePath,\n fileName: row.originalFilename || row.originalFileName,\n })\n },\n },\n {\n name: t('ep.attachment.delete'),\n disabled: () => {\n return mode.value === 'browse'\n },\n onClick: ({ $index, row }) => {\n if (isDialogOpen) {\n // 待删除的附件列表\n toBeDeleteData[$index] = row\n }\n data.value.splice($index, 1)\n },\n },\n ],\n },\n },\n {\n label: t('ep.attachment.attachmentType'),\n prop: 'type',\n type: 'EpSelect',\n required: true,\n show: () => props.isType,\n props: {\n desc: ({ row }) => {\n return row.typeDesc\n },\n },\n },\n {\n label: t('ep.attachment.fileName'),\n prop: 'originalFilename',\n type: 'EpLink',\n onClick({ row }) {\n previewFile(row.filePath)\n },\n },\n {\n label: t('ep.attachment.creator'),\n prop: 'createBy',\n },\n {\n label: t('ep.attachment.createTime'),\n prop: 'createTime',\n },\n {\n label: t('ep.attachment.description'),\n prop: 'note',\n type: 'EpInput',\n show: () => props.isNote,\n },\n ])\n const addAttachment = async () => {\n toBeConfirmData = []\n const fileData = await importFile({\n api: 'api-f/fast/files/save',\n extraData: {\n createBy: Cookies.get('accountName') || '',\n },\n })\n fileData.fileId = fileData.id\n delete fileData.id\n if (isDialogOpen) {\n // 待确认的附件列表\n toBeConfirmData.push(fileData)\n }\n data.value.push(fileData)\n }\n // 确认\n const onConfirm = async (resolve) => {\n await tableRef.value?.validate()\n resolve(data.value)\n }\n // 取消\n const onCancel = (resolve) => {\n if (toBeConfirmData.length) {\n // 找到待确认的附件\n const index = data.value.findIndex((item) => {\n return item.fileId === toBeConfirmData[0].fileId\n })\n if (index !== -1) {\n // 删除待确认的附件\n data.value.splice(index, 1)\n }\n // 清空待确认的附件列表\n toBeConfirmData = []\n }\n if (Object.keys(toBeDeleteData).length) {\n // 找到待删除的附件在原位置插入\n Object.keys(toBeDeleteData).forEach((oldIndex) => {\n data.value.splice(Number(oldIndex), 0, toBeDeleteData[oldIndex])\n })\n // 清空待删除的附件列表\n toBeDeleteData = {}\n }\n resolve()\n }\n return {\n columns,\n addAttachment,\n isNormalOpen,\n isDialogOpen,\n onConfirm,\n onCancel,\n }\n}\n"],"names":["useNavigation","useLocale","computed","useTemplateRef","ref","downloadFile","previewFile","importFile"],"mappings":";;;;;;;;AAOO,MAAM,aAAA,GAAgB,CAAC,KAAA,EAAO,EAAE,MAAK,KAAM;AAChD,EAAA,MAAM,EAAE,IAAA,EAAM,WAAA,EA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