@bagelink/vue 0.0.1224 → 0.0.1232

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/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { defineComponent, reactive, provide, openBlock, createElementBlock, renderSlot, ref, computed, inject, watch, normalizeClass, createElementVNode, unref, createVNode, createCommentVNode, toDisplayString, Transition, withCtx, isRef, Fragment, renderList, createBlock, useSlots, resolveDirective, withDirectives, resolveDynamicComponent, mergeProps, withModifiers, withKeys, createTextVNode, normalizeStyle, resolveComponent, useCssVars, onMounted, Comment, Text, nextTick, onBeforeUnmount, onUnmounted, h as h$2, getCurrentScope, onScopeDispose, toValue, getCurrentInstance, shallowRef, mergeModels, useModel, normalizeProps, vModelCheckbox, pushScopeId, popScopeId, guardReactiveProps, withScopeId, createApp, vModelText, toRef, createSlots, Teleport, render as render$e, onBeforeUpdate, vShow, vModelRadio, TransitionGroup, vModelDynamic, markRaw } from "vue";
4
+ import { defineComponent, reactive, provide, openBlock, createElementBlock, renderSlot, ref, computed, inject, watch, normalizeClass, createElementVNode, unref, createVNode, createCommentVNode, toDisplayString, Transition, withCtx, isRef, Fragment, renderList, createBlock, useSlots, resolveDirective, withDirectives, resolveDynamicComponent, mergeProps, withModifiers, withKeys, createTextVNode, normalizeStyle, resolveComponent, useCssVars, onMounted, Comment, Text, nextTick, onBeforeUnmount, onUnmounted, isVNode, h as h$2, getCurrentScope, onScopeDispose, toValue, getCurrentInstance, shallowRef, mergeModels, useModel, normalizeProps, vModelCheckbox, pushScopeId, popScopeId, guardReactiveProps, withScopeId, createApp, vModelText, toRef, createSlots, Teleport, render as render$e, onBeforeUpdate, vShow, vModelRadio, TransitionGroup, vModelDynamic, markRaw } from "vue";
5
5
  import { RouterLink } from "vue-router";
6
6
  const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7
7
  __proto__: null,
@@ -315,7 +315,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
315
315
  };
316
316
  }
317
317
  });
318
- const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-7b18a02c"]]);
318
+ const Btn = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__scopeId", "data-v-bfc435b3"]]);
319
319
  const _hoisted_1$17 = ["dismissable"];
320
320
  const _hoisted_2$Q = { class: "m-0" };
321
321
  const _sfc_main$1j = /* @__PURE__ */ defineComponent({
@@ -2812,7 +2812,6 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
2812
2812
  const clientXDragStart = ref(null);
2813
2813
  const changeInQuartersOnDrag = ref(0);
2814
2814
  const changeInDaysOnDrag = ref(0);
2815
- ref(false);
2816
2815
  const timeStartDragStart = ref(props2.eventProp.time.start);
2817
2816
  const timeEndDragStart = ref(props2.eventProp.time.end);
2818
2817
  const dragMoveListenerNameAndCallbacks = [
@@ -3162,7 +3161,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
3162
3161
  };
3163
3162
  }
3164
3163
  });
3165
- const DayEvent = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-d496d603"]]);
3164
+ const DayEvent = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-6b5ab9be"]]);
3166
3165
  const _hoisted_1$W = ["id", "onClick"];
