@hostlink/nuxt-light 0.0.45 → 0.0.47

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": "0.0.45"
4
+ "version": "0.0.47"
5
5
  }
package/dist/module.mjs CHANGED
@@ -53,7 +53,8 @@ const module = defineNuxtModule({
53
53
  { name: "t", from },
54
54
  { name: "updateObject", from },
55
55
  { name: "listObject", from },
56
- { name: "useLight", from: index }
56
+ { name: "useLight", from: index },
57
+ { name: "isGranted", from }
57
58
  ]);
58
59
  addPlugin({
59
60
  src: resolver.resolve("./runtime/plugin"),
@@ -1,6 +1,17 @@
1
1
  <script setup>
2
- defineProps(["modelValue"])
2
+ import { computed } from "vue";
3
+
4
+ const emit = defineEmits(["update:modelValue"]);
5
+ const props = defineProps(["modelValue", "label"])
6
+
7
+ const localValue = computed({
8
+ get: () => props.modelValue,
9
+ set: (value) => {
10
+ // popup.value.hide();
11
+ emit('update:modelValue', value)
12
+ }
13
+ });
3
14
  </script>
4
15
  <template>
5
- <q-checkbox v-model="modelValue" />
16
+ <q-checkbox v-model="localValue" :label="$t(label)" />
6
17
  </template>
@@ -17,8 +17,8 @@ const props = defineProps({
17
17
  },
18
18
  label: {
19
19
  type: String,
20
- default: ""
21
20
  },
21
+
22
22
  required: {
23
23
  type: Boolean,
24
24
  default: false
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { useQuasar, QTable } from 'quasar';
3
3
  import { useRoute } from 'vue-router';
4
- import { ref, computed, onMounted, useSlots, reactive } from "vue";
4
+ import { ref, computed, onMounted, useSlots, reactive, useAttrs } from "vue";
5
5
  import { t, deleteObject, q, f, useLight } from '../';
6
6
 
7
7
  const route = useRoute();
@@ -9,7 +9,6 @@ const module = route.path.split("/")[1];
9
9
  const errors = ref<InstanceType<any>>([]);
10
10
 
11
11
  const light = useLight();
12
-
13
12
  const props = defineProps({
14
13
  columns: {
15
14
  type: Array<{
@@ -350,9 +349,6 @@ const onDelete = async (id: any) => {
350
349
 
351
350
 
352
351
  //style
353
- const dense = light.getStyle("tableDense", false);
354
- const flat = light.getStyle("tableFlat", true);
355
- const bordered = light.getStyle("tableBorder", true);
356
352
 
357
353
  let rowsPerPageOptions = [3, 5, 7, 10, 15, 20, 25, 50, 0];
358
354
  if (props.pagination == false) {
@@ -361,6 +357,16 @@ if (props.pagination == false) {
361
357
  rowsPerPageOptions = [0]
362
358
  }
363
359
 
360
+
361
+ const attrs = {
362
+ ...{
363
+ dense: light.getStyle("tableDense", false),
364
+ flat: light.getStyle("tableFlat", true),
365
+ bordered: light.getStyle("tableBorder", true),
366
+ },
367
+ ...useAttrs()
368
+ }
369
+
364
370
  </script>
365
371
  <template>
366
372
  <template v-if="errors.length > 0">
@@ -371,11 +377,17 @@ if (props.pagination == false) {
371
377
  </div>
372
378
  </template>
373
379
 
374
- <q-table :flat="flat" :bordered="bordered" :dense="dense" v-model:pagination="pagination" ref="table" :loading="loading"
380
+
381
+ {{ attrs }}
382
+
383
+ <q-table v-bind="$attrs"
384
+ :flat="attrs.flat"
385
+ :dense="attrs.dense"
386
+ :bordered="attrs.bordered"
387
+
388
+ :loading="loading" :hide-bottom="hideBottom" v-model:pagination="pagination" ref="table"
375
389
  @request="onRequest" :selection="selection" :rows="rows" :rows-per-page-label="t(props.rowsPerPageLabel)"
376
- :hide-bottom="hideBottom" :columns="renderColumns"
377
- :rows-per-page-options="rowsPerPageOptions"
378
- >
390
+ :columns="renderColumns" :rows-per-page-options="rowsPerPageOptions">
379
391
 
380
392
  <template v-for="s in ss" v-slot:[s]="props">
381
393
  <slot :name="s" v-bind="props"></slot>
@@ -8,6 +8,13 @@ const props = defineProps({
8
8
  }, required: {
9
9
  type: Boolean,
10
10
  default: false
11
+ },
12
+ label: {
13
+ type: String,
14
+ },
15
+ hint: {
16
+ type: String,
17
+ default: ""
11
18
  }
12
19
  });
13
20
 
@@ -21,7 +28,8 @@ const localValue = computed({
21
28
  }
22
29
  });
23
30
 
24
- const rules = ["time"];
31
+ const rules = ["timeOrFulltime"];
32
+ //const rules = [];
25
33
  if (props.required) {
26
34
  rules.push(val => !!val || 'Required.');
27
35
  }
@@ -29,10 +37,9 @@ if (props.required) {
29
37
 
30
38
 
31
39
 
32
-
33
40
  </script>
34
41
  <template>
35
- <q-input v-model="localValue" mask="time" :rules="rules">
42
+ <q-input v-model="localValue" mask="time" :rules="rules" :label="$t(label)" :hint="$t(hint)">
36
43
  <template v-slot:prepend>
37
44
  <q-btn icon="sym_o_access_time" round dense flat>
38
45
  <q-popup-proxy cover transition-show="scale" transition-hide="scale" ref="popup">
@@ -15,6 +15,7 @@ import deleteObject from "./deleteObject";
15
15
  import t from "./t";
16
16
  import updateObject from "./updateObject";
17
17
  import listObject from "./listObject";
18
+ import isGranted from "./isGranted";
18
19
  declare const notify: (message: string, color?: string) => void;
19
20
  import getID from "./getID";
20
- export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject };
21
+ export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject, isGranted };
@@ -16,6 +16,7 @@ import deleteObject from "./deleteObject.mjs";
16
16
  import t from "./t.mjs";
17
17
  import updateObject from "./updateObject.mjs";
18
18
  import listObject from "./listObject.mjs";
19
+ import isGranted from "./isGranted.mjs";
19
20
  const notify = function(message, color = "green") {
20
21
  Notify.create({
21
22
  message,
@@ -24,4 +25,25 @@ const notify = function(message, color = "green") {
24
25
  });
25
26
  };
26
27
  import getID from "./getID.mjs";
27
- export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, login, m, mutation, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject };
28
+ export {
29
+ addObject,
30
+ f,
31
+ getApiUrl,
32
+ getCurrentUser,
33
+ getObject,
34
+ id,
35
+ list,
36
+ listData,
37
+ login,
38
+ m,
39
+ mutation,
40
+ q,
41
+ removeObject,
42
+ t,
43
+ updateObject,
44
+ notify,
45
+ getID,
46
+ deleteObject,
47
+ listObject,
48
+ isGranted
49
+ };
@@ -0,0 +1 @@
1
+ export default function isGranted(right: string): Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ export default async function isGranted(right) {
2
+ const my = await q("my", [f("granted", { right }, [])]);
3
+ return my.granted;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",