@hostlink/nuxt-light 1.52.2 → 1.52.4

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,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.52.2",
4
+ "version": "1.52.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -0,0 +1,12 @@
1
+ declare var __VLS_6: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_6) => any;
4
+ };
5
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
7
+ export default _default;
8
+ type __VLS_WithSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <q-btn flat round size="sm">
3
+ <slot></slot>
4
+ </q-btn>
5
+ </template>
@@ -0,0 +1,12 @@
1
+ declare var __VLS_6: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_6) => any;
4
+ };
5
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
7
+ export default _default;
8
+ type __VLS_WithSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };
@@ -9,8 +9,8 @@ type __VLS_Slots = {} & {
9
9
  default?: (props: typeof __VLS_1) => any;
10
10
  };
11
11
  declare const __VLS_component: import("vue").DefineComponent<LColProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LColProps> & Readonly<{}>, {
12
- xs: number | string;
13
12
  sm: number | string;
13
+ xs: number | string;
14
14
  md: number | string;
15
15
  gutter: "xs" | "sm" | "md" | "lg" | "xl" | "none";
16
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -9,8 +9,8 @@ type __VLS_Slots = {} & {
9
9
  default?: (props: typeof __VLS_1) => any;
10
10
  };
11
11
  declare const __VLS_component: import("vue").DefineComponent<LColProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LColProps> & Readonly<{}>, {
12
- xs: number | string;
13
12
  sm: number | string;
13
+ xs: number | string;
14
14
  md: number | string;
15
15
  gutter: "xs" | "sm" | "md" | "lg" | "xl" | "none";
16
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -62,16 +62,12 @@ const lastPart = computed(() => {
62
62
 
63
63
  <template>
64
64
  <q-page :padding="padding" class="q-pt-sm">
65
-
66
-
67
-
68
65
  <q-toolbar v-if="showToolbar">
69
66
  <l-back-btn v-if="backBtn" dense />
70
67
  <l-add-btn v-if="addBtn" dense />
71
68
  <l-edit-btn v-if="editBtn" dense />
72
69
  <l-delete-btn v-if="deleteBtn" @submit="onDelete" dense />
73
70
  <q-toolbar-title>{{ $t(title) }}</q-toolbar-title>
74
-
75
71
  <q-breadcrumbs v-if="breadcrumbs">
76
72
  <q-breadcrumbs-el :label="$t('Home')" to="/" icon="home" />
77
73
  <q-breadcrumbs-el :label="$t(title)" :to="'/' + route.path.split('/')[1]"
@@ -399,6 +399,9 @@ const onDelete = async (id) => {
399
399
  };
400
400
  const attrs = computed(() => {
401
401
  const a = { ...light.styles.table, ...Object.fromEntries(Object.entries(props).filter(([key, value]) => value !== void 0)) };
402
+ if (props.name) {
403
+ a.visibleColumns = visibleColumns.value;
404
+ }
402
405
  return {
403
406
  ...a,
404
407
  loadingLabel: t(props.loadingLabel),
@@ -423,7 +426,7 @@ const hasRowExpand = computed(() => {
423
426
  return ss.indexOf("row-expand") >= 0;
424
427
  });
425
428
  const hasActions = computed(() => {
426
- return props.actions.length > 0;
429
+ return props.actions.length > 0 || ss.indexOf("actions") >= 0;
427
430
  });
428
431
  const getCellStyle = (col, row) => {
429
432
  const style = col.cellStyle ?? {};
@@ -491,7 +494,21 @@ const showTopRight = computed(() => {
491
494
  const hidableColumns = computed(() => {
492
495
  return props.columns?.filter((c) => !c.required) || [];
493
496
  });
494
- const visibleColumns = props.name ? useStorage("l-table-visible-columns-" + simpleRouteName.value + "-" + props.name, hidableColumns.value.map((c) => c.name)) : ref(hidableColumns.value.map((c) => c.name));
497
+ const visibleColumns = computed({
498
+ get() {
499
+ if (props.name) {
500
+ return useStorage("l-table-visible-columns-" + simpleRouteName.value + "-" + props.name, hidableColumns.value.map((c) => c.name)).value;
501
+ } else {
502
+ return null;
503
+ }
504
+ },
505
+ set(value) {
506
+ if (props.name) {
507
+ const storage = useStorage("l-table-visible-columns-" + simpleRouteName.value + "-" + props.name, hidableColumns.value.map((c) => c.name));
508
+ storage.value = value;
509
+ }
510
+ }
511
+ });
495
512
  watch(filters, () => {
496
513
  onFilters();
497
514
  }, { deep: true });
@@ -504,13 +521,12 @@ const hasFilters = computed(() => {
504
521
 
505
522
  <template>
506
523
  <q-table v-bind="attrs" :loading="loading" :rows="rows" ref="table" @request="onLocalRequest" :columns="columns"
507
- v-model:pagination="pagination" :filter="filter" v-model:selected="localSelected"
508
- :visible-columns="visibleColumns">
524
+ v-model:pagination="pagination" :filter="filter" v-model:selected="localSelected">
509
525
  <template #header="props">
510
526
  <q-tr :props="props">
511
- <q-td v-if="selection != 'none'" auto-width>
512
- <q-checkbox v-model="props.selected" />
513
- </q-td>
527
+ <q-th v-if="selection != 'none'" auto-width>
528
+ <q-checkbox v-model="props.selected" :dense="table?.dense" />
529
+ </q-th>
514
530
  <q-th v-if="hasRowExpand" auto-width></q-th>
515
531
  <q-th v-if="hasActions" auto-width></q-th>
516
532
  <q-th v-for="col in props.cols" :key="col.name" :props="props">{{ col.label }}</q-th>
@@ -535,7 +551,7 @@ const hasFilters = computed(() => {
535
551
  <template #body="props">
536
552
  <q-tr :props="props">
537
553
  <q-td v-if="selection != 'none'" auto-width>
538
- <q-checkbox v-model="props.selected" />
554
+ <q-checkbox v-model="props.selected" :dense="table?.dense" />
539
555
  </q-td>
540
556
  <q-td v-if="hasRowExpand" auto-width>
541
557
  <q-btn flat round size="sm" :icon="props.expand ? 'sym_o_expand_more' : 'sym_o_expand_less'"
@@ -545,11 +561,11 @@ const hasFilters = computed(() => {
545
561
  <q-td v-if="hasActions" auto-width>
546
562
  <div :class="{ 'text-grey-8': !isDark }" v-if="primaryKey">
547
563
 
548
- <l-view-btn v-if="actionView && props.row.canView"
549
- :to="`/${modelName}/${props.row[primaryKey]}/view`" size="sm" />
564
+ <l-action-btn v-if="actionView && props.row.canView"
565
+ :to="`/${modelName}/${props.row[primaryKey]}/view`" icon="sym_o_search" />
550
566
 
551
- <l-edit-btn v-if="activeEdit && props.row.canUpdate"
552
- :to="`/${modelName}/${props.row[primaryKey]}/edit`" size="sm" />
567
+ <l-action-btn v-if="activeEdit && props.row.canUpdate"
568
+ :to="`/${modelName}/${props.row[primaryKey]}/edit`" icon="sym_o_edit" />
553
569
 
554
570
  <l-delete-btn v-if="actionDelete && props.row.canDelete"
555
571
  @submit="onDelete(props.row[primaryKey])" size="sm"></l-delete-btn>
@@ -0,0 +1,7 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ status?: number | undefined;
3
+ $props: {
4
+ readonly status?: number | undefined;
5
+ };
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ export default _default;
@@ -0,0 +1,28 @@
1
+ <script setup>
2
+ import { model } from "#imports";
3
+ const props = defineProps({
4
+ status: Number
5
+ });
6
+ const onRequest = async (request) => {
7
+ const filters = {};
8
+ if (props.status >= 0) {
9
+ filters.status = props.status;
10
+ }
11
+ request.loadObjects("User", filters);
12
+ };
13
+ const columns = model("User").columns({
14
+ username: true,
15
+ first_name: true,
16
+ label_name: true,
17
+ email: true,
18
+ phone: true,
19
+ join_date: true,
20
+ has2FA: true
21
+ });
22
+ </script>
23
+
24
+ <template>
25
+ <l-table ref="table" row-key="user_id" @request-data="onRequest" :columns="columns"
26
+ :actions="['view', 'update', 'delete']">
27
+ </l-table>
28
+ </template>
@@ -0,0 +1,7 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ status?: number | undefined;
3
+ $props: {
4
+ readonly status?: number | undefined;
5
+ };
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ export default _default;
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, ref } from "vue";
3
- import { useDragAndDrop, dragAndDrop } from "@formkit/drag-and-drop/vue";
3
+ import { useDragAndDrop } from "@formkit/drag-and-drop/vue";
4
4
  import { animations } from "@formkit/drag-and-drop";
5
5
  const props = defineProps({
6
6
  context: Object
@@ -10,6 +10,9 @@ const min = props.context.node.props.min ?? 1;
10
10
  const max = props.context.node.props.max ?? Infinity;
11
11
  const sortable = props.context.node.props.sortable !== void 0 ? props.context.node.props.sortable : true;
12
12
  const addLabel = props.context.node.props.addLabel ?? "Add";
13
+ if (!props.context.value) {
14
+ await node.input([]);
15
+ }
13
16
  const [parent, localValue] = useDragAndDrop(props.context.value, {
14
17
  dragHandle: ".l-repeater-handle",
15
18
  plugins: [animations()]
@@ -61,8 +64,8 @@ const cursor = ref("cursor-grab");
61
64
  </style>
62
65
 
63
66
  <template>
64
- <div class="col col-12 ">
65
- <FormKit type="list" v-model="localValue" dynamic #default="{ items, node }" :name="node.name">
67
+ <FormKit type="list" v-model="localValue" dynamic #default="{ items, node }" :name="node.name">
68
+ <div class="col col-12">
66
69
  <q-list bordered separator ref="parent">
67
70
  <FormKit type="group" v-for="(item, index) in items" :index="index" :key="item" #default="{ node }">
68
71
  <q-item class="q-pa-xs">
@@ -95,6 +98,6 @@ const cursor = ref("cursor-grab");
95
98
  </q-list>
96
99
  <q-btn @click="onAdd" :label="addLabel" icon="sym_o_add" color="primary" outline class="q-mt-sm"
97
100
  :disable="localValue.length >= max" />
98
- </FormKit>
99
- </div>
101
+ </div>
102
+ </FormKit>
100
103
  </template>
@@ -1,41 +1,12 @@
1
- <script setup>
2
- import { ref } from "vue";
3
- const status = ref("active");
4
- import { model } from "#imports";
5
- const onRequest = async (request) => {
6
- const filters = {};
7
- if (status.value === "active") {
8
- filters["status"] = 0;
9
- } else if (status.value === "inactive") {
10
- filters["status"] = 1;
11
- }
12
- request.loadObjects("User", filters);
13
- };
14
- const columns = model("User").columns({
15
- username: true,
16
- first_name: true,
17
- label_name: true,
18
- email: true,
19
- phone: true,
20
- join_date: true,
21
- has2FA: true
22
- });
23
- const selectedRows = ref([]);
24
- </script>
25
-
26
- <template>
1
+ <template>
27
2
  <l-page>
28
- <l-tabs route v-model="status">
3
+ <l-tabs route>
29
4
  <l-tab label="Active" name="active">
30
- <l-table ref="table" row-key="user_id" @request-data="onRequest" :columns="columns" name="user-active"
31
- :actions="['view', 'update', 'delete']">
32
- </l-table>
5
+ <user-list :status="0" name="user-active" />
33
6
  </l-tab>
34
7
  <l-tab label="Inactive" name="inactive">
35
- <l-table row-key="user_id" @request-data="onRequest" :columns="columns" name="user-inactive"
36
- :actions="['view', 'update', 'delete']">
37
- </l-table>
8
+ <user-list :status="1" name="user-inactive" />
38
9
  </l-tab>
39
10
  </l-tabs>
40
11
  </l-page>
41
- </template>
12
+ </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.52.2",
3
+ "version": "1.52.4",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- export {};
File without changes