Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dynamic Form] Implement @class extensibility for DynamicForm and DynamicField, add onPreRender delegate. #1794

Open
2 of 3 tasks
Ruslan-Urban opened this issue Mar 21, 2024 · 2 comments
Labels
status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:enhancement New feature or enhancement of existing capability

Comments

@Ruslan-Urban
Copy link

Ruslan-Urban commented Mar 21, 2024

Category

  • Enhancement
  • Bug
  • Question

Version [ 3.17.0 ]

Expected / Desired Behavior / Question

IDynamicFormProps and IDynamicFieldProps should have property class that should be appended to the default class style in the render() method, if specified.

IDynamicFormProps needs to have an optional onPreRender(state: IDynamicFormState) delegate that is going to be called before render(). This will allow applying business logic (making fields required, disabled, hidden) and dynamic styles (via class value) to fields depending on current field values, query string parameters, session storage, etc. This may also negate the need for the disabledFields and hiddenFields properties.

Similarly, onRenderField(fieldProperties: IDynamicFieldProps): React.ReactElement<IDynamicFieldProps> delegate can replace the fieldOverrides. If the delegate returns a null value, default rendered shall be used.

Observed Behavior

Currently, it is difficult to implement dynamic behaviors and style to form controls without implementing a field renderer via fieldOverrides. For example, we simply need to set a default value and disable input control when a specific query string value is specified. It was super easy to implement with JSLink injection.

There is also a bug in the DynamicForm.module.scss @media style definitions for the .sectionFormField class. It appears that the larger the screen size is, the smaller field controls become which makes the unusable on 4K screens. For example, check the size of the rich text control in the Notes field.

image

This behavior is easier to replicate when bodySections formatter is defined as follows:

{
    "sections": [
        {
            "displayname": "",
            "fields": []
        }
    ]
}
Copy link

Thank you for submitting your first issue to this project.

@Ruslan-Urban Ruslan-Urban changed the title [Dynamic Form] Add @class extensibility for DynamicForm and DynamicField, onPreRender delegate. [Dynamic Form] Add @class extensibility for DynamicForm and DynamicField, add onPreRender delegate. Mar 21, 2024
@Ruslan-Urban Ruslan-Urban changed the title [Dynamic Form] Add @class extensibility for DynamicForm and DynamicField, add onPreRender delegate. [Dynamic Form] Implement @class extensibility for DynamicForm and DynamicField, add onPreRender delegate. Mar 21, 2024
@wuxiaojun514
Copy link
Contributor

Hi, I also noticed the bad UI when dynamic form runs on custom formatting layout enabled list. It should show 3-4 columns in one row.
I plan to create a PR which introduce styles and className property on dynamic form to support customize the styling, like Component Styling mentioned

wuxiaojun514 added a commit to wuxiaojun514/sp-dev-fx-controls-react that referenced this issue Nov 29, 2024
and add styles/className property to support styling customization, should somehow fix pnp#1794
@michaelmaillot michaelmaillot added status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:enhancement New feature or enhancement of existing capability labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:enhancement New feature or enhancement of existing capability
Projects
None yet
Development

No branches or pull requests

3 participants