@unsource/ui 2.3.2 → 2.4.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,7 +1,7 @@
1
1
  {
2
2
  "name": "unsource-ui",
3
3
  "configKey": "unsourceUi",
4
- "version": "2.3.2",
4
+ "version": "2.4.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -80,6 +80,7 @@
80
80
  </template>
81
81
 
82
82
  <script setup>
83
+ import { ref, usePost } from "#imports";
83
84
  const emit = defineEmits(["select", "update:modelValue"]);
84
85
  const props = defineProps({
85
86
  label: { type: String, required: false },
@@ -0,0 +1,43 @@
1
+ type __VLS_Props = {
2
+ cols?: {
3
+ title: string;
4
+ name: string;
5
+ disabled?: boolean;
6
+ key?: string | string[];
7
+ subKey?: string | string[];
8
+ class?: string;
9
+ dir?: string;
10
+ isDesktop?: boolean;
11
+ isMobile?: boolean;
12
+ }[];
13
+ items?: Record<string, unknown>[];
14
+ thClass?: string;
15
+ tdClass?: string;
16
+ textClass?: string;
17
+ boxMode?: boolean;
18
+ };
19
+ declare var __VLS_2: any, __VLS_3: {
20
+ col: any;
21
+ item: any;
22
+ items: any;
23
+ index: any;
24
+ }, __VLS_6: any, __VLS_7: {
25
+ col: any;
26
+ item: any;
27
+ items: any;
28
+ index: any;
29
+ };
30
+ type __VLS_Slots = {} & {
31
+ [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
32
+ } & {
33
+ [K in NonNullable<typeof __VLS_6>]?: (props: typeof __VLS_7) => any;
34
+ };
35
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
39
+ type __VLS_WithSlots<T, S> = T & {
40
+ new (): {
41
+ $slots: S;
42
+ };
43
+ };
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <div class="flex flex-col justify-start min-h-50 <md:(max-w-screen overflow-x-auto)">
3
+ <div
4
+ v-if="boxMode"
5
+ class="flex flex-col gap-2 h-full"
6
+ >
7
+ <div
8
+ v-for="(item, index) in items"
9
+ :key="index"
10
+ class="flex flex-col gap-1 pb-2 border-b-(1 solid gray-400)"
11
+ @click="$emit('click:row', item)"
12
+ >
13
+ <div
14
+ v-for="col in cols.filter((e) => !e.disabled)"
15
+ :key="col.name"
16
+ class="flex items-center gap-2"
17
+ >
18
+ <div class="text-xs text-gray-600 font-medium text-left">
19
+ {{ col.title }}
20
+ </div>
21
+ <div class="border-t-(dashed gray-600 1) grow" />
22
+ <div class="text-gray-400 text-sm text-right">
23
+ <slot
24
+ :name="col.name"
25
+ :col="col"
26
+ :item="item"
27
+ :items="_at(item, col.key)"
28
+ :index="index"
29
+ >
30
+ <div class="flex flex-col gap-0.5">
31
+ <p :class="textClass">
32
+ {{ _at(item, col.key).join(" ") }}
33
+ </p>
34
+ <small
35
+ v-if="col.subKey?.length"
36
+ class="font-500 text-gray-600 text-xs"
37
+ >{{ _at(item, col.subKey).join(" ") }}</small>
38
+ </div>
39
+ </slot>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <table
45
+ v-else
46
+ class="border-spacing-x-0 border-spacing-y-1"
47
+ >
48
+ <thead>
49
+ <tr class="border-b-2 children:(text-center p-4) rounded-lg <md:children:p-1 ">
50
+ <th
51
+ v-for="col in cols.filter((e) => !e.disabled)"
52
+ :key="col.name + '-th'"
53
+ :class="[{ '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, `w-${cols.length}`, thClass, 'sticky top-0']"
54
+ class="text-xs text-gray-600 font-medium text-center first:rounded-l-lg last:rounded-r-lg"
55
+ >
56
+ {{ col.title }}
57
+ </th>
58
+ </tr>
59
+ </thead>
60
+ <tbody>
61
+ <tr
62
+ v-for="(item, index) in items"
63
+ :key="index"
64
+ class="children:p-3 <md:children:p-1 text-center children:(border-b border-gray-100)"
65
+ @click="$emit('click:row', item)"
66
+ >
67
+ <td
68
+ v-for="col in cols.filter((e) => !e.disabled)"
69
+ :key="col.name + '-td'"
70
+ class="text-gray-400 text-sm text-center first:rounded-l-lg last:rounded-r-lg"
71
+ :class="[col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
72
+ :dir="col.dir"
73
+ >
74
+ <slot
75
+ :name="col.name"
76
+ :col="col"
77
+ :item="item"
78
+ :items="_at(item, col.key)"
79
+ :index="index"
80
+ >
81
+ <div class="flex flex-col gap-0.5">
82
+ <p :class="textClass">
83
+ {{ _at(item, col.key).join(" ") }}
84
+ </p>
85
+ <small
86
+ v-if="col.subKey?.length"
87
+ class="font-500 text-gray-600 text-xs"
88
+ >{{ _at(item, col.subKey).join(" ") }}</small>
89
+ </div>
90
+ </slot>
91
+ </td>
92
+ </tr>
93
+ </tbody>
94
+ </table>
95
+ <div
96
+ v-if="!items?.length"
97
+ class="flex grow justify-center items-center font-bold text-sm text-text"
98
+ >
99
+ {{ $t("Empty") }}
100
+ </div>
101
+ </div>
102
+ </template>
103
+
104
+ <script setup>
105
+ import { _at, useDevice } from "#imports";
106
+ const { cols = [], items = [], thClass = "bg-gray-100 border-gray-100", tdClass = "bg-gray-250", textClass = "text-gray-800 font-700 text-xs" } = defineProps({
107
+ cols: { type: Array, required: false },
108
+ items: { type: Array, required: false },
109
+ thClass: { type: String, required: false },
110
+ tdClass: { type: String, required: false },
111
+ textClass: { type: String, required: false },
112
+ boxMode: { type: Boolean, required: false }
113
+ });
114
+ const { isDesktop, isMobile } = useDevice();
115
+ </script>
@@ -0,0 +1,43 @@
1
+ type __VLS_Props = {
2
+ cols?: {
3
+ title: string;
4
+ name: string;
5
+ disabled?: boolean;
6
+ key?: string | string[];
7
+ subKey?: string | string[];
8
+ class?: string;
9
+ dir?: string;
10
+ isDesktop?: boolean;
11
+ isMobile?: boolean;
12
+ }[];
13
+ items?: Record<string, unknown>[];
14
+ thClass?: string;
15
+ tdClass?: string;
16
+ textClass?: string;
17
+ boxMode?: boolean;
18
+ };
19
+ declare var __VLS_2: any, __VLS_3: {
20
+ col: any;
21
+ item: any;
22
+ items: any;
23
+ index: any;
24
+ }, __VLS_6: any, __VLS_7: {
25
+ col: any;
26
+ item: any;
27
+ items: any;
28
+ index: any;
29
+ };
30
+ type __VLS_Slots = {} & {
31
+ [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
32
+ } & {
33
+ [K in NonNullable<typeof __VLS_6>]?: (props: typeof __VLS_7) => any;
34
+ };
35
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
37
+ declare const _default: typeof __VLS_export;
38
+ export default _default;
39
+ type __VLS_WithSlots<T, S> = T & {
40
+ new (): {
41
+ $slots: S;
42
+ };
43
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsource/ui",
3
- "version": "2.3.2",
3
+ "version": "2.4.1",
4
4
  "private": false,
5
5
  "description": "nuxt ui kit for unsource env",
6
6
  "repository": "https://github.com/alisa2142/unsource-ui",
@@ -1,22 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
- type __VLS_WithSlots<T, S> = T & (new () => {
5
- $slots: S;
6
- });
7
- declare const __VLS_base: import("vue").DefineComponent<{}, {
8
- $props: Partial<typeof __VLS_props>;
9
- items: unknown[];
10
- cols: unknown[];
11
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
- type __VLS_Slots = {
13
- [x: string]: ((props: {
14
- col: any;
15
- item: any;
16
- items: any;
17
- }) => any) | undefined;
18
- };
19
- declare const __VLS_props: {
20
- readonly items: unknown[];
21
- readonly cols: unknown[];
22
- };
@@ -1,46 +0,0 @@
1
- <template>
2
- <div class="flex flex-col children:(p-4)">
3
- <table class="flex-grow">
4
- <thead>
5
- <tr class="border-b-2 border-gray-100 children:(text-center p-4) rounded-2xl <md:children:p-1">
6
- <th v-for="col in cols"
7
- :class="{'<md:hidden':col.isDesktop,'hidden <md:table-cell':col.isMobile}"
8
- class="text-xs text-gray-400 font-medium first:text-right last:text-left">
9
- {{ col.title }}
10
- </th>
11
- </tr>
12
- </thead>
13
- <tbody >
14
- <tr v-for="item in items"
15
- @click="$emit('click:row',item)"
16
- class="children:p-3 <md:children:p-1 text-center children:(border-b border-gray-100) hover:children:(bg-gray-100)">
17
- <td v-for="col in cols"
18
- class="text-gray-400 text-sm first:text-right last:text-left text-center first:rounded-r-lg last:rounded-l-lg"
19
- :class="[col.class,{'<md:hidden':col.isDesktop,'hidden <md:table-cell':col.isMobile}]" :dir="col.dir">
20
- <slot :name="col.name" :col="col" :item="item" :items="_at(item,col.key)">
21
- {{ _at(item, col.key).join(' ') }}
22
- </slot>
23
- </td>
24
- </tr>
25
- </tbody>
26
- </table>
27
- <div v-if="!items.length" class="flex justify-center items-center p-24 font-bold text-sm text-text">
28
- {{ $t('هیچ موردی برای این جستجو یافت نشد') }}
29
- </div>
30
-
31
- </div>
32
- </template>
33
-
34
- <script setup>
35
- defineProps({
36
- cols: {
37
- type: Array,
38
- default: () => []
39
- },
40
- items: {
41
- type: Array,
42
- default: () => []
43
- }
44
- });
45
- const { isDesktop, isMobile } = useDevice();
46
- </script>
@@ -1,22 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
- type __VLS_WithSlots<T, S> = T & (new () => {
5
- $slots: S;
6
- });
7
- declare const __VLS_base: import("vue").DefineComponent<{}, {
8
- $props: Partial<typeof __VLS_props>;
9
- items: unknown[];
10
- cols: unknown[];
11
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
- type __VLS_Slots = {
13
- [x: string]: ((props: {
14
- col: any;
15
- item: any;
16
- items: any;
17
- }) => any) | undefined;
18
- };
19
- declare const __VLS_props: {
20
- readonly items: unknown[];
21
- readonly cols: unknown[];
22
- };