@bagelink/vue 0.0.602 → 0.0.610

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.
Files changed (31) hide show
  1. package/dist/components/DataPreview.vue.d.ts +6 -0
  2. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  3. package/dist/components/Drop.vue.d.ts +34 -0
  4. package/dist/components/Drop.vue.d.ts.map +1 -0
  5. package/dist/components/FileUploader.vue.d.ts +60 -0
  6. package/dist/components/FileUploader.vue.d.ts.map +1 -0
  7. package/dist/components/TableSchema.vue.d.ts.map +1 -1
  8. package/dist/components/form/ItemRef.vue.d.ts +1 -0
  9. package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
  10. package/dist/components/form/inputs/FileUpload.vue.d.ts +11 -11
  11. package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
  12. package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/SignaturePad.vue.d.ts.map +1 -1
  14. package/dist/composables/index.d.ts +2 -0
  15. package/dist/composables/index.d.ts.map +1 -1
  16. package/dist/index.cjs +94 -49
  17. package/dist/index.mjs +95 -50
  18. package/dist/style.css +70 -72
  19. package/dist/utils/index.d.ts.map +1 -1
  20. package/package.json +13 -13
  21. package/src/components/DataPreview.vue +49 -21
  22. package/src/components/TableSchema.vue +14 -12
  23. package/src/components/form/inputs/FileUpload.vue +1 -1
  24. package/src/components/form/inputs/SignaturePad.vue +3 -2
  25. package/src/composables/index.ts +14 -0
  26. package/src/utils/index.ts +2 -1
  27. package/tsconfig.json +2 -0
  28. package/dist/components/Popover.vue.d.ts +0 -10
  29. package/dist/components/Popover.vue.d.ts.map +0 -1
  30. package/dist/types/materialIcon.d.ts +0 -2
  31. package/dist/types/materialIcon.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  var __defProp2 = Object.defineProperty;
2
2
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, createElementBlock, normalizeClass, renderSlot, normalizeProps, guardReactiveProps, withScopeId, resolveComponent, normalizeStyle, withKeys, createElementVNode, Fragment as Fragment$1, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h as h$2, toDisplayString, reactive, computed, inject, unref, renderList, resolveDynamicComponent, useCssVars, useSlots, withModifiers, createTextVNode, watch, onMounted, onUnmounted, mergeModels, useModel, createSlots, Transition, getCurrentScope, onScopeDispose, getCurrentInstance, shallowRef, withDirectives, isRef, vModelCheckbox, provide, toRef, Teleport, render as render$f, onBeforeUpdate, vShow, TransitionGroup, vModelDynamic, vModelText, vModelRadio, onBeforeUnmount, watchEffect, markRaw, customRef, resolveDirective } from "vue";
4
+ import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, createElementBlock, normalizeClass, renderSlot, normalizeProps, guardReactiveProps, withScopeId, resolveComponent, normalizeStyle, withKeys, createElementVNode, Fragment as Fragment$1, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h as h$2, toDisplayString, reactive, computed, inject, watch, unref, renderList, resolveDynamicComponent, useCssVars, useSlots, withModifiers, createTextVNode, onMounted, onUnmounted, mergeModels, useModel, createSlots, Transition, getCurrentScope, onScopeDispose, getCurrentInstance, shallowRef, withDirectives, isRef, vModelCheckbox, provide, toRef, Teleport, render as render$f, onBeforeUpdate, vShow, TransitionGroup, vModelDynamic, vModelText, vModelRadio, onBeforeUnmount, watchEffect, markRaw, customRef, resolveDirective } from "vue";
5
5
  const sides = ["top", "right", "bottom", "left"];
6
6
  const alignments = ["start", "end"];
7
7
  const placements$1 = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
@@ -5262,7 +5262,8 @@ function debounce$2(fn3, delay = 500) {
5262
5262
  timeout = setTimeout(fn3, delay);
5263
5263
  }
5264
5264
  function keyToLabel(key) {
5265
- return (key == null ? void 0 : key.split("_").map((k2) => k2.charAt(0).toUpperCase() + k2.slice(1)).join(" ")) || key;
5265
+ if (key === void 0) return key;
5266
+ return key.split("_").map((k2) => k2.charAt(0).toUpperCase() + k2.slice(1)).join(" ") || key;
5266
5267
  }
5267
5268
  async function copyText(text, cb) {
5268
5269
  await navigator.clipboard.writeText(text);
@@ -5416,6 +5417,15 @@ function useBglSchema({ schema, showFields, data: data2 } = {}) {
5416
5417
  }
5417
5418
  return getFallbackSchema(data2, showFields);
5418
5419
  }
