@v1nt1248/3nclient-lib 0.3.23 → 0.3.24
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/components/index.d.ts +2 -2
- package/dist/components/ui3n-input/types.d.ts +47 -4
- package/dist/components/ui3n-input/ui3n-input.vue.d.ts +23 -8
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +123 -100
- package/package.json +1 -1
- package/src/components/index.ts +3 -1
- package/src/components/ui3n-input/types.ts +50 -4
- package/src/components/ui3n-input/ui3n-input.vue +147 -150
package/dist/ui3n-components.js
CHANGED
|
@@ -17693,9 +17693,14 @@ var Rl = {
|
|
|
17693
17693
|
ui3nEmoji: "_ui3nEmoji_2j41l_1",
|
|
17694
17694
|
readonly: "_readonly_2j41l_14"
|
|
17695
17695
|
} }]]), Zl = [
|
|
17696
|
+
"autocomplete",
|
|
17696
17697
|
"type",
|
|
17697
17698
|
"placeholder",
|
|
17698
|
-
"disabled"
|
|
17699
|
+
"disabled",
|
|
17700
|
+
"readonly",
|
|
17701
|
+
"name",
|
|
17702
|
+
"maxlength",
|
|
17703
|
+
"minlength"
|
|
17699
17704
|
], Ql = /* @__PURE__ */ Q(/* @__PURE__ */ d({
|
|
17700
17705
|
__name: "ui3n-input",
|
|
17701
17706
|
props: {
|
|
@@ -17712,8 +17717,14 @@ var Rl = {
|
|
|
17712
17717
|
type: Boolean,
|
|
17713
17718
|
default: !1
|
|
17714
17719
|
},
|
|
17715
|
-
|
|
17716
|
-
|
|
17720
|
+
readonly: {
|
|
17721
|
+
type: Boolean,
|
|
17722
|
+
default: !1
|
|
17723
|
+
},
|
|
17724
|
+
name: {},
|
|
17725
|
+
maxlength: {},
|
|
17726
|
+
minlength: {},
|
|
17727
|
+
autocomplete: { default: "off" },
|
|
17717
17728
|
rules: { default: () => [] },
|
|
17718
17729
|
validateAtStartup: {
|
|
17719
17730
|
type: Boolean,
|
|
@@ -17748,152 +17759,164 @@ var Rl = {
|
|
|
17748
17759
|
"update:valid"
|
|
17749
17760
|
],
|
|
17750
17761
|
setup(e, { expose: t, emit: n }) {
|
|
17751
|
-
|
|
17752
|
-
|
|
17753
|
-
function E(e) {
|
|
17762
|
+
let r = e, l = n, u = N(), d = C(null), f = C(""), p = C(!1), m = C(!1), _ = C(""), v = i(() => !!u["prepend-icon"]), y = i(() => !!u["append-icon"]), S = i(() => r.displayStateMode === "success" && r.displayStateWithIcon && !m.value), w = i(() => !r.disabled && r.clearable && !!f.value && !S.value), E = i(() => S.value || w.value || y.value), O = i(() => !!_.value || !!(r.displayStateMode && r.displayStateMessage)), k = i(() => !!_.value || r.displayStateMode === "error" && !!r.displayStateMessage), A = i(() => r.displayStateMode === "success" && !!r.displayStateMessage);
|
|
17763
|
+
function j(e) {
|
|
17754
17764
|
return e.target.value;
|
|
17755
17765
|
}
|
|
17756
|
-
function
|
|
17766
|
+
function M(e) {
|
|
17757
17767
|
let t = [];
|
|
17758
17768
|
for (let n of r.rules) {
|
|
17759
17769
|
if (typeof n != "function") continue;
|
|
17760
17770
|
let r = n(e);
|
|
17761
17771
|
typeof r == "string" ? t.push(r) : r || t.push("Invalid");
|
|
17762
17772
|
}
|
|
17763
|
-
|
|
17773
|
+
_.value = t.join(". "), (p.value || r.validateAtStartup) && l("update:valid", t.length === 0);
|
|
17764
17774
|
}
|
|
17765
|
-
function
|
|
17766
|
-
|
|
17775
|
+
function P(e) {
|
|
17776
|
+
m.value = !0, l("focus", e);
|
|
17767
17777
|
}
|
|
17768
|
-
function
|
|
17778
|
+
function F(e) {
|
|
17769
17779
|
h(() => {
|
|
17770
|
-
|
|
17780
|
+
m.value = !1, l("blur", e);
|
|
17771
17781
|
});
|
|
17772
17782
|
}
|
|
17773
|
-
function
|
|
17774
|
-
let t =
|
|
17775
|
-
|
|
17783
|
+
function L(e) {
|
|
17784
|
+
let t = j(e);
|
|
17785
|
+
M(t), l("change", t);
|
|
17776
17786
|
}
|
|
17777
|
-
function
|
|
17778
|
-
let t =
|
|
17779
|
-
|
|
17787
|
+
function R(e) {
|
|
17788
|
+
let t = j(e);
|
|
17789
|
+
f.value = t, p.value = !0, M(t), l("update:modelValue", t), l("input", t);
|
|
17780
17790
|
}
|
|
17781
|
-
function
|
|
17791
|
+
function V(e) {
|
|
17782
17792
|
let { altKey: t, ctrlKey: n, metaKey: r, shiftKey: i } = e;
|
|
17783
|
-
|
|
17784
|
-
value:
|
|
17793
|
+
p.value = !0, M(f.value), l("enter", {
|
|
17794
|
+
value: f.value,
|
|
17785
17795
|
altKey: t,
|
|
17786
17796
|
ctrlKey: n,
|
|
17787
17797
|
metaKey: r,
|
|
17788
17798
|
shiftKey: i
|
|
17789
17799
|
});
|
|
17790
17800
|
}
|
|
17791
|
-
function
|
|
17792
|
-
|
|
17801
|
+
function H(e) {
|
|
17802
|
+
p.value = !0, M(f.value), l("escape", e);
|
|
17793
17803
|
}
|
|
17794
|
-
function
|
|
17804
|
+
function ee(e) {
|
|
17795
17805
|
l("keydown", e);
|
|
17796
17806
|
}
|
|
17797
|
-
function
|
|
17798
|
-
|
|
17807
|
+
function te() {
|
|
17808
|
+
f.value = "", p.value = !1, _.value = "", d.value && (d.value.value = "", d.value.focus()), l("update:modelValue", ""), l("input", ""), l("change", ""), l("clear"), l("update:valid", !0);
|
|
17799
17809
|
}
|
|
17800
17810
|
return t({
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17811
|
+
inputElement: d,
|
|
17812
|
+
isDirty: p,
|
|
17813
|
+
isFocused: m,
|
|
17814
|
+
clearValue: te
|
|
17804
17815
|
}), b(() => {
|
|
17805
|
-
|
|
17816
|
+
f.value = r.modelValue ?? "", d.value && (d.value.value = f.value, r.autofocus && d.value.focus(), l("init", d.value)), r.validateAtStartup && (p.value = !0, M(f.value));
|
|
17806
17817
|
}), I(() => r.modelValue, (e) => {
|
|
17807
17818
|
let t = e ?? "";
|
|
17808
|
-
t !==
|
|
17819
|
+
t !== f.value && (f.value = t, d.value && (d.value.value = t), M(t));
|
|
17809
17820
|
}), (t, n) => (x(), s("div", { class: g([
|
|
17810
17821
|
t.$style.ui3nInput,
|
|
17811
17822
|
e.size === "large" && t.$style.large,
|
|
17812
17823
|
e.label && t.$style.withLabel,
|
|
17813
17824
|
e.hideBottomSpace && t.$style.withoutBottomSpace,
|
|
17814
|
-
e.icon && t.$style.withIcon,
|
|
17815
|
-
e.clearable && d.value && t.$style.clearable,
|
|
17816
17825
|
e.disabled && t.$style.disabled,
|
|
17817
|
-
(!!
|
|
17826
|
+
(!!_.value || e.displayStateMode === "error") && t.$style.error,
|
|
17818
17827
|
e.displayStateMode === "success" && t.$style.success
|
|
17819
17828
|
]) }, [
|
|
17820
17829
|
e.label ? (x(), s("label", {
|
|
17821
17830
|
key: 0,
|
|
17822
17831
|
class: g(t.$style.ui3nInputLabel)
|
|
17823
17832
|
}, D(e.label), 3)) : o("", !0),
|
|
17824
|
-
c("
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
17833
|
+
c("div", { class: g([
|
|
17834
|
+
t.$style.inputWrapper,
|
|
17835
|
+
v.value && t.$style.withPrepend,
|
|
17836
|
+
E.value && t.$style.withAppend
|
|
17837
|
+
]) }, [
|
|
17838
|
+
v.value ? (x(), s("div", {
|
|
17839
|
+
key: 0,
|
|
17840
|
+
class: g(t.$style.prependIconSlot)
|
|
17841
|
+
}, [T(t.$slots, "prepend-icon")], 2)) : o("", !0),
|
|
17842
|
+
c("input", {
|
|
17843
|
+
ref_key: "inputElement",
|
|
17844
|
+
ref: d,
|
|
17845
|
+
autocomplete: e.autocomplete,
|
|
17846
|
+
type: e.type,
|
|
17847
|
+
placeholder: e.placeholder,
|
|
17848
|
+
disabled: e.disabled,
|
|
17849
|
+
readonly: e.readonly,
|
|
17850
|
+
name: e.name,
|
|
17851
|
+
maxlength: e.maxlength,
|
|
17852
|
+
minlength: e.minlength,
|
|
17853
|
+
class: g(t.$style.ui3nInputField),
|
|
17854
|
+
onInput: R,
|
|
17855
|
+
onKeydown: [
|
|
17856
|
+
z(V, ["enter"]),
|
|
17857
|
+
z(H, ["esc"]),
|
|
17858
|
+
ee
|
|
17859
|
+
],
|
|
17860
|
+
onFocus: P,
|
|
17861
|
+
onBlur: F,
|
|
17862
|
+
onChange: L
|
|
17863
|
+
}, null, 42, Zl),
|
|
17864
|
+
E.value ? (x(), s("div", {
|
|
17865
|
+
key: 1,
|
|
17866
|
+
class: g(t.$style.appendIconSlot)
|
|
17867
|
+
}, [
|
|
17868
|
+
S.value ? (x(), a(Hl, {
|
|
17869
|
+
key: 0,
|
|
17870
|
+
icon: "round-check-circle-outline",
|
|
17871
|
+
size: 16,
|
|
17872
|
+
color: "var(--success-content-default)",
|
|
17873
|
+
class: g(t.$style.appendSlotItem)
|
|
17874
|
+
}, null, 8, ["class"])) : o("", !0),
|
|
17875
|
+
w.value ? (x(), a(Gl, {
|
|
17876
|
+
key: 1,
|
|
17877
|
+
type: "icon",
|
|
17878
|
+
size: "small",
|
|
17879
|
+
color: "transparent",
|
|
17880
|
+
icon: "round-close",
|
|
17881
|
+
"icon-size": "16",
|
|
17882
|
+
"icon-color": "var(--color-icon-control-accent-default)",
|
|
17883
|
+
class: g(t.$style.appendSlotItem),
|
|
17884
|
+
onMousedown: n[0] ||= B(() => {}, ["prevent"]),
|
|
17885
|
+
onTouchstart: n[1] ||= B(() => {}, ["prevent"]),
|
|
17886
|
+
onClick: te
|
|
17887
|
+
}, null, 8, ["class"])) : o("", !0),
|
|
17888
|
+
y.value ? T(t.$slots, "append-icon", { key: 2 }) : o("", !0)
|
|
17889
|
+
], 2)) : o("", !0)
|
|
17890
|
+
], 2),
|
|
17891
|
+
O.value ? (x(), s("div", {
|
|
17843
17892
|
key: 1,
|
|
17844
|
-
icon: e.icon,
|
|
17845
|
-
size: 16,
|
|
17846
|
-
class: g([t.$style.ui3nInputIcon, e.disabled && t.$style.ui3nInputIconDisabled])
|
|
17847
|
-
}, null, 8, ["icon", "class"])) : o("", !0),
|
|
17848
|
-
v.value ? (x(), a(Hl, {
|
|
17849
|
-
key: 2,
|
|
17850
|
-
icon: "round-check-circle-outline",
|
|
17851
|
-
size: 16,
|
|
17852
|
-
color: "var(--success-content-default)",
|
|
17853
|
-
class: g(t.$style.ui3nInputSuccessIcon)
|
|
17854
|
-
}, null, 8, ["class"])) : o("", !0),
|
|
17855
|
-
y.value ? (x(), a(Gl, {
|
|
17856
|
-
key: 3,
|
|
17857
|
-
type: "icon",
|
|
17858
|
-
size: "small",
|
|
17859
|
-
color: "transparent",
|
|
17860
|
-
icon: "round-close",
|
|
17861
|
-
"icon-size": "16",
|
|
17862
|
-
"icon-color": "var(--color-icon-control-accent-default)",
|
|
17863
|
-
class: g(t.$style.clearBtn),
|
|
17864
|
-
onMousedown: n[0] ||= B(() => {}, ["prevent"]),
|
|
17865
|
-
onTouchstart: n[1] ||= B(() => {}, ["prevent"]),
|
|
17866
|
-
onClick: R
|
|
17867
|
-
}, null, 8, ["class"])) : o("", !0),
|
|
17868
|
-
S.value ? (x(), s("div", {
|
|
17869
|
-
key: 4,
|
|
17870
17893
|
class: g([
|
|
17871
17894
|
t.$style.ui3nInputFieldMessage,
|
|
17872
|
-
|
|
17873
|
-
|
|
17895
|
+
k.value && t.$style.ui3nInputErrorMessage,
|
|
17896
|
+
A.value && t.$style.ui3nInputSuccessMessage
|
|
17874
17897
|
])
|
|
17875
|
-
}, D(
|
|
17898
|
+
}, D(_.value || e.displayStateMessage), 3)) : o("", !0)
|
|
17876
17899
|
], 2));
|
|
17877
17900
|
}
|
|
17878
17901
|
}), [["__cssModules", { $style: {
|
|
17879
|
-
ui3nInput: "
|
|
17880
|
-
withLabel: "
|
|
17881
|
-
large: "
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
17896
|
-
disabled: "
|
|
17902
|
+
ui3nInput: "_ui3nInput_11ztm_1",
|
|
17903
|
+
withLabel: "_withLabel_11ztm_13",
|
|
17904
|
+
large: "_large_11ztm_18",
|
|
17905
|
+
withoutBottomSpace: "_withoutBottomSpace_11ztm_30",
|
|
17906
|
+
inputWrapper: "_inputWrapper_11ztm_33",
|
|
17907
|
+
ui3nInputField: "_ui3nInputField_11ztm_36",
|
|
17908
|
+
ui3nInputLabel: "_ui3nInputLabel_11ztm_44",
|
|
17909
|
+
prependIconSlot: "_prependIconSlot_11ztm_97",
|
|
17910
|
+
appendIconSlot: "_appendIconSlot_11ztm_104",
|
|
17911
|
+
withPrepend: "_withPrepend_11ztm_112",
|
|
17912
|
+
withAppend: "_withAppend_11ztm_116",
|
|
17913
|
+
appendSlotItem: "_appendSlotItem_11ztm_120",
|
|
17914
|
+
ui3nInputFieldMessage: "_ui3nInputFieldMessage_11ztm_124",
|
|
17915
|
+
ui3nInputErrorMessage: "_ui3nInputErrorMessage_11ztm_135",
|
|
17916
|
+
ui3nInputSuccessMessage: "_ui3nInputSuccessMessage_11ztm_139",
|
|
17917
|
+
error: "_error_11ztm_143",
|
|
17918
|
+
success: "_success_11ztm_150",
|
|
17919
|
+
disabled: "_disabled_11ztm_154"
|
|
17897
17920
|
} }]]), $l = /* @__PURE__ */ W(((e, t) => {
|
|
17898
17921
|
var n = Ei(), r = ca(), i = aa(), a = "[object String]";
|
|
17899
17922
|
function o(e) {
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { Ui3nDropFilesProps, Ui3nDropFilesEmits, Ui3nDropFilesSlots } from
|
|
|
10
10
|
import Ui3nEmoji from './ui3n-emoji/ui3n-emoji.vue';
|
|
11
11
|
import type { Ui3nEmojiProps, Ui3nEmojiEmits } from './ui3n-emoji/types';
|
|
12
12
|
import Ui3nInput from './ui3n-input/ui3n-input.vue';
|
|
13
|
-
import type { Ui3nInputProps, Ui3nInputEmits } from './ui3n-input/types';
|
|
13
|
+
import type { Ui3nInputProps, Ui3nInputEmits, Ui3nInputSlots, Ui3nInputExpose } from './ui3n-input/types';
|
|
14
14
|
import Ui3nInputFile from './ui3n-input-file/ui3n-input-file.vue';
|
|
15
15
|
import type { Ui3nInputFileProps, Ui3nInputFileEmits } from './ui3n-input-file/types';
|
|
16
16
|
import Ui3nText from './ui3n-text/ui3n-text.vue';
|
|
@@ -142,6 +142,8 @@ export {
|
|
|
142
142
|
Ui3nInput,
|
|
143
143
|
Ui3nInputProps,
|
|
144
144
|
Ui3nInputEmits,
|
|
145
|
+
Ui3nInputSlots,
|
|
146
|
+
Ui3nInputExpose,
|
|
145
147
|
Ui3nInputFile,
|
|
146
148
|
Ui3nInputFileProps,
|
|
147
149
|
Ui3nInputFileEmits,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Ref, VNode } from 'vue';
|
|
2
|
+
|
|
1
3
|
export interface Ui3nInputProps {
|
|
2
4
|
/**
|
|
3
5
|
* Input value
|
|
@@ -32,13 +34,27 @@ export interface Ui3nInputProps {
|
|
|
32
34
|
*/
|
|
33
35
|
autofocus?: boolean;
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Whether input is readonly
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
readonly?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Input name attribute (for use in native forms)
|
|
43
|
+
*/
|
|
44
|
+
name?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum length of input value
|
|
36
47
|
*/
|
|
37
|
-
|
|
48
|
+
maxlength?: number;
|
|
38
49
|
/**
|
|
39
|
-
*
|
|
50
|
+
* Minimum length of input value
|
|
40
51
|
*/
|
|
41
|
-
|
|
52
|
+
minlength?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Autocomplete attribute
|
|
55
|
+
* @default 'off'
|
|
56
|
+
*/
|
|
57
|
+
autocomplete?: string;
|
|
42
58
|
/**
|
|
43
59
|
* Validation rules
|
|
44
60
|
*/
|
|
@@ -128,3 +144,33 @@ export interface Ui3nInputEmits {
|
|
|
128
144
|
*/
|
|
129
145
|
(event: 'update:valid', value: boolean): void;
|
|
130
146
|
}
|
|
147
|
+
|
|
148
|
+
export interface Ui3nInputSlots {
|
|
149
|
+
/**
|
|
150
|
+
* Slot for prepend icon (displayed at the start of the input)
|
|
151
|
+
*/
|
|
152
|
+
'prepend-icon'?: () => VNode[];
|
|
153
|
+
/**
|
|
154
|
+
* Slot for append icon (displayed at the end of the input)
|
|
155
|
+
*/
|
|
156
|
+
'append-icon'?: () => VNode[];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface Ui3nInputExpose {
|
|
160
|
+
/**
|
|
161
|
+
* Reference to the input DOM element
|
|
162
|
+
*/
|
|
163
|
+
inputElement: Ref<HTMLInputElement | null>;
|
|
164
|
+
/**
|
|
165
|
+
* Whether the input has been modified
|
|
166
|
+
*/
|
|
167
|
+
isDirty: Ref<boolean>;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the input is currently focused
|
|
170
|
+
*/
|
|
171
|
+
isFocused: Ref<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Clear the input value
|
|
174
|
+
*/
|
|
175
|
+
clearValue: () => void;
|
|
176
|
+
}
|