@caipira/tamandua 0.0.48 → 0.0.50
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/README.md +7 -0
- package/dist/InputCheckbox.js +2 -2
- package/dist/{InputCheckbox.vue_vue_type_style_index_0_lang-D5J-rPuH.js → InputCheckbox.vue_vue_type_style_index_0_lang-DnRqQiOj.js} +20 -19
- package/dist/InputPrice.js +2 -2
- package/dist/InputPrice.vue_vue_type_script_setup_true_lang-C2wDVwnm.js +80 -0
- package/dist/InputSelect.js +2 -2
- package/dist/InputSelect.vue_vue_type_script_setup_true_lang-B89uyzj-.js +226 -0
- package/dist/Pagination.js +2 -2
- package/dist/Pagination.vue_vue_type_script_setup_true_lang-CrsaPQHf.js +106 -0
- package/dist/components.js +4 -4
- package/dist/{plugin-YUomn9tF.js → plugin-43qPVkHg.js} +1 -1
- package/dist/{plugin-DPCk5fFS.js → plugin-4XhHBTQc.js} +1 -1
- package/dist/{plugin-XDIORJya.js → plugin-C77cnZuW.js} +1 -1
- package/dist/{plugin-z8Hr_T_O.js → plugin-CQ-FpZui.js} +1 -1
- package/dist/{plugins-CfuHgVBl.js → plugins-D9rFe9qY.js} +6 -6
- package/dist/plugins.js +6 -6
- package/dist/tamandua.js +1 -1
- package/dist/types/components/InputPrice/InputPrice.story.d.ts +13 -0
- package/dist/types/components/InputPrice/InputPrice.vue.d.ts +8 -2
- package/dist/types/components/InputPrice/types.d.ts +4 -1
- package/dist/types/components/InputSelect/InputSelect.vue.d.ts +127 -52
- package/dist/types/components/InputSelect/types.d.ts +0 -1
- package/dist/types/components/Pagination/Pagination.story.d.ts +8 -0
- package/dist/types/components/Pagination/Pagination.vue.d.ts +3 -0
- package/dist/types/components/Pagination/types.d.ts +1 -0
- package/dist/types/types/ui.d.ts +6 -6
- package/package.json +1 -1
- package/dist/InputPrice.vue_vue_type_script_setup_true_lang-BX4rsYIr.js +0 -67
- package/dist/InputSelect.vue_vue_type_script_setup_true_lang-BDqMGvuy.js +0 -227
- package/dist/Pagination.vue_vue_type_script_setup_true_lang-PLZQJUd0.js +0 -89
package/dist/plugins.js
CHANGED
|
@@ -24,19 +24,19 @@ import { p as X } from "./plugin-DOeDaXWj.js";
|
|
|
24
24
|
import "./Icon.vue_vue_type_script_setup_true_lang-DXUyEtqW.js";
|
|
25
25
|
import { p as Z } from "./plugin-Dk3KBChD.js";
|
|
26
26
|
import { p as $ } from "./plugin--F5QK2vy.js";
|
|
27
|
-
import "./InputCheckbox.vue_vue_type_style_index_0_lang-
|
|
28
|
-
import { p as or } from "./plugin-
|
|
27
|
+
import "./InputCheckbox.vue_vue_type_style_index_0_lang-DnRqQiOj.js";
|
|
28
|
+
import { p as or } from "./plugin-4XhHBTQc.js";
|
|
29
29
|
import { p as tr } from "./plugin-Bq4nQPd4.js";
|
|
30
30
|
import { p as er } from "./plugin-D9KHvOM3.js";
|
|
31
31
|
import { p as nr } from "./plugin-BtF6kCcf.js";
|
|
32
32
|
import { p as ur } from "./plugin-Br-QOjhk.js";
|
|
33
33
|
import { p as Pr } from "./plugin-BT2ef1QG.js";
|
|
34
34
|
import { p as gr } from "./plugin-CrHDShgh.js";
|
|
35
|
-
import { p as fr } from "./plugin-
|
|
35
|
+
import { p as fr } from "./plugin-CQ-FpZui.js";
|
|
36
36
|
import "./InputRadio.vue_vue_type_style_index_0_lang-DusKEybQ.js";
|
|
37
37
|
import { p as cr } from "./plugin-Y4yYnlO3.js";
|
|
38
|
-
import "./InputSelect.vue_vue_type_script_setup_true_lang-
|
|
39
|
-
import { p as yr } from "./plugin-
|
|
38
|
+
import "./InputSelect.vue_vue_type_script_setup_true_lang-B89uyzj-.js";
|
|
39
|
+
import { p as yr } from "./plugin-C77cnZuW.js";
|
|
40
40
|
import { p as Cr } from "./plugin-BZOU6h10.js";
|
|
41
41
|
import { p as br } from "./plugin-lYDlOt8p.js";
|
|
42
42
|
import { p as Sr } from "./plugin-BQFwx3d5.js";
|
|
@@ -44,7 +44,7 @@ import "./Link.vue_vue_type_script_setup_true_lang-gTf77Jvd.js";
|
|
|
44
44
|
import { p as vr } from "./plugin-DHstqRmE.js";
|
|
45
45
|
import { p as Dr } from "./plugin-DKjcKBPg.js";
|
|
46
46
|
import { p as Lr } from "./plugin-DNXazWwT.js";
|
|
47
|
-
import { p as Ar } from "./plugin-
|
|
47
|
+
import { p as Ar } from "./plugin-43qPVkHg.js";
|
|
48
48
|
import "./Popconfirm.vue_vue_type_script_setup_true_lang-XyjBUx0p.js";
|
|
49
49
|
import { p as Er } from "./plugin-Ee4Z5Rtp.js";
|
|
50
50
|
import "./Popover.vue_vue_type_script_setup_true_lang-dnL75W40.js";
|
package/dist/tamandua.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
};
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Price: (args: any) => {
|
|
6
|
+
setup(): {
|
|
7
|
+
args: any;
|
|
8
|
+
onEnter: (newValue: any) => void;
|
|
9
|
+
onUpdate: (newValue: any) => void;
|
|
10
|
+
getCurrencies: () => Promise<unknown>;
|
|
11
|
+
};
|
|
12
|
+
template: string;
|
|
13
|
+
};
|
|
@@ -8,7 +8,10 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
8
8
|
disabled: {
|
|
9
9
|
type: import("vue").PropType<boolean>;
|
|
10
10
|
};
|
|
11
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
keyup: (val: KeyboardEvent) => void;
|
|
13
|
+
blur: (val: Event) => void;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
15
|
modelValue: import("vue").PropType<InputPriceModel>;
|
|
13
16
|
resource: {
|
|
14
17
|
type: import("vue").PropType<() => any>;
|
|
@@ -16,5 +19,8 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
16
19
|
disabled: {
|
|
17
20
|
type: import("vue").PropType<boolean>;
|
|
18
21
|
};
|
|
19
|
-
}
|
|
22
|
+
}>> & {
|
|
23
|
+
onBlur?: ((val: Event) => any) | undefined;
|
|
24
|
+
onKeyup?: ((val: KeyboardEvent) => any) | undefined;
|
|
25
|
+
}, {}, {}>;
|
|
20
26
|
export default _default;
|
|
@@ -1,43 +1,135 @@
|
|
|
1
1
|
import { ElementSize, ElementPosition } from '../../enums/ui.js';
|
|
2
|
-
import {
|
|
2
|
+
import { InputSelectValue, InputSelectOption, SelectValuePrimitives } from './types.js';
|
|
3
3
|
import { APISearchFilters } from '../../types/api.js';
|
|
4
4
|
import { Pagination } from '../../types/ui.js';
|
|
5
5
|
|
|
6
|
-
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
6
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
7
|
+
modelValue: import("vue").PropType<InputSelectValue>;
|
|
8
|
+
filter: {
|
|
9
|
+
type: import("vue").PropType<(input: string, option: InputSelectOption) => boolean>;
|
|
10
|
+
default: (input: string, option: InputSelectOption) => boolean;
|
|
11
|
+
};
|
|
12
|
+
size: {
|
|
13
|
+
type: import("vue").PropType<ElementSize>;
|
|
14
|
+
default: ElementSize;
|
|
15
|
+
};
|
|
16
|
+
multiple: {
|
|
17
|
+
type: import("vue").PropType<boolean>;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
disabled: {
|
|
21
|
+
type: import("vue").PropType<boolean>;
|
|
22
|
+
};
|
|
23
|
+
options: {
|
|
24
|
+
type: import("vue").PropType<InputSelectOption[]>;
|
|
25
|
+
default: () => never[];
|
|
26
|
+
};
|
|
27
|
+
initialValue: {
|
|
28
|
+
type: import("vue").PropType<any>;
|
|
29
|
+
};
|
|
30
|
+
placeholder: {
|
|
31
|
+
type: import("vue").PropType<string>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
resource: {
|
|
35
|
+
type: import("vue").PropType<(filters?: APISearchFilters | undefined) => Promise<{
|
|
36
|
+
items: unknown[];
|
|
37
|
+
pagination: Pagination;
|
|
38
|
+
}>>;
|
|
39
|
+
};
|
|
40
|
+
mapper: {
|
|
41
|
+
type: import("vue").PropType<(i: any) => InputSelectOption>;
|
|
42
|
+
default: (i: any) => InputSelectOption;
|
|
43
|
+
};
|
|
44
|
+
tooltip: {
|
|
45
|
+
type: import("vue").PropType<string>;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
isSearchable: {
|
|
49
|
+
type: import("vue").PropType<boolean>;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
dropdownPlacement: {
|
|
53
|
+
type: import("vue").PropType<"top-start" | "top" | "top-end" | "right-start" | "right" | "right-end" | "bottom-end" | "bottom" | "bottom-start" | "left-end" | "left" | "left-start">;
|
|
54
|
+
default: ElementPosition;
|
|
55
|
+
};
|
|
56
|
+
widthClass: {
|
|
57
|
+
type: import("vue").PropType<string>;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
borderClass: {
|
|
61
|
+
type: import("vue").PropType<string>;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
roundnessClass: {
|
|
65
|
+
type: import("vue").PropType<string>;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
69
|
"update:model-value": (val: any) => void;
|
|
24
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
70
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
71
|
+
modelValue: import("vue").PropType<InputSelectValue>;
|
|
72
|
+
filter: {
|
|
73
|
+
type: import("vue").PropType<(input: string, option: InputSelectOption) => boolean>;
|
|
74
|
+
default: (input: string, option: InputSelectOption) => boolean;
|
|
75
|
+
};
|
|
76
|
+
size: {
|
|
77
|
+
type: import("vue").PropType<ElementSize>;
|
|
78
|
+
default: ElementSize;
|
|
79
|
+
};
|
|
80
|
+
multiple: {
|
|
81
|
+
type: import("vue").PropType<boolean>;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
disabled: {
|
|
85
|
+
type: import("vue").PropType<boolean>;
|
|
86
|
+
};
|
|
87
|
+
options: {
|
|
88
|
+
type: import("vue").PropType<InputSelectOption[]>;
|
|
89
|
+
default: () => never[];
|
|
90
|
+
};
|
|
91
|
+
initialValue: {
|
|
92
|
+
type: import("vue").PropType<any>;
|
|
93
|
+
};
|
|
94
|
+
placeholder: {
|
|
95
|
+
type: import("vue").PropType<string>;
|
|
96
|
+
default: string;
|
|
97
|
+
};
|
|
98
|
+
resource: {
|
|
99
|
+
type: import("vue").PropType<(filters?: APISearchFilters | undefined) => Promise<{
|
|
100
|
+
items: unknown[];
|
|
101
|
+
pagination: Pagination;
|
|
102
|
+
}>>;
|
|
103
|
+
};
|
|
104
|
+
mapper: {
|
|
105
|
+
type: import("vue").PropType<(i: any) => InputSelectOption>;
|
|
106
|
+
default: (i: any) => InputSelectOption;
|
|
107
|
+
};
|
|
108
|
+
tooltip: {
|
|
109
|
+
type: import("vue").PropType<string>;
|
|
110
|
+
default: string;
|
|
111
|
+
};
|
|
112
|
+
isSearchable: {
|
|
113
|
+
type: import("vue").PropType<boolean>;
|
|
114
|
+
default: boolean;
|
|
115
|
+
};
|
|
116
|
+
dropdownPlacement: {
|
|
117
|
+
type: import("vue").PropType<"top-start" | "top" | "top-end" | "right-start" | "right" | "right-end" | "bottom-end" | "bottom" | "bottom-start" | "left-end" | "left" | "left-start">;
|
|
118
|
+
default: ElementPosition;
|
|
119
|
+
};
|
|
120
|
+
widthClass: {
|
|
121
|
+
type: import("vue").PropType<string>;
|
|
122
|
+
default: string;
|
|
123
|
+
};
|
|
124
|
+
borderClass: {
|
|
125
|
+
type: import("vue").PropType<string>;
|
|
126
|
+
default: string;
|
|
127
|
+
};
|
|
128
|
+
roundnessClass: {
|
|
129
|
+
type: import("vue").PropType<string>;
|
|
130
|
+
default: string;
|
|
131
|
+
};
|
|
132
|
+
}>> & {
|
|
41
133
|
"onUpdate:model-value"?: ((val: any) => any) | undefined;
|
|
42
134
|
}, {
|
|
43
135
|
filter: (input: string, option: InputSelectOption) => boolean;
|
|
@@ -84,23 +176,6 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
84
176
|
default?(_: any): any;
|
|
85
177
|
}>;
|
|
86
178
|
export default _default;
|
|
87
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
88
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
89
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
90
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
91
|
-
} : {
|
|
92
|
-
type: import('vue').PropType<T[K]>;
|
|
93
|
-
required: true;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
type __VLS_WithDefaults<P, D> = {
|
|
97
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
98
|
-
default: D[K];
|
|
99
|
-
}> : P[K];
|
|
100
|
-
};
|
|
101
|
-
type __VLS_Prettify<T> = {
|
|
102
|
-
[K in keyof T]: T[K];
|
|
103
|
-
} & {};
|
|
104
179
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
105
180
|
new (): {
|
|
106
181
|
$slots: S;
|
|
@@ -4,6 +4,7 @@ import { Pagination } from '../../types/ui.js';
|
|
|
4
4
|
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PaginationProps>, {
|
|
5
5
|
disabled: boolean;
|
|
6
6
|
pagination: () => Pagination;
|
|
7
|
+
hasPageSize: boolean;
|
|
7
8
|
pageLengths: () => number[];
|
|
8
9
|
showDescription: boolean;
|
|
9
10
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -11,6 +12,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
11
12
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<PaginationProps>, {
|
|
12
13
|
disabled: boolean;
|
|
13
14
|
pagination: () => Pagination;
|
|
15
|
+
hasPageSize: boolean;
|
|
14
16
|
pageLengths: () => number[];
|
|
15
17
|
showDescription: boolean;
|
|
16
18
|
}>>> & {
|
|
@@ -18,6 +20,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
18
20
|
}, {
|
|
19
21
|
disabled: boolean;
|
|
20
22
|
pagination: Pagination;
|
|
23
|
+
hasPageSize: boolean;
|
|
21
24
|
pageLengths: number[];
|
|
22
25
|
showDescription: boolean;
|
|
23
26
|
}, {}>;
|
package/dist/types/types/ui.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { ElementPosition, ToastVariant } from '../enums/ui.js';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type Pagination = {
|
|
4
4
|
/** Amount of items in current page */
|
|
5
|
-
items
|
|
5
|
+
items?: number;
|
|
6
6
|
/** Current page */
|
|
7
7
|
page: number;
|
|
8
8
|
/** Amount of pages */
|
|
9
9
|
pages: number;
|
|
10
10
|
/** Amount of items per page */
|
|
11
|
-
perPage
|
|
11
|
+
perPage?: number;
|
|
12
12
|
/** Amount of items being skipped */
|
|
13
|
-
skip
|
|
13
|
+
skip?: number;
|
|
14
14
|
/** Total number of items */
|
|
15
|
-
totalItems
|
|
16
|
-
}
|
|
15
|
+
totalItems?: number;
|
|
16
|
+
};
|
|
17
17
|
export type TableColumn = {
|
|
18
18
|
title?: string;
|
|
19
19
|
} & ({
|
package/package.json
CHANGED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { defineComponent as p, mergeModels as c, useModel as m, watch as v, resolveComponent as b, openBlock as f, createElementBlock as _, createVNode as g, withDirectives as h, createElementVNode as x, vModelText as N } from "vue";
|
|
2
|
-
const I = {
|
|
3
|
-
options: {
|
|
4
|
-
precision: 2
|
|
5
|
-
},
|
|
6
|
-
inputToPriceNumber(r) {
|
|
7
|
-
return r = r.replace(/[^0-9]/g, "").trim(), r ? parseFloat(r) / Math.pow(10, this.options.precision) : void 0;
|
|
8
|
-
}
|
|
9
|
-
}, M = { class: "flex items-center h-9 w-full input-bg-color input-text-color border input-border input-roundness" }, P = ["disabled"], y = /* @__PURE__ */ p({
|
|
10
|
-
name: "TInputPrice",
|
|
11
|
-
inheritAttrs: !1,
|
|
12
|
-
__name: "InputPrice",
|
|
13
|
-
props: /* @__PURE__ */ c({
|
|
14
|
-
resource: { type: Function },
|
|
15
|
-
disabled: { type: Boolean }
|
|
16
|
-
}, {
|
|
17
|
-
modelValue: {
|
|
18
|
-
default: {
|
|
19
|
-
iso: "",
|
|
20
|
-
value: void 0
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
modelModifiers: {}
|
|
24
|
-
}),
|
|
25
|
-
emits: ["update:modelValue"],
|
|
26
|
-
setup(r, { emit: n }) {
|
|
27
|
-
const t = m(r, "modelValue"), i = r, u = (e) => ({
|
|
28
|
-
label: e.symbol,
|
|
29
|
-
value: e.iso
|
|
30
|
-
}), a = (e, o) => {
|
|
31
|
-
if (o === void 0) {
|
|
32
|
-
t.value = { ...t.value };
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
e?.value && e.value !== o?.value && (t.value.value = e.value), e?.iso && e.iso !== o?.iso && (t.value.iso = e.iso);
|
|
36
|
-
}, d = (e) => {
|
|
37
|
-
const s = e.target.value;
|
|
38
|
-
return t.value.value = I.inputToPriceNumber(s), !1;
|
|
39
|
-
};
|
|
40
|
-
return v(t, a, { immediate: !0 }), (e, o) => {
|
|
41
|
-
const s = b("t-input-select");
|
|
42
|
-
return f(), _("div", M, [
|
|
43
|
-
g(s, {
|
|
44
|
-
modelValue: t.value.iso,
|
|
45
|
-
"onUpdate:modelValue": o[0] || (o[0] = (l) => t.value.iso = l),
|
|
46
|
-
resource: i.resource,
|
|
47
|
-
mapper: u,
|
|
48
|
-
"width-class": "w-20",
|
|
49
|
-
"border-class": "border-t border-r border-b input-border",
|
|
50
|
-
"roundness-class": ""
|
|
51
|
-
}, null, 8, ["modelValue", "resource"]),
|
|
52
|
-
h(x("input", {
|
|
53
|
-
"onUpdate:modelValue": o[1] || (o[1] = (l) => t.value.value = l),
|
|
54
|
-
type: "text",
|
|
55
|
-
class: "w-full h-full input-bg-color input-text-color input-outline input-roundness input-padding",
|
|
56
|
-
disabled: i.disabled,
|
|
57
|
-
onInput: d
|
|
58
|
-
}, null, 40, P), [
|
|
59
|
-
[N, t.value.value]
|
|
60
|
-
])
|
|
61
|
-
]);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
export {
|
|
66
|
-
y as _
|
|
67
|
-
};
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { defineComponent as le, ref as p, computed as I, onBeforeMount as te, watch as D, resolveComponent as w, openBlock as u, createBlock as C, normalizeClass as S, withCtx as x, createElementVNode as ae, withDirectives as oe, createElementBlock as c, vModelText as ne, createCommentVNode as R, createVNode as O, renderSlot as k, normalizeProps as g, mergeProps as z, Fragment as B, renderList as M, guardReactiveProps as K, toDisplayString as ue, createSlots as se, nextTick as ie } from "vue";
|
|
2
|
-
import { a as re, E as pe } from "./ui-BC6H9E93.js";
|
|
3
|
-
const ce = ["placeholder", "disabled", "readonly"], de = { key: 1 }, fe = {
|
|
4
|
-
key: 0,
|
|
5
|
-
class: "inline-flex w-full justify-between items-center"
|
|
6
|
-
}, ve = {
|
|
7
|
-
key: 1,
|
|
8
|
-
class: "inline-flex items-center"
|
|
9
|
-
}, he = /* @__PURE__ */ le({
|
|
10
|
-
name: "TInputSelect",
|
|
11
|
-
__name: "InputSelect",
|
|
12
|
-
props: {
|
|
13
|
-
size: { default: re.Default },
|
|
14
|
-
options: { default: () => [] },
|
|
15
|
-
mapper: { type: Function, default: (f) => ({
|
|
16
|
-
value: f.id ?? f.uuid,
|
|
17
|
-
label: f
|
|
18
|
-
}) },
|
|
19
|
-
filter: { type: Function, default: (f, T) => T.label.toLowerCase().indexOf(f.toLowerCase()) >= 0 },
|
|
20
|
-
tooltip: { default: "" },
|
|
21
|
-
disabled: { type: Boolean },
|
|
22
|
-
resource: {},
|
|
23
|
-
multiple: { type: Boolean, default: !1 },
|
|
24
|
-
modelValue: {},
|
|
25
|
-
placeholder: { default: "" },
|
|
26
|
-
initialValue: {},
|
|
27
|
-
isSearchable: { type: Boolean, default: !1 },
|
|
28
|
-
dropdownPlacement: { default: pe.BOTTOM_START },
|
|
29
|
-
widthClass: { default: "w-full" },
|
|
30
|
-
borderClass: { default: "border input-border" },
|
|
31
|
-
roundnessClass: { default: "input-roundness" }
|
|
32
|
-
},
|
|
33
|
-
emits: ["update:model-value"],
|
|
34
|
-
setup(f, { emit: T }) {
|
|
35
|
-
const e = f;
|
|
36
|
-
let $ = !1, V, j = "";
|
|
37
|
-
const U = T, o = p([]), r = p(""), P = p(null), F = p(), s = p(!1), L = p(null), a = p([]), A = p(!1), d = p(null), v = I(() => a.value.length > 0), m = I(() => e.isSearchable && s.value), h = I(() => typeof e.resource == "function"), N = (l) => !e.multiple || !e.modelValue || !Array.isArray(e.modelValue) ? !1 : e.modelValue.includes(l.value), q = (l = e.modelValue) => !(l === void 0 || l === "" || Array.isArray(l) && l.length === 0), G = (l) => {
|
|
38
|
-
U("update:model-value", l);
|
|
39
|
-
}, y = (l = e.modelValue) => {
|
|
40
|
-
if (q(l))
|
|
41
|
-
if (e.multiple)
|
|
42
|
-
Array.isArray(l) && (a.value = l.map(
|
|
43
|
-
(t) => E(t)
|
|
44
|
-
).filter((t) => t > -1));
|
|
45
|
-
else {
|
|
46
|
-
const t = E(l);
|
|
47
|
-
~t && (a.value = [t]);
|
|
48
|
-
}
|
|
49
|
-
}, H = (l) => {
|
|
50
|
-
s.value = !s.value, s.value && m.value && ie(() => {
|
|
51
|
-
P.value?.focus();
|
|
52
|
-
});
|
|
53
|
-
}, E = (l) => o.value.findIndex(
|
|
54
|
-
(t) => t.value === l
|
|
55
|
-
), _ = async (l = !1) => {
|
|
56
|
-
if (!e.resource)
|
|
57
|
-
return;
|
|
58
|
-
A.value = !0;
|
|
59
|
-
const t = {
|
|
60
|
-
t: r.value,
|
|
61
|
-
r: "option"
|
|
62
|
-
};
|
|
63
|
-
l && d.value && d.value.pages > d.value.page ? t.page = d.value.page + 1 : l = !1, !r.value && e.modelValue && (t.i = e.modelValue);
|
|
64
|
-
const i = await e.resource(t);
|
|
65
|
-
l ? o.value.push(...i.items.map(e.mapper)) : o.value = i.items.map(e.mapper), d.value = i.pagination, !h.value && r.value && y(r.value), A.value = !1;
|
|
66
|
-
}, J = () => {
|
|
67
|
-
!r.value || j === r.value || (V && (clearTimeout(V), V = null), V = setTimeout(() => {
|
|
68
|
-
j = r.value, h.value ? (s.value || (s.value = !0), _()) : e.isSearchable && (o.value = e.options.filter(
|
|
69
|
-
(l) => e.filter(r.value, l)
|
|
70
|
-
));
|
|
71
|
-
}, 500));
|
|
72
|
-
}, Q = ({
|
|
73
|
-
index: l,
|
|
74
|
-
hold: t
|
|
75
|
-
}) => {
|
|
76
|
-
if ($ = !0, e.multiple) {
|
|
77
|
-
const i = a.value.findIndex(
|
|
78
|
-
(b) => b === l
|
|
79
|
-
);
|
|
80
|
-
~i ? a.value.splice(i, 1) : a.value.push(l);
|
|
81
|
-
} else
|
|
82
|
-
a.value = [l];
|
|
83
|
-
(!e.multiple || !t) && (s.value = !1);
|
|
84
|
-
}, W = () => {
|
|
85
|
-
h.value && d.value && d.value.pages > d.value.page && _(!0);
|
|
86
|
-
}, X = async (l) => {
|
|
87
|
-
switch (l.key) {
|
|
88
|
-
case "ArrowDown":
|
|
89
|
-
L.value?.move(l);
|
|
90
|
-
break;
|
|
91
|
-
case "Escape":
|
|
92
|
-
s.value = !1;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
return te(async () => {
|
|
97
|
-
h.value ? (await _(), y()) : e.options.length > 0 && (o.value = e.options), !e.modelValue && e.initialValue ? y(e.initialValue) : y(e.modelValue);
|
|
98
|
-
}), D(
|
|
99
|
-
() => e.modelValue,
|
|
100
|
-
async (l) => {
|
|
101
|
-
l && (E(l) < 0 && h.value && await _(), y(l));
|
|
102
|
-
}
|
|
103
|
-
), D(
|
|
104
|
-
a,
|
|
105
|
-
(l) => {
|
|
106
|
-
const t = e.multiple ? o.value.filter(
|
|
107
|
-
(i, b) => a.value.includes(b)
|
|
108
|
-
).map((i) => i.value) : o.value[a.value[0]].value;
|
|
109
|
-
$ && ($ = !1, G(t));
|
|
110
|
-
},
|
|
111
|
-
{ deep: !0 }
|
|
112
|
-
), D(
|
|
113
|
-
() => e.options,
|
|
114
|
-
(l) => {
|
|
115
|
-
l.length > 0 && (o.value = l, e.modelValue && a.value.length === 0 && y(e.modelValue));
|
|
116
|
-
}
|
|
117
|
-
), (l, t) => {
|
|
118
|
-
const i = w("t-tag"), b = w("t-button"), Y = w("t-icon"), Z = w("t-dropdown"), ee = w("t-popover");
|
|
119
|
-
return u(), C(ee, {
|
|
120
|
-
open: s.value,
|
|
121
|
-
"onUpdate:open": t[1] || (t[1] = (n) => s.value = n),
|
|
122
|
-
placement: e.dropdownPlacement,
|
|
123
|
-
class: S([e.widthClass]),
|
|
124
|
-
ref_key: "popoverRef",
|
|
125
|
-
ref: F
|
|
126
|
-
}, {
|
|
127
|
-
default: x(() => [
|
|
128
|
-
ae("div", {
|
|
129
|
-
class: S([{
|
|
130
|
-
"h-9": !e.multiple,
|
|
131
|
-
"h-full *:min-h-9": e.multiple,
|
|
132
|
-
[e.borderClass]: !0,
|
|
133
|
-
[e.roundnessClass]: !0
|
|
134
|
-
}, "flex justify-between items-center w-full max-w-96 input-text-color select-none input-bg-color"])
|
|
135
|
-
}, [
|
|
136
|
-
m.value ? oe((u(), c("input", {
|
|
137
|
-
key: 0,
|
|
138
|
-
"onUpdate:modelValue": t[0] || (t[0] = (n) => r.value = n),
|
|
139
|
-
type: "text",
|
|
140
|
-
ref_key: "inputRef",
|
|
141
|
-
ref: P,
|
|
142
|
-
placeholder: e.placeholder,
|
|
143
|
-
disabled: e.disabled,
|
|
144
|
-
readonly: !e.isSearchable,
|
|
145
|
-
class: "w-full h-9 bg-transparent input-padding input-roundness input-outline",
|
|
146
|
-
onInput: J,
|
|
147
|
-
onKeydown: X
|
|
148
|
-
}, null, 40, ce)), [
|
|
149
|
-
[ne, r.value]
|
|
150
|
-
]) : R("", !0),
|
|
151
|
-
O(b, {
|
|
152
|
-
variant: "transparent",
|
|
153
|
-
size: "",
|
|
154
|
-
class: S(["h-full", {
|
|
155
|
-
"w-full justify-end pr-2": !m.value && !v.value,
|
|
156
|
-
"w-full justify-between pr-2": !m.value && v.value,
|
|
157
|
-
"w-10 justify-center": m.value
|
|
158
|
-
}]),
|
|
159
|
-
"aria-describedby": F.value?.name,
|
|
160
|
-
icon: s.value === !0 ? "chevron-up" : "chevron-down",
|
|
161
|
-
onClick: H
|
|
162
|
-
}, {
|
|
163
|
-
default: x(() => [
|
|
164
|
-
v.value && !m.value ? (u(), c("div", {
|
|
165
|
-
key: 0,
|
|
166
|
-
class: S(["inline-flex items-center ml-2 max-w-[calc(100%-2.5rem)]", {
|
|
167
|
-
"overflow-hidden whitespace-nowrap": !e.multiple,
|
|
168
|
-
"flex-wrap gap-2 py-1": e.multiple
|
|
169
|
-
}])
|
|
170
|
-
}, [
|
|
171
|
-
l.$slots.selection && v.value ? k(l.$slots, "selection", g(z({ key: 0 }, o.value[a.value[0]]))) : l.$slots.default && v.value ? (u(), c(B, { key: 1 }, [
|
|
172
|
-
e.multiple ? (u(!0), c(B, { key: 0 }, M(a.value, (n) => k(l.$slots, "default", g(K(o.value[n])))), 256)) : k(l.$slots, "default", g(z({ key: 1 }, o.value[a.value[0]])))
|
|
173
|
-
], 64)) : v.value ? (u(), c(B, { key: 2 }, [
|
|
174
|
-
e.multiple ? (u(!0), c(B, { key: 0 }, M(a.value, (n) => (u(), C(i, {
|
|
175
|
-
key: n,
|
|
176
|
-
text: o.value[n].label,
|
|
177
|
-
color: "#6e6e6e"
|
|
178
|
-
}, null, 8, ["text"]))), 128)) : (u(), c("span", de, ue(o.value[a.value[0]]?.label), 1))
|
|
179
|
-
], 64)) : R("", !0)
|
|
180
|
-
], 2)) : R("", !0)
|
|
181
|
-
]),
|
|
182
|
-
_: 3
|
|
183
|
-
}, 8, ["aria-describedby", "class", "icon"])
|
|
184
|
-
], 2)
|
|
185
|
-
]),
|
|
186
|
-
content: x(() => [
|
|
187
|
-
O(Z, {
|
|
188
|
-
ref_key: "dropdownRef",
|
|
189
|
-
ref: L,
|
|
190
|
-
items: o.value,
|
|
191
|
-
"is-visible": s.value,
|
|
192
|
-
multiple: e.multiple,
|
|
193
|
-
loading: A.value,
|
|
194
|
-
onChange: Q,
|
|
195
|
-
onEndReached: W
|
|
196
|
-
}, se({ _: 2 }, [
|
|
197
|
-
l.$slots.default || e.multiple ? {
|
|
198
|
-
name: "default",
|
|
199
|
-
fn: x((n) => [
|
|
200
|
-
e.multiple ? (u(), c("div", fe, [
|
|
201
|
-
l.$slots.default ? k(l.$slots, "default", g(z({ key: 0 }, n))) : (u(), C(i, {
|
|
202
|
-
key: 1,
|
|
203
|
-
text: n.label,
|
|
204
|
-
class: "m-1"
|
|
205
|
-
}, null, 8, ["text"])),
|
|
206
|
-
N(n) ? (u(), C(Y, {
|
|
207
|
-
key: 2,
|
|
208
|
-
icon: "check",
|
|
209
|
-
size: "sm",
|
|
210
|
-
class: "float-right ml-2"
|
|
211
|
-
})) : R("", !0)
|
|
212
|
-
])) : (u(), c("div", ve, [
|
|
213
|
-
k(l.$slots, "default", g(K(n)))
|
|
214
|
-
]))
|
|
215
|
-
]),
|
|
216
|
-
key: "0"
|
|
217
|
-
} : void 0
|
|
218
|
-
]), 1032, ["items", "is-visible", "multiple", "loading"])
|
|
219
|
-
]),
|
|
220
|
-
_: 3
|
|
221
|
-
}, 8, ["open", "placement", "class"]);
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
export {
|
|
226
|
-
he as _
|
|
227
|
-
};
|