@bagelink/vue 0.0.1260 → 0.0.1262
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/DataTable/DataTable.vue.d.ts.map +1 -1
- package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
- package/dist/components/form/useBagelFormState.d.ts.map +1 -1
- package/dist/index.cjs +406 -437
- package/dist/index.mjs +407 -438
- package/dist/style.css +47 -47
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/DataTable/DataTable.vue +7 -1
- package/src/components/form/BagelForm.vue +2 -13
- package/src/components/form/useBagelFormState.ts +2 -14
- package/src/utils/index.ts +15 -0
package/dist/index.cjs
CHANGED
|
@@ -5,51 +5,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
6
|
const vue = require("vue");
|
|
7
7
|
const vueRouter = require("vue-router");
|
|
8
|
-
const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
|
-
__proto__: null,
|
|
10
|
-
get arrField() {
|
|
11
|
-
return arrField;
|
|
12
|
-
},
|
|
13
|
-
get bglForm() {
|
|
14
|
-
return bglForm;
|
|
15
|
-
},
|
|
16
|
-
get checkField() {
|
|
17
|
-
return checkField;
|
|
18
|
-
},
|
|
19
|
-
get dateField() {
|
|
20
|
-
return dateField;
|
|
21
|
-
},
|
|
22
|
-
get findBglFieldById() {
|
|
23
|
-
return findBglFieldById;
|
|
24
|
-
},
|
|
25
|
-
get frmRow() {
|
|
26
|
-
return frmRow;
|
|
27
|
-
},
|
|
28
|
-
get getBaseField() {
|
|
29
|
-
return getBaseField;
|
|
30
|
-
},
|
|
31
|
-
get numField() {
|
|
32
|
-
return numField;
|
|
33
|
-
},
|
|
34
|
-
get richText() {
|
|
35
|
-
return richText;
|
|
36
|
-
},
|
|
37
|
-
get selectField() {
|
|
38
|
-
return selectField;
|
|
39
|
-
},
|
|
40
|
-
get slctField() {
|
|
41
|
-
return slctField;
|
|
42
|
-
},
|
|
43
|
-
get telField() {
|
|
44
|
-
return telField;
|
|
45
|
-
},
|
|
46
|
-
get txtField() {
|
|
47
|
-
return txtField;
|
|
48
|
-
},
|
|
49
|
-
get uploadField() {
|
|
50
|
-
return uploadField;
|
|
51
|
-
}
|
|
52
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
53
8
|
const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
|
|
54
9
|
__name: "Accordion",
|
|
55
10
|
setup(__props) {
|
|
@@ -10772,7 +10727,7 @@ function useTableData(options) {
|
|
|
10772
10727
|
return currentData.map(transform).sort((a2, z2) => {
|
|
10773
10728
|
const aValue = a2[computedSortField.value] ?? "";
|
|
10774
10729
|
const bValue = z2[computedSortField.value] ?? "";
|
|
10775
|
-
if (isDate(aValue) && isDate(bValue)) {
|
|
10730
|
+
if (isDate$2(aValue) && isDate$2(bValue)) {
|
|
10776
10731
|
return sortDirection.value === "ASC" ? new Date(aValue).getTime() - new Date(bValue).getTime() : new Date(bValue).getTime() - new Date(aValue).getTime();
|
|
10777
10732
|
}
|
|
10778
10733
|
const numAValue = Number.parseInt(`${aValue}`.replaceAll(NON_DIGIT_REGEX, ""), 10);
|
|
@@ -11515,7 +11470,7 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
|
11515
11470
|
emits: /* @__PURE__ */ vue.mergeModels(["update:selectedItems", "orderBy", "select", "lastItemVisible"], ["update:loading", "update:itemHeight", "update:selectedItems"]),
|
|
11516
11471
|
setup(__props, { emit: __emit }) {
|
|
11517
11472
|
vue.useCssVars((_ctx) => ({
|
|
11518
|
-
"
|
|
11473
|
+
"1ab0cc24": vue.unref(computedItemHeight)
|
|
11519
11474
|
}));
|
|
11520
11475
|
const props2 = __props;
|
|
11521
11476
|
const emit2 = __emit;
|
|
@@ -11578,7 +11533,12 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
|
11578
11533
|
function renderFieldForRow(field, row) {
|
|
11579
11534
|
const { renderField } = useSchemaField({
|
|
11580
11535
|
mode: "table",
|
|
11581
|
-
getRowData: () =>
|
|
11536
|
+
getRowData: () => {
|
|
11537
|
+
if (field.id) {
|
|
11538
|
+
return { [field.id]: getNestedValue(row, field.id) };
|
|
11539
|
+
}
|
|
11540
|
+
return row;
|
|
11541
|
+
}
|
|
11582
11542
|
});
|
|
11583
11543
|
return renderField({ ...field, label: "" }, slots);
|
|
11584
11544
|
}
|
|
@@ -11694,7 +11654,7 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
|
|
|
11694
11654
|
};
|
|
11695
11655
|
}
|
|
11696
11656
|
});
|
|
11697
|
-
const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-
|
|
11657
|
+
const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__scopeId", "data-v-8e14fc71"]]);
|
|
11698
11658
|
function useDraggable(options = {}) {
|
|
11699
11659
|
const isDragging = vue.ref(false);
|
|
11700
11660
|
const dragElement = vue.ref(null);
|
|
@@ -14916,6 +14876,385 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
|
|
|
14916
14876
|
}
|
|
14917
14877
|
});
|
|
14918
14878
|
const Flag = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-f99f1900"]]);
|
|
14879
|
+
function getBaseField(id, labelOrRest = {}, rest = {}) {
|
|
14880
|
+
if (typeof labelOrRest === "object") return { id, ...labelOrRest };
|
|
14881
|
+
return { id, label: labelOrRest, ...rest };
|
|
14882
|
+
}
|
|
14883
|
+
function richText(id, label, options) {
|
|
14884
|
+
return {
|
|
14885
|
+
$el: "richtext",
|
|
14886
|
+
class: options == null ? void 0 : options.class,
|
|
14887
|
+
required: options == null ? void 0 : options.required,
|
|
14888
|
+
id,
|
|
14889
|
+
label,
|
|
14890
|
+
vIf: options == null ? void 0 : options.vIf,
|
|
14891
|
+
placeholder: options == null ? void 0 : options.placeholder,
|
|
14892
|
+
attrs: {}
|
|
14893
|
+
};
|
|
14894
|
+
}
|
|
14895
|
+
function txtField(id, label, options) {
|
|
14896
|
+
return {
|
|
14897
|
+
$el: "text",
|
|
14898
|
+
class: options == null ? void 0 : options.class,
|
|
14899
|
+
required: options == null ? void 0 : options.required,
|
|
14900
|
+
id,
|
|
14901
|
+
label,
|
|
14902
|
+
vIf: options == null ? void 0 : options.vIf,
|
|
14903
|
+
disabled: options == null ? void 0 : options.disabled,
|
|
14904
|
+
placeholder: options == null ? void 0 : options.placeholder,
|
|
14905
|
+
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
14906
|
+
attrs: {
|
|
14907
|
+
type: options == null ? void 0 : options.type,
|
|
14908
|
+
pattern: options == null ? void 0 : options.pattern,
|
|
14909
|
+
multiline: options == null ? void 0 : options.multiline
|
|
14910
|
+
}
|
|
14911
|
+
};
|
|
14912
|
+
}
|
|
14913
|
+
function selectField(id, label, options, config) {
|
|
14914
|
+
return {
|
|
14915
|
+
$el: "select",
|
|
14916
|
+
id,
|
|
14917
|
+
options,
|
|
14918
|
+
class: config == null ? void 0 : config.class,
|
|
14919
|
+
placeholder: config == null ? void 0 : config.placeholder,
|
|
14920
|
+
required: config == null ? void 0 : config.required,
|
|
14921
|
+
label,
|
|
14922
|
+
defaultValue: config == null ? void 0 : config.defaultValue,
|
|
14923
|
+
vIf: config == null ? void 0 : config.vIf,
|
|
14924
|
+
attrs: {
|
|
14925
|
+
disabled: config == null ? void 0 : config.disabled,
|
|
14926
|
+
searchable: config == null ? void 0 : config.searchable,
|
|
14927
|
+
multiselect: config == null ? void 0 : config.multiselect,
|
|
14928
|
+
onSearch: config == null ? void 0 : config.onSearch,
|
|
14929
|
+
clearable: config == null ? void 0 : config.clearable
|
|
14930
|
+
}
|
|
14931
|
+
};
|
|
14932
|
+
}
|
|
14933
|
+
const slctField = selectField;
|
|
14934
|
+
function checkField(id, label, options) {
|
|
14935
|
+
return {
|
|
14936
|
+
$el: "check",
|
|
14937
|
+
class: options == null ? void 0 : options.class,
|
|
14938
|
+
required: options == null ? void 0 : options.required,
|
|
14939
|
+
id,
|
|
14940
|
+
label
|
|
14941
|
+
};
|
|
14942
|
+
}
|
|
14943
|
+
function dateField(id, label, options) {
|
|
14944
|
+
return {
|
|
14945
|
+
$el: "date",
|
|
14946
|
+
class: options == null ? void 0 : options.class,
|
|
14947
|
+
required: options == null ? void 0 : options.required,
|
|
14948
|
+
id,
|
|
14949
|
+
disabled: options == null ? void 0 : options.disabled,
|
|
14950
|
+
label,
|
|
14951
|
+
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
14952
|
+
vIf: options == null ? void 0 : options.vIf,
|
|
14953
|
+
attrs: {
|
|
14954
|
+
disabled: options == null ? void 0 : options.disabled
|
|
14955
|
+
}
|
|
14956
|
+
};
|
|
14957
|
+
}
|
|
14958
|
+
function numField$1(id, label, options) {
|
|
14959
|
+
return {
|
|
14960
|
+
$el: "number",
|
|
14961
|
+
class: options == null ? void 0 : options.class,
|
|
14962
|
+
required: options == null ? void 0 : options.required,
|
|
14963
|
+
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
14964
|
+
id,
|
|
14965
|
+
label,
|
|
14966
|
+
disabled: options == null ? void 0 : options.disabled,
|
|
14967
|
+
placeholder: options == null ? void 0 : options.placeholder,
|
|
14968
|
+
helptext: options == null ? void 0 : options.helptext,
|
|
14969
|
+
vIf: options == null ? void 0 : options.vIf,
|
|
14970
|
+
attrs: {
|
|
14971
|
+
step: options == null ? void 0 : options.step,
|
|
14972
|
+
min: options == null ? void 0 : options.min,
|
|
14973
|
+
max: options == null ? void 0 : options.max,
|
|
14974
|
+
layout: options == null ? void 0 : options.layout,
|
|
14975
|
+
padZero: options == null ? void 0 : options.padZero,
|
|
14976
|
+
center: options == null ? void 0 : options.center
|
|
14977
|
+
}
|
|
14978
|
+
};
|
|
14979
|
+
}
|
|
14980
|
+
function frmRow$1(...children2) {
|
|
14981
|
+
return {
|
|
14982
|
+
$el: "div",
|
|
14983
|
+
class: "flex gap-1 m_block align-items-end",
|
|
14984
|
+
children: children2
|
|
14985
|
+
};
|
|
14986
|
+
}
|
|
14987
|
+
function uploadField(id, label, options) {
|
|
14988
|
+
return {
|
|
14989
|
+
$el: "upload",
|
|
14990
|
+
id,
|
|
14991
|
+
label,
|
|
14992
|
+
vIf: options == null ? void 0 : options.vIf,
|
|
14993
|
+
attrs: {
|
|
14994
|
+
...options
|
|
14995
|
+
}
|
|
14996
|
+
};
|
|
14997
|
+
}
|
|
14998
|
+
function bglForm(idOrField, ...schema) {
|
|
14999
|
+
if (typeof idOrField === "string") {
|
|
15000
|
+
return {
|
|
15001
|
+
$el: "bagelform",
|
|
15002
|
+
id: idOrField,
|
|
15003
|
+
attrs: {
|
|
15004
|
+
schema: [idOrField, ...schema]
|
|
15005
|
+
}
|
|
15006
|
+
};
|
|
15007
|
+
}
|
|
15008
|
+
return {
|
|
15009
|
+
$el: "bagelform",
|
|
15010
|
+
attrs: {
|
|
15011
|
+
schema: [idOrField, ...schema]
|
|
15012
|
+
}
|
|
15013
|
+
};
|
|
15014
|
+
}
|
|
15015
|
+
function telField(id, label, options) {
|
|
15016
|
+
return {
|
|
15017
|
+
$el: vue.markRaw(TelInput),
|
|
15018
|
+
id,
|
|
15019
|
+
label,
|
|
15020
|
+
vIf: options == null ? void 0 : options.vIf,
|
|
15021
|
+
attrs: options
|
|
15022
|
+
};
|
|
15023
|
+
}
|
|
15024
|
+
function findBglFieldById(id, _schema) {
|
|
15025
|
+
for (const field of _schema) {
|
|
15026
|
+
if (field.id === id) return field;
|
|
15027
|
+
if (field.children && Number(field.children.length) > 0) {
|
|
15028
|
+
const fieldChildren = field.children.filter((c2) => typeof c2 === "object" && "$el" in c2);
|
|
15029
|
+
const child = findBglFieldById(id, fieldChildren);
|
|
15030
|
+
if (child) return child;
|
|
15031
|
+
}
|
|
15032
|
+
}
|
|
15033
|
+
return void 0;
|
|
15034
|
+
}
|
|
15035
|
+
function arrField(id, label, schema, options) {
|
|
15036
|
+
return {
|
|
15037
|
+
label,
|
|
15038
|
+
id,
|
|
15039
|
+
$el: "array",
|
|
15040
|
+
vIf: options == null ? void 0 : options.vIf,
|
|
15041
|
+
attrs: { schema, delete: true, add: true, ...options }
|
|
15042
|
+
};
|
|
15043
|
+
}
|
|
15044
|
+
const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
15045
|
+
__proto__: null,
|
|
15046
|
+
arrField,
|
|
15047
|
+
bglForm,
|
|
15048
|
+
checkField,
|
|
15049
|
+
dateField,
|
|
15050
|
+
findBglFieldById,
|
|
15051
|
+
frmRow: frmRow$1,
|
|
15052
|
+
getBaseField,
|
|
15053
|
+
numField: numField$1,
|
|
15054
|
+
richText,
|
|
15055
|
+
selectField,
|
|
15056
|
+
slctField,
|
|
15057
|
+
telField,
|
|
15058
|
+
txtField,
|
|
15059
|
+
uploadField
|
|
15060
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
15061
|
+
const state$1 = vue.reactive({
|
|
15062
|
+
defaultLang: "",
|
|
15063
|
+
availableLangs: [],
|
|
15064
|
+
lang: "en"
|
|
15065
|
+
});
|
|
15066
|
+
function $tdb(langEl) {
|
|
15067
|
+
if (!langEl) {
|
|
15068
|
+
console.warn("No language element provided for $tdb function");
|
|
15069
|
+
return "";
|
|
15070
|
+
}
|
|
15071
|
+
return langEl[state$1.lang] || langEl[state$1.defaultLang] || "";
|
|
15072
|
+
}
|
|
15073
|
+
function useLang() {
|
|
15074
|
+
const lang = vue.computed({
|
|
15075
|
+
get: () => state$1.lang,
|
|
15076
|
+
set: (val) => state$1.lang = val
|
|
15077
|
+
});
|
|
15078
|
+
const availableLangs = vue.computed({
|
|
15079
|
+
get: () => state$1.availableLangs,
|
|
15080
|
+
set: (val) => state$1.availableLangs = val
|
|
15081
|
+
});
|
|
15082
|
+
const defaultLang = vue.computed({
|
|
15083
|
+
get: () => state$1.defaultLang,
|
|
15084
|
+
set: (val) => state$1.defaultLang = val
|
|
15085
|
+
});
|
|
15086
|
+
return {
|
|
15087
|
+
lang,
|
|
15088
|
+
$tdb,
|
|
15089
|
+
availableLangs,
|
|
15090
|
+
defaultLang
|
|
15091
|
+
};
|
|
15092
|
+
}
|
|
15093
|
+
function formatString(str, format2) {
|
|
15094
|
+
if (format2 === "titleCase") {
|
|
15095
|
+
return str.split("_").map((word) => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase()).join(" ");
|
|
15096
|
+
}
|
|
15097
|
+
if (format2 === "pascal") {
|
|
15098
|
+
return str.split("_").map((word) => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase()).join("");
|
|
15099
|
+
}
|
|
15100
|
+
if (format2 === "camel") {
|
|
15101
|
+
return str.split("_").map((word, index2) => index2 === 0 ? word : word[0].toUpperCase() + word.slice(1)).join("");
|
|
15102
|
+
}
|
|
15103
|
+
if (format2 === "snake") {
|
|
15104
|
+
return [...str].map((letter) => {
|
|
15105
|
+
if (letter === letter.toUpperCase()) {
|
|
15106
|
+
return `_${letter.toLowerCase()}`;
|
|
15107
|
+
}
|
|
15108
|
+
return letter;
|
|
15109
|
+
}).join("");
|
|
15110
|
+
}
|
|
15111
|
+
return str;
|
|
15112
|
+
}
|
|
15113
|
+
const debouncers = /* @__PURE__ */ new Map();
|
|
15114
|
+
function debounce(fn2, wait = 500) {
|
|
15115
|
+
clearTimeout(debouncers.get(fn2));
|
|
15116
|
+
const timeout = setTimeout(() => {
|
|
15117
|
+
fn2();
|
|
15118
|
+
debouncers.delete(fn2);
|
|
15119
|
+
}, wait);
|
|
15120
|
+
debouncers.set(fn2, timeout);
|
|
15121
|
+
}
|
|
15122
|
+
function slugify(str) {
|
|
15123
|
+
return str.toLowerCase().replace(/[^a-z0-9-\s]/g, "").split(/[\s-]+/).join("-");
|
|
15124
|
+
}
|
|
15125
|
+
function keyToLabel(key) {
|
|
15126
|
+
if (key === void 0) return key;
|
|
15127
|
+
return key.split("_").map((k2) => k2.charAt(0).toUpperCase() + k2.slice(1)).join(" ") || key;
|
|
15128
|
+
}
|
|
15129
|
+
async function copyText(text, cb) {
|
|
15130
|
+
await navigator.clipboard.writeText(text);
|
|
15131
|
+
if (cb) cb("Copied to clipboard");
|
|
15132
|
+
}
|
|
15133
|
+
function initials(...strArr) {
|
|
15134
|
+
strArr = strArr.flatMap((str) => str.split(/\s/));
|
|
15135
|
+
return strArr.map((str) => str.charAt(0)).join("");
|
|
15136
|
+
}
|
|
15137
|
+
function useEscape(event, closeModel) {
|
|
15138
|
+
if (event.key === "Escape") {
|
|
15139
|
+
closeModel();
|
|
15140
|
+
}
|
|
15141
|
+
}
|
|
15142
|
+
function classify(fieldVal, row, ...classes) {
|
|
15143
|
+
return classes.map((cls) => {
|
|
15144
|
+
if (typeof cls === "function") return cls(fieldVal, row);
|
|
15145
|
+
return cls;
|
|
15146
|
+
}).join(" ");
|
|
15147
|
+
}
|
|
15148
|
+
function bindAttrs(attrs, fieldVal, row) {
|
|
15149
|
+
if (!attrs) return {};
|
|
15150
|
+
const exclude = ["class"];
|
|
15151
|
+
const arr = Object.entries(attrs).filter(([key]) => !exclude.includes(key)).map(([key, value]) => [
|
|
15152
|
+
key,
|
|
15153
|
+
typeof value === "function" ? value(fieldVal, row) : value
|
|
15154
|
+
]);
|
|
15155
|
+
const resolvedAttrs = Object.fromEntries(arr);
|
|
15156
|
+
return resolvedAttrs;
|
|
15157
|
+
}
|
|
15158
|
+
function iffer(field, itemData) {
|
|
15159
|
+
var _a2;
|
|
15160
|
+
if (field["v-if"] === void 0) return true;
|
|
15161
|
+
if (typeof field["v-if"] === "boolean") return field["v-if"];
|
|
15162
|
+
if (typeof field["v-if"] === "string") return true;
|
|
15163
|
+
if (typeof field["v-if"] === "function")
|
|
15164
|
+
return (_a2 = field["v-if"]) == null ? void 0 : _a2.call(field, itemData == null ? void 0 : itemData[field.id], itemData);
|
|
15165
|
+
return true;
|
|
15166
|
+
}
|
|
15167
|
+
function denullify(itemData, fieldID) {
|
|
15168
|
+
if (!fieldID) return;
|
|
15169
|
+
return itemData ? itemData[fieldID] : void 0;
|
|
15170
|
+
}
|
|
15171
|
+
const isDate$2 = (dateToTest) => !Number.isNaN(Date.parse(dateToTest));
|
|
15172
|
+
function getFallbackSchema(data2, showFields) {
|
|
15173
|
+
const keys4 = Array.from(new Set((data2 ?? []).flatMap(Object.keys)));
|
|
15174
|
+
const schema = keys4.map((id) => ({
|
|
15175
|
+
id,
|
|
15176
|
+
label: keyToLabel(id),
|
|
15177
|
+
transform: (val) => {
|
|
15178
|
+
const dateFields = ["created_at", "updated_at"];
|
|
15179
|
+
if (dateFields.includes(id)) return val ? new Date(val).toLocaleString() : val;
|
|
15180
|
+
return val;
|
|
15181
|
+
}
|
|
15182
|
+
}));
|
|
15183
|
+
return showFields ? schema.filter((f2) => showFields.includes(f2.id) || !f2.id) : schema;
|
|
15184
|
+
}
|
|
15185
|
+
function sleep(ms = 100) {
|
|
15186
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
15187
|
+
}
|
|
15188
|
+
function appendScript(src, options) {
|
|
15189
|
+
return new Promise((resolve, reject3) => {
|
|
15190
|
+
if (options == null ? void 0 : options.id) {
|
|
15191
|
+
if (document.getElementById(options.id)) {
|
|
15192
|
+
resolve();
|
|
15193
|
+
return;
|
|
15194
|
+
}
|
|
15195
|
+
} else if (document.querySelector(`script[src="${src}"]`)) {
|
|
15196
|
+
resolve();
|
|
15197
|
+
return;
|
|
15198
|
+
}
|
|
15199
|
+
const script2 = document.createElement("script");
|
|
15200
|
+
script2.src = src;
|
|
15201
|
+
if (options == null ? void 0 : options.id) {
|
|
15202
|
+
script2.id = options.id;
|
|
15203
|
+
}
|
|
15204
|
+
script2.onload = () => {
|
|
15205
|
+
resolve();
|
|
15206
|
+
};
|
|
15207
|
+
script2.onerror = reject3;
|
|
15208
|
+
document.head.append(script2);
|
|
15209
|
+
});
|
|
15210
|
+
}
|
|
15211
|
+
function appendStyle(src) {
|
|
15212
|
+
return new Promise((resolve, reject3) => {
|
|
15213
|
+
if (document.querySelector(`link[href="${src}"]`)) {
|
|
15214
|
+
resolve();
|
|
15215
|
+
return;
|
|
15216
|
+
}
|
|
15217
|
+
const link = document.createElement("link");
|
|
15218
|
+
link.href = src;
|
|
15219
|
+
link.rel = "stylesheet";
|
|
15220
|
+
link.onload = () => {
|
|
15221
|
+
resolve();
|
|
15222
|
+
};
|
|
15223
|
+
link.onerror = reject3;
|
|
15224
|
+
document.head.append(link);
|
|
15225
|
+
});
|
|
15226
|
+
}
|
|
15227
|
+
function normalizeURL(url) {
|
|
15228
|
+
if (url.startsWith("https://")) return url;
|
|
15229
|
+
url = url.replace(/http:\/\//, "");
|
|
15230
|
+
return `https://${url}`;
|
|
15231
|
+
}
|
|
15232
|
+
function normalizeDimension(value, defaultMetric = "px") {
|
|
15233
|
+
if (typeof value === "number") return `${value}${defaultMetric}`;
|
|
15234
|
+
return value;
|
|
15235
|
+
}
|
|
15236
|
+
const fileBaseUrl = "https://files.bagel.design".replace(/\/$/, "");
|
|
15237
|
+
const bagelBaseUrl = void 0;
|
|
15238
|
+
function pathKeyToURL(pathKey) {
|
|
15239
|
+
const urlRE = /^https?:\/\/|^\/\//;
|
|
15240
|
+
if (!pathKey || urlRE.test(pathKey)) return pathKey;
|
|
15241
|
+
if (pathKey.startsWith("static/")) {
|
|
15242
|
+
return `${bagelBaseUrl}/${pathKey}`;
|
|
15243
|
+
}
|
|
15244
|
+
return `${fileBaseUrl}/${pathKey}`;
|
|
15245
|
+
}
|
|
15246
|
+
function getNestedValue(obj, path, defaultValue = void 0) {
|
|
15247
|
+
if (!path) return obj;
|
|
15248
|
+
const keys4 = path.split(/[.[]/);
|
|
15249
|
+
let current = obj;
|
|
15250
|
+
for (const key of keys4) {
|
|
15251
|
+
if (!current || typeof current !== "object" || !(key in current)) {
|
|
15252
|
+
return defaultValue;
|
|
15253
|
+
}
|
|
15254
|
+
current = current[key];
|
|
15255
|
+
}
|
|
15256
|
+
return current ?? defaultValue;
|
|
15257
|
+
}
|
|
14919
15258
|
const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
|
|
14920
15259
|
__name: "BagelForm",
|
|
14921
15260
|
props: {
|
|
@@ -14965,15 +15304,6 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
|
|
|
14965
15304
|
return false;
|
|
14966
15305
|
}
|
|
14967
15306
|
});
|
|
14968
|
-
function getNestedValue(obj, path) {
|
|
14969
|
-
const keys4 = path.split(".");
|
|
14970
|
-
let current = obj;
|
|
14971
|
-
for (const key of keys4) {
|
|
14972
|
-
if (current === void 0 || current === null) return void 0;
|
|
14973
|
-
current = current[key];
|
|
14974
|
-
}
|
|
14975
|
-
return current;
|
|
14976
|
-
}
|
|
14977
15307
|
function updateFormData(fieldId, value) {
|
|
14978
15308
|
const keys4 = fieldId.split(".");
|
|
14979
15309
|
const newData = safeClone2(formData.value);
|
|
@@ -15013,7 +15343,7 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
|
|
|
15013
15343
|
return {
|
|
15014
15344
|
...formData.value,
|
|
15015
15345
|
// Add a special getter to handle nested paths
|
|
15016
|
-
get: (path) => getNestedValue(formData.value, path)
|
|
15346
|
+
get: (path) => getNestedValue(formData.value, path, "")
|
|
15017
15347
|
};
|
|
15018
15348
|
},
|
|
15019
15349
|
onUpdate: (field, value) => {
|
|
@@ -16399,11 +16729,11 @@ function compareAsc(dateLeft, dateRight) {
|
|
|
16399
16729
|
return diff;
|
|
16400
16730
|
}
|
|
16401
16731
|
}
|
|
16402
|
-
function isDate$
|
|
16732
|
+
function isDate$1(value) {
|
|
16403
16733
|
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
16404
16734
|
}
|
|
16405
16735
|
function isValid(date2) {
|
|
16406
|
-
if (!isDate$
|
|
16736
|
+
if (!isDate$1(date2) && typeof date2 !== "number") {
|
|
16407
16737
|
return false;
|
|
16408
16738
|
}
|
|
16409
16739
|
const _date = toDate(date2);
|
|
@@ -20085,7 +20415,7 @@ const bl = (e, t) => e == null ? void 0 : e.querySelector(`[data-dp-element="${t
|
|
|
20085
20415
|
return l2 && e.preventDefault(), t();
|
|
20086
20416
|
}, on$1 = (e, t, l2, a2, n2, c2) => {
|
|
20087
20417
|
const v2 = parse$1(e, t.slice(0, e.length), /* @__PURE__ */ new Date(), { locale: c2 });
|
|
20088
|
-
return isValid(v2) && isDate$
|
|
20418
|
+
return isValid(v2) && isDate$1(v2) ? a2 || n2 ? v2 : set(v2, {
|
|
20089
20419
|
hours: +l2.hours,
|
|
20090
20420
|
minutes: +(l2 == null ? void 0 : l2.minutes),
|
|
20091
20421
|
seconds: +(l2 == null ? void 0 : l2.seconds),
|
|
@@ -26525,7 +26855,7 @@ function formatting(state2) {
|
|
|
26525
26855
|
};
|
|
26526
26856
|
return { text, block, list, clear };
|
|
26527
26857
|
}
|
|
26528
|
-
const { frmRow
|
|
26858
|
+
const { frmRow, numField } = bagelFormUtils;
|
|
26529
26859
|
function insertImage(modal, state2) {
|
|
26530
26860
|
const { range: range2, doc } = state2;
|
|
26531
26861
|
if (!range2 || !doc) return;
|
|
@@ -26534,9 +26864,9 @@ function insertImage(modal, state2) {
|
|
|
26534
26864
|
schema: [
|
|
26535
26865
|
{ id: "src", $el: "file", attrs: { bindkey: "url" } },
|
|
26536
26866
|
{ id: "alt", $el: "text", label: "Alt Text" },
|
|
26537
|
-
frmRow
|
|
26538
|
-
numField
|
|
26539
|
-
numField
|
|
26867
|
+
frmRow(
|
|
26868
|
+
numField("width", "Width", { min: 1 }),
|
|
26869
|
+
numField("height", "Height", { min: 1 })
|
|
26540
26870
|
),
|
|
26541
26871
|
{ id: "figcaption", $el: "check", label: "Show Caption" }
|
|
26542
26872
|
],
|
|
@@ -31118,7 +31448,7 @@ const isPlainObject = (val) => {
|
|
|
31118
31448
|
const prototype2 = getPrototypeOf(val);
|
|
31119
31449
|
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
31120
31450
|
};
|
|
31121
|
-
const isDate
|
|
31451
|
+
const isDate = kindOfTest("Date");
|
|
31122
31452
|
const isFile = kindOfTest("File");
|
|
31123
31453
|
const isBlob = kindOfTest("Blob");
|
|
31124
31454
|
const isFileList = kindOfTest("FileList");
|
|
@@ -31413,7 +31743,7 @@ const utils$1 = {
|
|
|
31413
31743
|
isResponse,
|
|
31414
31744
|
isHeaders,
|
|
31415
31745
|
isUndefined,
|
|
31416
|
-
isDate
|
|
31746
|
+
isDate,
|
|
31417
31747
|
isFile,
|
|
31418
31748
|
isBlob,
|
|
31419
31749
|
isRegExp,
|
|
@@ -41387,15 +41717,15 @@ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
|
41387
41717
|
}
|
|
41388
41718
|
});
|
|
41389
41719
|
const TabbedLayout = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-915732c1"]]);
|
|
41390
|
-
const state
|
|
41720
|
+
const state = vue.reactive(/* @__PURE__ */ new Map());
|
|
41391
41721
|
function useTabs(group) {
|
|
41392
|
-
if (!state
|
|
41393
|
-
state
|
|
41722
|
+
if (!state.has(group)) {
|
|
41723
|
+
state.set(group, vue.reactive({ currentTab: void 0 }));
|
|
41394
41724
|
}
|
|
41395
41725
|
const currentTab = vue.computed({
|
|
41396
|
-
get: () => state
|
|
41726
|
+
get: () => state.get(group).currentTab,
|
|
41397
41727
|
set: (val) => {
|
|
41398
|
-
state
|
|
41728
|
+
state.get(group).currentTab = val;
|
|
41399
41729
|
}
|
|
41400
41730
|
});
|
|
41401
41731
|
return { currentTab };
|
|
@@ -43571,19 +43901,7 @@ function safeClone(obj) {
|
|
|
43571
43901
|
function provideBagelFormState(initialData) {
|
|
43572
43902
|
const data2 = vue.ref(initialData);
|
|
43573
43903
|
const isDirty = vue.ref(false);
|
|
43574
|
-
const getFieldData = (path) =>
|
|
43575
|
-
if (!path) return "";
|
|
43576
|
-
const keys4 = path.split(/[.[]/);
|
|
43577
|
-
let current = data2.value;
|
|
43578
|
-
for (let i2 = 0; i2 < keys4.length; i2++) {
|
|
43579
|
-
const key = keys4[i2];
|
|
43580
|
-
if (!current || typeof current !== "object" || !(key in current)) {
|
|
43581
|
-
return "";
|
|
43582
|
-
}
|
|
43583
|
-
current = current[key];
|
|
43584
|
-
}
|
|
43585
|
-
return current ?? "";
|
|
43586
|
-
};
|
|
43904
|
+
const getFieldData = (path) => getNestedValue(data2.value, path, "");
|
|
43587
43905
|
const updateField = (path, value) => {
|
|
43588
43906
|
const keys4 = path.split(/[.[]/);
|
|
43589
43907
|
if (typeof data2.value !== "object" || data2.value === null) {
|
|
@@ -44397,356 +44715,6 @@ const ripple = {
|
|
|
44397
44715
|
}
|
|
44398
44716
|
}
|
|
44399
44717
|
};
|
|
44400
|
-
function getBaseField(id, labelOrRest = {}, rest = {}) {
|
|
44401
|
-
if (typeof labelOrRest === "object") return { id, ...labelOrRest };
|
|
44402
|
-
return { id, label: labelOrRest, ...rest };
|
|
44403
|
-
}
|
|
44404
|
-
function richText(id, label, options) {
|
|
44405
|
-
return {
|
|
44406
|
-
$el: "richtext",
|
|
44407
|
-
class: options == null ? void 0 : options.class,
|
|
44408
|
-
required: options == null ? void 0 : options.required,
|
|
44409
|
-
id,
|
|
44410
|
-
label,
|
|
44411
|
-
vIf: options == null ? void 0 : options.vIf,
|
|
44412
|
-
placeholder: options == null ? void 0 : options.placeholder,
|
|
44413
|
-
attrs: {}
|
|
44414
|
-
};
|
|
44415
|
-
}
|
|
44416
|
-
function txtField(id, label, options) {
|
|
44417
|
-
return {
|
|
44418
|
-
$el: "text",
|
|
44419
|
-
class: options == null ? void 0 : options.class,
|
|
44420
|
-
required: options == null ? void 0 : options.required,
|
|
44421
|
-
id,
|
|
44422
|
-
label,
|
|
44423
|
-
vIf: options == null ? void 0 : options.vIf,
|
|
44424
|
-
disabled: options == null ? void 0 : options.disabled,
|
|
44425
|
-
placeholder: options == null ? void 0 : options.placeholder,
|
|
44426
|
-
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
44427
|
-
attrs: {
|
|
44428
|
-
type: options == null ? void 0 : options.type,
|
|
44429
|
-
pattern: options == null ? void 0 : options.pattern,
|
|
44430
|
-
multiline: options == null ? void 0 : options.multiline
|
|
44431
|
-
}
|
|
44432
|
-
};
|
|
44433
|
-
}
|
|
44434
|
-
function selectField(id, label, options, config) {
|
|
44435
|
-
return {
|
|
44436
|
-
$el: "select",
|
|
44437
|
-
id,
|
|
44438
|
-
options,
|
|
44439
|
-
class: config == null ? void 0 : config.class,
|
|
44440
|
-
placeholder: config == null ? void 0 : config.placeholder,
|
|
44441
|
-
required: config == null ? void 0 : config.required,
|
|
44442
|
-
label,
|
|
44443
|
-
defaultValue: config == null ? void 0 : config.defaultValue,
|
|
44444
|
-
vIf: config == null ? void 0 : config.vIf,
|
|
44445
|
-
attrs: {
|
|
44446
|
-
disabled: config == null ? void 0 : config.disabled,
|
|
44447
|
-
searchable: config == null ? void 0 : config.searchable,
|
|
44448
|
-
multiselect: config == null ? void 0 : config.multiselect,
|
|
44449
|
-
onSearch: config == null ? void 0 : config.onSearch,
|
|
44450
|
-
clearable: config == null ? void 0 : config.clearable
|
|
44451
|
-
}
|
|
44452
|
-
};
|
|
44453
|
-
}
|
|
44454
|
-
const slctField = selectField;
|
|
44455
|
-
function checkField(id, label, options) {
|
|
44456
|
-
return {
|
|
44457
|
-
$el: "check",
|
|
44458
|
-
class: options == null ? void 0 : options.class,
|
|
44459
|
-
required: options == null ? void 0 : options.required,
|
|
44460
|
-
id,
|
|
44461
|
-
label
|
|
44462
|
-
};
|
|
44463
|
-
}
|
|
44464
|
-
function dateField(id, label, options) {
|
|
44465
|
-
return {
|
|
44466
|
-
$el: "date",
|
|
44467
|
-
class: options == null ? void 0 : options.class,
|
|
44468
|
-
required: options == null ? void 0 : options.required,
|
|
44469
|
-
id,
|
|
44470
|
-
disabled: options == null ? void 0 : options.disabled,
|
|
44471
|
-
label,
|
|
44472
|
-
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
44473
|
-
vIf: options == null ? void 0 : options.vIf,
|
|
44474
|
-
attrs: {
|
|
44475
|
-
disabled: options == null ? void 0 : options.disabled
|
|
44476
|
-
}
|
|
44477
|
-
};
|
|
44478
|
-
}
|
|
44479
|
-
function numField(id, label, options) {
|
|
44480
|
-
return {
|
|
44481
|
-
$el: "number",
|
|
44482
|
-
class: options == null ? void 0 : options.class,
|
|
44483
|
-
required: options == null ? void 0 : options.required,
|
|
44484
|
-
defaultValue: options == null ? void 0 : options.defaultValue,
|
|
44485
|
-
id,
|
|
44486
|
-
label,
|
|
44487
|
-
disabled: options == null ? void 0 : options.disabled,
|
|
44488
|
-
placeholder: options == null ? void 0 : options.placeholder,
|
|
44489
|
-
helptext: options == null ? void 0 : options.helptext,
|
|
44490
|
-
vIf: options == null ? void 0 : options.vIf,
|
|
44491
|
-
attrs: {
|
|
44492
|
-
step: options == null ? void 0 : options.step,
|
|
44493
|
-
min: options == null ? void 0 : options.min,
|
|
44494
|
-
max: options == null ? void 0 : options.max,
|
|
44495
|
-
layout: options == null ? void 0 : options.layout,
|
|
44496
|
-
padZero: options == null ? void 0 : options.padZero,
|
|
44497
|
-
center: options == null ? void 0 : options.center
|
|
44498
|
-
}
|
|
44499
|
-
};
|
|
44500
|
-
}
|
|
44501
|
-
function frmRow(...children2) {
|
|
44502
|
-
return {
|
|
44503
|
-
$el: "div",
|
|
44504
|
-
class: "flex gap-1 m_block align-items-end",
|
|
44505
|
-
children: children2
|
|
44506
|
-
};
|
|
44507
|
-
}
|
|
44508
|
-
function uploadField(id, label, options) {
|
|
44509
|
-
return {
|
|
44510
|
-
$el: "upload",
|
|
44511
|
-
id,
|
|
44512
|
-
label,
|
|
44513
|
-
vIf: options == null ? void 0 : options.vIf,
|
|
44514
|
-
attrs: {
|
|
44515
|
-
...options
|
|
44516
|
-
}
|
|
44517
|
-
};
|
|
44518
|
-
}
|
|
44519
|
-
function bglForm(idOrField, ...schema) {
|
|
44520
|
-
if (typeof idOrField === "string") {
|
|
44521
|
-
return {
|
|
44522
|
-
$el: "bagelform",
|
|
44523
|
-
id: idOrField,
|
|
44524
|
-
attrs: {
|
|
44525
|
-
schema: [idOrField, ...schema]
|
|
44526
|
-
}
|
|
44527
|
-
};
|
|
44528
|
-
}
|
|
44529
|
-
return {
|
|
44530
|
-
$el: "bagelform",
|
|
44531
|
-
attrs: {
|
|
44532
|
-
schema: [idOrField, ...schema]
|
|
44533
|
-
}
|
|
44534
|
-
};
|
|
44535
|
-
}
|
|
44536
|
-
function telField(id, label, options) {
|
|
44537
|
-
return {
|
|
44538
|
-
$el: vue.markRaw(TelInput),
|
|
44539
|
-
id,
|
|
44540
|
-
label,
|
|
44541
|
-
vIf: options == null ? void 0 : options.vIf,
|
|
44542
|
-
attrs: options
|
|
44543
|
-
};
|
|
44544
|
-
}
|
|
44545
|
-
function findBglFieldById(id, _schema) {
|
|
44546
|
-
for (const field of _schema) {
|
|
44547
|
-
if (field.id === id) return field;
|
|
44548
|
-
if (field.children && Number(field.children.length) > 0) {
|
|
44549
|
-
const fieldChildren = field.children.filter((c2) => typeof c2 === "object" && "$el" in c2);
|
|
44550
|
-
const child = findBglFieldById(id, fieldChildren);
|
|
44551
|
-
if (child) return child;
|
|
44552
|
-
}
|
|
44553
|
-
}
|
|
44554
|
-
return void 0;
|
|
44555
|
-
}
|
|
44556
|
-
function arrField(id, label, schema, options) {
|
|
44557
|
-
return {
|
|
44558
|
-
label,
|
|
44559
|
-
id,
|
|
44560
|
-
$el: "array",
|
|
44561
|
-
vIf: options == null ? void 0 : options.vIf,
|
|
44562
|
-
attrs: { schema, delete: true, add: true, ...options }
|
|
44563
|
-
};
|
|
44564
|
-
}
|
|
44565
|
-
const state = vue.reactive({
|
|
44566
|
-
defaultLang: "",
|
|
44567
|
-
availableLangs: [],
|
|
44568
|
-
lang: "en"
|
|
44569
|
-
});
|
|
44570
|
-
function $tdb(langEl) {
|
|
44571
|
-
if (!langEl) {
|
|
44572
|
-
console.warn("No language element provided for $tdb function");
|
|
44573
|
-
return "";
|
|
44574
|
-
}
|
|
44575
|
-
return langEl[state.lang] || langEl[state.defaultLang] || "";
|
|
44576
|
-
}
|
|
44577
|
-
function useLang() {
|
|
44578
|
-
const lang = vue.computed({
|
|
44579
|
-
get: () => state.lang,
|
|
44580
|
-
set: (val) => state.lang = val
|
|
44581
|
-
});
|
|
44582
|
-
const availableLangs = vue.computed({
|
|
44583
|
-
get: () => state.availableLangs,
|
|
44584
|
-
set: (val) => state.availableLangs = val
|
|
44585
|
-
});
|
|
44586
|
-
const defaultLang = vue.computed({
|
|
44587
|
-
get: () => state.defaultLang,
|
|
44588
|
-
set: (val) => state.defaultLang = val
|
|
44589
|
-
});
|
|
44590
|
-
return {
|
|
44591
|
-
lang,
|
|
44592
|
-
$tdb,
|
|
44593
|
-
availableLangs,
|
|
44594
|
-
defaultLang
|
|
44595
|
-
};
|
|
44596
|
-
}
|
|
44597
|
-
function formatString(str, format2) {
|
|
44598
|
-
if (format2 === "titleCase") {
|
|
44599
|
-
return str.split("_").map((word) => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase()).join(" ");
|
|
44600
|
-
}
|
|
44601
|
-
if (format2 === "pascal") {
|
|
44602
|
-
return str.split("_").map((word) => word[0].toUpperCase() + word.slice(1).toLocaleLowerCase()).join("");
|
|
44603
|
-
}
|
|
44604
|
-
if (format2 === "camel") {
|
|
44605
|
-
return str.split("_").map((word, index2) => index2 === 0 ? word : word[0].toUpperCase() + word.slice(1)).join("");
|
|
44606
|
-
}
|
|
44607
|
-
if (format2 === "snake") {
|
|
44608
|
-
return [...str].map((letter) => {
|
|
44609
|
-
if (letter === letter.toUpperCase()) {
|
|
44610
|
-
return `_${letter.toLowerCase()}`;
|
|
44611
|
-
}
|
|
44612
|
-
return letter;
|
|
44613
|
-
}).join("");
|
|
44614
|
-
}
|
|
44615
|
-
return str;
|
|
44616
|
-
}
|
|
44617
|
-
const debouncers = /* @__PURE__ */ new Map();
|
|
44618
|
-
function debounce(fn2, wait = 500) {
|
|
44619
|
-
clearTimeout(debouncers.get(fn2));
|
|
44620
|
-
const timeout = setTimeout(() => {
|
|
44621
|
-
fn2();
|
|
44622
|
-
debouncers.delete(fn2);
|
|
44623
|
-
}, wait);
|
|
44624
|
-
debouncers.set(fn2, timeout);
|
|
44625
|
-
}
|
|
44626
|
-
function slugify(str) {
|
|
44627
|
-
return str.toLowerCase().replace(/[^a-z0-9-\s]/g, "").split(/[\s-]+/).join("-");
|
|
44628
|
-
}
|
|
44629
|
-
function keyToLabel(key) {
|
|
44630
|
-
if (key === void 0) return key;
|
|
44631
|
-
return key.split("_").map((k2) => k2.charAt(0).toUpperCase() + k2.slice(1)).join(" ") || key;
|
|
44632
|
-
}
|
|
44633
|
-
async function copyText(text, cb) {
|
|
44634
|
-
await navigator.clipboard.writeText(text);
|
|
44635
|
-
if (cb) cb("Copied to clipboard");
|
|
44636
|
-
}
|
|
44637
|
-
function initials(...strArr) {
|
|
44638
|
-
strArr = strArr.flatMap((str) => str.split(/\s/));
|
|
44639
|
-
return strArr.map((str) => str.charAt(0)).join("");
|
|
44640
|
-
}
|
|
44641
|
-
function useEscape(event, closeModel) {
|
|
44642
|
-
if (event.key === "Escape") {
|
|
44643
|
-
closeModel();
|
|
44644
|
-
}
|
|
44645
|
-
}
|
|
44646
|
-
function classify(fieldVal, row, ...classes) {
|
|
44647
|
-
return classes.map((cls) => {
|
|
44648
|
-
if (typeof cls === "function") return cls(fieldVal, row);
|
|
44649
|
-
return cls;
|
|
44650
|
-
}).join(" ");
|
|
44651
|
-
}
|
|
44652
|
-
function bindAttrs(attrs, fieldVal, row) {
|
|
44653
|
-
if (!attrs) return {};
|
|
44654
|
-
const exclude = ["class"];
|
|
44655
|
-
const arr = Object.entries(attrs).filter(([key]) => !exclude.includes(key)).map(([key, value]) => [
|
|
44656
|
-
key,
|
|
44657
|
-
typeof value === "function" ? value(fieldVal, row) : value
|
|
44658
|
-
]);
|
|
44659
|
-
const resolvedAttrs = Object.fromEntries(arr);
|
|
44660
|
-
return resolvedAttrs;
|
|
44661
|
-
}
|
|
44662
|
-
function iffer(field, itemData) {
|
|
44663
|
-
var _a2;
|
|
44664
|
-
if (field["v-if"] === void 0) return true;
|
|
44665
|
-
if (typeof field["v-if"] === "boolean") return field["v-if"];
|
|
44666
|
-
if (typeof field["v-if"] === "string") return true;
|
|
44667
|
-
if (typeof field["v-if"] === "function")
|
|
44668
|
-
return (_a2 = field["v-if"]) == null ? void 0 : _a2.call(field, itemData == null ? void 0 : itemData[field.id], itemData);
|
|
44669
|
-
return true;
|
|
44670
|
-
}
|
|
44671
|
-
function denullify(itemData, fieldID) {
|
|
44672
|
-
if (!fieldID) return;
|
|
44673
|
-
return itemData ? itemData[fieldID] : void 0;
|
|
44674
|
-
}
|
|
44675
|
-
const isDate = (dateToTest) => !Number.isNaN(Date.parse(dateToTest));
|
|
44676
|
-
function getFallbackSchema(data2, showFields) {
|
|
44677
|
-
const keys4 = Array.from(new Set((data2 ?? []).flatMap(Object.keys)));
|
|
44678
|
-
const schema = keys4.map((id) => ({
|
|
44679
|
-
id,
|
|
44680
|
-
label: keyToLabel(id),
|
|
44681
|
-
transform: (val) => {
|
|
44682
|
-
const dateFields = ["created_at", "updated_at"];
|
|
44683
|
-
if (dateFields.includes(id)) return val ? new Date(val).toLocaleString() : val;
|
|
44684
|
-
return val;
|
|
44685
|
-
}
|
|
44686
|
-
}));
|
|
44687
|
-
return showFields ? schema.filter((f2) => showFields.includes(f2.id) || !f2.id) : schema;
|
|
44688
|
-
}
|
|
44689
|
-
function sleep(ms = 100) {
|
|
44690
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
44691
|
-
}
|
|
44692
|
-
function appendScript(src, options) {
|
|
44693
|
-
return new Promise((resolve, reject3) => {
|
|
44694
|
-
if (options == null ? void 0 : options.id) {
|
|
44695
|
-
if (document.getElementById(options.id)) {
|
|
44696
|
-
resolve();
|
|
44697
|
-
return;
|
|
44698
|
-
}
|
|
44699
|
-
} else if (document.querySelector(`script[src="${src}"]`)) {
|
|
44700
|
-
resolve();
|
|
44701
|
-
return;
|
|
44702
|
-
}
|
|
44703
|
-
const script2 = document.createElement("script");
|
|
44704
|
-
script2.src = src;
|
|
44705
|
-
if (options == null ? void 0 : options.id) {
|
|
44706
|
-
script2.id = options.id;
|
|
44707
|
-
}
|
|
44708
|
-
script2.onload = () => {
|
|
44709
|
-
resolve();
|
|
44710
|
-
};
|
|
44711
|
-
script2.onerror = reject3;
|
|
44712
|
-
document.head.append(script2);
|
|
44713
|
-
});
|
|
44714
|
-
}
|
|
44715
|
-
function appendStyle(src) {
|
|
44716
|
-
return new Promise((resolve, reject3) => {
|
|
44717
|
-
if (document.querySelector(`link[href="${src}"]`)) {
|
|
44718
|
-
resolve();
|
|
44719
|
-
return;
|
|
44720
|
-
}
|
|
44721
|
-
const link = document.createElement("link");
|
|
44722
|
-
link.href = src;
|
|
44723
|
-
link.rel = "stylesheet";
|
|
44724
|
-
link.onload = () => {
|
|
44725
|
-
resolve();
|
|
44726
|
-
};
|
|
44727
|
-
link.onerror = reject3;
|
|
44728
|
-
document.head.append(link);
|
|
44729
|
-
});
|
|
44730
|
-
}
|
|
44731
|
-
function normalizeURL(url) {
|
|
44732
|
-
if (url.startsWith("https://")) return url;
|
|
44733
|
-
url = url.replace(/http:\/\//, "");
|
|
44734
|
-
return `https://${url}`;
|
|
44735
|
-
}
|
|
44736
|
-
function normalizeDimension(value, defaultMetric = "px") {
|
|
44737
|
-
if (typeof value === "number") return `${value}${defaultMetric}`;
|
|
44738
|
-
return value;
|
|
44739
|
-
}
|
|
44740
|
-
const fileBaseUrl = "https://files.bagel.design".replace(/\/$/, "");
|
|
44741
|
-
const bagelBaseUrl = void 0;
|
|
44742
|
-
function pathKeyToURL(pathKey) {
|
|
44743
|
-
const urlRE = /^https?:\/\/|^\/\//;
|
|
44744
|
-
if (!pathKey || urlRE.test(pathKey)) return pathKey;
|
|
44745
|
-
if (pathKey.startsWith("static/")) {
|
|
44746
|
-
return `${bagelBaseUrl}/${pathKey}`;
|
|
44747
|
-
}
|
|
44748
|
-
return `${fileBaseUrl}/${pathKey}`;
|
|
44749
|
-
}
|
|
44750
44718
|
const clickOutside = {
|
|
44751
44719
|
beforeMount(el, binding) {
|
|
44752
44720
|
el.clickOutsideEvent = (event) => {
|
|
@@ -45364,10 +45332,11 @@ exports.debounce = debounce;
|
|
|
45364
45332
|
exports.denullify = denullify;
|
|
45365
45333
|
exports.formatString = formatString;
|
|
45366
45334
|
exports.getFallbackSchema = getFallbackSchema;
|
|
45335
|
+
exports.getNestedValue = getNestedValue;
|
|
45367
45336
|
exports.i18nTInjectionKey = i18nTInjectionKey;
|
|
45368
45337
|
exports.iffer = iffer;
|
|
45369
45338
|
exports.initials = initials;
|
|
45370
|
-
exports.isDate = isDate;
|
|
45339
|
+
exports.isDate = isDate$2;
|
|
45371
45340
|
exports.keyToLabel = keyToLabel;
|
|
45372
45341
|
exports.localRef = localRef;
|
|
45373
45342
|
exports.normalizeDimension = normalizeDimension;
|