@bagelink/vue 1.0.41 → 1.0.47

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.vue.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.vue"],"names":[],"mappings":"AA2dA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAY/D,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAA;AAC5C,MAAM,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,eAAe,EAAE,CAAA;yBAEtC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAChC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAwU1D,mBAAmB,CAAC;;;;;;;;;;wBArNV,MAAM,EAAE;0CAqNoE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;UAnD0E,GAAG;UAqDjF,2TAAoC;OAG/B,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAlVzE,wBAkV4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"DataTable.vue.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.vue"],"names":[],"mappings":"AA+dA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAY/D,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAA;AAC5C,MAAM,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,eAAe,EAAE,CAAA;yBAEtC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,eAChC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAiV1D,mBAAmB,CAAC;;;;;;;;;;wBA7NV,MAAM,EAAE;0CA6NoE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;UApD0E,GAAG;UAsDjF,2TAAoC;OAG/B,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA3VzE,wBA2V4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -22,6 +22,7 @@ export declare function useTableData<T extends Record<string, any>>(options: Use
22
22
  sortDirection: ComputedRef<SortDirectionsT>;
23
23
  toggleSort: (fieldname: string) => void;
24
24
  cleanTransformedData: <T_1 extends Record<string, any>>(data: TransformedData<T_1>) => T_1;
25
+ schemaState: ComputedRef<"error" | "loading" | "loaded">;
25
26
  };
26
27
  export {};
27
28
  //# sourceMappingURL=useTableData.d.ts.map
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AC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC;;;yBA6F9D,CAAC,KAAG,eAAe,CAAC,CAAC,CAAC;;;4BA2FnB,MAAM;uCAzDG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,eAAe,CAAC,GAAC,CAAC,KAAG,GAAC;;EAiFzF"}
@@ -1,5 +1,5 @@
1
1
  import { AttributeFn, AttributeValue, Attributes, BagelFieldOptions, BglFormSchemaFnT, Field } from '../..';
2
- declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
2
+ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
4
  readonly "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
5
5
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue"> & {
@@ -18,8 +18,9 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
18
18
  add?: boolean;
19
19
  delete?: boolean;
20
20
  transform?: (value: T) => T;
21
- schema: BglFormSchemaFnT;
21
+ schema?: BglFormSchemaFnT;
22
22
  modelValue: T[];
23
+ type?: "object" | "number" | "text";
23
24
  } & Partial<{}>> & import('vue').PublicProps;
24
25
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
25
26
  attrs: any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AC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
package/dist/index.cjs CHANGED
@@ -1628,7 +1628,7 @@ const _hoisted_10$7 = {
1628
1628
  key: 4,
1629
1629
  class: "event-flyout__row is-topic"
1630
1630
  };
1631
- const _hoisted_11$6 = {
1631
+ const _hoisted_11$7 = {
1632
1632
  key: 5,
1633
1633
  class: "event-flyout__row is-description"
1634
1634
  };
@@ -1855,7 +1855,7 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
1855
1855
  }, null, 8, ["icon"]),
1856
1856
  vue.createTextVNode(" " + vue.toDisplayString(calendarEvent.value.topic), 1)
1857
1857
  ])) : vue.createCommentVNode("", true),
