@truenewx/tnxvue3 3.4.4 → 3.4.6
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/package.json +18 -17
- package/src/bootstrap-vue/dialog/Dialog.vue +22 -10
- package/src/bootstrap-vue/select/Select.vue +3 -4
- package/src/components/ScrollView.vue +69 -0
- package/src/css.d.ts +4 -0
- package/src/element-plus/aj-captcha/utils/ase.js +4 -4
- package/src/element-plus/dialog/Dialog.vue +19 -7
- package/src/element-plus/drawer/Drawer.vue +20 -3
- package/src/element-plus/fss-upload/FssUpload.vue +1 -1
- package/src/element-plus/icon/Icon.vue +3 -0
- package/src/element-plus/select/Select.vue +3 -4
- package/src/element-plus/tnxel.css +0 -8
- package/src/element-plus/tnxel.ts +58 -72
- package/src/tdesign/mobile/calendar/Calendar.vue +121 -0
- package/src/tdesign/mobile/date-time-picker/DateTimePicker.vue +147 -0
- package/src/tdesign/mobile/dialog/Dialog.vue +179 -0
- package/src/tdesign/mobile/dialog/DialogContent.vue +13 -0
- package/src/tdesign/mobile/drawer/Drawer.vue +197 -0
- package/src/tdesign/mobile/drawer/DrawerContent.vue +13 -0
- package/src/tdesign/mobile/enum-select/EnumSelect.vue +164 -0
- package/src/tdesign/mobile/popup/Popup.vue +106 -0
- package/src/tdesign/mobile/region-picker/RegionPicker.vue +223 -0
- package/src/tdesign/mobile/select/Select.vue +479 -0
- package/src/tdesign/mobile/slide-radio-group/SlideRadioGroup.vue +397 -0
- package/src/tdesign/mobile/tnxtdm.css +125 -0
- package/src/tdesign/mobile/tnxtdm.ts +305 -1
- package/src/tdesign/tnxtd-validator.ts +14 -13
- package/src/tdesign/tnxtd.css +98 -0
- package/src/tdesign/tnxtd.ts +4 -0
- package/src/tnxvue-router.ts +59 -5
- package/src/tnxvue.ts +32 -11
- package/src/vue.d.ts +6 -0
- package/tsconfig.json +4 -7
- /package/src/{percent → components}/Percent.vue +0 -0
- /package/src/{text → components}/Text.vue +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truenewx/tnxvue3",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.6",
|
|
4
4
|
"description": "互联网技术解决方案:Vue3扩展支持",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -21,33 +21,34 @@
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@element-plus/icons-vue": "~2.3.0",
|
|
23
23
|
"async-validator": "~4.2.0",
|
|
24
|
-
"bootstrap-vue-next": "~0.
|
|
25
|
-
"element-plus": "~2.
|
|
24
|
+
"bootstrap-vue-next": "~0.45.0",
|
|
25
|
+
"element-plus": "~2.14.0",
|
|
26
26
|
"tdesign-icons-vue-next": "~0.4.0",
|
|
27
|
-
"tdesign-mobile-vue": "~1.
|
|
28
|
-
"tdesign-vue-next": "~1.
|
|
27
|
+
"tdesign-mobile-vue": "~1.15.0",
|
|
28
|
+
"tdesign-vue-next": "~1.20.0",
|
|
29
29
|
"validator": "~13.15.0",
|
|
30
30
|
"vue": "~3.5.0",
|
|
31
31
|
"vue-router": "~4.6.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@truenewx/tnxcore": "3.4.
|
|
34
|
+
"@truenewx/tnxcore": "3.4.5",
|
|
35
35
|
"bootstrap": "5.3.8",
|
|
36
36
|
"cash-dom": "8.1.5",
|
|
37
37
|
"mitt": "3.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@eslint/js": "
|
|
41
|
-
"@typescript-eslint/parser": "8.
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
43
|
-
"@vitejs/plugin-vue": "6.0.
|
|
44
|
-
"eslint": "
|
|
45
|
-
"eslint-plugin-vue": "10.
|
|
46
|
-
"globals": "
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
40
|
+
"@eslint/js": "10.0.1",
|
|
41
|
+
"@typescript-eslint/parser": "8.61.1",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "8.61.1",
|
|
43
|
+
"@vitejs/plugin-vue": "6.0.7",
|
|
44
|
+
"eslint": "10.5.0",
|
|
45
|
+
"eslint-plugin-vue": "10.9.2",
|
|
46
|
+
"globals": "17.6.0",
|
|
47
|
+
"less": "4.6.6",
|
|
48
|
+
"tsx": "4.22.4",
|
|
49
|
+
"typescript": "6.0.3",
|
|
50
|
+
"vite": "8.0.16",
|
|
51
|
+
"vue-eslint-parser": "10.4.1"
|
|
51
52
|
},
|
|
52
53
|
"browserslist": [
|
|
53
54
|
"> 1%",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
<component ref="content" :is="content" v-bind="contentProps" v-else></component>
|
|
21
21
|
<template #footer>
|
|
22
22
|
<TnxbsvButton v-for="(button, index) in buttons" :key="index"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
:type="button.type || 'light'"
|
|
24
|
+
:loading="buttonLoadings[index]"
|
|
25
|
+
@click="btnClick(index)"
|
|
26
26
|
>
|
|
27
27
|
{{ button.caption || button.text }}
|
|
28
28
|
</TnxbsvButton>
|
|
@@ -113,14 +113,26 @@ export default {
|
|
|
113
113
|
},
|
|
114
114
|
btnClick(index) {
|
|
115
115
|
const button = this.buttons[index];
|
|
116
|
-
if (button
|
|
117
|
-
let
|
|
118
|
-
if (
|
|
119
|
-
this.
|
|
120
|
-
|
|
116
|
+
if (button) {
|
|
117
|
+
let click = button.click;
|
|
118
|
+
if (typeof click === 'string') {
|
|
119
|
+
if (typeof this.$refs.content[click] === 'function') {
|
|
120
|
+
click = this.$refs.content[click];
|
|
121
|
+
} else {
|
|
122
|
+
console.error(`Method '${click}' not found in component:`, this.$refs.content);
|
|
123
|
+
click = null;
|
|
124
|
+
}
|
|
121
125
|
}
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
|
|
127
|
+
if (typeof click === 'function') {
|
|
128
|
+
let result = click.call(this.$refs.content, this.close);
|
|
129
|
+
if (result === 'loading') {
|
|
130
|
+
this.buttonLoadings[index] = true;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (result === false) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
124
136
|
}
|
|
125
137
|
}
|
|
126
138
|
this.close();
|
|
@@ -181,18 +181,17 @@ export default {
|
|
|
181
181
|
},
|
|
182
182
|
triggerChange(value) {
|
|
183
183
|
if (this.change) {
|
|
184
|
-
let item = undefined;
|
|
185
184
|
if (this.isMulti()) {
|
|
186
|
-
item = [];
|
|
185
|
+
let item = [];
|
|
187
186
|
if (Array.isArray(value)) {
|
|
188
187
|
for (let v of value) {
|
|
189
188
|
item.push(this.getItem(v));
|
|
190
189
|
}
|
|
191
190
|
}
|
|
191
|
+
this.change(item, this.id);
|
|
192
192
|
} else {
|
|
193
|
-
|
|
193
|
+
this.change(this.getItem(value), this.id);
|
|
194
194
|
}
|
|
195
|
-
this.change(item, this.id);
|
|
196
195
|
} else {
|
|
197
196
|
this.$emit('change', value);
|
|
198
197
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="scroll-view">
|
|
3
|
+
<div class="scroll-view-y" :class="{'hide-scrollbar-y': !scrollY}">
|
|
4
|
+
<div class="scroll-view-x" :class="{'hide-scrollbar-x': !scrollX}">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: 'ScrollView',
|
|
14
|
+
props: {
|
|
15
|
+
scrollX: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
scrollY: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
return {};
|
|
26
|
+
},
|
|
27
|
+
methods: {}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style lang="less" scoped>
|
|
32
|
+
.scroll-view {
|
|
33
|
+
height: 100%;
|
|
34
|
+
min-height: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.scroll-view-y {
|
|
38
|
+
height: 100%;
|
|
39
|
+
overflow-x: hidden;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
-webkit-overflow-scrolling: touch;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.scroll-view-x {
|
|
45
|
+
width: 100%;
|
|
46
|
+
min-height: 100%;
|
|
47
|
+
overflow-x: auto;
|
|
48
|
+
overflow-y: visible;
|
|
49
|
+
-webkit-overflow-scrolling: touch;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.hide-scrollbar-y {
|
|
53
|
+
-ms-overflow-style: none;
|
|
54
|
+
scrollbar-width: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.hide-scrollbar-y::-webkit-scrollbar {
|
|
58
|
+
width: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hide-scrollbar-x {
|
|
62
|
+
-ms-overflow-style: none;
|
|
63
|
+
scrollbar-width: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.hide-scrollbar-x::-webkit-scrollbar {
|
|
67
|
+
height: 0;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
package/src/css.d.ts
ADDED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {AES, ECB, Pkcs7, Utf8} from 'crypto-es';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @word 要加密的内容
|
|
5
5
|
* @keyWord String 服务器随机返回的关键字
|
|
6
6
|
* */
|
|
7
7
|
export function aesEncrypt(word, keyWord = "XwKsGlMcdPMEhR1B") {
|
|
8
|
-
let key =
|
|
9
|
-
let srcs =
|
|
10
|
-
let encrypted =
|
|
8
|
+
let key = Utf8.parse(keyWord);
|
|
9
|
+
let srcs = Utf8.parse(word);
|
|
10
|
+
let encrypted = AES.encrypt(srcs, key, {mode: ECB, padding: Pkcs7});
|
|
11
11
|
return encrypted.toString();
|
|
12
12
|
}
|
|
@@ -170,14 +170,26 @@ export default {
|
|
|
170
170
|
},
|
|
171
171
|
btnClick(index) {
|
|
172
172
|
const button = this.buttons[index];
|
|
173
|
-
if (button
|
|
174
|
-
let
|
|
175
|
-
if (
|
|
176
|
-
this.
|
|
177
|
-
|
|
173
|
+
if (button) {
|
|
174
|
+
let click = button.click;
|
|
175
|
+
if (typeof click === 'string') {
|
|
176
|
+
if (typeof this.$refs.content[click] === 'function') {
|
|
177
|
+
click = this.$refs.content[click];
|
|
178
|
+
} else {
|
|
179
|
+
console.error(`Method '${click}' not found in component:`, this.$refs.content);
|
|
180
|
+
click = null;
|
|
181
|
+
}
|
|
178
182
|
}
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
|
|
184
|
+
if (typeof click === 'function') {
|
|
185
|
+
let result = click.call(this.$refs.content, this.close);
|
|
186
|
+
if (result === 'loading') {
|
|
187
|
+
this.buttonLoadings[index] = true;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (result === false) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
181
193
|
}
|
|
182
194
|
}
|
|
183
195
|
this.close();
|
|
@@ -87,9 +87,26 @@ export default {
|
|
|
87
87
|
methods: {
|
|
88
88
|
btnClick(index) {
|
|
89
89
|
const button = this.buttons[index];
|
|
90
|
-
if (button
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
if (button) {
|
|
91
|
+
let click = button.click;
|
|
92
|
+
if (typeof click === 'string') {
|
|
93
|
+
if (typeof this.$refs.content[click] === 'function') {
|
|
94
|
+
click = this.$refs.content[click];
|
|
95
|
+
} else {
|
|
96
|
+
console.error(`Method '${click}' not found in component:`, this.$refs.content);
|
|
97
|
+
click = null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (typeof click === 'function') {
|
|
102
|
+
let result = click.call(this.$refs.content, this.close);
|
|
103
|
+
if (result === 'loading') {
|
|
104
|
+
this.buttonLoadings[index] = true;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (result === false) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
93
110
|
}
|
|
94
111
|
}
|
|
95
112
|
this.close();
|
|
@@ -275,7 +275,7 @@ export default {
|
|
|
275
275
|
if (typeof reject === 'function') {
|
|
276
276
|
reject(file);
|
|
277
277
|
} else {
|
|
278
|
-
this.tnx.alert('文件"' + file.name + '"还未上传完毕,请稍候').then(() => {
|
|
278
|
+
this.tnx.alert('文件"' + file.name + '"还未上传完毕,请稍候', {title: '提示'}).then(() => {
|
|
279
279
|
if (reject && typeof reject.disable === 'function') {
|
|
280
280
|
reject.disable(false);
|
|
281
281
|
}
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
<Switch v-else-if="value === 'Switch'"/>
|
|
70
70
|
<Tools v-else-if="value === 'Tools'"/>
|
|
71
71
|
<Top v-else-if="value === 'Top'"/>
|
|
72
|
+
<Upload v-else-if="value === 'Upload'"/>
|
|
72
73
|
<User v-else-if="value === 'User'"/>
|
|
73
74
|
<UserFilled v-else-if="value === 'UserFilled'"/>
|
|
74
75
|
<View v-else-if="value === 'View'"/>
|
|
@@ -148,6 +149,7 @@ import {
|
|
|
148
149
|
Switch,
|
|
149
150
|
Tools,
|
|
150
151
|
Top,
|
|
152
|
+
Upload,
|
|
151
153
|
User,
|
|
152
154
|
UserFilled,
|
|
153
155
|
View,
|
|
@@ -225,6 +227,7 @@ const components = {
|
|
|
225
227
|
Switch,
|
|
226
228
|
Tools,
|
|
227
229
|
Top,
|
|
230
|
+
Upload,
|
|
228
231
|
User,
|
|
229
232
|
UserFilled,
|
|
230
233
|
View,
|
|
@@ -291,18 +291,17 @@ export default {
|
|
|
291
291
|
},
|
|
292
292
|
triggerChange(value) {
|
|
293
293
|
if (this.change) {
|
|
294
|
-
let item = undefined;
|
|
295
294
|
if (this.isMulti()) {
|
|
296
|
-
item = [];
|
|
295
|
+
let item = [];
|
|
297
296
|
if (Array.isArray(value)) {
|
|
298
297
|
for (let v of value) {
|
|
299
298
|
item.push(this.getItem(v));
|
|
300
299
|
}
|
|
301
300
|
}
|
|
301
|
+
this.change(item, this.id);
|
|
302
302
|
} else {
|
|
303
|
-
|
|
303
|
+
this.change(this.getItem(value), this.id);
|
|
304
304
|
}
|
|
305
|
-
this.change(item, this.id);
|
|
306
305
|
} else {
|
|
307
306
|
this.$emit('change', value);
|
|
308
307
|
}
|
|
@@ -10,14 +10,6 @@
|
|
|
10
10
|
background-color: var(--el-color-info-light-8) !important;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.text-white {
|
|
14
|
-
color: white !important;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.bg-white {
|
|
18
|
-
background-color: white !important;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
13
|
.text-regular {
|
|
22
14
|
color: var(--el-text-color-regular) !important;
|
|
23
15
|
}
|
|
@@ -8,6 +8,7 @@ import ElementPlus, {
|
|
|
8
8
|
ElMessageBox,
|
|
9
9
|
ElMessageBoxOptions,
|
|
10
10
|
MessageParams,
|
|
11
|
+
MessageType,
|
|
11
12
|
LoadingOptions,
|
|
12
13
|
LoadingInstance,
|
|
13
14
|
} from 'element-plus';
|
|
@@ -69,7 +70,8 @@ type VueComponent = Vue.Component & {
|
|
|
69
70
|
|
|
70
71
|
type ModalComponentInstance = Vue.ComponentPublicInstance & {
|
|
71
72
|
id: string;
|
|
72
|
-
close: () =>
|
|
73
|
+
close: () => void;
|
|
74
|
+
options: Record<string, any>;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export default class TnxEl extends TnxVue {
|
|
@@ -175,8 +177,8 @@ export default class TnxEl extends TnxVue {
|
|
|
175
177
|
theme: options.theme,
|
|
176
178
|
});
|
|
177
179
|
const dialog = dialogVm.mount(containerSelector) as ModalComponentInstance;
|
|
178
|
-
dialog
|
|
179
|
-
dialog
|
|
180
|
+
dialog.options = Object.assign(dialog.options || {}, options);
|
|
181
|
+
dialog.options.onClosed = this.util.function.around(dialog.options.onClosed, (onClosed: () => void): void => {
|
|
180
182
|
dialogVm.unmount();
|
|
181
183
|
this.dialogInstances.remove(dialog);
|
|
182
184
|
|
|
@@ -197,26 +199,18 @@ export default class TnxEl extends TnxVue {
|
|
|
197
199
|
return dialog;
|
|
198
200
|
}
|
|
199
201
|
|
|
200
|
-
closeDialog(all?: boolean):
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
} else {
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
202
|
+
closeDialog(all?: boolean): void {
|
|
203
|
+
if (this.dialogInstances.length) {
|
|
204
|
+
let dialog = this.dialogInstances.pop();
|
|
205
|
+
while (dialog) {
|
|
206
|
+
dialog.close();
|
|
207
|
+
if (all) {
|
|
208
|
+
dialog = this.dialogInstances.pop();
|
|
209
|
+
} else {
|
|
210
|
+
break;
|
|
212
211
|
}
|
|
213
|
-
Promise.all(promises).then(() => {
|
|
214
|
-
resolve();
|
|
215
|
-
});
|
|
216
|
-
} else {
|
|
217
|
-
resolve();
|
|
218
212
|
}
|
|
219
|
-
}
|
|
213
|
+
}
|
|
220
214
|
}
|
|
221
215
|
|
|
222
216
|
private drawerInstances: ModalComponentInstance[] = []; // 抽屉实例堆栈
|
|
@@ -251,8 +245,8 @@ export default class TnxEl extends TnxVue {
|
|
|
251
245
|
theme: options.theme,
|
|
252
246
|
});
|
|
253
247
|
const drawer = drawerVm.mount(containerSelector) as ModalComponentInstance;
|
|
254
|
-
drawer
|
|
255
|
-
drawer
|
|
248
|
+
drawer.options = Object.assign(drawer.options || {}, options);
|
|
249
|
+
drawer.options.onClosed = this.util.function.around(drawer.options.onClosed, (onClosed: () => void): void => {
|
|
256
250
|
drawerVm.unmount();
|
|
257
251
|
this.drawerInstances.remove(drawer);
|
|
258
252
|
|
|
@@ -273,26 +267,18 @@ export default class TnxEl extends TnxVue {
|
|
|
273
267
|
return drawer;
|
|
274
268
|
}
|
|
275
269
|
|
|
276
|
-
closeDrawer(all?: boolean):
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
} else {
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
270
|
+
closeDrawer(all?: boolean): void {
|
|
271
|
+
if (this.drawerInstances.length) {
|
|
272
|
+
let drawer = this.drawerInstances.pop();
|
|
273
|
+
while (drawer) {
|
|
274
|
+
drawer.close();
|
|
275
|
+
if (all) {
|
|
276
|
+
drawer = this.drawerInstances.pop();
|
|
277
|
+
} else {
|
|
278
|
+
break;
|
|
288
279
|
}
|
|
289
|
-
Promise.all(promises).then(() => {
|
|
290
|
-
resolve();
|
|
291
|
-
});
|
|
292
|
-
} else {
|
|
293
|
-
resolve();
|
|
294
280
|
}
|
|
295
|
-
}
|
|
281
|
+
}
|
|
296
282
|
}
|
|
297
283
|
|
|
298
284
|
private closeMessage() {
|
|
@@ -322,73 +308,73 @@ export default class TnxEl extends TnxVue {
|
|
|
322
308
|
});
|
|
323
309
|
}
|
|
324
310
|
|
|
325
|
-
toast(message: string,
|
|
311
|
+
toast(message: string, theme?: string, options?: { duration?: number }): Promise<void> {
|
|
326
312
|
this.closeMessage();
|
|
327
313
|
return new Promise<void>((resolve) => {
|
|
328
|
-
let
|
|
329
|
-
type: 'success', // 默认为成功主题,可更改为其它主题
|
|
314
|
+
let msgParams: MessageParams = {
|
|
315
|
+
type: (theme || 'success') as MessageType, // 默认为成功主题,可更改为其它主题
|
|
330
316
|
offset: this.util.dom.getDocHeight() * 0.4,
|
|
331
317
|
dangerouslyUseHTMLString: true,
|
|
332
318
|
showClose: false,
|
|
333
319
|
message: message,
|
|
334
|
-
duration:
|
|
320
|
+
duration: options?.duration || 2000,
|
|
335
321
|
customClass: 'tnxel-toast',
|
|
336
322
|
onClose: () => {
|
|
337
323
|
resolve();
|
|
338
324
|
}
|
|
339
325
|
};
|
|
340
|
-
ElMessage(
|
|
326
|
+
ElMessage(msgParams);
|
|
341
327
|
this.handleZIndex('.el-message:last');
|
|
342
|
-
this.eventBus.emit('tnx.toast',
|
|
328
|
+
this.eventBus.emit('tnx.toast', msgParams);
|
|
343
329
|
});
|
|
344
330
|
}
|
|
345
331
|
|
|
346
|
-
async alert(message: string, title
|
|
347
|
-
let
|
|
348
|
-
title: title,
|
|
332
|
+
async alert(message: string, options?: { title?: string, confirmButtonText?: string }): Promise<void> {
|
|
333
|
+
let msgOptions: ElMessageBoxOptions = {
|
|
334
|
+
title: options?.title || '提示',
|
|
349
335
|
dangerouslyUseHTMLString: true,
|
|
350
336
|
type: 'warning',
|
|
351
|
-
confirmButtonText: '确定',
|
|
337
|
+
confirmButtonText: options?.confirmButtonText || '确定',
|
|
352
338
|
};
|
|
353
339
|
this.closeMessage();
|
|
354
|
-
await ElMessageBox.alert(message,
|
|
340
|
+
await ElMessageBox.alert(message, msgOptions);
|
|
355
341
|
this.handleZIndex('.el-message-box__wrapper:last');
|
|
356
|
-
this.eventBus.emit('tnx.alert', Object.assign({},
|
|
342
|
+
this.eventBus.emit('tnx.alert', Object.assign({}, msgOptions, {message}));
|
|
357
343
|
}
|
|
358
344
|
|
|
359
|
-
async success(message: string): Promise<void> {
|
|
360
|
-
let
|
|
361
|
-
title: '成功',
|
|
345
|
+
async success(message: string, options?: { title?: string, confirmButtonText?: string }): Promise<void> {
|
|
346
|
+
let msgOptions: ElMessageBoxOptions = {
|
|
347
|
+
title: options?.title || '成功',
|
|
362
348
|
dangerouslyUseHTMLString: true,
|
|
363
349
|
type: 'success',
|
|
364
|
-
confirmButtonText: '确定',
|
|
350
|
+
confirmButtonText: options?.confirmButtonText || '确定',
|
|
365
351
|
};
|
|
366
352
|
this.closeMessage();
|
|
367
|
-
await ElMessageBox.alert(message,
|
|
353
|
+
await ElMessageBox.alert(message, msgOptions);
|
|
368
354
|
this.handleZIndex('.el-message-box__wrapper:last');
|
|
369
|
-
this.eventBus.emit('tnx.success', Object.assign({},
|
|
355
|
+
this.eventBus.emit('tnx.success', Object.assign({}, msgOptions, {message}));
|
|
370
356
|
}
|
|
371
357
|
|
|
372
|
-
async error(message: string): Promise<void> {
|
|
373
|
-
let
|
|
374
|
-
title: '错误',
|
|
358
|
+
async error(message: string, options?: { title?: string, confirmButtonText?: string }): Promise<void> {
|
|
359
|
+
let msgOptions: ElMessageBoxOptions = {
|
|
360
|
+
title: options?.title || '错误',
|
|
375
361
|
dangerouslyUseHTMLString: true,
|
|
376
362
|
type: 'error',
|
|
377
|
-
confirmButtonText: '确定',
|
|
363
|
+
confirmButtonText: options?.confirmButtonText || '确定',
|
|
378
364
|
};
|
|
379
365
|
this.closeMessage();
|
|
380
|
-
await ElMessageBox.alert(message,
|
|
366
|
+
await ElMessageBox.alert(message, msgOptions);
|
|
381
367
|
this.handleZIndex('.el-message-box__wrapper:last');
|
|
382
|
-
this.eventBus.emit('tnx.error', Object.assign({},
|
|
368
|
+
this.eventBus.emit('tnx.error', Object.assign({}, msgOptions, {message}));
|
|
383
369
|
}
|
|
384
370
|
|
|
385
|
-
confirm(message: string, title
|
|
386
|
-
let
|
|
387
|
-
title: title,
|
|
371
|
+
confirm(message: string, options?: { title?: string, confirmButtonText?: string, cancelButtonText?: string }) {
|
|
372
|
+
let msgOptions: ElMessageBoxOptions = {
|
|
373
|
+
title: options?.title || '确认',
|
|
388
374
|
type: 'info',
|
|
389
375
|
icon: Vue.markRaw(Icon.components.QuestionFilled),
|
|
390
|
-
confirmButtonText: '确定',
|
|
391
|
-
cancelButtonText: '取消',
|
|
376
|
+
confirmButtonText: options?.confirmButtonText || '确定',
|
|
377
|
+
cancelButtonText: options?.cancelButtonText || '取消',
|
|
392
378
|
dangerouslyUseHTMLString: true,
|
|
393
379
|
distinguishCancelAndClose: true,
|
|
394
380
|
};
|
|
@@ -401,13 +387,13 @@ export default class TnxEl extends TnxVue {
|
|
|
401
387
|
|
|
402
388
|
this.closeMessage();
|
|
403
389
|
return new Promise<boolean>(resolve => {
|
|
404
|
-
ElMessageBox.confirm(message,
|
|
390
|
+
ElMessageBox.confirm(message, msgOptions).then(() => {
|
|
405
391
|
resolve(true);
|
|
406
392
|
}).catch(() => {
|
|
407
393
|
resolve(false);
|
|
408
394
|
});
|
|
409
395
|
this.handleZIndex('.el-message-box__wrapper:last');
|
|
410
|
-
this.eventBus.emit('tnx.confirm', Object.assign({},
|
|
396
|
+
this.eventBus.emit('tnx.confirm', Object.assign({}, msgOptions, {message}));
|
|
411
397
|
})
|
|
412
398
|
}
|
|
413
399
|
|