@hostlink/nuxt-light 1.18.2 → 1.19.0

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/dist/module.json +1 -1
  2. package/dist/runtime/components/L/ForgetPasswordDialog.vue +12 -14
  3. package/dist/runtime/components/L/System/Setting/authentication.vue +54 -0
  4. package/dist/runtime/components/L/System/Setting/modules.vue +1 -1
  5. package/dist/runtime/components/l-app-main.vue +10 -13
  6. package/dist/runtime/components/l-app.vue +31 -8
  7. package/dist/runtime/components/l-edit-btn.vue +1 -1
  8. package/dist/runtime/components/l-facebook-button.vue +28 -0
  9. package/dist/runtime/components/l-form-dialog.vue +1 -2
  10. package/dist/runtime/components/l-input.vue +14 -9
  11. package/dist/runtime/components/l-login.vue +66 -14
  12. package/dist/runtime/components/l-microsoft-button.vue +119 -0
  13. package/dist/runtime/components/l-page.vue +0 -1
  14. package/dist/runtime/components/l-tab.vue +4 -1
  15. package/dist/runtime/components/l-tabs.vue +2 -4
  16. package/dist/runtime/index.d.ts +1 -92
  17. package/dist/runtime/index.js +1 -197
  18. package/dist/runtime/lib/index.d.ts +1 -1
  19. package/dist/runtime/light.d.ts +1224 -0
  20. package/dist/runtime/light.js +242 -0
  21. package/dist/runtime/locales/zh-hk.json +29 -1
  22. package/dist/runtime/pages/System/database/table.vue +8 -10
  23. package/dist/runtime/pages/System/setting.vue +24 -2
  24. package/dist/runtime/pages/System/view_as.vue +3 -3
  25. package/dist/runtime/pages/User/_user_id/view.vue +6 -20
  26. package/dist/runtime/pages/User/setting/bio-auth.vue +34 -15
  27. package/dist/runtime/pages/User/setting/my_favorite.vue +2 -5
  28. package/dist/runtime/pages/User/setting/open_id.vue +169 -31
  29. package/dist/runtime/pages/User/setting/two-factor-auth.vue +2 -3
  30. package/dist/runtime/plugin.js +4 -1
  31. package/package.json +4 -2
  32. package/dist/runtime/components/L/ForgetPasswordResetDialog.vue +0 -34
