@agrotools1/at-components 2.0.29 → 2.0.31
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/button-new/ButtonNew.vue.js +1 -1
- package/dist/changelog/versions/components/index.d.ts.map +1 -1
- package/dist/changelog/versions/components/v2.0.30.d.ts +4 -0
- package/dist/changelog/versions/components/v2.0.30.d.ts.map +1 -0
- package/dist/changelog/versions/components/v2.0.31.d.ts +4 -0
- package/dist/changelog/versions/components/v2.0.31.d.ts.map +1 -0
- package/dist/document-input/DocumentAutoComplete.vue.d.ts +80 -0
- package/dist/document-input/DocumentAutoComplete.vue.d.ts.map +1 -0
- package/dist/document-input/DocumentAutoComplete.vue.js +370 -0
- package/dist/document-input/DocumentAutoComplete.vue2.js +4 -0
- package/dist/document-input/DocumentInput.vue.d.ts +4 -0
- package/dist/document-input/DocumentInput.vue.d.ts.map +1 -1
- package/dist/document-input/DocumentInput.vue.js +121 -104
- package/dist/document-input/index.d.ts +2 -0
- package/dist/document-input/index.d.ts.map +1 -1
- package/dist/document-input/index.js +9 -2
- package/dist/index.css +1 -1
- package/dist/index.js +358 -354
- package/dist/packages/at-icons/dist/AtCheckSolidIcon/AtCheckSolidIcon.vue.js +46 -0
- package/dist/packages/at-icons/dist/AtCheckSolidIcon/index.js +5 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as p, computed as g, createBlock as r, openBlock as i, unref as t, normalizeClass as l, withCtx as c, renderSlot as f, createElementBlock as d, createCommentVNode as o, Fragment as y, toDisplayString as m, createVNode as v } from "vue";
|
|
2
2
|
import { cn as n } from "../lib/utils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AtCirclePlusSolidIcon as b, AtAngleRightSolidIcon as k } from "@agrotools1/at-icons";
|
|
4
4
|
import { Primitive as w } from "reka-ui";
|
|
5
5
|
import "../button/index.js";
|
|
6
6
|
import { resolveButtonNewTheme as z, buttonNewVariants as B } from "./variants.js";
|
|
@@ -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":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAgB3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2.0.30.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.30.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WAiBd,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2.0.31.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WAYd,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
id?: string;
|
|
3
|
+
modelValue?: any;
|
|
4
|
+
documentType?: 'cpf' | 'cnpj' | 'cpf-cnpj' | 'generic';
|
|
5
|
+
label?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
error?: boolean | string;
|
|
10
|
+
success?: boolean;
|
|
11
|
+
allowAlpha?: boolean;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
toUpperCase?: boolean;
|
|
15
|
+
unmask?: boolean;
|
|
16
|
+
customMask?: string;
|
|
17
|
+
class?: any;
|
|
18
|
+
inputClass?: any;
|
|
19
|
+
withIcon?: boolean;
|
|
20
|
+
withInternalValidation?: boolean;
|
|
21
|
+
options?: any[];
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
notFoundText?: string;
|
|
24
|
+
loadingText?: string;
|
|
25
|
+
optionId?: string;
|
|
26
|
+
}
|
|
27
|
+
declare function __VLS_template(): {
|
|
28
|
+
attrs: Partial<{}>;
|
|
29
|
+
slots: {
|
|
30
|
+
input?(_: {}): any;
|
|
31
|
+
list?(_: {}): any;
|
|
32
|
+
loading?(_: {}): any;
|
|
33
|
+
empty?(_: {}): any;
|
|
34
|
+
default?(_: {}): any;
|
|
35
|
+
option?(_: {
|
|
36
|
+
item: any;
|
|
37
|
+
}): any;
|
|
38
|
+
};
|
|
39
|
+
refs: {
|
|
40
|
+
wrapperRef: HTMLDivElement;
|
|
41
|
+
};
|
|
42
|
+
rootEl: HTMLDivElement;
|
|
43
|
+
};
|
|
44
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
45
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
46
|
+
clear: () => any;
|
|
47
|
+
"update:modelValue": (value: any) => any;
|
|
48
|
+
select: (value: any) => any;
|
|
49
|
+
blur: (event: FocusEvent) => any;
|
|
50
|
+
focus: (event: FocusEvent) => any;
|
|
51
|
+
validate: (isValid: boolean) => any;
|
|
52
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
53
|
+
onClear?: (() => any) | undefined;
|
|
54
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
55
|
+
onSelect?: ((value: any) => any) | undefined;
|
|
56
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
57
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
58
|
+
onValidate?: ((isValid: boolean) => any) | undefined;
|
|
59
|
+
}>, {
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
toUpperCase: boolean;
|
|
62
|
+
success: boolean;
|
|
63
|
+
error: boolean | string;
|
|
64
|
+
withIcon: boolean;
|
|
65
|
+
allowAlpha: boolean;
|
|
66
|
+
documentType: "cpf" | "cnpj" | "cpf-cnpj" | "generic";
|
|
67
|
+
withInternalValidation: boolean;
|
|
68
|
+
unmask: boolean;
|
|
69
|
+
optionId: string;
|
|
70
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
71
|
+
wrapperRef: HTMLDivElement;
|
|
72
|
+
}, HTMLDivElement>;
|
|
73
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
74
|
+
export default _default;
|
|
75
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
76
|
+
new (): {
|
|
77
|
+
$slots: S;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=DocumentAutoComplete.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentAutoComplete.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentAutoComplete.vue"],"names":[],"mappings":"AA0kBA,UAAU,KAAK;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAyXD,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;;;;;;;;;;;;;;;cA9xBR,OAAO;iBAMJ,OAAO;aAJX,OAAO;WADT,OAAO,GAAG,MAAM;cAUb,OAAO;gBARL,OAAO;kBAPL,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS;4BAgB7B,OAAO;YALvB,OAAO;cAUL,MAAM;;;kBAuxBjB,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"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { defineComponent as ie, useId as ue, ref as y, watch as ce, computed as U, createElementBlock as h, openBlock as n, normalizeClass as S, unref as r, createBlock as A, createCommentVNode as v, createVNode as f, withCtx as m, createTextVNode as z, toDisplayString as k, mergeProps as pe, createElementVNode as _, renderSlot as w, withModifiers as q, withDirectives as de, Fragment as fe, renderList as me, vShow as ge, nextTick as E } from "vue";
|
|
2
|
+
import { cn as F } from "../lib/utils.js";
|
|
3
|
+
import { AtCheckCircleRegularIcon as he } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
|
|
4
|
+
import { AtCheckSolidIcon as ve } from "../packages/at-icons/dist/AtCheckSolidIcon/index.js";
|
|
5
|
+
import { AtCircleXMarkRegularIcon as ye } from "../packages/at-icons/dist/AtCircleXMarkRegularIcon/index.js";
|
|
6
|
+
import { AtCircleXMarkSolidIcon as R } from "../packages/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
|
|
7
|
+
import { reactiveOmit as Ae } from "@vueuse/core";
|
|
8
|
+
import { useForwardPropsEmits as ke } from "reka-ui";
|
|
9
|
+
import we from "../combobox/Combobox.vue.js";
|
|
10
|
+
import xe from "../combobox/ComboboxAnchor.vue.js";
|
|
11
|
+
import Te from "../combobox/ComboboxEmpty.vue.js";
|
|
12
|
+
import Ce from "../combobox/ComboboxGroup.vue.js";
|
|
13
|
+
import Ve from "../combobox/ComboboxInput.vue.js";
|
|
14
|
+
import be from "../combobox/ComboboxItem.vue.js";
|
|
15
|
+
import _e from "../combobox/ComboboxItemIndicator.vue.js";
|
|
16
|
+
import Ie from "../combobox/ComboboxList.vue.js";
|
|
17
|
+
import $e from "../combobox/ComboboxViewport.vue.js";
|
|
18
|
+
import Me from "../label/Label.vue.js";
|
|
19
|
+
import { isValidCpf as x, isValidCnpj as T, applyCpfMask as O, applyCnpjMask as X } from "./utils.js";
|
|
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
|
+
const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
22
|
+
key: 0,
|
|
23
|
+
class: "py-6 flex items-center justify-center text-sm text-gray-500"
|
|
24
|
+
}, Ze = { class: "flex items-center gap-2" }, at = /* @__PURE__ */ ie({
|
|
25
|
+
__name: "DocumentAutoComplete",
|
|
26
|
+
props: {
|
|
27
|
+
id: {},
|
|
28
|
+
modelValue: {},
|
|
29
|
+
documentType: { default: "cpf-cnpj" },
|
|
30
|
+
label: {},
|
|
31
|
+
description: {},
|
|
32
|
+
required: { type: Boolean },
|
|
33
|
+
disabled: { type: Boolean, default: !1 },
|
|
34
|
+
error: { type: [Boolean, String], default: !1 },
|
|
35
|
+
success: { type: Boolean, default: !1 },
|
|
36
|
+
allowAlpha: { type: Boolean, default: !1 },
|
|
37
|
+
placeholder: {},
|
|
38
|
+
maxLength: {},
|
|
39
|
+
toUpperCase: { type: Boolean, default: !1 },
|
|
40
|
+
unmask: { type: Boolean, default: !0 },
|
|
41
|
+
customMask: {},
|
|
42
|
+
class: {},
|
|
43
|
+
inputClass: {},
|
|
44
|
+
withIcon: { type: Boolean, default: !0 },
|
|
45
|
+
withInternalValidation: { type: Boolean, default: !1 },
|
|
46
|
+
options: {},
|
|
47
|
+
loading: { type: Boolean },
|
|
48
|
+
notFoundText: {},
|
|
49
|
+
loadingText: {},
|
|
50
|
+
optionId: { default: "identifier" }
|
|
51
|
+
},
|
|
52
|
+
emits: ["update:modelValue", "select", "validate", "blur", "focus", "clear"],
|
|
53
|
+
setup(H, { emit: J }) {
|
|
54
|
+
const e = H, s = J, C = e.id || ue(), G = `error-${C}`, K = `desc-${C}`, Q = Ae(
|
|
55
|
+
e,
|
|
56
|
+
"modelValue",
|
|
57
|
+
"documentType",
|
|
58
|
+
"unmask",
|
|
59
|
+
"allowAlpha",
|
|
60
|
+
"placeholder",
|
|
61
|
+
"label",
|
|
62
|
+
"description",
|
|
63
|
+
"error",
|
|
64
|
+
"success",
|
|
65
|
+
"required",
|
|
66
|
+
"class",
|
|
67
|
+
"inputClass",
|
|
68
|
+
"toUpperCase",
|
|
69
|
+
"maxLength",
|
|
70
|
+
"customMask",
|
|
71
|
+
"withInternalValidation",
|
|
72
|
+
"options",
|
|
73
|
+
"loading",
|
|
74
|
+
"notFoundText",
|
|
75
|
+
"loadingText",
|
|
76
|
+
"optionId",
|
|
77
|
+
"modelValue"
|
|
78
|
+
), W = ke(Q, s), i = y(""), V = y(!1), I = y(!1), L = y(!1), $ = y(null), M = y(e.modelValue);
|
|
79
|
+
function Y(t, a) {
|
|
80
|
+
if (!a) return t;
|
|
81
|
+
const l = t.replace(/[^0-9A-Za-z]/g, "");
|
|
82
|
+
if (!l) return "";
|
|
83
|
+
let c = "", o = 0;
|
|
84
|
+
for (let p = 0; p < a.length && o < l.length; p++) {
|
|
85
|
+
const u = a[p], d = l[o];
|
|
86
|
+
u === "9" ? /[0-9]/.test(d) ? (c += d, o++) : (o++, p--) : u === "A" ? /[A-Za-z]/.test(d) ? (c += e.toUpperCase ? d.toUpperCase() : d, o++) : (o++, p--) : u === "X" ? /[0-9A-Za-z]/.test(d) ? (c += e.toUpperCase ? d.toUpperCase() : d, o++) : (o++, p--) : (c += u, d === u && o++);
|
|
87
|
+
}
|
|
88
|
+
return c;
|
|
89
|
+
}
|
|
90
|
+
function j(t) {
|
|
91
|
+
if (e.customMask && e.documentType === "generic")
|
|
92
|
+
return Y(t, e.customMask);
|
|
93
|
+
const a = /[A-Z]/i.test(t);
|
|
94
|
+
return e.documentType === "cpf" ? O(t) : e.documentType === "cnpj" ? X(t, e.allowAlpha) : e.documentType === "cpf-cnpj" ? e.allowAlpha && a || t.length > 11 ? X(t, e.allowAlpha) : O(t) : t;
|
|
95
|
+
}
|
|
96
|
+
const P = (t) => {
|
|
97
|
+
if (!t) return i.value || "";
|
|
98
|
+
if (typeof t == "string") {
|
|
99
|
+
const c = t.replace(
|
|
100
|
+
e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
|
|
101
|
+
""
|
|
102
|
+
);
|
|
103
|
+
return j(c);
|
|
104
|
+
}
|
|
105
|
+
const l = (t.identifier || t.value || t.text || "").replace(
|
|
106
|
+
e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
|
|
107
|
+
""
|
|
108
|
+
);
|
|
109
|
+
return j(l);
|
|
110
|
+
};
|
|
111
|
+
ce(
|
|
112
|
+
() => e.modelValue,
|
|
113
|
+
(t) => {
|
|
114
|
+
if (M.value = t, t == null || t === "") {
|
|
115
|
+
i.value !== "" && (i.value = ""), M.value = void 0;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const a = P(t);
|
|
119
|
+
i.value !== a && (i.value = a);
|
|
120
|
+
},
|
|
121
|
+
{ immediate: !0 }
|
|
122
|
+
);
|
|
123
|
+
const ee = U(() => e.maxLength ? e.maxLength : e.customMask && e.documentType === "generic" ? e.customMask.length : e.documentType === "cpf" ? 14 : 18), te = U(() => {
|
|
124
|
+
switch (e.documentType) {
|
|
125
|
+
case "cnpj":
|
|
126
|
+
return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
|
|
127
|
+
case "cpf":
|
|
128
|
+
return "000.000.000-00";
|
|
129
|
+
case "cpf-cnpj":
|
|
130
|
+
return "CPF ou CNPJ";
|
|
131
|
+
default:
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}), g = U(() => {
|
|
135
|
+
if (e.error) return !0;
|
|
136
|
+
if (e.withInternalValidation) {
|
|
137
|
+
const t = e.modelValue;
|
|
138
|
+
if (!t || I.value) return !1;
|
|
139
|
+
const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
|
|
140
|
+
if (!l) return !1;
|
|
141
|
+
if (l.length === 11 && !x(l) || l.length === 14 && !T(l) || L.value && (e.documentType === "cpf" && l.length !== 11 || e.documentType === "cnpj" && l.length !== 14 || e.documentType === "cpf-cnpj" && l.length !== 11 && l.length !== 14))
|
|
142
|
+
return !0;
|
|
143
|
+
}
|
|
144
|
+
return !1;
|
|
145
|
+
}), B = U(() => {
|
|
146
|
+
if (g.value) return !1;
|
|
147
|
+
if (e.success) return !0;
|
|
148
|
+
if (e.withInternalValidation) {
|
|
149
|
+
const t = e.modelValue;
|
|
150
|
+
if (!t) return !1;
|
|
151
|
+
const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
|
|
152
|
+
if (e.documentType === "cpf") return x(l);
|
|
153
|
+
if (e.documentType === "cnpj") return T(l);
|
|
154
|
+
if (e.documentType === "cpf-cnpj")
|
|
155
|
+
return l.length === 11 ? x(l) : T(l);
|
|
156
|
+
}
|
|
157
|
+
return !1;
|
|
158
|
+
});
|
|
159
|
+
function D(t) {
|
|
160
|
+
let a = !1;
|
|
161
|
+
e.documentType === "cpf" ? a = x(t) : e.documentType === "cnpj" ? a = T(t) : e.documentType === "cpf-cnpj" && (a = t.length === 11 ? x(t) : T(t)), s("validate", a);
|
|
162
|
+
}
|
|
163
|
+
function le(t) {
|
|
164
|
+
const a = t.target;
|
|
165
|
+
let l = a.value;
|
|
166
|
+
const c = a.selectionStart || 0;
|
|
167
|
+
I.value = !1, e.toUpperCase && (l = l.toUpperCase());
|
|
168
|
+
let o = l.replace(
|
|
169
|
+
e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
|
|
170
|
+
""
|
|
171
|
+
), p = e.maxLength;
|
|
172
|
+
p || (e.customMask && e.documentType === "generic" ? p = e.customMask.length : p = e.documentType === "cpf" ? 11 : 14), o = o.slice(0, p);
|
|
173
|
+
const u = j(o), d = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, ne = (l.slice(0, c).match(d) || []).length, se = (e.unmask ? o : u) || void 0;
|
|
174
|
+
s("update:modelValue", se), D(o), i.value = u, E(() => {
|
|
175
|
+
a.value = u;
|
|
176
|
+
let Z = 0, N = 0;
|
|
177
|
+
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++, Z = b + 1, !(N >= ne)); b++)
|
|
178
|
+
;
|
|
179
|
+
a.setSelectionRange(Z, Z);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function ae(t) {
|
|
183
|
+
i.value = "", M.value = null, s("update:modelValue", null), E(() => {
|
|
184
|
+
if (!$.value) return;
|
|
185
|
+
const a = $.value.querySelector(`[id="${C}"]`) || $.value.querySelector("input"), l = (a == null ? void 0 : a.tagName) === "INPUT" ? a : a == null ? void 0 : a.querySelector("input");
|
|
186
|
+
l && (l.value = "", l.dispatchEvent(new Event("input", { bubbles: !0 }))), E(() => {
|
|
187
|
+
V.value = !1;
|
|
188
|
+
});
|
|
189
|
+
}), I.value = !0, s("validate", !1), s("clear"), V.value = !1;
|
|
190
|
+
}
|
|
191
|
+
function re(t) {
|
|
192
|
+
if (!t) {
|
|
193
|
+
i.value = "", I.value = !0, s("update:modelValue", null);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
s("update:modelValue", t), s("select", t);
|
|
197
|
+
const l = (t.identifier || t.value || t.text || "").replace(/[^A-Z0-9]/gi, "");
|
|
198
|
+
i.value = j(l), D(l), V.value = !1;
|
|
199
|
+
}
|
|
200
|
+
function oe(t) {
|
|
201
|
+
L.value = !0, s("blur", t);
|
|
202
|
+
const a = i.value.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
|
|
203
|
+
let l = !1;
|
|
204
|
+
a.length === 11 ? l = x(a) : a.length === 14 && (l = T(a)), l && s("update:modelValue", e.toUpperCase ? a.toUpperCase() : a);
|
|
205
|
+
}
|
|
206
|
+
return (t, a) => (n(), h("div", {
|
|
207
|
+
class: S(r(F)("space-y-1.5 w-full", e.class)),
|
|
208
|
+
ref_key: "wrapperRef",
|
|
209
|
+
ref: $
|
|
210
|
+
}, [
|
|
211
|
+
e.label ? (n(), A(r(Me), {
|
|
212
|
+
key: 0,
|
|
213
|
+
for: r(C),
|
|
214
|
+
class: S(
|
|
215
|
+
r(F)(
|
|
216
|
+
"text-[#101011] font-normal text-[10px] leading-[10px]",
|
|
217
|
+
g.value ? "text-[var(--alert-red-dark,#831511)]" : ""
|
|
218
|
+
)
|
|
219
|
+
)
|
|
220
|
+
}, {
|
|
221
|
+
default: m(() => [
|
|
222
|
+
z(k(e.label), 1),
|
|
223
|
+
e.required && !e.label.includes("(Obrigatório)") ? (n(), h("span", Be, " (Obrigatório)")) : v("", !0)
|
|
224
|
+
]),
|
|
225
|
+
_: 1
|
|
226
|
+
}, 8, ["for", "class"])) : v("", !0),
|
|
227
|
+
f(r(we), pe(r(W), {
|
|
228
|
+
"model-value": M.value,
|
|
229
|
+
searchTerm: i.value,
|
|
230
|
+
"onUpdate:searchTerm": a[3] || (a[3] = (l) => i.value = l),
|
|
231
|
+
open: V.value,
|
|
232
|
+
"onUpdate:open": a[4] || (a[4] = (l) => V.value = l),
|
|
233
|
+
"reset-search-term-on-select": !1,
|
|
234
|
+
"filter-function": () => !0,
|
|
235
|
+
"onUpdate:modelValue": re
|
|
236
|
+
}), {
|
|
237
|
+
default: m(() => [
|
|
238
|
+
_("div", Ue, [
|
|
239
|
+
f(r(xe), { class: "w-full h-full" }, {
|
|
240
|
+
default: m(() => [
|
|
241
|
+
w(t.$slots, "input", {}, () => [
|
|
242
|
+
f(r(Ve), {
|
|
243
|
+
id: r(C),
|
|
244
|
+
"display-value": P,
|
|
245
|
+
placeholder: e.placeholder || te.value,
|
|
246
|
+
"with-icon": e.withIcon,
|
|
247
|
+
"with-clear-button": !1,
|
|
248
|
+
disabled: e.disabled,
|
|
249
|
+
error: g.value,
|
|
250
|
+
success: B.value,
|
|
251
|
+
class: S(
|
|
252
|
+
r(F)(
|
|
253
|
+
"pr-20",
|
|
254
|
+
g.value || B.value ? "border-[#3E2E46]" : "",
|
|
255
|
+
e.inputClass
|
|
256
|
+
)
|
|
257
|
+
),
|
|
258
|
+
maxlength: ee.value,
|
|
259
|
+
onInput: le,
|
|
260
|
+
onBlur: oe,
|
|
261
|
+
onFocus: a[0] || (a[0] = (l) => s("focus", l))
|
|
262
|
+
}, null, 8, ["id", "placeholder", "with-icon", "disabled", "error", "success", "class", "maxlength"])
|
|
263
|
+
])
|
|
264
|
+
]),
|
|
265
|
+
_: 3
|
|
266
|
+
}),
|
|
267
|
+
_("div", {
|
|
268
|
+
class: S(["absolute right-9 flex items-center justify-center z-10 h-10 w-6", e.disabled ? "pointer-events-none opacity-40" : ""])
|
|
269
|
+
}, [
|
|
270
|
+
g.value || e.modelValue && !B.value ? (n(), h("div", {
|
|
271
|
+
key: 0,
|
|
272
|
+
class: "flex items-center justify-center w-full h-full cursor-pointer",
|
|
273
|
+
onMousedown: a[1] || (a[1] = q((l) => !e.disabled && ae(), ["stop", "prevent"])),
|
|
274
|
+
onClick: a[2] || (a[2] = q(() => {
|
|
275
|
+
}, ["stop", "prevent"]))
|
|
276
|
+
}, [
|
|
277
|
+
g.value ? (n(), A(r(R), {
|
|
278
|
+
key: 0,
|
|
279
|
+
size: "20",
|
|
280
|
+
class: "text-[var(--alert-red-dark,#831511)] transition-opacity hover:opacity-80"
|
|
281
|
+
})) : (n(), A(r(ye), {
|
|
282
|
+
key: 1,
|
|
283
|
+
size: "20",
|
|
284
|
+
class: "text-gray-400 transition-colors hover:text-[#831511]"
|
|
285
|
+
}))
|
|
286
|
+
], 32)) : B.value ? (n(), A(r(he), {
|
|
287
|
+
key: 1,
|
|
288
|
+
size: "20",
|
|
289
|
+
class: "text-[#4b715c] pointer-events-none"
|
|
290
|
+
})) : v("", !0)
|
|
291
|
+
], 2)
|
|
292
|
+
]),
|
|
293
|
+
w(t.$slots, "list", {}, () => [
|
|
294
|
+
f(r(Ie), null, {
|
|
295
|
+
default: m(() => [
|
|
296
|
+
e.loading && (e.loadingText || t.$slots.loading) ? (n(), h("div", Se, [
|
|
297
|
+
w(t.$slots, "loading", {}, () => [
|
|
298
|
+
_("div", Ze, [
|
|
299
|
+
f(r(je), { class: "size-4 animate-spin" }),
|
|
300
|
+
_("span", null, k(e.loadingText), 1)
|
|
301
|
+
])
|
|
302
|
+
])
|
|
303
|
+
])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (n(), A(r(Te), { key: 1 }, {
|
|
304
|
+
default: m(() => [
|
|
305
|
+
w(t.$slots, "empty", {}, () => [
|
|
306
|
+
z(k(e.notFoundText), 1)
|
|
307
|
+
])
|
|
308
|
+
]),
|
|
309
|
+
_: 3
|
|
310
|
+
})) : v("", !0),
|
|
311
|
+
de(f(r($e), null, {
|
|
312
|
+
default: m(() => [
|
|
313
|
+
f(r(Ce), null, {
|
|
314
|
+
default: m(() => [
|
|
315
|
+
w(t.$slots, "default", {}, () => [
|
|
316
|
+
e.options && e.options.length ? (n(!0), h(fe, { key: 0 }, me(e.options, (l, c) => (n(), A(r(be), {
|
|
317
|
+
key: l[e.optionId] || c,
|
|
318
|
+
value: l
|
|
319
|
+
}, {
|
|
320
|
+
default: m(() => [
|
|
321
|
+
w(t.$slots, "option", { item: l }, () => [
|
|
322
|
+
z(k(l.text || l.label || l), 1)
|
|
323
|
+
]),
|
|
324
|
+
f(r(_e), { class: "ml-auto" }, {
|
|
325
|
+
default: m(() => [
|
|
326
|
+
f(r(ve), { size: "16" })
|
|
327
|
+
]),
|
|
328
|
+
_: 1
|
|
329
|
+
})
|
|
330
|
+
]),
|
|
331
|
+
_: 2
|
|
332
|
+
}, 1032, ["value"]))), 128)) : v("", !0)
|
|
333
|
+
])
|
|
334
|
+
]),
|
|
335
|
+
_: 3
|
|
336
|
+
})
|
|
337
|
+
]),
|
|
338
|
+
_: 3
|
|
339
|
+
}, 512), [
|
|
340
|
+
[ge, !e.loading]
|
|
341
|
+
])
|
|
342
|
+
]),
|
|
343
|
+
_: 3
|
|
344
|
+
})
|
|
345
|
+
])
|
|
346
|
+
]),
|
|
347
|
+
_: 3
|
|
348
|
+
}, 16, ["model-value", "searchTerm", "open"]),
|
|
349
|
+
e.description && !g.value ? (n(), h("div", {
|
|
350
|
+
key: 1,
|
|
351
|
+
id: K,
|
|
352
|
+
class: "text-gray-500 text-[11px] leading-tight"
|
|
353
|
+
}, k(e.description), 1)) : v("", !0),
|
|
354
|
+
typeof e.error == "string" && g.value ? (n(), h("div", {
|
|
355
|
+
key: 2,
|
|
356
|
+
id: G,
|
|
357
|
+
class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
|
|
358
|
+
}, [
|
|
359
|
+
f(r(R), {
|
|
360
|
+
size: "14",
|
|
361
|
+
class: "text-[var(--alert-red-dark,#831511)] shrink-0"
|
|
362
|
+
}),
|
|
363
|
+
_("span", null, k(e.error), 1)
|
|
364
|
+
])) : v("", !0)
|
|
365
|
+
], 2));
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
export {
|
|
369
|
+
at as default
|
|
370
|
+
};
|
|
@@ -10,6 +10,7 @@ export interface DocumentInputProps {
|
|
|
10
10
|
error?: boolean | string;
|
|
11
11
|
success?: boolean;
|
|
12
12
|
allowAlpha?: boolean;
|
|
13
|
+
withInternalValidation?: boolean;
|
|
13
14
|
placeholder?: string;
|
|
14
15
|
maxLength?: number;
|
|
15
16
|
toUpperCase?: boolean;
|
|
@@ -22,12 +23,14 @@ declare const _default: import('vue').DefineComponent<DocumentInputProps, {
|
|
|
22
23
|
input: import('vue').Ref<any, any>;
|
|
23
24
|
localValue: import('vue').Ref<string, string>;
|
|
24
25
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
26
|
+
clear: () => any;
|
|
25
27
|
"update:modelValue": (payload: string) => any;
|
|
26
28
|
change: (payload: string) => any;
|
|
27
29
|
blur: (payload: FocusEvent) => any;
|
|
28
30
|
focus: (payload: FocusEvent) => any;
|
|
29
31
|
validate: (isValid: boolean) => any;
|
|
30
32
|
}, string, import('vue').PublicProps, Readonly<DocumentInputProps> & Readonly<{
|
|
33
|
+
onClear?: (() => any) | undefined;
|
|
31
34
|
"onUpdate:modelValue"?: ((payload: string) => any) | undefined;
|
|
32
35
|
onChange?: ((payload: string) => any) | undefined;
|
|
33
36
|
onBlur?: ((payload: FocusEvent) => any) | undefined;
|
|
@@ -40,6 +43,7 @@ declare const _default: import('vue').DefineComponent<DocumentInputProps, {
|
|
|
40
43
|
error: boolean | string;
|
|
41
44
|
allowAlpha: boolean;
|
|
42
45
|
documentType: DocumentType;
|
|
46
|
+
withInternalValidation: boolean;
|
|
43
47
|
unmask: boolean;
|
|
44
48
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
45
49
|
inputRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('../input/Input.vue').InputProps> & Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentInput.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DocumentInput.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentInput.vue"],"names":[],"mappings":"AA2dA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAA;AAElE,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB;;;;;;;;;;;;;;;;;;;cAZY,OAAO;iBAOJ,OAAO;aALX,OAAO;WADT,OAAO,GAAG,MAAM;gBAEX,OAAO;kBAPL,YAAY;4BAQF,OAAO;YAIvB,OAAO;;;;;;;;;;;;;;;;;;;;;AAulBlB,wBAUG"}
|