@unsource/ui 2.7.7 → 2.7.8

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": "unsource-ui",
3
3
  "configKey": "unsourceUi",
4
- "version": "2.7.7",
4
+ "version": "2.7.8",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -34,11 +34,7 @@ declare var __VLS_2: any, __VLS_3: {
34
34
  type __VLS_Slots = {} & {
35
35
  [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
36
36
  };
37
- declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
38
- "update:modelValue": (value: any) => any;
39
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
41
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
38
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
43
39
  declare const _default: typeof __VLS_export;
44
40
  export default _default;
@@ -70,6 +70,7 @@
70
70
  v-for="(item, index) in items?.filter((e) => !parentKey || parentNotExist(e))"
71
71
  :key="index"
72
72
  v-model="selected"
73
+ :level="0"
73
74
  :item="item"
74
75
  :items
75
76
  :cols="cols"
@@ -105,6 +106,7 @@ const { parentKey, idKey, cols = [], items = [], thClass = "bg-gray-100 border-g
105
106
  idKey: { type: String, required: false },
106
107
  selectable: { type: Boolean, required: false }
107
108
  });
109
+ defineEmits(["click:row", "dbclick:row", "add:row"]);
108
110
  const selected = defineModel();
109
111
  const parentNotExist = (item) => !item[parentKey] || !items.find((e) => e[idKey || "id"] === item[parentKey]);
110
112
  </script>
@@ -34,11 +34,7 @@ declare var __VLS_2: any, __VLS_3: {
34
34
  type __VLS_Slots = {} & {
35
35
  [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
36
36
  };
37
- declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
38
- "update:modelValue": (value: any) => any;
39
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
41
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
38
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
43
39
  declare const _default: typeof __VLS_export;
44
40
  export default _default;
@@ -7,6 +7,7 @@ type __VLS_Props = {
7
7
  parentKey?: string;
8
8
  idKey?: string;
9
9
  tdClass?: string;
10
+ level?: number;
10
11
  };
11
12
  type __VLS_ModelProps = {
12
13
  modelValue?: any;
@@ -1,14 +1,15 @@
1
1
  <template>
2
2
  <tr
3
3
  class="children:p-3 <md:children:p-1 text-center border-b-(2 solid border) hover:bg-primary/10"
4
- :class="{ '!bg-primary/20': selected?.id === item.id }"
4
+ :class="{ '!bg-primary/20': selected?.[idKey] === item[idKey] }"
5
5
  @click="$emit('click:row', item);
6
6
  selected = item"
7
7
  @dbclick="$emit('dbclick:row', item)"
8
8
  >
9
9
  <td
10
10
  v-if="parentKey"
11
- class="!max-w-1 !w-1 !p-1"
11
+ class="!max-w-1 !w-1"
12
+ :style="{ paddingInlineStart: level * 10 + 5 + 'px' }"
12
13
  >
13
14
  <UnNuxtIcon
14
15
  v-if="subItems?.length"
@@ -21,6 +22,7 @@
21
22
  v-for="col in cols.filter((e) => !e.disabled)"
22
23
  :key="col.name + '-td'"
23
24
  class="text-gray-400 text-sm text-center first:rounded-l-lg last:rounded-r-lg"
25
+ :style="{ paddingInlineStart: parentKey ? level * 10 + 5 + 'px' : 'unset' }"
24
26
  :class="[col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
25
27
  :dir="col.dir"
26
28
  >
@@ -62,6 +64,7 @@
62
64
  :items
63
65
  :cols
64
66
  :parent-key
67
+ :level="level + 1"
65
68
  :id-key
66
69
  :text-class
67
70
  :td-class
@@ -74,15 +77,16 @@
74
77
 
75
78
  <script setup>
76
79
  import { _at, computed, ref } from "#imports";
77
- defineEmits(["click:row", "dbclick:row"]);
78
- const { parentKey, idKey = "id", item = {}, items = [] } = defineProps({
80
+ defineEmits(["click:row", "dbclick:row", "add:row"]);
81
+ const { level = 0, parentKey, idKey = "id", item = {}, items = [] } = defineProps({
79
82
  item: { type: null, required: false },
80
83
  items: { type: Array, required: false },
81
84
  cols: { type: Array, required: true },
82
85
  textClass: { type: String, required: false },
83
86
  parentKey: { type: String, required: false },
84
87
  idKey: { type: String, required: false },
85
- tdClass: { type: String, required: false }
88
+ tdClass: { type: String, required: false },
89
+ level: { type: Number, required: false }
86
90
  });
87
91
  const open = ref(false);
88
92
  const selected = defineModel();
@@ -7,6 +7,7 @@ type __VLS_Props = {
7
7
  parentKey?: string;
8
8
  idKey?: string;
9
9
  tdClass?: string;
10
+ level?: number;
10
11
  };
11
12
  type __VLS_ModelProps = {
12
13
  modelValue?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsource/ui",
3
- "version": "2.7.7",
3
+ "version": "2.7.8",
4
4
  "private": false,
5
5
  "description": "nuxt ui kit for unsource env",
6
6
  "repository": "https://github.com/alisa2142/unsource-ui",