@unsource/ui 2.7.7 → 2.7.9

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.9",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -6,6 +6,7 @@ export type TableCol = {
6
6
  key?: string | string[];
7
7
  subKey?: string | string[];
8
8
  class?: string;
9
+ classHandler?: () => string;
9
10
  dir?: string;
10
11
  isDesktop?: boolean;
11
12
  isMobile?: boolean;
@@ -14,6 +15,7 @@ type __VLS_Props = {
14
15
  cols?: TableCol[];
15
16
  items?: Record<string, unknown>[];
16
17
  thClass?: string;
18
+ trClass?: () => string;
17
19
  tdClass?: string;
18
20
  textClass?: string;
19
21
  boxMode?: boolean;
@@ -34,11 +36,7 @@ declare var __VLS_2: any, __VLS_3: {
34
36
  type __VLS_Slots = {} & {
35
37
  [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
36
38
  };
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>;
39
+ 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
40
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
43
41
  declare const _default: typeof __VLS_export;
44
42
  export default _default;
@@ -70,8 +70,10 @@
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
76
+ :tr-class
75
77
  :cols="cols"
76
78
  :td-class
77
79
  :text-class
@@ -98,6 +100,7 @@ const { parentKey, idKey, cols = [], items = [], thClass = "bg-gray-100 border-g
98
100
  cols: { type: Array, required: false },
99
101
  items: { type: Array, required: false },
100
102
  thClass: { type: String, required: false },
103
+ trClass: { type: Function, required: false },
101
104
  tdClass: { type: String, required: false },
102
105
  textClass: { type: String, required: false },
103
106
  boxMode: { type: Boolean, required: false },
@@ -105,6 +108,7 @@ const { parentKey, idKey, cols = [], items = [], thClass = "bg-gray-100 border-g
105
108
  idKey: { type: String, required: false },
106
109
  selectable: { type: Boolean, required: false }
107
110
  });
111
+ defineEmits(["click:row", "dbclick:row", "add:row"]);
108
112
  const selected = defineModel();
109
113
  const parentNotExist = (item) => !item[parentKey] || !items.find((e) => e[idKey || "id"] === item[parentKey]);
110
114
  </script>
@@ -6,6 +6,7 @@ export type TableCol = {
6
6
  key?: string | string[];
7
7
  subKey?: string | string[];
8
8
  class?: string;
9
+ classHandler?: () => string;
9
10
  dir?: string;
10
11
  isDesktop?: boolean;
11
12
  isMobile?: boolean;
@@ -14,6 +15,7 @@ type __VLS_Props = {
14
15
  cols?: TableCol[];
15
16
  items?: Record<string, unknown>[];
16
17
  thClass?: string;
18
+ trClass?: () => string;
17
19
  tdClass?: string;
18
20
  textClass?: string;
19
21
  boxMode?: boolean;
@@ -34,11 +36,7 @@ declare var __VLS_2: any, __VLS_3: {
34
36
  type __VLS_Slots = {} & {
35
37
  [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
36
38
  };
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>;
39
+ 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
40
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
43
41
  declare const _default: typeof __VLS_export;
44
42
  export default _default;
@@ -7,6 +7,8 @@ type __VLS_Props = {
7
7
  parentKey?: string;
8
8
  idKey?: string;
9
9
  tdClass?: string;
10
+ trClass?: () => string;
11
+ level?: number;
10
12
  };
11
13
  type __VLS_ModelProps = {
12
14
  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="[trClass?.(item, items), { '!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,7 +22,8 @@
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"
24
- :class="[col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
25
+ :style="{ paddingInlineStart: parentKey ? level * 10 + 5 + 'px' : 'unset' }"
26
+ :class="[col.classHandler?.(item, col, items, cols), col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
25
27
  :dir="col.dir"
26
28
  >
27
29
  <slot
@@ -62,9 +64,11 @@
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
71
+ :tr-class
68
72
  @click:row="$emit('click:row', i)"
69
73
  @dbclick:row="$emit('dbclick:row', i)"
70
74
  @add:row="$emit('add:row', i)"
@@ -74,15 +78,17 @@
74
78
 
75
79
  <script setup>
76
80
  import { _at, computed, ref } from "#imports";
77
- defineEmits(["click:row", "dbclick:row"]);
78
- const { parentKey, idKey = "id", item = {}, items = [] } = defineProps({
81
+ defineEmits(["click:row", "dbclick:row", "add:row"]);
82
+ const { level = 0, parentKey, idKey = "id", item = {}, items = [] } = defineProps({
79
83
  item: { type: null, required: false },
80
84
  items: { type: Array, required: false },
81
85
  cols: { type: Array, required: true },
82
86
  textClass: { type: String, required: false },
83
87
  parentKey: { type: String, required: false },
84
88
  idKey: { type: String, required: false },
85
- tdClass: { type: String, required: false }
89
+ tdClass: { type: String, required: false },
90
+ trClass: { type: Function, required: false },
91
+ level: { type: Number, required: false }
86
92
  });
87
93
  const open = ref(false);
88
94
  const selected = defineModel();
@@ -7,6 +7,8 @@ type __VLS_Props = {
7
7
  parentKey?: string;
8
8
  idKey?: string;
9
9
  tdClass?: string;
10
+ trClass?: () => string;
11
+ level?: number;
10
12
  };
11
13
  type __VLS_ModelProps = {
12
14
  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.9",
4
4
  "private": false,
5
5
  "description": "nuxt ui kit for unsource env",
6
6
  "repository": "https://github.com/alisa2142/unsource-ui",