3167
3166
  const _sfc_main$15 = /* @__PURE__ */ defineComponent({
3168
3167
  __name: "Day",
@@ -10761,6 +10760,11 @@ function useSchemaField(options) {
10761
10760
  }
10762
10761
  return typeof field.$el === "object" ? field.$el : componentMap[field.$el] ?? field.$el ?? "div";
10763
10762
  }
10763
+ function renderChild(child, slots) {
10764
+ if (typeof child === "string") return child;
10765
+ if (isVNode(child)) return child;
10766
+ return renderField(child, slots);
10767
+ }
10764
10768
  function renderField(field, slots) {
10765
10769
  const Component = getComponent(field);
10766
10770
  if (!Component) return null;
@@ -10840,17 +10844,24 @@ function useSchemaField(options) {
10840
10844
  props2.class = classify(currentValue, rowData, fieldClass, props2.class);
10841
10845
  const componentSlots = {};
10842
10846
  if (children2 == null ? void 0 : children2.length) {
10843
- componentSlots.default = () => children2.map((child) => {
10844
- if (typeof child === "string") return child;
10845
- return renderField(child, slots);
10846
- }).filter(Boolean);
10847
+ componentSlots.default = () => children2.map((child) => renderChild(child, slots)).filter(Boolean);
10847
10848
  }
10848
10849
  if (isSlotValueComponent && transformedValue !== void 0) {
10849
10850
  componentSlots.default = () => (transformedValue == null ? void 0 : transformedValue.toString()) || "";
10850
10851
  }
10851
10852
  if (fieldSlots) {
10852
10853
  Object.entries(fieldSlots).forEach(([name, slot]) => {
10853
- componentSlots[name] = typeof slot === "function" ? () => slot(currentValue, rowData) : () => slot;
10854
+ componentSlots[name] = () => {
10855
+ if (Array.isArray(slot)) {
10856
+ return slot.map((schemaField) => renderField(schemaField, slots));
10857
+ } else if (isVNode(slot)) {
10858
+ return slot;
10859
+ } else if (typeof slot === "function") {
10860
+ const slotFn = slot;
10861
+ return slotFn({ row: rowData, field });
10862
+ }
10863
+ return slot;
10864
+ };
10854
10865
  });
10855
10866
  }
10856
10867
  const slotContent = field.id && (slots == null ? void 0 : slots[field.id]) ? slots[field.id]({ row: rowData, field }) : void 0;
@@ -15105,9 +15116,12 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
15105
15116
  async function handleSubmit() {
15106
15117
  var _a2;
15107
15118
  try {
15119
+ if (formState.value === "submitting") return;
15120
+ formState.value = "submitting";
15108
15121
  await ((_a2 = props2.onSubmit) == null ? void 0 : _a2.call(props2, formData.value));
15109
15122
  initialFormData.value = structuredClone(formData.value);
15110
15123
  formState.value = "success";
15124
+ window.parent.postMessage({ type: "BAGEL_FORM_SUCCESS", data: formData.value }, "*");
15111
15125
  } catch (error) {
15112
15126
  formState.value = "error";
15113
15127
  }
@@ -15145,7 +15159,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
15145
15159
  renderSlot(_ctx.$slots, "submit", {
15146
15160
  submit: handleSubmit,
15147
15161
  isDirty: isDirty.value,
15148
- validateForm
15162
+ validateForm,
15163
+ formState: formState.value
15149
15164
  }),
15150
15165
  formState.value === "success" ? renderSlot(_ctx.$slots, "success", { key: 2 }) : createCommentVNode("", true),
15151
15166
  formState.value === "error" ? renderSlot(_ctx.$slots, "error", { key: 3 }) : createCommentVNode("", true)
@@ -42144,7 +42159,7 @@ const _hoisted_5$1 = {
42144
42159
  };
42145
42160
  const _hoisted_6$1 = ["onClick"];
42146
42161
  const _hoisted_7$1 = ["onClick"];
42147
- const _hoisted_8$1 = ["onMousedown", "onMouseover", "onFocusin", "onDblclick", "onKeydown"];
42162
+ const _hoisted_8$1 = ["tabindex", "onMousedown", "onMouseover", "onFocusin", "onDblclick", "onKeydown"];
42148
42163
  const _hoisted_9$1 = ["value", "onInput"];
42149
42164
  const _hoisted_10$1 = { class: "spreadsheet-cell spreadsheetCellPlaceHolder" };
42150
42165
  const _hoisted_11$1 = {
@@ -42164,7 +42179,7 @@ const _hoisted_16 = {
42164
42179
  };
42165
42180
  const _hoisted_17 = ["onClick"];
42166
42181
  const _hoisted_18 = ["onClick"];
42167
- const _hoisted_19 = ["onMousedown", "onMouseover", "onFocusin", "onDblclick", "onKeydown"];
42182
+ const _hoisted_19 = ["tabindex", "onMousedown", "onMouseover", "onFocusin", "onDblclick", "onKeydown"];
42168
42183
  const _hoisted_20 = ["value", "onInput"];
42169
42184
  const _hoisted_21 = { class: "spreadsheet-cell spreadsheetCellPlaceHolder" };
42170
42185
  const _hoisted_22 = {
@@ -42248,7 +42263,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42248
42263
  format: (configuredColumn == null ? void 0 : configuredColumn.format) ?? "text",
42249
42264
  width: configuredColumn == null ? void 0 : configuredColumn.width,
42250
42265
  fixed: (configuredColumn == null ? void 0 : configuredColumn.fixed) ?? false,
42251
- hidden: (configuredColumn == null ? void 0 : configuredColumn.hidden) ?? false
42266
+ hidden: (configuredColumn == null ? void 0 : configuredColumn.hidden) ?? false,
42267
+ defaultValue: configuredColumn == null ? void 0 : configuredColumn.defaultValue
42252
42268
  };
42253
42269
  });
42254
42270
  });
@@ -42323,7 +42339,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42323
42339
  const isSelecting = ref(false);
42324
42340
  const selectionStart = ref(null);
42325
42341
  const selectionEnd = ref(null);
42326
- ref([]);
42327
42342
  const editingCell = ref(null);
42328
42343
  const editInputRef = ref(/* @__PURE__ */ new Map());
42329
42344
  function setInputRef(el, key) {
@@ -42418,7 +42433,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42418
42433
  if (column == null ? void 0 : column.locked) return;
42419
42434
  saveState("cell");
42420
42435
  const parsedValue = parseValueForFormat(newValue, column == null ? void 0 : column.format);
42421
- localRows.value[rowIndex][key] = parsedValue;
42436
+ localRows.value[rowIndex][key] = parsedValue ?? (column == null ? void 0 : column.defaultValue) ?? ((column == null ? void 0 : column.format) === "boolean" ? false : "");
42422
42437
  emitUpdate();
42423
42438
  }
42424
42439
  const fixedColumns = computed(() => {
@@ -42430,7 +42445,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42430
42445
  function createEmptyRow() {
42431
42446
  const newRow = {};
42432
42447
  columns.value.forEach((col) => {
42433
- newRow[col.key] = col.format === "boolean" ? false : "";
42448
+ if (col.defaultValue !== void 0) {
42449
+ newRow[col.key] = col.defaultValue;
42450
+ } else {
42451
+ newRow[col.key] = col.format === "boolean" ? false : "";
42452
+ }
42434
42453
  });
42435
42454
  return newRow;
42436
42455
  }
@@ -42510,6 +42529,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42510
42529
  const input = editInputRef.value.get(inputKey);
42511
42530
  if (input) {
42512
42531
  input.focus();
42532
+ if (initialKey !== void 0) {
42533
+ input.value = initialKey;
42534
+ }
42513
42535
  }
42514
42536
  });
42515
42537
  }
