@1337exp/taoui 1.11.5 → 1.12.0

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/index.d.ts CHANGED
@@ -744,7 +744,17 @@ options?: TaoSelectOption[];
744
744
  placeholder?: string;
745
745
  disabled?: boolean;
746
746
  error?: boolean;
747
+ /** Label of the clear row in the list. Slot `#clear` replaces it (icon, markup). / Подпись пункта сброса; слот `#clear` заменяет её (иконка, разметка). */
747
748
  clearText?: string;
749
+ /**
750
+ * Whether the value can be cleared: shows the clear row and enables Delete / Backspace.
751
+ * Turn off when null is not a valid value (grid step, sort order).
752
+ * Можно ли очистить значение: показывает пункт сброса и включает Delete / Backspace.
753
+ * Выключайте, когда null не допустим (шаг сетки, порядок сортировки).
754
+ */
755
+ clearable?: boolean;
756
+ /** Control size, same scale as TaoButton. / Размер контрола, шкала как у TaoButton. */
757
+ size?: "small" | "medium" | "large";
748
758
  }>, {
749
759
  modelValue: null;
750
760
  options: () => never[];
@@ -752,6 +762,8 @@ placeholder: string;
752
762
  disabled: boolean;
753
763
  error: boolean;
754
764
  clearText: string;
765
+ clearable: boolean;
766
+ size: string;
755
767
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
756
768
  "update:modelValue": (value: string | number | null) => void;
757
769
  change: (value: string | number | null) => void;
@@ -761,7 +773,17 @@ options?: TaoSelectOption[];
761
773
  placeholder?: string;
762
774
  disabled?: boolean;
763
775
  error?: boolean;
776
+ /** Label of the clear row in the list. Slot `#clear` replaces it (icon, markup). / Подпись пункта сброса; слот `#clear` заменяет её (иконка, разметка). */
764
777
  clearText?: string;
778
+ /**
779
+ * Whether the value can be cleared: shows the clear row and enables Delete / Backspace.
780
+ * Turn off when null is not a valid value (grid step, sort order).
781
+ * Можно ли очистить значение: показывает пункт сброса и включает Delete / Backspace.
782
+ * Выключайте, когда null не допустим (шаг сетки, порядок сортировки).
783
+ */
784
+ clearable?: boolean;
785
+ /** Control size, same scale as TaoButton. / Размер контрола, шкала как у TaoButton. */
786
+ size?: "small" | "medium" | "large";
765
787
  }>, {
766
788
  modelValue: null;
767
789
  options: () => never[];
@@ -769,16 +791,20 @@ placeholder: string;
769
791
  disabled: boolean;
770
792
  error: boolean;
771
793
  clearText: string;
794
+ clearable: boolean;
795
+ size: string;
772
796
  }>>> & Readonly<{
773
797
  "onUpdate:modelValue"?: ((value: string | number | null) => any) | undefined;
774
798
  onChange?: ((value: string | number | null) => any) | undefined;
775
799
  }>, {
776
800
  error: boolean;
801
+ size: "small" | "medium" | "large";
777
802
  disabled: boolean;
778
803
  placeholder: string;
779
804
  modelValue: string | number | null;
780
805
  options: TaoSelectOption[];
781
806
  clearText: string;
807
+ clearable: boolean;
782
808
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
783
809
 
784
810
  declare const __VLS_component_36: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_36<__VLS_TypePropsToRuntimeProps_38<{
@@ -788,7 +814,12 @@ placeholder?: string;
788
814
  disabled?: boolean;
789
815
  error?: boolean;
790
816
  emptyText?: string;
817
+ /** Label of the clear row in the list. Slot `#clear` replaces it (icon, markup). / Подпись пункта сброса; слот `#clear` заменяет её (иконка, разметка). */
791
818
  clearText?: string;
819
+ /** Whether the value can be cleared: shows the clear row. Turn off when null is not valid. / Можно ли очистить значение: показывает пункт сброса. Выключайте, когда null не допустим. */
820
+ clearable?: boolean;
821
+ /** Control size, same scale as TaoButton and TaoSelect. / Размер контрола, шкала как у TaoButton и TaoSelect. */
822
+ size?: "small" | "medium" | "large";
792
823
  /** Можно оставить то, чего нет в списке. */
793
824
  allowCreate?: boolean;
794
825
  }>, {
@@ -799,6 +830,8 @@ disabled: boolean;
799
830
  error: boolean;
800
831
  emptyText: string;
801
832
  clearText: string;
833
+ clearable: boolean;
834
+ size: string;
802
835
  allowCreate: boolean;
803
836
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
804
837
  "update:modelValue": (value: string | number | null) => void;
@@ -811,7 +844,12 @@ placeholder?: string;
811
844
  disabled?: boolean;
812
845
  error?: boolean;
813
846
  emptyText?: string;
847
+ /** Label of the clear row in the list. Slot `#clear` replaces it (icon, markup). / Подпись пункта сброса; слот `#clear` заменяет её (иконка, разметка). */
814
848
  clearText?: string;
849
+ /** Whether the value can be cleared: shows the clear row. Turn off when null is not valid. / Можно ли очистить значение: показывает пункт сброса. Выключайте, когда null не допустим. */
850
+ clearable?: boolean;
851
+ /** Control size, same scale as TaoButton and TaoSelect. / Размер контрола, шкала как у TaoButton и TaoSelect. */
852
+ size?: "small" | "medium" | "large";
815
853
  /** Можно оставить то, чего нет в списке. */
816
854
  allowCreate?: boolean;
817
855
  }>, {
@@ -822,6 +860,8 @@ disabled: boolean;
822
860
  error: boolean;
823
861
  emptyText: string;
824
862
  clearText: string;
863
+ clearable: boolean;
864
+ size: string;
825
865
  allowCreate: boolean;
826
866
  }>>> & Readonly<{
827
867
  "onUpdate:modelValue"?: ((value: string | number | null) => any) | undefined;
@@ -829,12 +869,14 @@ onChange?: ((value: string | number | null) => any) | undefined;
829
869
  onCreate?: ((value: string) => any) | undefined;
830
870
  }>, {
831
871
  error: boolean;
872
+ size: "small" | "medium" | "large";
832
873
  disabled: boolean;
833
874
  placeholder: string;
834
875
  modelValue: string | number | null;
835
876
  options: TaoSelectOption[];
836
877
  emptyText: string;
837
878
  clearText: string;
879
+ clearable: boolean;
838
880
  allowCreate: boolean;
839
881
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
840
882
 
@@ -1478,6 +1520,7 @@ decrementLabel: string;
1478
1520
  "update:modelValue": (value: number | null) => void;
1479
1521
  blur: (event: FocusEvent) => void;
1480
1522
  focus: (event: FocusEvent) => void;
1523
+ commit: (value: number | null) => void;
1481
1524
  }, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_4<__VLS_TypePropsToRuntimeProps_4<{
1482
1525
  modelValue?: number | null;
1483
1526
  min?: number;
@@ -1501,6 +1544,7 @@ decrementLabel: string;
1501
1544
  "onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
1502
1545
  onBlur?: ((event: FocusEvent) => any) | undefined;
1503
1546
  onFocus?: ((event: FocusEvent) => any) | undefined;
1547
+ onCommit?: ((value: number | null) => any) | undefined;
1504
1548
  }>, {
1505
1549
  disabled: boolean;
1506
1550
  step: number;
package/dist/index.mjs CHANGED
@@ -260,7 +260,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
260
260
  incrementLabel: { default: "Увеличить" },
261
261
  decrementLabel: { default: "Уменьшить" }
262
262
  },
263
- emits: ["update:modelValue", "blur", "focus"],
263
+ emits: ["update:modelValue", "commit", "blur", "focus"],
264
264
  setup(__props, { emit: __emit }) {
265
265
  const props = __props;
266
266
  const emit = __emit;
@@ -328,9 +328,8 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
328
328
  function commit(value) {
329
329
  const next = value === null ? null : clamp(value);
330
330
  emit("update:modelValue", next);
331
- if (!focused.value) {
332
- draft.value = toDraft(next);
333
- }
331
+ draft.value = toDraft(next);
332
+ emit("commit", next);
334
333
  }
335
334
  function bump(direction) {
336
335
  if (props.disabled) {
@@ -361,6 +360,11 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
361
360
  emit("blur", event);
362
361
  }
363
362
  function onKeydown(event) {
363
+ if (event.key === "Enter") {
364
+ const parsed = parseDraft(draft.value);
365
+ commit(parsed === "incomplete" ? null : parsed);
366
+ return;
367
+ }
364
368
  if (event.key === "ArrowUp") {
365
369
  event.preventDefault();
366
370
  bump(1);
@@ -431,7 +435,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
431
435
  };
432
436
  }
433
437
  });
434
- const TaoInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__scopeId", "data-v-f2141b0c"]]);
438
+ const TaoInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__scopeId", "data-v-a4d3eca0"]]);
435
439
  const _hoisted_1$L = ["aria-label", "disabled"];
436
440
  const _hoisted_2$E = { "aria-hidden": "true" };
437
441
  const _hoisted_3$x = ["id", "value", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
@@ -2427,7 +2431,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
2427
2431
  };
2428
2432
  }