1858
- calendarEvent.value.description ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$6, [
1858
+ calendarEvent.value.description ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$7, [
1859
1859
  vue.createVNode(vue.unref(_sfc_main$s), {
1860
1860
  icon: icons.description
1861
1861
  }, null, 8, ["icon"]),
@@ -10688,6 +10688,8 @@ const SRC_VALUE_COMPONENTS = /* @__PURE__ */ new Set(["img", "iframe"]);
10688
10688
  function useTableData(options) {
10689
10689
  const sortField = vue.ref("");
10690
10690
  const sortDirection = vue.ref("ASC");
10691
+ const schemaState = vue.ref("loading");
10692
+ const resolvedSchema = vue.ref([]);
10691
10693
  function getValue(value) {
10692
10694
  if (value === void 0 || value === null) {
10693
10695
  return void 0;
@@ -10702,31 +10704,50 @@ function useTableData(options) {
10702
10704
  return void 0;
10703
10705
  }
10704
10706
  }
10705
- const computedSchema = vue.computed(() => {
10706
- const dataValue = options.data.value || [];
10707
- const schema = useBglSchema({
10708
- schema: getValue(options.schema),
10709
- columns: getValue(options.columns),
10710
- data: dataValue
10711
- });
10712
- if (Array.isArray(schema) && schema.length > 0) {
10713
- return schema.filter((field) => field && field.id);
10714
- }
10715
- if (Array.isArray(dataValue) && dataValue.length > 0) {
10716
- const firstItem = dataValue[0];
10717
- return Object.keys(firstItem || {}).filter((key) => key !== "id" && !key.startsWith("_")).map((key) => ({
10718
- id: key,
10719
- label: keyToLabel(key),
10720
- $el: "div",
10721
- transform: (val) => {
10722
- const dateFields = ["created_at", "updated_at"];
10723
- if (dateFields.includes(key)) return val ? new Date(val).toLocaleString() : val;
10724
- return val;
10725
- }
10726
- }));
10707
+ async function resolveSchemaAsync() {
10708
+ try {
10709
+ schemaState.value = "loading";
10710
+ const dataValue = options.data.value || [];
10711
+ const schema = await useBglSchema({
10712
+ schema: getValue(options.schema),
10713
+ columns: getValue(options.columns),
10714
+ data: dataValue
10715
+ });
10716
+ if (Array.isArray(schema) && schema.length > 0) {
10717
+ resolvedSchema.value = schema.filter((field) => field && field.id);
10718
+ } else if (Array.isArray(dataValue) && dataValue.length > 0) {
10719
+ const firstItem = dataValue[0];
10720
+ resolvedSchema.value = Object.keys(firstItem || {}).filter((key) => key !== "id" && !key.startsWith("_")).map((key) => ({
10721
+ id: key,
10722
+ label: keyToLabel(key),
10723
+ $el: "div",
10724
+ transform: (val) => {
10725
+ const dateFields = ["created_at", "updated_at"];
10726
+ if (dateFields.includes(key)) return val ? new Date(val).toLocaleString() : val;
10727
+ return val;
10728
+ }
10729
+ }));
10730
+ } else {
10731
+ resolvedSchema.value = [];
10732
+ }
10733
+ schemaState.value = "loaded";
10734
+ } catch (error) {
10735
+ console.error("Error resolving schema:", error);
10736
+ schemaState.value = "error";
10737
+ resolvedSchema.value = [];
10727
10738
  }
10728
- return [];
10739
+ }
10740
+ vue.watch([
10741
+ () => getValue(options.schema),
10742
+ () => getValue(options.columns),
10743
+ () => options.data.value
10744
+ ], () => {
10745
+ resolveSchemaAsync();
10746
+ }, { immediate: true });
10747
+ vue.onMounted(() => {
10748
+ resolveSchemaAsync();
10729
10749
  });
10750
+ const computedSchema = vue.computed(() => resolvedSchema.value);
10730
10751
  function transform(rowData) {
10731
10752
  const transformed = { ...rowData };
10732
10753
  const schemaFields = computedSchema.value.filter((f2) => f2.id);
@@ -10808,7 +10829,8 @@ function useTableData(options) {
10808
10829
  sortField: vue.computed(() => sortField.value),
10809
10830
  sortDirection: vue.computed(() => sortDirection.value),
10810
10831
  toggleSort,
10811
- cleanTransformedData
10832
+ cleanTransformedData,
10833
+ schemaState: vue.computed(() => schemaState.value)
10812
10834
  };
10813
10835
  }
10814
10836
  const _hoisted_1$P = { class: "data-preview" };
@@ -11512,15 +11534,19 @@ const _hoisted_1$O = {
11512
11534
  key: 0,
11513
11535
  class: "loading-table-wrapper z-99 h-100 w-100 absolute inset"
11514
11536
  };
11515
- const _hoisted_2$A = { class: "infinite-wrapper" };
11516
- const _hoisted_3$u = { class: "row first-row" };
11517
- const _hoisted_4$k = { key: 0 };
11518
- const _hoisted_5$j = ["onClick"];
11519
- const _hoisted_6$g = { class: "flex" };
11520
- const _hoisted_7$c = ["onClick"];
11521
- const _hoisted_8$7 = { key: 0 };
11522
- const _hoisted_9$6 = ["value"];
11523
- const _hoisted_10$6 = { key: 1 };
11537
+ const _hoisted_2$A = {
11538
+ key: 1,
11539
+ class: "flex-center h-300px txt-red"
11540
+ };
11541
+ const _hoisted_3$u = { class: "infinite-wrapper" };
11542
+ const _hoisted_4$k = { class: "row first-row" };
11543
+ const _hoisted_5$j = { key: 0 };
11544
+ const _hoisted_6$g = ["onClick"];
11545
+ const _hoisted_7$c = { class: "flex" };
11546
+ const _hoisted_8$7 = ["onClick"];
11547
+ const _hoisted_9$6 = { key: 0 };
11548
+ const _hoisted_10$6 = ["value"];
11549
+ const _hoisted_11$6 = { key: 1 };
11524
11550
  const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11525
11551
  __name: "DataTable",
11526
11552
  props: /* @__PURE__ */ vue.mergeModels({
@@ -11541,7 +11567,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11541
11567
  emits: /* @__PURE__ */ vue.mergeModels(["orderBy", "select", "lastItemVisible"], ["update:loading", "update:itemHeight", "update:selectedItems"]),
11542
11568
  setup(__props, { emit: __emit }) {
11543
11569
  vue.useCssVars((_ctx) => ({
11544
- "31aad8d2": vue.unref(computedItemHeight)
11570
+ "03db8ce0": vue.unref(computedItemHeight)
11545
11571
  }));
11546
11572
  const props2 = __props;
11547
11573
  const emit2 = __emit;
@@ -11559,7 +11585,8 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11559
11585
  sortField,
11560
11586
  sortDirection,
11561
11587
  toggleSort,
11562
- cleanTransformedData
11588
+ cleanTransformedData,
11589
+ schemaState
11563
11590
  } = useTableData({ data: data2, schema, columns, useServerSort, onSort: (field, direction) => {
11564
11591
  emit2("orderBy", `${field} ${direction}`.trim());
11565
11592
  } });
@@ -11630,14 +11657,14 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11630
11657
  );
11631
11658
  return (_ctx, _cache) => {
11632
11659
  return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({ class: "table-list-wrap h-100" }, vue.unref(containerProps), {
11633
- class: { "loading-table": loading.value }
11660
+ class: { "loading-table": loading.value || vue.unref(schemaState) === "loading" }
11634
11661
  }), [
11635
- loading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$O, _cache[4] || (_cache[4] = [
11662
+ loading.value || vue.unref(schemaState) === "loading" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$O, _cache[4] || (_cache[4] = [
11636
11663
  vue.createElementVNode("div", { class: "loading-table-animation absolute oval" }, null, -1)
11637
- ]))) : (vue.openBlock(), vue.createElementBlock("div", vue.normalizeProps(vue.mergeProps({ key: 1 }, vue.unref(wrapperProps))), [
11638
- vue.createElementVNode("table", _hoisted_2$A, [
11639
- vue.createElementVNode("thead", _hoisted_3$u, [
11640
- vue.unref(isSelectable) ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_4$k, [
11664
+ ]))) : vue.unref(schemaState) === "error" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$A, " Error loading table schema ")) : (vue.openBlock(), vue.createElementBlock("div", vue.normalizeProps(vue.mergeProps({ key: 2 }, vue.unref(wrapperProps))), [
11665
+ vue.createElementVNode("table", _hoisted_3$u, [
11666
+ vue.createElementVNode("thead", _hoisted_4$k, [
11667
+ vue.unref(isSelectable) ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_5$j, [
11641
11668
  vue.createElementVNode("input", {
11642
11669
  ref_key: "allSelectorEl",
11643
11670
  ref: allSelectorEl,
@@ -11654,7 +11681,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11654
11681
  class: "col",
11655
11682
  onClick: ($event) => vue.unref(toggleSort)((field == null ? void 0 : field.id) || "")
11656
11683
  }, [
11657
- vue.createElementVNode("div", _hoisted_6$g, [
11684
+ vue.createElementVNode("div", _hoisted_7$c, [
11658
11685
  vue.createTextVNode(vue.toDisplayString(field.label || vue.unref(keyToLabel)(field == null ? void 0 : field.id)) + " ", 1),
11659
11686
  vue.createElementVNode("div", {
11660
11687
  class: vue.normalizeClass(["list-arrows", { sorted: vue.unref(sortField) === (field == null ? void 0 : field.id) }])
@@ -11665,7 +11692,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11665
11692
  }, null, 8, ["class"])
11666
11693
  ], 2)
11667
11694
  ])
11668
- ], 8, _hoisted_5$j);
11695
+ ], 8, _hoisted_6$g);
11669
11696
  }), 128))
11670
11697
  ]),
11671
11698
  vue.createElementVNode("tbody", null, [
@@ -11675,7 +11702,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11675
11702
  class: vue.normalizeClass(["row row-item position-relative", { selected: (row == null ? void 0 : row.id) && vue.unref(computedSelectedItems).includes(row.id) }]),
11676
11703
  onClick: ($event) => vue.unref(toggleSelectItem)(row)
11677
11704
  }, [
11678
- vue.unref(isSelectable) ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_8$7, [
11705
+ vue.unref(isSelectable) ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_9$6, [
11679
11706
  vue.createElementVNode("div", {
11680
11707
  onClick: _cache[3] || (_cache[3] = vue.withModifiers(() => {
11681
11708
  }, ["stop"]))
@@ -11684,7 +11711,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11684
11711
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => selectedItems.value = $event),
11685
11712
  type: "checkbox",
11686
11713
  value: (row == null ? void 0 : row.id) || ""
11687
- }, null, 8, _hoisted_9$6), [
11714
+ }, null, 8, _hoisted_10$6), [
11688
11715
  [vue.vModelCheckbox, selectedItems.value]
11689
11716
  ])
11690
11717
  ])
@@ -11698,12 +11725,12 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11698
11725
  key: 0,
11699
11726
  row,
11700
11727
  field
11701
- }, void 0, true) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$6, [
11728
+ }, void 0, true) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$6, [
11702
11729
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderFieldForRow(field, row))))
11703
11730
  ]))
11704
11731
  ]);
11705
11732
  }), 128))
