Migrate ABViewForm#715
Conversation
…he included plugins directory
|
Please add one release label: |
… in view_form plugin
johnny-hausman
left a comment
There was a problem hiding this comment.
You are definitely tackling a big project and you are off to a good start.
OK, So I have a thought about how we might make this a little less verbose.
What if we do two things:
-
make each of our Form items manage their own Core version. For example we let ABViewFormButton internally prepare it's ABViewFormButtonCore value.
-
we make a FormAPI value, that packages the necessary objects that all our related form items need.
If we do that, then we could simplify some of this setup to be like:
First, create a "barrel" file:
view_form/FormComponents.js:
export { default as FNAbviewformButton } from "./FNAbviewformButton.js";
export { default as FNAbviewformCheckbox } from "./FNAbviewformCheckbox.js";
export { default as FNAbviewformConnect } from "./FNAbviewformConnect.js";
export { default as FNAbviewformCustom } from "./FNAbviewformCustom.js";
export { default as FNAbviewformDatepicker } from "./FNAbviewformDatepicker.js";
export { default as FNAbviewformItem } from "./FNAbviewformItem.js";
export { default as FNAbviewformJson } from "./FNAbviewformJson.js";
export { default as FNAbviewformNumber } from "./FNAbviewformNumber.js";
export { default as FNAbviewformReadonly } from "./FNAbviewformReadonly.js";
export { default as FNAbviewformSelectMultiple } from "./FNAbviewformSelectMultiple.js";
export { default as FNAbviewformSelectSingle } from "./FNAbviewformSelectSingle.js";
export { default as FNAbviewformTree } from "./FNAbviewformTree.js";
export { default as FNAbviewformTextbox } from "./FNAbviewformTextbox.js";
export { default as FNAbviewformURL } from "./FNAbviewformURL.js";
Then your view_form/ABviewform.js would have:
let FormAPI = {
ABViewComponentPlugin,
ABViewFormItemComponent,
ABViewPropertyAddPage,
ABViewPropertyEditPage,
ABFieldImage,
FocusableTemplate,
}
import * as fObjs from "./FormComponents.js";
let views = Object.values(fObjs).map((FNv) => FNv(FormAPI));
views.forEach((v) => {
v.getPluginKey = () => v.common().key;
v.getPluginType = () => "view";
});
This could reduce some of the code in the main file and make things easier to read/follow.
Lighthouse Performance ReportMetrics📄Full Report |
Moved the form system to a more modern structure and fixed several display and data bugs.
Relate PR.
CruGlobal/appbuilder_class_core#339
CruGlobal/plugin_ABDesigner#348