2429
2433
  });
2430
- const TaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-f9c46f8c"]]);
2434
+ const TaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-98f6bc87"]]);
2431
2435
  const _hoisted_1$z = {
2432
2436
  key: 0,
2433
2437
  class: "tao-tag__prefix"
@@ -3938,7 +3942,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
3938
3942
  placeholder: { default: "Выберите" },
3939
3943
  disabled: { type: Boolean, default: false },
3940
3944
  error: { type: Boolean, default: false },
3941
- clearText: { default: "Очистить" }
3945
+ clearText: { default: "Очистить" },
3946
+ clearable: { type: Boolean, default: true },
3947
+ size: { default: "medium" }
3942
3948
  },
3943
3949
  emits: ["update:modelValue", "change"],
3944
3950
  setup(__props, { emit: __emit }) {
@@ -4042,7 +4048,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
4042
4048
  if (props.disabled) {
4043
4049
  return;
4044
4050
  }
4045
- if ((event.key === "Backspace" || event.key === "Delete") && selected.value) {
4051
+ if ((event.key === "Backspace" || event.key === "Delete") && selected.value && props.clearable) {
4046
4052
  event.preventDefault();
4047
4053
  clear();
4048
4054
  return;
@@ -4083,7 +4089,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
4083
4089
  return;
4084
4090
  }
4085
4091
  if (event.key === "Backspace" || event.key === "Delete") {
4086
- if (selected.value) {
4092
+ if (selected.value && props.clearable) {
4087
4093
  event.preventDefault();
4088
4094
  clear();
4089
4095
  }
@@ -4129,7 +4135,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
4129
4135
  return (_ctx, _cache) => {
4130
4136
  var _a;
4131
4137
  return openBlock(), createElementBlock("div", {
4132
- class: normalizeClass(["tao-select", { "tao-select--open": open.value, "tao-select--invalid": invalid.value }])
4138
+ class: normalizeClass(["tao-select", [`tao-select--${__props.size}`, { "tao-select--open": open.value, "tao-select--invalid": invalid.value }]])
4133
4139
  }, [
4134
4140
  createElementVNode("button", {
4135
4141
  id: controlId.value,
@@ -4160,7 +4166,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
4160
4166
  key: 0,
4161
4167
  ref_key: "panelRef",
4162
4168
  ref: panelRef,
4163
- class: "tao-select__panel",
4169
+ class: normalizeClass(["tao-select__panel", `tao-select__panel--${__props.size}`]),
4164
4170
  style: normalizeStyle(listStyle.value)
4165
4171
  }, [
4166
4172
  createElementVNode("ul", {
@@ -4193,7 +4199,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
4193
4199
  }, toDisplayString(option.label), 43, _hoisted_4$h);
4194
4200
  }), 128))
4195
4201
  ], 40, _hoisted_3$i),
4196
- selected.value ? (openBlock(), createElementBlock("button", {
4202
+ __props.clearable && selected.value ? (openBlock(), createElementBlock("button", {
4197
4203
  key: 0,
4198
4204
  type: "button",
4199
4205
  class: "tao-select__clear",
@@ -4205,13 +4211,13 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
4205
4211
  createTextVNode(toDisplayString(__props.clearText), 1)
4206
4212
  ], true)
4207
4213
  ], 32)) : createCommentVNode("", true)
4208
- ], 4)) : createCommentVNode("", true)
4214
+ ], 6)) : createCommentVNode("", true)
4209
4215
  ]))
