@truenewx/tnxvue3 3.4.4 → 3.4.6

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 (35) hide show
  1. package/package.json +18 -17
  2. package/src/bootstrap-vue/dialog/Dialog.vue +22 -10
  3. package/src/bootstrap-vue/select/Select.vue +3 -4
  4. package/src/components/ScrollView.vue +69 -0
  5. package/src/css.d.ts +4 -0
  6. package/src/element-plus/aj-captcha/utils/ase.js +4 -4
  7. package/src/element-plus/dialog/Dialog.vue +19 -7
  8. package/src/element-plus/drawer/Drawer.vue +20 -3
  9. package/src/element-plus/fss-upload/FssUpload.vue +1 -1
  10. package/src/element-plus/icon/Icon.vue +3 -0
  11. package/src/element-plus/select/Select.vue +3 -4
  12. package/src/element-plus/tnxel.css +0 -8
  13. package/src/element-plus/tnxel.ts +58 -72
  14. package/src/tdesign/mobile/calendar/Calendar.vue +121 -0
  15. package/src/tdesign/mobile/date-time-picker/DateTimePicker.vue +147 -0
  16. package/src/tdesign/mobile/dialog/Dialog.vue +179 -0
  17. package/src/tdesign/mobile/dialog/DialogContent.vue +13 -0
  18. package/src/tdesign/mobile/drawer/Drawer.vue +197 -0
  19. package/src/tdesign/mobile/drawer/DrawerContent.vue +13 -0
  20. package/src/tdesign/mobile/enum-select/EnumSelect.vue +164 -0
  21. package/src/tdesign/mobile/popup/Popup.vue +106 -0
  22. package/src/tdesign/mobile/region-picker/RegionPicker.vue +223 -0
  23. package/src/tdesign/mobile/select/Select.vue +479 -0
  24. package/src/tdesign/mobile/slide-radio-group/SlideRadioGroup.vue +397 -0
  25. package/src/tdesign/mobile/tnxtdm.css +125 -0
  26. package/src/tdesign/mobile/tnxtdm.ts +305 -1
  27. package/src/tdesign/tnxtd-validator.ts +14 -13
  28. package/src/tdesign/tnxtd.css +98 -0
  29. package/src/tdesign/tnxtd.ts +4 -0
  30. package/src/tnxvue-router.ts +59 -5
  31. package/src/tnxvue.ts +32 -11
  32. package/src/vue.d.ts +6 -0
  33. package/tsconfig.json +4 -7
  34. /package/src/{percent → components}/Percent.vue +0 -0
  35. /package/src/{text → components}/Text.vue +0 -0
package/src/tnxvue.ts CHANGED
@@ -2,11 +2,12 @@
2
2
  * 基于Vue 3的扩展支持
3
3
  */
4
4
  import Tnx, {util} from '../../tnxcore/src/tnxcore.ts';
5
- import Text from './text/Text.vue';
6
- import Percent from './percent/Percent.vue';
5
+ import Text from './components/Text.vue';
6
+ import Percent from './components/Percent.vue';
7
+ import ScrollView from './components/ScrollView.vue';
7
8
  import * as Vue from 'vue';
8
9
  import mitt, {Emitter, EventType} from 'mitt';
9
- import {Router} from 'vue-router';
10
+ import {Router, useRoute} from 'vue-router';
10
11
  import {VueRouter} from './tnxvue-router.ts';
11
12
 
12
13
  export {util};
@@ -27,11 +28,14 @@ export type DialogOptions = {
27
28
  click?: boolean | ((yes: boolean, close: () => void) => boolean | undefined) | ((close: () => void) => boolean | undefined);
28
29
  buttonText?: string | string[];
29
30
  buttons?: ButtonOptions[];
31
+ width?: number | string;
30
32
  }
31
33
 
32
34
  export type OpenType = 'alert' | 'confirm' | 'close' | 'none';
33
35
 
34
- export type DrawerOptions = DialogOptions
36
+ export type DrawerOptions = DialogOptions & {
37
+ placement?: 'bottom' | 'right' | 'top' | 'left';
38
+ }
35
39
 
