@bagelink/vue 0.0.1161 → 0.0.1165

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":"Carousel.vue.d.ts","sourceRoot":"","sources":["../../src/components/Carousel.vue"],"names":[],"mappings":"AAgzBA,iBAAS,IAAI,SAIZ;AAED,iBAAS,IAAI,SAIZ;AAmZD,iBAAS,cAAc;WAyFT,OAAO,IAA6B;;yBAbrB,GAAG;;;;YACN,GAAG;;;;YACH,GAAG;;;;;;EAgB5B;AAmCD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmBnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAEpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"Carousel.vue.d.ts","sourceRoot":"","sources":["../../src/components/Carousel.vue"],"names":[],"mappings":"AA8yBA,iBAAS,IAAI,SAIZ;AAED,iBAAS,IAAI,SAIZ;AAmZD,iBAAS,cAAc;WAyFT,OAAO,IAA6B;;yBAbrB,GAAG;;;;YACN,GAAG;;;;YACH,GAAG;;;;;;EAgB5B;AAmCD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmBnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAEpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { BglFormSchemaFnT } from '../..';
2
2
  interface Props {
3
- modelValue: Record<string, any>;
3
+ modelValue?: Record<string, any>;
4
4
  schema?: BglFormSchemaFnT;
5
5
  }
6
6
  declare function handleSubmit(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"BagelForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BagelForm.vue"],"names":[],"mappings":"AAAA,OAkGO,KAAK,EAAkB,gBAAgB,EAAS,MAAM,eAAe,CAAA;AAK5E,UAAU,KAAK;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B,MAAM,CAAC,EAAE,gBAAgB,CAAA;CACzB;AA0CD,iBAAS,YAAY,SAGpB;AAUD,iBAAS,YAAY,YAGpB;AA0BD,iBAAS,cAAc;WA6CT,OAAO,IAA6B;;yBAZrB,GAAG;;;;;YACJ,GAAG;;;;;;EAgB9B;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;YAxJX,gBAAgB;gBADb,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;mBAoK9B,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"BagelForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BagelForm.vue"],"names":[],"mappings":"AAoGA,OAAO,KAAK,EAAkB,gBAAgB,EAAS,MAAM,eAAe,CAAA;AAK5E,UAAU,KAAK;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CACzB;AA4CD,iBAAS,YAAY,SAGpB;AAUD,iBAAS,YAAY,YAGpB;AA0BD,iBAAS,cAAc;WA6CT,OAAO,IAA6B;;yBAZrB,GAAG;;;;;YACJ,GAAG;;;;;;EAgB9B;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;YA1JX,gBAAgB;gBADZ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;mBAsK/B,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSchemaField.d.ts","sourceRoot":"","sources":["../../src/composables/useSchemaField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAwBxD,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;CACzD;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC;yBA4BtF,cAAc,CAAC,CAAC,CAAC,UAChB,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;KAAE,KAAK,GAAG,CAAC,KAC1E,KAAK,GAAG,IAAI;0BA3Bc,cAAc,CAAC,CAAC,CAAC;EA8J9C"}
1
+ {"version":3,"file":"useSchemaField.d.ts","sourceRoot":"","sources":["../../src/composables/useSchemaField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAwBxD,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;CACzD;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC;yBA4BtF,cAAc,CAAC,CAAC,CAAC,UAChB,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;KAAE,KAAK,GAAG,CAAC,KAC1E,KAAK,GAAG,IAAI;0BA3Bc,cAAc,CAAC,CAAC,CAAC;EAkK9C"}
package/dist/index.cjs CHANGED
@@ -1176,7 +1176,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
1176
1176
  };
1177
1177
  }
1178
1178
  });
1179
- const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-1ae4b9ae"]]);
1179
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-b4d71e9e"]]);
1180
1180
  function _isPlaceholder(a2) {
1181
1181
  return a2 != null && typeof a2 === "object" && a2["@@functional/placeholder"] === true;
1182
1182
  }
