@truenewx/tnxvue3 3.4.0 → 3.4.1
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/eslint.config.cjs +58 -0
- package/index.html +12 -12
- package/package.json +16 -40
- package/src/aj-captcha/Verify/VerifySlide.vue +9 -9
- package/src/aj-captcha/api/index.js +2 -10
- package/src/aj-captcha/utils/ase.js +1 -1
- package/src/bootstrap-vue/alert/Alert.vue +79 -79
- package/src/bootstrap-vue/button/Button.vue +40 -40
- package/src/bootstrap-vue/enum-select/EnumSelect.vue +4 -5
- package/src/bootstrap-vue/form/Form.vue +320 -320
- package/src/bootstrap-vue/form/FormGroup.vue +73 -73
- package/src/bootstrap-vue/loading-icon/LoadingIcon.vue +46 -46
- package/src/bootstrap-vue/paged/Paged.vue +119 -119
- package/src/bootstrap-vue/progress/Progress.vue +58 -58
- package/src/bootstrap-vue/query-table/QueryTable.vue +84 -84
- package/src/bootstrap-vue/region-cascader/RegionCascader.vue +119 -119
- package/src/bootstrap-vue/select/Select.vue +375 -375
- package/src/bootstrap-vue/submit-form/SubmitForm.vue +180 -176
- package/src/bootstrap-vue/tags-input/TagsInput.vue +64 -64
- package/src/bootstrap-vue/tnxbsv.css +107 -107
- package/src/bootstrap-vue/tnxbsv.js +109 -92
- package/src/bootstrap-vue/upload/Upload.vue +173 -173
- package/src/element-plus/avatar/Avatar.vue +8 -9
- package/src/element-plus/button/Button.vue +2 -2
- package/src/element-plus/curd/Curd.vue +20 -23
- package/src/element-plus/date-picker/DatePicker.vue +1 -1
- package/src/element-plus/detail-form/DetailForm.vue +1 -1
- package/src/element-plus/dialog/Dialog.vue +18 -20
- package/src/element-plus/drawer/Drawer.vue +10 -9
- package/src/element-plus/edit-table/EditTable.vue +3 -3
- package/src/element-plus/enum-select/EnumSelect.vue +3 -3
- package/src/element-plus/enum-view/EnumView.vue +41 -41
- package/src/element-plus/fetch-cascader/FetchCascader.vue +3 -4
- package/src/element-plus/fetch-select/FetchSelect.vue +10 -11
- package/src/element-plus/fetch-tags/FetchTags.vue +4 -5
- package/src/element-plus/fss-upload/FssUpload.vue +18 -18
- package/src/element-plus/fss-view/FssView.vue +1 -1
- package/src/element-plus/icon/Icon.vue +6 -0
- package/src/element-plus/input-dropdown/InputDropdown.vue +74 -74
- package/src/element-plus/query-form/QueryForm.vue +1 -1
- package/src/element-plus/query-table/QueryTable.vue +22 -26
- package/src/element-plus/region-cascader/RegionCascader.vue +4 -5
- package/src/element-plus/select/Select.vue +2 -2
- package/src/element-plus/steps-nav/StepsNav.vue +3 -4
- package/src/element-plus/submit-form/SubmitForm.vue +36 -39
- package/src/element-plus/tabs/Tabs.vue +1 -1
- package/src/element-plus/tnxel.css +22 -0
- package/src/element-plus/tnxel.js +101 -93
- package/src/element-plus/toolbar/ToolBarItem.js +15 -15
- package/src/element-plus/toolbar/Toolbar.vue +56 -56
- package/src/element-plus/transfer/Transfer.vue +8 -9
- package/src/element-plus/upload/Upload.vue +24 -24
- package/src/tnxvue-router.js +4 -4
- package/src/tnxvue-validator.js +8 -2
- package/src/tnxvue.js +13 -26
|
@@ -293,7 +293,7 @@ export default {
|
|
|
293
293
|
this.files = [].concat(this.fileList);
|
|
294
294
|
let vm = this;
|
|
295
295
|
// 需在vue渲染之后才可正常操作dom元素
|
|
296
|
-
this.$nextTick(
|
|
296
|
+
this.$nextTick(() => {
|
|
297
297
|
// 初始化显示尺寸
|
|
298
298
|
let width = vm.uploadSize.width;
|
|
299
299
|
if (width) {
|
|
@@ -360,7 +360,7 @@ export default {
|
|
|
360
360
|
}
|
|
361
361
|
// 校验文件重复
|
|
362
362
|
const vm = this;
|
|
363
|
-
if (this.files.contains(
|
|
363
|
+
if (this.files.contains((f) => {
|
|
364
364
|
const raw = f.raw ? f.raw : f;
|
|
365
365
|
return file.uid !== raw.uid && vm.getFileId(file) === vm.getFileId(raw);
|
|
366
366
|
})) {
|
|
@@ -430,7 +430,7 @@ export default {
|
|
|
430
430
|
|
|
431
431
|
const vm = this;
|
|
432
432
|
const rpc = this.tnx.app.rpc;
|
|
433
|
-
return new Promise(
|
|
433
|
+
return new Promise((resolve, reject) => {
|
|
434
434
|
if (vm.validate(file)) {
|
|
435
435
|
let $upload = $('#' + vm.id + ' .el-upload');
|
|
436
436
|
if (vm.showFileList && vm.fileNumExceed) {
|
|
@@ -438,29 +438,12 @@ export default {
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
// 上传前需确保用户在fss应用中已登录
|
|
441
|
-
rpc.ensureLogined(
|
|
442
|
-
if (vm.beforeUpload) {
|
|
443
|
-
let promise = vm.beforeUpload(file);
|
|
444
|
-
if (promise instanceof Promise) {
|
|
445
|
-
promise.then(function () {
|
|
446
|
-
resolve(file);
|
|
447
|
-
}).catch(function () {
|
|
448
|
-
reject(file);
|
|
449
|
-
});
|
|
450
|
-
} else if (promise === false) {
|
|
451
|
-
reject(file);
|
|
452
|
-
} else {
|
|
453
|
-
resolve(file);
|
|
454
|
-
}
|
|
455
|
-
} else {
|
|
456
|
-
resolve(file);
|
|
457
|
-
}
|
|
458
|
-
}, {
|
|
441
|
+
rpc.ensureLogined({
|
|
459
442
|
app: vm.app,
|
|
460
443
|
toLogin(loginFormUrl, originalUrl, originalMethod) {
|
|
461
444
|
$upload.css('visibility', 'unset');
|
|
462
445
|
// 从当前应用登录表单地址
|
|
463
|
-
rpc.get('/authentication/login-url'
|
|
446
|
+
rpc.get('/authentication/login-url').then(loginUrl => {
|
|
464
447
|
if (loginUrl) {
|
|
465
448
|
// 默认登录后跳转回当前页面
|
|
466
449
|
loginUrl += loginUrl.contains('?') ? '&' : '?';
|
|
@@ -473,6 +456,23 @@ export default {
|
|
|
473
456
|
});
|
|
474
457
|
return true;
|
|
475
458
|
}
|
|
459
|
+
}).then(() => {
|
|
460
|
+
if (vm.beforeUpload) {
|
|
461
|
+
let promise = vm.beforeUpload(file);
|
|
462
|
+
if (promise instanceof Promise) {
|
|
463
|
+
promise.then(() => {
|
|
464
|
+
resolve(file);
|
|
465
|
+
}).catch(() => {
|
|
466
|
+
reject(file);
|
|
467
|
+
});
|
|
468
|
+
} else if (promise === false) {
|
|
469
|
+
reject(file);
|
|
470
|
+
} else {
|
|
471
|
+
resolve(file);
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
resolve(file);
|
|
475
|
+
}
|
|
476
476
|
});
|
|
477
477
|
} else {
|
|
478
478
|
reject(file);
|
|
@@ -557,14 +557,14 @@ export default {
|
|
|
557
557
|
}
|
|
558
558
|
},
|
|
559
559
|
removeFile(file) {
|
|
560
|
-
this.files.remove(
|
|
560
|
+
this.files.remove((f) => {
|
|
561
561
|
return file.uid === f.uid;
|
|
562
562
|
});
|
|
563
563
|
this.$refs.upload.handleRemove(file);
|
|
564
564
|
if (!this.fileNumExceed) {
|
|
565
565
|
this.handleErrors([]); // 移除一个文件后,此时如果有错误提示则一定为数量超限,需清空错误提示
|
|
566
566
|
let container = $('#' + this.id);
|
|
567
|
-
this.$nextTick(
|
|
567
|
+
this.$nextTick(() => {
|
|
568
568
|
// 去掉文件列表的样式,以免其占高度
|
|
569
569
|
$('.el-upload-list', container).removeAttr('style');
|
|
570
570
|
// 恢复添加框默认样式
|
package/src/tnxvue-router.js
CHANGED
|
@@ -69,7 +69,7 @@ export default function (VueRouter, menu, fnImportPage) {
|
|
|
69
69
|
let items;
|
|
70
70
|
if (Array.isArray(menu)) {
|
|
71
71
|
items = [];
|
|
72
|
-
menu.forEach(
|
|
72
|
+
menu.forEach((m) => {
|
|
73
73
|
if (Array.isArray(m.items)) {
|
|
74
74
|
items = items.concat(m.items);
|
|
75
75
|
} else { // menu实际上是items
|
|
@@ -94,7 +94,7 @@ export default function (VueRouter, menu, fnImportPage) {
|
|
|
94
94
|
// if (window.history && window.history.pushState) {
|
|
95
95
|
// window.history.pushState(null, null, document.URL);
|
|
96
96
|
// }
|
|
97
|
-
window.addEventListener('popstate',
|
|
97
|
+
window.addEventListener('popstate', () => {
|
|
98
98
|
let $route = getCurrentRoute(router);
|
|
99
99
|
if ($route) {
|
|
100
100
|
$route.meta.historyFrom = router.history.state.forward;
|
|
@@ -111,7 +111,7 @@ export default function (VueRouter, menu, fnImportPage) {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
router.beforeEach(
|
|
114
|
+
router.beforeEach((to, from, next) => {
|
|
115
115
|
if (typeof window.tnx.router.beforeLeave === 'function') {
|
|
116
116
|
window.tnx.router.beforeLeave(router, from);
|
|
117
117
|
}
|
|
@@ -128,7 +128,7 @@ export default function (VueRouter, menu, fnImportPage) {
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
router.afterEach(
|
|
131
|
+
router.afterEach((to, from) => {
|
|
132
132
|
router.prev = from;
|
|
133
133
|
// 前后路径相同,但全路径不同(意味着参数不同),则需要刷新页面,否则页面不会刷新
|
|
134
134
|
if (to.path === from.path && to.fullPath !== from.fullPath) {
|
package/src/tnxvue-validator.js
CHANGED
|
@@ -359,7 +359,13 @@ export default {
|
|
|
359
359
|
validateRegExp: validator.validateRegExp,
|
|
360
360
|
getRule,
|
|
361
361
|
getRules,
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
/**
|
|
363
|
+
* 校验字段
|
|
364
|
+
* @param rules 包含所有字段校验规则的对象,格式:{字段名: [规则数组]}
|
|
365
|
+
* @param model 待校验的模型对象,包含待校验的字段
|
|
366
|
+
* @returns {Promise} then({errors,fields}=>{})
|
|
367
|
+
*/
|
|
368
|
+
validate: function (rules, model) {
|
|
369
|
+
return new AsyncValidator(rules).validate(model);
|
|
364
370
|
},
|
|
365
371
|
}
|
package/src/tnxvue.js
CHANGED
|
@@ -159,8 +159,8 @@ export default build('tnxvue', () => {
|
|
|
159
159
|
}
|
|
160
160
|
return this.dialog(component, title, buttons, options, props);
|
|
161
161
|
},
|
|
162
|
-
getDefaultDialogButtons(type,
|
|
163
|
-
if (
|
|
162
|
+
getDefaultDialogButtons(type, click, theme) {
|
|
163
|
+
if (click !== false) {
|
|
164
164
|
if (type === 'none') {
|
|
165
165
|
return [];
|
|
166
166
|
} else if (type === 'confirm') {
|
|
@@ -168,15 +168,15 @@ export default build('tnxvue', () => {
|
|
|
168
168
|
text: '确定',
|
|
169
169
|
type: theme || 'primary',
|
|
170
170
|
click(close) {
|
|
171
|
-
if (typeof
|
|
172
|
-
return
|
|
171
|
+
if (typeof click === 'function') {
|
|
172
|
+
return click.call(this, true, close);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
}, {
|
|
176
176
|
text: '取消',
|
|
177
177
|
click(close) {
|
|
178
|
-
if (typeof
|
|
179
|
-
return
|
|
178
|
+
if (typeof click === 'function') {
|
|
179
|
+
return click.call(this, false, close);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
}];
|
|
@@ -185,8 +185,8 @@ export default build('tnxvue', () => {
|
|
|
185
185
|
text: '关闭',
|
|
186
186
|
type: theme,
|
|
187
187
|
click(close) {
|
|
188
|
-
if (typeof
|
|
189
|
-
return
|
|
188
|
+
if (typeof click === 'function') {
|
|
189
|
+
return click.call(this, close);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
}];
|
|
@@ -195,8 +195,8 @@ export default build('tnxvue', () => {
|
|
|
195
195
|
text: '确定',
|
|
196
196
|
type: theme || 'primary',
|
|
197
197
|
click(close) {
|
|
198
|
-
if (typeof
|
|
199
|
-
return
|
|
198
|
+
if (typeof click === 'function') {
|
|
199
|
+
return click.call(this, close);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}];
|
|
@@ -256,7 +256,7 @@ export default build('tnxvue', () => {
|
|
|
256
256
|
tnxvue.app.validator = validator;
|
|
257
257
|
tnxvue.app.rpc.getMeta =
|
|
258
258
|
tnxvue.util.function.around(tnxvue.app.rpc.getMeta, function (getMeta, url, callback, app) {
|
|
259
|
-
getMeta.call(tnxvue.app.rpc, url, function (meta) {
|
|
259
|
+
return getMeta.call(tnxvue.app.rpc, url, function (meta) {
|
|
260
260
|
if (meta) { // meta已被缓存,所以直接修改其内容,以便同步缓存
|
|
261
261
|
meta.$rules = validator.getRules(meta);
|
|
262
262
|
if (typeof callback === 'function') {
|
|
@@ -266,19 +266,6 @@ export default build('tnxvue', () => {
|
|
|
266
266
|
}, app);
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
-
tnxvue.app.page.init = tnxvue.util.function.around(tnxvue.app.page.init, function (init, page, container) {
|
|
270
|
-
if (container.tagName === 'BODY') { // vue不推荐以body为挂载目标,故从body下获取第一个div作为容器
|
|
271
|
-
for (let i = 0; i < container.children.length; i++) {
|
|
272
|
-
const child = container.children[i];
|
|
273
|
-
if (child.tagName === 'DIV') {
|
|
274
|
-
container = child;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
init.call(this, page, container);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
269
|
Object.assign(tnxvue.app.page, {
|
|
283
270
|
// TODO 路由缓存迁移至tnxvue-router.js中
|
|
284
271
|
startCache: function (router, model, intervalMillis, ignoredFields) {
|
|
@@ -289,7 +276,7 @@ export default build('tnxvue', () => {
|
|
|
289
276
|
|
|
290
277
|
if (path) {
|
|
291
278
|
let _this = this;
|
|
292
|
-
let intervalId = setInterval(
|
|
279
|
+
let intervalId = setInterval(() => {
|
|
293
280
|
_this._storeCache(router, path, intervalId, model, ignoredFields);
|
|
294
281
|
}, intervalMillis);
|
|
295
282
|
}
|
|
@@ -350,8 +337,8 @@ export default build('tnxvue', () => {
|
|
|
350
337
|
},
|
|
351
338
|
/**
|
|
352
339
|
* 前端页面模型转换为后端命令模型,检查文件上传是否完成,去掉后端不需要的多余字段,转换多层嵌入字段数据使其符合服务端命令模型的基本要求
|
|
340
|
+
* @param vm vue实例
|
|
353
341
|
* @param model 前端页面模型
|
|
354
|
-
* @param refs 页面中的组件引用集
|
|
355
342
|
* @param validFieldNames 有效的字段名称集,如有指定则清除模型中的无效字段
|
|
356
343
|
*/
|
|
357
344
|
toCommandModel: function (vm, model, validFieldNames) {
|