@truenewx/tnxvue3 3.4.2 → 3.4.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.
Files changed (32) hide show
  1. package/package.json +14 -8
  2. package/src/element-plus/aj-captcha/api/index.js +2 -2
  3. package/src/element-plus/avatar/Avatar.vue +4 -27
  4. package/src/element-plus/date-picker/DatePicker.vue +8 -9
  5. package/src/element-plus/dialog/Dialog.vue +15 -15
  6. package/src/element-plus/drawer/Drawer.vue +2 -2
  7. package/src/element-plus/edit-table/EditTable.vue +10 -10
  8. package/src/element-plus/enum-select/EnumSelect.vue +30 -30
  9. package/src/element-plus/enum-view/EnumView.vue +1 -3
  10. package/src/element-plus/fetch-cascader/FetchCascader.vue +4 -4
  11. package/src/element-plus/fetch-select/FetchSelect.vue +3 -3
  12. package/src/element-plus/fetch-tags/FetchTags.vue +1 -1
  13. package/src/element-plus/fss-upload/FssUpload.vue +75 -114
  14. package/src/element-plus/fss-view/FssView.vue +28 -30
  15. package/src/element-plus/query-form/QueryForm.vue +3 -3
  16. package/src/element-plus/query-table/QueryTable.vue +12 -12
  17. package/src/element-plus/region-cascader/RegionCascader.vue +3 -3
  18. package/src/element-plus/select/Select.vue +56 -56
  19. package/src/element-plus/submit-form/SubmitForm.vue +5 -5
  20. package/src/element-plus/tnxel-validator.ts +347 -0
  21. package/src/element-plus/tnxel.ts +575 -0
  22. package/src/element-plus/transfer/Transfer.vue +2 -2
  23. package/src/element-plus/upload/Upload.vue +68 -70
  24. package/src/tdesign/desktop/tnxtdd.ts +5 -5
  25. package/src/tdesign/mobile/tnxtdm.css +0 -0
  26. package/src/tdesign/mobile/tnxtdm.ts +7 -6
  27. package/src/tdesign/{foundation/validator.ts → tnxtd-validator.ts} +4 -4
  28. package/src/tdesign/tnxtd.ts +6 -7
  29. package/src/tnxvue-router.ts +8 -14
  30. package/src/tnxvue.ts +53 -26
  31. package/tsconfig.json +32 -19
  32. package/src/element-plus/tnxel.js +0 -598
@@ -1,69 +1,69 @@
1
1
  <template>
2
- <el-upload ref="upload" name="file" class="tnxel-upload-container"
3
- :class="{center: center, 'hide-file-list': !showFileList}"
4
- :id="id"
5
- :action="actionUrl"
6
- :before-upload="_beforeUpload"
7
- :on-progress="_onProgress"
8
- :on-success="_onSuccess"
9
- :on-error="_onError"
10
- :with-credentials="true"
11
- :list-type="listType"
12
- :file-list="fileList"
13
- :show-file-list="true"
14
- :headers="uploadHeaders"
15
- :multiple="uploadOptions && uploadOptions.number !== 1"
16
- :accept="uploadAccept" :disabled="disabled" v-if="uploadOptions">
17
- <template #file="{file}">
18
- <div class="el-upload-list__panel" :data-file-id="getFileId(file)" :style="itemPanelStyle"
19
- v-if="showFileList">
20
- <img class="el-upload-list__item-thumbnail" :src="file.url" v-if="imageable">
21
- <div class="el-upload-list__item-name" v-else>
22
- <tnxel-icon :value="getFileIcon(file)"/>
23
- <span>{{ file.name }}</span>
24
- </div>
25
- <span class="el-upload-list__item-uploading" v-if="isUploading(file) && listType !== 'text'">
2
+ <el-upload ref="upload" name="file" class="tnxel-upload-container"
3
+ :class="{center: center, 'hide-file-list': !showFileList}"
4
+ :id="id"
5
+ :action="actionUrl"
6
+ :before-upload="_beforeUpload"
7
+ :on-progress="_onProgress"
8
+ :on-success="_onSuccess"
9
+ :on-error="_onError"
10
+ :with-credentials="true"
11
+ :list-type="listType"
12
+ :file-list="fileList"
13
+ :show-file-list="true"
14
+ :headers="uploadHeaders"
15
+ :multiple="uploadOptions && uploadOptions.number !== 1"
16
+ :accept="uploadAccept" :disabled="disabled" v-if="uploadOptions">
17
+ <template #file="{file}">
18
+ <div class="el-upload-list__panel" :data-file-id="getFileId(file)" :style="itemPanelStyle"
19
+ v-if="showFileList">
20
+ <img class="el-upload-list__item-thumbnail" :src="file.url" v-if="imageable">
21
+ <div class="el-upload-list__item-name" v-else>
22
+ <tnxel-icon :value="getFileIcon(file)"/>
23
+ <span>{{ file.name }}</span>
24
+ </div>
25
+ <span class="el-upload-list__item-uploading" v-if="isUploading(file) && listType !== 'text'">
26
26
  <tnxel-icon value="Loading"/>
27
27
  </span>
28
- <label class="el-upload-list__item-status-label">
29
- <el-progress type="circle" :percentage="file.percentage" :width="16" :stroke-width="3"
30
- :show-text="false" v-if="isUploading(file)"/>
31
- <tnxel-icon value="CircleCheck" class="text-success" v-else-if="listType === 'text'"/>
32
- <tnxel-icon value="Check" style="margin-top: 8px;" v-else/>
33
- </label>
34
- <div class="el-upload-list__item-actions">
35
- <tnxel-icon value="ZoomIn" @click="previewFile(file)" v-if="isPreviewable(file)"/>
36
- <tnxel-icon :value="listType === 'text' ? 'Close' : 'Delete'" @click="removeFile(file)"/>
37
- </div>
28
+ <label class="el-upload-list__item-status-label">
29
+ <el-progress type="circle" :percentage="file.percentage" :width="16" :stroke-width="3"
30
+ :show-text="false" v-if="isUploading(file)"/>
31
+ <tnxel-icon value="CircleCheck" class="text-success" v-else-if="listType === 'text'"/>
32
+ <tnxel-icon value="Check" style="margin-top: 8px;" v-else/>
33
+ </label>
34
+ <div class="el-upload-list__item-actions">
35
+ <tnxel-icon value="ZoomIn" @click="previewFile(file)" v-if="isPreviewable(file)"/>
36
+ <tnxel-icon :value="listType === 'text' ? 'Close' : 'Delete'" @click="removeFile(file)"/>
37
+ </div>
38
+ </div>
39
+ </template>
40
+ <template #trigger>
41
+ <el-tooltip :content="tipContent" placement="top" :disabled="tip !== 'tooltip'">
42
+ <div class="upload-trigger" :title="tip === 'title' ? tipContent : undefined"
43
+ :class="{'text-placeholder': disabled}" v-if="$slots.trigger">
44
+ <slot name="trigger"></slot>
45
+ </div>
46
+ <el-button class="upload-trigger" :title="tip === 'title' ? tipContent : undefined"
47
+ :disabled="disabled" v-else-if="listType === 'text'">
48
+ <tnxel-icon :value="triggerIcon" :size="uploadIconSize"/>
49
+ <div class="upload-trigger-text" v-if="triggerText">{{ triggerText }}</div>
50
+ </el-button>
51
+ <div class="upload-trigger" :title="tip === 'title' ? tipContent : undefined"
52
+ :class="{'text-placeholder': disabled}" v-else>
53
+ <tnxel-icon :value="triggerIcon" :size="uploadIconSize"/>
54
+ <div class="upload-trigger-text" v-if="triggerText">{{ triggerText }}</div>
55
+ </div>
56
+ </el-tooltip>
57
+ </template>
58
+ <template #tip v-if="(tipContent && (typeof tip !== 'string')) || errors.length">
59
+ <tnxel-alert type="error" class="w-fit-content my-0" v-if="errors.length">
60
+ <div v-for="error of errors" :key="error.code">
61
+ {{ error.message }}
38
62
  </div>