5420
+ function useLocalStorage(key, initialValue) {
5421
+ const storedValue = localStorage.getItem(key);
5422
+ const initial = storedValue ? JSON.parse(storedValue) : initialValue;
5423
+ const value = ref(initial);
5424
+ watch(() => value.value, (val) => {
5425
+ localStorage.setItem(key, JSON.stringify(val));
5426
+ }, { immediate: true, deep: true });
5427
+ return value;
5428
+ }
5419
5429
  const _sfc_main$O = /* @__PURE__ */ defineComponent({
5420
5430
  __name: "MaterialIcon",
5421
5431
  props: {
@@ -6347,7 +6357,7 @@ function useVerticalVirtualList(options, list) {
6347
6357
  containerRef
6348
6358
  };
6349
6359
  }
6350
- const _withScopeId$3 = (n2) => (pushScopeId("data-v-73d79ea6"), n2 = n2(), popScopeId(), n2);
6360
+ const _withScopeId$3 = (n2) => (pushScopeId("data-v-d01cb754"), n2 = n2(), popScopeId(), n2);
6351
6361
  const _hoisted_1$C = {
6352
6362
  key: 0,
6353
6363
  class: "loading-table-wrapper z-99 h-100 w-100 absolute inset"
@@ -6381,7 +6391,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6381
6391
  emits: /* @__PURE__ */ mergeModels(["update:selectedItems", "orderBy", "select"], ["update:loading", "update:itemHeight"]),
6382
6392
  setup(__props, { emit: __emit }) {
6383
6393
  useCssVars((_ctx) => ({
6384
- "59d71ad2": unref(computedItemHiehgt)
6394
+ "02b73339": unref(computedItemHiehgt)
6385
6395
  }));
6386
6396
  const props2 = __props;
6387
6397
  const emit2 = __emit;
@@ -6482,7 +6492,11 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6482
6492
  }
6483
6493
  function toggleSelectItem(item) {
6484
6494
  if (!computedSelectedItems.value.length) {
6485
- emit2("select", item);
6495
+ const obj = { ...item };
6496
+ Object.keys(obj).forEach((key) => {
6497
+ if (key.startsWith("_transformed_")) delete obj[key];
6498
+ });
6499
+ emit2("select", obj);
6486
6500
  return;
6487
6501
  }
6488
6502
  const index2 = computedSelectedItems.value.indexOf(item.id);
@@ -6582,7 +6596,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
6582
6596
  };
6583
6597
  }
6584
6598
  });
6585
- const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-73d79ea6"]]);
6599
+ const TableSchema = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-d01cb754"]]);
6586
6600
  const _sfc_main$E = {};
6587
6601
  const _hoisted_1$B = { class: "flex space-between" };
