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

Add a support for label for array items #3231

Closed
1 task done
harkiratsm opened this issue Nov 5, 2022 · 4 comments
Closed
1 task done

Add a support for label for array items #3231

harkiratsm opened this issue Nov 5, 2022 · 4 comments

Comments

@harkiratsm
Copy link

Prerequisites

What theme are you using?

core

What is your question?

Does rjsf support label for array items ?

From a conversation with @heath-freenome, I guess rjsf does not support it.

@harkiratsm harkiratsm added needs triage Initial label given, to be assigned correct labels and assigned question labels Nov 5, 2022
@heath-freenome heath-freenome added help wanted feature Is a feature request and removed needs triage Initial label given, to be assigned correct labels and assigned labels Dec 23, 2022
@heath-freenome
Copy link
Member

@harkiratsm In this playground I just tried adding the "ui:label": false and it worked. Does doing something similar in your situation also work?

@heath-freenome heath-freenome added awaiting response and removed help wanted feature Is a feature request labels Dec 23, 2022
@harkiratsm
Copy link
Author

Thank @heath-freenome

@harkiratsm
Copy link
Author

As the issue hasn't been fixed lately, thank you for reopening it.

@heath-freenome
Copy link
Member

heath-freenome commented Mar 15, 2023

Confirmed that the use case in this playground link is not working

heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Mar 22, 2023
…layed correctly

Fixes rjsf-team#827, rjsf-team#2636, rjsf-team#2399, rjsf-team#2791, rjsf-team#3231, and rjsf-team#3531 so that titles, descriptions and labels are picked up from uiSchema then schema and are hidden correctly when `label` in uiSchema is false
- Updated `@rjsf/utils` to add `displayLabel` to `WidgetProps`
- Updated `@rjsf/core` to fix the bugs as follows:
  - Updated `ArrayField`, `MultiSchemaField`, `StringField` to pass the label as `uiOptions.title || schema.title || name` as well as passing `displayLabel` from the `uiOptions`
  - Updated `ObjectField` to not pass `title` or `description` when `displayLabel` is false and `ObjectTitleTemplate` to only check `title` and `description`
  - Updated `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to pass `globalUiOptions` into `getUiOptions` to pick up the global `label`
  - Updated `CheckboxWidget` to not show description when `displayLabel` is false
- Updated `@rjsf/antd` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
- Updated `@rjsf/bootstrap-4` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `RangeWidget` to only pass `label` in the `extraProps` when `displayLabel` is true
- Updated `@rjsf/chakra-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget`, `TextareaWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/fluent-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `ColorWidget`, `DateWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated `FieldTemplate` to hide description when `displayLabel` is false
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/material-ui` and `@rjsf/mui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget` and `SelectWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/semantic-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `SelectWidget` and `TextareaWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated the `widget` documentation for the new `displayLabel` prop
- Updated the `CHANGELOG.md` file accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Mar 22, 2023
…layed correctly

Fixes rjsf-team#827, rjsf-team#2636, rjsf-team#2399, rjsf-team#2791, rjsf-team#3231, and rjsf-team#3531 so that titles, descriptions and labels are picked up from uiSchema then schema and are hidden correctly when `label` in uiSchema is false
- Updated `@rjsf/utils` to add `displayLabel` to `WidgetProps`
- Updated `@rjsf/core` to fix the bugs as follows:
  - Updated `ArrayField`, `MultiSchemaField`, `StringField` to pass the label as `uiOptions.title || schema.title || name` as well as passing `displayLabel` from the `uiOptions`
  - Updated `ObjectField` to not pass `title` or `description` when `displayLabel` is false and `ObjectTitleTemplate` to only check `title` and `description`
  - Updated `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to pass `globalUiOptions` into `getUiOptions` to pick up the global `label`
  - Updated `CheckboxWidget` to not show description when `displayLabel` is false
- Updated `@rjsf/antd` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
- Updated `@rjsf/bootstrap-4` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `RangeWidget` to only pass `label` in the `extraProps` when `displayLabel` is true
- Updated `@rjsf/chakra-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget`, `TextareaWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/fluent-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `ColorWidget`, `DateWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated `FieldTemplate` to hide description when `displayLabel` is false
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/material-ui` and `@rjsf/mui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget` and `SelectWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/semantic-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `SelectWidget` and `TextareaWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated the `widget` documentation for the new `displayLabel` prop
- Updated the `CHANGELOG.md` file accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Mar 22, 2023
…layed correctly