@@ -7356,7 +7356,11 @@ function useSchemaField(options) {
7356
7356
  const boundAttrs = bindAttrs(field.attrs, currentValue, rowData);
7357
7357
  Object.entries(boundAttrs).forEach(([key, value]) => {
7358
7358
  if (typeof value === "function") {
7359
- props2[key] = value(currentValue, rowData);
7359
+ if (key.startsWith("on")) {
7360
+ props2[key] = value;
7361
+ } else {
7362
+ props2[key] = value(currentValue, rowData);
7363
+ }
7360
7364
  } else {
7361
7365
  props2[key] = value;
7362
7366
  }
@@ -11568,7 +11572,7 @@ const Flag = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-f99
11568
11572
  const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
11569
11573
  __name: "BagelForm",
11570
11574
  props: {
11571
- modelValue: { default: () => ({}) },
11575
+ modelValue: { default: void 0 },
11572
11576
  schema: { default: void 0 }
11573
11577
  },
11574
11578
  emits: ["update:modelValue", "submit"],
@@ -11576,10 +11580,12 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
11576
11580
  const props2 = __props;
11577
11581
  const emit2 = __emit;
11578
11582
  const form = vue.ref();
11579
- let formData = vue.ref({ ...props2.modelValue });
11580
- let initialFormData = vue.ref({ ...props2.modelValue });
11583
+ let formData = vue.ref(props2.modelValue ? { ...props2.modelValue } : {});
11584
+ let initialFormData = vue.ref(props2.modelValue ? { ...props2.modelValue } : {});
11581
11585
  vue.watch(() => props2.modelValue, (newValue) => {
11582
- formData.value = { ...newValue };
11586
+ if (newValue !== void 0) {
11587
+ formData.value = { ...newValue };
11588
+ }
11583
11589
  }, { immediate: true, deep: true });
11584
11590
  const resolvedSchema = vue.computed(() => {
11585
11591
  if (!props2.schema) return void 0;
@@ -21638,7 +21644,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
21638
21644
  const emit2 = __emit;
21639
21645
  let numberValue = vue.ref(Number.parseFloat(`${__props.modelValue}`) || void 0);
21640
21646
  const btnLayouts = ["horizontal", "vertical"];
21641
- const canAdd = vue.computed(() => !(__props.max !== void 0 && (numberValue.value || 0 + __props.step) > __props.max));
21647
+ const canAdd = vue.computed(() => !(__props.max !== void 0 && (numberValue.value || 0) + __props.step > __props.max));
21642
21648
  const canDecrement = vue.computed(() => !(__props.min !== void 0 && (numberValue.value || 0 - __props.step) < __props.min));
21643
21649
  function increment() {
21644
21650
  if (!canAdd.value) return;
@@ -21774,7 +21780,7 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
21774
21780
  };
21775
21781
  }
21776
21782
  });
21777
- const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-8ae5f930"]]);
21783
+ const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-eddf76f4"]]);
21778
21784
  const _hoisted_1$y = ["value", "autofocus", "onKeydown", "onPaste"];
21779
21785
  const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
21780
21786
  __name: "OTP",
package/dist/index.mjs CHANGED
@@ -1174,7 +1174,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
1174
1174
  };
1175
1175
  }
1176
1176
  });
1177
- const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-1ae4b9ae"]]);
1177
+ const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-b4d71e9e"]]);
1178
1178
  function _isPlaceholder(a2) {
1179
1179
  return a2 != null && typeof a2 === "object" && a2["@@functional/placeholder"] === true;
1180
1180
  }