@@ -42524,7 +42546,17 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42524
42546
  }
42525
42547
  editingCell.value = null;
42526
42548
  editingOriginalValue.value = null;
42527
- console.log(editingCell.value);
42549
+ }
42550
+ function handleStopEditingAndBlur(cancelled = false) {
42551
+ nextTick(() => {
42552
+ stopEditing(cancelled);
42553
+ nextTick(() => {
42554
+ const spreadsheet = document.querySelector(".spreadsheet");
42555
+ if (spreadsheet) {
42556
+ spreadsheet.focus();
42557
+ }
42558
+ });
42559
+ });
42528
42560
  }
42529
42561
  window.addEventListener("mouseup", handleMouseUp);
42530
42562
  function selectEntireRow(rowIndex) {
@@ -42677,7 +42709,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42677
42709
  locked: !isCellEditable(col.key)
42678
42710
  }),
42679
42711
  style: normalizeStyle({ width: col.width }),
42680
- tabindex: "0",
42712
+ tabindex: col.hidden ? void 0 : 0,
42681
42713
  onMousedown: ($event) => handleMouseDown(rowIndex, fixedColumns.value.indexOf(col)),
42682
42714
  onMouseover: ($event) => handleMouseOver(rowIndex, fixedColumns.value.indexOf(col)),
42683
42715
  onFocusin: ($event) => handleMouseOver(rowIndex, fixedColumns.value.indexOf(col)),
@@ -42691,12 +42723,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42691
42723
  value: row[col.key],
42692
42724
  type: "text",
42693
42725
  class: "spreadsheet-input",
42694
- autofocus: "",
42695
42726
  onInput: (e) => updateCell(rowIndex, col.key, e.target.value),
