@hostlink/nuxt-light 1.38.0 → 1.39.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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/l-app-main.vue +1 -0
- package/dist/runtime/components/l-editor.vue +4 -4
- package/dist/runtime/components/l-input.vue +1 -0
- package/dist/runtime/components/l-login.vue +1 -1
- package/dist/runtime/composables/useLight.d.ts +9 -5
- package/dist/runtime/composables/useLight.js +4 -0
- package/dist/runtime/composables/useRoles.d.ts +7 -0
- package/dist/runtime/composables/useRoles.js +39 -0
- package/dist/runtime/composables/useWebAuthn.d.ts +5 -0
- package/dist/runtime/composables/useWebAuthn.js +5 -0
- package/package.json +9 -9
package/dist/module.json
CHANGED
|
@@ -55,6 +55,7 @@ let my = reactive(tt.my);
|
|
|
55
55
|
const light = useLight();
|
|
56
56
|
light.devMode = tt.system.devMode;
|
|
57
57
|
light.init(my.styles);
|
|
58
|
+
light.setMyRoles(my.roles);
|
|
58
59
|
light.setPermissions(my.permissions);
|
|
59
60
|
light.setMyFavorites(toRaw(my.myFavorites));
|
|
60
61
|
const myFavorites = computed(() => {
|
|
@@ -7,20 +7,20 @@ const textColorRef = ref(null);
|
|
|
7
7
|
const textHightlightRef = ref(null);
|
|
8
8
|
const highlight = ref("#ffff00aa");
|
|
9
9
|
const foreColor = ref("#000000");
|
|
10
|
-
const TextColorCMD = (cmd, name) => {
|
|
10
|
+
const TextColorCMD = ((cmd, name) => {
|
|
11
11
|
const edit = editorRef.value;
|
|
12
12
|
textColorRef.value.hide();
|
|
13
13
|
edit.caret.restore();
|
|
14
14
|
edit.runCmd(cmd, name);
|
|
15
15
|
edit.focus();
|
|
16
|
-
};
|
|
17
|
-
const TextHightlightCMD = (cmd, name) => {
|
|
16
|
+
});
|
|
17
|
+
const TextHightlightCMD = ((cmd, name) => {
|
|
18
18
|
const edit = editorRef.value;
|
|
19
19
|
textHightlightRef.value.hide();
|
|
20
20
|
edit.caret.restore();
|
|
21
21
|
edit.runCmd(cmd, name);
|
|
22
22
|
edit.focus();
|
|
23
|
-
};
|
|
23
|
+
});
|
|
24
24
|
const emit = defineEmits(["update:modelValue"]);
|
|
25
25
|
const props = defineProps({
|
|
26
26
|
fullscreen: { type: Boolean, required: false, skipCheck: true },
|
|
@@ -12,6 +12,7 @@ const props = defineProps({
|
|
|
12
12
|
fillMask: { type: [Boolean, String], required: false, skipCheck: true },
|
|
13
13
|
reverseFillMask: { type: Boolean, required: false, skipCheck: true },
|
|
14
14
|
unmaskedValue: { type: Boolean, required: false, skipCheck: true },
|
|
15
|
+
maskTokens: { type: null, required: false },
|
|
15
16
|
modelValue: { type: null, required: true },
|
|
16
17
|
error: { type: [Boolean, null], required: false, skipCheck: true },
|
|
17
18
|
errorMessage: { type: null, required: false },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, reactive, onMounted, resolveComponent } from "vue";
|
|
3
3
|
import { useQuasar } from "quasar";
|
|
4
|
-
import { api, useHead
|
|
4
|
+
import { api, useHead } from "#imports";
|
|
5
5
|
import { useI18n } from "vue-i18n";
|
|
6
6
|
const { t } = useI18n();
|
|
7
7
|
const emits = defineEmits(["login"]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QDialogOptions, QNotifyCreateOptions
|
|
1
|
+
import type { QDialogOptions, QNotifyCreateOptions } from 'quasar';
|
|
2
2
|
declare module 'vue' {
|
|
3
3
|
interface ComponentCustomProperties {
|
|
4
4
|
$light: typeof light;
|
|
@@ -99,7 +99,7 @@ declare const light: {
|
|
|
99
99
|
increment: (amount?: number) => void;
|
|
100
100
|
setDefaults: (props: import("quasar").QLoadingBarOptions) => void;
|
|
101
101
|
};
|
|
102
|
-
notify: (opts: QNotifyCreateOptions | string) => (props?: QNotifyUpdateOptions) => void;
|
|
102
|
+
notify: (opts: QNotifyCreateOptions | string) => (props?: import("quasar").QNotifyUpdateOptions) => void;
|
|
103
103
|
platform: {
|
|
104
104
|
userAgent: string;
|
|
105
105
|
is: {
|
|
@@ -589,8 +589,9 @@ declare const light: {
|
|
|
589
589
|
isAdmin: boolean;
|
|
590
590
|
permissions: string[];
|
|
591
591
|
myFavorites: any[];
|
|
592
|
+
myRoles: string[];
|
|
592
593
|
$t: any;
|
|
593
|
-
notify: (opts: QNotifyCreateOptions | string) => (props?: QNotifyUpdateOptions) => void;
|
|
594
|
+
notify: (opts: QNotifyCreateOptions | string) => (props?: import("quasar").QNotifyUpdateOptions) => void;
|
|
594
595
|
dialog: (opts: QDialogOptions) => import("quasar").DialogChainObject;
|
|
595
596
|
users: {
|
|
596
597
|
create: (user: User) => Promise<User>;
|
|
@@ -603,6 +604,7 @@ declare const light: {
|
|
|
603
604
|
};
|
|
604
605
|
getColorValue: () => string;
|
|
605
606
|
setMyFavorites: (favorites: Array<any>) => void;
|
|
607
|
+
setMyRoles: (roles: Array<string>) => void;
|
|
606
608
|
reloadMyFavorites: () => Promise<void>;
|
|
607
609
|
getMyFavorites: () => any[];
|
|
608
610
|
isDarkMode: () => boolean;
|
|
@@ -703,7 +705,7 @@ declare const _default: () => {
|
|
|
703
705
|
increment: (amount?: number) => void;
|
|
704
706
|
setDefaults: (props: import("quasar").QLoadingBarOptions) => void;
|
|
705
707
|
};
|
|
706
|
-
notify: (opts: QNotifyCreateOptions | string) => (props?: QNotifyUpdateOptions) => void;
|
|
708
|
+
notify: (opts: QNotifyCreateOptions | string) => (props?: import("quasar").QNotifyUpdateOptions) => void;
|
|
707
709
|
platform: {
|
|
708
710
|
userAgent: string;
|
|
709
711
|
is: {
|
|
@@ -1193,8 +1195,9 @@ declare const _default: () => {
|
|
|
1193
1195
|
isAdmin: boolean;
|
|
1194
1196
|
permissions: string[];
|
|
1195
1197
|
myFavorites: any[];
|
|
1198
|
+
myRoles: string[];
|
|
1196
1199
|
$t: any;
|
|
1197
|
-
notify: (opts: QNotifyCreateOptions | string) => (props?: QNotifyUpdateOptions) => void;
|
|
1200
|
+
notify: (opts: QNotifyCreateOptions | string) => (props?: import("quasar").QNotifyUpdateOptions) => void;
|
|
1198
1201
|
dialog: (opts: QDialogOptions) => import("quasar").DialogChainObject;
|
|
1199
1202
|
users: {
|
|
1200
1203
|
create: (user: User) => Promise<User>;
|
|
@@ -1207,6 +1210,7 @@ declare const _default: () => {
|
|
|
1207
1210
|
};
|
|
1208
1211
|
getColorValue: () => string;
|
|
1209
1212
|
setMyFavorites: (favorites: Array<any>) => void;
|
|
1213
|
+
setMyRoles: (roles: Array<string>) => void;
|
|
1210
1214
|
reloadMyFavorites: () => Promise<void>;
|
|
1211
1215
|
getMyFavorites: () => any[];
|
|
1212
1216
|
isDarkMode: () => boolean;
|
|
@@ -74,6 +74,7 @@ const light = reactive({
|
|
|
74
74
|
isAdmin: false,
|
|
75
75
|
permissions: Array(),
|
|
76
76
|
myFavorites: Array(),
|
|
77
|
+
myRoles: Array(),
|
|
77
78
|
$t: null,
|
|
78
79
|
notify: (opts) => {
|
|
79
80
|
if (light.$q == null) {
|
|
@@ -158,6 +159,9 @@ const light = reactive({
|
|
|
158
159
|
setMyFavorites: (favorites) => {
|
|
159
160
|
light.myFavorites = favorites;
|
|
160
161
|
},
|
|
162
|
+
setMyRoles: (roles) => {
|
|
163
|
+
light.myRoles = roles;
|
|
164
|
+
},
|
|
161
165
|
reloadMyFavorites: async () => {
|
|
162
166
|
const data = await q({
|
|
163
167
|
my: {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import useLight from "./useLight.js";
|
|
3
|
+
import q from "./q.js";
|
|
4
|
+
export default function useRoles() {
|
|
5
|
+
const light = useLight();
|
|
6
|
+
const roles = computed(() => light.myRoles || []);
|
|
7
|
+
function hasRole(role) {
|
|
8
|
+
if (!role) return false;
|
|
9
|
+
if (light.isAdmin) return true;
|
|
10
|
+
return light.myRoles.includes(role);
|
|
11
|
+
}
|
|
12
|
+
function hasAny(...args) {
|
|
13
|
+
const list = Array.isArray(args[0]) ? args[0] : args;
|
|
14
|
+
if (light.isAdmin) return true;
|
|
15
|
+
return list.some((r) => light.myRoles.includes(r));
|
|
16
|
+
}
|
|
17
|
+
function hasAll(wanted = []) {
|
|
18
|
+
if (light.isAdmin) return true;
|
|
19
|
+
return wanted.every((r) => light.myRoles.includes(r));
|
|
20
|
+
}
|
|
21
|
+
async function reload() {
|
|
22
|
+
const data = await q({
|
|
23
|
+
my: {
|
|
24
|
+
roles
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const newRoles = (data?.my?.roles || []).map((r) => r.role || r);
|
|
28
|
+
light.myRoles = newRoles;
|
|
29
|
+
light.isAdmin = newRoles.includes("Administrators");
|
|
30
|
+
return newRoles;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
roles,
|
|
34
|
+
hasRole,
|
|
35
|
+
hasAny,
|
|
36
|
+
hasAll,
|
|
37
|
+
reload
|
|
38
|
+
};
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hostlink/nuxt-light",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.39.0",
|
|
4
4
|
"description": "HostLink Nuxt Light Framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,31 +32,31 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@azure/msal-browser": "^3.26.1",
|
|
34
34
|
"@formkit/drag-and-drop": "^0.5.3",
|
|
35
|
-
"@hostlink/light": "^2.
|
|
35
|
+
"@hostlink/light": "^2.9.0",
|
|
36
36
|
"@nuxt/module-builder": "^1.0.1",
|
|
37
|
-
"@quasar/extras": "^1.
|
|
37
|
+
"@quasar/extras": "^1.17.0",
|
|
38
38
|
"@quasar/quasar-ui-qmarkdown": "^2.0.5",
|
|
39
|
-
"axios": "^1.
|
|
39
|
+
"axios": "^1.12.2",
|
|
40
40
|
"defu": "^6.1.4",
|
|
41
41
|
"diff2html": "^3.4.47",
|
|
42
42
|
"formkit-quasar": "^0.0.15",
|
|
43
43
|
"json-to-graphql-query": "^2.2.5",
|
|
44
44
|
"nuxt-quasar-ui": "^2.1.12",
|
|
45
|
-
"quasar": "^2.
|
|
45
|
+
"quasar": "^2.18.5",
|
|
46
46
|
"vue-i18n": "^9.2.2",
|
|
47
47
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@nuxt/devtools": "latest",
|
|
51
51
|
"@nuxt/eslint-config": "^0.2.0",
|
|
52
|
-
"@nuxt/kit": "^4.
|
|
53
|
-
"@nuxt/schema": "^4.
|
|
52
|
+
"@nuxt/kit": "^4.1.2",
|
|
53
|
+
"@nuxt/schema": "^4.1.2",
|
|
54
54
|
"@nuxt/test-utils": "^3.17.2",
|
|
55
55
|
"@types/node": "^22.5.0",
|
|
56
56
|
"changelogen": "^0.5.4",
|
|
57
57
|
"eslint": "^8.46.0",
|
|
58
|
-
"nuxt": "^4.
|
|
59
|
-
"typescript": "^5.
|
|
58
|
+
"nuxt": "^4.1.2",
|
|
59
|
+
"typescript": "^5.9.2",
|
|
60
60
|
"vue-tsc": "^2.2.8"
|
|
61
61
|
}
|
|
62
62
|
}
|