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

Unable to hide maskSettings items when creating a Specialized Question type #5843

Open
doelgonzo opened this issue Aug 30, 2024 · 2 comments
Labels

Comments

@doelgonzo
Copy link

doelgonzo commented Aug 30, 2024

Are you requesting a feature, reporting a bug or ask a question?

Bug/Question

What is the current behavior?

The documentation here indicates that End users cannot break the functionality because the Property Grid hides the questionJSON object properties., but when I set some of these properties they still appear in the property grid (see test code). It's possible I'm doing something wrong, but I understand it that this should work this way. My gut says it's related to these being nested values, but I don't know how to get around it.

I also tried:

inheritBaseProps: ["maskSettings:max","maskSettings:min","maskSettings:decimalSeparator","maskSettings:thousandsSeparator", "maskSettings:allowNegativeValues"]

and it made no difference. Any guidance is welcome.
Also, the console.log below prints out base properties but none of the maskSettings-related ones...

What is the expected behavior?

They are hidden, or I have a programatic way to hide these properties.

How would you reproduce the current behavior (if this is a bug)?

Provide the test code and the tested page URL (if applicable)

Test code

export const registerNumberInput = () => {
   const existingQuestion = ComponentCollection.Instance.getCustomQuestionByName(
    CustomField.NumberInput
  );

  // Register the NumericInput model with the ElementFactory
  if (!existingQuestion) {
    ComponentCollection.Instance.add({
      name: CustomField.NumberInput,
      iconName: CustomField.NumberInput,
      title: "Number Input",
      questionJSON: {
        type: "text",
        inputType: "text",
        maskType: "numeric",
        maskSettings: {
          saveMaskedValue: false,
          precision: 0,
        },
      },
      inheritBaseProps: ["maskSettings"],
    });
  }

  console.log(
    ComponentCollection.Instance.getCustomQuestionByName(
      CustomField.NumberInput
    )
  );
};

Specify your

  • browser:
  • editor version: 1.11.13
@JaneSjs JaneSjs self-assigned this Sep 5, 2024
@JaneSjs
Copy link
Contributor

JaneSjs commented Sep 5, 2024

Hello,
You set inheritBaseProps: ["maskSettings"], therefore, Mask Settings appear in a property grid. If you wish to define mask settings but make them unavailable in a property grid, update your specialized question definition and remove the inheritBaseProps attribute.

 ComponentCollection.Instance.add({
      name: "custom-number-input",
      title: "Number Input",
      questionJSON: {
        type: "text",
        inputType: "text",
        maskType: "numeric",
        maskSettings: {
          saveMaskedValue: false,
          precision: 0,
        },
      }
});

Let me know if you have any questions.

@JaneSjs JaneSjs removed their assignment Sep 5, 2024
@doelgonzo
Copy link
Author

doelgonzo commented Sep 6, 2024

@JaneSjs Is there a way to make maskSettings.saveMaskedValue or maskSettings.precision not appear on on the property grid but have the others within maskSettings still appear?

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

No branches or pull requests

2 participants