import { EditorAPI, EditorResponse, Id, PrivateData } from '../types/CommonTypes'; import { ConnectorRegistration } from '../types/ConnectorTypes'; import { BidirectionalDataPage, BidirectionalDataPageItem, DataItem, DataSourceVariableDataModel, Dictionary } from '../../../connector-types/src'; import { DataSourceVariableDisplayOptionsType, DateRestriction, Day, Locale, RowId, Variable, VariableType, VariableUsagesReport, VariableVisibility, DataSourceVariableSourceType } from '../types/VariableTypes'; import { DataItemMappingTools } from '../utils/DataItemMappingTools'; import { StructuredTextTextFlowDefinition } from '../types/RichTextRuleTypes'; declare class NumberVariable { #private; constructor(editorAPI: EditorAPI); /** * @experimental Sets the minimum value for a number variable * @param id the id of the variable to update * @param minimum the minimum value or null to remove the minimum value * @returns */ setMinimum: (id: string, minimum: number | null) => Promise>; /** * @experimental Sets the maximum value for a number variable * @param id the id of the variable to update * @param maximum the maximum value or null to remove the maximum value * @returns */ setMaximum: (id: string, maximum: number | null) => Promise>; /** * @experimental Sets the visibility of the stepper for a number variable * @param id the id of the variable to update * @param showStep true to show the stepper, false to hide it * @returns */ setShowStepper: (id: string, showStepper: boolean) => Promise>; /** * @experimental Sets the step size for a number variable * @param id the id of the variable to update * @param stepSize the step size. Must be > 0 * @returns */ setStepSize: (id: string, stepSize: number) => Promise>; /** * @experimental Sets the thousands separator for a number variable * @param id the id of the variable to update * @param thousandsSeparator the thousands separator to use * @returns */ setThousandsSeparator: (id: string, thousandsSeparator: "" | "." | "," | " ") => Promise>; /** * @experimental Sets the decimal separator for a number variable * @param id the id of the variable to update * @param decimalSeparator the decimal separator to use * @returns */ setDecimalSeparator: (id: string, decimalSeparator: "" | "." | "," | " ") => Promise>; /** * @experimental Sets or clears the decimal character style for a number variable * @param id the id of the variable to update * @param characterStyleId the id of the character style to use/clear for the decimals * @returns */ setDecimalCharacterStyle: (id: string, characterStyleId: string | null) => Promise>; /** * @experimental Sets the number of decimals for a number variable * @param id the id of the variable to update * @param numberOfDecimals the number of decimals to use * @returns */ setNumberOfDecimals: (id: string, numberOfDecimals: 0 | 1 | 2 | 3 | 4) => Promise>; private applyPropertiesUpdate; } declare class DateVariable { #private; constructor(editorAPI: EditorAPI); /** * @experimental This method sets the display format for a date variable. * * The `displayFormat` is using ICU formatting (Unicode). * * Supported date formats: * - Day -> `d`, `dd` * - Month -> `M`, `MM`, `MMM`, `MMMM` * - Year -> `yy`, `yyyy` * - Day of week -> `ccc`, `cccc` * * Examples for an input date of `10-12-1815`: * - Format `dd/MM/yyyy` will display `12/10/1815` * - Format `d.M.yy` will display `12.10.15` * - Format `d MMM yyyy` will display `12 Oct 1815` for the `en_US` language * - Format `MMMM d, yyyy` will display `October 12, 1815` for the `en_US` language * - Format `ccc, MMM d, yyyy` will display `Thu, Oct 12, 1815` for the `en_US` language * - Format `cccc, MMMM d, yyyy` will display `Thursday, October 12, 1815` for the `en_US` language * - Format `cccc, MMMM d, yyyy` will display `donderdag, oktober 12, 1815` for the `nl` language * * Patterns which output words such as `MMM`, `MMMM`, `ccc` and `cccc` will * differ depending on chosen language (default is `en_US`). * * @param id The id of the date variable to update * @param displayFormat The display format for the date variable */ setDisplayFormat: (id: string, displayFormat: string) => Promise>; /** * @experimental This method sets the locale for a date variable. * * @param id The id of the date variable to update * @param locale The locale for the date variable (`'en_US'`, `'fi'`, `'fr'`...) */ setLocale: (id: string, locale: Locale) => Promise>; /** * @experimental This method sets or clears the start date for a date variable. * @param id The id of the date variable to update * @param date The start date for the date variable */ setStartDate: (id: string, date: DateRestriction | null) => Promise>; /** * @experimental This method sets or clears the end date for a date variable. * @param id The id of the date variable to update * @param date The end date for the date variable */ setEndDate: (id: string, date: DateRestriction | null) => Promise>; /** * @experimental This method sets or clears the excluded days for a date variable. * @param id The id of the date variable to update * @param excludedDays The excluded days for the date variable */ setExcludedDays: (id: string, excludedDays: Day[] | null) => Promise>; private applyPropertiesUpdate; } declare class DataSourceVariable { #private; constructor(editorAPI: EditorAPI, dataItemMappingTools: DataItemMappingTools); /** * Sets the value for a data source variable. * * @param id the id of the data source variable to update * @param value the value to set for the data source variable. This can be a list of records, when we set the data for the data source variable in injected data mode * or a single record id, when we have to change the selected record value . * @returns */ setValue: (id: string, value: RowId | DataItem[]) => Promise>; /** * Sets how the data source variable is displayed in the UI (table or list with optional display column). * @param variableId The id of the data source variable to update * @param displayOptionsType Whether to show the full table or a single column (list) * @param displayColumn Column name when displayOptionsType is list * @returns */ setDisplayOptions(variableId: string, displayOptionsType: DataSourceVariableDisplayOptionsType.table): Promise>; setDisplayOptions(variableId: string, displayOptionsType: DataSourceVariableDisplayOptionsType.list, displayColumn: string): Promise>; /** * Get the injected data from a data source variable. This only works for data source variables * that are in injected data mode. If no data is set, an empty list will be returned. * @param variableId the id of the variable * @returns a DataPage with an array of data objects */ getInjectedData: (variableId: string) => Promise>; /** * Get a single item from injected data of a data source variable. This only works for data source variables * that are in injected data mode. * @param variableId the id of the variable * @param itemId the id of the item to get * @returns a BidirectionalDataPageItem with the item and empty navigation tokens */ getInjectedItemById: (variableId: string, itemId: string) => Promise>; /** * Sets the model for a data source variable. This only works for data source variables * that are in injected data mode. * * @param variableId the id of the data source variable to update * @param value the model to set for the data source variable * @returns */ setInjectedModel: (variableId: string, value: DataSourceVariableDataModel) => Promise>; /** * Sets the source type for a data source variable. * * @param variableId the id of the data source variable to update * @param sourceType the source type to set for the data source variable * @returns */ setSourceType: (variableId: string, sourceType: DataSourceVariableSourceType) => Promise>; /** * Sets the connector for a data source variable. This only works for data source variables * that are in connector source type. * * @param variableId the id of the data source variable to update * @param registration the connector registration to set for the data source variable * @returns The new id of the connector */ setConnector: (variableId: string, registration: ConnectorRegistration) => Promise>; /** * Removes the connector for a data source variable. This only works for data source variables * that are in connector source type. * * @param variableId the id of the data source variable to update * @returns */ removeConnector: (variableId: string) => Promise>; } /** * The VariableController is responsible for all communication regarding the variables. * Methods inside this controller can be called by `window.SDK.variable.{method-name}` */ export declare class VariableController { #private; number: NumberVariable; date: DateVariable; /** * @experimental * This controller is experimental and might change in future releases. * Use at your own risk. */ dataSource: DataSourceVariable; /** * @ignore */ constructor(editorAPI: EditorAPI, dataItemMappingTools: DataItemMappingTools); /** * This method returns the list of variables * @returns */ getAll: () => Promise>; /** * This method returns a variable by id * @param id the id of a specific variable * @returns */ getById: (id: string) => Promise>; /** * This method returns a variable by name * @param name the name of a specific variable * @returns */ getByName: (name: string) => Promise>; /** * This method creates a new variable * @param parentId parent id of the created variable * @param type type of the created variable * @returns the new created variable id */ create: (parentId: string, type: VariableType) => Promise>; /** * This method removes a list of variables. * * All connectors linked to the variables will be unregistered. * @param ids list of the variables to be removed * @returns */ remove: (ids: string[]) => Promise>; /** * This method sets a new name for a variable * @param id id of the variable * @param name name of the variable * @returns */ rename: (id: string, name: string) => Promise>; /** * This method sets a new label for a variable * @param id id of the variable * @param label label of the variable * @returns */ setLabel: (id: string, label: string | null) => Promise>; /** * This method sets a new placeholder for a variable * @param id id of the variable * @param placeholder placeholder of the variable * @returns */ setPlaceholder: (id: string, placeholder: string) => Promise>; /** * This method resets a placeholder for a variable * @param id id of the variable * @returns */ resetPlaceholder: (id: string) => Promise>; /** * This method sets a new help text for a variable * @param id id of the variable * @param helpText placeholder of the variable * @returns */ setHelpText: (id: string, helpText: string) => Promise>; /** * This method resets a help text for a variable * @param id id of the variable * @returns */ resetHelpText: (id: string) => Promise>; /** * This method sets a new type for a variable * @param id id of the variable * @param type type of the variable * @returns */ setType: (id: string, type: VariableType) => Promise>; /** * This method sets the rule set id for a rich text variable * @param id id of the variable * @param ruleSetId id of the rule set * @returns */ setRuleSetId: (id: string, ruleSetId: string) => Promise>; /** * This method sets the items of the list variable * * The items need to be unique and are not case sensitive. * * @param id the id of the list variable * @param items the items of the list * @returns */ setListVariable: (id: Id, items: string[]) => Promise>; /** * This method sets a new value for a variable * * If the value is some text to be set on a ShortTextVariable, it must not * contain any type of line breaks. * * If the value is passing a context on an image variable value, it will be * available from the connector. * * @param id the id of the variable * @param value the new value of the variable * @returns */ setValue: (id: Id, value: string | boolean | number | null) => Promise>; /** * This method creates a copy of a variable * @returns */ duplicate: (id: string) => Promise>; /** * This method aggregates the provided variables into a new group * @param name name of the new group * @param ids list of variable ids to group together * @returns group id */ groupVariables: (name: string, ids: string[]) => Promise>; /** * This method dissolves the specified group * @param id id of the variable group * @returns */ ungroupVariables: (id: string) => Promise>; /** * This method moves a variable's position * @param order new order of variable * @param id id of the variable * @param parentId parent id of the created variable * @returns */ move: (order: number, id: string, parentId: string) => Promise>; /** * This method changes positions of variables * @param order new order of variable * @param ids Array of the variable IDs * @param parentId parent id of the variables * @returns */ moveVariables: (order: number, ids: string[], parentId: string) => Promise>; /** * @deprecated Use `setVariableVisibility` instead. * This method redirects to `setVariableVisibility` and sets visibility config for a variable by id. * @param id variable id * @param isVisible visibility flag * @returns */ setIsVisible: (id: string, isVisible: boolean) => Promise>; /** * @deprecated Use `setVariableVisibility` instead. * This method redirects to `setVariableVisibility` and sets visibility config for a variable by id. * @param id variable id * @param isHidden visibility flag * @returns */ setIsHidden: (id: string, isHidden: boolean) => Promise>; /** * This method sets visibility config for a variable by id * @param id variable id * @param config visibility config * @returns */ setVariableVisibility: (id: string, config: VariableVisibility) => Promise>; /** * This method sets which layouts are considered for variable visibility * @param layoutIdList nullable layout id list. * Pass null to reset to follow selected layout. * @returns */ setLayoutsForVariableVisibility: (layoutIdList?: Id[] | null) => Promise>; /** * This method sets isRequired flag for a variable * @returns */ setIsRequired: (id: string, isRequired: boolean) => Promise>; /** * This method sets removeParagraphIfEmpty flag for a variable * @param id The id of the variable to update * @param removeParagraphIfEmpty Set to true to remove the paragraph if it is empty, or false to keep it * @returns */ setRemoveParagraphIfEmpty: (id: string, removeParagraphIfEmpty: boolean) => Promise>; /** * This method sets maxCharacters limit on a text variable * @param id The id of the variable to update * @param maxCharacters Sets the max number of characters for that variable * maxCharacters > 0 && maxCharacters <= 100000000 or it can be set to null * @returns */ setVariableCharacterLimit: (id: string, maxCharacters: number | null) => Promise>; /** * This method sets isReadonly flag for a variable * @returns */ setIsReadonly: (id: string, isReadonly: boolean) => Promise>; /** * This method gets the image variable connector id. * @param id The id of the image variable * @returns The id of the connector */ getImageVariableConnectorId: (id: string) => Promise>; /** * This method sets the image variable connector. Setting a connector will * automatically remove the assetId linked to the connector if present. * If a connector was the source of the variable, it will be unregistered. * @param id The id of the image variable to update * @param registration registration object containing all details about the connector * @returns The new id of the connector */ setImageVariableConnector: (id: string, registration: ConnectorRegistration) => Promise>; /** * This method sets the value of an image variable along with its context in a single atomic operation * @param id the id of the image variable to update * @param value the new value of the image variable * @param context the context dictionary * @returns */ setImageVariableValueWithContext: (id: string, value: string | null, context: Dictionary) => Promise>; /** * @deprecated use `setValue` instead and pass `null` as the value argument. * * This method removes the variable source * @param id the id of the variable to update */ removeSource: (id: string) => Promise>; /** * @experimental Sets the prefix for a supported variable * @param id the id of the variable to update * @param prefix the prefix to set/clear * @returns */ setPrefix: (id: string, prefix: string | null) => Promise>; /** * @experimental Sets the suffix for a supported variable * @param id the id of the variable to update * @param suffix the suffix to set/clear * @returns */ setSuffix: (id: string, suffix: string | null) => Promise>; /** * @experimental Sets the prefix character style for a supported variable * @param id the id of the variable to update * @param characterStyleId the id of the character style to use/clear for the prefix * @returns */ setPrefixCharacterStyle: (id: string, characterStyleId: string | null) => Promise>; /** * @experimental Sets the suffix character style for a supported variable * @param id the id of the variable to update * @param characterStyleId the id of the character style to use/clear for the suffix * @returns */ setSuffixCharacterStyle: (id: string, characterStyleId: string | null) => Promise>; /** * Sets the private data for any variable * @param id the id of the variable to update * @param privateData the private data * @returns */ setPrivateData: (id: string, privateData: PrivateData) => Promise>; /** * Gets the private data for any variable * @param id the id of the variable * @returns the private data */ getPrivateData: (id: string) => Promise>; /** * This method sets the allowQuery flag for an image variable * @param id the id of the variable * @param allowQuery the allowQuery flag * @returns */ setAllowImageQuery: (id: string, allowQuery: boolean) => Promise>; /** * This method sets the allowUpload flag for an image variable * @param id the id of the variable * @param allowUpload the allowUpload flag * @returns */ setAllowImageUpload: (id: string, allowUpload: boolean) => Promise>; /** * This method sets the minimum size (both width and height) for an image variable that will be uploaded * @param id the id of the variable * @param minWidth the minimum width * @param minHeight the minimum height * @returns */ setMinImageUploadSize: (id: string, minWidth: string | null, minHeight: string | null) => Promise>; /** * Sets the "don't break" flag for a short text variable. When set to true, the variable will not be split across lines. * @param id the id of the variable * @param isDontBreak the value of the "don't break" flag * @returns */ setIsDontBreak: (id: string, isDontBreak: boolean) => Promise>; /** * This method highlights the usages of a variable in * - pages * - frames * - actionTrigger * - variables * - outputDataSource * @param id the id of the variable * @returns the usages of the variable */ highlightUsages: (id: string) => Promise>; /** * This method sets the global rich text rules available for all rich text variables. This should be set * before a document is loaded to ensure the rules are available when they are needed. * * @param rules The rules to set, these replace the existing rules entirely. * @returns */ setRichTextRules: (rules: StructuredTextTextFlowDefinition[]) => Promise>; private makeVariablesBackwardsCompatible; private makeVariableBackwardsCompatible; private makeListVariableBackwardsCompatible; private applyPrefixSuffixDeltaUpdate; } export {};