@1337exp/taoui 5.28.0 → 5.29.1
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/CHANGELOG.md +707 -698
- package/dist/index.d.ts +16 -1
- package/dist/index.js +109 -18
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +105 -105
- package/skills/taoui/references/components.md +1297 -1295
package/dist/index.d.ts
CHANGED
|
@@ -7376,6 +7376,10 @@ export declare interface TaoLocale {
|
|
|
7376
7376
|
pauseLabel: string;
|
|
7377
7377
|
restartLabel: string;
|
|
7378
7378
|
};
|
|
7379
|
+
/** The field of an `editable` slider. / Поле слайдера с `editable`. */
|
|
7380
|
+
slider: {
|
|
7381
|
+
editLabel: string;
|
|
7382
|
+
};
|
|
7379
7383
|
toast: {
|
|
7380
7384
|
closeLabel: string;
|
|
7381
7385
|
};
|
|
@@ -7877,6 +7881,17 @@ declare interface TaoSliderBaseProps {
|
|
|
7877
7881
|
ariaLabel?: string;
|
|
7878
7882
|
/** Step for the mouse wheel (a single thumb only). 0 — off. / Шаг для колёсика мыши (только одна ручка). 0 — отключено. */
|
|
7879
7883
|
wheel?: number;
|
|
7884
|
+
/**
|
|
7885
|
+
* The value can be typed: a right click or a double click on the bar, or Enter / F2 on a thumb, opens a field over the bar
|
|
7886
|
+
* (for a range, for the nearest or the focused thumb). Enter or leaving the field sets the value, snapped to the step (or
|
|
7887
|
+
* to a mark with `discrete`) and kept in range; Esc drops the edit. Off by default.
|
|
7888
|
+
* Значение можно набрать: правый клик или двойной клик по полосе либо Enter / F2 на ручке открывают поле поверх полосы
|
|
7889
|
+
* (у диапазона для ближайшей или сфокусированной ручки). Enter или уход из поля ставит значение, прижатое к шагу (или к
|
|
7890
|
+
* метке при `discrete`) и в границах; Esc отменяет правку. По умолчанию выключено.
|
|
7891
|
+
*/
|
|
7892
|
+
editable?: boolean;
|
|
7893
|
+
/** Accessible name of the field of `editable` (the locale text by default). / Имя поля у `editable` для скринридеров (по умолчанию текст локали). */
|
|
7894
|
+
editLabel?: string;
|
|
7880
7895
|
}
|
|
7881
7896
|
|
|
7882
7897
|
/** Метка на шкале: значение, подпись (нет подписи: только черта). */
|
|
@@ -8187,10 +8202,10 @@ variant: TaoTextareaVariant;
|
|
|
8187
8202
|
modelValue: string;
|
|
8188
8203
|
align: "start" | "center" | "end";
|
|
8189
8204
|
autocomplete: string;
|
|
8205
|
+
spellcheck: boolean;
|
|
8190
8206
|
rows: number;
|
|
8191
8207
|
maxHeight: number | string;
|
|
8192
8208
|
maxlength: number;
|
|
8193
|
-
spellcheck: boolean;
|
|
8194
8209
|
minlength: number;
|
|
8195
8210
|
readonly: boolean;
|
|
8196
8211
|
noSpace: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowReactive, defineComponent, useCssVars, computed, openBlock, createElementBlock, renderSlot, normalizeClass, normalizeStyle, ref, inject, provide, shallowRef, unref, createElementVNode, createStaticVNode, toDisplayString, createCommentVNode, useSlots, useAttrs, createBlock, useId, mergeProps, watch, createVNode, toValue, onBeforeUnmount, nextTick, onMounted, Teleport, Transition, withCtx, Fragment, renderList, createTextVNode, createSlots, normalizeProps, guardReactiveProps, resolveDynamicComponent,
|
|
1
|
+
import { shallowReactive, defineComponent, useCssVars, computed, openBlock, createElementBlock, renderSlot, normalizeClass, normalizeStyle, ref, inject, provide, shallowRef, unref, createElementVNode, createStaticVNode, toDisplayString, createCommentVNode, useSlots, useAttrs, createBlock, useId, mergeProps, watch, createVNode, toValue, onBeforeUnmount, nextTick, onMounted, Teleport, Transition, withCtx, Fragment, renderList, createTextVNode, withDirectives, withModifiers, withKeys, vModelText, createSlots, normalizeProps, guardReactiveProps, resolveDynamicComponent, onBeforeMount, resolveComponent, toRef, vShow, getCurrentInstance, reactive, TransitionGroup, onUpdated, createApp } from "vue";
|
|
2
2
|
function isDev() {
|
|
3
3
|
try {
|
|
4
4
|
return process.env.NODE_ENV !== "production";
|
|
@@ -258,6 +258,7 @@ const localeEn = {
|
|
|
258
258
|
clearText: "Clear"
|
|
259
259
|
},
|
|
260
260
|
scrubber: { playLabel: "Play", pauseLabel: "Pause", restartLabel: "Restart" },
|
|
261
|
+
slider: { editLabel: "Value" },
|
|
261
262
|
toast: { closeLabel: "Close notification" }
|
|
262
263
|
};
|
|
263
264
|
const confirmDefaults = {
|
|
@@ -491,6 +492,7 @@ const localeRu = {
|
|
|
491
492
|
clearText: "Очистить"
|
|
492
493
|
},
|
|
493
494
|
scrubber: { playLabel: "Играть", pauseLabel: "Пауза", restartLabel: "В начало" },
|
|
495
|
+
slider: { editLabel: "Значение" },
|
|
494
496
|
toast: { closeLabel: "Закрыть уведомление" }
|
|
495
497
|
};
|
|
496
498
|
const language = (tag) => tag.toLowerCase().split(/[-_]/)[0] ?? "";
|
|
@@ -1374,7 +1376,7 @@ const _hoisted_6$o = {
|
|
|
1374
1376
|
key: 0,
|
|
1375
1377
|
class: "tao-card__title"
|
|
1376
1378
|
};
|
|
1377
|
-
const _hoisted_7$
|
|
1379
|
+
const _hoisted_7$k = {
|
|
1378
1380
|
key: 1,
|
|
1379
1381
|
class: "tao-card__sub"
|
|
1380
1382
|
};
|
|
@@ -1464,7 +1466,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
|
|
|
1464
1466
|
_ctx.$slots.title ? (openBlock(), createElementBlock("h2", _hoisted_6$o, [
|
|
1465
1467
|
renderSlot(_ctx.$slots, "title", {}, void 0, true)
|
|
1466
1468
|
])) : createCommentVNode("", true),
|
|
1467
|
-
_ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_7$
|
|
1469
|
+
_ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_7$k, [
|
|
1468
1470
|
renderSlot(_ctx.$slots, "sub", {}, void 0, true)
|
|
1469
1471
|
])) : createCommentVNode("", true)
|
|
1470
1472
|
])) : createCommentVNode("", true),
|
|
@@ -1665,7 +1667,7 @@ const _hoisted_3$J = ["id"];
|
|
|
1665
1667
|
const _hoisted_4$C = { key: 1 };
|
|
1666
1668
|
const _hoisted_5$s = ["aria-label"];
|
|
1667
1669
|
const _hoisted_6$n = { "aria-hidden": "true" };
|
|
1668
|
-
const _hoisted_7$
|
|
1670
|
+
const _hoisted_7$j = { class: "tao-modal__content" };
|
|
1669
1671
|
const _hoisted_8$c = {
|
|
1670
1672
|
key: 1,
|
|
1671
1673
|
class: "tao-modal__footer"
|
|
@@ -1775,7 +1777,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
|
|
|
1775
1777
|
])
|
|
1776
1778
|
], 8, _hoisted_5$s)) : createCommentVNode("", true)
|
|
1777
1779
|
])) : createCommentVNode("", true),
|
|
1778
|
-
createElementVNode("div", _hoisted_7$
|
|
1780
|
+
createElementVNode("div", _hoisted_7$j, [
|
|
1779
1781
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1780
1782
|
]),
|
|
1781
1783
|
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_8$c, [
|
|
@@ -2417,17 +2419,18 @@ function zoneGradient(zones, min, max, vertical = false, dimmed = false) {
|
|
|
2417
2419
|
return `linear-gradient(${vertical ? "to top" : "to right"}, ${stops.join(", ")})`;
|
|
2418
2420
|
}
|
|
2419
2421
|
const _hoisted_1$_ = ["aria-disabled"];
|
|
2420
|
-
const _hoisted_2$Q = ["id", "tabindex", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-label", "aria-orientation", "aria-disabled", "aria-invalid", "aria-describedby", "onKeydown"];
|
|
2422
|
+
const _hoisted_2$Q = ["id", "tabindex", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-label", "aria-orientation", "aria-disabled", "aria-invalid", "aria-describedby", "aria-keyshortcuts", "onKeydown"];
|
|
2421
2423
|
const _hoisted_3$I = {
|
|
2422
2424
|
key: 2,
|
|
2423
2425
|
class: "tao-slider__value"
|
|
2424
2426
|
};
|
|
2425
|
-
const _hoisted_4$B =
|
|
2427
|
+
const _hoisted_4$B = ["aria-label", "onKeydown"];
|
|
2428
|
+
const _hoisted_5$r = {
|
|
2426
2429
|
key: 0,
|
|
2427
2430
|
class: "tao-slider__marks"
|
|
2428
2431
|
};
|
|
2429
|
-
const
|
|
2430
|
-
const
|
|
2432
|
+
const _hoisted_6$m = ["disabled", "onClick"];
|
|
2433
|
+
const _hoisted_7$i = {
|
|
2431
2434
|
key: 0,
|
|
2432
2435
|
class: "tao-slider__mark-label"
|
|
2433
2436
|
};
|
|
@@ -2454,6 +2457,8 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2454
2457
|
size: {},
|
|
2455
2458
|
ariaLabel: {},
|
|
2456
2459
|
wheel: { default: 0 },
|
|
2460
|
+
editable: { type: Boolean, default: false },
|
|
2461
|
+
editLabel: {},
|
|
2457
2462
|
modelValue: {}
|
|
2458
2463
|
},
|
|
2459
2464
|
emits: ["update:modelValue", "change"],
|
|
@@ -2461,6 +2466,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2461
2466
|
const props = __props;
|
|
2462
2467
|
const emit = __emit;
|
|
2463
2468
|
const { controlId, invalid, describedBy } = useField(props);
|
|
2469
|
+
const l10n = useLocaleText(props, "slider");
|
|
2464
2470
|
const isRange = computed(() => Array.isArray(props.modelValue));
|
|
2465
2471
|
const values = computed(() => normalizeValue(props.modelValue, props.min, props.max));
|
|
2466
2472
|
const text = (v) => props.format ? props.format(v) : String(v);
|
|
@@ -2585,6 +2591,53 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2585
2591
|
if (dragPointer !== -1 && event.pointerId !== dragPointer) return;
|
|
2586
2592
|
endDrag();
|
|
2587
2593
|
}
|
|
2594
|
+
const editorRef = ref(null);
|
|
2595
|
+
const editing = ref(null);
|
|
2596
|
+
const draft = ref("");
|
|
2597
|
+
const DECIMAL = /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;
|
|
2598
|
+
function openEditor(index) {
|
|
2599
|
+
if (!props.editable || props.disabled) return;
|
|
2600
|
+
endDrag();
|
|
2601
|
+
activeThumb.value = index;
|
|
2602
|
+
draft.value = String(values.value[index]);
|
|
2603
|
+
editing.value = index;
|
|
2604
|
+
void nextTick(() => {
|
|
2605
|
+
editorRef.value?.focus();
|
|
2606
|
+
editorRef.value?.select();
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
function closeEditor(refocus) {
|
|
2610
|
+
const index = editing.value;
|
|
2611
|
+
editing.value = null;
|
|
2612
|
+
if (refocus && index !== null) {
|
|
2613
|
+
void nextTick(() => railRef.value?.querySelectorAll(".tao-slider__thumb")[index]?.focus({ preventScroll: true }));
|
|
2614
|
+
}
|
|
2615
|
+
return index;
|
|
2616
|
+
}
|
|
2617
|
+
function commitEditor(refocus = false) {
|
|
2618
|
+
const index = closeEditor(refocus);
|
|
2619
|
+
if (index === null) return;
|
|
2620
|
+
const typed = draft.value.trim().replace(/\s/g, "").replace(",", ".");
|
|
2621
|
+
if (!DECIMAL.test(typed)) return;
|
|
2622
|
+
const parsed = Number(typed);
|
|
2623
|
+
if (!Number.isFinite(parsed)) return;
|
|
2624
|
+
const target = stepped.value ? nearestMark(parsed, markValues.value) : valueAt(ratioOf(parsed, props.min, props.max), props.min, props.max, props.step);
|
|
2625
|
+
setThumb(index, target, true);
|
|
2626
|
+
}
|
|
2627
|
+
function cancelEditor() {
|
|
2628
|
+
closeEditor(true);
|
|
2629
|
+
}
|
|
2630
|
+
function onEditGesture(event) {
|
|
2631
|
+
if (!props.editable || props.disabled) return;
|
|
2632
|
+
event.preventDefault();
|
|
2633
|
+
openEditor(nearestThumb(values.value, valueUnder(event), activeThumb.value));
|
|
2634
|
+
}
|
|
2635
|
+
watch(
|
|
2636
|
+
() => props.disabled || !props.editable,
|
|
2637
|
+
(off) => {
|
|
2638
|
+
if (off) editing.value = null;
|
|
2639
|
+
}
|
|
2640
|
+
);
|
|
2588
2641
|
function onKeydown2(event, index) {
|
|
2589
2642
|
if (props.disabled) return;
|
|
2590
2643
|
pointerFocus.value = false;
|
|
@@ -2603,6 +2656,10 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2603
2656
|
next = props.min;
|
|
2604
2657
|
} else if (event.key === "End") {
|
|
2605
2658
|
next = props.max;
|
|
2659
|
+
} else if (props.editable && (event.key === "Enter" || event.key === "F2")) {
|
|
2660
|
+
event.preventDefault();
|
|
2661
|
+
openEditor(index);
|
|
2662
|
+
return;
|
|
2606
2663
|
}
|
|
2607
2664
|
if (next === null) return;
|
|
2608
2665
|
event.preventDefault();
|
|
@@ -2660,9 +2717,11 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2660
2717
|
onPointermove: onPointerMove,
|
|
2661
2718
|
onPointerup: onPointerEnd,
|
|
2662
2719
|
onPointercancel: onPointerEnd,
|
|
2663
|
-
onLostpointercapture: endDrag
|
|
2720
|
+
onLostpointercapture: endDrag,
|
|
2721
|
+
onContextmenu: onEditGesture,
|
|
2722
|
+
onDblclick: onEditGesture
|
|
2664
2723
|
}, [
|
|
2665
|
-
_cache[
|
|
2724
|
+
_cache[8] || (_cache[8] = createElementVNode("div", { class: "tao-slider__track" }, null, -1)),
|
|
2666
2725
|
zoneList.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2667
2726
|
createElementVNode("div", {
|
|
2668
2727
|
class: "tao-slider__track tao-slider__zones tao-slider__zones--dim",
|
|
@@ -2702,6 +2761,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2702
2761
|
"aria-disabled": __props.disabled || void 0,
|
|
2703
2762
|
"aria-invalid": unref(invalid) || void 0,
|
|
2704
2763
|
"aria-describedby": unref(describedBy),
|
|
2764
|
+
"aria-keyshortcuts": __props.editable ? "Enter F2" : void 0,
|
|
2705
2765
|
onKeydown: ($event) => onKeydown2($event, i),
|
|
2706
2766
|
onBlur: _cache[0] || (_cache[0] = ($event) => pointerFocus.value = false)
|
|
2707
2767
|
}, null, 46, _hoisted_2$Q),
|
|
@@ -2720,13 +2780,40 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2720
2780
|
], 6)) : createCommentVNode("", true)
|
|
2721
2781
|
], 64);
|
|
2722
2782
|
}), 128)),
|
|
2723
|
-
__props.showValue ? (openBlock(), createElementBlock("div", _hoisted_3$I, [
|
|
2783
|
+
__props.showValue && editing.value === null ? (openBlock(), createElementBlock("div", _hoisted_3$I, [
|
|
2724
2784
|
renderSlot(_ctx.$slots, "pre-value", {}, void 0, true),
|
|
2725
2785
|
createTextVNode(toDisplayString(barText.value), 1),
|
|
2726
2786
|
renderSlot(_ctx.$slots, "post-value", {}, void 0, true)
|
|
2727
|
-
])) : createCommentVNode("", true)
|
|
2787
|
+
])) : createCommentVNode("", true),
|
|
2788
|
+
editing.value !== null ? withDirectives((openBlock(), createElementBlock("input", {
|
|
2789
|
+
key: 3,
|
|
2790
|
+
ref_key: "editorRef",
|
|
2791
|
+
ref: editorRef,
|
|
2792
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => draft.value = $event),
|
|
2793
|
+
class: "tao-slider__editor",
|
|
2794
|
+
type: "text",
|
|
2795
|
+
inputmode: "decimal",
|
|
2796
|
+
autocomplete: "off",
|
|
2797
|
+
spellcheck: "false",
|
|
2798
|
+
"aria-label": __props.ariaLabel ?? unref(l10n).editLabel,
|
|
2799
|
+
onKeydown: [
|
|
2800
|
+
_cache[2] || (_cache[2] = withKeys(withModifiers(($event) => commitEditor(true), ["prevent"]), ["enter"])),
|
|
2801
|
+
withKeys(withModifiers(cancelEditor, ["prevent", "stop"]), ["esc"])
|
|
2802
|
+
],
|
|
2803
|
+
onBlur: _cache[3] || (_cache[3] = ($event) => commitEditor()),
|
|
2804
|
+
onPointerdown: _cache[4] || (_cache[4] = withModifiers(() => {
|
|
2805
|
+
}, ["stop"])),
|
|
2806
|
+
onContextmenu: _cache[5] || (_cache[5] = withModifiers(() => {
|
|
2807
|
+
}, ["stop"])),
|
|
2808
|
+
onDblclick: _cache[6] || (_cache[6] = withModifiers(() => {
|
|
2809
|
+
}, ["stop"])),
|
|
2810
|
+
onWheel: _cache[7] || (_cache[7] = withModifiers(() => {
|
|
2811
|
+
}, ["stop"]))
|
|
2812
|
+
}, null, 40, _hoisted_4$B)), [
|
|
2813
|
+
[vModelText, draft.value]
|
|
2814
|
+
]) : createCommentVNode("", true)
|
|
2728
2815
|
], 34),
|
|
2729
|
-
markList.value.length > 0 ? (openBlock(), createElementBlock("div",
|
|
2816
|
+
markList.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_5$r, [
|
|
2730
2817
|
(openBlock(true), createElementBlock(Fragment, null, renderList(markList.value, (mark) => {
|
|
2731
2818
|
return openBlock(), createElementBlock("button", {
|
|
2732
2819
|
key: mark.value,
|
|
@@ -2741,8 +2828,8 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2741
2828
|
tabindex: "-1",
|
|
2742
2829
|
onClick: ($event) => onMarkClick(mark)
|
|
2743
2830
|
}, [
|
|
2744
|
-
_cache[
|
|
2745
|
-
mark.label ? (openBlock(), createElementBlock("span",
|
|
2831
|
+
_cache[9] || (_cache[9] = createElementVNode("span", { class: "tao-slider__tick" }, null, -1)),
|
|
2832
|
+
mark.label ? (openBlock(), createElementBlock("span", _hoisted_7$i, [
|
|
2746
2833
|
renderSlot(_ctx.$slots, "mark", {
|
|
2747
2834
|
mark,
|
|
2748
2835
|
active: unref(isMarkActive)(mark.value, values.value)
|
|
@@ -2750,14 +2837,14 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
|
|
|
2750
2837
|
createTextVNode(toDisplayString(mark.label), 1)
|
|
2751
2838
|
], true)
|
|
2752
2839
|
])) : createCommentVNode("", true)
|
|
2753
|
-
], 14,
|
|
2840
|
+
], 14, _hoisted_6$m);
|
|
2754
2841
|
}), 128))
|
|
2755
2842
|
])) : createCommentVNode("", true)
|
|
2756
2843
|
], 42, _hoisted_1$_);
|
|
2757
2844
|
};
|
|
2758
2845
|
}
|
|
2759
2846
|
});
|
|
2760
|
-
const TaoSliderBase = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__scopeId", "data-v-
|
|
2847
|
+
const TaoSliderBase = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__scopeId", "data-v-8ec84551"]]);
|
|
2761
2848
|
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
2762
2849
|
...{ name: "TaoSlider" },
|
|
2763
2850
|
__name: "TaoSlider",
|
|
@@ -2781,6 +2868,8 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
2781
2868
|
size: {},
|
|
2782
2869
|
ariaLabel: {},
|
|
2783
2870
|
wheel: {},
|
|
2871
|
+
editable: { type: Boolean },
|
|
2872
|
+
editLabel: {},
|
|
2784
2873
|
modelValue: {}
|
|
2785
2874
|
},
|
|
2786
2875
|
emits: ["update:modelValue", "change"],
|
|
@@ -5129,6 +5218,8 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
5129
5218
|
size: {},
|
|
5130
5219
|
ariaLabel: {},
|
|
5131
5220
|
wheel: {},
|
|
5221
|
+
editable: { type: Boolean },
|
|
5222
|
+
editLabel: {},
|
|
5132
5223
|
modelValue: {}
|
|
5133
5224
|
},
|
|
5134
5225
|
emits: ["update:modelValue", "change"],
|