42696
- onBlur: _cache[1] || (_cache[1] = ($event) => stopEditing(false)),
42727
+ onBlur: _cache[1] || (_cache[1] = ($event) => handleStopEditingAndBlur(false)),
42697
42728
  onKeydown: [
42698
- _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => stopEditing(true), ["prevent"]), ["esc"])),
42699
- _cache[3] || (_cache[3] = withKeys(withModifiers(($event) => stopEditing(false), ["prevent"]), ["enter"]))
42729
+ _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => handleStopEditingAndBlur(false), ["prevent"]), ["enter"])),
42730
+ _cache[3] || (_cache[3] = withKeys(withModifiers(($event) => handleStopEditingAndBlur(true), ["prevent"]), ["esc"]))
42700
42731
  ],
42701
42732
  onMousedown: _cache[4] || (_cache[4] = withModifiers(() => {
42702
42733
  }, ["stop"]))
@@ -42761,7 +42792,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42761
42792
  locked: !isCellEditable(col.key)
42762
42793
  }),
42763
42794
  style: normalizeStyle({ width: col.width }),
42764
- tabindex: "0",
42795
+ tabindex: col.hidden ? void 0 : 0,
42765
42796
  onMousedown: ($event) => handleMouseDown(rowIndex, fixedColumns.value.length + colIndex),
42766
42797
  onMouseover: ($event) => handleMouseOver(rowIndex, fixedColumns.value.length + colIndex),
42767
42798
  onFocusin: ($event) => handleMouseOver(rowIndex, fixedColumns.value.length + colIndex),
@@ -42775,12 +42806,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42775
42806
  value: row[col.key],
42776
42807
  type: "text",
42777
42808
  class: "spreadsheet-input",
42778
- autofocus: "",
42779
42809
  onInput: (e) => updateCell(rowIndex, col.key, e.target.value),
42780
- onBlur: _cache[6] || (_cache[6] = ($event) => stopEditing(false)),
42810
+ onBlur: _cache[6] || (_cache[6] = ($event) => handleStopEditingAndBlur(false)),
42781
42811
  onKeydown: [
42782
- _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => stopEditing(true), ["prevent"]), ["esc"])),
42783
- _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => stopEditing(false), ["prevent"]), ["enter"]))
42812
+ _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => handleStopEditingAndBlur(false), ["prevent"]), ["enter"])),
42813
+ _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => handleStopEditingAndBlur(true), ["prevent"]), ["esc"]))
42784
42814
  ],
42785
42815
  onMousedown: _cache[9] || (_cache[9] = withModifiers(() => {
42786
42816
  }, ["stop"]))
@@ -42827,7 +42857,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
42827
42857
  };
42828
42858
  }
42829
42859
  });
42830
- const Index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c988b157"]]);
42860
+ const Index = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ea9bc123"]]);
42831
42861
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
42832
42862
  __name: "Title",
