@morningfast/platform 0.0.10 → 0.0.12

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/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { MICRO_AUTH_EXPIRED_EVENT as e } from "./micro-contract.js";
2
- import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./chunks/main-BRpmAK9d.js";
3
- import { ApiError as d, RequestManager as f, createRequestClient as p, formatErrorMessage as m } from "./request.js";
4
- import { a as h, i as g, n as _, r as v, t as y } from "./chunks/auth-C3RvRgcW.js";
5
- import { t as b } from "./chunks/system-BbMsTIBR.js";
6
- import { n as x, r as S, t as C } from "./chunks/route-items-DZFRXefX.js";
7
- import { o as w } from "./chunks/config-Cd-9BYBy.js";
8
- import { a as T, c as E, d as D, i as O, l as k, n as A, o as j, r as M, s as N, t as P, u as F } from "./chunks/sub-D7y3UaHp.js";
9
- export { d as ApiError, j as DEFAULT_SUB_APP_BASE, r as HOME_TAB_PATH, e as MICRO_AUTH_EXPIRED_EVENT, x as MicroAppView, f as RequestManager, N as SUB_APP_NAME, E as SUB_APP_THEME_CHANGE_EVENT, O as applySubAppTheme, o as configureMorningfastRequestClient, c as createApi, _ as createMockLoginResult, v as createMockUserProfile, s as createMorningfastBaseRoutes, a as createMorningfastRouter, p as createRequestClient, C as createRoutesFromItems, F as createSubAppContext, T as createSubAppRouter, m as formatErrorMessage, n as http, l as mountMorningfastApp, M as mountSubApp, g as normalizeLoginResult, h as normalizeUserProfile, i as requestManager, k as resolveSubAppBasePath, w as setDefaultAppConfigs, u as setupAuthExpiredHandler, D as subAppContextKey, S as useAppStore, y as useAuthStore, P as useRequestClient, A as useSubAppContext, b as useSystemStore, t as useTabsStore };
2
+ import { a as t, c as n, d as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/main-BVdwJu-s.js";
3
+ import { ApiError as f, RequestManager as p, createRequestClient as m, formatErrorMessage as h } from "./request.js";
4
+ import { a as g, i as _, n as v, r as y, t as b } from "./chunks/auth-C3RvRgcW.js";
5
+ import { i as x, n as S, r as C, t as w } from "./chunks/system-DZaKDrG6.js";
6
+ import { n as T, r as E, t as D } from "./chunks/route-items-84k92f3O.js";
7
+ import { o as O } from "./chunks/config-Cd-9BYBy.js";
8
+ import { a as k, c as A, d as j, i as M, l as N, n as P, o as F, r as I, s as L, t as R, u as z } from "./chunks/sub-D7y3UaHp.js";
9
+ export { f as ApiError, F as DEFAULT_SUB_APP_BASE, t as HOME_TAB_PATH, e as MICRO_AUTH_EXPIRED_EVENT, T as MicroAppView, p as RequestManager, L as SUB_APP_NAME, A as SUB_APP_THEME_CHANGE_EVENT, M as applySubAppTheme, l as configureMorningfastRequestClient, n as createApi, v as createMockLoginResult, y as createMockUserProfile, c as createMorningfastBaseRoutes, o as createMorningfastRouter, m as createRequestClient, D as createRoutesFromItems, z as createSubAppContext, k as createSubAppRouter, h as formatErrorMessage, S as getPersistedValue, a as http, u as mountMorningfastApp, I as mountSubApp, _ as normalizeLoginResult, g as normalizeUserProfile, C as removePersistedValue, d as requestManager, N as resolveSubAppBasePath, O as setDefaultAppConfigs, x as setPersistedValue, r as setupAuthExpiredHandler, j as subAppContextKey, E as useAppStore, b as useAuthStore, R as useRequestClient, i as useSortable, P as useSubAppContext, w as useSystemStore, s as useTabsStore };
@@ -6,6 +6,9 @@ export { createRoutesFromItems } from './router/route-items';
6
6
  export type { AppRouteItem, RouteItem } from './router/route-items';
7
7
  export { setDefaultAppConfigs, type AppConfigItem, } from './micro-apps/config';
8
8
  export { mountMorningfastApp } from './app/create-app';
9
+ export { useSortable } from './composables/useSortable';
10
+ export type { UseSortableOptions } from './composables/useSortable';
11
+ export { getPersistedValue, removePersistedValue, setPersistedValue, } from './utils/persistence';
9
12
  export { default as MicroAppView } from './pages/micro/MicroAppView.vue';
10
13
  export type { MountedMorningfastAppContext, MountMorningfastAppContext, MountMorningfastAppOptions, } from './app/create-app';
11
14
  export type { MorningfastAppConfig } from './app/runtime-config';
@@ -0,0 +1,14 @@
1
+ type __VLS_Props = {
2
+ src: string;
3
+ alt: string;
4
+ textInverted?: boolean;
5
+ width?: string;
6
+ height?: string;
7
+ };
8
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
+ textInverted: boolean;
10
+ width: string;
11
+ height: string;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -1,13 +1,16 @@
1
1
  import { ThemeColorPosition, ThemeMode } from '../utils/theme';
2
- export type LayoutMode = 'side' | 'top' | 'mix';
2
+ export type LayoutMode = 'default' | 'side' | 'top' | 'mix';
3
3
  export type MenuSearchPlacement = 'header' | 'sidebar';
4
4
  export declare const useAppStore: import('pinia').StoreDefinition<"app", Pick<{
5
+ closeMobileSidebar: () => void;
5
6
  closeSettings: () => void;
6
7
  initializePreferences: () => void;
7
8
  isDark: import('vue').ComputedRef<boolean>;
9
+ isMobileViewport: import('vue').Ref<boolean, boolean>;
8
10
  layoutMode: import('vue').Ref<LayoutMode, LayoutMode>;
9
11
  menuSearchPlacement: import('vue').Ref<MenuSearchPlacement, MenuSearchPlacement>;
10
12
  menuSearchPlacementOptions: import('vue').ComputedRef<MenuSearchPlacement[]>;
13
+ mobileSidebarVisible: import('vue').Ref<boolean, boolean>;
11
14
  openSettings: (tab?: "theme" | "layout" | "shortcut" | "general") => void;
12
15
  isSidebarMenuSearch: import('vue').ComputedRef<boolean>;
13
16
  settingsActiveTab: import('vue').Ref<"theme" | "layout" | "shortcut" | "general", "theme" | "layout" | "shortcut" | "general">;
@@ -28,13 +31,16 @@ export declare const useAppStore: import('pinia').StoreDefinition<"app", Pick<{
28
31
  themeMode: import('vue').Ref<ThemeMode, ThemeMode>;
29
32
  toggleDarkMode: () => void;
30
33
  toggleSidebar: () => void;
31
- }, "layoutMode" | "menuSearchPlacement" | "settingsActiveTab" | "selectedTopMenuPath" | "settingsVisible" | "sidebarCollapsed" | "shortcutTipVisible" | "themeColor" | "themeColorPosition" | "themeMode">, Pick<{
34
+ }, "isMobileViewport" | "layoutMode" | "menuSearchPlacement" | "mobileSidebarVisible" | "settingsActiveTab" | "selectedTopMenuPath" | "settingsVisible" | "sidebarCollapsed" | "shortcutTipVisible" | "themeColor" | "themeColorPosition" | "themeMode">, Pick<{
35
+ closeMobileSidebar: () => void;
32
36
  closeSettings: () => void;
33
37
  initializePreferences: () => void;
34
38
  isDark: import('vue').ComputedRef<boolean>;
39
+ isMobileViewport: import('vue').Ref<boolean, boolean>;
35
40
  layoutMode: import('vue').Ref<LayoutMode, LayoutMode>;
36
41
  menuSearchPlacement: import('vue').Ref<MenuSearchPlacement, MenuSearchPlacement>;
37
42
  menuSearchPlacementOptions: import('vue').ComputedRef<MenuSearchPlacement[]>;
43
+ mobileSidebarVisible: import('vue').Ref<boolean, boolean>;
38
44
  openSettings: (tab?: "theme" | "layout" | "shortcut" | "general") => void;
39
45
  isSidebarMenuSearch: import('vue').ComputedRef<boolean>;
40
46
  settingsActiveTab: import('vue').Ref<"theme" | "layout" | "shortcut" | "general", "theme" | "layout" | "shortcut" | "general">;
@@ -56,12 +62,15 @@ export declare const useAppStore: import('pinia').StoreDefinition<"app", Pick<{
56
62
  toggleDarkMode: () => void;
57
63
  toggleSidebar: () => void;
58
64
  }, "isDark" | "menuSearchPlacementOptions" | "isSidebarMenuSearch">, Pick<{
65
+ closeMobileSidebar: () => void;
59
66
  closeSettings: () => void;
60
67
  initializePreferences: () => void;
61
68
  isDark: import('vue').ComputedRef<boolean>;
69
+ isMobileViewport: import('vue').Ref<boolean, boolean>;
62
70
  layoutMode: import('vue').Ref<LayoutMode, LayoutMode>;
63
71
  menuSearchPlacement: import('vue').Ref<MenuSearchPlacement, MenuSearchPlacement>;
64
72
  menuSearchPlacementOptions: import('vue').ComputedRef<MenuSearchPlacement[]>;
73
+ mobileSidebarVisible: import('vue').Ref<boolean, boolean>;
65
74
  openSettings: (tab?: "theme" | "layout" | "shortcut" | "general") => void;
66
75
  isSidebarMenuSearch: import('vue').ComputedRef<boolean>;
67
76
  settingsActiveTab: import('vue').Ref<"theme" | "layout" | "shortcut" | "general", "theme" | "layout" | "shortcut" | "general">;
@@ -82,4 +91,4 @@ export declare const useAppStore: import('pinia').StoreDefinition<"app", Pick<{
82
91
  themeMode: import('vue').Ref<ThemeMode, ThemeMode>;
83
92
  toggleDarkMode: () => void;
84
93
  toggleSidebar: () => void;
85
- }, "closeSettings" | "initializePreferences" | "openSettings" | "setLayoutMode" | "setMenuSearchPlacement" | "setSelectedTopMenuPath" | "setSettingsVisible" | "setSidebarCollapsed" | "setThemeColor" | "setThemeColorPosition" | "setThemeMode" | "toggleDarkMode" | "toggleSidebar">>;
94
+ }, "closeMobileSidebar" | "closeSettings" | "initializePreferences" | "openSettings" | "setLayoutMode" | "setMenuSearchPlacement" | "setSelectedTopMenuPath" | "setSettingsVisible" | "setSidebarCollapsed" | "setThemeColor" | "setThemeColorPosition" | "setThemeMode" | "toggleDarkMode" | "toggleSidebar">>;
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./chunks/main-BRpmAK9d.js";
2
- import { a as u, i as d, n as f, r as p, t as m } from "./chunks/auth-C3RvRgcW.js";
3
- import { t as h } from "./chunks/system-BbMsTIBR.js";
4
- import { n as g, r as _, t as v } from "./chunks/route-items-DZFRXefX.js";
5
- import { o as y } from "./chunks/config-Cd-9BYBy.js";
6
- export { n as HOME_TAB_PATH, g as MicroAppView, a as configureMorningfastRequestClient, s as createApi, f as createMockLoginResult, p as createMockUserProfile, o as createMorningfastBaseRoutes, i as createMorningfastRouter, v as createRoutesFromItems, t as http, c as mountMorningfastApp, d as normalizeLoginResult, u as normalizeUserProfile, r as requestManager, y as setDefaultAppConfigs, l as setupAuthExpiredHandler, _ as useAppStore, m as useAuthStore, h as useSystemStore, e as useTabsStore };
1
+ import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./chunks/main-BVdwJu-s.js";
2
+ import { a as d, i as f, n as p, r as m, t as h } from "./chunks/auth-C3RvRgcW.js";
3
+ import { i as g, n as _, r as v, t as y } from "./chunks/system-DZaKDrG6.js";
4
+ import { n as b, r as x, t as S } from "./chunks/route-items-84k92f3O.js";
5
+ import { o as C } from "./chunks/config-Cd-9BYBy.js";
6
+ export { e as HOME_TAB_PATH, b as MicroAppView, c as configureMorningfastRequestClient, t as createApi, p as createMockLoginResult, m as createMockUserProfile, s as createMorningfastBaseRoutes, a as createMorningfastRouter, S as createRoutesFromItems, _ as getPersistedValue, i as http, l as mountMorningfastApp, f as normalizeLoginResult, d as normalizeUserProfile, v as removePersistedValue, u as requestManager, C as setDefaultAppConfigs, g as setPersistedValue, n as setupAuthExpiredHandler, x as useAppStore, h as useAuthStore, r as useSortable, y as useSystemStore, o as useTabsStore };
package/dist/sub.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./chunks/route-items-DZFRXefX.js";
1
+ import { t as e } from "./chunks/route-items-84k92f3O.js";
2
2
  import { a as t, c as n, d as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/sub-D7y3UaHp.js";
3
3
  export { s as DEFAULT_SUB_APP_BASE, l as SUB_APP_NAME, n as SUB_APP_THEME_CHANGE_EVENT, i as applySubAppTheme, e as createRoutesFromItems, d as createSubAppContext, t as createSubAppRouter, c as mountSubApp, a as resolveSubAppBasePath, r as subAppContextKey, u as useRequestClient, o as useSubAppContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morningfast/platform",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Morningfast platform runtime for main and sub applications.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,209 +0,0 @@
1
- import { t as e } from "./auth-C3RvRgcW.js";
2
- import { t } from "./system-BbMsTIBR.js";
3
- import { t as n } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
4
- import { useRoute as r, useRouter as i } from "vue-router";
5
- import { ElMessage as a } from "element-plus";
6
- import { computed as o, createBlock as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, normalizeClass as p, onBeforeUnmount as m, openBlock as h, reactive as g, ref as _, resolveComponent as v, toDisplayString as y, unref as b, withCtx as x, withKeys as S, withModifiers as C } from "vue";
7
- import { Iphone as w, Lock as T, Message as E, User as ee } from "@element-plus/icons-vue";
8
- //#region src/main/pages/auth/Login.vue?vue&type=script&setup=true&lang.ts
9
- var D = { class: "login-page" }, O = { class: "login-page__panel" }, k = { class: "login-page__hero" }, A = ["src", "alt"], j = { class: "login-page__brand" }, M = ["src", "alt"], N = { class: "login-page__account" }, P = ["aria-label"], F = { class: "login-page__card-header" }, I = { class: "login-page__form-sheet" }, L = { class: "login-page__code-row" }, R = { class: "login-page__qr-sheet" }, z = /* @__PURE__ */ n(/* @__PURE__ */ f({
10
- __name: "Login",
11
- setup(n) {
12
- let f = r(), z = i(), B = e(), V = t(), H = _("password"), U = _(!1), W = _(!1), G = _(!1), K = _(0), q, J = g({
13
- phone: "13800000000",
14
- password: "123456"
15
- }), Y = g({
16
- phone: "13800000000",
17
- code: "246810"
18
- }), X = o(() => K.value > 0 ? `${K.value}s 后重试` : "获取验证码");
19
- function Z(e) {
20
- return /^1[3-9]\d{9}$/.test(e.trim()) ? !0 : (a.warning("请输入正确的手机号"), !1);
21
- }
22
- async function Q() {
23
- G.value || K.value > 0 || Z(Y.phone) && (G.value = !0, await new Promise((e) => setTimeout(e, 600)), G.value = !1, K.value = 60, a.success("验证码已发送,演示验证码 246810"), q = window.setInterval(() => {
24
- --K.value, K.value <= 0 && (window.clearInterval(q), q = void 0);
25
- }, 1e3));
26
- }
27
- async function $() {
28
- let e = H.value === "password" ? J.phone : Y.phone;
29
- if (!Z(e)) return;
30
- if (H.value === "password" && !J.password) {
31
- a.warning("请输入密码");
32
- return;
33
- }
34
- if (H.value === "sms" && Y.code.trim() !== "246810") {
35
- a.warning("请输入正确的验证码");
36
- return;
37
- }
38
- W.value = !0;
39
- try {
40
- await B.login({
41
- username: e.trim(),
42
- password: H.value === "password" ? J.password : Y.code
43
- });
44
- } finally {
45
- W.value = !1;
46
- }
47
- a.success("登录成功,已进入平台骨架页");
48
- let t = typeof f.query.redirect == "string" ? f.query.redirect : "/";
49
- z.replace(t);
50
- }
51
- return m(() => {
52
- q && window.clearInterval(q);
53
- }), (e, t) => {
54
- let n = v("el-segmented"), r = v("el-icon"), i = v("el-input"), a = v("el-form-item"), o = v("el-button"), f = v("el-form"), m = v("el-card");
55
- return h(), c("div", D, [l("div", O, [l("div", k, [l("img", {
56
- src: b(V).loginBackground,
57
- alt: b(V).systemName,
58
- class: "login-page__visual"
59
- }, null, 8, A), l("div", j, [l("img", {
60
- src: b(V).logoCollapsed,
61
- alt: b(V).systemName,
62
- class: "login-page__brand-logo"
63
- }, null, 8, M), l("span", null, y(b(V).systemName), 1)])]), l("section", N, [d(m, {
64
- shadow: "never",
65
- class: "login-page__card"
66
- }, {
67
- header: x(() => [l("div", F, [l("strong", null, y(U.value ? "扫码登录" : "账号登录"), 1), l("span", null, y(U.value ? "使用企业移动端扫码确认" : "请选择登录方式完成身份验证"), 1)])]),
68
- default: x(() => [l("button", {
69
- class: p(["login-page__qr-corner", { "is-open": U.value }]),
70
- type: "button",
71
- "aria-label": U.value ? "切换到手机号登录" : "切换到扫码登录",
72
- onClick: t[0] ||= (e) => U.value = !U.value
73
- }, [...t[8] ||= [l("span", { class: "login-page__qr-mini" }, null, -1)]], 10, P), l("div", {
74
- class: p(["login-page__card-body", { "is-qr": U.value }]),
75
- onKeydown: t[7] ||= S((e) => U.value = !1, ["esc"])
76
- }, [l("div", I, [d(n, {
77
- modelValue: H.value,
78
- "onUpdate:modelValue": t[1] ||= (e) => H.value = e,
79
- class: "login-page__mode",
80
- options: [{
81
- label: "手机号登录",
82
- value: "password"
83
- }, {
84
- label: "验证码登录",
85
- value: "sms"
86
- }]
87
- }, null, 8, ["modelValue"]), H.value === "password" ? (h(), s(f, {
88
- key: 0,
89
- "label-position": "top",
90
- onSubmit: C($, ["prevent"])
91
- }, {
92
- default: x(() => [
93
- d(a, { label: "手机号" }, {
94
- default: x(() => [d(i, {
95
- modelValue: J.phone,
96
- "onUpdate:modelValue": t[2] ||= (e) => J.phone = e,
97
- maxlength: "11",
98
- placeholder: "请输入手机号"
99
- }, {
100
- prefix: x(() => [d(r, null, {
101
- default: x(() => [d(b(w))]),
102
- _: 1
103
- })]),
104
- _: 1
105
- }, 8, ["modelValue"])]),
106
- _: 1
107
- }),
108
- d(a, { label: "密码" }, {
109
- default: x(() => [d(i, {
110
- modelValue: J.password,
111
- "onUpdate:modelValue": t[3] ||= (e) => J.password = e,
112
- "show-password": "",
113
- placeholder: "请输入密码"
114
- }, {
115
- prefix: x(() => [d(r, null, {
116
- default: x(() => [d(b(T))]),
117
- _: 1
118
- })]),
119
- _: 1
120
- }, 8, ["modelValue"])]),
121
- _: 1
122
- }),
123
- d(o, {
124
- type: "primary",
125
- class: "login-page__submit",
126
- loading: W.value,
127
- onClick: $
128
- }, {
129
- default: x(() => [...t[9] ||= [u(" 登录系统 ", -1)]]),
130
- _: 1
131
- }, 8, ["loading"])
132
- ]),
133
- _: 1
134
- })) : (h(), s(f, {
135
- key: 1,
136
- "label-position": "top",
137
- onSubmit: C($, ["prevent"])
138
- }, {
139
- default: x(() => [
140
- d(a, { label: "手机号" }, {
141
- default: x(() => [d(i, {
142
- modelValue: Y.phone,
143
- "onUpdate:modelValue": t[4] ||= (e) => Y.phone = e,
144
- maxlength: "11",
145
- placeholder: "请输入手机号"
146
- }, {
147
- prefix: x(() => [d(r, null, {
148
- default: x(() => [d(b(w))]),
149
- _: 1
150
- })]),
151
- _: 1
152
- }, 8, ["modelValue"])]),
153
- _: 1
154
- }),
155
- d(a, { label: "验证码" }, {
156
- default: x(() => [l("div", L, [d(i, {
157
- modelValue: Y.code,
158
- "onUpdate:modelValue": t[5] ||= (e) => Y.code = e,
159
- maxlength: "6",
160
- placeholder: "请输入验证码"
161
- }, {
162
- prefix: x(() => [d(r, null, {
163
- default: x(() => [d(b(E))]),
164
- _: 1
165
- })]),
166
- _: 1
167
- }, 8, ["modelValue"]), d(o, {
168
- disabled: K.value > 0,
169
- loading: G.value,
170
- onClick: Q
171
- }, {
172
- default: x(() => [u(y(X.value), 1)]),
173
- _: 1
174
- }, 8, ["disabled", "loading"])])]),
175
- _: 1
176
- }),
177
- d(o, {
178
- type: "primary",
179
- class: "login-page__submit",
180
- loading: W.value,
181
- onClick: $
182
- }, {
183
- default: x(() => [...t[10] ||= [u(" 登录系统 ", -1)]]),
184
- _: 1
185
- }, 8, ["loading"])
186
- ]),
187
- _: 1
188
- }))]), l("div", R, [
189
- t[12] ||= l("div", { class: "login-page__qr-box" }, "二维码", -1),
190
- t[13] ||= l("strong", null, "移动端扫码登录", -1),
191
- t[14] ||= l("p", null, "二维码每 2 分钟自动刷新", -1),
192
- d(o, {
193
- text: "",
194
- onClick: t[6] ||= (e) => U.value = !1
195
- }, {
196
- default: x(() => [d(r, null, {
197
- default: x(() => [d(b(ee))]),
198
- _: 1
199
- }), t[11] ||= u(" 使用手机号登录 ", -1)]),
200
- _: 1
201
- })
202
- ])], 34)]),
203
- _: 1
204
- })])])]);
205
- };
206
- }
207
- }), [["__scopeId", "data-v-8e99a976"]]);
208
- //#endregion
209
- export { z as default };