Fixes rjsf-team#827, rjsf-team#2636, rjsf-team#2399, rjsf-team#2791, rjsf-team#3231, and rjsf-team#3531 so that titles, descriptions and labels are picked up from uiSchema then schema and are hidden correctly when `label` in uiSchema is false
- Updated `@rjsf/utils` to add `displayLabel` to `WidgetProps`
- Updated `@rjsf/core` to fix the bugs as follows:
  - Updated `ArrayField`, `MultiSchemaField`, `StringField` to pass the label as `uiOptions.title || schema.title || name` as well as passing `displayLabel` from the `uiOptions`
  - Updated `ObjectField` to not pass `title` or `description` when `displayLabel` is false and `ObjectTitleTemplate` to only check `title` and `description`
  - Updated `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to pass `globalUiOptions` into `getUiOptions` to pick up the global `label`
  - Updated `CheckboxWidget` to not show description when `displayLabel` is false
- Updated `@rjsf/antd` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
- Updated `@rjsf/bootstrap-4` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `RangeWidget` to only pass `label` in the `extraProps` when `displayLabel` is true
- Updated `@rjsf/chakra-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget`, `TextareaWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/fluent-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `ColorWidget`, `DateWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated `FieldTemplate` to hide description when `displayLabel` is false
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/material-ui` and `@rjsf/mui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget` and `SelectWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/semantic-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `SelectWidget` and `TextareaWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated the `widget` documentation for the new `displayLabel` prop
- Updated the `CHANGELOG.md` file accordingly
heath-freenome added a commit that referenced this issue Mar 24, 2023
…layed correctly (#3533)

* fix: many bugs related to titles, descriptions, labels not being displayed correctly
Fixes #827, #2636, #2399, #2791, #3231, and #3531 so that titles, descriptions and labels are picked up from uiSchema then schema and are hidden correctly when `label` in uiSchema is false
- Updated `@rjsf/utils` to add `displayLabel` to `WidgetProps`
- Updated `@rjsf/core` to fix the bugs as follows:
  - Updated `ArrayField`, `MultiSchemaField`, `StringField` to pass the label as `uiOptions.title || schema.title || name` as well as passing `displayLabel` from the `uiOptions`
  - Updated `ObjectField` to not pass `title` or `description` when `displayLabel` is false and `ObjectTitleTemplate` to only check `title` and `description`
  - Updated `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to pass `globalUiOptions` into `getUiOptions` to pick up the global `label`
  - Updated `CheckboxWidget` to not show description when `displayLabel` is false
- Updated `@rjsf/antd` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
- Updated `@rjsf/bootstrap-4` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `RangeWidget` to only pass `label` in the `extraProps` when `displayLabel` is true
- Updated `@rjsf/chakra-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget`, `TextareaWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/fluent-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `ColorWidget`, `DateWidget`, `RadioWidget`, `RangeWidget`, `SelectWidget` and `UpDownWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated `FieldTemplate` to hide description when `displayLabel` is false
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/material-ui` and `@rjsf/mui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `RadioWidget`, `RangeWidget` and `SelectWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated `@rjsf/semantic-ui` to fix the bugs as follows:
  - Updated `ObjectTitleTemplate` to only check `title` and `description` since they will be falsey from `ObjectField` when `displayLabel` is false
  - Updated `CheckboxWidget` to render the description using the `DescriptionFieldTemplate`, except when `displayLabel` is false
  - Updated `BaseInputTemplate`, `CheckboxesWidget`, `SelectWidget` and `TextareaWidget` to hide `label` when `displayLabel` and `label` are falsy
  - Updated test snapshots due to fixed bugs
- Updated the `widget` documentation for the new `displayLabel` prop
- Updated the `CHANGELOG.md` file accordingly

* - Added a new `labelValue()` function to `@rjsf/utils`
- Updated all ui packages to use `labelValue()` as appropriate, in some cases replacing the `schema.title` with `undefined` which is the real value of `schema.title` when label is an empty string
- Added a new `FluentLabel` component by refactoring common code out of `CheckboxesWidget`, `ColorWidget`, `RangeWidget` and `UpDownWidget`

* - Missed one `labelValue()` usage

* Apply suggestions from code review

Fix bug links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants