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

Missing typedef for sap.m.Token.data() #4211

Open
neoruien opened this issue Feb 21, 2025 · 2 comments
Open

Missing typedef for sap.m.Token.data() #4211

neoruien opened this issue Feb 21, 2025 · 2 comments

Comments

@neoruien
Copy link

SAPUI5 version: 1.123.2 (though we will be upgrading to 1.127.7 soon)

sap.ui.comp.valuehelpdialog.ValueHelpDialog.setTokens

I read the description of ValueHelpDialog.setTokens() and I realised that sap.m.Token has a data() method for getting Value Help rangeKeyFields information.

sap.m.Token

However, the sap.m.Token.data() method was not documented. It seems to have 2 parameters: a string parameter and an object parameter of shape { exclude: boolean, operation: sap.ui.comp.valuehelpdialog.ValueHelpRangeOperation, keyField: string, value1: any, value2: any }.

I request documentation of the sap.m.Token.data() method, including the various options for the string parameter and a TypeScript interface for the object parameter.


Screenshot:
Image

@nikoletavnv nikoletavnv self-assigned this Feb 21, 2025
@nikoletavnv
Copy link
Member

Hello @neoruien,

The .data() method is part of the jQuery library and is a way to assign internally some properties to the tokens inside a ValueHelpDialog. The data is assigned to the tokens for operations related to range tokens. It is not intended to be used from the outside neither this method is part of the class public API.

You can explain in more detail what you want to achieve so we can help you with other approaches.

Kind regards,
Nikoleta

@neoruien
Copy link
Author

Hello @nikoletavnv,

I wish to convert the range tokens into filters.

tokens
      .map((token) => token.data('range') as TokenRangeProperties)
      .map((properties) => new Filter({
            path: properties.keyField,
            operator: properties.operation,
            value1: properties.value1
      }));

Note that I created a custom type TokenRangeProperties as I am using Typescript. I defined it with this shape:

{
      exclude: boolean,
      operation: sap.ui.model.FilterOperator,
      keyField: string,
      value1: unknown,
      value2: unknown
}

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