@bagelink/vue 0.0.214 → 0.0.216
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/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +28 -23
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts +41 -42
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/index.cjs +48 -42
- package/dist/index.mjs +49 -43
- package/dist/style.css +9 -9
- package/package.json +1 -1
- package/src/components/form/BglField.vue +9 -0
- package/src/components/form/BglForm.vue +15 -15
- package/src/components/form/inputs/CheckInput.vue +2 -18
- package/src/components/form/inputs/ToggleInput.vue +2 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BglField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BglField.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BglField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BglField.vue"],"names":[],"mappings":"AAoBA;AAEA,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,eAAe,CAAC;;gBA+FtC,OAAO,MAAM,EAAE,GAAG,CAAC;WACxB,KAAK;;;;gBADA,OAAO,MAAM,EAAE,GAAG,CAAC;WACxB,KAAK;;;;AAPhB,wBAUG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
|
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
import { type BglFormSchemaT } from '../..';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<
|
|
3
|
-
modelValue
|
|
4
|
-
schema:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
|
+
modelValue: import("vue").PropType<Record<string, any>>;
|
|
4
|
+
schema: {
|
|
5
|
+
type: import("vue").PropType<BglFormSchemaT>;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
onDelete: {
|
|
9
|
+
type: import("vue").PropType<(id: string) => void>;
|
|
10
|
+
};
|
|
11
|
+
onSubmit: {
|
|
12
|
+
type: import("vue").PropType<(data: any) => void>;
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
validateForm: () => boolean | undefined;
|
|
16
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
17
|
submit: (...args: any[]) => void;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
modelValue: import("vue").PropType<Record<string, any>>;
|
|
20
|
+
schema: {
|
|
21
|
+
type: import("vue").PropType<BglFormSchemaT>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
onDelete: {
|
|
25
|
+
type: import("vue").PropType<(id: string) => void>;
|
|
26
|
+
};
|
|
27
|
+
onSubmit: {
|
|
28
|
+
type: import("vue").PropType<(data: any) => void>;
|
|
29
|
+
};
|
|
30
|
+
}>> & {
|
|
17
31
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
18
32
|
}, {}, {}>, {
|
|
19
33
|
submit?(_: {}): any;
|
|
20
34
|
}>;
|
|
21
35
|
export default _default;
|
|
22
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
23
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
24
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
25
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
26
|
-
} : {
|
|
27
|
-
type: import('vue').PropType<T[K]>;
|
|
28
|
-
required: true;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
36
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
32
37
|
new (): {
|
|
33
38
|
$slots: S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BglForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BglForm.vue"],"names":[],"mappings":"AAgBA;AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC
|
|
1
|
+
{"version":3,"file":"BglForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BglForm.vue"],"names":[],"mappings":"AAgBA;AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8MpD,wBAAwG;AAGxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
|
|
@@ -1,47 +1,46 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
modelValue: import("vue").PropType<boolean>;
|
|
3
|
+
small: {
|
|
4
|
+
type: import("vue").PropType<boolean>;
|
|
5
|
+
};
|
|
6
|
+
title: {
|
|
7
|
+
type: import("vue").PropType<string>;
|
|
8
|
+
};
|
|
9
|
+
label: {
|
|
10
|
+
type: import("vue").PropType<string>;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
id: {
|
|
14
|
+
type: import("vue").PropType<string>;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
editMode: {
|
|
18
|
+
type: import("vue").PropType<boolean>;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
modelValue: import("vue").PropType<boolean>;
|
|
23
|
+
small: {
|
|
24
|
+
type: import("vue").PropType<boolean>;
|
|
25
|
+
};
|
|
26
|
+
title: {
|
|
27
|
+
type: import("vue").PropType<string>;
|
|
28
|
+
};
|
|
29
|
+
label: {
|
|
30
|
+
type: import("vue").PropType<string>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
id: {
|
|
34
|
+
type: import("vue").PropType<string>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
editMode: {
|
|
38
|
+
type: import("vue").PropType<boolean>;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
}>>, {
|
|
26
42
|
id: string;
|
|
27
43
|
editMode: boolean;
|
|
28
44
|
}, {}>;
|
|
29
45
|
export default _default;
|
|
30
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
31
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
32
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
33
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
34
|
-
} : {
|
|
35
|
-
type: import('vue').PropType<T[K]>;
|
|
36
|
-
required: true;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
type __VLS_WithDefaults<P, D> = {
|
|
40
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
41
|
-
default: D[K];
|
|
42
|
-
}> : P[K];
|
|
43
|
-
};
|
|
44
|
-
type __VLS_Prettify<T> = {
|
|
45
|
-
[K in keyof T]: T[K];
|
|
46
|
-
} & {};
|
|
47
46
|
//# sourceMappingURL=CheckInput.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/CheckInput.vue"],"names":[],"mappings":"AAuBA
|
|
1
|
+
{"version":3,"file":"CheckInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/CheckInput.vue"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4IS,MAAM;cAEA,OAAO;;AAVtB,wBAeG"}
|
package/dist/index.cjs
CHANGED
|
@@ -18471,32 +18471,37 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
|
18471
18471
|
const _hoisted_1$B = { key: 2 };
|
|
18472
18472
|
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
18473
18473
|
__name: "BglForm",
|
|
18474
|
-
props: {
|
|
18475
|
-
modelValue: {},
|
|
18474
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
18476
18475
|
schema: {},
|
|
18477
18476
|
onDelete: { type: Function },
|
|
18478
18477
|
onSubmit: { type: Function }
|
|
18479
|
-
},
|
|
18480
|
-
|
|
18481
|
-
|
|
18478
|
+
}, {
|
|
18479
|
+
"modelValue": { default: {} },
|
|
18480
|
+
"modelModifiers": {}
|
|
18481
|
+
}),
|
|
18482
|
+
emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:modelValue"]),
|
|
18483
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18482
18484
|
const { showModal } = useModal();
|
|
18485
|
+
const data2 = vue.useModel(__props, "modelValue");
|
|
18483
18486
|
const props2 = __props;
|
|
18484
|
-
|
|
18485
|
-
|
|
18486
|
-
|
|
18487
|
-
|
|
18487
|
+
const form = vue.ref();
|
|
18488
|
+
const validateForm = () => {
|
|
18489
|
+
var _a2, _b;
|
|
18490
|
+
return (_b = (_a2 = form.value) == null ? void 0 : _a2.reportValidity) == null ? void 0 : _b.call(_a2);
|
|
18491
|
+
};
|
|
18488
18492
|
const updateModelValue = (val, fieldID) => {
|
|
18489
|
-
if (!fieldID)
|
|
18493
|
+
if (!fieldID || !data2.value)
|
|
18490
18494
|
return;
|
|
18491
18495
|
data2.value[fieldID] = val;
|
|
18492
|
-
emits("update:modelValue", data2.value);
|
|
18493
18496
|
};
|
|
18497
|
+
__expose({ validateForm });
|
|
18498
|
+
const clearForm = () => Object.assign(data2, {});
|
|
18494
18499
|
const emits = __emit;
|
|
18495
18500
|
const runSubmit = () => {
|
|
18496
|
-
|
|
18501
|
+
validateForm();
|
|
18502
|
+
emits("submit", data2);
|
|
18497
18503
|
clearForm();
|
|
18498
18504
|
};
|
|
18499
|
-
const clearForm = () => data2.value = {};
|
|
18500
18505
|
const i18nT = (val) => val;
|
|
18501
18506
|
const runDelete = () => {
|
|
18502
18507
|
showModal(
|
|
@@ -18521,17 +18526,19 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
18521
18526
|
return (_ctx, _cache) => {
|
|
18522
18527
|
var _a2;
|
|
18523
18528
|
return vue.openBlock(), vue.createElementBlock("form", {
|
|
18529
|
+
ref_key: "form",
|
|
18530
|
+
ref: form,
|
|
18524
18531
|
onSubmit: vue.withModifiers(runSubmit, ["prevent"])
|
|
18525
18532
|
}, [
|
|
18526
18533
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.schema, (field, i3) => {
|
|
18527
18534
|
return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$q), {
|
|
18528
18535
|
key: field.id || `${i3}p`,
|
|
18529
18536
|
field,
|
|
18530
|
-
modelValue:
|
|
18537
|
+
modelValue: data2.value,
|
|
18531
18538
|
"onUpdate:modelValue": ($event) => updateModelValue($event, (field == null ? void 0 : field.id) || "")
|
|
18532
18539
|
}, null, 8, ["field", "modelValue", "onUpdate:modelValue"]);
|
|
18533
18540
|
}), 128)),
|
|
18534
|
-
((_a2 =
|
|
18541
|
+
((_a2 = data2.value) == null ? void 0 : _a2.id) && _ctx.onDelete ? (vue.openBlock(), vue.createBlock(vue.unref(Btn), {
|
|
18535
18542
|
key: 0,
|
|
18536
18543
|
class: "del-top",
|
|
18537
18544
|
onClick: runDelete,
|
|
@@ -18549,7 +18556,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
18549
18556
|
})) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$B, [
|
|
18550
18557
|
vue.renderSlot(_ctx.$slots, "submit")
|
|
18551
18558
|
]))
|
|
18552
|
-
],
|
|
18559
|
+
], 544);
|
|
18553
18560
|
};
|
|
18554
18561
|
}
|
|
18555
18562
|
});
|
|
@@ -18562,11 +18569,23 @@ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
|
18562
18569
|
emits: ["update:modelValue"],
|
|
18563
18570
|
setup(__props, { emit: __emit }) {
|
|
18564
18571
|
const props2 = __props;
|
|
18572
|
+
const vIf = vue.computed(() => {
|
|
18573
|
+
if (props2.field["v-if"] === void 0)
|
|
18574
|
+
return true;
|
|
18575
|
+
if (typeof props2.field["v-if"] === "boolean")
|
|
18576
|
+
return props2.field["v-if"];
|
|
18577
|
+
if (typeof props2.field["v-if"] === "string")
|
|
18578
|
+
return !!props2.modelValue[props2.field["v-if"]];
|
|
18579
|
+
if (typeof props2.field["v-if"] === "function")
|
|
18580
|
+
return props2.field["v-if"](props2.modelValue[props2.field.id || ""], props2.modelValue);
|
|
18581
|
+
return true;
|
|
18582
|
+
});
|
|
18565
18583
|
const emits = __emit;
|
|
18566
18584
|
return (_ctx, _cache) => {
|
|
18567
18585
|
var _a2;
|
|
18568
18586
|
const _component_BglField = vue.resolveComponent("BglField", true);
|
|
18569
|
-
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.field.$el || "div"), vue.mergeProps({
|
|
18587
|
+
return vIf.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.field.$el || "div"), vue.mergeProps({
|
|
18588
|
+
key: 0,
|
|
18570
18589
|
required: _ctx.field.required
|
|
18571
18590
|
}, vue.unref(bindAttrs)(((_a2 = _ctx.field) == null ? void 0 : _a2.attrs) || {}, props2.modelValue[_ctx.field.id || ""], props2.modelValue), {
|
|
18572
18591
|
label: _ctx.field.label,
|
|
@@ -18586,11 +18605,11 @@ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
|
18586
18605
|
}), 128))
|
|
18587
18606
|
]),
|
|
18588
18607
|
_: 1
|
|
18589
|
-
}, 16, ["required", "label", "id", "placeholder", "modelValue"]);
|
|
18608
|
+
}, 16, ["required", "label", "id", "placeholder", "modelValue"])) : vue.createCommentVNode("", true);
|
|
18590
18609
|
};
|
|
18591
18610
|
}
|
|
18592
18611
|
});
|
|
18593
|
-
const _withScopeId = (n) => (vue.pushScopeId("data-v-
|
|
18612
|
+
const _withScopeId = (n) => (vue.pushScopeId("data-v-0cde7fe3"), n = n(), vue.popScopeId(), n);
|
|
18594
18613
|
const _hoisted_1$A = ["title"];
|
|
18595
18614
|
const _hoisted_2$x = ["id"];
|
|
18596
18615
|
const _hoisted_3$t = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("svg", {
|
|
@@ -18604,32 +18623,19 @@ const _hoisted_3$t = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.crea
|
|
|
18604
18623
|
const _hoisted_4$f = ["for"];
|
|
18605
18624
|
const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
18606
18625
|
__name: "CheckInput",
|
|
18607
|
-
props: {
|
|
18626
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
18608
18627
|
label: {},
|
|
18609
18628
|
id: { default: Math.random().toString(36).substring(7) },
|
|
18610
18629
|
title: {},
|
|
18611
|
-
modelValue: { type: Boolean },
|
|
18612
18630
|
editMode: { type: Boolean, default: true },
|
|
18613
18631
|
small: { type: Boolean }
|
|
18614
|
-
},
|
|
18632
|
+
}, {
|
|
18633
|
+
"modelValue": { type: Boolean, ...{ default: false } },
|
|
18634
|
+
"modelModifiers": {}
|
|
18635
|
+
}),
|
|
18615
18636
|
emits: ["update:modelValue"],
|
|
18616
|
-
setup(__props
|
|
18617
|
-
const
|
|
18618
|
-
const props2 = __props;
|
|
18619
|
-
let inputVal = vue.ref(false);
|
|
18620
|
-
vue.watch(inputVal.value, (newVal) => {
|
|
18621
|
-
if (newVal === void 0)
|
|
18622
|
-
return;
|
|
18623
|
-
emits("update:modelValue", newVal);
|
|
18624
|
-
});
|
|
18625
|
-
vue.watch(
|
|
18626
|
-
() => props2.modelValue,
|
|
18627
|
-
(newVal) => {
|
|
18628
|
-
if (inputVal.value !== newVal)
|
|
18629
|
-
inputVal.value = newVal;
|
|
18630
|
-
},
|
|
18631
|
-
{ immediate: true }
|
|
18632
|
-
);
|
|
18637
|
+
setup(__props) {
|
|
18638
|
+
const inputVal = vue.useModel(__props, "modelValue");
|
|
18633
18639
|
return (_ctx, _cache) => {
|
|
18634
18640
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
18635
18641
|
class: vue.normalizeClass(["bagel-input bgl-checkbox", { small: _ctx.small, "no-edit": !_ctx.editMode }]),
|
|
@@ -18638,10 +18644,10 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
|
18638
18644
|
vue.withDirectives(vue.createElementVNode("input", {
|
|
18639
18645
|
id: _ctx.id,
|
|
18640
18646
|
type: "checkbox",
|
|
18641
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
18647
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event),
|
|
18642
18648
|
class: vue.normalizeClass({ "no-edit": !_ctx.editMode })
|
|
18643
18649
|
}, null, 10, _hoisted_2$x), [
|
|
18644
|
-
[vue.vModelCheckbox,
|
|
18650
|
+
[vue.vModelCheckbox, inputVal.value]
|
|
18645
18651
|
]),
|
|
18646
18652
|
_hoisted_3$t,
|
|
18647
18653
|
vue.createElementVNode("label", { for: _ctx.id }, vue.toDisplayString(_ctx.label), 9, _hoisted_4$f)
|
|
@@ -18649,7 +18655,7 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
|
18649
18655
|
};
|
|
18650
18656
|
}
|
|
18651
18657
|
});
|
|
18652
|
-
const CheckInput = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-
|
|
18658
|
+
const CheckInput = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-0cde7fe3"]]);
|
|
18653
18659
|
const _hoisted_1$z = ["title"];
|
|
18654
18660
|
const _hoisted_2$w = { key: 0 };
|
|
18655
18661
|
const _hoisted_3$s = { class: "flex gap-3" };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, ref, defineComponent, h, openBlock, createElementBlock, Fragment as Fragment$1, createElementVNode, createTextVNode, toDisplayString, watch, onMounted, withKeys, withModifiers, normalizeStyle, resolveComponent, normalizeClass, renderSlot, renderList, createBlock, withCtx, pushScopeId, popScopeId, useCssVars, useSlots, computed, resolveDynamicComponent, unref, createCommentVNode, onUnmounted, createVNode, mergeProps, withDirectives, vModelText, isRef, reactive, Transition, markRaw, vModelCheckbox, Teleport, vModelDynamic, TransitionGroup, toRef, nextTick, createSlots, normalizeProps, guardReactiveProps, render as render$e, onBeforeUpdate, vShow, getCurrentScope, onScopeDispose, vModelRadio, provide } from "vue";
|
|
1
|
+
import { inject, ref, defineComponent, h, openBlock, createElementBlock, Fragment as Fragment$1, createElementVNode, createTextVNode, toDisplayString, watch, onMounted, withKeys, withModifiers, normalizeStyle, resolveComponent, normalizeClass, renderSlot, renderList, createBlock, withCtx, pushScopeId, popScopeId, useCssVars, useSlots, computed, resolveDynamicComponent, unref, createCommentVNode, onUnmounted, createVNode, mergeProps, withDirectives, vModelText, isRef, reactive, Transition, markRaw, vModelCheckbox, mergeModels, useModel, Teleport, vModelDynamic, TransitionGroup, toRef, nextTick, createSlots, normalizeProps, guardReactiveProps, render as render$e, onBeforeUpdate, vShow, getCurrentScope, onScopeDispose, vModelRadio, provide } from "vue";
|
|
2
2
|
function bind$2(fn2, thisArg) {
|
|
3
3
|
return function wrap2() {
|
|
4
4
|
return fn2.apply(thisArg, arguments);
|
|
@@ -18469,32 +18469,37 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
18469
18469
|
const _hoisted_1$B = { key: 2 };
|
|
18470
18470
|
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
18471
18471
|
__name: "BglForm",
|
|
18472
|
-
props: {
|
|
18473
|
-
modelValue: {},
|
|
18472
|
+
props: /* @__PURE__ */ mergeModels({
|
|
18474
18473
|
schema: {},
|
|
18475
18474
|
onDelete: { type: Function },
|
|
18476
18475
|
onSubmit: { type: Function }
|
|
18477
|
-
},
|
|
18478
|
-
|
|
18479
|
-
|
|
18476
|
+
}, {
|
|
18477
|
+
"modelValue": { default: {} },
|
|
18478
|
+
"modelModifiers": {}
|
|
18479
|
+
}),
|
|
18480
|
+
emits: /* @__PURE__ */ mergeModels(["submit"], ["update:modelValue"]),
|
|
18481
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
18480
18482
|
const { showModal } = useModal();
|
|
18483
|
+
const data2 = useModel(__props, "modelValue");
|
|
18481
18484
|
const props2 = __props;
|
|
18482
|
-
|
|
18483
|
-
|
|
18484
|
-
|
|
18485
|
-
|
|
18485
|
+
const form = ref();
|
|
18486
|
+
const validateForm = () => {
|
|
18487
|
+
var _a2, _b;
|
|
18488
|
+
return (_b = (_a2 = form.value) == null ? void 0 : _a2.reportValidity) == null ? void 0 : _b.call(_a2);
|
|
18489
|
+
};
|
|
18486
18490
|
const updateModelValue = (val, fieldID) => {
|
|
18487
|
-
if (!fieldID)
|
|
18491
|
+
if (!fieldID || !data2.value)
|
|
18488
18492
|
return;
|
|
18489
18493
|
data2.value[fieldID] = val;
|
|
18490
|
-
emits("update:modelValue", data2.value);
|
|
18491
18494
|
};
|
|
18495
|
+
__expose({ validateForm });
|
|
18496
|
+
const clearForm = () => Object.assign(data2, {});
|
|
18492
18497
|
const emits = __emit;
|
|
18493
18498
|
const runSubmit = () => {
|
|
18494
|
-
|
|
18499
|
+
validateForm();
|
|
18500
|
+
emits("submit", data2);
|
|
18495
18501
|
clearForm();
|
|
18496
18502
|
};
|
|
18497
|
-
const clearForm = () => data2.value = {};
|
|
18498
18503
|
const i18nT = (val) => val;
|
|
18499
18504
|
const runDelete = () => {
|
|
18500
18505
|
showModal(
|
|
@@ -18519,17 +18524,19 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
18519
18524
|
return (_ctx, _cache) => {
|
|
18520
18525
|
var _a2;
|
|
18521
18526
|
return openBlock(), createElementBlock("form", {
|
|
18527
|
+
ref_key: "form",
|
|
18528
|
+
ref: form,
|
|
18522
18529
|
onSubmit: withModifiers(runSubmit, ["prevent"])
|
|
18523
18530
|
}, [
|
|
18524
18531
|
(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.schema, (field, i3) => {
|
|
18525
18532
|
return openBlock(), createBlock(unref(_sfc_main$q), {
|
|
18526
18533
|
key: field.id || `${i3}p`,
|
|
18527
18534
|
field,
|
|
18528
|
-
modelValue:
|
|
18535
|
+
modelValue: data2.value,
|
|
18529
18536
|
"onUpdate:modelValue": ($event) => updateModelValue($event, (field == null ? void 0 : field.id) || "")
|
|
18530
18537
|
}, null, 8, ["field", "modelValue", "onUpdate:modelValue"]);
|
|
18531
18538
|
}), 128)),
|
|
18532
|
-
((_a2 =
|
|
18539
|
+
((_a2 = data2.value) == null ? void 0 : _a2.id) && _ctx.onDelete ? (openBlock(), createBlock(unref(Btn), {
|
|
18533
18540
|
key: 0,
|
|
18534
18541
|
class: "del-top",
|
|
18535
18542
|
onClick: runDelete,
|
|
@@ -18547,7 +18554,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
18547
18554
|
})) : (openBlock(), createElementBlock("div", _hoisted_1$B, [
|
|
18548
18555
|
renderSlot(_ctx.$slots, "submit")
|
|
18549
18556
|
]))
|
|
18550
|
-
],
|
|
18557
|
+
], 544);
|
|
18551
18558
|
};
|
|
18552
18559
|
}
|
|
18553
18560
|
});
|
|
@@ -18560,11 +18567,23 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
18560
18567
|
emits: ["update:modelValue"],
|
|
18561
18568
|
setup(__props, { emit: __emit }) {
|
|
18562
18569
|
const props2 = __props;
|
|
18570
|
+
const vIf = computed(() => {
|
|
18571
|
+
if (props2.field["v-if"] === void 0)
|
|
18572
|
+
return true;
|
|
18573
|
+
if (typeof props2.field["v-if"] === "boolean")
|
|
18574
|
+
return props2.field["v-if"];
|
|
18575
|
+
if (typeof props2.field["v-if"] === "string")
|
|
18576
|
+
return !!props2.modelValue[props2.field["v-if"]];
|
|
18577
|
+
if (typeof props2.field["v-if"] === "function")
|
|
18578
|
+
return props2.field["v-if"](props2.modelValue[props2.field.id || ""], props2.modelValue);
|
|
18579
|
+
return true;
|
|
18580
|
+
});
|
|
18563
18581
|
const emits = __emit;
|
|
18564
18582
|
return (_ctx, _cache) => {
|
|
18565
18583
|
var _a2;
|
|
18566
18584
|
const _component_BglField = resolveComponent("BglField", true);
|
|
18567
|
-
return openBlock(), createBlock(resolveDynamicComponent(_ctx.field.$el || "div"), mergeProps({
|
|
18585
|
+
return vIf.value ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.field.$el || "div"), mergeProps({
|
|
18586
|
+
key: 0,
|
|
18568
18587
|
required: _ctx.field.required
|
|
18569
18588
|
}, unref(bindAttrs)(((_a2 = _ctx.field) == null ? void 0 : _a2.attrs) || {}, props2.modelValue[_ctx.field.id || ""], props2.modelValue), {
|
|
18570
18589
|
label: _ctx.field.label,
|
|
@@ -18584,11 +18603,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
18584
18603
|
}), 128))
|
|
18585
18604
|
]),
|
|
18586
18605
|
_: 1
|
|
18587
|
-
}, 16, ["required", "label", "id", "placeholder", "modelValue"]);
|
|
18606
|
+
}, 16, ["required", "label", "id", "placeholder", "modelValue"])) : createCommentVNode("", true);
|
|
18588
18607
|
};
|
|
18589
18608
|
}
|
|
18590
18609
|
});
|
|
18591
|
-
const _withScopeId = (n) => (pushScopeId("data-v-
|
|
18610
|
+
const _withScopeId = (n) => (pushScopeId("data-v-0cde7fe3"), n = n(), popScopeId(), n);
|
|
18592
18611
|
const _hoisted_1$A = ["title"];
|
|
18593
18612
|
const _hoisted_2$x = ["id"];
|
|
18594
18613
|
const _hoisted_3$t = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("svg", {
|
|
@@ -18602,32 +18621,19 @@ const _hoisted_3$t = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createEl
|
|
|
18602
18621
|
const _hoisted_4$f = ["for"];
|
|
18603
18622
|
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
18604
18623
|
__name: "CheckInput",
|
|
18605
|
-
props: {
|
|
18624
|
+
props: /* @__PURE__ */ mergeModels({
|
|
18606
18625
|
label: {},
|
|
18607
18626
|
id: { default: Math.random().toString(36).substring(7) },
|
|
18608
18627
|
title: {},
|
|
18609
|
-
modelValue: { type: Boolean },
|
|
18610
18628
|
editMode: { type: Boolean, default: true },
|
|
18611
18629
|
small: { type: Boolean }
|
|
18612
|
-
},
|
|
18630
|
+
}, {
|
|
18631
|
+
"modelValue": { type: Boolean, ...{ default: false } },
|
|
18632
|
+
"modelModifiers": {}
|
|
18633
|
+
}),
|
|
18613
18634
|
emits: ["update:modelValue"],
|
|
18614
|
-
setup(__props
|
|
18615
|
-
const
|
|
18616
|
-
const props2 = __props;
|
|
18617
|
-
let inputVal = ref(false);
|
|
18618
|
-
watch(inputVal.value, (newVal) => {
|
|
18619
|
-
if (newVal === void 0)
|
|
18620
|
-
return;
|
|
18621
|
-
emits("update:modelValue", newVal);
|
|
18622
|
-
});
|
|
18623
|
-
watch(
|
|
18624
|
-
() => props2.modelValue,
|
|
18625
|
-
(newVal) => {
|
|
18626
|
-
if (inputVal.value !== newVal)
|
|
18627
|
-
inputVal.value = newVal;
|
|
18628
|
-
},
|
|
18629
|
-
{ immediate: true }
|
|
18630
|
-
);
|
|
18635
|
+
setup(__props) {
|
|
18636
|
+
const inputVal = useModel(__props, "modelValue");
|
|
18631
18637
|
return (_ctx, _cache) => {
|
|
18632
18638
|
return openBlock(), createElementBlock("div", {
|
|
18633
18639
|
class: normalizeClass(["bagel-input bgl-checkbox", { small: _ctx.small, "no-edit": !_ctx.editMode }]),
|
|
@@ -18636,10 +18642,10 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
18636
18642
|
withDirectives(createElementVNode("input", {
|
|
18637
18643
|
id: _ctx.id,
|
|
18638
18644
|
type: "checkbox",
|
|
18639
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
18645
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event),
|
|
18640
18646
|
class: normalizeClass({ "no-edit": !_ctx.editMode })
|
|
18641
18647
|
}, null, 10, _hoisted_2$x), [
|
|
18642
|
-
[vModelCheckbox,
|
|
18648
|
+
[vModelCheckbox, inputVal.value]
|
|
18643
18649
|
]),
|
|
18644
18650
|
_hoisted_3$t,
|
|
18645
18651
|
createElementVNode("label", { for: _ctx.id }, toDisplayString(_ctx.label), 9, _hoisted_4$f)
|
|
@@ -18647,7 +18653,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
18647
18653
|
};
|
|
18648
18654
|
}
|
|
18649
18655
|
});
|
|
18650
|
-
const CheckInput = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-
|
|
18656
|
+
const CheckInput = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-0cde7fe3"]]);
|
|
18651
18657
|
const _hoisted_1$z = ["title"];
|
|
18652
18658
|
const _hoisted_2$w = { key: 0 };
|
|
18653
18659
|
const _hoisted_3$s = { class: "flex gap-3" };
|
package/dist/style.css
CHANGED
|
@@ -1738,25 +1738,25 @@ input:checked + .slider[data-v-dee6bdf5]:before {
|
|
|
1738
1738
|
--bgl-primary: #19b8ea;
|
|
1739
1739
|
}
|
|
1740
1740
|
|
|
1741
|
-
.bgl-checkbox[data-v-
|
|
1741
|
+
.bgl-checkbox[data-v-0cde7fe3]{
|
|
1742
1742
|
position: relative;
|
|
1743
1743
|
}
|
|
1744
|
-
.bgl-checkbox input[type=checkbox][data-v-
|
|
1744
|
+
.bgl-checkbox input[type=checkbox][data-v-0cde7fe3]{
|
|
1745
1745
|
display: none;
|
|
1746
1746
|
}
|
|
1747
|
-
.bgl-checkbox label[data-v-
|
|
1747
|
+
.bgl-checkbox label[data-v-0cde7fe3]{
|
|
1748
1748
|
padding-inline-start: calc(var(--input-height) / 2 + 0.25rem);
|
|
1749
1749
|
transition: var(--bgl-transition);
|
|
1750
1750
|
cursor: pointer;
|
|
1751
1751
|
user-select: none;
|
|
1752
1752
|
}
|
|
1753
|
-
.bgl-checkbox[data-v-
|
|
1753
|
+
.bgl-checkbox[data-v-0cde7fe3]:hover{
|
|
1754
1754
|
filter: brightness(90%);
|
|
1755
1755
|
}
|
|
1756
|
-
.bgl-checkbox[data-v-
|
|
1756
|
+
.bgl-checkbox[data-v-0cde7fe3]:active{
|
|
1757
1757
|
filter: var(--bgl-active-filter);
|
|
1758
1758
|
}
|
|
1759
|
-
.bgl-checkbox label[data-v-
|
|
1759
|
+
.bgl-checkbox label[data-v-0cde7fe3]::before{
|
|
1760
1760
|
content: "";
|
|
1761
1761
|
width: calc(var(--input-height) / 2.5);
|
|
1762
1762
|
height: calc(var(--input-height) / 2.5);
|
|
@@ -1768,10 +1768,10 @@ position: relative;
|
|
|
1768
1768
|
border-radius: calc(var(--input-border-radius) / 2) ;
|
|
1769
1769
|
border: var(--bgl-primary) 1px solid;
|
|
1770
1770
|
}
|
|
1771
|
-
input:checked ~ label[data-v-
|
|
1771
|
+
input:checked ~ label[data-v-0cde7fe3]::before{
|
|
1772
1772
|
background: var(--bgl-primary);
|
|
1773
1773
|
}
|
|
1774
|
-
.bgl-checkbox svg[data-v-
|
|
1774
|
+
.bgl-checkbox svg[data-v-0cde7fe3]{
|
|
1775
1775
|
width: calc(var(--input-height) / 2.5);
|
|
1776
1776
|
height: calc(var(--input-height) / 2.5);
|
|
1777
1777
|
position: absolute;
|
|
@@ -1782,7 +1782,7 @@ input:checked ~ label[data-v-4594626f]::before{
|
|
|
1782
1782
|
opacity: 0;
|
|
1783
1783
|
pointer-events: none;
|
|
1784
1784
|
}
|
|
1785
|
-
input:checked ~ svg[data-v-
|
|
1785
|
+
input:checked ~ svg[data-v-0cde7fe3]{
|
|
1786
1786
|
opacity: 1;
|
|
1787
1787
|
}
|
|
1788
1788
|
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<component
|
|
3
3
|
:required="field.required"
|
|
4
4
|
v-bind="bindAttrs(field?.attrs||{}, props.modelValue[field.id || ''], props.modelValue,)"
|
|
5
|
+
v-if="vIf"
|
|
5
6
|
:is="field.$el || 'div'"
|
|
6
7
|
:label="field.label"
|
|
7
8
|
:id="field.id"
|
|
@@ -26,5 +27,13 @@ const props = defineProps<{
|
|
|
26
27
|
field: Field
|
|
27
28
|
}>();
|
|
28
29
|
|
|
30
|
+
const vIf = $computed(() => {
|
|
31
|
+
if (props.field['v-if'] === undefined) return true;
|
|
32
|
+
if (typeof props.field['v-if'] === 'boolean') return props.field['v-if'];
|
|
33
|
+
if (typeof props.field['v-if'] === 'string') return !!props.modelValue[props.field['v-if']];
|
|
34
|
+
if (typeof props.field['v-if'] === 'function') return props.field['v-if']!(props.modelValue[props.field.id || ''], props.modelValue);
|
|
35
|
+
return true;
|
|
36
|
+
});
|
|
37
|
+
|
|
29
38
|
const emits = defineEmits(['update:modelValue']);
|
|
30
39
|
</script>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form @submit.prevent="runSubmit">
|
|
2
|
+
<form ref="form" @submit.prevent="runSubmit">
|
|
3
3
|
<BglField
|
|
4
4
|
v-for="(field, i) in schema" :key="field.id || `${i }p`" :field="field" :modelValue="data"
|
|
5
5
|
@update:modelValue="($event)=>updateModelValue($event, field?.id || '')"
|
|
6
6
|
/>
|
|
7
7
|
<Btn
|
|
8
|
-
class="del-top" v-if="
|
|
8
|
+
class="del-top" v-if="data?.id && onDelete" @click="runDelete" value="Delete" flat icon="delete"
|
|
9
9
|
color="red" thin
|
|
10
10
|
/>
|
|
11
11
|
<Btn v-if="!$slots.submit && onSubmit" value="Submit" type="submit" thin />
|
|
@@ -18,37 +18,37 @@
|
|
|
18
18
|
<script lang="ts" setup>
|
|
19
19
|
import { Btn, useModal, BglField } from '@bagelink/vue';
|
|
20
20
|
import { type BglFormSchemaT } from '@bagelink/vue';
|
|
21
|
-
import { watch } from 'vue';
|
|
22
21
|
|
|
23
22
|
const { showModal } = useModal();
|
|
24
23
|
|
|
24
|
+
const data = defineModel<Record<string, any>>('modelValue', { default: {} });
|
|
25
|
+
|
|
25
26
|
const props = defineProps<{
|
|
26
|
-
modelValue?: any;
|
|
27
27
|
schema: BglFormSchemaT;
|
|
28
28
|
onDelete?: ((id: string) => void);
|
|
29
29
|
onSubmit?: ((data: any) => void);
|
|
30
30
|
}>();
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const form = $ref<HTMLFormElement>();
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
data = val;
|
|
36
|
-
}, { immediate: true, deep: true });
|
|
34
|
+
const validateForm = () => form?.reportValidity?.();
|
|
37
35
|
|
|
38
36
|
const updateModelValue = (val: any, fieldID: string) => {
|
|
39
|
-
if (!fieldID) return;
|
|
40
|
-
data[fieldID] = val;
|
|
41
|
-
emits('update:modelValue', data);
|
|
37
|
+
if (!fieldID || !data.value) return;
|
|
38
|
+
data.value[fieldID] = val;
|
|
42
39
|
};
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
defineExpose({ validateForm });
|
|
42
|
+
|
|
43
|
+
const clearForm = () => Object.assign(data, {});
|
|
44
|
+
const emits = defineEmits(['submit']);
|
|
45
|
+
|
|
45
46
|
const runSubmit = () => {
|
|
47
|
+
validateForm();
|
|
46
48
|
emits('submit', data);
|
|
47
49
|
clearForm();
|
|
48
50
|
};
|
|
49
51
|
|
|
50
|
-
const clearForm = () => data = {};
|
|
51
|
-
|
|
52
52
|
const i18nT = (val: string) => val;
|
|
53
53
|
|
|
54
54
|
const runDelete = () => {
|
|
@@ -60,7 +60,7 @@ const runDelete = () => {
|
|
|
60
60
|
{
|
|
61
61
|
value: 'Confirm',
|
|
62
62
|
color: 'red',
|
|
63
|
-
onClick: () => props.onDelete?.(data.id),
|
|
63
|
+
onClick: () => props.onDelete?.(data.value.id),
|
|
64
64
|
},
|
|
65
65
|
{ value: 'Cancel', color: 'gray' },
|
|
66
66
|
],
|
|
@@ -23,15 +23,11 @@
|
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup lang="ts">
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const emits = defineEmits(['update:modelValue']);
|
|
29
|
-
const props = withDefaults(
|
|
26
|
+
withDefaults(
|
|
30
27
|
defineProps<{
|
|
31
28
|
label: string;
|
|
32
29
|
id?: string;
|
|
33
30
|
title?: string;
|
|
34
|
-
modelValue: boolean;
|
|
35
31
|
editMode?: boolean;
|
|
36
32
|
small?: boolean;
|
|
37
33
|
}>(),
|
|
@@ -41,19 +37,7 @@ const props = withDefaults(
|
|
|
41
37
|
},
|
|
42
38
|
);
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
watch(inputVal, (newVal) => {
|
|
46
|
-
if (newVal === undefined) return;
|
|
47
|
-
emits('update:modelValue', newVal);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
watch(
|
|
51
|
-
() => props.modelValue,
|
|
52
|
-
(newVal) => {
|
|
53
|
-
if (inputVal !== newVal) inputVal = newVal;
|
|
54
|
-
},
|
|
55
|
-
{ immediate: true },
|
|
56
|
-
);
|
|
40
|
+
const inputVal = defineModel<boolean>('modelValue', { default: false });
|
|
57
41
|
</script>
|
|
58
42
|
<style>
|
|
59
43
|
:root {
|
|
@@ -20,15 +20,11 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script setup lang="ts">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const emits = defineEmits(['update:modelValue']);
|
|
26
|
-
const props = withDefaults(
|
|
23
|
+
withDefaults(
|
|
27
24
|
defineProps<{
|
|
28
25
|
label: string;
|
|
29
26
|
id?: string;
|
|
30
27
|
title?: string;
|
|
31
|
-
modelValue: boolean;
|
|
32
28
|
editMode?: boolean;
|
|
33
29
|
small?: boolean;
|
|
34
30
|
}>(),
|
|
@@ -38,18 +34,7 @@ const props = withDefaults(
|
|
|
38
34
|
},
|
|
39
35
|
);
|
|
40
36
|
|
|
41
|
-
const inputVal =
|
|
42
|
-
watch(inputVal, (newVal) => {
|
|
43
|
-
if (newVal === undefined) return;
|
|
44
|
-
emits('update:modelValue', newVal);
|
|
45
|
-
});
|
|
46
|
-
watch(
|
|
47
|
-
() => props.modelValue,
|
|
48
|
-
(newVal) => {
|
|
49
|
-
if (inputVal.value !== newVal) inputVal.value = newVal;
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
onMounted(() => (inputVal.value = !!props.modelValue));
|
|
37
|
+
const inputVal = defineModel<boolean>('modelValue', { default: false });
|
|
53
38
|
</script>
|
|
54
39
|
|
|
55
40
|
<style scoped>
|