@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
49 lines (48 loc) • 1.45 kB
JavaScript
import { DataValidator as l } from "../validation/utils/DataValidator.js";
import { ProxyField as m } from "../validation/utils/ProxyField.js";
import { typedValidatorsResolver as g } from "../validation/utils/validatorsResolver.js";
import { emptyPropertiesContext as x } from "./emptyPropertiesContext.js";
import { getFieldPropertiesContext as V } from "./getFieldPropertiesContext.js";
const v = (e, t, d, o) => {
const r = e.getValidationRules(d), i = (s) => e.localizeErrorMessages(t.dataRoot, t.store, s);
return l.create(
e,
() => t.dataRoot,
g(r),
t.store.schema,
o,
i
);
}, D = (e, t, d) => {
const { store: o, model: r } = e, i = r.valued;
if (!i || r.dataBindingType === "none") return x;
if (r.dataBindingType === "oneWay")
return {
get valueProperty() {
if (o.disableDataBinding?.value !== !0)
return {
propertyName: i,
get propertyValue() {
const { dataKey: a, rowData: n } = t;
return a ? n?.[a] : void 0;
}
};
},
cellInfo: t
};
const s = () => t.dataKey ? t.rowData?.[t.dataKey] : void 0, u = (a) => {
t.dataKey && t.rowData && (t.rowData[t.dataKey] = a);
}, y = (a, n) => v(d, e, a, n), p = new m(
s,
u,
y,
o,
r,
!1
);
return V(p, r, t);
};
export {
D as getCellInfoPropertiesContext
};
//# sourceMappingURL=getCellInfoPropertiesContext.js.map