36
40
  export type OpenOptions = DialogOptions & {
37
41
  mode?: 'dialog' | 'drawer';
@@ -49,6 +53,7 @@ export default class TnxVue extends Tnx {
49
53
  components: Record<string, Vue.Component> = {
50
54
  Text,
51
55
  Percent,
56
+ ScrollView,
52
57
  };
53
58
 
54
59
  constructor(apiBaseUrl: string, id: string = 'tnxvue') {
@@ -56,6 +61,10 @@ export default class TnxVue extends Tnx {
56
61
  this.libs.Vue = Vue;
57
62
  }
58
63
 
64
+ route(): ReturnType<typeof useRoute> {
65
+ return useRoute();
66
+ }
67
+
59
68
  install(app: Vue.App): void {
60
69
  for (let key of Object.keys(this.components)) {
61
70
  const component = this.components[key];
@@ -174,7 +183,7 @@ export default class TnxVue extends Tnx {
174
183
 
175
184
  protected getDefaultDialogButtons(
176
185
  type: OpenType,
177
- click: boolean | ((yes: boolean, close: () => void) => boolean | undefined) | ((close: () => void) => boolean | undefined),
186
+ click: boolean | string | ((yes: boolean, close: () => void) => boolean | undefined) | ((close: () => void) => boolean | undefined),
178
187
  theme?: string): ButtonOptions[] {
179
188
  if (click !== false) {
180
189
  if (type === 'none') {
@@ -184,6 +193,9 @@ export default class TnxVue extends Tnx {
184
193
  text: '确定',
185
194
  type: theme || 'primary',
186
195
  click(close: () => void) {
196
+ if (typeof click === 'string') {
197
+ click = this[click];
198
+ }
187
199
  if (typeof click === 'function') {
188
200
  return click.call(this, true, close);
189
201
  }
@@ -191,6 +203,9 @@ export default class TnxVue extends Tnx {
191
203
  }, {
192
204
  text: '取消',
193
205
  click(close: () => void) {
206
+ if (typeof click === 'string') {
207
+ click = this[click];
208
+ }
194
209
  if (typeof click === 'function') {
195
210
  return click.call(this, false, close);
196
211
  }
@@ -201,6 +216,9 @@ export default class TnxVue extends Tnx {
201
216
  text: '关闭',
202
217
  type: theme,
203
218
  click(close: () => void) {
219
+ if (typeof click === 'string') {
220
+ click = this[click];
221
+ }
204
222
  if (typeof click === 'function') {
205
223
  return click.call(this, close);
206
224
  }
@@ -211,6 +229,9 @@ export default class TnxVue extends Tnx {
211
229
  text: '确定',
212
230
  type: theme || 'primary',
213
231
  click(close: () => void) {
232
+ if (typeof click === 'string') {
233
+ click = this[click];
234
+ }
214
235
  if (typeof click === 'function') {
215
236
  return click.call(this, close);
216
237
  }
@@ -221,7 +242,7 @@ export default class TnxVue extends Tnx {
221
242
  return [];
222
243
  }
223
244
 
224
- closeDialog(all?: boolean): Promise<void> {
245
+ closeDialog(all?: boolean): void {
225
246
  // 默认不实现,由UI框架扩展层实现
226
247
  throw new Error('Unsupported function');
227
248
  }
@@ -235,7 +256,7 @@ export default class TnxVue extends Tnx {
235
256
  throw new Error('Unsupported function');
236
257
  }
237
258
 
238
- closeDrawer(all?: boolean): Promise<void> {
259
+ closeDrawer(all?: boolean): void {
239
260
  // 默认不实现,由UI框架扩展层实现
240
261
  throw new Error('Unsupported function');
241
262
  }
@@ -256,10 +277,10 @@ export default class TnxVue extends Tnx {
256
277
 
257
278
  open(component: Vue.Component, props?: Record<string, any>, options: OpenOptions = {}) {
258
279
  const c = component as any;
259
- if (typeof c.open === 'function') {
260
- options = Object.assign({}, c.open(props), options);
261
- } else if (c.methods && typeof c.methods.open === 'function') {
262
- options = Object.assign({}, c.methods.open(props), options);
280
+ if (typeof c.openOptions === 'function') {
281
+ options = Object.assign({}, c.openOptions(props), options);
282
+ } else if (c.openOptions) {
283
+ options = Object.assign({}, c.openOptions, options);
263
284
  }
264
285
 
265
286
  let mode = options.mode;
package/src/vue.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ declare module '*.vue' {
2
+ import type { DefineComponent } from 'vue';
3
+
4
+ const component: DefineComponent<Record<string, never>, Record<string, never>, any>;
5
+ export default component;
6
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "rootDir": "..",
3
4
  "target": "ES2020",
4
5
  "module": "ESNext",
5
6
  "moduleResolution": "Bundler",
@@ -18,16 +19,12 @@
18
19
  "ES2020",
19
20
  "DOM"
20
21
  ],
21
- "types": [],
22
- "baseUrl": ".",
23
- "paths": {
24
- "@/*": [
25
- "src/*"
26
- ]
27
- }
22
+ "types": []
28
23
  },
29
24
  "include": [
25
+ "src/**/*.d.ts",
30
26
  "src/**/*.ts",
27
+ "src/**/*.vue",
31
28
  "sample/**/*.ts",
32
29
  "node_modules/tdesign-vue-next/global.d.ts"
33
30
  ]
File without changes
File without changes