4210
4216
  ], 2);
4211
4217
  };
4212
4218
  }
4213
4219
  });
4214
- const TaoSelect = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-854360a4"]]);
4220
+ const TaoSelect = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-70703b6d"]]);
4215
4221
  const _hoisted_1$n = ["id", "aria-expanded", "aria-activedescendant", "aria-invalid", "aria-describedby", "disabled", "placeholder", "value"];
4216
4222
  const _hoisted_2$l = {
4217
4223
  key: 0,
@@ -4229,6 +4235,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4229
4235
  error: { type: Boolean, default: false },
4230
4236
  emptyText: { default: "Ничего не найдено" },
4231
4237
  clearText: { default: "Очистить" },
4238
+ clearable: { type: Boolean, default: true },
4239
+ size: { default: "medium" },
4232
4240
  allowCreate: { type: Boolean, default: false }
4233
4241
  },
4234
4242
  emits: ["update:modelValue", "change", "create"],
@@ -4602,11 +4610,14 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4602
4610
  });
4603
4611
  return (_ctx, _cache) => {
4604
4612
  return openBlock(), createElementBlock("div", {
4605
- class: normalizeClass(["tao-combobox", {
4606
- "tao-combobox--open": open.value,
4607
- "tao-combobox--invalid": invalid.value,
4608
- "tao-combobox--disabled": __props.disabled
4609
- }])
4613
+ class: normalizeClass(["tao-combobox", [
4614
+ `tao-combobox--${__props.size}`,
4615
+ {
4616
+ "tao-combobox--open": open.value,
4617
+ "tao-combobox--invalid": invalid.value,
4618
+ "tao-combobox--disabled": __props.disabled
4619
+ }
4620
+ ]])
4610
4621
  }, [
4611
4622
  createElementVNode("div", {
4612
4623
  ref_key: "fieldRef",
@@ -4652,7 +4663,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4652
4663
  key: 0,
4653
4664
  ref_key: "panelRef",
4654
4665
  ref: panelRef,
4655
- class: "tao-combobox__panel",
4666
+ class: normalizeClass(["tao-combobox__panel", `tao-combobox__panel--${__props.size}`]),
4656
4667
  style: normalizeStyle(listStyle.value)
4657
4668
  }, [
4658
4669
  createElementVNode("ul", {
@@ -4695,7 +4706,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4695
4706
  ], 42, _hoisted_3$h);
4696
4707
  }), 128))
4697
4708
  ], 512),
4698
- selected.value ? (openBlock(), createElementBlock("button", {
4709
+ __props.clearable && selected.value ? (openBlock(), createElementBlock("button", {
4699
4710
  key: 0,
4700
4711
  type: "button",
4701
4712
  class: "tao-combobox__clear",
@@ -4706,13 +4717,13 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4706
4717
  createTextVNode(toDisplayString(__props.clearText), 1)
4707
4718
  ], true)
4708
4719
  ], 32)) : createCommentVNode("", true)
4709
- ], 4)) : createCommentVNode("", true)
4720
+ ], 6)) : createCommentVNode("", true)
4710
4721
  ]))
4711
4722
  ], 2);
4712
4723
  };
4713
4724
  }
4714
4725
  });
4715
- const TaoCombobox = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-c1f14f5a"]]);
4726
+ const TaoCombobox = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-ce122d2d"]]);
4716
4727
  const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
4717
4728
  function formatTaoDateIso(parts) {
4718
4729
  return `${String(parts.y).padStart(4, "0")}-${String(parts.m).padStart(2, "0")}-${String(parts.d).padStart(2, "0")}`;