@bagelink/vue 0.0.1202 → 0.0.1206
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/form/BagelForm.vue.d.ts.map +1 -1
- package/dist/composables/useSchemaField.d.ts.map +1 -1
- package/dist/index.cjs +19 -32
- package/dist/index.mjs +19 -32
- package/dist/style.css +10 -10
- package/package.json +1 -1
- package/src/components/Carousel.vue +2 -2
- package/src/components/form/BagelForm.vue +1 -34
- package/src/composables/useSchemaField.ts +23 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BagelForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BagelForm.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BagelForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form/BagelForm.vue"],"names":[],"mappings":"AAgHA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,eAAe,CAAA;AAK5D,MAAM,WAAW,cAAc,CAAC,EAAE;IACjC,UAAU,CAAC,EAAE,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAA;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtC;yBAEgB,CAAC,SAAS;IAAC,CAAC,GAAG,EAAC,MAAM,GAAE,GAAG,CAAA;CAAC,eAC/B,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;WA0L1D,mBAAmB,CAAC;;6KAAkE,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB;;;;MAAsB,GAAG,IAAI;WACpE,GAAG;;yBAxCkB,GAAG;;;;;YACJ,GAAG;yBACF,GAAG;uBACL,GAAG;;cA7IzB,mBAAmB,SAAS,CAAC,KAAG,IAAI;OAuL7B,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AApMzE,wBAoM4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,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;IACzD,YAAY,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC;yBA4BzF,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;
|
|
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;IACzD,YAAY,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC;yBA4BzF,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;EAyL9C"}
|
package/dist/index.cjs
CHANGED
|
@@ -748,8 +748,8 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
|
748
748
|
const emit2 = __emit;
|
|
749
749
|
const ANIMATION_TIMINGS = {
|
|
750
750
|
TOUCH: 150,
|
|
751
|
-
MOBILE:
|
|
752
|
-
DESKTOP:
|
|
751
|
+
MOBILE: 420,
|
|
752
|
+
DESKTOP: 840,
|
|
753
753
|
MAX_DURATION: 300,
|
|
754
754
|
BASE_DURATION: 150,
|
|
755
755
|
DURATION_PER_PANEL: 50
|
|
@@ -1182,7 +1182,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
|
|
|
1182
1182
|
};
|
|
1183
1183
|
}
|
|
1184
1184
|
});
|
|
1185
|
-
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-
|
|
1185
|
+
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-d0b0c027"]]);
|
|
1186
1186
|
function _isPlaceholder(a2) {
|
|
1187
1187
|
return a2 != null && typeof a2 === "object" && a2["@@functional/placeholder"] === true;
|
|
1188
1188
|
}
|
|
@@ -7314,6 +7314,20 @@ function useSchemaField(options) {
|
|
|
7314
7314
|
const Component = getComponent(field);
|
|
7315
7315
|
if (!Component) return null;
|
|
7316
7316
|
const rowData = (getRowData == null ? void 0 : getRowData()) || {};
|
|
7317
|
+
const condition = field.vIf ?? field["v-if"];
|
|
7318
|
+
if (condition !== void 0) {
|
|
7319
|
+
if (typeof condition === "function") {
|
|
7320
|
+
if (!condition(field.id ? rowData[field.id] : void 0, rowData)) {
|
|
7321
|
+
return null;
|
|
7322
|
+
}
|
|
7323
|
+
} else if (typeof condition === "string") {
|
|
7324
|
+
if (!rowData[condition]) {
|
|
7325
|
+
return null;
|
|
7326
|
+
}
|
|
7327
|
+
} else if (!condition) {
|
|
7328
|
+
return null;
|
|
7329
|
+
}
|
|
7330
|
+
}
|
|
7317
7331
|
const {
|
|
7318
7332
|
$el,
|
|
7319
7333
|
children: children2,
|
|
@@ -7378,7 +7392,7 @@ function useSchemaField(options) {
|
|
|
7378
7392
|
componentSlots.default = () => children2.map((child) => {
|
|
7379
7393
|
if (typeof child === "string") return child;
|
|
7380
7394
|
return renderField(child, slots);
|
|
7381
|
-
});
|
|
7395
|
+
}).filter(Boolean);
|
|
7382
7396
|
}
|
|
7383
7397
|
if (isSlotValueComponent && transformedValue !== void 0) {
|
|
7384
7398
|
componentSlots.default = () => (transformedValue == null ? void 0 : transformedValue.toString()) || "";
|
|
@@ -11631,18 +11645,6 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
|
|
|
11631
11645
|
formState.value = "error";
|
|
11632
11646
|
}
|
|
11633
11647
|
}
|
|
11634
|
-
function shouldRenderField(field) {
|
|
11635
|
-
const condition = field.vIf ?? field["v-if"];
|
|
11636
|
-
if (condition === void 0) return true;
|
|
11637
|
-
if (typeof condition === "function") {
|
|
11638
|
-
console.log("shouldRenderField", field.id, condition(formData.value[field.id], formData.value));
|
|
11639
|
-
return condition(formData.value[field.id], formData.value);
|
|
11640
|
-
}
|
|
11641
|
-
if (typeof condition === "string") {
|
|
11642
|
-
return !!formData.value[condition];
|
|
11643
|
-
}
|
|
11644
|
-
return !!condition;
|
|
11645
|
-
}
|
|
11646
11648
|
function validateForm() {
|
|
11647
11649
|
if (!form.value) return false;
|
|
11648
11650
|
return form.value.reportValidity();
|
|
@@ -11657,23 +11659,8 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
|
|
|
11657
11659
|
(_a2 = field.onUpdate) == null ? void 0 : _a2.call(field, value, formData.value);
|
|
11658
11660
|
}
|
|
11659
11661
|
});
|
|
11660
|
-
function parseChildren(children2) {
|
|
11661
|
-
if (!children2) return void 0;
|
|
11662
|
-
return children2.map((child) => {
|
|
11663
|
-
if (typeof child === "string") return child;
|
|
11664
|
-
if (!shouldRenderField(child)) return null;
|
|
11665
|
-
if (!child.children) return child;
|
|
11666
|
-
const parsedChildren = parseChildren(child.children);
|
|
11667
|
-
return (parsedChildren == null ? void 0 : parsedChildren.length) ? { ...child, children: parsedChildren } : null;
|
|
11668
|
-
}).filter((child) => child !== null);
|
|
11669
|
-
}
|
|
11670
11662
|
function renderSchemaField(field) {
|
|
11671
|
-
|
|
11672
|
-
if (!shouldRender) return null;
|
|
11673
|
-
return renderField({
|
|
11674
|
-
...field,
|
|
11675
|
-
children: parseChildren(field.children)
|
|
11676
|
-
});
|
|
11663
|
+
return renderField(field);
|
|
11677
11664
|
}
|
|
11678
11665
|
__expose({ form, isDirty: isDirty.value, validateForm });
|
|
11679
11666
|
return (_ctx, _cache) => {
|
package/dist/index.mjs
CHANGED
|
@@ -746,8 +746,8 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
|
746
746
|
const emit2 = __emit;
|
|
747
747
|
const ANIMATION_TIMINGS = {
|
|
748
748
|
TOUCH: 150,
|
|
749
|
-
MOBILE:
|
|
750
|
-
DESKTOP:
|
|
749
|
+
MOBILE: 420,
|
|
750
|
+
DESKTOP: 840,
|
|
751
751
|
MAX_DURATION: 300,
|
|
752
752
|
BASE_DURATION: 150,
|
|
753
753
|
DURATION_PER_PANEL: 50
|
|
@@ -1180,7 +1180,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
|
|
|
1180
1180
|
};
|
|
1181
1181
|
}
|
|
1182
1182
|
});
|
|
1183
|
-
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-
|
|
1183
|
+
const Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-d0b0c027"]]);
|
|
1184
1184
|
function _isPlaceholder(a2) {
|
|
1185
1185
|
return a2 != null && typeof a2 === "object" && a2["@@functional/placeholder"] === true;
|
|
1186
1186
|
}
|
|
@@ -7312,6 +7312,20 @@ function useSchemaField(options) {
|
|
|
7312
7312
|
const Component = getComponent(field);
|
|
7313
7313
|
if (!Component) return null;
|
|
7314
7314
|
const rowData = (getRowData == null ? void 0 : getRowData()) || {};
|
|
7315
|
+
const condition = field.vIf ?? field["v-if"];
|
|
7316
|
+
if (condition !== void 0) {
|
|
7317
|
+
if (typeof condition === "function") {
|
|
7318
|
+
if (!condition(field.id ? rowData[field.id] : void 0, rowData)) {
|
|
7319
|
+
return null;
|
|
7320
|
+
}
|
|
7321
|
+
} else if (typeof condition === "string") {
|
|
7322
|
+
if (!rowData[condition]) {
|
|
7323
|
+
return null;
|
|
7324
|
+
}
|
|
7325
|
+
} else if (!condition) {
|
|
7326
|
+
return null;
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7315
7329
|
const {
|
|
7316
7330
|
$el,
|
|
7317
7331
|
children: children2,
|
|
@@ -7376,7 +7390,7 @@ function useSchemaField(options) {
|
|
|
7376
7390
|
componentSlots.default = () => children2.map((child) => {
|
|
7377
7391
|
if (typeof child === "string") return child;
|
|
7378
7392
|
return renderField(child, slots);
|
|
7379
|
-
});
|
|
7393
|
+
}).filter(Boolean);
|
|
7380
7394
|
}
|
|
7381
7395
|
if (isSlotValueComponent && transformedValue !== void 0) {
|
|
7382
7396
|
componentSlots.default = () => (transformedValue == null ? void 0 : transformedValue.toString()) || "";
|
|
@@ -11629,18 +11643,6 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
11629
11643
|
formState.value = "error";
|
|
11630
11644
|
}
|
|
11631
11645
|
}
|
|
11632
|
-
function shouldRenderField(field) {
|
|
11633
|
-
const condition = field.vIf ?? field["v-if"];
|
|
11634
|
-
if (condition === void 0) return true;
|
|
11635
|
-
if (typeof condition === "function") {
|
|
11636
|
-
console.log("shouldRenderField", field.id, condition(formData.value[field.id], formData.value));
|
|
11637
|
-
return condition(formData.value[field.id], formData.value);
|
|
11638
|
-
}
|
|
11639
|
-
if (typeof condition === "string") {
|
|
11640
|
-
return !!formData.value[condition];
|
|
11641
|
-
}
|
|
11642
|
-
return !!condition;
|
|
11643
|
-
}
|
|
11644
11646
|
function validateForm() {
|
|
11645
11647
|
if (!form.value) return false;
|
|
11646
11648
|
return form.value.reportValidity();
|
|
@@ -11655,23 +11657,8 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
11655
11657
|
(_a2 = field.onUpdate) == null ? void 0 : _a2.call(field, value, formData.value);
|
|
11656
11658
|
}
|
|
11657
11659
|
});
|
|
11658
|
-
function parseChildren(children2) {
|
|
11659
|
-
if (!children2) return void 0;
|
|
11660
|
-
return children2.map((child) => {
|
|
11661
|
-
if (typeof child === "string") return child;
|
|
11662
|
-
if (!shouldRenderField(child)) return null;
|
|
11663
|
-
if (!child.children) return child;
|
|
11664
|
-
const parsedChildren = parseChildren(child.children);
|
|
11665
|
-
return (parsedChildren == null ? void 0 : parsedChildren.length) ? { ...child, children: parsedChildren } : null;
|
|
11666
|
-
}).filter((child) => child !== null);
|
|
11667
|
-
}
|
|
11668
11660
|
function renderSchemaField(field) {
|
|
11669
|
-
|
|
11670
|
-
if (!shouldRender) return null;
|
|
11671
|
-
return renderField({
|
|
11672
|
-
...field,
|
|
11673
|
-
children: parseChildren(field.children)
|
|
11674
|
-
});
|
|
11661
|
+
return renderField(field);
|
|
11675
11662
|
}
|
|
11676
11663
|
__expose({ form, isDirty: isDirty.value, validateForm });
|
|
11677
11664
|
return (_ctx, _cache) => {
|
package/dist/style.css
CHANGED
|
@@ -356,13 +356,13 @@ display: block;
|
|
|
356
356
|
padding: 0;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
.BglCarousel[data-v-
|
|
359
|
+
.BglCarousel[data-v-d0b0c027] {
|
|
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-
|
|
365
|
+
.bgl-slider[data-v-d0b0c027] {
|
|
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-
|
|
378
|
+
.bgl-slider[data-v-d0b0c027] > * {
|
|
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-
|
|
385
|
+
.bgl-slider.slides-1[data-v-d0b0c027] > * {
|
|
386
386
|
flex: 0 0 100%;
|
|
387
387
|
width: 100%;
|
|
388
388
|
min-width: 100%;
|
|
389
389
|
}
|
|
390
|
-
.dragging .bgl-slider[data-v-
|
|
390
|
+
.dragging .bgl-slider[data-v-d0b0c027] > * {
|
|
391
391
|
pointer-events: none;
|
|
392
392
|
user-select: none;
|
|
393
393
|
}
|
|
394
|
-
.autoHeight[data-v-
|
|
394
|
+
.autoHeight[data-v-d0b0c027] {
|
|
395
395
|
transition: height ease 0.7s;
|
|
396
396
|
}
|
|
397
|
-
.dots[data-v-
|
|
397
|
+
.dots[data-v-d0b0c027] {
|
|
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-
|
|
405
|
+
.dot[data-v-d0b0c027] {
|
|
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-
|
|
414
|
+
.dot[data-v-d0b0c027]:hover {
|
|
415
415
|
opacity: 0.6;
|
|
416
416
|
}
|
|
417
|
-
.dot.current[data-v-
|
|
417
|
+
.dot.current[data-v-d0b0c027] {
|
|
418
418
|
opacity: 0.8;
|
|
419
419
|
}
|
|
420
420
|
|
package/package.json
CHANGED
|
@@ -68,22 +68,6 @@ async function handleSubmit() {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
function shouldRenderField(field: Field): boolean {
|
|
72
|
-
const condition = field.vIf ?? field['v-if']
|
|
73
|
-
if (condition === undefined) return true
|
|
74
|
-
|
|
75
|
-
if (typeof condition === 'function') {
|
|
76
|
-
console.log('shouldRenderField', field.id, condition(formData.value[field.id as keyof T], formData.value))
|
|
77
|
-
return condition(formData.value[field.id as keyof T], formData.value)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (typeof condition === 'string') {
|
|
81
|
-
return !!formData.value[condition as keyof T]
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return !!condition
|
|
85
|
-
}
|
|
86
|
-
|
|
87
71
|
function validateForm() {
|
|
88
72
|
if (!form.value) return false
|
|
89
73
|
return form.value.reportValidity()
|
|
@@ -98,26 +82,9 @@ const { renderField } = useSchemaField<T>({
|
|
|
98
82
|
field.onUpdate?.(value, formData.value)
|
|
99
83
|
}
|
|
100
84
|
})
|
|
101
|
-
function parseChildren(children?: (string | Field)[]): (string | Field)[] | undefined {
|
|
102
|
-
if (!children) return undefined
|
|
103
|
-
return children
|
|
104
|
-
.map((child) => {
|
|
105
|
-
if (typeof child === 'string') return child
|
|
106
|
-
if (!shouldRenderField(child)) return null
|
|
107
|
-
if (!child.children) return child
|
|
108
|
-
const parsedChildren = parseChildren(child.children)
|
|
109
|
-
return parsedChildren?.length ? { ...child, children: parsedChildren } : null
|
|
110
|
-
})
|
|
111
|
-
.filter((child): child is string | Field => child !== null)
|
|
112
|
-
}
|
|
113
85
|
|
|
114
86
|
function renderSchemaField(field: Field): VNode | null {
|
|
115
|
-
|
|
116
|
-
if (!shouldRender) return null
|
|
117
|
-
return renderField({
|
|
118
|
-
...field,
|
|
119
|
-
children: parseChildren(field.children)
|
|
120
|
-
})
|
|
87
|
+
return renderField(field)
|
|
121
88
|
}
|
|
122
89
|
|
|
123
90
|
defineExpose({ form, isDirty, validateForm })
|
|
@@ -66,6 +66,22 @@ export function useSchemaField<T extends { [key: string]: any }>(options: UseSch
|
|
|
66
66
|
|
|
67
67
|
const rowData = getRowData?.() || {} as T
|
|
68
68
|
|
|
69
|
+
// Check vIf condition first
|
|
70
|
+
const condition = field.vIf ?? field['v-if']
|
|
71
|
+
if (condition !== undefined) {
|
|
72
|
+
if (typeof condition === 'function') {
|
|
73
|
+
if (!condition(field.id ? rowData[field.id as keyof T] : undefined, rowData)) {
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
} else if (typeof condition === 'string') {
|
|
77
|
+
if (!rowData[condition as keyof T]) {
|
|
78
|
+
return null
|
|
79
|
+
}
|
|
80
|
+
} else if (!condition) {
|
|
81
|
+
return null
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
69
85
|
const {
|
|
70
86
|
$el,
|
|
71
87
|
children,
|
|
@@ -147,15 +163,17 @@ export function useSchemaField<T extends { [key: string]: any }>(options: UseSch
|
|
|
147
163
|
// Handle class binding last to ensure all transformations are applied
|
|
148
164
|
props.class = classify(currentValue, rowData, fieldClass, props.class)
|
|
149
165
|
|
|
150
|
-
// Handle component slots
|
|
166
|
+
// Handle component slots with vIf aware child rendering
|
|
151
167
|
const componentSlots: Record<string, any> = {}
|
|
152
168
|
|
|
153
169
|
// Add default slot if there are children
|
|
154
170
|
if (children?.length) {
|
|
155
|
-
componentSlots.default = () => children
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
171
|
+
componentSlots.default = () => children
|
|
172
|
+
.map((child) => {
|
|
173
|
+
if (typeof child === 'string') return child
|
|
174
|
+
return renderField(child, slots)
|
|
175
|
+
})
|
|
176
|
+
.filter(Boolean) // Filter out null results from vIf
|
|
159
177
|
}
|
|
160
178
|
|
|
161
179
|
// For slot value components, add the transformed value as default slot content
|