@truenewx/tnxvue3 3.0.17 → 3.4.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truenewx/tnxvue3",
3
- "version": "3.0.17",
3
+ "version": "3.4.0",
4
4
  "description": "互联网技术解决方案:Vue3扩展支持",
5
5
  "private": false,
6
6
  "type": "module",
@@ -18,22 +18,22 @@
18
18
  "preview": "vite preview"
19
19
  },
20
20
  "peerDependencies": {
21
- "element-plus": "~2.8.0",
22
- "bootstrap-vue-next": "~0.26.0",
21
+ "element-plus": "~2.9.0",
22
+ "bootstrap-vue-next": "~0.28.0",
23
23
  "vue": "~3.5.0",
24
- "vue-router": "~4.4.0"
24
+ "vue-router": "~4.5.0"
25
25
  },
26
26
  "dependencies": {
27
- "@truenewx/tnxcore": "3.0.15",
27
+ "@truenewx/tnxcore": "3.4.0",
28
28
  "@element-plus/icons-vue": "2.3.1",
29
29
  "async-validator": "4.2.5",
30
30
  "mitt": "3.0.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@vitejs/plugin-vue": "5.2.1",
34
- "vite": "6.2.0",
35
- "eslint": "7.32.0",
36
- "eslint-plugin-vue": "8.7.1"
33
+ "@vitejs/plugin-vue": "5.2.3",
34
+ "vite": "6.2.2",
35
+ "eslint": "9.22.0",
36
+ "eslint-plugin-vue": "9.33.0"
37
37
  },
38
38
  "eslintConfig": {
39
39
  "root": true,
@@ -81,7 +81,24 @@ export default build('tnxbsv', () => {
81
81
  document.body.removeChild(dialogContainer);
82
82
  });
83
83
  window.tnx.dialogInstances.push(dialog);
84
- return dialogVm;
84
+ return dialog;
85
+ },
86
+ closeDialog(all, callback) {
87
+ if (typeof all === 'function') {
88
+ callback = all;
89
+ all = false;
90
+ }
91
+ if (window.tnx.dialogInstances.length) {
92
+ let dialog = window.tnx.dialogInstances.pop();
93
+ while (dialog) {
94
+ dialog.close(callback);
95
+ if (all) {
96
+ dialog = window.tnx.dialogInstances.pop();
97
+ } else {
98
+ break;
99
+ }
100
+ }
101
+ }
85
102
  },