39
- </template>
40
- <template #trigger>
41
- <el-tooltip :content="tipContent" placement="top" :disabled="tip !== 'tooltip'">
42
- <div class="upload-trigger" :title="tip === 'title' ? tipContent : undefined"
43
- :class="{'text-placeholder': disabled}" v-if="$slots.trigger">
44
- <slot name="trigger"></slot>
45
- </div>
46
- <el-button class="upload-trigger" :title="tip === 'title' ? tipContent : undefined"
47
- :disabled="disabled" v-else-if="listType === 'text'">
48
- <tnxel-icon :value="triggerIcon" :size="uploadIconSize"/>
49
- <div class="upload-trigger-text" v-if="triggerText">{{ triggerText }}</div>
50
- </el-button>
51
- <div class="upload-trigger" :title="tip === 'title' ? tipContent : undefined"
52
- :class="{'text-placeholder': disabled}" v-else>
53
- <tnxel-icon :value="triggerIcon" :size="uploadIconSize"/>
54
- <div class="upload-trigger-text" v-if="triggerText">{{ triggerText }}</div>
55
- </div>
56
- </el-tooltip>
57
- </template>
58
- <template #tip v-if="(tipContent && (typeof tip !== 'string')) || errors.length">
59
- <tnxel-alert type="error" class="w-fit-content my-0" v-if="errors.length">
60
- <div v-for="error of errors" :key="error.code">
61
- {{ error.message }}
62
- </div>
63
- </tnxel-alert>
64
- <div class="el-upload__tip" v-text="tipContent" v-else></div>
65
- </template>
66
- </el-upload>
63
+ </tnxel-alert>
64
+ <div class="el-upload__tip" v-text="tipContent" v-else></div>
65
+ </template>
66
+ </el-upload>
67
67
  </template>
68
68
 
69
69
  <script>
