@hostlink/nuxt-light 1.18.1 → 1.18.3

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 (31) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +0 -5
  3. package/dist/runtime/components/L/ForgetPasswordDialog.vue +11 -13
  4. package/dist/runtime/components/L/System/Setting/modules.vue +1 -1
  5. package/dist/runtime/components/l-app-main.vue +22 -17
  6. package/dist/runtime/components/l-app.vue +6 -13
  7. package/dist/runtime/components/l-edit-btn.vue +1 -1
  8. package/dist/runtime/components/l-form-dialog.vue +1 -2
  9. package/dist/runtime/components/l-input.vue +14 -9
  10. package/dist/runtime/components/l-login.vue +22 -17
  11. package/dist/runtime/components/l-page.vue +2 -1
  12. package/dist/runtime/components/l-tab.vue +4 -1
  13. package/dist/runtime/components/l-tabs.vue +2 -4
  14. package/dist/runtime/index.d.ts +1 -100
  15. package/dist/runtime/index.js +1 -209
  16. package/dist/runtime/lib/index.d.ts +1 -1
  17. package/dist/runtime/light.d.ts +1224 -0
  18. package/dist/runtime/light.js +242 -0
  19. package/dist/runtime/locales/zh-hk.json +29 -1
  20. package/dist/runtime/pages/System/database/table.vue +8 -10
  21. package/dist/runtime/pages/System/setting.vue +1 -1
  22. package/dist/runtime/pages/System/view_as.vue +3 -3
  23. package/dist/runtime/pages/User/_user_id/view.vue +6 -20
  24. package/dist/runtime/pages/User/setting/bio-auth.vue +34 -15
  25. package/dist/runtime/pages/User/setting/my_favorite.vue +2 -5
  26. package/dist/runtime/pages/User/setting/open_id.vue +35 -20
  27. package/dist/runtime/pages/User/setting/two-factor-auth.vue +2 -3
  28. package/dist/runtime/plugin.js +4 -1
  29. package/package.json +1 -1
  30. package/dist/runtime/components/L/ForgetPasswordResetDialog.vue +0 -34
  31. package/dist/runtime/pages/logout.vue +0 -17
