x-essential-lib 0.10.6 → 0.10.8

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.
@@ -0,0 +1,201 @@
1
+ import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
2
+
3
+ //#region src/i18n/locales/en/index.ts
4
+ var en_exports = /* @__PURE__ */ __exportAll({ default: () => en_default });
5
+ var en_default = {
6
+ dlg: { common: {
7
+ cancel: "Cancel",
8
+ confirm: "Confirm",
9
+ responding: "Responding..."
10
+ } },
11
+ $vuetify: {
12
+ badge: "Badge",
13
+ open: "Open",
14
+ close: "Close",
15
+ dismiss: "Dismiss",
16
+ confirmEdit: {
17
+ ok: "OK",
18
+ cancel: "Cancel"
19
+ },
20
+ dataIterator: {
21
+ noResultsText: "No matching records found",
22
+ loadingText: "Loading items..."
23
+ },
24
+ dataTable: {
25
+ itemsPerPageText: "Rows per page:",
26
+ ariaLabel: {
27
+ sortDescending: "Sorted descending.",
28
+ sortAscending: "Sorted ascending.",
29
+ sortNone: "Not sorted.",
30
+ activateNone: "Activate to remove sorting.",
31
+ activateDescending: "Activate to sort descending.",
32
+ activateAscending: "Activate to sort ascending.",
33
+ selectRow: "Select row",
34
+ selectAll: "Select all",
35
+ selectGroup: "Select group"
36
+ },
37
+ sortBy: "Sort by"
38
+ },
39
+ dataFooter: {
40
+ itemsPerPageText: "Items per page:",
41
+ itemsPerPageAll: "All",
42
+ nextPage: "Next page",
43
+ prevPage: "Previous page",
44
+ firstPage: "First page",
45
+ lastPage: "Last page",
46
+ pageText: "{0}-{1} of {2}"
47
+ },
48
+ dateRangeInput: { divider: "to" },
49
+ monthPicker: {
50
+ title: "Select month",
51
+ itemsSelected: "{0} selected",
52
+ header: "Enter month",
53
+ range: { title: "Enter months" },
54
+ ariaLabel: {
55
+ previousYear: "Previous year",
56
+ nextYear: "Next year",
57
+ selectYear: "Select year",
58
+ currentMonth: "Current month, {0}"
59
+ }
60
+ },
61
+ datePicker: {
62
+ itemsSelected: "{0} selected",
63
+ range: {
64
+ title: "Select dates",
65
+ header: "Enter dates"
66
+ },
67
+ title: "Select date",
68
+ header: "Enter date",
69
+ input: { placeholder: "Enter date" },
70
+ ariaLabel: {
71
+ previousMonth: "Previous month",
72
+ nextMonth: "Next month",
73
+ selectYear: "Select year",
74
+ previousYear: "Previous year",
75
+ nextYear: "Next year",
76
+ selectMonth: "Select month",
77
+ selectDate: "{0}",
78
+ currentDate: "Today, {0}"
79
+ }
80
+ },
81
+ noDataText: "No data available",
82
+ carousel: {
83
+ prev: "Previous visual",
84
+ next: "Next visual",
85
+ ariaLabel: { delimiter: "Carousel slide {0} of {1}" }
86
+ },
87
+ calendar: {
88
+ moreEvents: "{0} more",
89
+ today: "Today"
90
+ },
91
+ heatmap: {
92
+ less: "Less",
93
+ more: "More"
94
+ },
95
+ input: {
96
+ clear: "Clear {0}",
97
+ prependAction: "{0} prepended action",
98
+ appendAction: "{0} appended action",
99
+ otp: "Enter verification code"
100
+ },
101
+ fileInput: {
102
+ counter: "{0} files",
103
+ counterSize: "{0} files ({1} in total)"
104
+ },
105
+ fileUpload: {
106
+ title: "Drag and drop files here",
107
+ divider: "or",
108
+ browse: "Browse Files"
109
+ },
110
+ timePicker: {
111
+ am: "AM",
112
+ pm: "PM",
113
+ title: "Select Time",
114
+ hour: "Hour",
115
+ minute: "Minute",
116
+ second: "Second",
117
+ notAllowed: "Value is not allowed"
118
+ },
119
+ pagination: { ariaLabel: {
120
+ root: "Pagination Navigation",
121
+ next: "Next page",
122
+ previous: "Previous page",
123
+ page: "Go to page {0}",
124
+ currentPage: "Page {0}, Current page",
125
+ first: "First page",
126
+ last: "Last page"
127
+ } },
128
+ stepper: {
129
+ next: "Next",
130
+ prev: "Previous"
131
+ },
132
+ rating: { ariaLabel: { item: "Rating {0} of {1}" } },
133
+ loading: "Loading...",
134
+ infiniteScroll: {
135
+ loadMore: "Load more",
136
+ empty: "No more"
137
+ },
138
+ rules: {
139
+ required: "This field is required",
140
+ email: "Please enter a valid email",
141
+ number: "This field can only contain numbers",
142
+ integer: "This field can only contain integer values",
143
+ capital: "This field can only contain uppercase letters",
144
+ maxLength: "You must enter a maximum of {0} characters",
145
+ minLength: "You must enter a minimum of {0} characters",
146
+ strictLength: "The length of the entered field is invalid",
147
+ exclude: "The {0} character is not allowed",
148
+ notEmpty: "Please choose at least one value",
149
+ pattern: "Invalid format"
150
+ },
151
+ command: { search: "Type a command or search..." },
152
+ hotkey: {
153
+ then: "then",
154
+ ctrl: "Ctrl",
155
+ command: "Command",
156
+ space: "Space",
157
+ shift: "Shift",
158
+ alt: "Alt",
159
+ enter: "Enter",
160
+ escape: "Escape",
161
+ upArrow: "Up Arrow",
162
+ downArrow: "Down Arrow",
163
+ leftArrow: "Left Arrow",
164
+ rightArrow: "Right Arrow",
165
+ backspace: "Backspace",
166
+ option: "Option",
167
+ plus: "plus",
168
+ shortcut: "Keyboard shortcut: {0}",
169
+ or: "or"
170
+ },
171
+ video: {
172
+ play: "Play",
173
+ pause: "Pause",
174
+ seek: "Seek",
175
+ volume: "Volume",
176
+ showVolume: "Show volume control",
177
+ mute: "Mute",
178
+ unmute: "Unmute",
179
+ enterFullscreen: "Full screen",
180
+ exitFullscreen: "Exit full screen"
181
+ },
182
+ colorPicker: { ariaLabel: {
183
+ eyedropper: "Select color with eyedropper",
184
+ hueSlider: "Hue",
185
+ alphaSlider: "Alpha",
186
+ redInput: "Red value",
187
+ greenInput: "Green value",
188
+ blueInput: "Blue value",
189
+ alphaInput: "Alpha value",
190
+ hueInput: "Hue value",
191
+ saturationInput: "Saturation value",
192
+ lightnessInput: "Lightness value",
193
+ hexInput: "HEX value",
194
+ hexaInput: "HEX with alpha value",
195
+ changeFormat: "Change color format"
196
+ } }
197
+ }
198
+ };
199
+
200
+ //#endregion
201
+ export { en_exports as t };
@@ -0,0 +1,201 @@
1
+ import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
2
+
3
+ //#region src/i18n/locales/zhHans/index.ts
4
+ var zhHans_exports = /* @__PURE__ */ __exportAll({ default: () => zhHans_default });
5
+ var zhHans_default = {
6
+ dlg: { common: {
7
+ cancel: "取消",
8
+ confirm: "确定",
9
+ responding: "响应中..."
10
+ } },
11
+ $vuetify: {
12
+ badge: "徽章",
13
+ open: "打开",
14
+ close: "关闭",
15
+ dismiss: "取消",
16
+ confirmEdit: {
17
+ ok: "确定",
18
+ cancel: "取消"
19
+ },
20
+ dataIterator: {
21
+ noResultsText: "没有符合条件的结果",
22
+ loadingText: "加载中……"
23
+ },
24
+ dataTable: {
25
+ itemsPerPageText: "每页数目:",
26
+ ariaLabel: {
27
+ sortDescending: ":降序排列。",
28
+ sortAscending: ":升序排列。",
29
+ sortNone: ":未排序。",
30
+ activateNone: "点击以移除排序。",
31
+ activateDescending: "点击以降序排列。",
32
+ activateAscending: "点击以升序排列。",
33
+ selectRow: "选择行",
34
+ selectAll: "选择全部",
35
+ selectGroup: "选择分组"
36
+ },
37
+ sortBy: "排序方式"
38
+ },
39
+ dataFooter: {
40
+ itemsPerPageText: "每页数目:",
41
+ itemsPerPageAll: "全部",
42
+ nextPage: "下一页",
43
+ prevPage: "上一页",
44
+ firstPage: "首页",
45
+ lastPage: "尾页",
46
+ pageText: "{0}-{1} 共 {2}"
47
+ },
48
+ dateRangeInput: { divider: "至" },
49
+ monthPicker: {
50
+ title: "选择月份",
51
+ itemsSelected: "已选择 {0} 项",
52
+ header: "输入月份",
53
+ range: { title: "输入月份" },
54
+ ariaLabel: {
55
+ previousYear: "上一年",
56
+ nextYear: "下一年",
57
+ selectYear: "选择年份",
58
+ currentMonth: "本月,{0}"
59
+ }
60
+ },
61
+ datePicker: {
62
+ itemsSelected: "已选择 {0} 项",
63
+ range: {
64
+ title: "选择日期",
65
+ header: "输入日期"
66
+ },
67
+ title: "选择日期",
68
+ header: "输入日期",
69
+ input: { placeholder: "输入日期" },
70
+ ariaLabel: {
71
+ previousMonth: "上个月",
72
+ nextMonth: "下个月",
73
+ selectYear: "选择年份",
74
+ previousYear: "上一年",
75
+ nextYear: "下一年",
76
+ selectMonth: "选择月份",
77
+ selectDate: "{0}",
78
+ currentDate: "今天,{0}"
79
+ }
80
+ },
81
+ noDataText: "没有数据",
82
+ carousel: {
83
+ prev: "上一张",
84
+ next: "下一张",
85
+ ariaLabel: { delimiter: "幻灯片 {0} / {1}" }
86
+ },
87
+ calendar: {
88
+ moreEvents: "还有 {0} 项",
89
+ today: "今天"
90
+ },
91
+ heatmap: {
92
+ less: "少",
93
+ more: "多"
94
+ },
95
+ input: {
96
+ clear: "清除 {0}",
97
+ prependAction: "{0} 前置操作",
98
+ appendAction: "{0} 后置操作",
99
+ otp: "请输入第 {0} 位 OTP"
100
+ },
101
+ fileInput: {
102
+ counter: "{0} 个文件",
103
+ counterSize: "{0} 个文件(共 {1})"
104
+ },
105
+ fileUpload: {
106
+ title: "拖放文件到此处",
107
+ divider: "或",
108
+ browse: "浏览文件"
109
+ },
110
+ timePicker: {
111
+ am: "上午",
112
+ pm: "下午",
113
+ title: "选择时间",
114
+ hour: "小时",
115
+ minute: "分钟",
116
+ second: "秒",
117
+ notAllowed: "值不允许"
118
+ },
119
+ pagination: { ariaLabel: {
120
+ root: "分页导航",
121
+ next: "下一页",
122
+ previous: "上一页",
123
+ page: "转到页面 {0}",
124
+ currentPage: "当前页 {0}",
125
+ first: "第一页",
126
+ last: "最后一页"
127
+ } },
128
+ stepper: {
129
+ next: "下一步",
130
+ prev: "上一步"
131
+ },
132
+ rating: { ariaLabel: { item: "评分 {0} / {1}" } },
133
+ loading: "加载中...",
134
+ infiniteScroll: {
135
+ loadMore: "加载更多",
136
+ empty: "没有更多内容"
137
+ },
138
+ rules: {
139
+ required: "此字段为必填项",
140
+ email: "请输入有效的电子邮件地址",
141
+ number: "此字段只能包含数字",
142
+ integer: "此字段只能包含整数",
143
+ capital: "此字段只能包含大写字母",
144
+ maxLength: "您最多可以输入{0}个字符",
145
+ minLength: "您必须至少输入{0}个字符",
146
+ strictLength: "输入字段的长度无效",
147
+ exclude: "字符{0}是不允许的",
148
+ notEmpty: "请至少选择一个值",
149
+ pattern: "格式无效"
150
+ },
151
+ command: { search: "输入命令或搜索..." },
152
+ hotkey: {
153
+ then: "然后",
154
+ ctrl: "Ctrl",
155
+ command: "Command",
156
+ shift: "Shift",
157
+ alt: "Alt",
158
+ option: "Option",
159
+ enter: "Enter",
160
+ escape: "Escape",
161
+ upArrow: "上箭头",
162
+ downArrow: "下箭头",
163
+ leftArrow: "左箭头",
164
+ rightArrow: "右箭头",
165
+ backspace: "退格",
166
+ space: "空格",
167
+ plus: "加",
168
+ shortcut: "键盘快捷键:{0}",
169
+ or: "或"
170
+ },
171
+ video: {
172
+ play: "播放",
173
+ pause: "暂停",
174
+ seek: "跳转",
175
+ volume: "音量",
176
+ showVolume: "显示音量控制",
177
+ mute: "静音",
178
+ unmute: "取消静音",
179
+ enterFullscreen: "全屏",
180
+ exitFullscreen: "退出全屏"
181
+ },
182
+ colorPicker: { ariaLabel: {
183
+ eyedropper: "从屏幕拾取颜色",
184
+ hueSlider: "色相",
185
+ alphaSlider: "不透明度",
186
+ redInput: "红色",
187
+ greenInput: "绿色",
188
+ blueInput: "蓝色",
189
+ alphaInput: "不透明度",
190
+ hueInput: "色相",
191
+ saturationInput: "饱和度",
192
+ lightnessInput: "亮度",
193
+ hexInput: "HEX 值",
194
+ hexaInput: "带不透明度 HEX 值",
195
+ changeFormat: "更改颜色格式"
196
+ } }
197
+ }
198
+ };
199
+
200
+ //#endregion
201
+ export { zhHans_exports as t };
package/dist/index.d.ts CHANGED
@@ -264,8 +264,9 @@ declare function injectViews(): Ref<string[]>;
264
264
  interface RouteMeta {
265
265
  app: 'x-app-mf' | 'x-compute-mf' | 'x-create-mf' | 'x-data-mf' | 'x-ecosystem-mf' | 'x-main-mf' | 'x-mine-mf' | 'x-org-mf' | 'x-passport-mf' | 'x-resource-mf';
266
266
  path: string;
267
+ back?: string;
267
268
  level: number;
268
- requiredState?: 'auth' | 'org';
269
+ requireAuth: boolean;
269
270
  }