@@ -171,7 +171,7 @@ export default {
171
171
  computed: {
172
172
  actionUrl() {
173
173
  if (this.app) {
174
- let baseUrl = this.tnx.app.rpc.getBaseUrl(this.app);
174
+ let baseUrl = this.tnx.api.getBaseUrl(this.app);
175
175
  if (baseUrl) {
176
176
  return baseUrl + this.action;
177
177
  }
@@ -233,7 +233,7 @@ export default {
233
233
  },
234
234
  uploadAccept() {
235
235
  if (this.uploadOptions && !this.uploadOptions.extensionsRejected && this.uploadOptions.extensions
236
- && this.uploadOptions.extensions.length) {
236
+ && this.uploadOptions.extensions.length) {
237
237
  let accept = '';
238
238
  for (let extension of this.uploadOptions.extensions) {
239
239
  accept += ',.' + extension;
@@ -342,7 +342,7 @@ export default {
342
342
  } else {
343
343
  // 没有URL的文件,通过文件类型+文件名+文件大小+最后修改时间,几乎可以唯一区分一个文件,重复的概率极低,即使重复也不破坏业务一致性和完整性
344
344
  file.id = this.tnx.util.string.md5(
345
- file.type + '-' + file.name + '-' + file.size + '-' + file.lastModified);
345
+ file.type + '-' + file.name + '-' + file.size + '-' + file.lastModified);
346
346
  }
347
347
  }
348
348
  return file.id;
@@ -382,7 +382,7 @@ export default {
382
382
  const capacity = this.tnx.util.string.getCapacityCaption(this.uploadOptions.capacity);
383
383
  let message = this.tipMessages.capacity.format(capacity, 2);
384
384
  message += ',文件"' + file.name + '"大小为' + this.tnx.util.string.getCapacityCaption(file.size, 2)
385
- + ',不符合要求,未加入上传队列';
385
+ + ',不符合要求,未加入上传队列';
386
386
  this.handleErrors([{
387
387
  code: 'error.upload.capacity',
388
388
  message: message,
@@ -429,7 +429,7 @@ export default {
429
429
  this.handleErrors([]); // 先清除可能存在的错误提示,以便于重新提示
430
430
 
431
431
  const vm = this;
432
- const rpc = this.tnx.app.rpc;
432
+ const rpc = this.tnx.api;
433
433
  return new Promise((resolve, reject) => {
434
434
  if (vm.validate(file)) {
435
435
  let $upload = $('#' + vm.id + ' .el-upload');
@@ -532,9 +532,7 @@ export default {
532
532
  if (this.onError) {
533
533
  this.onError(file, message.message);
534
534
  } else {
535
- this.tnx.app.rpc.handle500Error(message.message, {
536
- error: this.handleErrors
537
- });
535
+ window.tnx.error(message.message);
538
536
  }
539
537
  return;
540
538
  } else if (message.errors) {
@@ -1,12 +1,12 @@
1
- import { App, Component } from 'vue';
2
- import { Router } from 'vue-router';
3
- import TnxTd from '../tnxtd';
1
+ import {App, Component} from 'vue';
2
+ import {Router} from 'vue-router';
3
+ import TnxTd from '../tnxtd.ts';
4
4
  import TDesign from 'tdesign-vue-next';
5
5
 
6
6
  export default class TnxTdd extends TnxTd {
7
7
 
8
- constructor(apiBaseUrl: string) {
9
- super(apiBaseUrl);
8
+ constructor(apiBaseUrl: string, id: string = 'tnxtdd') {
9
+ super(apiBaseUrl, id);
10
10
  }
11
11
 
12
12
  createVueApp(rootComponent: Component, router: Router, rootProps?: Record<string, any>): App {
File without changes
@@ -1,15 +1,16 @@
1
- import { App, Component } from 'vue';
2
- import { Router } from 'vue-router';
3
- import TnxTd from '../tnxtd';
1
+ import {App, Component} from 'vue';
2
+ import {Router} from 'vue-router';
3
+ import TnxTd from '../tnxtd.ts';
4
4
  import TDesign from 'tdesign-mobile-vue';
5
+ import './tnxtdm.css';
5
6
 
6
7
  export default class TnxTdm extends TnxTd {
7
8
 
8
- constructor(apiBaseUrl: string) {
9
- super(apiBaseUrl);
9
+ constructor(apiBaseUrl: string, id: string = 'tnxtdm') {
10
+ super(apiBaseUrl, id);
10
11
  }
11
12
 
12
- createVueApp(rootComponent: Component, router: Router, rootProps?: Record<string, any>): App {
13
+ createVueApp(rootComponent: Component, router?: Router, rootProps?: Record<string, any>): App {
13
14
  return super.createVueApp(rootComponent, router, rootProps).use(TDesign);
14
15
  }
15
16
 
@@ -3,8 +3,8 @@
3
3
  * validator组件详见:https://github.com/validatorjs/validator.js
4
4
  */
5
5
  import validator from 'validator';
6
- import {Validator} from '../../../../tnxcore/src/tnxcore';
7
- import {ApiModelPropertyMeta, ApiModelMeta} from '../../../../tnxcore/src/api/meta';
6
+ import {Validator} from '../../../tnxcore/src/tnxcore.ts';
7
+ import {ApiModelPropertyMeta, ApiModelMeta} from '../../../tnxcore/src/api/meta.ts';
8
8
 
9
9
  export type ValidateResultType = 'error' | 'warning' | 'success';
10
10
 
@@ -25,7 +25,7 @@ export type ValidatorRule = {
25
25
 
26
26
  export default class TnxTdValidator extends Validator {
27
27
 
28
- getRule(validationName: string, validationValue: any, fieldMeta: ApiModelPropertyMeta): ValidatorRule | undefined {
28
+ getRule(validationName: string, validationValue: any, fieldMeta?: ApiModelPropertyMeta): ValidatorRule | undefined {
29
29
  let rule: ValidatorRule;
30
30
  let fieldCaption = '';
31
31
  // 据目前观察,字段格式校验的错误消息均显示在字段旁,无需显示字段名称,未来如果出现不在字段旁显示的场景,再考虑扩展
@@ -325,7 +325,7 @@ export default class TnxTdValidator extends Validator {
325
325
  fieldRules.push(rule);
326
326
  }
327
327
  });
328
- // 将可能包含的引用字段路径中的.替换为__,以符合async-validator规则名称的规范
328
+ // 将可能包含的引用字段路径中的.替换为__,以符合规则名称规范
329
329
  let ruleName = fieldName.replace('.', '__');
330
330
  rules[ruleName] = fieldRules;
331
331
  }
@@ -1,17 +1,16 @@
1
- import TnxVue from '../tnxvue';
1
+ import TnxVue from '../tnxvue.ts';
2
2
  import {Icon} from 'tdesign-icons-vue-next';
3
- import Validator from './foundation/validator';
3
+ import Validator from './tnxtd-validator.ts';
4
4
 
5
5
  export {Validator};
6
6
 
7
7
  export default class TnxTd extends TnxVue {
8
8
 
9
- static {
10
- TnxTd.Foundations.Validator = Validator;
11
- }
9
+ constructor(apiBaseUrl: string, id: string = 'tnxtd') {
10
+ super(apiBaseUrl, id);
11
+
12
+ this.foundations.Validator = Validator;
12
13
 
13
- constructor(apiBaseUrl: string) {
14
- super(apiBaseUrl);
15
14
  Object.assign(this.components, {
16
15
  Icon,
17
16
  });
@@ -12,18 +12,12 @@ import {
12
12
  RouteLocationNormalizedLoadedGeneric,
13
13
  NavigationGuardNext,
14
14
  } from 'vue-router';
15
- import NetUtil from '../../tnxcore/src/util/net';
15
+ import * as NetUtil from '../../tnxcore/src/util/net.ts';
16
16
 
17
- export type RouteItem = RouteRecordRaw & {
17
+ export type RouteItem = {
18
+ caption: string;
18
19
  path: string;
19
20
  icon?: string;
20
- meta?: {
21
- superiorPath?: string;
22
- page?: string;
23
- cache: Record<string, any>;
24
- historyFrom?: any;
25
- isHistory: () => boolean;
26
- };
27
21
  page?: string;
28
22
  component?: () => Promise<any>;
29
23
  redirect?: never;
@@ -31,10 +25,10 @@ export type RouteItem = RouteRecordRaw & {
31
25
  subs?: RouteItem[];
32
26
  }
33
27
 
34
- function addRoute(routes: RouteRecordRaw[], superiorPath: string, item: RouteItem, fnImportPage: (page: string) => Promise<any>): void {
28
+ function addRoute(routes: RouteRecordRaw[], superiorPath: string, item: RouteItem, fnImportPage?: (page: string) => Promise<any>): void {
35
29
  if (item && item.path) {
36
30
  let page = item.page || item.path.replace(/\/:[a-zA-Z0-9_]+/g, '');
37
- let route: RouteItem = {
31
+ let route: RouteRecordRaw = {
38
32
  path: item.path,
39
33
  meta: {
40
34
  superiorPath: superiorPath,
@@ -46,7 +40,7 @@ function addRoute(routes: RouteRecordRaw[], superiorPath: string, item: RouteIte
46
40
  },
47
41
  component: item.component,
48
42
  };
49
- if (!route.component) {
43
+ if (!route.component && fnImportPage) {
50
44
  route.component = () => {
51
45
  return fnImportPage(page);
52
46
  };
@@ -62,7 +56,7 @@ function addRoute(routes: RouteRecordRaw[], superiorPath: string, item: RouteIte
62
56
  }
63
57
  }
64
58
 
65
- function applyItemsToRoutes(superiorPath: string, items: RouteItem[], routes: RouteRecordRaw[], fnImportPage: (page: string) => Promise<any>): void {
59
+ function applyItemsToRoutes(superiorPath: string, items: RouteItem[], routes: RouteRecordRaw[], fnImportPage?: (page: string) => Promise<any>): void {
66
60
  if (items && items.length) {
67
61
  items.forEach(item => {
68
62
  if (item) {
@@ -103,7 +97,7 @@ export type VueRouter = Router & {
103
97
  backTo: (path?: string) => void;
104
98
  }
105
99
 
106
- export default function (items: RouteItem[], fnImportPage: (page: string) => Promise<any>): VueRouter {
100
+ export default function (items: RouteItem[], fnImportPage?: (page: string) => Promise<any>): VueRouter {
107
101
  const routes: RouteRecordRaw[] = [];
108
102
  applyItemsToRoutes('', items, routes, fnImportPage);
109
103
 
package/src/tnxvue.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  /**
2
2
  * 基于Vue 3的扩展支持
3
3
  */
4
- import Tnx from '../../tnxcore/src/tnxcore';
4
+ import Tnx, {util} from '../../tnxcore/src/tnxcore.ts';
5
5
  import Text from './text/Text.vue';
6
6
  import Percent from './percent/Percent.vue';
7
7
  import * as Vue from 'vue';
8
8
  import mitt, {Emitter, EventType} from 'mitt';
9
9
  import {Router} from 'vue-router';
10
+ import {VueRouter} from './tnxvue-router.ts';
11
+
12
+ export {util};
10
13
 
11
14
  export type EventBus = Emitter<Record<EventType, unknown>> & {
12
- once(name: EventType, handler: (arg: unknown) => void): void;
15
+ once(name: EventType, handler: (event: unknown) => void): void;
13
16
  };
14
17
 
15
18
  export type ButtonOptions = {
@@ -37,35 +40,35 @@ export type OpenOptions = DialogOptions & {
37
40
 
38
41
  export default class TnxVue extends Tnx {
39
42
 
40
- router: Router;
43
+ router: VueRouter;
41
44
  eventBus: EventBus;
42
45
 
43
- static {
44
- TnxVue.Libs.Vue = Vue;
45
- }
46
-
47
- components: Record<string, Vue.Component | Vue.DefineComponent> = {
46
+ /**
47
+ * 需要注册到Vue中的组件清单
48
+ */
49
+ components: Record<string, Vue.Component> = {
48
50
  Text,
49
51
  Percent,
50
52
  };
51
53
 
52
- constructor(apiBaseUrl: string) {
53
- super(apiBaseUrl);
54
+ constructor(apiBaseUrl: string, id: string = 'tnxvue') {
55
+ super(apiBaseUrl, id);
56
+ this.libs.Vue = Vue;
54
57
  }
55
58
 
56
- install(app: Vue.App) {
59
+ install(app: Vue.App): void {
57
60
  for (let key of Object.keys(this.components)) {
58
61
  const component = this.components[key];
59
62
  app.component(component.name, component);
60
63
  }
61
64
  }
62
65
 
63
- createVueApp(rootComponent: Vue.Component, router: Router, rootProps?: Record<string, any>): Vue.App {
66
+ createVueApp(rootComponent: Vue.Component, router?: Router, rootProps?: Record<string, any>): Vue.App {
64
67
  let app = Vue.createApp(rootComponent, rootProps);
65
68
  app.use(this);
66
69
  if (router) {
67
70
  app.use(router);
68
- this.router = app.config.globalProperties.$router;
71
+ this.router = app.config.globalProperties.$router as VueRouter;
69
72
  } else if (this.router) {
70
73
  app.config.globalProperties.$router = this.router;
71
74
  }
@@ -73,7 +76,7 @@ export default class TnxVue extends Tnx {
73
76
  if (!this.eventBus) {
74
77
  this.eventBus = mitt() as EventBus;
75
78
  }
76
- this.eventBus.once = (name: EventType, handler: (arg: unknown) => void) => {
79
+ this.eventBus.once = (name: EventType, handler: (event: unknown) => void) => {
77
80
  this.eventBus.all.set(name, [handler]);
78
81
  }
79
82
 
@@ -135,7 +138,16 @@ export default class TnxVue extends Tnx {
135
138
  });
136
139
  }
137
140
 
138
- dialog(content: string | Vue.Component | Vue.DefineComponent,
141
+ /**
142
+ * 判断指定对象是否组件实例
143
+ * @param obj 对象
144
+ * @returns {boolean} 是否组件实例
145
+ */
146
+ isComponent(obj: any): boolean {
147
+ return (typeof obj === 'object') && (typeof obj.render === 'function');
148
+ }
149
+
150
+ dialog(content: string | Vue.Component,
139
151
  title?: string,
140
152
  options: DialogOptions = {},
141
153
  contentProps: Record<string, any> = {}) {
@@ -209,7 +221,12 @@ export default class TnxVue extends Tnx {
209
221
  return [];
210
222
  }
211
223
 
212
- drawer(content: string | Vue.Component | Vue.DefineComponent,
224
+ closeDialog(all?: boolean): Promise<void> {
225
+ // 默认不实现,由UI框架扩展层实现
226
+ throw new Error('Unsupported function');
227
+ }
228
+
229
+ drawer(content: string | Vue.Component,
213
230
  title?: string,
214
231
  options: DrawerOptions = {},
215
232
  contentProps: Record<string, any> = {}) {
@@ -218,7 +235,26 @@ export default class TnxVue extends Tnx {
218
235
  throw new Error('Unsupported function');
219
236
  }
220
237
 
221
- open(component: Vue.Component | Vue.DefineComponent, props?: Record<string, any>, options: OpenOptions = {}) {
238
+ closeDrawer(all?: boolean): Promise<void> {
239
+ // 默认不实现,由UI框架扩展层实现
240
+ throw new Error('Unsupported function');
241
+ }
242
+
243
+ showLoading(message?: string): Promise<void> {
244
+ // 默认不实现,由UI框架扩展层实现
245
+ throw new Error('Unsupported function');
246
+ }
247
+
248
+ closeLoading(): void {
249
+ // 默认不实现,由UI框架扩展层实现
250
+ throw new Error('Unsupported function');
251
+ }
252
+
253
+ hideLoading(): void {
254
+ this.closeLoading();
255
+ }
256
+
257
+ open(component: Vue.Component, props?: Record<string, any>, options: OpenOptions = {}) {
222
258
  const c = component as any;
223
259
  if (typeof c.open === 'function') {
224
260
  options = Object.assign({}, c.open(props), options);
@@ -236,13 +272,4 @@ export default class TnxVue extends Tnx {
236
272
  return this.dialog(component, title, options, props);
237
273
  }
238
274
 
239
- /**
240
- * 判断指定对象是否组件实例
241
- * @param obj 对象
242
- * @returns {boolean} 是否组件实例
243
- */
244
- isComponent(obj: any): boolean {
245
- return (typeof obj === 'object') && (typeof obj.render === 'function');
246
- }
247
-
248
275
  }
package/tsconfig.json CHANGED
@@ -1,21 +1,34 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ESNext",
5
- "moduleResolution": "Bundler",
6
- "strict": false,
7
- "noImplicitAny": false,
8
- "allowJs": false,
9
- "resolveJsonModule": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "lib": [
13
- "ES2020",
14
- "DOM"
15
- ],
16
- "types": []
17
- },
18
- "include": [
19
- "src/**/*"
20
- ]
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "emitDeclarationOnly": true,
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "outDir": "types",
10
+ "allowImportingTsExtensions": true,
11
+ "strict": false,
12
+ "noImplicitAny": false,
13
+ "allowJs": false,
14
+ "resolveJsonModule": true,
15
+ "esModuleInterop": true,
16
+ "skipLibCheck": true,
17
+ "lib": [
18
+ "ES2020",
19
+ "DOM"
20
+ ],
21
+ "types": [],
22
+ "baseUrl": ".",
23
+ "paths": {
24
+ "@/*": [
25
+ "src/*"
26
+ ]
27
+ }
28
+ },
29
+ "include": [
30
+ "src/**/*.ts",
31
+ "sample/**/*.ts",
32
+ "node_modules/tdesign-vue-next/global.d.ts"
33
+ ]
21
34
  }