@@ -1,210 +1,2 @@
1
- import packageJson from "../../package.json";
2
- import { watch, reactive, toRaw } from "vue";
3
- import { m, q } from "./lib/index.js";
4
- const errors = reactive([]);
5
- let styles = {};
6
- const COLOR_CODE = {
7
- red: "#f44336",
8
- pink: "#e91e63",
9
- purple: "#9c27b0",
10
- "deep-purple": "#673ab7",
11
- indigo: "#3f51b5",
12
- blue: "#2196f3",
13
- "light-blue": "#03a9f4",
14
- cyan: "#00bcd4",
15
- teal: "#009688",
16
- green: "#4caf50",
17
- "light-green": "#8bc34a",
18
- lime: "#cddc39",
19
- yellow: "#ffeb3b",
20
- amber: "#ffc107",
21
- orange: "#ff9800",
22
- "deep-orange": "#ff5722",
23
- brown: "#795548",
24
- grey: "#9e9e9e",
25
- "blue-grey": "#607d8b",
26
- primary: "#7367f0",
27
- secondary: "#82868b",
28
- accent: "#9C27B0",
29
- positive: "#28c76f",
30
- negative: "#ea5455",
31
- info: "#00cfe8",
32
- warning: "#ff9f43",
33
- dark: "#4b4b4b"
34
- };
35
- let defaultStyle = {
36
- inputOutlined: true,
37
- inputStackLabel: true,
38
- tableFlat: true,
39
- tableBorder: true,
40
- tableSeparator: "cell"
41
- };
42
- const app = reactive({
43
- company: "",
44
- companyLogo: "",
45
- color: "",
46
- theme: "light",
47
- isAdmin: false,
48
- permissions: Array(),
49
- myFavorites: Array(),
50
- users: {
51
- create: async (user) => {
52
- const u = await m("addUser", { data: user });
53
- user.user_id = u;
54
- return user;
55
- },
56
- del: async (user_id) => {
57
- return await m("deleteUser", { id: user_id });
58
- },
59
- update: async (id, user) => {
60
- return await m("updateUser", {
61
- id,
62
- data: user
63
- });
64
- },
65
- list: async (args) => {
66
- const { listUser } = await q({
67
- listUser: {
68
- data: {
69
- __args: args,
70
- user_id: true,
71
- name: true
72
- }
73
- }
74
- });
75
- return listUser.data;
76
- }
77
- },
78
- roles: {
79
- list: async () => {
80
- const { listRole } = await q({
81
- listRole: {
82
- name: true
83
- }
84
- });
85
- return listRole;
86
- }
87
- },
88
- getColorValue: () => {
89
- return COLOR_CODE[app.color];
90
- },
91
- setMyFavorites: (favorites) => {
92
- app.myFavorites = favorites;
93
- },
94
- reloadMyFavorites: async () => {
95
- const data = await q({
96
- my: {
97
- myFavorites: {
98
- my_favorite_id: true,
99
- label: true,
100
- path: true,
101
- icon: true
102
- }
103
- }
104
- });
105
- app.myFavorites = data.my.myFavorites;
106
- },
107
- getMyFavorites: () => {
108
- return app.myFavorites;
109
- },
110
- isDarkMode: () => {
111
- return app.theme == "dark";
112
- },
113
- setCompany: (company) => {
114
- app.company = company;
115
- },
116
- getCompany: () => {
117
- return app.company;
118
- },
119
- setCompanyLogo: (logo) => {
120
- app.companyLogo = logo;
121
- },
122
- getCompanyLogo: () => {
123
- return app.companyLogo;
124
- },
125
- getVersion: () => {
126
- return packageJson.version;
127
- },
128
- addError: (err) => {
129
- errors.push(err);
130
- },
131
- getErrors: () => {
132
- return errors;
133
- },
134
- removeError: (error) => {
135
- const index = errors.indexOf(error);
136
- if (index > -1) {
137
- errors.splice(index, 1);
138
- }
139
- },
140
- getStyle(name) {
141
- if (styles[name] === void 0) {
142
- if (defaultStyle[name] !== void 0) {
143
- return defaultStyle[name];
144
- }
145
- return false;
146
- }
147
- return styles[name];
148
- },
149
- setStyles(s) {
150
- styles = s;
151
- },
152
- getStyles() {
153
- return styles;
154
- },
155
- async setStyle(name, value) {
156
- await m("updateMyStyle", {
157
- name,
158
- value
159
- });
160
- styles[name] = value;
161
- },
162
- setCurrentRoute(to) {
163
- currentRoute = to;
164
- },
165
- getID() {
166
- if (currentRoute == null) return null;
167
- let name = currentRoute.name?.toString();
168
- if (name == void 0) return 0;
169
- let parts = name.split("-");
170
- const keyname = parts[1];
171
- return parseInt(currentRoute.params[keyname]);
172
- },
173
- init(styles2) {
174
- app.color = styles2.color || "primary";
175
- app.theme = styles2.theme || "semi-dark";
176
- app.setStyles(styles2);
177
- watch(() => app.theme, async () => {
178
- await app.setStyle("theme", app.theme);
179
- });
180
- },
181
- isGranted(right) {
182
- if (right === void 0) return true;
183
- if (app.permissions.includes("*")) return true;
184
- if (app.permissions.includes(right)) return true;
185
- const parts = right.split(".");
186
- parts.pop();
187
- do {
188
- if (app.permissions.includes(parts.join(".") + ".*")) return true;
189
- parts.pop();
190
- } while (parts.length > 0);
191
- return false;
192
- },
193
- setPermissions(permissions) {
194
- this.permissions = permissions;
195
- }
196
- });
197
- let currentRoute = null;
198
- watch(() => app.color, async () => {
199
- await m("updateMyStyle", {
200
- name: "color",
201
- value: app.color
202
- });
203
- });
204
- export const useLight = (options = {}) => {
205
- if (options.color !== void 0) {
206
- toRaw(app).color = options.color;
207
- }
208
- return app;
209
- };
1
+ export { useLight } from "./light.js";
210
2
  export * from "./lib/index.js";
@@ -21,5 +21,5 @@ export { type LightModelField, type LightModel } from "./defineLightModel.js";
21
21
  export declare const notify: (message: string, color?: string) => void;
22
22
  export { default as getID } from "./getID.js";
23
23
  export { default as id } from "./getID.js";
24
- export declare const getApiBase: () => {};
24
+ export declare const getApiBase: () => string;
25
25
  export { default as getGQLFields } from "./getGQLFields.js";