@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
61 lines (60 loc) • 2.52 kB
JavaScript
import { jsx as t } from "react/jsx-runtime";
import { useBuilderMode as m } from "../../utils/contexts/BuilderModeContext.js";
import { useStore as s } from "../../utils/contexts/StoreContext.js";
import { isUndefined as c } from "../../utils/tools.js";
import { array as f } from "../annotation/arrayAnnotation.js";
import { containerStyles as u } from "../annotation/containerStyles.js";
import { node as h } from "../annotation/nodeAnnotation.js";
import { string as o } from "../annotation/stringAnnotation.js";
import { toArray as v } from "../annotation/toArray.js";
import { toStyleProperties as a } from "../annotation/toStyleProperties.js";
import { getDefaultCss as n } from "../annotation/utils/getDefaultCss.js";
import { addOrUpdateFeatures as y } from "../define/utils/ComponentFeature.js";
import { cfSkipChildrenDuringFieldCollection as g } from "../define/utils/integratedComponentFeatures.js";
import { Model as x } from "../define/utils/Model.js";
import { RepeaterItem as C } from "./RepeaterItem.js";
import { RepeaterPropsProvider as R } from "./RepeaterPropsContext.js";
const I = (e) => {
const r = m() === "viewer", l = s().parentStore;
return r && !e.children ? null : /* @__PURE__ */ t("div", { className: e.wrapperClassName, children: r || l ? e.children : /* @__PURE__ */ t(C, { children: e.children }) });
}, P = (e) => /* @__PURE__ */ t(R, { value: e, children: /* @__PURE__ */ t(I, { wrapperClassName: e.wrapperClassName, children: e.children }) }), i = "Repeater", S = f.valued.setup({ editor: "arrayOfObject" }), w = v({
itemRenderWhen: o.notLocalize,
value: S,
children: h
}), { flexDirection: d, gap: p } = u, D = a({
display: o.default("flex").hideEditor(),
flexDirection: d.default("column").named("Item direction").hinted("Item direction"),
gap: p.default("20px").named("Item gap").hinted("Item gap")
}), N = n(D), M = a({
display: o.default("flex").hideEditor(),
flexDirection: d.default("column").hinted("Repeater direction"),
gap: p.default("20px").hinted("Repeater gap")
}), F = n(M), O = w.filter((e) => !c(e.default)).reduce((e, r) => (e[r.key] = r.default, e), {}), W = y(
{},
{ name: g, value: !0 }
), X = new x(
P,
i,
void 0,
"value",
"array",
O,
N,
F,
i,
"repeater",
void 0,
void 0,
void 0,
void 0,
void 0,
W
);
export {
D as repeaterItemStyleProperties,
X as repeaterModel,
w as repeaterProps,
S as repeaterValuedAnnotation,
M as repeaterWrapperStyleProperties
};
//# sourceMappingURL=repeaterModel.js.map