@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) • 1.78 kB
JavaScript
import { AnnotationBuilder as i } from "./AnnotationBuilder.js";
class n extends i {
/**
* The function that checks whether a child component can be inserted into a parent component.
*/
insertPredicate;
/**
* The default editor.
*/
defaultEditor;
/**
* Creates a component property metadata builder.
* @param editor the property editor type.
* @template T the property type.
*/
constructor(t) {
super(t);
}
/**
* Specifies a function that will create conditions that check if a child component can be bound to a parent slot.
* @param slotConditionBuilder the function that returns a string containing the source code of the function to bind child components.
* @returns the instance of the metadata property builder.
*/
withSlotConditionBuilder(t) {
return this.setup({ slotConditionBuilder: t });
}
/**
* @inheritDoc
*/
build(t) {
const e = super.build(t);
return e.insertPredicate = this.insertPredicate, e.defaultEditor = this.defaultEditor, e;
}
/**
* Specifies a function that checks whether a child component can be inserted into a parent component.
* @param predicate the function that returns a boolean value.
* @returns the modified instance of the builder.
*/
withInsertRestriction(t) {
const e = this.clone();
return e.insertPredicate = t, e;
}
/**
* Specifies the default editor for the property.
* @param defaultEditor the default editor.
* @returns the modified instance of the builder.
*/
withDefaultEditor(t) {
const e = this.clone();
return e.defaultEditor = t, e;
}
}
function d(r) {
return new n(r);
}
export {
n as NodeAnnotationBuilder,
d as createNodeAnnotation
};
//# sourceMappingURL=NodeAnnotationBuilder.js.map