270
271
  declare function matchRouteMeta(path: string): RouteMeta | undefined;
271
272
  declare const routeTransName: import("vue").Ref<string, string>;
@@ -289,7 +290,7 @@ declare function popView(views: Ref<string[]>): void;
289
290
  declare function clearViews(views: Ref<string[]>): void;
290
291
  //#endregion
291
292
  //#region src/composables/microApp.d.ts
292
- declare function useMicroApp(dark: Ref<boolean | undefined>, locale: Ref<string>, permissionObjects: Ref<PermissionObjects>, permissionChecksum: Ref<string>, lastAppPath: Ref<string>, views: Ref<string[]>): void;
293
+ declare function useMicroApp(dark: Ref<boolean | undefined>, locale: Ref<string>, permissionObjects: Ref<PermissionObjects>, permissionChecksum: Ref<string>, lastAppPath: Ref<string>, views: Ref<string[]>, customBack?: (m: RouteMeta) => void): void;
293
294
  //#endregion
294
295
  //#region src/composables/permission.d.ts
295
296
  declare function usePermission(): {
@@ -313,6 +314,13 @@ declare function useViewStack(name: string, hook?: (params: unknown) => void): {
313
314
  //#endregion
314
315
  //#region src/i18n/index.d.ts
315
316
  declare function loadLocaleMessageEssential(locale: string): Promise<{
317
+ dlg: {
318
+ common: {
319
+ cancel: string;
320
+ confirm: string;
321
+ responding: string;
322
+ };
323
+ };
316
324
  $vuetify: {
317
325
  badge: string;
318
326
  open: string;
@@ -335,6 +343,9 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
335
343
  activateNone: string;
336
344
  activateDescending: string;
337
345
  activateAscending: string;
346
+ selectRow: string;
347
+ selectAll: string;
348
+ selectGroup: string;
338
349
  };
339
350
  sortBy: string;
340
351
  };
@@ -350,6 +361,20 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
350
361
  dateRangeInput: {
351
362
  divider: string;
352
363
  };
364
+ monthPicker: {
365
+ title: string;
366
+ itemsSelected: string;
367
+ header: string;
368
+ range: {
369
+ title: string;
370
+ };
371
+ ariaLabel: {
372
+ previousYear: string;
373
+ nextYear: string;
374
+ selectYear: string;
375
+ currentMonth: string;
376
+ };
377
+ };
353
378
  datePicker: {
354
379
  itemsSelected: string;
355
380
  range: {
@@ -361,6 +386,16 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
361
386
  input: {
362
387
  placeholder: string;
363
388
  };
389
+ ariaLabel: {
390
+ previousMonth: string;
391
+ nextMonth: string;
392
+ selectYear: string;
393
+ previousYear: string;
394
+ nextYear: string;
395
+ selectMonth: string;
396
+ selectDate: string;
397
+ currentDate: string;
398
+ };
364
399
  };
365
400
  noDataText: string;
366
401
  carousel: {
@@ -374,6 +409,10 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
374
409
  moreEvents: string;
375
410
  today: string;
376
411
  };
412
+ heatmap: {
413
+ less: string;
414
+ more: string;
415
+ };
377
416
  input: {
378
417
  clear: string;
379
418
  prependAction: string;
@@ -384,10 +423,19 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
384
423
  counter: string;
385
424
  counterSize: string;
386
425
  };
426
+ fileUpload: {
427
+ title: string;
428
+ divider: string;
429
+ browse: string;
430
+ };
387
431
  timePicker: {
388
432
  am: string;
389
433
  pm: string;
390
434
  title: string;
435
+ hour: string;
436
+ minute: string;
437
+ second: string;
438
+ notAllowed: string;
391
439
  };
392
440
  pagination: {
393
441
  ariaLabel: {
@@ -414,13 +462,68 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
414
462
  loadMore: string;
415
463
  empty: string;
416
464
  };
417
- };
418
- dlg: {
419
- common: {
420
- ask: string;
421
- cancel: string;
422
- confirm: string;
423
- responding: string;
465
+ rules: {
466
+ required: string;
467
+ email: string;
468
+ number: string;
469
+ integer: string;
470
+ capital: string;
471
+ maxLength: string;
472
+ minLength: string;
473
+ strictLength: string;
474
+ exclude: string;
475
+ notEmpty: string;
476
+ pattern: string;
477
+ };
478
+ command: {
479
+ search: string;
480
+ };
481
+ hotkey: {
482
+ then: string;
483
+ ctrl: string;
484
+ command: string;
485
+ space: string;
486
+ shift: string;
487
+ alt: string;
488
+ enter: string;
489
+ escape: string;
490
+ upArrow: string;
491
+ downArrow: string;
492
+ leftArrow: string;
493
+ rightArrow: string;
494
+ backspace: string;
495
+ option: string;
496
+ plus: string;
497
+ shortcut: string;
498
+ or: string;
499
+ };
500
+ video: {
501
+ play: string;
502
+ pause: string;
503
+ seek: string;
504
+ volume: string;
505
+ showVolume: string;
506
+ mute: string;
507
+ unmute: string;
508
+ enterFullscreen: string;
509
+ exitFullscreen: string;
510
+ };
511
+ colorPicker: {
512
+ ariaLabel: {
513
+ eyedropper: string;
514
+ hueSlider: string;
515
+ alphaSlider: string;
516
+ redInput: string;
517
+ greenInput: string;
518
+ blueInput: string;
519
+ alphaInput: string;
520
+ hueInput: string;
521
+ saturationInput: string;
522
+ lightnessInput: string;
523
+ hexInput: string;
524
+ hexaInput: string;
525
+ changeFormat: string;
526
+ };
424
527
  };
425
528
  };
426
529
  }>;
@@ -430,4 +533,4 @@ declare const _default: {
430
533
  install: (app: import("vue").App) => void;
431
534
  };
432
535
  //#endregion
433
- export { Permission, PermissionObjects, Type, addView, appAppear, clearViews, closeWaitDlg, createAxios, _default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLastAppPath, injectLocale, injectPermissionChecksum, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLastAppPath, provideLocale, providePermissionChecksum, providePermissionObjects, provideViews, routeTransName, types, useColor, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
536
+ export { Permission, PermissionObjects, RouteMeta, Type, addView, appAppear, clearViews, closeWaitDlg, createAxios, _default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLastAppPath, injectLocale, injectPermissionChecksum, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLastAppPath, provideLocale, providePermissionChecksum, providePermissionObjects, provideViews, routeTransName, types, useColor, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ async function waitMs(ms) {
113
113
  async function waitUtil(conditionFunc, timeout, interval) {
114
114
  const timestamp = Date.now();
115
115
  return new Promise((resolve) => {
116
- const check = async () => {
116
+ const check = () => {
117
117
  if (conditionFunc()) resolve(true);
118
118
  else if (timeout && Date.now() - timestamp > timeout) resolve(false);
119
119
  else setTimeout(check, interval ?? 30);
@@ -441,119 +441,130 @@ const routeMetas = [
441
441
  {
442
442
  app: "x-passport-mf",
443
443
  path: "/passport/login",
444
- level: 0
444
+ level: 0,
445
+ requireAuth: false
445
446
  },
446
447
  {
447
448
  app: "x-passport-mf",
448
449
  path: "/passport/loginAccount",
449
- level: 1
450
+ back: "/passport/login",
451
+ level: 1,
452
+ requireAuth: false
450
453
  },
451
454
  {
452
455
  app: "x-passport-mf",
453
456
  path: "/passport/register",
454
- level: 1
455
- },
456
- {
457
- app: "x-org-mf",
458
- path: "/org/joinOrCreate",
457
+ back: "/passport/login",
459
458
  level: 1,
460
- requiredState: "auth"
461
- },
462
- {
463
- app: "x-org-mf",
464
- path: "/org/manager",
465
- level: 1,
466
- requiredState: "org"
459
+ requireAuth: false
467
460
  },
468
461
  {
469
462
  app: "x-main-mf",
470
463
  path: "/main",
471
464
  level: 0,
472
- requiredState: "org"
465
+ requireAuth: true
473
466
  },
474
467
  {
475
468
  app: "x-create-mf",
476
469
  path: "/create",
477
470
  level: 0,
478
- requiredState: "org"
471
+ requireAuth: true
479
472
  },
480
473
  {
481
474
  app: "x-ecosystem-mf",
482
475
  path: "/ecosystem",
483
476
  level: 0,
484
- requiredState: "org"
477
+ requireAuth: true
485
478
  },
486
479
  {
487
480
  app: "x-mine-mf",
488
481
  path: "/mine",
489
482
  level: 0,
490
- requiredState: "org"
483
+ requireAuth: true
491
484
  },
492
485
  {
493
486
  app: "x-mine-mf",
494
487
  path: "/mine/personalInfo",
488
+ back: "/mine",
495
489
  level: 1,
496
- requiredState: "org"
490
+ requireAuth: true
497
491
  },
498
492
  {
499
493
  app: "x-mine-mf",
500
494
  path: "/mine/accountSecurity",
495
+ back: "/mine/personalInfo",
501
496
  level: 2,
502
- requiredState: "org"
497
+ requireAuth: true
503
498
  },
504
499
  {
505
500
  app: "x-mine-mf",
506
501
  path: "/mine/settings",
502
+ back: "/mine",
507
503
  level: 1,
508
- requiredState: "org"
504
+ requireAuth: true
509
505
  },
510
506
  {
511
507
  app: "x-mine-mf",
512
508
  path: "/mine/general",
509
+ back: "/mine/settings",
513
510
  level: 2,
514
- requiredState: "org"
511
+ requireAuth: true
515
512
  },
516
513
  {
517
514
  app: "x-mine-mf",
518
515
  path: "/mine/general/darkMode",
516
+ back: "/mine/general",
519
517
  level: 3,
520
- requiredState: "org"
518
+ requireAuth: true
521
519
  },
522
520
  {
523
521
  app: "x-mine-mf",
524
522
  path: "/mine/general/language",
523
+ back: "/mine/general",
525
524
  level: 3,
526
- requiredState: "org"
525
+ requireAuth: true
527
526
  },
528
527
  {
529
528
  app: "x-app-mf",
530
529
  path: "/app/manager",
530
+ back: "/create",
531
531
  level: 1,
532
- requiredState: "org"
532
+ requireAuth: true
533
533
  },
534
534
  {
535
535
  app: "x-app-mf",
536
536
  path: "/app/editor",
537
+ back: "/app/manager",
537
538
  level: 2,
538
- requiredState: "org"
539
+ requireAuth: true
539
540
  },
540
541
  {
541
542
  app: "x-compute-mf",
542
543
  path: "/compute",
544
+ back: "/create",
543
545
  level: 1,
544
- requiredState: "org"
546
+ requireAuth: true
545
547
  },
546
548
  {
547
549
  app: "x-data-mf",
548
550
  path: "/data",
551
+ back: "/create",
549
552
  level: 1,
550
- requiredState: "org"
553
+ requireAuth: true
551
554
  },
552
555
  {
553
556
  app: "x-resource-mf",
554
557
  path: "/resource",
558
+ back: "/create",
559
+ level: 1,
560
+ requireAuth: true
561
+ },
562
+ {
563
+ app: "x-org-mf",
564
+ path: "/org",
565
+ back: "/create",
555
566
  level: 1,
556
- requiredState: "org"
567
+ requireAuth: true
557
568
  }
558
569
  ];
559
570
  function matchRouteMeta(path) {
@@ -599,53 +610,21 @@ function onBeforeChange(toPath, fromPath, lastAppPath) {
599
610
  function isHasAccessToken() {
600
611
  return !!api.get("accessToken");
601
612
  }
602
- function isHasActiveOrg() {
603
- return !!api.get("activeOrg");
604
- }
605
613
  function onBeforeEach(to, from, lastAppPath) {
606
614
  const hasAccessToken = isHasAccessToken();
607
- const hasActiveOrg = isHasActiveOrg();
608
615
  const toRouteMeta = matchRouteMeta(to.path);
609
- if (!toRouteMeta) throw new Error(`to route meta invalid`);
610
- if (toRouteMeta.requiredState === "auth") if (hasAccessToken) if (hasActiveOrg) {
611
- const toPath = "/main";
612
- onBeforeChange(toPath, from.path, lastAppPath);
613
- return { path: toPath };
614
- } else {
615
- onBeforeChange(to.path, from.path, lastAppPath);
616
- return;
617
- }
618
- else {
616
+ if (!toRouteMeta) return;
617
+ if (toRouteMeta.requireAuth && !hasAccessToken) {
619
618
  const toPath = "/passport/login";
620
619
  onBeforeChange(toPath, from.path, lastAppPath);
621
620
  return { path: toPath };
622
621
  }
623
- else if (toRouteMeta.requiredState === "org") if (hasAccessToken) if (hasActiveOrg) {
624
- onBeforeChange(to.path, from.path, lastAppPath);
625
- return;
626
- } else {
627
- const toPath = "/org/joinOrCreate";
628
- onBeforeChange(toPath, from.path, lastAppPath);
629
- return { path: toPath };
630
- }
631
- else {
632
- const toPath = "/passport/login";
633
- onBeforeChange(toPath, from.path, lastAppPath);
634
- return { path: toPath };
635
- }
636
- else if (hasAccessToken) if (hasActiveOrg) {
622
+ if (hasAccessToken && to.path.startsWith("/passport/")) {
637
623
  const toPath = "/main";
638
624
  onBeforeChange(toPath, from.path, lastAppPath);
639
625
  return { path: toPath };
640
- } else {
641
- const toPath = "/org/joinOrCreate";
642
- onBeforeChange(toPath, from.path, lastAppPath);
643
- return { path: toPath };
644
- }
645
- else {
646
- onBeforeChange(to.path, from.path, lastAppPath);
647
- return;
648
626
  }
627
+ onBeforeChange(to.path, from.path, lastAppPath);
649
628
  }
650
629
 
651
630
  //#endregion
@@ -710,7 +689,7 @@ function clearViews(views) {
710
689
 
711
690
  //#endregion
712
691
  //#region src/composables/microApp.ts
713
- function useMicroApp(dark, locale, permissionObjects, permissionChecksum, lastAppPath, views) {
692
+ function useMicroApp(dark, locale, permissionObjects, permissionChecksum, lastAppPath, views, customBack) {
714
693
  const route = useRoute();
715
694
  const router = useRouter();
716
695
  const prefDark = usePreferredDark();
@@ -728,31 +707,29 @@ function useMicroApp(dark, locale, permissionObjects, permissionChecksum, lastAp
728
707
  provideLastAppPath(lastAppPath);
729
708
  provideViews(views);
730
709
  const theme = useTheme();
731
- watchEffect(() => {
732
- theme.change(finalDark.value ? "dark" : "light");
710
+ watchEffect(async () => {
711
+ await theme.change(finalDark.value ? "dark" : "light");
733
712
  });
734
- const handleBack = () => {
713
+ async function handleBack() {
735
714
  if (!isEmpty(views)) {
736
715
  if (!hasView(views, "waitDlg")) popView(views);
737
716
  return;
738
717
  }
739
718
  const routeMeta = matchRouteMeta(route.path);
740
- if (!routeMeta) {
741
- console.assert(false);
742
- return;
743
- }
719
+ if (!routeMeta) return;
744
720
  if (routeMeta.level === 0) navigator?.Backbutton?.goHome(() => {}, () => {});
745
- else router.back();
746
- };
747
- const onKeyDown = (e) => {
721
+ else if (customBack) customBack(routeMeta);
722
+ else if (routeMeta.back) await router.replace({ path: routeMeta.back });
723
+ }
724
+ async function onKeyDown(e) {
748
725
  if (e.key === "Escape") {
749
- handleBack();
726
+ await handleBack();
750
727
  return;
751
728
  }
752
- };
753
- const onBackButton = () => {
754
- handleBack();
755
- };
729
+ }
730
+ async function onBackButton() {
731
+ await handleBack();
732
+ }
756
733
  onMounted(() => {
757
734
  window.addEventListener("keydown", onKeyDown);
758
735
  eventBus.on("backbutton", onBackButton);
@@ -761,20 +738,20 @@ function useMicroApp(dark, locale, permissionObjects, permissionChecksum, lastAp
761
738
  window.removeEventListener("keydown", onKeyDown);
762
739
  eventBus.off("backbutton", onBackButton);
763
740
  });
764
- const onUpdateDark = (val) => {
741
+ function onUpdateDark(val) {
765
742
  dark.value = val;
766
- };
767
- const onUpdateLocale = (val) => {
743
+ }
744
+ function onUpdateLocale(val) {
768
745
  locale.value = val;
769
- };
770
- const onUpdatePermission = (val) => {
746
+ }
747
+ function onUpdatePermission(val) {
771
748
  const v = val;
772
749
  permissionObjects.value = v[0];
773
750
  permissionChecksum.value = v[1];
774
- };
775
- const onUpdateLastAppPath = (val) => {
751
+ }
752
+ function onUpdateLastAppPath(val) {
776
753
  lastAppPath.value = val;
777
- };
754
+ }
778
755
  onBeforeMount(() => {
779
756
  eventBus.on("updateDark", onUpdateDark);
780
757
  eventBus.on("updateLocale", onUpdateLocale);
@@ -1540,8 +1517,8 @@ const install = (app) => {
1540
1517
  //#endregion
1541
1518
  //#region src/i18n/index.ts
1542
1519
  async function loadLocaleMessageEssential(locale) {
1543
- if (locale === "en") return (await import("./i18n-en.nsm1ldfp.js").then((n) => n.t)).default;
1544
- else if (locale === "zhHans") return (await import("./i18n-zhHans.do0bpr19.js").then((n) => n.t)).default;
1520
+ if (locale === "en") return (await import("./i18n-en.exw0q3rp.js").then((n) => n.t)).default;
1521
+ else if (locale === "zhHans") return (await import("./i18n-zhHans.itmme76z.js").then((n) => n.t)).default;
1545
1522
  else throw new Error(`invalid locale=${locale}`);
1546
1523
  }
1547
1524
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
- "version": "0.10.6",
3
+ "version": "0.10.8",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -41,8 +41,8 @@
41
41
  "typescript": "^6.0.3",
42
42
  "vite": "^8.0.16",
43
43
  "x-config-lib": "^0.1.5",
44
- "x-config-oxfmt": "^0.1.3",
45
- "x-config-oxlint": "^0.1.2"
44
+ "x-config-oxfmt": "^0.1.4",
45
+ "x-config-oxlint": "^0.1.4"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "axios": "^1.18.0",
@@ -52,13 +52,7 @@
52
52
  "vuetify": "^4.1.2"
53
53
  },
54
54
  "lint-staged": {
55
+ "*.{js,jsx,ts,tsx,vue}": "oxlint",
55
56
  "*": "oxfmt --no-error-on-unmatched-pattern"
56
- },
57
- "inlinedDependencies": {
58
- "@vueuse/core": "14.3.0",
59
- "@vueuse/shared": "14.3.0",
60
- "js-cookie": "3.0.8",
61
- "lodash-es": "4.18.1",
62
- "mitt": "3.0.1"
63
57
  }
64
58
  }
@@ -1,113 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
2
-
3
- //#region src/i18n/locales/en/$vuetify.ts
4
- var $vuetify_default = {
5
- badge: "Badge",
6
- open: "Open",
7
- close: "Close",
8
- dismiss: "Dismiss",
9
- confirmEdit: {
10
- ok: "OK",
11
- cancel: "Cancel"
12
- },
13
- dataIterator: {
14
- noResultsText: "No matching records found",
15
- loadingText: "Loading items..."
16
- },
17
- dataTable: {
18
- itemsPerPageText: "Rows per page:",
19
- ariaLabel: {
20
- sortDescending: "Sorted descending.",
21
- sortAscending: "Sorted ascending.",
22
- sortNone: "Not sorted.",
23
- activateNone: "Activate to remove sorting.",
24
- activateDescending: "Activate to sort descending.",
25
- activateAscending: "Activate to sort ascending."
26
- },
27
- sortBy: "Sort by"
28
- },
29
- dataFooter: {
30
- itemsPerPageText: "Items per page:",
31
- itemsPerPageAll: "All",
32
- nextPage: "Next page",
33
- prevPage: "Previous page",
34
- firstPage: "First page",
35
- lastPage: "Last page",
36
- pageText: "{0}-{1} of {2}"
37
- },
38
- dateRangeInput: { divider: "to" },
39
- datePicker: {
40
- itemsSelected: "{0} selected",
41
- range: {
42
- title: "Select dates",
43
- header: "Enter dates"
44
- },
45
- title: "Select date",
46
- header: "Enter date",
47
- input: { placeholder: "Enter date" }
48
- },
49
- noDataText: "No data available",
50
- carousel: {
51
- prev: "Previous visual",
52
- next: "Next visual",
53
- ariaLabel: { delimiter: "Carousel slide {0} of {1}" }
54
- },
55
- calendar: {
56
- moreEvents: "{0} more",
57
- today: "Today"
58
- },
59
- input: {
60
- clear: "Clear {0}",
61
- prependAction: "{0} prepended action",
62
- appendAction: "{0} appended action",
63
- otp: "Please enter OTP character {0}"
64
- },
65
- fileInput: {
66
- counter: "{0} files",
67
- counterSize: "{0} files ({1} in total)"
68
- },
69
- timePicker: {
70
- am: "AM",
71
- pm: "PM",
72
- title: "Select Time"
73
- },
74
- pagination: { ariaLabel: {
75
- root: "Pagination Navigation",
76
- next: "Next page",
77
- previous: "Previous page",
78
- page: "Go to page {0}",
79
- currentPage: "Page {0}, Current page",
80
- first: "First page",
81
- last: "Last page"
82
- } },
83
- stepper: {
84
- next: "Next",
85
- prev: "Previous"
86
- },
87
- rating: { ariaLabel: { item: "Rating {0} of {1}" } },
88
- loading: "Loading...",
89
- infiniteScroll: {
90
- loadMore: "Load more",
91
- empty: "No more"
92
- }
93
- };
94
-
95
- //#endregion
96
- //#region src/i18n/locales/en/dlg.ts
97
- var dlg_default = { common: {
98
- ask: "Do you want to {verb} {object} <{name}> ?",
99
- cancel: "Cancel",
100
- confirm: "Confirm",
101
- responding: "Responding..."
102
- } };
103
-
104
- //#endregion
105
- //#region src/i18n/locales/en/index.ts
106
- var en_exports = /* @__PURE__ */ __exportAll({ default: () => en_default });
107
- var en_default = {
108
- $vuetify: $vuetify_default,
109
- dlg: dlg_default
110
- };
111
-
112
- //#endregion
113
- export { en_exports as t };
@@ -1,113 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
2
-
3
- //#region src/i18n/locales/zhHans/$vuetify.ts
4
- var $vuetify_default = {
5
- badge: "徽章",
6
- open: "Open",
7
- close: "关闭",
8
- dismiss: "Dismiss",
9
- confirmEdit: {
10
- ok: "OK",
11
- cancel: "Cancel"
12
- },
13
- dataIterator: {
14
- noResultsText: "没有符合条件的结果",
15
- loadingText: "加载中..."
16
- },
17
- dataTable: {
18
- itemsPerPageText: "每页数目:",
19
- ariaLabel: {
20
- sortDescending: ":降序排列。",
21
- sortAscending: ":升序排列。",
22
- sortNone: ":未排序。",
23
- activateNone: "点击以移除排序。",
24
- activateDescending: "点击以降序排列。",
25
- activateAscending: "点击以升序排列。"
26
- },
27
- sortBy: "排序方式"
28
- },
29
- dataFooter: {
30
- itemsPerPageText: "每页数目:",
31
- itemsPerPageAll: "全部",
32
- nextPage: "下一页",
33
- prevPage: "上一页",
34
- firstPage: "首页",
35
- lastPage: "尾页",
36
- pageText: "{0}-{1} 共 {2}"
37
- },
38
- dateRangeInput: { divider: "to" },
39
- datePicker: {
40
- itemsSelected: "{0} selected",
41
- range: {
42
- title: "Select dates",
43
- header: "Enter dates"
44
- },
45
- title: "Select date",
46
- header: "Enter date",
47
- input: { placeholder: "Enter date" }
48
- },
49
- noDataText: "没有数据",
50
- carousel: {
51
- prev: "上一张",
52
- next: "下一张",
53
- ariaLabel: { delimiter: "Carousel slide {0} of {1}" }
54
- },
55
- calendar: {
56
- moreEvents: "还有 {0} 项",
57
- today: "Today"
58
- },
59
- input: {
60
- clear: "Clear {0}",
61
- prependAction: "{0} prepended action",
62
- appendAction: "{0} appended action",
63
- otp: "Please enter OTP character {0}"
64
- },
65
- fileInput: {
66
- counter: "{0} 个文件",
67
- counterSize: "{0} 个文件(共 {1})"
68
- },
69
- timePicker: {
70
- am: "AM",
71
- pm: "PM",
72
- title: "Select Time"
73
- },
74
- pagination: { ariaLabel: {
75
- root: "分页导航",
76
- next: "下一页",
77
- previous: "上一页",
78
- page: "转到页面 {0}",
79
- currentPage: "当前页 {0}",
80
- first: "First page",
81
- last: "Last page"
82
- } },
83
- stepper: {
84
- next: "Next",
85
- prev: "Previous"
86
- },
87
- rating: { ariaLabel: { item: "Rating {0} of {1}" } },
88
- loading: "Loading...",
89
- infiniteScroll: {
90
- loadMore: "Load more",
91
- empty: "No more"
92
- }
93
- };
94
-
95
- //#endregion
96
- //#region src/i18n/locales/zhHans/dlg.ts
97
- var dlg_default = { common: {
98
- ask: "你想要{verb}{object} <{name}> ?",
99
- cancel: "取消",
100
- confirm: "确定",
101
- responding: "响应中..."
102
- } };
103
-
104
- //#endregion
105
- //#region src/i18n/locales/zhHans/index.ts
106
- var zhHans_exports = /* @__PURE__ */ __exportAll({ default: () => zhHans_default });
107
- var zhHans_default = {
108
- $vuetify: $vuetify_default,
109
- dlg: dlg_default
110
- };
111
-
112
- //#endregion
113
- export { zhHans_exports as t };