@agrotools1/at-components 2.0.32 → 2.0.34
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/changelog/versions/components/index.d.ts.map +1 -1
- package/dist/changelog/versions/components/v2.0.33.d.ts +4 -0
- package/dist/changelog/versions/components/v2.0.33.d.ts.map +1 -0
- package/dist/changelog/versions/components/v2.0.34.d.ts +4 -0
- package/dist/changelog/versions/components/v2.0.34.d.ts.map +1 -0
- package/dist/document-input/DocumentAutoComplete.vue.d.ts +4 -2
- package/dist/document-input/DocumentAutoComplete.vue.d.ts.map +1 -1
- package/dist/document-input/DocumentAutoComplete.vue.js +148 -133
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/index.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAmB3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2.0.33.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.33.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WA4Bd,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2.0.34.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.34.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WA2Bd,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -7,7 +7,7 @@ interface Props {
|
|
|
7
7
|
* Tipo de documento. Define máscara e validação.
|
|
8
8
|
* @default 'cpf-cnpj'
|
|
9
9
|
*/
|
|
10
|
-
documentType?: 'cpf' | 'cnpj' | 'cpf-cnpj' | 'generic';
|
|
10
|
+
documentType?: 'cpf' | 'cnpj' | 'cpf-cnpj' | 'generic' | 'custom';
|
|
11
11
|
/** Texto do rótulo (label) acima do campo. */
|
|
12
12
|
label?: string;
|
|
13
13
|
/** Texto de ajuda ou descrição abaixo do campo. */
|
|
@@ -90,6 +90,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
90
90
|
blur: (event: FocusEvent) => any;
|
|
91
91
|
focus: (event: FocusEvent) => any;
|
|
92
92
|
validate: (isValid: boolean) => any;
|
|
93
|
+
"update:searchTerm": (value: string) => any;
|
|
93
94
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
94
95
|
onClear?: (() => any) | undefined;
|
|
95
96
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
@@ -97,6 +98,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
97
98
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
98
99
|
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
99
100
|
onValidate?: ((isValid: boolean) => any) | undefined;
|
|
101
|
+
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
100
102
|
}>, {
|
|
101
103
|
disabled: boolean;
|
|
102
104
|
toUpperCase: boolean;
|
|
@@ -104,7 +106,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
104
106
|
error: boolean | string;
|
|
105
107
|
withIcon: boolean;
|
|
106
108
|
allowAlpha: boolean;
|
|
107
|
-
documentType: "cpf" | "cnpj" | "cpf-cnpj" | "generic";
|
|
109
|
+
documentType: "cpf" | "cnpj" | "cpf-cnpj" | "generic" | "custom";
|
|
108
110
|
withInternalValidation: boolean;
|
|
109
111
|
unmask: boolean;
|
|
110
112
|
withClearIcon: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentAutoComplete.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentAutoComplete.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DocumentAutoComplete.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentAutoComplete.vue"],"names":[],"mappings":"AAspBA,UAAU,KAAK;IACb,8BAA8B;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,+CAA+C;IAC/C,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAA;IACjE,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,oCAAoC;IACpC,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,wCAAwC;IACxC,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kDAAkD;IAClD,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;IACf,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AA6ZD,iBAAS,cAAc;WAiWT,OAAO,IAA6B;;uBAhBtB,GAAG;sBACJ,GAAG;yBACA,GAAG;uBACL,GAAG;yBACD,GAAG;;;YACJ,GAAG;;;;;;EAgB/B;AA4CD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;cAj2BR,OAAO;iBAeJ,OAAO;aARX,OAAO;WAFT,OAAO,GAAG,MAAM;cAuBb,OAAO;gBAnBL,OAAO;kBAjBL,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ;4BAsCxC,OAAO;YAVvB,OAAO;mBA4BA,OAAO;cALZ,MAAM;;;kBAg0BjB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as ie, useId as ue, ref as
|
|
1
|
+
import { defineComponent as ie, useId as ue, ref as v, watch as ce, computed as U, createElementBlock as g, openBlock as i, normalizeClass as S, unref as a, createBlock as T, createCommentVNode as y, createVNode as d, withCtx as m, createTextVNode as Z, toDisplayString as k, mergeProps as pe, createElementVNode as _, renderSlot as A, withModifiers as q, withDirectives as de, Fragment as fe, renderList as me, vShow as he, nextTick as z } from "vue";
|
|
2
2
|
import { cn as F } from "../lib/utils.js";
|
|
3
|
-
import { AtCheckCircleRegularIcon as
|
|
4
|
-
import { AtCheckSolidIcon as
|
|
5
|
-
import { AtCircleXMarkRegularIcon as
|
|
3
|
+
import { AtCheckCircleRegularIcon as ge } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
|
|
4
|
+
import { AtCheckSolidIcon as ye } from "../packages/at-icons/dist/AtCheckSolidIcon/index.js";
|
|
5
|
+
import { AtCircleXMarkRegularIcon as ve } from "../packages/at-icons/dist/AtCircleXMarkRegularIcon/index.js";
|
|
6
6
|
import { AtCircleXMarkSolidIcon as R } from "../packages/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
|
|
7
|
-
import { reactiveOmit as
|
|
7
|
+
import { reactiveOmit as Te } from "@vueuse/core";
|
|
8
8
|
import { useForwardPropsEmits as ke } from "reka-ui";
|
|
9
|
-
import
|
|
9
|
+
import Ae from "../combobox/Combobox.vue.js";
|
|
10
10
|
import xe from "../combobox/ComboboxAnchor.vue.js";
|
|
11
|
-
import
|
|
11
|
+
import we from "../combobox/ComboboxEmpty.vue.js";
|
|
12
12
|
import Ce from "../combobox/ComboboxGroup.vue.js";
|
|
13
13
|
import Ve from "../combobox/ComboboxInput.vue.js";
|
|
14
14
|
import be from "../combobox/ComboboxItem.vue.js";
|
|
@@ -16,12 +16,12 @@ import _e from "../combobox/ComboboxItemIndicator.vue.js";
|
|
|
16
16
|
import Ie from "../combobox/ComboboxList.vue.js";
|
|
17
17
|
import $e from "../combobox/ComboboxViewport.vue.js";
|
|
18
18
|
import Me from "../label/Label.vue.js";
|
|
19
|
-
import { isValidCpf as x, isValidCnpj as
|
|
19
|
+
import { isValidCpf as x, isValidCnpj as w, applyCpfMask as O, applyCnpjMask as X } from "./utils.js";
|
|
20
20
|
import je from "../node_modules/.pnpm/lucide-vue-next@0.542.0_vue@3.5.19_typescript@5.8.3_/node_modules/lucide-vue-next/dist/esm/icons/loader-circle.js";
|
|
21
21
|
const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "py-6 flex items-center justify-center text-sm text-gray-500"
|
|
24
|
-
}, Ze = { class: "flex items-center gap-2" },
|
|
24
|
+
}, Ze = { class: "flex items-center gap-2" }, rt = /* @__PURE__ */ ie({
|
|
25
25
|
__name: "DocumentAutoComplete",
|
|
26
26
|
props: {
|
|
27
27
|
id: {},
|
|
@@ -50,9 +50,9 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
|
50
50
|
optionId: { default: "identifier" },
|
|
51
51
|
withClearIcon: { type: Boolean, default: !0 }
|
|
52
52
|
},
|
|
53
|
-
emits: ["update:modelValue", "select", "validate", "blur", "focus", "clear"],
|
|
53
|
+
emits: ["update:modelValue", "update:searchTerm", "select", "validate", "blur", "focus", "clear"],
|
|
54
54
|
setup(H, { emit: J }) {
|
|
55
|
-
const e = H,
|
|
55
|
+
const e = H, o = J, C = e.id || ue(), G = `error-${C}`, K = `desc-${C}`, Q = Te(
|
|
56
56
|
e,
|
|
57
57
|
"modelValue",
|
|
58
58
|
"documentType",
|
|
@@ -76,52 +76,54 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
|
76
76
|
"loadingText",
|
|
77
77
|
"optionId",
|
|
78
78
|
"modelValue"
|
|
79
|
-
), W = ke(Q,
|
|
80
|
-
function Y(t,
|
|
81
|
-
if (!
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
let
|
|
85
|
-
for (let
|
|
86
|
-
const u =
|
|
87
|
-
u === "9" ? /[0-9]/.test(
|
|
79
|
+
), W = ke(Q, o), s = v(""), V = v(!1), I = v(!1), E = v(!1), $ = v(null), M = v(e.modelValue);
|
|
80
|
+
function Y(t, l) {
|
|
81
|
+
if (!l) return t;
|
|
82
|
+
const r = t.replace(/[^0-9A-Za-z]/g, "");
|
|
83
|
+
if (!r) return "";
|
|
84
|
+
let f = "", n = 0;
|
|
85
|
+
for (let c = 0; c < l.length && n < r.length; c++) {
|
|
86
|
+
const u = l[c], p = r[n];
|
|
87
|
+
u === "9" ? /[0-9]/.test(p) ? (f += p, n++) : (n++, c--) : u === "A" ? /[A-Za-z]/.test(p) ? (f += e.toUpperCase ? p.toUpperCase() : p, n++) : (n++, c--) : u === "X" ? /[0-9A-Za-z]/.test(p) ? (f += e.toUpperCase ? p.toUpperCase() : p, n++) : (n++, c--) : (f += u, p === u && n++);
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return f;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function L(t) {
|
|
92
92
|
if (e.customMask && e.documentType === "generic")
|
|
93
93
|
return Y(t, e.customMask);
|
|
94
|
-
const
|
|
95
|
-
return e.documentType === "cpf" ? O(t) : e.documentType === "cnpj" ? X(t, e.allowAlpha) : e.documentType === "cpf-cnpj" ? e.allowAlpha &&
|
|
94
|
+
const l = /[A-Z]/i.test(t);
|
|
95
|
+
return e.documentType === "cpf" ? O(t) : e.documentType === "cnpj" ? X(t, e.allowAlpha) : e.documentType === "cpf-cnpj" ? e.allowAlpha && l || t.length > 11 ? X(t, e.allowAlpha) : O(t) : t;
|
|
96
96
|
}
|
|
97
97
|
const P = (t) => {
|
|
98
|
-
if (!t) return
|
|
98
|
+
if (!t) return s.value || "";
|
|
99
|
+
if (e.documentType === "custom")
|
|
100
|
+
return typeof t == "string" ? t : t.text || t.label || t.identifier || t.value || "";
|
|
99
101
|
if (typeof t == "string") {
|
|
100
|
-
const
|
|
102
|
+
const l = t.replace(
|
|
101
103
|
e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
|
|
102
104
|
""
|
|
103
105
|
);
|
|
104
|
-
return
|
|
106
|
+
return L(l);
|
|
105
107
|
}
|
|
106
|
-
|
|
107
|
-
e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
|
|
108
|
-
""
|
|
109
|
-
);
|
|
110
|
-
return j(l);
|
|
108
|
+
return t.text || t.label || t.identifier || t.value || "";
|
|
111
109
|
};
|
|
112
110
|
ce(
|
|
113
111
|
() => e.modelValue,
|
|
114
112
|
(t) => {
|
|
115
113
|
if (M.value = t, t == null || t === "") {
|
|
116
|
-
|
|
114
|
+
s.value !== "" && (s.value = ""), M.value = void 0;
|
|
117
115
|
return;
|
|
118
116
|
}
|
|
119
|
-
const
|
|
120
|
-
|
|
117
|
+
const l = P(t);
|
|
118
|
+
s.value !== l && (s.value = l);
|
|
121
119
|
},
|
|
122
120
|
{ immediate: !0 }
|
|
123
121
|
);
|
|
124
|
-
const ee = U(() =>
|
|
122
|
+
const ee = U(() => {
|
|
123
|
+
if (e.maxLength) return e.maxLength;
|
|
124
|
+
if (e.documentType !== "custom")
|
|
125
|
+
return e.customMask && e.documentType === "generic" ? e.customMask.length : e.documentType === "cpf" ? 14 : 18;
|
|
126
|
+
}), te = U(() => {
|
|
125
127
|
switch (e.documentType) {
|
|
126
128
|
case "cnpj":
|
|
127
129
|
return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
|
|
@@ -132,134 +134,147 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
|
132
134
|
default:
|
|
133
135
|
return;
|
|
134
136
|
}
|
|
135
|
-
}),
|
|
137
|
+
}), h = U(() => {
|
|
136
138
|
if (e.error) return !0;
|
|
139
|
+
if (e.documentType === "custom") return !1;
|
|
137
140
|
if (e.withInternalValidation) {
|
|
138
141
|
const t = e.modelValue;
|
|
139
142
|
if (!t || I.value) return !1;
|
|
140
|
-
const
|
|
141
|
-
if (!
|
|
142
|
-
if (
|
|
143
|
+
const r = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
|
|
144
|
+
if (!r) return !1;
|
|
145
|
+
if (r.length === 11 && !x(r) || r.length === 14 && !w(r) || E.value && (e.documentType === "cpf" && r.length !== 11 || e.documentType === "cnpj" && r.length !== 14 || e.documentType === "cpf-cnpj" && r.length !== 11 && r.length !== 14))
|
|
143
146
|
return !0;
|
|
144
147
|
}
|
|
145
148
|
return !1;
|
|
146
|
-
}),
|
|
147
|
-
if (
|
|
149
|
+
}), j = U(() => {
|
|
150
|
+
if (h.value) return !1;
|
|
148
151
|
if (e.success) return !0;
|
|
152
|
+
if (e.documentType === "custom") return !1;
|
|
149
153
|
if (e.withInternalValidation) {
|
|
150
154
|
const t = e.modelValue;
|
|
151
155
|
if (!t) return !1;
|
|
152
|
-
const
|
|
153
|
-
if (e.documentType === "cpf") return x(
|
|
154
|
-
if (e.documentType === "cnpj") return
|
|
156
|
+
const r = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
|
|
157
|
+
if (e.documentType === "cpf") return x(r);
|
|
158
|
+
if (e.documentType === "cnpj") return w(r);
|
|
155
159
|
if (e.documentType === "cpf-cnpj")
|
|
156
|
-
return
|
|
160
|
+
return r.length === 11 ? x(r) : w(r);
|
|
157
161
|
}
|
|
158
162
|
return !1;
|
|
159
163
|
});
|
|
160
164
|
function D(t) {
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
if (e.documentType === "custom") {
|
|
166
|
+
o("validate", !!t);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
let l = !1;
|
|
170
|
+
e.documentType === "cpf" ? l = x(t) : e.documentType === "cnpj" ? l = w(t) : e.documentType === "cpf-cnpj" && (l = t.length === 11 ? x(t) : w(t)), o("validate", l);
|
|
163
171
|
}
|
|
164
172
|
function le(t) {
|
|
165
|
-
const
|
|
166
|
-
let
|
|
167
|
-
const
|
|
168
|
-
I.value = !1, e.toUpperCase && (
|
|
169
|
-
|
|
173
|
+
const l = t.target;
|
|
174
|
+
let r = l.value;
|
|
175
|
+
const f = l.selectionStart || 0;
|
|
176
|
+
if (I.value = !1, e.toUpperCase && (r = r.toUpperCase()), e.documentType === "custom") {
|
|
177
|
+
o("update:modelValue", r || void 0), o("update:searchTerm", r), s.value = r;
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
let n = r.replace(
|
|
170
181
|
e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
|
|
171
182
|
""
|
|
172
|
-
),
|
|
173
|
-
|
|
174
|
-
const u =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
let
|
|
178
|
-
for (let b = 0; b < u.length && ((e.documentType === "generic" && e.customMask || e.allowAlpha ? /[A-Z0-9]/i.test(u[b]) : /[0-9]/.test(u[b])) && N++,
|
|
183
|
+
), c = e.maxLength;
|
|
184
|
+
c || (e.customMask && e.documentType === "generic" ? c = e.customMask.length : c = e.documentType === "cpf" ? 11 : 14), n = n.slice(0, c);
|
|
185
|
+
const u = L(n), p = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, ne = (r.slice(0, f).match(p) || []).length, se = (e.unmask ? n : u) || void 0;
|
|
186
|
+
o("update:modelValue", se), o("update:searchTerm", n), D(n), s.value = u, z(() => {
|
|
187
|
+
l.value = u;
|
|
188
|
+
let B = 0, N = 0;
|
|
189
|
+
for (let b = 0; b < u.length && ((e.documentType === "generic" && e.customMask || e.allowAlpha ? /[A-Z0-9]/i.test(u[b]) : /[0-9]/.test(u[b])) && N++, B = b + 1, !(N >= ne)); b++)
|
|
179
190
|
;
|
|
180
|
-
|
|
191
|
+
l.setSelectionRange(B, B);
|
|
181
192
|
});
|
|
182
193
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
194
|
+
function re(t) {
|
|
195
|
+
s.value = "", o("update:searchTerm", ""), M.value = null, o("update:modelValue", null), z(() => {
|
|
185
196
|
if (!$.value) return;
|
|
186
|
-
const
|
|
187
|
-
|
|
197
|
+
const l = $.value.querySelector(`[id="${C}"]`) || $.value.querySelector("input"), r = (l == null ? void 0 : l.tagName) === "INPUT" ? l : l == null ? void 0 : l.querySelector("input");
|
|
198
|
+
r && (r.value = "", r.dispatchEvent(new Event("input", { bubbles: !0 }))), z(() => {
|
|
188
199
|
V.value = !1;
|
|
189
200
|
});
|
|
190
|
-
}), I.value = !0,
|
|
201
|
+
}), I.value = !0, o("validate", !1), o("clear"), V.value = !1;
|
|
191
202
|
}
|
|
192
|
-
function
|
|
203
|
+
function ae(t) {
|
|
193
204
|
if (!t) {
|
|
194
|
-
|
|
205
|
+
s.value = "", o("update:searchTerm", ""), I.value = !0, o("update:modelValue", null);
|
|
195
206
|
return;
|
|
196
207
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
208
|
+
if (o("update:modelValue", t), o("select", t), s.value = t.text || t.label || t.identifier || t.value || "", e.documentType === "custom")
|
|
209
|
+
o("update:searchTerm", s.value), o("validate", !0);
|
|
210
|
+
else {
|
|
211
|
+
const l = (t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
|
|
212
|
+
o("update:searchTerm", l), D(l);
|
|
213
|
+
}
|
|
214
|
+
V.value = !1;
|
|
200
215
|
}
|
|
201
216
|
function oe(t) {
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
let
|
|
205
|
-
|
|
217
|
+
if (E.value = !0, o("blur", t), e.documentType === "custom") return;
|
|
218
|
+
const l = s.value.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
|
|
219
|
+
let r = !1;
|
|
220
|
+
l.length === 11 ? r = x(l) : l.length === 14 && (r = w(l)), r && o("update:modelValue", e.toUpperCase ? l.toUpperCase() : l);
|
|
206
221
|
}
|
|
207
|
-
return (t,
|
|
208
|
-
class: S(
|
|
222
|
+
return (t, l) => (i(), g("div", {
|
|
223
|
+
class: S(a(F)("space-y-1.5 w-full", e.class)),
|
|
209
224
|
ref_key: "wrapperRef",
|
|
210
225
|
ref: $
|
|
211
226
|
}, [
|
|
212
|
-
e.label ? (
|
|
227
|
+
e.label ? (i(), T(a(Me), {
|
|
213
228
|
key: 0,
|
|
214
|
-
for:
|
|
229
|
+
for: a(C),
|
|
215
230
|
class: S(
|
|
216
|
-
|
|
231
|
+
a(F)(
|
|
217
232
|
"text-[#101011] font-normal text-[10px] leading-[10px]",
|
|
218
|
-
|
|
233
|
+
h.value ? "text-[var(--alert-red-dark,#831511)]" : ""
|
|
219
234
|
)
|
|
220
235
|
)
|
|
221
236
|
}, {
|
|
222
237
|
default: m(() => [
|
|
223
|
-
|
|
224
|
-
e.required && !e.label.includes("(Obrigatório)") ? (
|
|
238
|
+
Z(k(e.label), 1),
|
|
239
|
+
e.required && !e.label.includes("(Obrigatório)") ? (i(), g("span", Be, " (Obrigatório)")) : y("", !0)
|
|
225
240
|
]),
|
|
226
241
|
_: 1
|
|
227
|
-
}, 8, ["for", "class"])) :
|
|
228
|
-
|
|
242
|
+
}, 8, ["for", "class"])) : y("", !0),
|
|
243
|
+
d(a(Ae), pe(a(W), {
|
|
229
244
|
"model-value": M.value,
|
|
230
|
-
searchTerm:
|
|
231
|
-
"onUpdate:searchTerm":
|
|
245
|
+
searchTerm: s.value,
|
|
246
|
+
"onUpdate:searchTerm": l[3] || (l[3] = (r) => s.value = r),
|
|
232
247
|
open: V.value,
|
|
233
|
-
"onUpdate:open":
|
|
248
|
+
"onUpdate:open": l[4] || (l[4] = (r) => V.value = r),
|
|
234
249
|
"reset-search-term-on-select": !1,
|
|
235
250
|
"filter-function": () => !0,
|
|
236
|
-
"onUpdate:modelValue":
|
|
251
|
+
"onUpdate:modelValue": ae
|
|
237
252
|
}), {
|
|
238
253
|
default: m(() => [
|
|
239
254
|
_("div", Ue, [
|
|
240
|
-
|
|
255
|
+
d(a(xe), { class: "w-full h-full" }, {
|
|
241
256
|
default: m(() => [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
id:
|
|
257
|
+
A(t.$slots, "input", {}, () => [
|
|
258
|
+
d(a(Ve), {
|
|
259
|
+
id: a(C),
|
|
245
260
|
"display-value": P,
|
|
246
|
-
placeholder: e.placeholder
|
|
261
|
+
placeholder: e.placeholder ?? te.value,
|
|
247
262
|
"with-icon": e.withIcon,
|
|
248
263
|
"with-clear-button": !1,
|
|
249
264
|
disabled: e.disabled,
|
|
250
|
-
error:
|
|
251
|
-
success:
|
|
265
|
+
error: h.value,
|
|
266
|
+
success: j.value,
|
|
252
267
|
class: S(
|
|
253
|
-
|
|
268
|
+
a(F)(
|
|
254
269
|
"pr-20",
|
|
255
|
-
|
|
270
|
+
h.value || j.value ? "border-[#3E2E46]" : "",
|
|
256
271
|
e.inputClass
|
|
257
272
|
)
|
|
258
273
|
),
|
|
259
274
|
maxlength: ee.value,
|
|
260
275
|
onInput: le,
|
|
261
276
|
onBlur: oe,
|
|
262
|
-
onFocus:
|
|
277
|
+
onFocus: l[0] || (l[0] = (r) => o("focus", r))
|
|
263
278
|
}, null, 8, ["id", "placeholder", "with-icon", "disabled", "error", "success", "class", "maxlength"])
|
|
264
279
|
])
|
|
265
280
|
]),
|
|
@@ -268,69 +283,69 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
|
268
283
|
_("div", {
|
|
269
284
|
class: S(["absolute right-9 flex items-center justify-center z-10 h-10 w-6", e.disabled ? "pointer-events-none opacity-40" : ""])
|
|
270
285
|
}, [
|
|
271
|
-
(
|
|
286
|
+
(h.value || e.modelValue && !j.value) && !e.disabled && e.withClearIcon ? (i(), g("div", {
|
|
272
287
|
key: 0,
|
|
273
288
|
class: "flex items-center justify-center w-full h-full cursor-pointer",
|
|
274
|
-
onMousedown:
|
|
275
|
-
onClick:
|
|
289
|
+
onMousedown: l[1] || (l[1] = q((r) => !e.disabled && re(), ["stop", "prevent"])),
|
|
290
|
+
onClick: l[2] || (l[2] = q(() => {
|
|
276
291
|
}, ["stop", "prevent"]))
|
|
277
292
|
}, [
|
|
278
|
-
|
|
293
|
+
h.value ? (i(), T(a(R), {
|
|
279
294
|
key: 0,
|
|
280
295
|
size: "20",
|
|
281
296
|
class: "text-[var(--alert-red-dark,#831511)] transition-opacity hover:opacity-80"
|
|
282
|
-
})) : (
|
|
297
|
+
})) : (i(), T(a(ve), {
|
|
283
298
|
key: 1,
|
|
284
299
|
size: "20",
|
|
285
300
|
class: "text-gray-400 transition-colors hover:text-[#831511]"
|
|
286
301
|
}))
|
|
287
|
-
], 32)) :
|
|
302
|
+
], 32)) : j.value ? (i(), T(a(ge), {
|
|
288
303
|
key: 1,
|
|
289
304
|
size: "20",
|
|
290
305
|
class: "text-[#4b715c] pointer-events-none"
|
|
291
|
-
})) :
|
|
306
|
+
})) : y("", !0)
|
|
292
307
|
], 2)
|
|
293
308
|
]),
|
|
294
|
-
|
|
295
|
-
|
|
309
|
+
A(t.$slots, "list", {}, () => [
|
|
310
|
+
d(a(Ie), null, {
|
|
296
311
|
default: m(() => [
|
|
297
|
-
e.loading && (e.loadingText || t.$slots.loading) ? (
|
|
298
|
-
|
|
312
|
+
e.loading && (e.loadingText || t.$slots.loading) ? (i(), g("div", Se, [
|
|
313
|
+
A(t.$slots, "loading", {}, () => [
|
|
299
314
|
_("div", Ze, [
|
|
300
|
-
|
|
315
|
+
d(a(je), { class: "size-4 animate-spin" }),
|
|
301
316
|
_("span", null, k(e.loadingText), 1)
|
|
302
317
|
])
|
|
303
318
|
])
|
|
304
|
-
])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (
|
|
319
|
+
])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (i(), T(a(we), { key: 1 }, {
|
|
305
320
|
default: m(() => [
|
|
306
|
-
|
|
307
|
-
|
|
321
|
+
A(t.$slots, "empty", {}, () => [
|
|
322
|
+
Z(k(e.notFoundText), 1)
|
|
308
323
|
])
|
|
309
324
|
]),
|
|
310
325
|
_: 3
|
|
311
|
-
})) :
|
|
312
|
-
de(
|
|
326
|
+
})) : y("", !0),
|
|
327
|
+
de(d(a($e), null, {
|
|
313
328
|
default: m(() => [
|
|
314
|
-
|
|
329
|
+
d(a(Ce), null, {
|
|
315
330
|
default: m(() => [
|
|
316
|
-
|
|
317
|
-
e.options && e.options.length ? (
|
|
318
|
-
key:
|
|
319
|
-
value:
|
|
331
|
+
A(t.$slots, "default", {}, () => [
|
|
332
|
+
e.options && e.options.length ? (i(!0), g(fe, { key: 0 }, me(e.options, (r, f) => (i(), T(a(be), {
|
|
333
|
+
key: r[e.optionId] || f,
|
|
334
|
+
value: r
|
|
320
335
|
}, {
|
|
321
336
|
default: m(() => [
|
|
322
|
-
|
|
323
|
-
|
|
337
|
+
A(t.$slots, "option", { item: r }, () => [
|
|
338
|
+
Z(k(r.text || r.label || r), 1)
|
|
324
339
|
]),
|
|
325
|
-
|
|
340
|
+
d(a(_e), { class: "ml-auto" }, {
|
|
326
341
|
default: m(() => [
|
|
327
|
-
|
|
342
|
+
d(a(ye), { size: "16" })
|
|
328
343
|
]),
|
|
329
344
|
_: 1
|
|
330
345
|
})
|
|
331
346
|
]),
|
|
332
347
|
_: 2
|
|
333
|
-
}, 1032, ["value"]))), 128)) :
|
|
348
|
+
}, 1032, ["value"]))), 128)) : y("", !0)
|
|
334
349
|
])
|
|
335
350
|
]),
|
|
336
351
|
_: 3
|
|
@@ -338,7 +353,7 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
|
338
353
|
]),
|
|
339
354
|
_: 3
|
|
340
355
|
}, 512), [
|
|
341
|
-
[
|
|
356
|
+
[he, !e.loading]
|
|
342
357
|
])
|
|
343
358
|
]),
|
|
344
359
|
_: 3
|
|
@@ -347,25 +362,25 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
|
347
362
|
]),
|
|
348
363
|
_: 3
|
|
349
364
|
}, 16, ["model-value", "searchTerm", "open"]),
|
|
350
|
-
e.description && !
|
|
365
|
+
e.description && !h.value ? (i(), g("div", {
|
|
351
366
|
key: 1,
|
|
352
367
|
id: K,
|
|
353
368
|
class: "text-gray-500 text-[11px] leading-tight"
|
|
354
|
-
}, k(e.description), 1)) :
|
|
355
|
-
typeof e.error == "string" &&
|
|
369
|
+
}, k(e.description), 1)) : y("", !0),
|
|
370
|
+
typeof e.error == "string" && h.value ? (i(), g("div", {
|
|
356
371
|
key: 2,
|
|
357
372
|
id: G,
|
|
358
373
|
class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
|
|
359
374
|
}, [
|
|
360
|
-
|
|
375
|
+
d(a(R), {
|
|
361
376
|
size: "14",
|
|
362
377
|
class: "text-[var(--alert-red-dark,#831511)] shrink-0"
|
|
363
378
|
}),
|
|
364
379
|
_("span", null, k(e.error), 1)
|
|
365
|
-
])) :
|
|
380
|
+
])) : y("", !0)
|
|
366
381
|
], 2));
|
|
367
382
|
}
|
|
368
383
|
});
|
|
369
384
|
export {
|
|
370
|
-
|
|
385
|
+
rt as default
|
|
371
386
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agrotools1/at-components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.34",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Componentes da Agrotools - Versão 2 (com re-export da V1)",
|
|
7
7
|
"author": "Agrotools",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"tw-animate-css": "^1.3.4",
|
|
58
58
|
"vue-component-type-helpers": "^2.2.0",
|
|
59
59
|
"vue-sonner": "^2.0.8",
|
|
60
|
-
"@agrotools1/at-
|
|
61
|
-
"@agrotools1/at-
|
|
60
|
+
"@agrotools1/at-tailwind-config": "0.2.0",
|
|
61
|
+
"@agrotools1/at-icons": "1.0.13"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@internationalized/date": "^3.8.2",
|