@@ -0,0 +1,119 @@
1
+ <script setup lang="ts">
2
+ import { PublicClientApplication } from '@azure/msal-browser';
3
+ import { useQuasar } from 'quasar';
4
+ const $q = useQuasar()
5
+
6
+ const props = defineProps({
7
+ clientId: {
8
+ type: String,
9
+ required: true
10
+ },
11
+ })
12
+
13
+ const emits = defineEmits(["login"]);
14
+
15
+ const onClick = async () => {
16
+ const myMSALObject = new PublicClientApplication({
17
+ auth: {
18
+ clientId: props.clientId,
19
+ authority: "https://login.microsoftonline.com/common",
20
+ redirectUri: window.location.origin,
21
+ },
22
+ cache: {
23
+ cacheLocation: "memoryStorage",
24
+ storeAuthStateInCookie: false,
25
+ }
26
+ });
27
+
28
+ try {
29
+ await myMSALObject.initialize();
30
+
31
+ const resp = await myMSALObject.loginPopup({
32
+ scopes: ["user.read"]
33
+ });
34
+
35
+ emits("login", resp);
36
+
37
+ } catch (e: any) {
38
+ $q.dialog({
39
+ title: "Error",
40
+ message: e.message,
41
+ color: "negative",
42
+ });
43
+ }
44
+
45
+
46
+ }
47
+
48
+ </script>
49
+
50
+ <template>
51
+ <a @click="onClick" class="cursor-pointer">
52
+ <svg xmlns="http://www.w3.org/2000/svg" width="215" height="41" viewBox="0 0 215 41">
53
+ <title>MS-SymbolLockup</title>
54
+ <rect width="215" height="41" fill="#fff" />
55
+ <path d="M214,1V40H1V1H214m1-1H0V41H215V0Z" fill="#8c8c8c" />
56
+ <path
57
+ d="M45.812,25.082V23.288a2.849,2.849,0,0,0,.576.4,4.5,4.5,0,0,0,.707.3,5.513,5.513,0,0,0,.747.187,3.965,3.965,0,0,0,.688.065,2.937,2.937,0,0,0,1.637-.365,1.2,1.2,0,0,0,.538-1.062,1.16,1.16,0,0,0-.179-.649,1.928,1.928,0,0,0-.5-.5,5.355,5.355,0,0,0-.757-.435q-.437-.209-.935-.436c-.356-.19-.687-.383-1-.578a4.358,4.358,0,0,1-.8-.648,2.728,2.728,0,0,1-.534-.8,2.6,2.6,0,0,1-.194-1.047,2.416,2.416,0,0,1,.333-1.285,2.811,2.811,0,0,1,.879-.9,4.026,4.026,0,0,1,1.242-.528,5.922,5.922,0,0,1,1.42-.172,5.715,5.715,0,0,1,2.4.374v1.721a3.832,3.832,0,0,0-2.3-.645,4.106,4.106,0,0,0-.773.074,2.348,2.348,0,0,0-.689.241,1.5,1.5,0,0,0-.494.433,1.054,1.054,0,0,0-.19.637,1.211,1.211,0,0,0,.146.608,1.551,1.551,0,0,0,.429.468,4.276,4.276,0,0,0,.688.414c.271.134.584.28.942.436q.547.285,1.036.6a4.881,4.881,0,0,1,.856.7,3.015,3.015,0,0,1,.586.846,2.464,2.464,0,0,1,.217,1.058,2.635,2.635,0,0,1-.322,1.348,2.608,2.608,0,0,1-.868.892,3.82,3.82,0,0,1-1.257.5,6.988,6.988,0,0,1-1.5.155c-.176,0-.392-.014-.649-.04s-.518-.067-.787-.117a7.772,7.772,0,0,1-.761-.187A2.4,2.4,0,0,1,45.812,25.082Z"
58
+ fill="#5e5e5e" />
59
+ <path
60
+ d="M55.129,16.426a1.02,1.02,0,0,1-.714-.272.89.89,0,0,1-.3-.688.916.916,0,0,1,.3-.7,1.008,1.008,0,0,1,.714-.278,1.039,1.039,0,0,1,.732.278.909.909,0,0,1,.3.7.9.9,0,0,1-.3.678A1.034,1.034,0,0,1,55.129,16.426Zm.842,9.074h-1.7V18h1.7Z"
61
+ fill="#5e5e5e" />
62
+ <path
63
+ d="M65.017,24.9q0,4.131-4.153,4.131a6.187,6.187,0,0,1-2.556-.491V26.986a4.726,4.726,0,0,0,2.337.7,2.342,2.342,0,0,0,2.672-2.628V24.24h-.029a2.947,2.947,0,0,1-4.742.436,4.041,4.041,0,0,1-.838-2.684,4.738,4.738,0,0,1,.9-3.04,3,3,0,0,1,2.476-1.128,2.384,2.384,0,0,1,2.2,1.216h.029V18h1.7Zm-1.684-2.835v-.973a1.91,1.91,0,0,0-.524-1.352A1.718,1.718,0,0,0,61.5,19.18a1.793,1.793,0,0,0-1.512.714,3.217,3.217,0,0,0-.546,2,2.774,2.774,0,0,0,.524,1.769,1.678,1.678,0,0,0,1.387.662,1.805,1.805,0,0,0,1.429-.632A2.391,2.391,0,0,0,63.333,22.064Z"
64
+ fill="#5e5e5e" />
65
+ <path
66
+ d="M73.908,25.5h-1.7V21.273q0-2.1-1.486-2.1a1.622,1.622,0,0,0-1.282.582,2.162,2.162,0,0,0-.5,1.469V25.5H67.229V18h1.707v1.245h.029A2.673,2.673,0,0,1,71.4,17.824a2.265,2.265,0,0,1,1.868.795,3.57,3.57,0,0,1,.644,2.3Z"
67
+ fill="#5e5e5e" />
68
+ <path
69
+ d="M80.962,16.426a1.02,1.02,0,0,1-.714-.272.89.89,0,0,1-.3-.688.916.916,0,0,1,.3-.7,1.008,1.008,0,0,1,.714-.278,1.039,1.039,0,0,1,.732.278.909.909,0,0,1,.3.7.9.9,0,0,1-.3.678A1.034,1.034,0,0,1,80.962,16.426ZM81.8,25.5H80.1V18h1.7Z"
70
+ fill="#5e5e5e" />
71
+ <path
72
+ d="M90.7,25.5H89V21.273q0-2.1-1.486-2.1a1.622,1.622,0,0,0-1.282.582,2.157,2.157,0,0,0-.506,1.469V25.5H84.023V18H85.73v1.245h.03a2.673,2.673,0,0,1,2.431-1.421,2.265,2.265,0,0,1,1.868.795,3.57,3.57,0,0,1,.644,2.3Z"
73
+ fill="#5e5e5e" />
74
+ <path
75
+ d="M106.984,18l-2.212,7.5h-1.78l-1.361-5.083a3.215,3.215,0,0,1-.1-.659H101.5a3.069,3.069,0,0,1-.131.644l-1.48,5.1H98.145L95.939,18H97.7l1.363,5.405a3.16,3.16,0,0,1,.087.645H99.2a3.384,3.384,0,0,1,.117-.659L100.832,18h1.6l1.347,5.428a3.732,3.732,0,0,1,.095.644h.052a3.387,3.387,0,0,1,.11-.644L105.365,18Z"
76
+ fill="#5e5e5e" />
77
+ <path
78
+ d="M109.1,16.426a1.018,1.018,0,0,1-.714-.272.886.886,0,0,1-.3-.688.912.912,0,0,1,.3-.7,1.006,1.006,0,0,1,.714-.278,1.039,1.039,0,0,1,.732.278.912.912,0,0,1,.3.7.9.9,0,0,1-.3.678A1.034,1.034,0,0,1,109.1,16.426Zm.841,9.074h-1.7V18h1.7Z"
79
+ fill="#5e5e5e" />
80
+ <path
81
+ d="M116.117,25.42a2.955,2.955,0,0,1-1.31.248q-2.182,0-2.183-2.094V19.333h-1.253V18h1.253V16.264l1.7-.483V18h1.794v1.333h-1.794v3.75a1.484,1.484,0,0,0,.241.952,1.006,1.006,0,0,0,.807.285,1.167,1.167,0,0,0,.746-.248Z"
82
+ fill="#5e5e5e" />
83
+ <path
84
+ d="M124.248,25.5h-1.7V21.4q0-2.226-1.487-2.226a1.556,1.556,0,0,0-1.26.644,2.568,2.568,0,0,0-.513,1.649V25.5h-1.707V14.4h1.707v4.849h.029a2.685,2.685,0,0,1,2.432-1.421q2.5,0,2.5,3.055Z"
85
+ fill="#5e5e5e" />
86
+ <path
87
+ d="M141.907,25.5h-1.728V18.7q0-.835.1-2.043h-.029a6.992,6.992,0,0,1-.285.988L136.831,25.5h-1.2l-3.143-7.793a7.236,7.236,0,0,1-.277-1.047h-.029q.057.63.058,2.058V25.5h-1.611V15h2.453l2.762,7a10.884,10.884,0,0,1,.41,1.2h.036c.181-.551.327-.962.44-1.23L139.541,15h2.366Z"
88
+ fill="#5e5e5e" />
89
+ <path
90
+ d="M145.158,16.426a1.022,1.022,0,0,1-.714-.272.89.89,0,0,1-.3-.688.916.916,0,0,1,.3-.7,1.009,1.009,0,0,1,.714-.278,1.043,1.043,0,0,1,.733.278.911.911,0,0,1,.3.7.9.9,0,0,1-.3.678A1.038,1.038,0,0,1,145.158,16.426ZM146,25.5h-1.7V18H146Z"
91
+ fill="#5e5e5e" />
92
+ <path
93
+ d="M153.589,25.156a4.2,4.2,0,0,1-2.131.52,3.606,3.606,0,0,1-2.695-1.044,3.691,3.691,0,0,1-1.026-2.706,4.07,4.07,0,0,1,1.1-2.978,3.944,3.944,0,0,1,2.948-1.124,4.3,4.3,0,0,1,1.81.36v1.582a2.743,2.743,0,0,0-1.67-.586,2.32,2.32,0,0,0-1.766.728,2.665,2.665,0,0,0-.688,1.908,2.536,2.536,0,0,0,.648,1.838,2.3,2.3,0,0,0,1.739.674,2.716,2.716,0,0,0,1.729-.652Z"
94
+ fill="#5e5e5e" />
95
+ <path
96
+ d="M159.625,19.619a1.4,1.4,0,0,0-.887-.242,1.513,1.513,0,0,0-1.259.682,3.04,3.04,0,0,0-.506,1.852V25.5h-1.7V18h1.7v1.545H157a2.606,2.606,0,0,1,.766-1.233,1.724,1.724,0,0,1,1.154-.444,1.432,1.432,0,0,1,.7.14Z"
97
+ fill="#5e5e5e" />
98
+ <path
99
+ d="M164.02,25.676a3.719,3.719,0,0,1-2.773-1.051,3.8,3.8,0,0,1-1.036-2.787,3.7,3.7,0,0,1,3.991-4.014,3.6,3.6,0,0,1,2.739,1.033,3.986,3.986,0,0,1,.982,2.864,3.932,3.932,0,0,1-1.059,2.875A3.8,3.8,0,0,1,164.02,25.676Zm.08-6.5a1.938,1.938,0,0,0-1.575.7,2.913,2.913,0,0,0-.579,1.919,2.744,2.744,0,0,0,.586,1.856,1.965,1.965,0,0,0,1.568.678,1.87,1.87,0,0,0,1.542-.666,2.956,2.956,0,0,0,.538-1.9,3,3,0,0,0-.538-1.911A1.858,1.858,0,0,0,164.1,19.18Z"
100
+ fill="#5e5e5e" />
101
+ <path
102
+ d="M169.182,25.266V23.691a3.392,3.392,0,0,0,2.1.725q1.539,0,1.538-.908a.714.714,0,0,0-.132-.436,1.241,1.241,0,0,0-.355-.318,2.784,2.784,0,0,0-.527-.25q-.3-.108-.677-.248a7.052,7.052,0,0,1-.832-.389,2.545,2.545,0,0,1-.615-.465,1.745,1.745,0,0,1-.37-.59,2.145,2.145,0,0,1-.125-.769,1.775,1.775,0,0,1,.256-.955,2.223,2.223,0,0,1,.69-.7,3.289,3.289,0,0,1,.98-.425,4.511,4.511,0,0,1,1.136-.143,5.181,5.181,0,0,1,1.86.315v1.487a3.136,3.136,0,0,0-1.816-.542,2.317,2.317,0,0,0-.582.066,1.472,1.472,0,0,0-.443.183.886.886,0,0,0-.286.282.669.669,0,0,0-.1.363.77.77,0,0,0,.1.41.93.93,0,0,0,.3.3,2.654,2.654,0,0,0,.483.234q.282.105.649.23a9.4,9.4,0,0,1,.867.4,2.886,2.886,0,0,1,.656.465,1.806,1.806,0,0,1,.417.6,2.034,2.034,0,0,1,.147.81,1.847,1.847,0,0,1-.264,1,2.205,2.205,0,0,1-.7.7,3.292,3.292,0,0,1-1.015.413,5.222,5.222,0,0,1-1.212.136A5.115,5.115,0,0,1,169.182,25.266Z"
103
+ fill="#5e5e5e" />
104
+ <path
105
+ d="M179.443,25.676a3.717,3.717,0,0,1-2.772-1.051,3.793,3.793,0,0,1-1.036-2.787,3.7,3.7,0,0,1,3.991-4.014,3.6,3.6,0,0,1,2.739,1.033,3.986,3.986,0,0,1,.982,2.864,3.932,3.932,0,0,1-1.059,2.875A3.8,3.8,0,0,1,179.443,25.676Zm.08-6.5a1.936,1.936,0,0,0-1.574.7,2.908,2.908,0,0,0-.579,1.919,2.739,2.739,0,0,0,.586,1.856,1.964,1.964,0,0,0,1.567.678,1.868,1.868,0,0,0,1.542-.666,2.95,2.95,0,0,0,.539-1.9,2.99,2.99,0,0,0-.539-1.911A1.857,1.857,0,0,0,179.523,19.18Z"
106
+ fill="#5e5e5e" />
107
+ <path
108
+ d="M189.067,15.781a1.533,1.533,0,0,0-.784-.2q-1.237,0-1.237,1.4V18h1.743v1.333h-1.736V25.5h-1.7V19.333h-1.282V18h1.282V16.784a2.362,2.362,0,0,1,.777-1.871,2.82,2.82,0,0,1,1.94-.684,2.879,2.879,0,0,1,1,.138Z"
109
+ fill="#5e5e5e" />
110
+ <path
111
+ d="M194.23,25.42a2.955,2.955,0,0,1-1.31.248q-2.182,0-2.183-2.094V19.333h-1.253V18h1.253V16.264l1.7-.483V18h1.793v1.333h-1.793v3.75a1.484,1.484,0,0,0,.241.952,1,1,0,0,0,.806.285,1.165,1.165,0,0,0,.746-.248Z"
112
+ fill="#5e5e5e" />
113
+ <rect x="13" y="11" width="9" height="9" fill="#f25022" />
114
+ <rect x="13" y="21" width="9" height="9" fill="#00a4ef" />
115
+ <rect x="23" y="11" width="9" height="9" fill="#7fba00" />
116
+ <rect x="23" y="21" width="9" height="9" fill="#ffb900" />
117
+ </svg>
118
+ </a>
119
+ </template>
@@ -50,7 +50,6 @@ const onDelete = async () => {
50
50
 
51
51
  }