6588
6602
  function _sfc_render$1(_ctx, _cache) {
@@ -6625,16 +6639,23 @@ const _hoisted_2$s = {
6625
6639
  const _hoisted_3$i = { class: "key" };
6626
6640
  const _hoisted_4$c = { class: "m-0" };
6627
6641
  const _hoisted_5$c = { key: 1 };
6628
- const _hoisted_6$7 = { class: "key" };
6629
- const _hoisted_7$3 = { class: "m-0" };
6630
- const _hoisted_8$1 = { class: "vlue" };
6631
- const _hoisted_9$1 = { class: "m-0" };
6642
+ const _hoisted_6$7 = {
6643
+ key: 0,
6644
+ class: "data-row"
6645
+ };
6646
+ const _hoisted_7$3 = { class: "key" };
6647
+ const _hoisted_8$1 = { class: "m-0" };
6648
+ const _hoisted_9$1 = {
6649
+ key: 0,
6650
+ class: "m-0"
6651
+ };
6632
6652
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
6633
6653
  __name: "DataPreview",
6634
6654
  props: /* @__PURE__ */ mergeModels({
6635
6655
  showFields: {},
6636
6656
  schema: {},
6637
- title: {}
6657
+ title: {},
6658
+ excludeUnset: { type: Boolean }
6638
6659
  }, {
6639
6660
  "data": { default: {} },
6640
6661
  "dataModifiers": {}
@@ -6643,12 +6664,25 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6643
6664
  setup(__props) {
6644
6665
  const props2 = __props;
6645
6666
  const itemData = useModel(__props, "data");
6646
- const computedSchema = computed(
6647
- () => getFallbackSchema(
6648
- [itemData.value],
6649
- props2.showFields
6650
- )
6651
- );
6667
+ function dataTransform(dataValue) {
6668
+ if (!dataValue) return dataValue;
6669
+ if (Array.isArray(dataValue)) return dataValue.map(dataTransform);
6670
+ if (typeof dataValue === "object") {
6671
+ Object.keys(dataValue).forEach((key) => {
6672
+ dataValue[key] = dataTransform(dataValue[key]);
6673
+ });
6674
+ }
6675
+ if (typeof dataValue === "string" && /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(dataValue)) {
6676
+ const date2 = new Date(dataValue);
6677
+ return date2.toDateString();
6678
+ }
6679
+ return dataValue;
6680
+ }
6681
+ function isUnset(value) {
6682
+ if (!props2.excludeUnset) return false;
6683
+ return value === void 0 || value === null || value === "" || value.length === 0;
6684
+ }
6685
+ const computedSchema = computed(() => getFallbackSchema([itemData.value], props2.showFields));
6652
6686
  return (_ctx, _cache) => {
6653
6687
  var _a2;
6654
6688
  return __props.data ? (openBlock(), createElementBlock("div", _hoisted_1$A, [
@@ -6676,17 +6710,16 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6676
6710
  }), 128)),
6677
6711
  !((_a2 = _ctx.schema) == null ? void 0 : _a2.length) ? (openBlock(), createElementBlock("div", _hoisted_5$c, [
6678
6712
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(computedSchema.value, ({ id, label }) => {
6679
- return openBlock(), createElementBlock("div", {
6680
- key: id,
6681
- class: "data-row"
6682
- }, [
6683
- createElementVNode("div", _hoisted_6$7, [
6684
- createElementVNode("p", _hoisted_7$3, toDisplayString(label), 1)
6685
- ]),
6686
- createElementVNode("div", _hoisted_8$1, [
6687
- createElementVNode("p", _hoisted_9$1, toDisplayString(itemData.value[id ?? ""]), 1)
6688
- ])
6689
- ]);
6713
+ return openBlock(), createElementBlock(Fragment$1, { key: id }, [
6714
+ !isUnset(itemData.value[id]) ? (openBlock(), createElementBlock("div", _hoisted_6$7, [
6715
+ createElementVNode("div", _hoisted_7$3, [
6716
+ createElementVNode("p", _hoisted_8$1, toDisplayString(label), 1)
6717
+ ]),
6718
+ createElementVNode("div", null, [
6719
+ id ? (openBlock(), createElementBlock("p", _hoisted_9$1, toDisplayString(dataTransform(itemData.value[id])), 1)) : createCommentVNode("", true)
6720
+ ])
6721
+ ])) : createCommentVNode("", true)
6722
+ ], 64);
6690
6723
  }), 128))
6691
6724
  ])) : createCommentVNode("", true),
6692
6725
  renderSlot(_ctx.$slots, "footer", {}, void 0, true)
@@ -6694,7 +6727,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
6694
6727
  };
6695
6728
  }
6696
6729
  });
6697
- const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-792f7ec0"]]);
6730
+ const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-0ffde6c7"]]);
6698
6731
  const _hoisted_1$z = {
6699
6732
  key: 0,
6700
6733
  class: "card_label"
@@ -28863,7 +28896,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
28863
28896
  }
28864
28897
  });
28865
28898
  const RadioPillsInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-681173be"]]);
28866
- const _withScopeId$2 = (n2) => (pushScopeId("data-v-5409803c"), n2 = n2(), popScopeId(), n2);
28899
+ const _withScopeId$2 = (n2) => (pushScopeId("data-v-6716fd45"), n2 = n2(), popScopeId(), n2);
28867
28900
  const _hoisted_1$j = { class: "bagel-input" };
28868
28901
  const _hoisted_2$e = {
28869
28902
  key: 0,
@@ -29107,7 +29140,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
29107
29140
  };
29108
29141
  }
29109
29142
  });
29110
- const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-5409803c"]]);
29143
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-6716fd45"]]);
29111
29144
  const _withScopeId$1 = (n2) => (pushScopeId("data-v-eceeebfb"), n2 = n2(), popScopeId(), n2);
29112
29145
  const _hoisted_1$i = ["title"];
29113
29146
  const _hoisted_2$d = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "slider round" }, null, -1));
@@ -41452,7 +41485,7 @@ const getTextContentFromNodes = ($from, maxMatch = 500) => {
41452
41485
  parent,
41453
41486
  index: index2
41454
41487
  })) || node.textContent || "%leaf%";
41455
- textBefore += chunk.slice(0, Math.max(0, sliceEndPos - pos));
41488
+ textBefore += node.isAtom ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
41456
41489
  });