@@ -7354,7 +7354,11 @@ function useSchemaField(options) {
7354
7354
  const boundAttrs = bindAttrs(field.attrs, currentValue, rowData);
7355
7355
  Object.entries(boundAttrs).forEach(([key, value]) => {
7356
7356
  if (typeof value === "function") {
7357
- props2[key] = value(currentValue, rowData);
7357
+ if (key.startsWith("on")) {
7358
+ props2[key] = value;
7359
+ } else {
7360
+ props2[key] = value(currentValue, rowData);
7361
+ }
7358
7362
  } else {
7359
7363
  props2[key] = value;
7360
7364
  }
@@ -11566,7 +11570,7 @@ const Flag = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-f99
11566
11570
  const _sfc_main$R = /* @__PURE__ */ defineComponent({
11567
11571
  __name: "BagelForm",
11568
11572
  props: {
11569
- modelValue: { default: () => ({}) },
11573
+ modelValue: { default: void 0 },
11570
11574
  schema: { default: void 0 }
11571
11575
  },
11572
11576
  emits: ["update:modelValue", "submit"],
@@ -11574,10 +11578,12 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
11574
11578
  const props2 = __props;
11575
11579
  const emit2 = __emit;
11576
11580
  const form = ref();
11577
- let formData = ref({ ...props2.modelValue });
11578
- let initialFormData = ref({ ...props2.modelValue });
11581
+ let formData = ref(props2.modelValue ? { ...props2.modelValue } : {});
11582
+ let initialFormData = ref(props2.modelValue ? { ...props2.modelValue } : {});
11579
11583
  watch(() => props2.modelValue, (newValue) => {
11580
- formData.value = { ...newValue };
11584
+ if (newValue !== void 0) {
11585
+ formData.value = { ...newValue };
11586
+ }
11581
11587
  }, { immediate: true, deep: true });
11582
11588
  const resolvedSchema = computed(() => {
11583
11589
  if (!props2.schema) return void 0;
@@ -21636,7 +21642,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
21636
21642
  const emit2 = __emit;
21637
21643
  let numberValue = ref(Number.parseFloat(`${__props.modelValue}`) || void 0);
21638
21644
  const btnLayouts = ["horizontal", "vertical"];
21639
- const canAdd = computed(() => !(__props.max !== void 0 && (numberValue.value || 0 + __props.step) > __props.max));
21645
+ const canAdd = computed(() => !(__props.max !== void 0 && (numberValue.value || 0) + __props.step > __props.max));
21640
21646
  const canDecrement = computed(() => !(__props.min !== void 0 && (numberValue.value || 0 - __props.step) < __props.min));
21641
21647
  function increment() {
21642
21648
  if (!canAdd.value) return;
@@ -21772,7 +21778,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
21772
21778
  };
21773
21779
  }
21774
21780
  });
21775
- const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-8ae5f930"]]);
21781
+ const NumberInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-eddf76f4"]]);
21776
21782
  const _hoisted_1$y = ["value", "autofocus", "onKeydown", "onPaste"];
21777
21783
  const _sfc_main$F = /* @__PURE__ */ defineComponent({
21778
21784
  __name: "OTP",
package/dist/style.css CHANGED
@@ -356,13 +356,13 @@ display: block;
356
356
  padding: 0;
357
357
  }
358
358
 
359
- .BglCarousel[data-v-1ae4b9ae] {
359
+ .BglCarousel[data-v-b4d71e9e] {
360
360
  position: relative;
361
361
  width: 100%;
362
362
  overflow: hidden;
363
363
  touch-action: pan-y pinch-zoom; /* Allow vertical scrolling */
364
364
  }
365
- .bgl-slider[data-v-1ae4b9ae] {
365
+ .bgl-slider[data-v-b4d71e9e] {
366
366
  display: flex;
367
367
  position: relative;
368
368
  width: 100%;
@@ -375,26 +375,26 @@ display: block;
375
375
  -webkit-user-select: none;
376
376
  user-select: none;
377
377
  }
378
- .bgl-slider[data-v-1ae4b9ae] > * {
378
+ .bgl-slider[data-v-b4d71e9e] > * {
379
379
  flex: 0 0 calc((100% - (var(--item-count) - 1) * 1%) / var(--item-count));
380
380
  width: calc((100% - (var(--item-count) - 1) * 1%) / var(--item-count));
381
381
  min-width: calc((100% - (var(--item-count) - 1) * 1%) / var(--item-count));
382
382
  position: relative;
383
383
  overflow: hidden;
384
384
  }
385
- .bgl-slider.slides-1[data-v-1ae4b9ae] > * {
385
+ .bgl-slider.slides-1[data-v-b4d71e9e] > * {
386
386
  flex: 0 0 100%;
387
387
  width: 100%;
388
388
  min-width: 100%;
389
389
  }
390
- .dragging .bgl-slider[data-v-1ae4b9ae] > * {
390
+ .dragging .bgl-slider[data-v-b4d71e9e] > * {
391
391
  pointer-events: none;
392
392
  user-select: none;
393
393
  }
394
- .autoHeight[data-v-1ae4b9ae] {
394
+ .autoHeight[data-v-b4d71e9e] {
395
395
  transition: height ease 0.7s;
396
396
  }
397
- .dots[data-v-1ae4b9ae] {
397
+ .dots[data-v-b4d71e9e] {
398
398
  display: flex;
399
399
  justify-content: center;
400
400
  align-items: center;
@@ -402,7 +402,7 @@ display: block;
402
402
  margin-top: 1rem;
403
403
  gap: 8px;
404
404
  }
405
- .dot[data-v-1ae4b9ae] {
405
+ .dot[data-v-b4d71e9e] {
406
406
  height: 10px;
407
407
  width: 10px;
408
408
  border-radius: 50%;
@@ -411,10 +411,10 @@ display: block;
411
411
  transition: opacity 0.3s ease;
412
412
  cursor: pointer;
413
413
  }
414
- .dot[data-v-1ae4b9ae]:hover {
414
+ .dot[data-v-b4d71e9e]:hover {
415
415
  opacity: 0.6;
416
416
  }
417
- .dot.current[data-v-1ae4b9ae] {
417
+ .dot.current[data-v-b4d71e9e] {
418
418
  opacity: 0.8;
419
419
  }
420
420
 
@@ -1240,14 +1240,14 @@ pre code.hljs{
1240
1240
  direction: ltr;
1241
1241
  }
1242
1242
 
1243
- .txtInputIconStart .iconStart[data-v-8ae5f930] {
1243
+ .txtInputIconStart .iconStart[data-v-eddf76f4] {
1244
1244
  color: var(--input-color);
1245
1245
  position: absolute;
1246
1246
  inset-inline-start:calc(var(--input-height) / 3 - 0.25rem);
1247
1247
  margin-top: calc(var(--input-height) / 2 );
1248
1248
  line-height: 0;
1249
1249
  }
1250
- .textInputSpinnerWrap .spinner[data-v-8ae5f930] {
1250
+ .textInputSpinnerWrap .spinner[data-v-eddf76f4] {
1251
1251
  color: var(--input-color);
1252
1252
  position: absolute;
1253
1253
  inset-inline-end: 0;
@@ -1257,18 +1257,18 @@ pre code.hljs{
1257
1257
  flex-direction: column;
1258
1258
  gap: 0;
1259
1259
  }
1260
- .top-bgl-ctrl-num-btn[data-v-8ae5f930]{
1260
+ .top-bgl-ctrl-num-btn[data-v-eddf76f4]{
1261
1261
  margin-top: calc(var(--input-height) / 10) !important;
1262
1262
  }
1263
- .bgl-ctrl-num-btn[data-v-8ae5f930]{
1263
+ .bgl-ctrl-num-btn[data-v-eddf76f4]{
1264
1264
  height: calc(var(--input-height) / 2.5) !important;
1265
1265
  isolation: isolate;
1266
1266
  }
1267
- .bgl-big-ctrl-num-btn[data-v-8ae5f930]{
1267
+ .bgl-big-ctrl-num-btn[data-v-eddf76f4]{
1268
1268
  width: 100% !important;
1269
1269
  isolation: isolate;
1270
1270
  }
1271
- .bgl-number-input[data-v-8ae5f930]{
1271
+ .bgl-number-input[data-v-eddf76f4]{
1272
1272
  padding-inline-end: 1.75rem !important;
1273
1273
  }
1274
1274
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.1161",
4
+ "version": "0.0.1165",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -56,7 +56,6 @@ let lastTime = $ref(0)
56
56
  let swipeVelocity = $ref(0)
57
57
  let accumulatedDeltaX = $ref(0)
58
58
 
59
- // Timers
60
59
  let timeout: NodeJS.Timeout
61
60
  let wheelTimeout: NodeJS.Timeout
62
61
  let autoPlayInterval: NodeJS.Timeout
@@ -1,16 +1,16 @@
1
1
  <script setup lang="ts">
2
2
  import type { BglFormSchemaT, BglFormSchemaFnT, Field } from '@bagelink/vue'
3
3
  import type { VNode } from 'vue'
4
- import { h, watch } from 'vue'
4
+ import { watch } from 'vue'
5
5
  import { useSchemaField } from '../../composables/useSchemaField'
6
6
 
7
7
  interface Props {
8
- modelValue: Record<string, any>
8
+ modelValue?: Record<string, any>
9
9
  schema?: BglFormSchemaFnT
10
10
  }
11
11
 
12
12
  const props = withDefaults(defineProps<Props>(), {
13
- modelValue: () => ({}),
13
+ modelValue: undefined,
14
14
  schema: undefined
15
15
  })
16
16
 
@@ -20,12 +20,14 @@ const emit = defineEmits<{
20
20
  }>()
21
21
 
22
22
  const form = $ref<HTMLFormElement>()
23
- let formData = $ref({ ...props.modelValue })
24
- let initialFormData = $ref({ ...props.modelValue })
23
+ let formData = $ref(props.modelValue ? { ...props.modelValue } : {})
24
+ let initialFormData = $ref(props.modelValue ? { ...props.modelValue } : {})
25
25
 
26
- // Keep formData in sync with modelValue prop
26
+ // Keep formData in sync with modelValue prop only if it's provided
27
27
  watch(() => props.modelValue, (newValue) => {
28
- formData = { ...newValue }
28
+ if (newValue !== undefined) {
29
+ formData = { ...newValue }
30
+ }
29
31
  }, { immediate: true, deep: true })
30
32
 
31
33
  const resolvedSchema = $computed<BglFormSchemaT | undefined>(() => {
@@ -48,7 +48,7 @@ let numberValue = $ref(Number.parseFloat(`${modelValue}`) || undefined)
48
48
 
49
49
  const btnLayouts: NumberLayout[] = ['horizontal', 'vertical']
50
50
 
51
- const canAdd = $computed(() => !(max !== undefined && (numberValue || 0 + step) > max))
51
+ const canAdd = $computed(() => !(max !== undefined && ((numberValue || 0) + step) > max))
52
52
  const canDecrement = $computed(() => !(min !== undefined && (numberValue || 0 - step) < min))
53
53
 
54
54
  // Methods
@@ -132,7 +132,11 @@ export function useSchemaField<T extends Record<string, any>>(options: UseSchema
132
132
  const boundAttrs = bindAttrs(field.attrs, currentValue, rowData)
133
133
  Object.entries(boundAttrs).forEach(([key, value]) => {
134
134
  if (typeof value === 'function') {
135
- props[key] = value(currentValue, rowData)
135
+ if (key.startsWith('on')) {
136
+ props[key] = value
137
+ } else {
138
+ props[key] = value(currentValue, rowData)
139
+ }
136
140
  } else {
137
141
  props[key] = value
138
142
  }