@quidgest/ui 0.25.0 → 0.26.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/CHANGELOG.md +16 -0
- package/dist/json/api.json +15 -2
- package/dist/ui.css +28 -11
- package/dist/ui.esm.js +16 -13
- package/dist/ui.js +16 -13
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +16 -13
- package/dist/ui.scss +40 -16
- package/esm/components/QSection/QSection.d.ts +2 -0
- package/esm/components/QSection/QSection.d.ts.map +1 -1
- package/esm/components/QSection/QSection.vue.js +18 -14
- package/esm/components/QSection/index.d.ts +2 -0
- package/esm/components/QSection/index.d.ts.map +1 -1
- package/esm/components/QTabs/QTabs.d.ts.map +1 -1
- package/esm/components/QTabs/QTabs.vue.js +106 -112
- package/esm/components/QTextArea/QTextArea.d.ts.map +1 -1
- package/esm/components/QTextArea/QTextArea.vue.js +9 -7
- package/esm/components/QTextField/QTextField.d.ts.map +1 -1
- package/esm/components/QTextField/QTextField.vue.js +11 -9
- package/esm/composables/useEnabledSelection/index.d.ts +33 -0
- package/esm/composables/useEnabledSelection/index.d.ts.map +1 -0
- package/esm/composables/useEnabledSelection/index.js +15 -0
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { provideDefaults as e } from "../../composables/defaults.js";
|
|
2
2
|
import { useGroup as t } from "../../composables/useGroup/index.js";
|
|
3
3
|
import { QOverflow as n } from "../QOverflow/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useEnabledSelection as r } from "../../composables/useEnabledSelection/index.js";
|
|
5
|
+
import { TabsSymbol as i } from "./context.js";
|
|
6
|
+
import { computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, mergeModels as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, openBlock as g, provide as _, ref as v, renderSlot as y, shallowRef as b, toRef as x, unref as S, useModel as C, useTemplateRef as w, watch as T, withCtx as E } from "vue";
|
|
6
7
|
//#region src/components/QTabs/QTabs.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var
|
|
8
|
+
var D = ["id"], O = {
|
|
8
9
|
ref: "tabListHost",
|
|
9
10
|
class: "q-tabs__list"
|
|
10
|
-
},
|
|
11
|
+
}, k = { class: "q-tabs__panels" }, A = /*@__PURE__*/ u({
|
|
11
12
|
__name: "QTabs",
|
|
12
|
-
props: /*@__PURE__*/
|
|
13
|
+
props: /*@__PURE__*/ d({
|
|
13
14
|
id: {},
|
|
14
15
|
class: {},
|
|
15
16
|
direction: { default: "horizontal" },
|
|
@@ -21,188 +22,181 @@ var E = ["id"], D = {
|
|
|
21
22
|
modelModifiers: {}
|
|
22
23
|
}),
|
|
23
24
|
emits: ["update:modelValue"],
|
|
24
|
-
setup(
|
|
25
|
-
let
|
|
25
|
+
setup(u) {
|
|
26
|
+
let d = u, A = C(u, "modelValue"), j = w("tabListHost"), M = w("overflowRef"), N = a(() => M.value?.contentEl ?? null), P = b([]), F = v({
|
|
26
27
|
width: "0",
|
|
27
28
|
height: "0",
|
|
28
29
|
transform: "translate(0, 0)",
|
|
29
30
|
opacity: "0"
|
|
30
|
-
}),
|
|
31
|
-
active:
|
|
31
|
+
}), I = v(!1), L = null, { active: R } = t({
|
|
32
|
+
active: A,
|
|
32
33
|
required: !0
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}), e({ QTab: { disabled:
|
|
37
|
-
let
|
|
35
|
+
T(R, (e) => {
|
|
36
|
+
A.value = e;
|
|
37
|
+
}), e({ QTab: { disabled: x(d, "disabled") } });
|
|
38
|
+
let z = a(() => [
|
|
38
39
|
"q-tabs",
|
|
39
|
-
`q-tabs--${
|
|
40
|
-
`q-tabs--${
|
|
41
|
-
`q-tabs--align-${
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
`q-tabs--${d.direction}`,
|
|
41
|
+
`q-tabs--${d.variant}`,
|
|
42
|
+
`q-tabs--align-${d.align}`,
|
|
43
|
+
I.value ? "q-tabs--indicator-ready" : void 0,
|
|
44
|
+
d.class
|
|
44
45
|
]);
|
|
45
|
-
function
|
|
46
|
-
let e =
|
|
47
|
-
e && (e.setAttribute("role", "tablist"), e.setAttribute("aria-orientation",
|
|
46
|
+
function B() {
|
|
47
|
+
let e = N.value;
|
|
48
|
+
e && (e.setAttribute("role", "tablist"), e.setAttribute("aria-orientation", d.direction));
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function V(e) {
|
|
50
51
|
let t = e.tabRef.value;
|
|
51
52
|
return t ? "$el" in t ? t.$el : t : null;
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
...
|
|
54
|
+
function H() {
|
|
55
|
+
I.value = !1, F.value = {
|
|
56
|
+
...F.value,
|
|
56
57
|
opacity: "0",
|
|
57
58
|
width: "0",
|
|
58
59
|
height: "0"
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
63
|
-
|
|
62
|
+
function U() {
|
|
63
|
+
if (d.variant !== "line" || !A.value) {
|
|
64
|
+
H();
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
|
-
let e =
|
|
67
|
+
let e = P.value.find((e) => e.value === A.value);
|
|
67
68
|
if (!e) {
|
|
68
|
-
|
|
69
|
+
H();
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
|
-
let t =
|
|
72
|
+
let t = V(e);
|
|
72
73
|
if (!t) {
|
|
73
|
-
|
|
74
|
+
H();
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
let n =
|
|
77
|
-
n ?
|
|
77
|
+
let n = d.direction === "horizontal", r = I.value;
|
|
78
|
+
n ? F.value = {
|
|
78
79
|
width: `${t.offsetWidth}px`,
|
|
79
80
|
height: "var(--q-tabs-indicator-thickness)",
|
|
80
81
|
transform: `translate(${t.offsetLeft}px, 0)`,
|
|
81
82
|
opacity: "1"
|
|
82
|
-
} :
|
|
83
|
+
} : F.value = {
|
|
83
84
|
width: "var(--q-tabs-indicator-thickness)",
|
|
84
85
|
height: `${t.offsetHeight}px`,
|
|
85
86
|
transform: `translate(0, ${t.offsetTop}px)`,
|
|
86
87
|
opacity: "1"
|
|
87
|
-
}, r ||
|
|
88
|
-
|
|
88
|
+
}, r || f(() => {
|
|
89
|
+
F.value.opacity === "1" && (I.value = !0);
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
-
if (!
|
|
93
|
-
let e =
|
|
92
|
+
function W() {
|
|
93
|
+
if (!A.value) return;
|
|
94
|
+
let e = P.value.find((e) => e.value === A.value);
|
|
94
95
|
if (!e) return;
|
|
95
|
-
let t =
|
|
96
|
-
t &&
|
|
96
|
+
let t = V(e);
|
|
97
|
+
t && M.value?.scrollElementIntoView(t);
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
-
if (
|
|
100
|
-
|
|
99
|
+
function G() {
|
|
100
|
+
if (d.variant !== "line") {
|
|
101
|
+
L?.disconnect();
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
L ? L.disconnect() : L = new ResizeObserver(() => {
|
|
105
|
+
U();
|
|
105
106
|
});
|
|
106
|
-
let e =
|
|
107
|
-
e &&
|
|
108
|
-
for (let e of
|
|
109
|
-
let t =
|
|
110
|
-
t &&
|
|
107
|
+
let e = j.value;
|
|
108
|
+
e && L.observe(e);
|
|
109
|
+
for (let e of P.value) {
|
|
110
|
+
let t = V(e);
|
|
111
|
+
t && L.observe(t);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
let e = G();
|
|
118
|
-
e.length && (e.some((e) => e.value === k.value) || (k.value = e[0].value));
|
|
119
|
-
}
|
|
120
|
-
let q;
|
|
121
|
-
function J() {
|
|
122
|
-
q ||= d(() => {
|
|
123
|
-
q = void 0, K();
|
|
114
|
+
let { enabledItems: K, ensureSelection: q } = r(() => P.value, A), J;
|
|
115
|
+
function Y() {
|
|
116
|
+
J ||= f(() => {
|
|
117
|
+
J = void 0, q();
|
|
124
118
|
});
|
|
125
119
|
}
|
|
126
|
-
function
|
|
127
|
-
if (
|
|
128
|
-
|
|
120
|
+
function X(e) {
|
|
121
|
+
if (P.value = [...P.value, e], !A.value) {
|
|
122
|
+
q();
|
|
129
123
|
return;
|
|
130
124
|
}
|
|
131
|
-
|
|
125
|
+
Y();
|
|
132
126
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
127
|
+
function Z(e) {
|
|
128
|
+
P.value = P.value.filter((t) => t.value !== e);
|
|
135
129
|
}
|
|
136
|
-
function
|
|
130
|
+
function Q(e, t) {
|
|
137
131
|
if (e === t) return;
|
|
138
|
-
let n =
|
|
132
|
+
let n = P.value.findIndex((t) => t.value === e);
|
|
139
133
|
if (n !== -1) {
|
|
140
|
-
if (
|
|
134
|
+
if (P.value = P.value.map((e, r) => r === n ? {
|
|
141
135
|
...e,
|
|
142
136
|
value: t
|
|
143
|
-
} : e),
|
|
144
|
-
|
|
137
|
+
} : e), A.value === e || A.value === t) {
|
|
138
|
+
A.value = t;
|
|
145
139
|
return;
|
|
146
140
|
}
|
|
147
|
-
|
|
141
|
+
q();
|
|
148
142
|
}
|
|
149
143
|
}
|
|
150
|
-
function
|
|
151
|
-
let n =
|
|
144
|
+
function $(e, t) {
|
|
145
|
+
let n = K.value;
|
|
152
146
|
if (!n.length) return;
|
|
153
147
|
let r = n.findIndex((t) => t.value === e), i = n[r === -1 ? 0 : (r + t + n.length) % n.length];
|
|
154
148
|
i.select(), i.focus();
|
|
155
149
|
}
|
|
156
|
-
function
|
|
157
|
-
let e =
|
|
150
|
+
function ee() {
|
|
151
|
+
let e = K.value[0];
|
|
158
152
|
e && (e.select(), e.focus());
|
|
159
153
|
}
|
|
160
|
-
function
|
|
161
|
-
let e =
|
|
154
|
+
function te() {
|
|
155
|
+
let e = K.value, t = e[e.length - 1];
|
|
162
156
|
t && (t.select(), t.focus());
|
|
163
157
|
}
|
|
164
|
-
return
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
], () =>
|
|
171
|
-
|
|
172
|
-
}), { immediate: !0 }),
|
|
158
|
+
return T(() => P.value.map((e) => [e.value, S(e.disabled)]), () => Y()), T(() => [
|
|
159
|
+
A.value,
|
|
160
|
+
P.value.length,
|
|
161
|
+
d.direction,
|
|
162
|
+
d.variant,
|
|
163
|
+
d.align
|
|
164
|
+
], () => f(() => {
|
|
165
|
+
U(), W();
|
|
166
|
+
}), { immediate: !0 }), T(() => [P.value.length, d.variant], () => f(G), { immediate: !0 }), T(() => [N.value, d.direction], () => B(), {
|
|
173
167
|
immediate: !0,
|
|
174
168
|
flush: "post"
|
|
175
|
-
}),
|
|
176
|
-
|
|
177
|
-
}),
|
|
178
|
-
tabListEl:
|
|
179
|
-
direction:
|
|
180
|
-
register:
|
|
181
|
-
unregister:
|
|
182
|
-
updateValue:
|
|
183
|
-
focusAdjacent:
|
|
184
|
-
focusFirst:
|
|
185
|
-
focusLast:
|
|
186
|
-
}), (e, t) => (
|
|
187
|
-
id:
|
|
188
|
-
class:
|
|
189
|
-
}, [
|
|
169
|
+
}), h(() => {
|
|
170
|
+
L?.disconnect(), L = null;
|
|
171
|
+
}), _(i, {
|
|
172
|
+
tabListEl: N,
|
|
173
|
+
direction: a(() => d.direction),
|
|
174
|
+
register: X,
|
|
175
|
+
unregister: Z,
|
|
176
|
+
updateValue: Q,
|
|
177
|
+
focusAdjacent: $,
|
|
178
|
+
focusFirst: ee,
|
|
179
|
+
focusLast: te
|
|
180
|
+
}), (e, t) => (g(), s("div", {
|
|
181
|
+
id: d.id,
|
|
182
|
+
class: p(z.value)
|
|
183
|
+
}, [c("div", O, [l(S(n), {
|
|
190
184
|
ref_key: "overflowRef",
|
|
191
|
-
ref:
|
|
185
|
+
ref: M,
|
|
192
186
|
class: "q-tabs__overflow",
|
|
193
|
-
direction:
|
|
187
|
+
direction: d.direction,
|
|
194
188
|
"scroll-mode": "item",
|
|
195
189
|
"content-class": "q-tabs__tablist"
|
|
196
190
|
}, {
|
|
197
|
-
default:
|
|
191
|
+
default: E(() => [d.variant === "line" ? (g(), s("div", {
|
|
198
192
|
key: 0,
|
|
199
193
|
class: "q-tabs__indicator",
|
|
200
194
|
"aria-hidden": "true",
|
|
201
|
-
style:
|
|
202
|
-
}, null, 4)) :
|
|
195
|
+
style: m(F.value)
|
|
196
|
+
}, null, 4)) : o("v-if", !0)]),
|
|
203
197
|
_: 1
|
|
204
|
-
}, 8, ["direction"])], 512),
|
|
198
|
+
}, 8, ["direction"])], 512), c("div", k, [y(e.$slots, "default")])], 10, D));
|
|
205
199
|
}
|
|
206
200
|
});
|
|
207
201
|
//#endregion
|
|
208
|
-
export {
|
|
202
|
+
export { A as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextArea/QTextArea.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextArea/QTextArea.vue"],"names":[],"mappings":"AAkDA;AA+HC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,GAAG,CAAA;AAKvC,KAAK,WAAW,GAAG,cAAc,CAAC;AA6DnC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WA8GT,OAAO,IAA6B;;iCAhBb,GAAG;gCACJ,GAAG;yBACV,GAAG;wBACJ,GAAG;wBACF,GAAG;;;;;;EAiB/B;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;OASnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -49,13 +49,14 @@ var C = [
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
b(w, (e) => T.value = e, { immediate: !0 });
|
|
52
|
-
let E = e(g(c, "id")), D = r(() => c.readonly || c.disabled ? void 0 : c.placeholder), O = r(() => ({ input: c.autosize ?
|
|
53
|
-
element: r(() => c.autosize ?
|
|
52
|
+
let E = e(g(c, "id")), D = r(() => c.readonly || c.disabled ? void 0 : c.placeholder), O = r(() => `${E.value}_input`), k = r(() => ({ input: c.autosize ? j : null })), A = p(), { triggerResize: j, stop: M } = n({
|
|
53
|
+
element: r(() => c.autosize ? A.value : void 0),
|
|
54
54
|
styleProp: "minHeight"
|
|
55
55
|
});
|
|
56
|
-
return d(
|
|
56
|
+
return d(M), (e, n) => (f(), i(_(t), {
|
|
57
|
+
id: _(E),
|
|
57
58
|
class: u(["q-text-area", c.class]),
|
|
58
|
-
for:
|
|
59
|
+
for: O.value,
|
|
59
60
|
label: c.label,
|
|
60
61
|
"label-position": c.labelPosition,
|
|
61
62
|
size: c.size,
|
|
@@ -66,9 +67,9 @@ var C = [
|
|
|
66
67
|
"label.prepend": x(() => [m(e.$slots, "label.prepend")]),
|
|
67
68
|
"label.append": x(() => [m(e.$slots, "label.append")]),
|
|
68
69
|
default: x(() => [S(a("textarea", l({
|
|
69
|
-
id:
|
|
70
|
+
id: O.value,
|
|
70
71
|
ref_key: "textareaRef",
|
|
71
|
-
ref:
|
|
72
|
+
ref: A,
|
|
72
73
|
"onUpdate:modelValue": n[0] ||= (e) => T.value = e,
|
|
73
74
|
class: "q-text-area__input",
|
|
74
75
|
required: c.required,
|
|
@@ -80,7 +81,7 @@ var C = [
|
|
|
80
81
|
cols: c.cols,
|
|
81
82
|
resize: c.resize,
|
|
82
83
|
wrap: c.wrap
|
|
83
|
-
}, e.$attrs, h(
|
|
84
|
+
}, e.$attrs, h(k.value, !0)), null, 16, C), [[y, T.value]])]),
|
|
84
85
|
_: 2
|
|
85
86
|
}, [
|
|
86
87
|
e.$slots.prepend ? {
|
|
@@ -99,6 +100,7 @@ var C = [
|
|
|
99
100
|
key: "2"
|
|
100
101
|
} : void 0
|
|
101
102
|
]), 1032, [
|
|
103
|
+
"id",
|
|
102
104
|
"class",
|
|
103
105
|
"for",
|
|
104
106
|
"label",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QTextField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextField/QTextField.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QTextField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextField/QTextField.vue"],"names":[],"mappings":"AAsDA;AAyIC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,CAAA;AAKxC,KAAK,WAAW,GAAG,eAAe,CAAC;AAsEpC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WAuIT,OAAO,IAA6B;;iCAjBb,GAAG;gCACJ,GAAG;yBACV,GAAG;wBACH,GAAG;wBACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAoE8nd,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;EAlDnxd;AAkBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA+Byod,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;OArBlxd,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -44,17 +44,18 @@ var S = [
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
y(E, (e) => D.value = e, { immediate: !0 });
|
|
47
|
-
let O = e(m(w, "id")), k = _("field"), A = _("input"), j = r(() => w.readonly || w.disabled ? void 0 : w.placeholder),
|
|
48
|
-
function
|
|
49
|
-
|
|
47
|
+
let O = e(m(w, "id")), k = _("field"), A = _("input"), j = r(() => `${O.value}_input`), M = r(() => w.readonly || w.disabled ? void 0 : w.placeholder), N = r(() => w.clearable && !w.readonly && !w.disabled), P = r(() => N.value && E.value);
|
|
48
|
+
function F(e) {
|
|
49
|
+
N.value && (E.value = "", T("click:clear", e));
|
|
50
50
|
}
|
|
51
51
|
return l({
|
|
52
52
|
fieldRef: r(() => k.value?.fieldRef),
|
|
53
53
|
inputRef: A
|
|
54
54
|
}), (e, r) => (f(), i(h(t), {
|
|
55
|
+
id: h(O),
|
|
55
56
|
ref: "field",
|
|
56
57
|
class: d(["q-text-field", w.class]),
|
|
57
|
-
for:
|
|
58
|
+
for: j.value,
|
|
58
59
|
label: w.label,
|
|
59
60
|
"label-position": w.labelPosition,
|
|
60
61
|
size: w.size,
|
|
@@ -66,14 +67,14 @@ var S = [
|
|
|
66
67
|
"label.prepend": b(() => [p(e.$slots, "label.prepend")]),
|
|
67
68
|
"label.append": b(() => [p(e.$slots, "label.append")]),
|
|
68
69
|
default: b(() => [x(o("input", u({
|
|
69
|
-
id:
|
|
70
|
+
id: j.value,
|
|
70
71
|
ref: "input",
|
|
71
72
|
"onUpdate:modelValue": r[0] ||= (e) => D.value = e,
|
|
72
73
|
class: "q-text-field__input",
|
|
73
74
|
type: w.type,
|
|
74
75
|
maxlength: w.maxLength,
|
|
75
76
|
required: w.required,
|
|
76
|
-
placeholder:
|
|
77
|
+
placeholder: M.value,
|
|
77
78
|
readonly: w.readonly,
|
|
78
79
|
disabled: w.disabled
|
|
79
80
|
}, e.$attrs), null, 16, S), [[v, D.value]])]),
|
|
@@ -84,13 +85,13 @@ var S = [
|
|
|
84
85
|
fn: b(() => [p(e.$slots, "prepend")]),
|
|
85
86
|
key: "0"
|
|
86
87
|
} : void 0,
|
|
87
|
-
e.$slots.append ||
|
|
88
|
+
e.$slots.append || P.value ? {
|
|
88
89
|
name: "append",
|
|
89
|
-
fn: b(() => [p(e.$slots, "append"),
|
|
90
|
+
fn: b(() => [p(e.$slots, "append"), P.value ? (f(), i(h(n), {
|
|
90
91
|
key: 0,
|
|
91
92
|
"data-testid": "q-text-field__clear-button",
|
|
92
93
|
texts: w.texts,
|
|
93
|
-
onClick:
|
|
94
|
+
onClick: F
|
|
94
95
|
}, null, 8, ["texts"])) : a("v-if", !0)]),
|
|
95
96
|
key: "1"
|
|
96
97
|
} : void 0,
|
|
@@ -100,6 +101,7 @@ var S = [
|
|
|
100
101
|
key: "2"
|
|
101
102
|
} : void 0
|
|
102
103
|
]), 1032, [
|
|
104
|
+
"id",
|
|
103
105
|
"class",
|
|
104
106
|
"for",
|
|
105
107
|
"label",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal shape required from an item to participate in {@link useEnabledSelection}.
|
|
4
|
+
*/
|
|
5
|
+
export type QEnabledSelectionItem = {
|
|
6
|
+
/** Identity matched against the `v-model` ref. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** Whether the item is disabled and therefore excluded from selection. */
|
|
9
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
10
|
+
};
|
|
11
|
+
export interface QUseEnabledSelectionReturn<T extends QEnabledSelectionItem> {
|
|
12
|
+
/** Items with `disabled` excluded, in their original order. */
|
|
13
|
+
enabledItems: ComputedRef<T[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Snaps `model` onto an enabled item's value when it doesn't currently match one.
|
|
16
|
+
* No-ops when there is no enabled item to fall back to.
|
|
17
|
+
*/
|
|
18
|
+
ensureSelection: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Shared "enabled item" selection logic for list-like components with a
|
|
22
|
+
* `value`/`disabled` item shape and a single-value `v-model` (e.g. `QTabs`, `QSteps`).
|
|
23
|
+
*
|
|
24
|
+
* Filters out disabled items and keeps `model` snapped to an enabled one: whenever
|
|
25
|
+
* the current `model` value doesn't match an enabled item,
|
|
26
|
+
* {@link QUseEnabledSelectionReturn.ensureSelection} resets it to the first
|
|
27
|
+
* enabled item's value.
|
|
28
|
+
*
|
|
29
|
+
* @param items - Getter returning the current ordered list of items.
|
|
30
|
+
* @param model - The `v-model` ref to keep in sync with `items`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useEnabledSelection<T extends QEnabledSelectionItem>(items: () => T[], model: Ref<string | undefined>): QUseEnabledSelectionReturn<T>;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useEnabledSelection/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAK7D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IACnC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IAEb,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;CAChD,CAAA;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,SAAS,qBAAqB;IAC1E,+DAA+D;IAC/D,YAAY,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAA;IAE9B;;;OAGG;IACH,eAAe,EAAE,MAAM,IAAI,CAAA;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,EAClE,KAAK,EAAE,MAAM,CAAC,EAAE,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,GAC5B,0BAA0B,CAAC,CAAC,CAAC,CAc/B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { computed as e, toValue as t } from "vue";
|
|
2
|
+
//#region src/composables/useEnabledSelection/index.ts
|
|
3
|
+
function n(n, r) {
|
|
4
|
+
let i = e(() => n().filter((e) => !t(e.disabled)));
|
|
5
|
+
function a() {
|
|
6
|
+
let e = i.value;
|
|
7
|
+
e.length && (e.some((e) => e.value === r.value) || (r.value = e[0].value));
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
enabledItems: i,
|
|
11
|
+
ensureSelection: a
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n as useEnabledSelection };
|