@tb-dev/vue 0.3.33 → 0.3.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.
@@ -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
- inputEl: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
19
+ baseInput: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
14
20
  defaultValue?: string | number;
15
21
  modelValue?: string | number;
16
22
  class?: import('vue').HTMLAttributes["class"];
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 inputEl = useTemplateRef("inputEl");
2377
+ const baseInput = useTemplateRef("baseInput");
2378
+ const inputEl = computed(() => {
2379
+ return baseInput.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?.$el?.focus();
2388
+ inputEl.value?.focus();
2389
+ }
2390
+ function blur() {
2391
+ inputEl.value?.blur();
2392
+ }
2393
+ function select() {
2394
+ inputEl.value?.select();
2386
2395
  }
2387
- __expose({ focus });
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: "inputEl",
2394
- ref: inputEl
2402
+ ref_key: "baseInput",
2403
+ ref: baseInput
2395
2404
  }, _ctx.$attrs, {
2396
2405
  modelValue: value.value,
2397
2406
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/vue",
3
- "version": "0.3.33",
3
+ "version": "0.3.34",
4
4
  "description": "Vue utilities",
5
5
  "license": "MIT",
6
6
  "type": "module",