@truenewx/tnxvue3 2.6.2 → 2.6.4

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": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "description": "互联网技术解决方案:Vue3扩展支持",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * 基于ElementPlus的扩展支持
4
4
  */
5
- import ElementPlus, {ElLoading, ElMessage, ElMessageBox} from 'element-plus';
5
+ import ElementPlus, { ElLoading, ElMessage, ElMessageBox } from 'element-plus';
6
6
  import ElementPlus_zh_CN from 'element-plus/es/locale/lang/zh-cn';
7
7
  import tnxbs from '@truenewx/tnxcore/src/tnxbs'; // 二次封装组件中使用了Bootstrap的基础样式
8
8
  import tnxvue from '../tnxvue.js';
@@ -87,7 +87,6 @@ const dialogContainerClass = 'tnxel-dialog-container';
87
87
  const drawerContainerClass = 'tnxel-drawer-container';
88
88
 
89
89
  const tnxel = Object.assign({}, tnxbs, tnxvue, {
90
- libs: Object.assign({}, tnxbs.libs, tnxvue.libs, {ElementPlus}),
91
90
  components,
92
91
  _dialogs: [], // 对话框堆栈
93
92
  dialog(content, title, buttons, options, contentProps) {
@@ -119,7 +118,7 @@ const tnxel = Object.assign({}, tnxbs, tnxvue, {
119
118
  theme: options.theme,
120
119
  }).mount(containerSelector);
121
120
  dialogVm.options = Object.assign(dialogVm.options || {}, options);
122
- dialogVm.options.onClosed = this.util.function.around(dialogVm.options.onClosed, function (onClosed) {
121
+ dialogVm.options.onClosed = this.util.function.around(dialogVm.options.onClosed, function(onClosed) {
123
122
  let $container = $(containerSelector);
124
123
  $container.next('.el-overlay').remove();
125
124
  $container.remove();
@@ -176,7 +175,7 @@ const tnxel = Object.assign({}, tnxbs, tnxvue, {
176
175
  }).mount(containerSelector);
177
176
  drawerVm.id = drawerId;
178
177
  drawerVm.options = Object.assign(drawerVm.options || {}, options);
179
- drawerVm.options.onClosed = this.util.function.around(drawerVm.options.onClosed, function (onClosed) {
178
+ drawerVm.options.onClosed = this.util.function.around(drawerVm.options.onClosed, function(onClosed) {
180
179
  let $container = $(containerSelector);
181
180
  $container.next('.el-overlay').remove();
182
181
  $container.remove();
@@ -210,7 +209,7 @@ const tnxel = Object.assign({}, tnxbs, tnxvue, {
210
209
  },
211
210
  _handleZIndex(selector) {
212
211
  const util = this.util;
213
- setTimeout(function () {
212
+ setTimeout(function() {
214
213
  const topZIndex = util.dom.minTopZIndex(2);
215
214
  const element = $(selector);
216
215
  const zIndex = Number(element.css('zIndex'));
@@ -282,7 +281,7 @@ const tnxel = Object.assign({}, tnxbs, tnxvue, {
282
281
  options.cancelButtonText = buttonText;
283
282
  }
284
283
  if (typeof callback === 'function') {
285
- options.callback = function (action) {
284
+ options.callback = function(action) {
286
285
  let yes = undefined;
287
286
  if (action === 'confirm') {
288
287
  yes = options.reverse ? false : true;
@@ -374,14 +373,19 @@ const tnxel = Object.assign({}, tnxbs, tnxvue, {
374
373
  }
375
374
  });
376
375
 
377
- tnxel.install = tnxel.util.function.around(tnxel.install, function (install, vm) {
378
- vm.use(ElementPlus, {
376
+ tnxel.install = tnxel.util.function.around(tnxel.install, function(install, vm) {
377
+ install.call(window.tnx, vm);
378
+ let ElementComponent = ElementPlus;
379
+ if (window.tnx.libs && window.tnx.libs.ElementPlus) {
380
+ ElementComponent = window.tnx.libs.ElementPlus;
381
+ }
382
+ vm.use(ElementComponent, {
379
383
  locale: ElementPlus_zh_CN,
380
384
  });
381
- install.call(window.tnx, vm);
385
+ window.tnx.libs = Object.assign({}, window.tnx.libs, {ElementPlus: ElementComponent});
382
386
  });
383
387
 
384
- tnxel.router.beforeLeave = tnxel.util.function.around(tnxel.router.beforeLeave, function (beforeLeave, router, from) {
388
+ tnxel.router.beforeLeave = tnxel.util.function.around(tnxel.router.beforeLeave, function(beforeLeave, router, from) {
385
389
  // 页面跳转前关闭当前页面中可能存在的所有消息框和对话框
386
390
  window.tnx._closeMessage();
387
391
  window.tnx.closeDialog(true);
@@ -389,19 +393,19 @@ tnxel.router.beforeLeave = tnxel.util.function.around(tnxel.router.beforeLeave,
389
393
  });
390
394
 
391
395
  tnxel.date = {
392
- formatDateTime: function (row, column, cellValue) {
396
+ formatDateTime: function(row, column, cellValue) {
393
397
  if (cellValue) {
394
398
  return new Date(cellValue).formatDateTime();
395
399
  }
396
400
  return undefined;
397
401
  },
398
- formatDate: function (row, column, cellValue) {
402
+ formatDate: function(row, column, cellValue) {
399
403
  if (cellValue) {
400
404
  return new Date(cellValue).formatDate();
401
405
  }
402
406
  return undefined;
403
407
  },
404
- formatTime: function (row, column, cellValue) {
408
+ formatTime: function(row, column, cellValue) {
405
409
  if (typeof cellValue === 'number') {
406
410
  cellValue = new Date(cellValue);
407
411
  }
@@ -413,7 +417,7 @@ tnxel.date = {
413
417
  }
414
418
  return undefined;
415
419
  },
416
- formatTimeMinute: function (row, column, cellValue) {
420
+ formatTimeMinute: function(row, column, cellValue) {
417
421
  if (typeof cellValue === 'number') {
418
422
  cellValue = new Date(cellValue);
419
423
  }
@@ -428,19 +432,19 @@ tnxel.date = {
428
432
  }
429
433
  return undefined;
430
434
  },
431
- formatDateMinute: function (row, column, cellValue) {
435
+ formatDateMinute: function(row, column, cellValue) {
432
436
  if (cellValue) {
433
437
  return new Date(cellValue).formatDateMinute();
434
438
  }
435
439
  return undefined;
436
440
  },
437
- formatDateMonth: function (row, column, cellValue) {
441
+ formatDateMonth: function(row, column, cellValue) {
438
442
  if (cellValue) {
439
443
  return new Date(cellValue).formatDateMonth();
440
444
  }
441
445
  return undefined;
442
446
  },
443
- formatPermanentableDate: function (row, column, cellValue) {
447
+ formatPermanentableDate: function(row, column, cellValue) {
444
448
  if (Array.isArray(cellValue)) {
445
449
  cellValue = cellValue[column];
446
450
  }
@@ -457,7 +461,7 @@ tnxel.date = {
457
461
  };
458
462
 
459
463
  tnxel.number = {
460
- formatPercent: function (row, column, cellValue) {
464
+ formatPercent: function(row, column, cellValue) {
461
465
  if (typeof cellValue !== 'number') {
462
466
  cellValue = parseFloat(cellValue);
463
467
  }
@@ -489,13 +493,13 @@ tnxel.boolean = {
489
493
  text: '无',
490
494
  }]
491
495
  },
492
- format: function (row, column, cellValue) {
496
+ format: function(row, column, cellValue) {
493
497
  if (typeof cellValue === 'boolean') {
494
498
  cellValue = cellValue.toText();
495
499
  }
496
500
  return cellValue;
497
501
  },
498
- formatHas: function (row, column, cellValue) {
502
+ formatHas: function(row, column, cellValue) {
499
503
  if (typeof cellValue === 'boolean') {
500
504
  cellValue = tnxel.boolean.items.getText('has', cellValue);
501
505
  }
@@ -506,7 +510,7 @@ tnxel.boolean = {
506
510
  tnxel.table = {}
507
511
 
508
512
  const rpc = tnxel.app.rpc;
509
- rpc.handleErrors = tnxel.util.function.around(rpc.handleErrors, function (handleErrors, errors, options) {
513
+ rpc.handleErrors = tnxel.util.function.around(rpc.handleErrors, function(handleErrors, errors, options) {
510
514
  if (options && options.form) {
511
515
  let forms;
512
516
  if (Array.isArray(options.form)) {
package/src/tnxvue.js CHANGED
@@ -27,9 +27,6 @@ const components = {
27
27
  };
28
28
 
29
29
  const tnxvue = Object.assign({}, tnxcore, {
30
- libs: Object.assign({}, tnxcore.libs, {
31
- Vue: Vue
32
- }),
33
30
  components,
34
31
  router: {
35
32
  instance: null,
@@ -62,6 +59,7 @@ const tnxvue = Object.assign({}, tnxcore, {
62
59
  const component = this.components[key];
63
60
  vm.component(component.name, component);
64
61
  }
62
+ this.libs.Vue = Vue;
65
63
  },
66
64
  dialog(content, title, buttons, options, contentProps) {
67
65
  // 默认不实现,由UI框架扩展层实现