@hostlink/nuxt-light 1.8.13 → 1.9.1

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.8.13"
4
+ "version": "1.9.1"
5
5
  }
@@ -1,9 +1,26 @@
1
1
  <script setup lang="ts">
2
- import type { QTabPanelProps } from 'quasar';
3
- defineProps<QTabPanelProps>()
2
+ import type { QTabPanelProps, QTabProps } from 'quasar';
3
+ import { getCurrentInstance } from 'vue';
4
+ defineProps<QTabPanelProps | QTabProps>()
5
+ const instance = getCurrentInstance();
6
+
7
+ // check parent is q-tab-panels or q-tabs
8
+
9
+ const parent_type = instance?.parent?.type.name
10
+
11
+
4
12
  </script>
5
13
  <template>
6
- <q-tab-panel :name="name">
7
- <slot></slot>
8
- </q-tab-panel>
14
+ <template v-if="parent_type == 'QTabPanels'">
15
+ <q-tab-panel :name="name">
16
+ <slot></slot>
17
+ </q-tab-panel>
18
+ </template>
19
+
20
+ <template v-if="parent_type == 'QTabs'">
21
+ <q-tab v-bind="$props">
22
+ </q-tab>
23
+ </template>
24
+
25
+
9
26
  </template>
@@ -1,37 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { useSlots } from 'vue';
3
2
  import type { QTabsProps } from 'quasar';
4
3
 
5
4
  const model = defineModel<string | number | null | undefined>()
6
5
  interface LTabsProps extends QTabsProps {
7
-
8
6
  }
9
7
 
10
- defineProps<LTabsProps>()
11
-
12
- const slots = useSlots();
13
- const defaultSlots = slots.default ? slots.default() : []
14
-
15
8
 
16
- const LTab = resolveComponent("l-tab")
17
- //get the tabs from the default slot
18
- let name = 0;
19
- const tabContents = defaultSlots.filter((slot) => {
20
- return slot.type === LTab
21
- }).map((slot) => {
22
- const n = slot.props?.name || name++;
23
- return {
24
- label: slot.props?.label,
25
- content: slot.children,
26
- name: n.toString()
27
- }
28
- })
29
-
30
- if (model.value === null || model.value === undefined) {
31
- if (tabContents.length > 0) {
32
- model.value = tabContents[0].name
33
- }
34
- }
9
+ defineProps<LTabsProps>()
35
10
 
36
11
  </script>
37
12
 
@@ -39,10 +14,12 @@ if (model.value === null || model.value === undefined) {
39
14
  <l-card>
40
15
  <q-tabs class="text-grey" :active-color="$light.color" :indicator-color="$light.color" align="justify"
41
16
  v-model="model">
42
- <q-tab v-for="tab in tabContents" :label="$t(tab.label)" :name="tab.name"></q-tab>
17
+
18
+ <slot></slot>
43
19
  </q-tabs>
44
20
  <q-tab-panels v-model="model">
45
- <component v-for="tab in tabContents" :key="tab.name" :is="tab.content?.default" :name="tab.name" />
21
+ <slot></slot>
22
+ <!-- component v-for="tab in tabContents" :key="tab.name" :is="tab.content?.default" :name="tab.name" /-->
46
23
  </q-tab-panels>
47
24
  </l-card>
48
25
  </template>
@@ -145,10 +145,17 @@ const app = reactive({
145
145
  isGranted(right) {
146
146
  if (right === void 0)
147
147
  return true;
148
- if (app.isAdmin)
148
+ if (app.permissions.includes("*"))
149
149
  return true;
150
150
  if (app.permissions.includes(right))
151
151
  return true;
152
+ const parts = right.split(".");
153
+ parts.pop();
154
+ do {
155
+ if (app.permissions.includes(parts.join(".") + ".*"))
156
+ return true;
157
+ parts.pop();
158
+ } while (parts.length > 0);
152
159
  return false;
153
160
  },
154
161
  setPermissions(permissions) {
@@ -1,7 +1,10 @@
1
1
  <script setup>
2
+ import { useI18n } from 'vue-i18n'
2
3
  import { q, m } from '#imports'
3
4
  import { useRouter, useRoute } from "vue-router"
4
5
  import { Notify } from 'quasar';
6
+ import { computed } from 'vue'
7
+ const { t } = useI18n()
5
8
 
6
9
  const system = await q("system", ["passwordPolicy"]);
7
10
  const router = useRouter();
@@ -18,17 +21,42 @@ const onSubmit = async (data) => {
18
21
  color: "positive",
19
22
  icon: "check"
20
23
  });
21
-
24
+
22
25
  router.push("/User");
23
26
  });
24
27
  }
25
28
 
29
+ const policies = computed(() => {
30
+ return system.passwordPolicy.split("|").map((policy) => {
31
+ let name = policy.split(":")[0]
32
+
33
+ if (name == "length") {
34
+ return t('Must contain at least {0} characters', [policy.split(":")[1]]);
35
+ }
36
+
37
+ return t(name);
38
+ })
39
+ })
40
+
41
+
26
42
  </script>
27
43
  <template>
28
44
  <l-page>
29
45
  <FormKit type="l-form" @submit="onSubmit">
30
46
  <FormKit type="l-input" name="password" :validation="system.passwordPolicy" label="Password"
31
- input-type="password"></FormKit>
47
+ input-type="password" show-password></FormKit>
48
+
49
+
32
50
  </FormKit>
51
+
52
+ <q-card flat>
53
+ <q-card-section>
54
+ <div>{{ $t('Password policy') }}</div>
55
+ <ul>
56
+ <li v-for="policy in policies" :key="policy">{{ policy }}</li>
57
+ </ul>
58
+
59
+ </q-card-section>
60
+ </q-card>
33
61
  </l-page>
34
62
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.8.13",
3
+ "version": "1.9.1",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",