42833
42863
  props: {
@@ -43695,7 +43725,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43695
43725
  return (_ctx, _cache) => {
43696
43726
  return openBlock(), createBlock(Transition, { name: "fade" }, {
43697
43727
  default: withCtx(() => {
43698
- var _a2, _b, _c, _d, _e2, _f, _g, _h;
43728
+ var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j;
43699
43729
  return [
43700
43730
  unref(isOpen) ? (openBlock(), createElementBlock("div", {
43701
43731
  key: 0,
@@ -43756,7 +43786,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43756
43786
  onClick: _cache[2] || (_cache[2] = ($event) => zoom.value++)
43757
43787
  }, null, 8, ["disabled"])
43758
43788
  ])) : createCommentVNode("", true),
43759
- ((_c = unref(currentItem)) == null ? void 0 : _c.openFile) ? (openBlock(), createBlock(unref(Btn), {
43789
+ ((_c = unref(currentItem)) == null ? void 0 : _c.openFile) && ((_d = unref(currentItem)) == null ? void 0 : _d.src) ? (openBlock(), createBlock(unref(Btn), {
43760
43790
  key: 1,
43761
43791
  class: "color-white",
43762
43792
  round: "",
@@ -43764,10 +43794,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43764
43794
  flat: "",
43765
43795
  iconEnd: "arrow_outward",
43766
43796
  value: "Open File",
43767
- href: (_d = unref(currentItem)) == null ? void 0 : _d.src,
43797
+ href: (_e2 = unref(currentItem)) == null ? void 0 : _e2.src,
43768
43798
  target: "_blank"
43769
43799
  }, null, 8, ["href"])) : createCommentVNode("", true),
43770
- ((_e2 = unref(currentItem)) == null ? void 0 : _e2.download) ? (openBlock(), createBlock(unref(Btn), {
43800
+ ((_f = unref(currentItem)) == null ? void 0 : _f.download) && ((_g = unref(currentItem)) == null ? void 0 : _g.src) ? (openBlock(), createBlock(unref(Btn), {
43771
43801
  key: 2,
43772
43802
  class: "color-white",
43773
43803
  round: "",
@@ -43775,10 +43805,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43775
43805
  flat: "",
43776
43806
  icon: "download",
43777
43807
  value: "Download File",
43778
- href: upgradeHeaders((_f = unref(currentItem)) == null ? void 0 : _f.src),
43808
+ href: upgradeHeaders((_h = unref(currentItem)) == null ? void 0 : _h.src),
43779
43809
  download: ""
43780
43810
  }, null, 8, ["href"])) : createCommentVNode("", true),
43781
- !((_g = unref(currentItem)) == null ? void 0 : _g.openFile) && !((_h = unref(currentItem)) == null ? void 0 : _h.download) ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("", true)
43811
+ !((_i = unref(currentItem)) == null ? void 0 : _i.openFile) && !((_j = unref(currentItem)) == null ? void 0 : _j.download) ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("", true)
43782
43812
  ]),
43783
43813
  createVNode(unref(Carousel), {
43784
43814
  index: unref(currentIndex),
@@ -43803,18 +43833,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43803
43833
  createVNode(unref(Image$1), {
43804
43834
  draggable: false,
43805
43835
  src: item == null ? void 0 : item.src,
43836
+ pathKey: item == null ? void 0 : item.pathKey,
43806
43837
  alt: "Preview",
43807
43838
  class: "vw90 lightbox-image"
43808
- }, null, 8, ["src"])
43839
+ }, null, 8, ["src", "pathKey"])
43809
43840
  ]),
43810
43841
  _: 2
43811
- }, 1032, ["zoom", "disabled"])) : (item == null ? void 0 : item.type) === "video" ? (openBlock(), createBlock(unref(BglVideo), {
43842
+ }, 1032, ["zoom", "disabled"])) : (item == null ? void 0 : item.type) === "video" && (item == null ? void 0 : item.src) ? (openBlock(), createBlock(unref(BglVideo), {
43812
43843
  key: 1,
43813
43844
  src: item == null ? void 0 : item.src,
43814
43845
  autoplay: "",
43815
43846
  controls: "",
43816
43847
  class: "vw90"
43817
- }, null, 8, ["src"])) : (item == null ? void 0 : item.type) === "pdf" ? (openBlock(), createElementBlock("embed", {
43848
+ }, null, 8, ["src"])) : (item == null ? void 0 : item.type) === "pdf" && (item == null ? void 0 : item.src) ? (openBlock(), createElementBlock("embed", {
43818
43849
  key: 2,
43819
43850
  src: unref(normalizeURL)(item == null ? void 0 : item.src),
43820
43851
  type: "application/pdf",
@@ -43886,7 +43917,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43886
43917
  };
43887
43918
  }
43888
43919
  });
43889
- const Lightbox$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f833758f"]]);
43920
+ const Lightbox$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-194584ac"]]);
43890
43921
  const groups = {};
43891
43922
  let clickHandler = (_e2) => void 0;
43892
43923
  const lightboxDirective = {
@@ -44285,7 +44316,8 @@ function findBglFieldById(id, _schema) {
44285
44316
  for (const field of _schema) {
44286
44317
  if (field.id === id) return field;
44287
44318
  if (field.children && Number(field.children.length) > 0) {
44288
- const child = findBglFieldById(id, field.children.filter((c2) => typeof c2 !== "string"));
44319
+ const fieldChildren = field.children.filter((c2) => typeof c2 === "object" && "$el" in c2);
44320
+ const child = findBglFieldById(id, fieldChildren);
44289
44321
  if (child) return child;
44290
44322
  }
44291
44323
  }