@scalar/api-client 2.0.16 → 2.0.17
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 +8 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts +9 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +69 -44
- package/dist/components/DataTable/DataTableInput.vue.js +2 -2
- package/dist/components/DataTable/DataTableInput.vue2.js +13 -13
- package/dist/components/DataTable/{DataTableInputEnumSelect.vue.d.ts → DataTableInputSelect.vue.d.ts} +3 -3
- package/dist/components/DataTable/DataTableInputSelect.vue.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableInputSelect.vue.js +109 -0
- package/dist/components/DataTable/DataTableInputSelect.vue2.js +4 -0
- package/dist/store/workspace.d.ts +52 -2
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +74 -73
- package/dist/style.css +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +39 -38
- package/package.json +6 -6
- package/dist/components/DataTable/DataTableInputEnumSelect.vue.d.ts.map +0 -1
- package/dist/components/DataTable/DataTableInputEnumSelect.vue.js +0 -102
- package/dist/components/DataTable/DataTableInputEnumSelect.vue2.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 91b97fa: fix: input checked by default on required item
|
|
8
|
+
- 05bc858: feat: display select for boolean type
|
|
9
|
+
- 05bc858: fix: data table input enum select back
|
|
10
|
+
|
|
3
11
|
## 2.0.16
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -14,12 +14,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
14
14
|
required?: boolean;
|
|
15
15
|
disableEnter?: boolean;
|
|
16
16
|
disableCloseBrackets?: boolean;
|
|
17
|
+
enum?: string[];
|
|
18
|
+
type?: string;
|
|
19
|
+
nullable?: boolean;
|
|
17
20
|
}>, {
|
|
18
21
|
disableCloseBrackets: boolean;
|
|
19
22
|
disableEnter: boolean;
|
|
20
23
|
disableTabIndent: boolean;
|
|
21
24
|
emitOnBlur: boolean;
|
|
22
25
|
colorPicker: boolean;
|
|
26
|
+
nullable: boolean;
|
|
23
27
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
28
|
submit: (v: string) => void;
|
|
25
29
|
"update:modelValue": (v: string) => void;
|
|
@@ -38,16 +42,21 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
38
42
|
required?: boolean;
|
|
39
43
|
disableEnter?: boolean;
|
|
40
44
|
disableCloseBrackets?: boolean;
|
|
45
|
+
enum?: string[];
|
|
46
|
+
type?: string;
|
|
47
|
+
nullable?: boolean;
|
|
41
48
|
}>, {
|
|
42
49
|
disableCloseBrackets: boolean;
|
|
43
50
|
disableEnter: boolean;
|
|
44
51
|
disableTabIndent: boolean;
|
|
45
52
|
emitOnBlur: boolean;
|
|
46
53
|
colorPicker: boolean;
|
|
54
|
+
nullable: boolean;
|
|
47
55
|
}>>> & {
|
|
48
56
|
onSubmit?: ((v: string) => any) | undefined;
|
|
49
57
|
"onUpdate:modelValue"?: ((v: string) => any) | undefined;
|
|
50
58
|
}, {
|
|
59
|
+
nullable: boolean;
|
|
51
60
|
colorPicker: boolean;
|
|
52
61
|
emitOnBlur: boolean;
|
|
53
62
|
disableTabIndent: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,OAyPO,EAGL,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;;kBAWb,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;;;;;;;;;;;;kBAhBJ,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;;;;;;;;;;;;cAAP,OAAO;iBAhBJ,OAAO;gBAGR,OAAO;sBAGD,OAAO;kBAMX,OAAO;0BACC,OAAO;;qBAmPJ,GAAG;kBACN,GAAG;;AApQ9B,wBAuSC;AAMD,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAC7C,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAC,CAAC,GACvC,CAAC,CAAC,CAAC,CAAC;CACP,CAAC;AAEN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC;AAExD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./CodeInput.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4b2915d8"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
_ as default
|
|
7
7
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCodeMirror as
|
|
1
|
+
import { defineComponent as F, useAttrs as S, ref as b, toRef as o, watch as $, computed as O, openBlock as t, createElementBlock as u, Fragment as P, createBlock as y, mergeProps as q, unref as E, renderSlot as h, createCommentVNode as g } from "vue";
|
|
2
|
+
import { useCodeMirror as I, colorPicker as M } from "@scalar/use-codemirror";
|
|
3
3
|
import { nanoid as N } from "nanoid";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import B from "../DataTable/DataTableInputSelect.vue.js";
|
|
5
|
+
const R = ["id"], T = {
|
|
6
|
+
key: 3,
|
|
6
7
|
class: "absolute centered-y right-7 text-orange text-xs"
|
|
7
|
-
},
|
|
8
|
-
key:
|
|
8
|
+
}, A = {
|
|
9
|
+
key: 4,
|
|
9
10
|
class: "required absolute centered-y right-0 pt-px pr-2 text-xxs text-c-3 bg-b-1 shadow-[-8px_0_4px_var(--scalar-background-1)] opacity-100 duration-150 transition-opacity peer-has-[.cm-focused]:opacity-0"
|
|
10
|
-
},
|
|
11
|
+
}, U = {
|
|
11
12
|
inheritAttrs: !1
|
|
12
|
-
},
|
|
13
|
-
...
|
|
13
|
+
}, H = /* @__PURE__ */ F({
|
|
14
|
+
...U,
|
|
14
15
|
__name: "CodeInput",
|
|
15
16
|
props: {
|
|
16
17
|
colorPicker: { type: Boolean, default: !1 },
|
|
@@ -26,58 +27,82 @@ const P = ["id"], $ = {
|
|
|
26
27
|
placeholder: {},
|
|
27
28
|
required: { type: Boolean },
|
|
28
29
|
disableEnter: { type: Boolean, default: !1 },
|
|
29
|
-
disableCloseBrackets: { type: Boolean, default: !1 }
|
|
30
|
+
disableCloseBrackets: { type: Boolean, default: !1 },
|
|
31
|
+
enum: {},
|
|
32
|
+
type: {},
|
|
33
|
+
nullable: { type: Boolean, default: !1 }
|
|
30
34
|
},
|
|
31
35
|
emits: ["submit", "update:modelValue"],
|
|
32
|
-
setup(
|
|
33
|
-
var
|
|
34
|
-
const e =
|
|
35
|
-
function
|
|
36
|
-
return e.handleFieldChange ? e.handleFieldChange(
|
|
36
|
+
setup(V, { emit: k }) {
|
|
37
|
+
var m;
|
|
38
|
+
const e = V, a = k, s = S(), v = s.id || `id-${N()}`, i = b(!1);
|
|
39
|
+
function C(l) {
|
|
40
|
+
return e.handleFieldChange ? e.handleFieldChange(l) : a("update:modelValue", l);
|
|
37
41
|
}
|
|
38
|
-
function
|
|
39
|
-
return e.handleFieldSubmit ? e.handleFieldSubmit(
|
|
42
|
+
function _(l) {
|
|
43
|
+
return e.handleFieldSubmit ? e.handleFieldSubmit(l) : a("submit", l);
|
|
40
44
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
45
|
+
function w(l) {
|
|
46
|
+
i.value = !1, e.emitOnBlur && e.modelValue && _(l);
|
|
43
47
|
}
|
|
44
|
-
const
|
|
45
|
-
e.colorPicker &&
|
|
46
|
-
const
|
|
48
|
+
const c = [];
|
|
49
|
+
e.colorPicker && c.push(M);
|
|
50
|
+
const p = b(null), { codeMirror: n } = I({
|
|
47
51
|
content: o(
|
|
48
52
|
() => e.modelValue !== void 0 ? String(e.modelValue) : ""
|
|
49
53
|
),
|
|
50
|
-
onChange:
|
|
51
|
-
onFocus: () =>
|
|
52
|
-
onBlur: (
|
|
53
|
-
codeMirrorRef:
|
|
54
|
+
onChange: C,
|
|
55
|
+
onFocus: () => i.value = !0,
|
|
56
|
+
onBlur: (l) => w(l),
|
|
57
|
+
codeMirrorRef: p,
|
|
54
58
|
disableTabIndent: o(() => e.disableTabIndent),
|
|
55
59
|
disableEnter: o(() => e.disableEnter),
|
|
56
60
|
disableCloseBrackets: o(() => e.disableCloseBrackets),
|
|
57
61
|
lineNumbers: o(() => e.lineNumbers),
|
|
58
62
|
language: o(() => e.language),
|
|
59
63
|
lint: o(() => e.lint),
|
|
60
|
-
extensions:
|
|
64
|
+
extensions: c,
|
|
61
65
|
placeholder: o(() => e.placeholder)
|
|
62
66
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
(m = n.value) == null || m.focus(), $(n, () => {
|
|
68
|
+
n.value && Object.prototype.hasOwnProperty.call(s, "autofocus") && n.value.focus();
|
|
69
|
+
});
|
|
70
|
+
const x = O(() => {
|
|
71
|
+
var l;
|
|
72
|
+
return e.type === "boolean" || (l = e.type) != null && l.includes("boolean") || e.nullable ? ["true", "false", "null"] : ["true", "false"];
|
|
73
|
+
});
|
|
74
|
+
return (l, r) => {
|
|
75
|
+
var f;
|
|
76
|
+
return t(), u(P, null, [
|
|
77
|
+
e.enum && e.enum.length ? (t(), y(B, {
|
|
78
|
+
key: 0,
|
|
79
|
+
modelValue: e.modelValue,
|
|
80
|
+
value: e.enum,
|
|
81
|
+
"onUpdate:modelValue": r[0] || (r[0] = (d) => a("update:modelValue", d))
|
|
82
|
+
}, null, 8, ["modelValue", "value"])) : e.type === "boolean" || (f = e.type) != null && f.includes("boolean") ? (t(), y(B, {
|
|
83
|
+
key: 1,
|
|
84
|
+
modelValue: e.modelValue,
|
|
85
|
+
value: x.value,
|
|
86
|
+
"onUpdate:modelValue": r[1] || (r[1] = (d) => a("update:modelValue", d))
|
|
87
|
+
}, null, 8, ["modelValue", "value"])) : (t(), u("div", q({
|
|
88
|
+
key: 2,
|
|
89
|
+
id: E(v)
|
|
90
|
+
}, l.$attrs, {
|
|
91
|
+
ref_key: "codeMirrorRef",
|
|
92
|
+
ref: p,
|
|
93
|
+
class: ["peer font-code w-full whitespace-nowrap text-xs leading-[1.44] relative", {
|
|
94
|
+
"flow-code-input--error": l.error
|
|
95
|
+
}]
|
|
96
|
+
}), null, 16, R)),
|
|
97
|
+
l.$slots.warning ? (t(), u("div", T, [
|
|
98
|
+
h(l.$slots, "warning", {}, void 0, !0)
|
|
99
|
+
])) : g("", !0),
|
|
100
|
+
h(l.$slots, "icon", {}, void 0, !0),
|
|
101
|
+
l.required ? (t(), u("div", A, " Required ")) : g("", !0)
|
|
102
|
+
], 64);
|
|
103
|
+
};
|
|
79
104
|
}
|
|
80
105
|
});
|
|
81
106
|
export {
|
|
82
|
-
|
|
107
|
+
H as default
|
|
83
108
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./DataTableInput.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import o from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ o(t, [["__scopeId", "data-v-266b624d"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -2,7 +2,7 @@ import { defineComponent as $, ref as d, computed as x, openBlock as o, createBl
|
|
|
2
2
|
import F from "../../views/Environment/EnvironmentVariableDropdown.vue.js";
|
|
3
3
|
import { ScalarIconButton as I } from "@scalar/components";
|
|
4
4
|
import M from "./DataTableCell.vue.js";
|
|
5
|
-
import O from "./
|
|
5
|
+
import O from "./DataTableInputSelect.vue.js";
|
|
6
6
|
const N = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "text-c-2 flex min-w-[100px] items-center border-r-1/2 pl-2 pr-0"
|
|
@@ -27,16 +27,16 @@ const N = {
|
|
|
27
27
|
max: {}
|
|
28
28
|
},
|
|
29
29
|
emits: ["update:modelValue", "inputFocus", "inputBlur", "selectVariable"],
|
|
30
|
-
setup(
|
|
31
|
-
const
|
|
32
|
-
u.value ||
|
|
30
|
+
setup(v, { emit: y }) {
|
|
31
|
+
const l = v, n = y, a = d(!0), c = d(""), u = d(!1), w = () => {
|
|
32
|
+
u.value || n("inputBlur");
|
|
33
33
|
}, h = x(
|
|
34
|
-
() =>
|
|
34
|
+
() => l.type === "password" ? a.value ? "password" : "text" : l.type ?? "text"
|
|
35
35
|
), V = (e) => {
|
|
36
36
|
const t = e.target;
|
|
37
|
-
c.value = t.value,
|
|
37
|
+
c.value = t.value, n("update:modelValue", t.value);
|
|
38
38
|
}, g = (e) => {
|
|
39
|
-
|
|
39
|
+
n("update:modelValue", e);
|
|
40
40
|
}, k = () => {
|
|
41
41
|
u.value = !0;
|
|
42
42
|
}, b = () => {
|
|
@@ -50,12 +50,12 @@ const N = {
|
|
|
50
50
|
m(e.$slots, "default", {}, void 0, !0)
|
|
51
51
|
])) : s("", !0),
|
|
52
52
|
f("div", P, [
|
|
53
|
-
|
|
53
|
+
l.enum && l.enum.length ? (o(), p(O, {
|
|
54
54
|
key: 0,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"onUpdate:modelValue": t[0] || (t[0] = (i) =>
|
|
58
|
-
}, null, 8, ["
|
|
55
|
+
modelValue: l.modelValue,
|
|
56
|
+
value: l.enum,
|
|
57
|
+
"onUpdate:modelValue": t[0] || (t[0] = (i) => n("update:modelValue", i))
|
|
58
|
+
}, null, 8, ["modelValue", "value"])) : (o(), r(C, { key: 1 }, [
|
|
59
59
|
f("input", S(e.$attrs, {
|
|
60
60
|
id: e.id,
|
|
61
61
|
autocomplete: "off",
|
|
@@ -69,7 +69,7 @@ const N = {
|
|
|
69
69
|
type: h.value,
|
|
70
70
|
value: e.modelValue,
|
|
71
71
|
onBlur: w,
|
|
72
|
-
onFocus: t[1] || (t[1] = (i) =>
|
|
72
|
+
onFocus: t[1] || (t[1] = (i) => n("inputFocus")),
|
|
73
73
|
onInput: V
|
|
74
74
|
}), null, 16, E),
|
|
75
75
|
e.required ? (o(), r("div", H, " Required ")) : s("", !0)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
|
|
2
2
|
modelValue: string | number;
|
|
3
|
-
|
|
3
|
+
value?: string[];
|
|
4
4
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
5
|
"update:modelValue": (v: string) => void;
|
|
6
6
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
|
|
7
7
|
modelValue: string | number;
|
|
8
|
-
|
|
8
|
+
value?: string[];
|
|
9
9
|
}>>> & {
|
|
10
10
|
"onUpdate:modelValue"?: ((v: string) => any) | undefined;
|
|
11
11
|
}, {}, {}>;
|
|
@@ -19,4 +19,4 @@ type __VLS_TypePropsToOption<T> = {
|
|
|
19
19
|
required: true;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=DataTableInputSelect.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTableInputSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTableInputSelect.vue"],"names":[],"mappings":";gBAyIc,MAAM,GAAG,MAAM;YACnB,MAAM,EAAE;;;;gBADJ,MAAM,GAAG,MAAM;YACnB,MAAM,EAAE;;;;AA0TlB,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { defineComponent as B, computed as z, ref as i, watch as k, nextTick as N, openBlock as o, createElementBlock as p, withDirectives as T, withKeys as j, vModelText as I, createBlock as m, unref as l, withCtx as r, Fragment as A, renderList as E, createElementVNode as d, normalizeClass as K, createVNode as c, createTextVNode as R, toDisplayString as y, createCommentVNode as $ } from "vue";
|
|
2
|
+
import { ScalarDropdown as F, ScalarDropdownItem as V, ScalarIcon as f, ScalarDropdownDivider as L, ScalarButton as M } from "@scalar/components";
|
|
3
|
+
const U = { class: "w-full" }, W = { class: "flex items-center justify-center h-4 w-4" }, q = /* @__PURE__ */ d("span", null, "Add value", -1), O = /* @__PURE__ */ B({
|
|
4
|
+
__name: "DataTableInputSelect",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {},
|
|
7
|
+
value: {}
|
|
8
|
+
},
|
|
9
|
+
emits: ["update:modelValue"],
|
|
10
|
+
setup(_, { emit: g }) {
|
|
11
|
+
const v = _, x = g, C = z(() => v.value ?? []), n = i(v.modelValue.toString()), s = i(!1), a = i(""), h = i(null);
|
|
12
|
+
k(a, (e) => {
|
|
13
|
+
x("update:modelValue", e);
|
|
14
|
+
});
|
|
15
|
+
const w = (e) => {
|
|
16
|
+
n.value = e, x("update:modelValue", e), s.value = !1;
|
|
17
|
+
}, S = () => {
|
|
18
|
+
a.value.trim() && (w(a.value), a.value = "");
|
|
19
|
+
}, D = () => {
|
|
20
|
+
a.value.trim() || (n.value = "", s.value = !1);
|
|
21
|
+
}, b = (e) => n.value === e;
|
|
22
|
+
return k(s, (e) => {
|
|
23
|
+
e && N(() => {
|
|
24
|
+
var u;
|
|
25
|
+
(u = h.value) == null || u.focus();
|
|
26
|
+
});
|
|
27
|
+
}), (e, u) => (o(), p("div", U, [
|
|
28
|
+
s.value ? T((o(), p("input", {
|
|
29
|
+
key: 0,
|
|
30
|
+
ref_key: "inputRef",
|
|
31
|
+
ref: h,
|
|
32
|
+
"onUpdate:modelValue": u[0] || (u[0] = (t) => a.value = t),
|
|
33
|
+
class: "border-none focus:text-c-1 text-c-2 min-w-0 w-full px-2 py-1.5 outline-none",
|
|
34
|
+
placeholder: "Value",
|
|
35
|
+
type: "text",
|
|
36
|
+
onBlur: D,
|
|
37
|
+
onKeyup: j(S, ["enter"])
|
|
38
|
+
}, null, 544)), [
|
|
39
|
+
[I, a.value]
|
|
40
|
+
]) : (o(), m(l(F), {
|
|
41
|
+
key: 1,
|
|
42
|
+
resize: "",
|
|
43
|
+
value: n.value
|
|
44
|
+
}, {
|
|
45
|
+
items: r(() => [
|
|
46
|
+
(o(!0), p(A, null, E(C.value, (t) => (o(), m(l(V), {
|
|
47
|
+
key: t,
|
|
48
|
+
class: "flex gap-1.5 group/item items-center whitespace-nowrap text-ellipsis overflow-hidden",
|
|
49
|
+
value: t,
|
|
50
|
+
onClick: (G) => w(t)
|
|
51
|
+
}, {
|
|
52
|
+
default: r(() => [
|
|
53
|
+
d("div", {
|
|
54
|
+
class: K([
|
|
55
|
+
"flex items-center justify-center rounded-full p-[3px] w-4 h-4 group-hover/item:shadow-border",
|
|
56
|
+
b(t) ? "bg-blue text-b-1" : "text-transparent"
|
|
57
|
+
])
|
|
58
|
+
}, [
|
|
59
|
+
c(l(f), {
|
|
60
|
+
class: "size-2.5 stroke-[1.75]",
|
|
61
|
+
icon: "Checkmark"
|
|
62
|
+
})
|
|
63
|
+
], 2),
|
|
64
|
+
R(" " + y(t), 1)
|
|
65
|
+
]),
|
|
66
|
+
_: 2
|
|
67
|
+
}, 1032, ["value", "onClick"]))), 128)),
|
|
68
|
+
c(l(L)),
|
|
69
|
+
c(l(V), {
|
|
70
|
+
class: "flex items-center gap-1.5",
|
|
71
|
+
onClick: u[1] || (u[1] = (t) => s.value = !0)
|
|
72
|
+
}, {
|
|
73
|
+
default: r(() => [
|
|
74
|
+
d("div", W, [
|
|
75
|
+
c(l(f), {
|
|
76
|
+
class: "h-2.5",
|
|
77
|
+
icon: "Add"
|
|
78
|
+
})
|
|
79
|
+
]),
|
|
80
|
+
q
|
|
81
|
+
]),
|
|
82
|
+
_: 1
|
|
83
|
+
})
|
|
84
|
+
]),
|
|
85
|
+
default: r(() => [
|
|
86
|
+
c(l(M), {
|
|
87
|
+
class: "gap-1.5 font-normal h-full justify-start px-2 py-1.5",
|
|
88
|
+
fullWidth: "",
|
|
89
|
+
variant: "ghost"
|
|
90
|
+
}, {
|
|
91
|
+
default: r(() => [
|
|
92
|
+
d("span", null, y(n.value || "Select a value"), 1),
|
|
93
|
+
n.value ? $("", !0) : (o(), m(l(f), {
|
|
94
|
+
key: 0,
|
|
95
|
+
icon: "ChevronDown",
|
|
96
|
+
size: "xs"
|
|
97
|
+
}))
|
|
98
|
+
]),
|
|
99
|
+
_: 1
|
|
100
|
+
})
|
|
101
|
+
]),
|
|
102
|
+
_: 1
|
|
103
|
+
}, 8, ["value"]))
|
|
104
|
+
]));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
export {
|
|
108
|
+
O as default
|
|
109
|
+
};
|