52
52
 
53
- console.log(light)
54
53
  useHead({
55
54
  title: light.company + " - " + title,
56
55
  })
@@ -1,6 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import type { QTabPanelProps, QTabProps } from 'quasar';
3
3
  import { getCurrentInstance } from 'vue';
4
+ import { useI18n } from 'vue-i18n';
5
+
6
+ const { t } = useI18n();
4
7
 
5
8
  const instance = getCurrentInstance();
6
9
  defineProps<QTabPanelProps | QTabProps>()
@@ -17,7 +20,7 @@ const parent_type = instance?.parent?.type.name
17
20
  </template>
18
21
 
19
22
  <template v-if="parent_type == 'QTabs'">
20
- <q-tab v-bind="$props">
23
+ <q-tab v-bind="$props" :label="$t($props.label ?? '')">
21
24
  </q-tab>
22
25
  </template>
23
26
 
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import type { QTabsProps } from 'quasar';
3
- import { onMounted, useSlots } from '#imports';
3
+ import { useSlots } from '#imports';
4
4
  const model = defineModel<string | number | null | undefined>()
5
- export interface LTabsProps extends QTabsProps {
5
+ export interface LTabsProps extends QTabsProps {
6
6
  }
7
7
  defineProps<LTabsProps>();
8
8
  const slots = useSlots()
@@ -16,12 +16,10 @@ if (model.value === undefined) {
16
16
  <l-card>
17
17
  <q-tabs class="text-grey" :active-color="$light.color" :indicator-color="$light.color" align="justify"
18
18
  v-model="model">
19
-
20
19
  <slot></slot>
21
20
  </q-tabs>
22
21
  <q-tab-panels v-model="model">
23
22
  <slot></slot>
24
- <!-- component v-for="tab in tabContents" :key="tab.name" :is="tab.content?.default" :name="tab.name" /-->
25
23
  </q-tab-panels>
26
24
  </l-card>
27
25
  </template>
@@ -1,56 +1,4 @@
1
1
  import { type FormKitInputs } from '@formkit/inputs';
2
- export interface User {
3
- user_id?: number;
4
- username: string;
5
- password: string;
6
- first_name: string;
7
- last_name?: string;
8
- email: string;
9
- language?: string;
10
- }
11
- declare const app: {
12
- company: string;
13
- companyLogo: string;
14
- color: string;
15
- theme: string;
16
- isAdmin: boolean;
17
- permissions: string[];
18
- myFavorites: any[];
19
- users: {
20
- create: (user: User) => Promise<User>;
21
- del: (user_id: number) => Promise<any>;
22
- update: (id: number, user: User) => Promise<any>;
23
- list: (args: any) => Promise<any>;
24
- };
25
- roles: {
26
- list: () => Promise<any>;
27
- };
28
- getColorValue: () => string;
29
- setMyFavorites: (favorites: Array<any>) => void;
30
- reloadMyFavorites: () => Promise<void>;
31
- getMyFavorites: () => any[];
32
- isDarkMode: () => boolean;
33
- getVersion: () => string;
34
- addError: (err: Error) => void;
35
- getErrors: () => Error[];
36
- removeError: (error: Error) => void;
37
- getStyle: (name: string) => any;
38
- setStyles: (s: Object) => void;
39
- getStyles: () => {
40
- [key: string]: any;
41
- };
42
- setStyle: (name: string, value: any) => Promise<void>;
43
- setCurrentRoute: (to: any) => void;
44
- getID: () => number | null;
45
- init: (styles: any) => void;
46
- isGranted: (right?: string) => boolean;
47
- setPermissions: (permissions: Array<string>) => void;
48
- };
49
- declare module 'vue' {
50
- interface ComponentCustomProperties {
51
- $light: typeof app;
52
- }
53
- }
54
2
  declare module '@formkit/inputs' {
55
3
  interface FormKitInputProps<Props extends FormKitInputs<Props>> {
56
4
  lInput: {
@@ -86,44 +34,5 @@ declare module '@formkit/inputs' {
86
34
  };
87
35
  }
88
36
  }
89
- export declare const useLight: (options?: {
90
- color?: string;
91
- }) => {
92
- company: string;
93
- companyLogo: string;
94
- color: string;
95
- theme: string;
96
- isAdmin: boolean;
97
- permissions: string[];
98
- myFavorites: any[];
99
- users: {
100
- create: (user: User) => Promise<User>;
101
- del: (user_id: number) => Promise<any>;
102
- update: (id: number, user: User) => Promise<any>;
103
- list: (args: any) => Promise<any>;
104
- };
105
- roles: {
106
- list: () => Promise<any>;
107
- };
108
- getColorValue: () => string;
109
- setMyFavorites: (favorites: Array<any>) => void;
110
- reloadMyFavorites: () => Promise<void>;
111
- getMyFavorites: () => any[];
112
- isDarkMode: () => boolean;
113
- getVersion: () => string;
114
- addError: (err: Error) => void;
115
- getErrors: () => Error[];
116
- removeError: (error: Error) => void;
117
- getStyle: (name: string) => any;
118
- setStyles: (s: Object) => void;
119
- getStyles: () => {
120
- [key: string]: any;
121
- };
122
- setStyle: (name: string, value: any) => Promise<void>;
123
- setCurrentRoute: (to: any) => void;
124
- getID: () => number | null;
125
- init: (styles: any) => void;
126
- isGranted: (right?: string) => boolean;
127
- setPermissions: (permissions: Array<string>) => void;
128
- };
37
+ export { useLight } from "./light.js";
129
38
  export * from "./lib/index.js";
@@ -1,198 +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
- getVersion: () => {
114
- return packageJson.version;
115
- },
116
- addError: (err) => {
117
- errors.push(err);
118
- },
119
- getErrors: () => {
120
- return errors;
121
- },
122
- removeError: (error) => {
123
- const index = errors.indexOf(error);
124
- if (index > -1) {
125
- errors.splice(index, 1);
126
- }
127
- },
128
- getStyle(name) {
129
- if (styles[name] === void 0) {
130
- if (defaultStyle[name] !== void 0) {
131
- return defaultStyle[name];
132
- }
133
- return false;
134
- }
135
- return styles[name];
136
- },
137
- setStyles(s) {
138
- styles = s;
139
- },
140
- getStyles() {
141
- return styles;
142
- },
143
- async setStyle(name, value) {
144
- await m("updateMyStyle", {
145
- name,
146
- value
147
- });
148
- styles[name] = value;
149
- },
150
- setCurrentRoute(to) {
151
- currentRoute = to;
152
- },
153
- getID() {
154
- if (currentRoute == null) return null;
155
- let name = currentRoute.name?.toString();
156
- if (name == void 0) return 0;
157
- let parts = name.split("-");
158
- const keyname = parts[1];
159
- return parseInt(currentRoute.params[keyname]);
160
- },
161
- init(styles2) {
162
- app.color = styles2.color || "primary";
163
- app.theme = styles2.theme || "semi-dark";
164
- app.setStyles(styles2);
165
- watch(() => app.theme, async () => {
166
- await app.setStyle("theme", app.theme);
167
- });
168
- },
169
- isGranted(right) {
170
- if (right === void 0) return true;
171
- if (app.permissions.includes("*")) return true;
172
- if (app.permissions.includes(right)) return true;
173
- const parts = right.split(".");
174
- parts.pop();
175
- do {
176
- if (app.permissions.includes(parts.join(".") + ".*")) return true;
177
- parts.pop();
178
- } while (parts.length > 0);
179
- return false;
180
- },
181
- setPermissions(permissions) {
182
- this.permissions = permissions;
183
- }
184
- });
185
- let currentRoute = null;
186
- watch(() => app.color, async () => {
187
- await m("updateMyStyle", {
188
- name: "color",
189
- value: app.color
190
- });
191
- });
192
- export const useLight = (options = {}) => {
193
- if (options.color !== void 0) {
194
- toRaw(app).color = options.color;
195
- }
196
- return app;
197
- };
1
+ export { useLight } from "./light.js";
198
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";