86
103
  _closeMessage() {
87
104
  this.hideLoading();
@@ -35,7 +35,10 @@
35
35
  <Histogram v-else-if="value === 'Histogram'"/>
36
36
  <HomeFilled v-else-if="value === 'HomeFilled'"/>
37
37
  <InfoFilled v-else-if="value === 'InfoFilled'"/>
38
+ <Key v-else-if="value === 'Key'"/>
38
39
  <List v-else-if="value === 'List'"/>
40
+ <Location v-else-if="value === 'Location'"/>
41
+ <LocationFilled v-else-if="value === 'LocationFilled'"/>
39
42
  <Management v-else-if="value === 'Management'"/>
40
43
  <Memo v-else-if="value === 'Memo'"/>
41
44
  <Minus v-else-if="value === 'Minus'"/>
@@ -108,7 +111,10 @@ import {
108
111
  Histogram,
109
112
  HomeFilled,
110
113
  InfoFilled,
114
+ Key,
111
115
  List,
116
+ Location,
117
+ LocationFilled,
112
118
  Loading,
113
119
  Management,
114
120
  Memo,
@@ -180,7 +186,10 @@ const components = {
180
186
  Histogram,
181
187
  HomeFilled,
182
188
  InfoFilled,
189
+ Key,
183
190
  List,
191
+ Location,
192
+ LocationFilled,
184
193
  Management,
185
194
  Memo,
186
195
  Minus,
@@ -98,12 +98,12 @@ export default build('tnxel', () => {
98
98
  const tnxel = Object.assign({}, tnxbs, tnxvue, {
99
99
  components,
100
100
  componentDefaultApp: undefined, // 组件的默认app,从服务端获取数据的组件以此为远程请求的默认app
101
- _dialogs: [], // 对话框堆栈
101
+ dialogInstances: [], // 对话框堆栈
102
102
  dialog(content, title, buttons, options, contentProps) {
103
103
  this._closeMessage();
104
104
 
105
105
  let componentOptions = {};
106
- if (this.util.isComponent(content)) {
106
+ if (window.tnx.util.isComponent(content)) {
107
107
  componentOptions.components = {
108
108
  'tnxel-dialog-content': content
109
109
  };
@@ -118,7 +118,7 @@ export default build('tnxel', () => {
118
118
  }
119
119
  const containerSelector = '.' + dialogContainerClass + '#' + dialogId;
120
120
  options = options || {};
121
- const dialogVm = window.tnx.createVueInstance(componentDefinition, null, {
121
+ let dialogVm = window.tnx.createVueInstance(componentDefinition, null, {
122
122
  modelValue: true,
123
123
  container: containerSelector,
124
124
  title: title,
@@ -126,37 +126,40 @@ export default build('tnxel', () => {
126
126
  contentProps: contentProps,
127
127
  buttons: buttons,
128
128
  theme: options.theme,
129
- }).mount(containerSelector);
130
- dialogVm.options = Object.assign(dialogVm.options || {}, options);
131
- dialogVm.options.onClosed = this.util.function.around(dialogVm.options.onClosed, function (onClosed) {
129
+ });
130
+ const dialog = dialogVm.mount(containerSelector);
131
+ dialog.options = Object.assign(dialog.options || {}, options);
132
+ dialog.options.onClosed = window.tnx.util.function.around(dialog.options.onClosed, function (onClosed) {
133
+ dialogVm.unmount();
134
+ window.tnx.dialogInstances.remove(dialog);
132
135
  let $container = $(containerSelector);
133
136
  $container.next('.el-overlay').remove();
134
137
  $container.remove();
135
138
  if (onClosed) {
136
- onClosed.call(dialogVm);
139
+ onClosed.call(dialog);
137
140
  }
138
141
  });
139
- this._dialogs.push(dialogVm);
140
- return dialogVm;
142
+ window.tnx.dialogInstances.push(dialog);
143
+ return dialog;
141
144
  },
142
145
  closeDialog(all, callback) {
143
146
  if (typeof all === 'function') {
144
147
  callback = all;
145
148
  all = false;
146
149
  }
147
- if (this._dialogs.length) {
148
- let dialog = this._dialogs.pop();
150
+ if (window.tnx.dialogInstances.length) {
151
+ let dialog = window.tnx.dialogInstances.pop();
149
152
  while (dialog) {
150
153
  dialog.close(callback);
151
154
  if (all) {
152
- dialog = this._dialogs.pop();
155
+ dialog = window.tnx.dialogInstances.pop();
153
156
  } else {
154
157
  break;
155
158
  }
156
159
  }
157
160
  }
158
161
  },
159
- _drawers: [], // 抽屉堆栈
162
+ drawerInstances: [], // 抽屉堆栈
160
163
  drawer(content, title, buttons, options, contentProps) {
161
164
  this._closeMessage();
162
165
 
@@ -176,37 +179,40 @@ export default build('tnxel', () => {
176
179
  }
177
180
  const containerSelector = '.' + drawerContainerClass + '#' + drawerId;
178
181
  options = options || {};
179
- const drawerVm = window.tnx.createVueInstance(componentDefinition, null, {
182
+ let drawerVm = window.tnx.createVueInstance(componentDefinition, null, {
180
183
  content: content,
181
184
  title: title,
182
185
  contentProps: contentProps,
183
186
  buttons: buttons,
184
187
  theme: options.theme,
185
- }).mount(containerSelector);
186
- drawerVm.id = drawerId;
187
- drawerVm.options = Object.assign(drawerVm.options || {}, options);
188
- drawerVm.options.onClosed = this.util.function.around(drawerVm.options.onClosed, function (onClosed) {
188
+ });
189
+ const drawer = drawerVm.mount(containerSelector);
190
+ drawer.id = drawerId;
191
+ drawer.options = Object.assign(drawer.options || {}, options);
192
+ drawer.options.onClosed = this.util.function.around(drawer.options.onClosed, function (onClosed) {
193
+ drawerVm.unmount();
194
+ window.tnx.drawerInstances.remove(drawer);
189
195
  let $container = $(containerSelector);
190
196
  $container.next('.el-overlay').remove();
191
197
  $container.remove();
192
198
  if (onClosed) {
193
- onClosed.call(drawerVm);
199
+ onClosed.call(drawer);
194
200
  }
195
201
  });
196
- this._drawers.push(drawerVm);
197
- return drawerVm;
202
+ window.tnx.drawerInstances.push(drawer);
203
+ return drawer;
198
204
  },
199
205
  closeDrawer(all, callback) {
200
206
  if (typeof all === 'function') {
201
207
  callback = all;
202
208
  all = false;
203
209
  }
204
- if (this._drawers.length) {
205
- let drawer = this._drawers.pop();
210
+ if (window.tnx.drawerInstances.length) {
211
+ let drawer = window.tnx.drawerInstances.pop();
206
212
  while (drawer) {
207
213
  drawer.close(callback);
208
214
  if (all) {
209
- drawer = this._drawers.pop();
215
+ drawer = window.tnx.drawerInstances.pop();
210
216
  } else {
211
217
  break;
212
218
  }
@@ -238,6 +244,7 @@ export default build('tnxel', () => {
238
244
  });
239
245
  },
240
246
  alert(message, title, callback, options) {
247
+ this.closeLoading();
241
248
  if (typeof title === 'function') {
242
249
  options = callback;
243
250
  callback = title;
@@ -249,11 +256,12 @@ export default build('tnxel', () => {
249
256
  confirmButtonText: '确定',
250
257
  }, options);
251
258
  this.closeLoading();
252
- ElMessageBox.alert(message, title, options).then(callback);
259
+ ElMessageBox.alert(message, title || '提示', options).then(callback);
253
260
  this._handleZIndex('.el-message-box__wrapper:last');
254
261
  this.app.eventBus.emit('tnx.alert', options);
255
262
  },
256
263
  success(message, callback, options) {
264
+ this.closeLoading();
257
265
  options = Object.assign({
258
266
  dangerouslyUseHTMLString: true,
259
267
  }, options, {
@@ -266,6 +274,7 @@ export default build('tnxel', () => {
266
274
  this.app.eventBus.emit('tnx.success', options);
267
275
  },
268
276
  error(message, callback, options) {
277
+ this.closeLoading();
269
278
  options = Object.assign({
270
279
  dangerouslyUseHTMLString: true,
271
280
  }, options, {
@@ -282,6 +291,7 @@ export default build('tnxel', () => {
282
291
  }
283
292
  },
284
293
  confirm(message, title, callback, options) {
294
+ this.closeLoading();
285
295
  if (typeof title === 'function') {
286
296
  options = callback;
287
297
  callback = title;
@@ -322,6 +332,7 @@ export default build('tnxel', () => {
322
332
  this.app.eventBus.emit('tnx.confirm', options);
323
333
  },
324
334
  toast(message, timeout, callback, options) {
335
+ this.closeLoading();
325
336
  if (typeof timeout === 'function') {
326
337
  options = callback;
327
338
  callback = timeout;
package/src/tnxvue.js CHANGED
@@ -2,8 +2,7 @@
2
2
  /**
3
3
  * 基于Vue 3的扩展支持
4
4
  */
5
- import tnxcore from '@truenewx/tnxcore';
6
- // import tnxcore from '../../core/src/tnxcore';
5
+ import tnxcore from '../../tnxcore/src/tnxcore';
7
6
  import validator from './tnxvue-validator';
8
7
  import createRouter from './tnxvue-router';
9
8
  import Text from './text/Text.vue';