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

ui: fix validation for multiselect fields and import from list #2848

Closed
wants to merge 2 commits into from

Conversation

miguelgrc
Copy link
Contributor

@miguelgrc miguelgrc commented Sep 12, 2023

Closes #2847
Closes #2849

Signed-off-by: Miguel Garcia Garcia <[email protected]>
@miguelgrc miguelgrc changed the title ui: fix validation for multiselect fields ui: fix validation for multiselect fields and import from list Sep 13, 2023
marginBottom: "5px",
backgroundColor: "white",
}}
>
<List.Item.Meta
title={
<Typography.Text ellipsis={{ rows: 1 }}>
<Typography.Text ellipsis>
Copy link
Collaborator

Choose a reason for hiding this comment

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

why remove {{ rows: 1 }}? seems not to work for long text

Copy link
Contributor Author

@miguelgrc miguelgrc Sep 14, 2023

Choose a reason for hiding this comment

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

I tried and it seems to work the same, did you notice any issue? For some reason I was getting a warning saying that rows is not a valid property for ellipsis (even though it should be...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why but they're excluding rows and expandable from the ellipsis props in antd, and in the documentation they appear as valid props (https://github.com/ant-design/ant-design/blob/master/components/typography/Text.tsx#L34)

ui/cap-react/src/antd/admin/utils/index.js Outdated Show resolved Hide resolved
@@ -23,6 +26,9 @@ const PropertyKeyEditorForm = ({
} else {
if (uiSchema["ui:widget"]) {
type = uiSchema["ui:widget"];
if (uiSchema["ui:widget"] === "select") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is a chance we don't have a ui:widget specified, but RJSF still will render the select widget
e.g.

    "multipleChoicesList": {
      "type": "array",
      "title": "A multiple choices list",
      "items": {
        "type": "string",
        "enum": [
          "foo",
          "bar",
          "fuzz",
          "qux"
        ]
      },
      "uniqueItems": true
    },

do we need to handle better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We won't have those cases from the builder, only maybe for imported or manually created schemas, but I would say we should have those schemas follow the "form builder syntax" instead of implementing more custom checks that can make the code more confusing. What do you think?

Signed-off-by: Miguel Garcia Garcia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui: fix import from list in select fields ui: fix validation for multiselect fields
2 participants