41457
41490
  return textBefore;
41458
41491
  };
@@ -44360,6 +44393,11 @@ let Editor$1 = class Editor2 extends EventEmitter {
44360
44393
  }
44361
44394
  const state2 = this.state.apply(transaction);
44362
44395
  const selectionHasChanged = !this.state.selection.eq(state2.selection);
44396
+ this.emit("beforeTransaction", {
44397
+ editor: this,
44398
+ transaction,
44399
+ nextState: state2
44400
+ });
44363
44401
  this.view.updateState(state2);
44364
44402
  this.emit("transaction", {
44365
44403
  editor: this,
@@ -49821,12 +49859,12 @@ function useDebouncedRef(value) {
49821
49859
  class Editor extends Editor$1 {
49822
49860
  constructor(options = {}) {
49823
49861
  super(options);
49824
- this.vueRenderers = reactive(/* @__PURE__ */ new Map());
49825
49862
  this.contentComponent = null;
49863
+ this.appContext = null;
49826
49864
  this.reactiveState = useDebouncedRef(this.view.state);
49827
49865
  this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage);
49828
- this.on("transaction", () => {
49829
- this.reactiveState.value = this.view.state;
49866
+ this.on("beforeTransaction", ({ nextState }) => {
49867
+ this.reactiveState.value = nextState;
49830
49868
  this.reactiveExtensionStorage.value = this.extensionStorage;
49831
49869
  });
49832
49870
  return markRaw(this);
@@ -49873,6 +49911,16 @@ const EditorContent = defineComponent({
49873
49911
  const element = unref(rootEl2.value);
49874
49912
  rootEl2.value.append(...editor.options.element.childNodes);
49875
49913
  editor.contentComponent = instance.ctx._;
49914
+ if (instance) {
49915
+ editor.appContext = {
49916
+ ...instance.appContext,
49917
+ provides: {
49918
+ // @ts-ignore
49919
+ ...instance.provides,
49920
+ ...instance.appContext.provides
49921
+ }
49922
+ };
49923
+ }
49876
49924
  editor.setOptions({
49877
49925
  element
49878
49926
  });
@@ -49891,6 +49939,7 @@ const EditorContent = defineComponent({
49891
49939
  });
49892
49940
  }
49893
49941
  editor.contentComponent = null;
49942
+ editor.appContext = null;
49894
49943
  if (!editor.options.element.firstChild) {
49895
49944
  return;
49896
49945
  }
@@ -49903,24 +49952,11 @@ const EditorContent = defineComponent({
49903
49952
  return { rootEl: rootEl2 };
49904
49953
  },
49905
49954
  render() {
49906
- const vueRenderers = [];
49907
- if (this.editor) {
49908
- this.editor.vueRenderers.forEach((vueRenderer) => {
49909
- const node = h$2(Teleport, {
49910
- to: vueRenderer.teleportElement,
49911
- key: vueRenderer.id
49912
- }, h$2(vueRenderer.component, {
49913
- ref: vueRenderer.id,
49914
- ...vueRenderer.props
49915
- }));
49916
- vueRenderers.push(node);
49917
- });
49918
- }
49919
49955
  return h$2("div", {
49920
49956
  ref: (el) => {
49921
49957
  this.rootEl = el;
49922
49958
  }
49923
- }, ...vueRenderers);
49959
+ });
49924
49960
  }
49925
49961
  });
49926
49962
  defineComponent({
@@ -56307,10 +56343,18 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
56307
56343
  });
56308
56344
  return (_ctx, _cache) => {
56309
56345
  return openBlock(), createElementBlock("div", {
56310
- class: "bgl_input signature-pad",
56346
+ class: "bgl_input signature-pad relative",
56311
56347
  onTouchmove: _cache[0] || (_cache[0] = withModifiers(() => {
56312
56348
  }, ["prevent"]))
56313
56349
  }, [
56350
+ !_ctx.disabled ? (openBlock(), createBlock(unref(Btn), {
56351
+ key: 0,
56352
+ flat: "",
56353
+ thin: "",
56354
+ icon: "refresh",
56355
+ class: "position-bottom-end",
56356
+ onClick: clear
56357
+ })) : createCommentVNode("", true),
56314
56358
  createElementVNode("canvas", {
56315
56359
  ref_key: "vCanvas",
56316
56360
  ref: vCanvas,
@@ -63615,5 +63659,6 @@ export {
63615
63659
  useEscape,
63616
63660
  useI18nT,
63617
63661
  useLang,
63662
+ useLocalStorage,
63618
63663
  useModal
63619
63664
  };