@tb-dev/vue 0.3.33 → 0.3.35
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.
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { InputProps } from './types';
|
|
2
|
+
import { Option } from '@tb-dev/utils';
|
|
2
3
|
declare function focus(): void;
|
|
4
|
+
declare function blur(): void;
|
|
5
|
+
declare function select(): void;
|
|
3
6
|
declare const _default: import('vue').DefineComponent<InputProps, {
|
|
7
|
+
inputEl: import('vue').ComputedRef<Option<HTMLInputElement>>;
|
|
4
8
|
focus: typeof focus;
|
|
9
|
+
blur: typeof blur;
|
|
10
|
+
select: typeof select;
|
|
5
11
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
12
|
"update:modelValue": (value: string | null) => any;
|
|
7
13
|
}, string, import('vue').PublicProps, Readonly<InputProps> & Readonly<{
|
|
@@ -10,7 +16,7 @@ declare const _default: import('vue').DefineComponent<InputProps, {
|
|
|
10
16
|
type: import('vue').InputTypeHTMLAttribute;
|
|
11
17
|
spellcheck: boolean | "true" | "false";
|
|
12
18
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
13
|
-
|
|
19
|
+
inputComponent: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
14
20
|
defaultValue?: string | number;
|
|
15
21
|
modelValue?: string | number;
|
|
16
22
|
class?: import('vue').HTMLAttributes["class"];
|
|
@@ -1,14 +1,76 @@
|
|
|
1
1
|
import { Option } from '@tb-dev/utils';
|
|
2
2
|
import { InputTextProps } from './types';
|
|
3
3
|
type __VLS_Props = InputTextProps;
|
|
4
|
+
declare function focus(): void;
|
|
5
|
+
declare function blur(): void;
|
|
6
|
+
declare function select(): void;
|
|
4
7
|
type __VLS_PublicProps = {
|
|
5
8
|
modelValue: Option<string>;
|
|
6
9
|
} & __VLS_Props;
|
|
7
|
-
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
10
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
11
|
+
inputEl: import('vue').ComputedRef<Option<HTMLInputElement>>;
|
|
12
|
+
focus: typeof focus;
|
|
13
|
+
blur: typeof blur;
|
|
14
|
+
select: typeof select;
|
|
15
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
8
16
|
"update:modelValue": (value: Option<string>) => any;
|
|
9
17
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
10
18
|
"onUpdate:modelValue"?: ((value: Option<string>) => any) | undefined;
|
|
11
19
|
}>, {
|
|
12
20
|
spellcheck: boolean | "true" | "false";
|
|
13
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
21
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
22
|
+
inputComponent: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').InputProps> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
inputEl: import('vue').ComputedRef<Option<HTMLInputElement>>;
|
|
26
|
+
focus: () => void;
|
|
27
|
+
blur: () => void;
|
|
28
|
+
select: () => void;
|
|
29
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
+
"update:modelValue": (value: string | null) => any;
|
|
31
|
+
}, import('vue').PublicProps, {
|
|
32
|
+
type: import('vue').InputTypeHTMLAttribute;
|
|
33
|
+
spellcheck: boolean | "true" | "false";
|
|
34
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
35
|
+
inputComponent: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
36
|
+
defaultValue?: string | number;
|
|
37
|
+
modelValue?: string | number;
|
|
38
|
+
class?: import('vue').HTMLAttributes["class"];
|
|
39
|
+
}> & Readonly<{
|
|
40
|
+
"onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
41
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
42
|
+
"update:modelValue": (payload: string | number) => any;
|
|
43
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLInputElement, import('vue').ComponentProvideOptions, {
|
|
44
|
+
P: {};
|
|
45
|
+
B: {};
|
|
46
|
+
D: {};
|
|
47
|
+
C: {};
|
|
48
|
+
M: {};
|
|
49
|
+
Defaults: {};
|
|
50
|
+
}, Readonly<{
|
|
51
|
+
defaultValue?: string | number;
|
|
52
|
+
modelValue?: string | number;
|
|
53
|
+
class?: import('vue').HTMLAttributes["class"];
|
|
54
|
+
}> & Readonly<{
|
|
55
|
+
"onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
56
|
+
}>, {}, {}, {}, {}, {}> | null;
|
|
57
|
+
}, any, import('vue').ComponentProvideOptions, {
|
|
58
|
+
P: {};
|
|
59
|
+
B: {};
|
|
60
|
+
D: {};
|
|
61
|
+
C: {};
|
|
62
|
+
M: {};
|
|
63
|
+
Defaults: {};
|
|
64
|
+
}, Readonly<import('..').InputProps> & Readonly<{
|
|
65
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
66
|
+
}>, {
|
|
67
|
+
inputEl: import('vue').ComputedRef<Option<HTMLInputElement>>;
|
|
68
|
+
focus: () => void;
|
|
69
|
+
blur: () => void;
|
|
70
|
+
select: () => void;
|
|
71
|
+
}, {}, {}, {}, {
|
|
72
|
+
type: import('vue').InputTypeHTMLAttribute;
|
|
73
|
+
spellcheck: boolean | "true" | "false";
|
|
74
|
+
}> | null;
|
|
75
|
+
}, any>;
|
|
14
76
|
export default _default;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { TextareaProps } from './types';
|
|
2
|
-
|
|
2
|
+
import { Option } from '@tb-dev/utils';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<TextareaProps, {
|
|
4
|
+
textareaEl: import('vue').ComputedRef<Option<HTMLTextAreaElement>>;
|
|
5
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
6
|
"update:modelValue": (value: string | null) => any;
|
|
4
7
|
}, string, import('vue').PublicProps, Readonly<TextareaProps> & Readonly<{
|
|
5
8
|
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
@@ -7,5 +10,28 @@ declare const _default: import('vue').DefineComponent<TextareaProps, {}, {}, {},
|
|
|
7
10
|
autocomplete: string;
|
|
8
11
|
spellcheck: boolean | "true" | "false";
|
|
9
12
|
autocorrect: string;
|
|
10
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
14
|
+
textareaComponent: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
15
|
+
class?: import('vue').HTMLAttributes["class"];
|
|
16
|
+
defaultValue?: string | number;
|
|
17
|
+
modelValue?: string | number;
|
|
18
|
+
}> & Readonly<{
|
|
19
|
+
"onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
21
|
+
"update:modelValue": (payload: string | number) => any;
|
|
22
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLTextAreaElement, import('vue').ComponentProvideOptions, {
|
|
23
|
+
P: {};
|
|
24
|
+
B: {};
|
|
25
|
+
D: {};
|
|
26
|
+
C: {};
|
|
27
|
+
M: {};
|
|
28
|
+
Defaults: {};
|
|
29
|
+
}, Readonly<{
|
|
30
|
+
class?: import('vue').HTMLAttributes["class"];
|
|
31
|
+
defaultValue?: string | number;
|
|
32
|
+
modelValue?: string | number;
|
|
33
|
+
}> & Readonly<{
|
|
34
|
+
"onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
35
|
+
}>, {}, {}, {}, {}, {}> | null;
|
|
36
|
+
}, any>;
|
|
11
37
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -2374,7 +2374,10 @@ const _sfc_main$1T = /* @__PURE__ */ defineComponent({
|
|
|
2374
2374
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2375
2375
|
const props = __props;
|
|
2376
2376
|
const emit = __emit;
|
|
2377
|
-
const
|
|
2377
|
+
const inputComponent = useTemplateRef("inputComponent");
|
|
2378
|
+
const inputEl = computed(() => {
|
|
2379
|
+
return inputComponent.value?.$el;
|
|
2380
|
+
});
|
|
2378
2381
|
const value = computed({
|
|
2379
2382
|
// eslint-disable-next-line no-undefined
|
|
2380
2383
|
get: () => props.modelValue ?? void 0,
|
|
@@ -2382,16 +2385,22 @@ const _sfc_main$1T = /* @__PURE__ */ defineComponent({
|
|
|
2382
2385
|
});
|
|
2383
2386
|
const [DefineTemplate, ReuseTemplate] = createReusableTemplate();
|
|
2384
2387
|
function focus() {
|
|
2385
|
-
inputEl.value
|
|
2388
|
+
inputEl.value?.focus();
|
|
2389
|
+
}
|
|
2390
|
+
function blur() {
|
|
2391
|
+
inputEl.value?.blur();
|
|
2386
2392
|
}
|
|
2387
|
-
|
|
2393
|
+
function select() {
|
|
2394
|
+
inputEl.value?.select();
|
|
2395
|
+
}
|
|
2396
|
+
__expose({ inputEl, focus, blur, select });
|
|
2388
2397
|
return (_ctx, _cache) => {
|
|
2389
2398
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
2390
2399
|
createVNode(unref(DefineTemplate), null, {
|
|
2391
2400
|
default: withCtx(() => [
|
|
2392
2401
|
createVNode(unref(_sfc_main$1U), mergeProps({
|
|
2393
|
-
ref_key: "
|
|
2394
|
-
ref:
|
|
2402
|
+
ref_key: "inputComponent",
|
|
2403
|
+
ref: inputComponent
|
|
2395
2404
|
}, _ctx.$attrs, {
|
|
2396
2405
|
modelValue: value.value,
|
|
2397
2406
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
@@ -2691,11 +2700,25 @@ const _sfc_main$1M = /* @__PURE__ */ defineComponent({
|
|
|
2691
2700
|
"modelModifiers": {}
|
|
2692
2701
|
}),
|
|
2693
2702
|
emits: ["update:modelValue"],
|
|
2694
|
-
setup(__props) {
|
|
2703
|
+
setup(__props, { expose: __expose }) {
|
|
2695
2704
|
const props = __props;
|
|
2696
2705
|
const value = useModel(__props, "modelValue");
|
|
2706
|
+
const inputComponent = useTemplateRef("inputComponent");
|
|
2707
|
+
const inputEl = computed(() => inputComponent.value?.inputEl);
|
|
2708
|
+
function focus() {
|
|
2709
|
+
inputEl.value?.focus();
|
|
2710
|
+
}
|
|
2711
|
+
function blur() {
|
|
2712
|
+
inputEl.value?.blur();
|
|
2713
|
+
}
|
|
2714
|
+
function select() {
|
|
2715
|
+
inputEl.value?.select();
|
|
2716
|
+
}
|
|
2717
|
+
__expose({ inputEl, focus, blur, select });
|
|
2697
2718
|
return (_ctx, _cache) => {
|
|
2698
2719
|
return openBlock(), createBlock(unref(_sfc_main$1T), {
|
|
2720
|
+
ref_key: "inputComponent",
|
|
2721
|
+
ref: inputComponent,
|
|
2699
2722
|
modelValue: value.value,
|
|
2700
2723
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
2701
2724
|
type: "text",
|
|
@@ -6331,9 +6354,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6331
6354
|
style: {}
|
|
6332
6355
|
},
|
|
6333
6356
|
emits: ["update:modelValue"],
|
|
6334
|
-
setup(__props, { emit: __emit }) {
|
|
6357
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6335
6358
|
const props = __props;
|
|
6336
6359
|
const emit = __emit;
|
|
6360
|
+
const textareaComponent = useTemplateRef("textareaComponent");
|
|
6361
|
+
const textareaEl = computed(() => {
|
|
6362
|
+
return textareaComponent.value?.$el;
|
|
6363
|
+
});
|
|
6337
6364
|
const value = computed({
|
|
6338
6365
|
// eslint-disable-next-line no-undefined
|
|
6339
6366
|
get: () => props.modelValue ?? void 0,
|
|
@@ -6343,11 +6370,15 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6343
6370
|
return props.height ? { height: toPixel(props.height) } : null;
|
|
6344
6371
|
});
|
|
6345
6372
|
const [DefineTemplate, ReuseTemplate] = createReusableTemplate();
|
|
6373
|
+
__expose({ textareaEl });
|
|
6346
6374
|
return (_ctx, _cache) => {
|
|
6347
6375
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
6348
6376
|
createVNode(unref(DefineTemplate), null, {
|
|
6349
6377
|
default: withCtx(() => [
|
|
6350
|
-
createVNode(unref(_sfc_main$3), mergeProps(
|
|
6378
|
+
createVNode(unref(_sfc_main$3), mergeProps({
|
|
6379
|
+
ref_key: "textareaComponent",
|
|
6380
|
+
ref: textareaComponent
|
|
6381
|
+
}, _ctx.$attrs, {
|
|
6351
6382
|
modelValue: value.value,
|
|
6352
6383
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
6353
6384
|
modelModifiers: { trim: true },
|