@bagelink/vue 1.0.50 → 1.0.54
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/Modal.vue.d.ts.map +1 -1
- package/dist/components/Spreadsheet/Index.vue.d.ts +2 -0
- package/dist/components/Spreadsheet/Index.vue.d.ts.map +1 -1
- package/dist/components/form/BagelForm.vue.d.ts +3 -1
- package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/NumberInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PasswordInput.vue.d.ts +1 -0
- package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PhoneInput.vue.d.ts +2 -0
- package/dist/components/form/inputs/PhoneInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +4 -0
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts +1 -0
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/composables/useSchemaField.d.ts.map +1 -1
- package/dist/index.cjs +74 -22
- package/dist/index.mjs +74 -22
- package/dist/style.css +765 -484
- package/dist/utils/BagelFormUtils.d.ts +2 -0
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Modal.vue +1 -0
- package/src/components/form/BagelForm.vue +23 -7
- package/src/components/form/FieldArray.vue +2 -2
- package/src/components/form/inputs/NumberInput.vue +1 -1
- package/src/components/form/inputs/PasswordInput.vue +2 -0
- package/src/components/form/inputs/TextInput.vue +4 -1
- package/src/composables/useSchemaField.ts +34 -1
- package/src/styles/text.css +911 -560
- package/src/utils/BagelFormUtils.ts +9 -1
- package/src/components/DataTable/tableTypes.d.ts +0 -0
package/dist/index.mjs
CHANGED
|
@@ -10530,6 +10530,24 @@ const SLOT_VALUE_COMPONENTS$1 = /* @__PURE__ */ new Set(["div", "span", "p"]);
|
|
|
10530
10530
|
const SRC_VALUE_COMPONENTS$1 = /* @__PURE__ */ new Set(["img", "iframe"]);
|
|
10531
10531
|
function useSchemaField(optns) {
|
|
10532
10532
|
const { mode = "form", getRowData, onUpdate, includeUnset = false } = optns;
|
|
10533
|
+
function renderObject(obj, depth = 0) {
|
|
10534
|
+
if (obj === null || obj === void 0) return "";
|
|
10535
|
+
if (typeof obj !== "object") return String(obj);
|
|
10536
|
+
if (Array.isArray(obj)) return obj.map((item) => renderObject(item, depth + 1)).join(", ");
|
|
10537
|
+
const indent = depth > 0 ? " ".repeat(depth) : "";
|
|
10538
|
+
const nextIndent = " ".repeat(depth + 1);
|
|
10539
|
+
const entries = Object.entries(obj);
|
|
10540
|
+
if (entries.length === 0) return "{}";
|
|
10541
|
+
if (depth > 0) {
|
|
10542
|
+
return `{
|
|
10543
|
+
${entries.map(([key, value]) => `${nextIndent}${key}: ${renderObject(value, depth + 1)}`).join(",\n")}
|
|
10544
|
+
${indent}}`;
|
|
10545
|
+
}
|
|
10546
|
+
return entries.map(([key, value]) => {
|
|
10547
|
+
const valueStr = typeof value === "object" && value !== null ? renderObject(value, depth + 1) : String(value);
|
|
10548
|
+
return `${key}: ${valueStr}`;
|
|
10549
|
+
}).join("\n");
|
|
10550
|
+
}
|
|
10533
10551
|
function getComponent(field) {
|
|
10534
10552
|
var _a;
|
|
10535
10553
|
const componentMap = {
|
|
@@ -10669,7 +10687,7 @@ function useSchemaField(optns) {
|
|
|
10669
10687
|
return h$2("div", { class: "preview-field" }, [
|
|
10670
10688
|
h$2("div", { class: "field-label" }, `${field.label || keyToLabel(field.id || "")}:`),
|
|
10671
10689
|
h$2("div", { class: "field-value" }, [
|
|
10672
|
-
slotContent || (typeof field.$el === "object" ? h$2(Component, props2, componentSlots) : (transformedValue == null ? void 0 : transformedValue.toString()) || "")
|
|
10690
|
+
slotContent || (typeof field.$el === "object" ? h$2(Component, props2, componentSlots) : typeof transformedValue === "object" && transformedValue !== null ? h$2("pre", { style: "margin: 0; white-space: pre-wrap; font-family: inherit; font-size: inherit;" }, renderObject(transformedValue)) : (transformedValue == null ? void 0 : transformedValue.toString()) || "")
|
|
10673
10691
|
])
|
|
10674
10692
|
]);
|
|
10675
10693
|
}
|
|
@@ -14985,7 +15003,9 @@ function richText(id, label, options) {
|
|
|
14985
15003
|
label,
|
|
14986
15004
|
vIf: options == null ? void 0 : options.vIf,
|
|
14987
15005
|
placeholder: options == null ? void 0 : options.placeholder,
|
|
14988
|
-
attrs: {
|
|
15006
|
+
attrs: {
|
|
15007
|
+
autocomplete: options == null ? void 0 : options.autocomplete
|
|
15008
|
+
}
|
|
14989
15009
|
};
|
|
14990
15010
|
}
|
|
14991
15011
|
function txtField(id, label, options) {
|
|
@@ -15002,7 +15022,8 @@ function txtField(id, label, options) {
|
|
|
15002
15022
|
attrs: {
|
|
15003
15023
|
type: options == null ? void 0 : options.type,
|
|
15004
15024
|
pattern: options == null ? void 0 : options.pattern,
|
|
15005
|
-
multiline: options == null ? void 0 : options.multiline
|
|
15025
|
+
multiline: options == null ? void 0 : options.multiline,
|
|
15026
|
+
autocomplete: options == null ? void 0 : options.autocomplete
|
|
15006
15027
|
}
|
|
15007
15028
|
};
|
|
15008
15029
|
}
|
|
@@ -15022,7 +15043,8 @@ function selectField(id, label, options, config) {
|
|
|
15022
15043
|
searchable: config == null ? void 0 : config.searchable,
|
|
15023
15044
|
multiselect: config == null ? void 0 : config.multiselect,
|
|
15024
15045
|
onSearch: config == null ? void 0 : config.onSearch,
|
|
15025
|
-
clearable: config == null ? void 0 : config.clearable
|
|
15046
|
+
clearable: config == null ? void 0 : config.clearable,
|
|
15047
|
+
autocomplete: config == null ? void 0 : config.autocomplete
|
|
15026
15048
|
}
|
|
15027
15049
|
};
|
|
15028
15050
|
}
|
|
@@ -15047,7 +15069,8 @@ function dateField(id, label, options) {
|
|
|
15047
15069
|
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
15048
15070
|
vIf: options == null ? void 0 : options.vIf,
|
|
15049
15071
|
attrs: {
|
|
15050
|
-
disabled: options == null ? void 0 : options.disabled
|
|
15072
|
+
disabled: options == null ? void 0 : options.disabled,
|
|
15073
|
+
autocomplete: options == null ? void 0 : options.autocomplete
|
|
15051
15074
|
}
|
|
15052
15075
|
};
|
|
15053
15076
|
}
|
|
@@ -15064,6 +15087,7 @@ function numField$1(id, label, options) {
|
|
|
15064
15087
|
helptext: options == null ? void 0 : options.helptext,
|
|
15065
15088
|
vIf: options == null ? void 0 : options.vIf,
|
|
15066
15089
|
attrs: {
|
|
15090
|
+
autocomplete: options == null ? void 0 : options.autocomplete,
|
|
15067
15091
|
step: options == null ? void 0 : options.step,
|
|
15068
15092
|
min: options == null ? void 0 : options.min,
|
|
15069
15093
|
max: options == null ? void 0 : options.max,
|
|
@@ -15099,6 +15123,7 @@ function rangeField(id, label, options) {
|
|
|
15099
15123
|
label,
|
|
15100
15124
|
vIf: options == null ? void 0 : options.vIf,
|
|
15101
15125
|
attrs: {
|
|
15126
|
+
autocomplete: options == null ? void 0 : options.autocomplete,
|
|
15102
15127
|
min: options == null ? void 0 : options.min,
|
|
15103
15128
|
max: options == null ? void 0 : options.max,
|
|
15104
15129
|
step: options == null ? void 0 : options.step,
|
|
@@ -15463,9 +15488,16 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
15463
15488
|
formData.value = newData;
|
|
15464
15489
|
emit2("update:modelValue", formData.value);
|
|
15465
15490
|
}
|
|
15491
|
+
const validateForm = () => {
|
|
15492
|
+
var _a;
|
|
15493
|
+
return ((_a = form.value) == null ? void 0 : _a.reportValidity()) ?? false;
|
|
15494
|
+
};
|
|
15495
|
+
let formError = ref();
|
|
15466
15496
|
async function handleSubmit() {
|
|
15467
15497
|
var _a;
|
|
15468
15498
|
try {
|
|
15499
|
+
const valid = validateForm();
|
|
15500
|
+
if (!valid) return;
|
|
15469
15501
|
if (formState.value === "submitting") return;
|
|
15470
15502
|
formState.value = "submitting";
|
|
15471
15503
|
await ((_a = props2.onSubmit) == null ? void 0 : _a.call(props2, formData.value));
|
|
@@ -15473,14 +15505,11 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
15473
15505
|
formState.value = "success";
|
|
15474
15506
|
window.parent.postMessage({ type: "BAGEL_FORM_SUCCESS", data: JSON.stringify(formData.value) }, "*");
|
|
15475
15507
|
} catch (error) {
|
|
15476
|
-
console.error("Submit error:", error);
|
|
15477
15508
|
formState.value = "error";
|
|
15509
|
+
formError.value = error;
|
|
15510
|
+
console.error("Submit error:", formError.value);
|
|
15478
15511
|
}
|
|
15479
15512
|
}
|
|
15480
|
-
const validateForm = () => {
|
|
15481
|
-
var _a;
|
|
15482
|
-
return ((_a = form.value) == null ? void 0 : _a.reportValidity()) ?? false;
|
|
15483
|
-
};
|
|
15484
15513
|
const { renderField } = useSchemaField({
|
|
15485
15514
|
mode: "form",
|
|
15486
15515
|
getRowData: () => ({
|
|
@@ -15496,6 +15525,13 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
15496
15525
|
}
|
|
15497
15526
|
});
|
|
15498
15527
|
const renderSchemaField = (field) => renderField(field);
|
|
15528
|
+
function handleSlotInputChange(event) {
|
|
15529
|
+
const input = event.target;
|
|
15530
|
+
if (input.name) {
|
|
15531
|
+
const value = input.type === "checkbox" ? input.checked : input.value;
|
|
15532
|
+
updateFormData(input.name, value);
|
|
15533
|
+
}
|
|
15534
|
+
}
|
|
15499
15535
|
__expose({ form, isDirty, validateForm, resolveSchema, refreshSchema });
|
|
15500
15536
|
return (_ctx, _cache) => {
|
|
15501
15537
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
@@ -15505,7 +15541,8 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
15505
15541
|
ref_key: "form",
|
|
15506
15542
|
ref: form,
|
|
15507
15543
|
class: normalizeClass(props2.class),
|
|
15508
|
-
onSubmit: withModifiers(handleSubmit, ["prevent"])
|
|
15544
|
+
onSubmit: withModifiers(handleSubmit, ["prevent"]),
|
|
15545
|
+
onInput: handleSlotInputChange
|
|
15509
15546
|
}, [
|
|
15510
15547
|
schemaState.value === "loading" ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
15511
15548
|
createElementVNode("div", _hoisted_1$M, [
|
|
@@ -15539,7 +15576,10 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
15539
15576
|
], 64))
|
|
15540
15577
|
], 64)) : createCommentVNode("", true),
|
|
15541
15578
|
formState.value === "success" ? renderSlot(_ctx.$slots, "success", { key: 1 }) : createCommentVNode("", true),
|
|
15542
|
-
formState.value === "error" ? renderSlot(_ctx.$slots, "error", {
|
|
15579
|
+
formState.value === "error" ? renderSlot(_ctx.$slots, "error", {
|
|
15580
|
+
key: 2,
|
|
15581
|
+
error: unref(formError)
|
|
15582
|
+
}) : createCommentVNode("", true)
|
|
15543
15583
|
], 64);
|
|
15544
15584
|
};
|
|
15545
15585
|
}
|
|
@@ -15665,7 +15705,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
15665
15705
|
() => isPrimitiveType.value || props2.type === "object" && resolvedSchemaData.value.length > 0
|
|
15666
15706
|
);
|
|
15667
15707
|
const showMinimizeButton = computed(() => {
|
|
15668
|
-
return resolvedSchemaData.value.length >
|
|
15708
|
+
return resolvedSchemaData.value.length > 2 || resolvedSchemaData.value.some((schema) => schema.$el === "richtext");
|
|
15669
15709
|
});
|
|
15670
15710
|
return (_ctx, _cache) => {
|
|
15671
15711
|
const _component_Icon = resolveComponent("Icon");
|
|
@@ -15721,7 +15761,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
15721
15761
|
thin: "",
|
|
15722
15762
|
icon: "add",
|
|
15723
15763
|
color: "gray",
|
|
15724
|
-
class: "txt12",
|
|
15764
|
+
class: "txt12 arrayAddButton",
|
|
15725
15765
|
onClick: addItem
|
|
15726
15766
|
}, {
|
|
15727
15767
|
default: withCtx(() => [
|
|
@@ -17497,7 +17537,10 @@ const _hoisted_2$p = {
|
|
|
17497
17537
|
class: "block"
|
|
17498
17538
|
};
|
|
17499
17539
|
const _hoisted_3$k = ["id", "placeholder", "disabled", "required", "readonly", "pattern", "onKeydown"];
|
|
17500
|
-
const _hoisted_4$d = {
|
|
17540
|
+
const _hoisted_4$d = {
|
|
17541
|
+
key: 1,
|
|
17542
|
+
class: "opacity-7 light"
|
|
17543
|
+
};
|
|
17501
17544
|
const _hoisted_5$d = {
|
|
17502
17545
|
key: 5,
|
|
17503
17546
|
class: "flex column spinner"
|
|
@@ -17700,7 +17743,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
17700
17743
|
};
|
|
17701
17744
|
}
|
|
17702
17745
|
});
|
|
17703
|
-
const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-
|
|
17746
|
+
const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-01b5487f"]]);
|
|
17704
17747
|
const _hoisted_1$A = ["value", "autofocus", "onKeydown", "onPaste"];
|
|
17705
17748
|
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
17706
17749
|
__name: "OTP",
|
|
@@ -17822,6 +17865,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
17822
17865
|
pattern: {},
|
|
17823
17866
|
shrink: { type: Boolean },
|
|
17824
17867
|
disabled: { type: Boolean },
|
|
17868
|
+
name: {},
|
|
17825
17869
|
nativeInputAttrs: {},
|
|
17826
17870
|
icon: {},
|
|
17827
17871
|
iconStart: {},
|
|
@@ -17853,8 +17897,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
17853
17897
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => password.value = $event)
|
|
17854
17898
|
}, props2, {
|
|
17855
17899
|
type: inputType.value,
|
|
17856
|
-
class: "mb-0"
|
|
17857
|
-
|
|
17900
|
+
class: "mb-0",
|
|
17901
|
+
name: props2.name
|
|
17902
|
+
}), null, 16, ["modelValue", "type", "name"]),
|
|
17858
17903
|
createElementVNode("div", _hoisted_2$o, [
|
|
17859
17904
|
createVNode(unref(Btn), {
|
|
17860
17905
|
flat: "",
|
|
@@ -28356,15 +28401,19 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
28356
28401
|
const TableField = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-e9632f79"]]);
|
|
28357
28402
|
const _hoisted_1$o = ["title"];
|
|
28358
28403
|
const _hoisted_2$e = ["for"];
|
|
28359
|
-
const _hoisted_3$b = ["id", "title", "autocomplete", "type", "placeholder", "disabled", "required", "pattern"];
|
|
28360
|
-
const _hoisted_4$6 = ["id", "title", "type", "rows", "placeholder", "disabled", "required", "pattern"];
|
|
28361
|
-
const _hoisted_5$6 = {
|
|
28404
|
+
const _hoisted_3$b = ["id", "name", "title", "autocomplete", "type", "placeholder", "disabled", "required", "pattern"];
|
|
28405
|
+
const _hoisted_4$6 = ["id", "name", "title", "type", "rows", "placeholder", "disabled", "required", "pattern"];
|
|
28406
|
+
const _hoisted_5$6 = {
|
|
28407
|
+
key: 2,
|
|
28408
|
+
class: "opacity-7 light"
|
|
28409
|
+
};
|
|
28362
28410
|
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
28363
28411
|
__name: "TextInput",
|
|
28364
28412
|
props: {
|
|
28365
28413
|
id: {},
|
|
28366
28414
|
title: {},
|
|
28367
28415
|
helptext: {},
|
|
28416
|
+
name: {},
|
|
28368
28417
|
placeholder: {},
|
|
28369
28418
|
modelValue: { default: "" },
|
|
28370
28419
|
label: {},
|
|
@@ -28448,6 +28497,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
28448
28497
|
ref_key: "input",
|
|
28449
28498
|
ref: input,
|
|
28450
28499
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(inputVal) ? inputVal.value = $event : inputVal = $event),
|
|
28500
|
+
name: _ctx.name,
|
|
28451
28501
|
title: _ctx.title,
|
|
28452
28502
|
autocomplete: _ctx.autocomplete,
|
|
28453
28503
|
type: _ctx.type,
|
|
@@ -28475,6 +28525,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
28475
28525
|
ref_key: "input",
|
|
28476
28526
|
ref: input,
|
|
28477
28527
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(inputVal) ? inputVal.value = $event : inputVal = $event),
|
|
28528
|
+
name: _ctx.name,
|
|
28478
28529
|
title: _ctx.title,
|
|
28479
28530
|
type: _ctx.type,
|
|
28480
28531
|
rows: inputRows.value,
|
|
@@ -28504,7 +28555,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
28504
28555
|
};
|
|
28505
28556
|
}
|
|
28506
28557
|
});
|
|
28507
|
-
const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-
|
|
28558
|
+
const TextInput = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-dbcf2010"]]);
|
|
28508
28559
|
const _hoisted_1$n = ["title"];
|
|
28509
28560
|
const _hoisted_2$d = ["id", "required"];
|
|
28510
28561
|
const _hoisted_3$a = ["for"];
|
|
@@ -34364,6 +34415,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
34364
34415
|
class: "position-start",
|
|
34365
34416
|
icon: "close",
|
|
34366
34417
|
thin: "",
|
|
34418
|
+
round: "",
|
|
34367
34419
|
color: "white",
|
|
34368
34420
|
onClick: closeModal
|
|
34369
34421
|
})
|