11706
- ], 10, _hoisted_7$c);
11733
+ ], 10, _hoisted_8$7);
11707
11734
  }), 128)),
11708
11735
  props2.onLastItemVisible !== void 0 ? (vue.openBlock(), vue.createElementBlock("tr", {
11709
11736
  key: 0,
@@ -11718,7 +11745,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
11718
11745
  };
11719
11746
  }
11720
11747
  });
11721
- const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-43f28baa"]]);
11748
+ const DataTable = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-30ec790f"]]);
11722
11749
  function useDraggable(options = {}) {
11723
11750
  const isDragging = vue.ref(false);
11724
11751
  const dragElement = vue.ref(null);
@@ -15131,13 +15158,16 @@ function findBglFieldById(id, _schema) {
15131
15158
  }
15132
15159
  return void 0;
15133
15160
  }
15134
- function arrField(id, label, schema, options) {
15161
+ function arrField(id, label, schemaOrType, options) {
15162
+ const attrs = { delete: true, add: true, ...options };
15163
+ if (typeof schemaOrType === "string") attrs.type = schemaOrType;
15164
+ else attrs.schema = schemaOrType;
15135
15165
  return {
15136
15166
  label,
15137
15167
  id,
15138
15168
  $el: "array",
15139
15169
  vIf: options == null ? void 0 : options.vIf,
15140
- attrs: { schema, delete: true, add: true, ...options }
15170
+ attrs
15141
15171
  };
15142
15172
  }
15143
15173
  const bagelFormUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -15516,18 +15546,18 @@ const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
15516
15546
  };
