Skip to content

Migrate ABViewForm#715

Open
benthongtiang wants to merge 17 commits into
masterfrom
ben/FormPlugin
Open

Migrate ABViewForm#715
benthongtiang wants to merge 17 commits into
masterfrom
ben/FormPlugin

Conversation

@benthongtiang

@benthongtiang benthongtiang commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Moved the form system to a more modern structure and fixed several display and data bugs.

  1. Moved to Plugin System
  • Moved all Form files (Buttons, Textboxes, dropdowns, etc.) into a new "Plugin" folder.
  • Separated the code into Core (logic) and Components (the UI you see).
  1. Visual & UI Fixes
  • Tree Fields: Fixed the Tree view in forms to look exactly like the old version.
  • JSON Fields: Fixed the issue where it showed [object Object]. Now it shows readable text.
  • Grid Editing: You can now click and edit JSON data directly in the data grid.
  • Text Formatting: Fixed long text and JSON to keep their line breaks and spacing in the Detail view.
  1. Bug Fixes
  • Data Protection: Fixed a bug where data in the Grid would disappear after opening a Detail view.
  • Tree Data: Improved how the system reads Tree values so they don't get lost when you edit a record.
  • Broken Code: Fixed several "undefined variable" errors found during code testing (linting).
  1. Code Cleanup
  • Removed old, unused code.
  • Simplified how different parts of the form talk to each other to make the system faster.

Relate PR.
CruGlobal/appbuilder_class_core#339
CruGlobal/plugin_ABDesigner#357

@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Please add one release label:
major (for breaking changes), minor (for new features), patch (for bug fixes) or skip-release (to skip the auto release process).

Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewform.js Fixed

@johnny-hausman johnny-hausman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. make each of our Form items manage their own Core version. For example we let ABViewFormButton internally prepare it's ABViewFormButtonCore value.

  2. 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.

Comment thread AppBuilder/platform/plugins/included/view_form/core/ABViewFormItemCore.js Outdated
Comment thread AppBuilder/platform/plugins/included/view_form/core/ABViewFormJsonCore.js Outdated
Comment thread AppBuilder/platform/plugins/included/view_form/core/ABViewFormNumberCore.js Outdated
Comment thread AppBuilder/platform/plugins/included/view_form/core/ABViewFormReadonlyCore.js Outdated
Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewform.js Outdated
Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewform.js
Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewform.js Outdated
Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewformButton.js Outdated
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Lighthouse Performance Report

Metrics





📄Full Report
Note: Above values are an average of 3 reports, only the last report was uploaded.

@benthongtiang benthongtiang added major Tag Pull Requests to trigger a major version update minor Tag Pull Requests to trigger a minor version update and removed major Tag Pull Requests to trigger a major version update labels Apr 24, 2026

@Hiro-Nakamura Hiro-Nakamura left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! That was a lot of files.

Here are a few things to review:

Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewformTree.js Outdated
Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewform.js
Comment thread AppBuilder/platform/plugins/included/view_form/FNAbviewform.js Outdated
Comment thread AppBuilder/platform/views/viewComponent/ABViewGridComponent.js Outdated
Comment thread AppBuilder/platform/ABClassManager.js Outdated
# Conflicts:
#	AppBuilder/core
#	AppBuilder/platform/views/ABViewKanbanFormSidePanel.js
#	package-lock.json
#	package.json
Comment thread AppBuilder/platform/plugins/included/index.js Fixed
# Conflicts:
#	AppBuilder/platform/ABClassManager.js
#	AppBuilder/platform/dataFields/ABFieldList.js
#	AppBuilder/platform/plugins/included/index.js

@johnny-hausman johnny-hausman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes look good.

What about the Pending Comments?

ABViewDataviewPropertyComponentDefaults.detailsTab;
this.settings.editTab =
this.settings.editTab ||
ABViewDataviewPropertyComponentDefaults.editTab;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I know this is how the original code was, but now that they are in the same file, it is easy to see that we are just reduplicating work in both of these, .fromValues() methods.

Update these to be ?? instead of || and remove the redundant checks down below.

this.settings.detailsTab =
this.settings.detailsTab ?? ABViewDataviewDefaults.detailsTab;
this.settings.editTab =
this.settings.editTab ?? ABViewDataviewDefaults.editTab;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant checks

import FNABViewDetailComponent from "../view_detail/FNAbviewdetailComponent.js";

export default function FNAbviewdataviewComponent({
/*AB,*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably uncomment this AB here so you can reference it below.

this.initDetailComponent();

const ids = this.ids;
const L = (...params) => (this.AB ?? AB).Multilingual.label(...params);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uncomment that /* AB */ above and it will be accessible here.

clearTimeout(this.__throttleRefreshWarning);

this.__throttleRefreshWarning = setTimeout(() => {
$$(this.ids.reload)?.show();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add a:

delete this.__throttleRefreshWarning;

here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Tag Pull Requests to trigger a minor version update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants