@truenewx/tnxvue3 3.0.0-alpha.16 → 3.0.0-alpha.18

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.0-alpha.16",
3
+ "version": "3.0.0-alpha.18",
4
4
  "description": "互联网技术解决方案:Vue3扩展支持",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -20,7 +20,6 @@
20
20
  },
21
21
  "peerDependencies": {
22
22
  "element-plus": "~2.8.0",
23
- "tdesign-vue-next": "~1.9.0",
24
23
  "vue": "~3.4.0",
25
24
  "vue-router": "~4.4.0"
26
25
  },
@@ -258,7 +258,7 @@ export default {
258
258
  }
259
259
 
260
260
  .tnxel-dialog .tnxel-dialog-footer {
261
- padding: 1rem;
261
+ padding: 0 1rem 1rem 1rem;
262
262
  display: flex;
263
263
  justify-content: flex-end;
264
264
  }
@@ -13,8 +13,11 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
+ import TnxelIcon from '../icon/Icon.vue'
17
+
16
18
  export default {
17
19
  name: 'TnxelDropdownItem',
20
+ components: {TnxelIcon},
18
21
  props: {
19
22
  icon: String,
20
23
  iconSize: Number,
@@ -161,7 +161,7 @@ export default {
161
161
  fileList.push({
162
162
  name: meta.name,
163
163
  url: vm._getFullReadUrl(meta.thumbnailReadUrl || meta.readUrl),
164
- previewUrl: vm._getFullReadUrl(meta.readUrl),
164
+ previewUrl: vm.tnx.fss.getClientConfig().baseUrl + meta.downloadUrl,
165
165
  locationUrl: meta.locationUrl,
166
166
  });
167
167
  }
@@ -241,7 +241,7 @@ export default {
241
241
  file.downloadUrl = result.downloadUrl;
242
242
  // 构建Upload组件用到的文件字段
243
243
  file.url = result.readUrl;
244
- file.previewUrl = (process.env.VUE_APP_API_BASE_URL + result.downloadUrl) || result.readUrl;
244
+ file.previewUrl = this.tnx.fss.getClientConfig().baseUrl + result.downloadUrl;
245
245
 
246
246
  this.fileList = fileList;
247
247
  this.emitInput();
@@ -17,6 +17,7 @@
17
17
  <Close v-else-if="value === 'Close'"/>
18
18
  <CloseBold v-else-if="value === 'CloseBold'"/>
19
19
  <CopyDocument v-else-if="value === 'CopyDocument'"/>
20
+ <DArrowRight v-else-if="value === 'DArrowRight'"/>
20
21
  <Delete v-else-if="value === 'Delete'"/>
21
22
  <DeleteFilled v-else-if="value === 'DeleteFilled'"/>
22
23
  <Document v-else-if="value === 'Document'"/>
@@ -26,6 +27,7 @@
26
27
  <Folder v-else-if="value === 'Folder'"/>
27
28
  <HomeFilled v-else-if="value === 'HomeFilled'"/>
28
29
  <InfoFilled v-else-if="value === 'InfoFilled'"/>
30
+ <List v-else-if="value === 'List'"/>
29
31
  <MoreFilled v-else-if="value === 'MoreFilled'"/>
30
32
  <OfficeBuilding v-else-if="value === 'OfficeBuilding'"/>
31
33
  <Picture v-else-if="value === 'Picture'"/>
@@ -70,6 +72,7 @@ import {
70
72
  Close,
71
73
  CloseBold,
72
74
  CopyDocument,
75
+ DArrowRight,
73
76
  Delete,
74
77
  DeleteFilled,
75
78
  Document,
@@ -79,6 +82,7 @@ import {
79
82
  Folder,
80
83
  HomeFilled,
81
84
  InfoFilled,
85
+ List,
82
86
  Loading,
83
87
  MoreFilled,
84
88
  OfficeBuilding,
@@ -122,6 +126,7 @@ const components = {
122
126
  Close,
123
127
  CloseBold,
124
128
  CopyDocument,
129
+ DArrowRight,
125
130
  Delete,
126
131
  DeleteFilled,
127
132
  Document,
@@ -131,6 +136,7 @@ const components = {
131
136
  Folder,
132
137
  HomeFilled,
133
138
  InfoFilled,
139
+ List,
134
140
  MoreFilled,
135
141
  Loading,
136
142
  OfficeBuilding,
@@ -331,7 +331,7 @@ export default {
331
331
  } else { // 如果当前值找不到匹配的选项,则需要考虑是设置为空还是默认选项
332
332
  if (!this.empty) { // 如果不能为空,则默认选中第一个可用选项
333
333
  let firstItem = this.firstEnabledItem;
334
- if (firstItem[this.valueName]) {
334
+ if (firstItem && firstItem[this.valueName]) {
335
335
  return firstItem[this.valueName];
336
336
  }
337
337
  }
@@ -268,7 +268,7 @@
268
268
 
269
269
  .el-dropdown-menu__item .el-icon {
270
270
  text-align: center;
271
- margin-right: 0.25rem;
271
+ margin-right: 6px;
272
272
  }
273
273
 
274
274
  .el-dropdown-menu__item .el-icon:before {
@@ -650,21 +650,21 @@ el-card {
650
650
  padding: 0;
651
651
  }
652
652
 
653
- .el-message-box__header {
654
- padding: 1rem;
655
- border-bottom: 1px solid var(--el-border-color);
653
+ .el-message-box {
654
+ padding: 0;
656
655
  }
657
656
 
658
- .el-message-box {
659
- padding-bottom: 0;
657
+ .el-message-box__header {
658
+ padding: 12px 1rem;
659
+ border-bottom: 1px solid var(--el-border-color);
660
660
  }
661
661
 
662
662
  .el-message-box__title {
663
- font-size: 1rem;
663
+ font-size: 14px;
664
664
  }
665
665
 
666
666
  .el-message-box__headerbtn {
667
- margin-top: -3px;
667
+ margin-top: 4px;
668
668
  }
669
669
 
670
670
  .el-message-box__content {
@@ -811,7 +811,7 @@ el-card {
811
811
  left: 1rem;
812
812
  }
813
813
 
814
- .el-icon {
814
+ .el-icon:not(.el-message-box__status) {
815
815
  font-size: unset;
816
816
  }
817
817
 
@@ -836,6 +836,10 @@ i svg {
836
836
  border-radius: 0;
837
837
  }
838
838
 
839
+ .el-dialog {
840
+ --el-dialog-padding-primary: 0;
841
+ }
842
+
839
843
  .el-dialog__header {
840
844
  margin-right: 0;
841
845
  }
@@ -44,11 +44,11 @@ import Upload from './upload/Upload.vue';
44
44
 
45
45
  import './tnxel.css';
46
46
 
47
+ const $ = tnxbs.libs.$;
48
+
47
49
  export const build = tnxvue.build;
48
50
 
49
51
  export default build('tnxel', () => {
50
- const $ = tnxbs.libs.$;
51
-
52
52
  const components = Object.assign({}, tnxvue.components, {
53
53
  Avatar,
54
54
  Alert,
@@ -215,7 +215,13 @@ export default build('tnxel', () => {
215
215
  const util = this.util;
216
216
  setTimeout(function () {
217
217
  const topZIndex = util.dom.minTopZIndex(2);
218
- const element = $(selector);
218
+ if (selector.endsWith(':last')) {
219
+ selector = selector.substring(0, selector.length - ':last'.length);
220
+ }
221
+ let element = $(selector);
222
+ if (element.length > 0) {
223
+ element = $(element[element.length - 1]);
224
+ }
219
225
  const zIndex = Number(element.css('zIndex'));
220
226
  if (isNaN(zIndex) || topZIndex > zIndex) {
221
227
  element.css('zIndex', topZIndex);
@@ -291,9 +297,9 @@ export default build('tnxel', () => {
291
297
  options.callback = function (action) {
292
298
  let yes = undefined;
293
299
  if (action === 'confirm') {
294
- yes = options.reverse ? false : true;
300
+ yes = !options.reverse;
295
301
  } else if (action === 'cancel') {
296
- yes = options.reverse ? true : false;
302
+ yes = !!options.reverse;
297
303
  }
298
304
  callback(yes);
299
305
  }
@@ -385,12 +391,11 @@ export default build('tnxel', () => {
385
391
 
386
392
  tnxel.install = tnxel.util.function.around(tnxel.install, function (install, vm) {
387
393
  install.call(tnxel, vm);
388
- if (!tnxel.libs.ElementPlus) {
389
- vm.use(ElementPlus, {
390
- locale: ElementPlus_zh_CN,
391
- });
392
- tnxel.libs = Object.assign({}, tnxel.libs, {ElementPlus});
393
- }
394
+ // 始终安装ElementPlus,以避免对于不同Vue实例未安装的问题
395
+ vm.use(ElementPlus, {
396
+ locale: ElementPlus_zh_CN,
397
+ });
398
+ tnxel.libs = Object.assign({}, tnxel.libs, {ElementPlus});
394
399
  });
395
400
 
396
401
  tnxel.router.beforeLeave =
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 基于Vue的路由器构建函数
3
3
  */
4
- import { FunctionUtil, NetUtil } from '@truenewx/tnxcore/src/tnxcore-util';
4
+ import {FunctionUtil, NetUtil} from '@truenewx/tnxcore/src/tnxcore-util';
5
5
 
6
6
  function addRoute(routes, superiorPath, item, fnImportPage) {
7
7
  if (item && item.path) {
@@ -14,12 +14,15 @@ function addRoute(routes, superiorPath, item, fnImportPage) {
14
14
  cache: {}, // 路由级缓存
15
15
  isHistory() { // 通过setTimeout()方式调用才能确保获得正确结果
16
16
  return this.historyFrom !== undefined;
17
- }
18
- },
19
- component() {
20
- return fnImportPage(page);
17
+ },
21
18
  },
19
+ component: item.component,
22
20
  };
21
+ if (!route.component) {
22
+ route.component = () => {
23
+ return fnImportPage(page);
24
+ };
25
+ }
23
26
  // 如果直接定义route的redirect/alias字段,则item的redirect/alias为undefined时,route仍然有redirect/alias字段,只是其值为undefined,这将导致VueRouter报错
24
27
  if (item.redirect) {
25
28
  route.redirect = item.redirect;
@@ -48,7 +51,8 @@ function instantiatePath(path, params) {
48
51
  });
49
52
  }
50
53
  if (path.contains('/:')) { // 参数替换完之后,还有路径参数,则为无效路径,返回首页
51
- console.warn('路径中的参数无法获得参数值,请确保具有参数的路径所属菜单项的下级菜单路径包含相同的参数:' + path);
54
+ console.warn(
55
+ '路径中的参数无法获得参数值,请确保具有参数的路径所属菜单项的下级菜单路径包含相同的参数:' + path);
52
56
  return '/';
53
57
  }
54
58
  }
@@ -59,11 +63,11 @@ function getCurrentRoute(router) {
59
63
  return router.currentRoute._value;
60
64
  }
61
65
 
62
- export default function(VueRouter, menu, fnImportPage) {
66
+ export default function (VueRouter, menu, fnImportPage) {
63
67
  let items;
64
68
  if (Array.isArray(menu)) {
65
69
  items = [];
66
- menu.forEach(function(m) {
70
+ menu.forEach(function (m) {
67
71
  items = items.concat(m.items);
68
72
  });
69
73
  } else {
@@ -84,7 +88,7 @@ export default function(VueRouter, menu, fnImportPage) {
84
88
  // if (window.history && window.history.pushState) {
85
89
  // window.history.pushState(null, null, document.URL);
86
90
  // }
87
- window.addEventListener('popstate', function() {
91
+ window.addEventListener('popstate', function () {
88
92
  let $route = getCurrentRoute(router);
89
93
  if ($route) {
90
94
  $route.meta.historyFrom = router.history.state.forward;
@@ -93,7 +97,7 @@ export default function(VueRouter, menu, fnImportPage) {
93
97
 
94
98
  // 注册离开页面前事件处理支持
95
99
  router.$beforeLeaveHandlers = {};
96
- router.beforeLeave = function(handler) {
100
+ router.beforeLeave = function (handler) {
97
101
  if (typeof handler === 'function') {
98
102
  let $route = getCurrentRoute(router);
99
103
  let path = $route.path;
@@ -101,7 +105,7 @@ export default function(VueRouter, menu, fnImportPage) {
101
105
  }
102
106
  };
103
107
 
104
- router.beforeEach(function(to, from, next) {
108
+ router.beforeEach(function (to, from, next) {
105
109
  if (typeof window.tnx.router.beforeLeave === 'function') {
106
110
  window.tnx.router.beforeLeave(router, from);
107
111
  }
@@ -118,7 +122,7 @@ export default function(VueRouter, menu, fnImportPage) {
118
122
  }
119
123
  });
120
124
 
121
- router.afterEach(function(to, from) {
125
+ router.afterEach(function (to, from) {
122
126
  router.prev = from;
123
127
  // 前后hash相同,但全路径不同(意味着参数不同),则需要刷新页面,否则页面不会刷新
124
128
  if (to.href === from.href && to.fullPath !== from.fullPath) {
@@ -126,7 +130,7 @@ export default function(VueRouter, menu, fnImportPage) {
126
130
  }
127
131
  });
128
132
 
129
- router.back = FunctionUtil.around(router.back, function(back, path) {
133
+ router.back = FunctionUtil.around(router.back, function (back, path) {
130
134
  if (!router.prev || !router.prev.href) { // 没有href,说明当前页面为刷新后进入的第一个页面,无法简单返回
131
135
  let $route = getCurrentRoute(router);
132
136
  if (!path) { // 未指定默认返回路径,则返回上一级页面
@@ -141,21 +145,21 @@ export default function(VueRouter, menu, fnImportPage) {
141
145
  back.call(router);
142
146
  });
143
147
 
144
- router.pushState = function(path) {
148
+ router.pushState = function (path) {
145
149
  let success = NetUtil.pushState('#' + path);
146
150
  if (!success) {
147
151
  this.push(path);
148
152
  }
149
153
  return success;
150
- }
154
+ };
151
155
 
152
- router.replaceState = function(path) {
156
+ router.replaceState = function (path) {
153
157
  let success = NetUtil.replaceState('#' + path);
154
158
  if (!success) {
155
159
  this.replace(path);
156
160
  }
157
161
  return success;
158
- }
162
+ };
159
163
 
160
164
  return router;
161
165
  }
package/src/tnxvue.js CHANGED
@@ -111,18 +111,18 @@ export default build('tnxvue', () => {
111
111
  return [];
112
112
  } else if (type === 'confirm') {
113
113
  return [{
114
- text: '取消',
114
+ text: '确定',
115
+ type: theme || 'primary',
115
116
  click(close) {
116
117
  if (typeof callback === 'function') {
117
- return callback.call(this, false, close);
118
+ return callback.call(this, true, close);
118
119
  }
119
120
  }
120
121
  }, {
121
- text: '确定',
122
- type: theme || 'primary',
122
+ text: '取消',
123
123
  click(close) {
124
124
  if (typeof callback === 'function') {
125
- return callback.call(this, true, close);
125
+ return callback.call(this, false, close);
126
126
  }
127
127
  }
128
128
  }];
@@ -154,10 +154,12 @@ export default build('tnxvue', () => {
154
154
  });
155
155
 
156
156
  tnxvue.app.isProduction = function () {
157
- if (process && process.env && process.env.NODE_ENV !== 'production') {
158
- return false;
157
+ try {
158
+ return !(process && process.env && process.env.NODE_ENV !== 'production');
159
+ } catch (e) {
160
+ // process未定义时会出错,此时为生产模式
161
+ return true;
159
162
  }
160
- return true;
161
163
  };
162
164
 
163
165
  tnxvue.app.toDevUrl = function (url, portIndex, replacement) {
@@ -1,4 +0,0 @@
1
- /**
2
- * tnxtd.css
3
- * 对Tencent TDesign样式的调整
4
- */
@@ -1,22 +0,0 @@
1
- /**
2
- * 对Tencent TDesign Vue3组件库的扩展支持
3
- */
4
- import TDesign from 'tdesign-vue-next';
5
- import tnxvue from '../tnxvue.js';
6
-
7
- import 'tdesign-vue-next/es/style/index.css';
8
- import './tnxtd.css';
9
-
10
- export const build = tnxvue.build;
11
-
12
- export default build('tnxtd', () => {
13
- const tnxtd = Object.assign({}, tnxvue, {});
14
- tnxtd.install = tnxtd.util.function.around(tnxtd.install, function (install, vm) {
15
- install.call(tnxtd, vm);
16
- if (!tnxtd.libs.TDesign) {
17
- vm.use(TDesign);
18
- tnxtd.libs = Object.assign({}, tnxtd.libs, {TDesign});
19
- }
20
- });
21
- return tnxtd;
22
- });