15517
15547
  }
15518
15548
  });
15519
- const _hoisted_1$L = { class: "label mb-05" };
15520
- const _hoisted_2$y = {
15549
+ const _hoisted_1$L = {
15521
15550
  key: 0,
15522
- class: "ps-025 border-start mb-05"
15551
+ class: "label mb-05"
15523
15552
  };
15553
+ const _hoisted_2$y = { class: "ps-025 border-start mb-05" };
15524
15554
  const _hoisted_3$t = {
15525
15555
  key: 0,
15526
15556
  class: "flex-center h-300px"
15527
15557
  };
15528
15558
  const _hoisted_4$j = {
15529
15559
  key: 1,
15530
- class: "flex-center h-300px txt-red"
15560
+ class: "py-1"
15531
15561
  };
15532
15562
  const _hoisted_5$i = {
15533
15563
  key: 0,
@@ -15553,7 +15583,8 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15553
15583
  delete: { type: Boolean, default: true },
15554
15584
  transform: {},
15555
15585
  schema: {},
15556
- modelValue: {}
15586
+ modelValue: {},
15587
+ type: { default: "object" }
15557
15588
  },
15558
15589
  emits: ["update:modelValue"],
15559
15590
  setup(__props, { emit: __emit }) {
@@ -15563,7 +15594,23 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15563
15594
  const internalData = vue.ref(props2.modelValue || []);
15564
15595
  const schemaState = vue.ref("loaded");
15565
15596
  const resolvedSchemaData = vue.ref([]);
15597
+ vue.watch(() => props2.modelValue, (newValue) => {
15598
+ internalData.value = newValue || [];
15599
+ }, { deep: true });
15600
+ const primitiveSchema = vue.computed(() => {
15601
+ if (props2.type === "text") {
15602
+ return [{ id: "value", type: "text", label: "" }];
15603
+ } else if (props2.type === "number") {
15604
+ return [{ id: "value", type: "number", label: "" }];
15605
+ }
15606
+ return [];
15607
+ });
15566
15608
  async function resolveSchema() {
15609
+ if (props2.type !== "object") {
15610
+ resolvedSchemaData.value = primitiveSchema.value;
15611
+ schemaState.value = "loaded";
15612
+ return;
15613
+ }
15567
15614
  if (!props2.schema) {
15568
15615
  resolvedSchemaData.value = [];
15569
15616
  schemaState.value = "loaded";
@@ -15587,9 +15634,7 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15587
15634
  resolvedSchemaData.value = [];
15588
15635
  }
15589
15636
  }
15590
- vue.onMounted(() => {
15591
- resolveSchema();
15592
- });
15637
+ vue.onMounted(resolveSchema);
15593
15638
  function emitValue() {
15594
15639
  emit2("update:modelValue", internalData.value);
15595
15640
  }
@@ -15598,25 +15643,46 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15598
15643
  emitValue();
15599
15644
  }
15600
15645
  function addItem() {
15601
- internalData.value.push({});
15646
+ const defaultValues = {
15647
+ text: "",
15648
+ number: 0,
15649
+ object: {}
15650
+ };
15651
+ internalData.value.push(defaultValues[props2.type]);
15602
15652
  emitValue();
15603
15653
  }
15604
15654
  function toggleMinimized(index2) {
15605
15655
  minimizedItems.value[index2] = !minimizedItems.value[index2];
15606
15656
  }
15607
15657
  function updateItem(index2, value) {
15608
- internalData.value[index2] = value;
15658
+ if (props2.type === "text" || props2.type === "number") {
15659
+ internalData.value[index2] = props2.type === "number" ? Number(value.value) : value.value;
15660
+ } else {
15661
+ internalData.value[index2] = value;
15662
+ }
15609
15663
  emitValue();
15610
15664
  }
15665
+ const isPrimitiveType = vue.computed(() => props2.type === "text" || props2.type === "number");
15666
+ const canRenderItems = vue.computed(
15667
+ () => isPrimitiveType.value || props2.type === "object" && resolvedSchemaData.value.length > 0
15668
+ );
15669
+ const showMinimizeButton = vue.computed(() => resolvedSchemaData.value.length > 4);
15611
15670
  return (_ctx, _cache) => {
15671
+ const _component_Icon = vue.resolveComponent("Icon");
15612
15672
  return vue.openBlock(), vue.createElementBlock("div", {
15613
15673
  class: vue.normalizeClass(props2.class)
15614
15674
  }, [
15615
- vue.createElementVNode("p", _hoisted_1$L, vue.toDisplayString(_ctx.label), 1),
15616
- resolvedSchemaData.value.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$y, [
15617
- schemaState.value === "loading" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$t, [
15618
- vue.createVNode(vue.unref(Loading))
15619
- ])) : schemaState.value === "error" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$j, " Error ")) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
15675
+ _ctx.label ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_1$L, vue.toDisplayString(_ctx.label), 1)) : vue.createCommentVNode("", true),
15676
+ vue.createElementVNode("div", _hoisted_2$y, [
15677
+ schemaState.value !== "loaded" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$t, [
15678
+ schemaState.value === "loading" ? (vue.openBlock(), vue.createBlock(vue.unref(Loading), { key: 0 })) : schemaState.value === "error" ? (vue.openBlock(), vue.createBlock(_component_Icon, {
15679
+ key: 1,
15680
+ icon: "error",
15681
+ color: "red"
15682
+ })) : vue.createCommentVNode("", true)
15683
+ ])) : !canRenderItems.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$j, _cache[0] || (_cache[0] = [
15684
+ vue.createElementVNode("p", { class: "opacity-7" }, " No schema available ", -1)
15685
+ ]))) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
15620
15686
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(internalData.value, (item, i2) => {
15621
15687
  return vue.openBlock(), vue.createElementBlock("div", {
15622
15688
  key: i2,
@@ -15626,12 +15692,12 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15626
15692
  }, [
15627
15693
  minimizedItems.value[i2] ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_5$i, vue.toDisplayString(_ctx.label) + " " + vue.toDisplayString(i2 + 1), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$T), {
15628
15694
  key: 1,
15629
- "model-value": item,
15695
+ "model-value": isPrimitiveType.value ? { value: item } : item,
15630
15696
  schema: resolvedSchemaData.value,
15631
15697
  "onUpdate:modelValue": (val) => updateItem(i2, val)
15632
15698
  }, null, 8, ["model-value", "schema", "onUpdate:modelValue"])),
15633
15699
  vue.createElementVNode("div", _hoisted_6$f, [
15634
- resolvedSchemaData.value.length > 4 ? (vue.openBlock(), vue.createBlock(vue.unref(Btn), {
15700
+ showMinimizeButton.value ? (vue.openBlock(), vue.createBlock(vue.unref(Btn), {
15635
15701
  key: 0,
15636
15702
  class: "block rotate-180 txt10 opacity-7 p-025",
15637
15703
  flat: "",
@@ -15664,11 +15730,7 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15664
15730
  _: 1
15665
15731
  })) : vue.createCommentVNode("", true)
15666
15732
  ], 64))
15667
- ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(internalData.value, (_2, i2) => {
15668
- return vue.openBlock(), vue.createElementBlock("div", { key: i2 }, _cache[0] || (_cache[0] = [
15669
- vue.createElementVNode("p", null, "No schema available", -1)
15670
- ]));
15671
- }), 128))
15733
+ ])
15672
15734
  ], 2);
15673
15735
  };
15674
15736
  }