export type GenericObject = { [key: string]: any; }; export interface ListActions { /** * This Adds the INSERT page instruction to the referenced list in context. * @param payload - The object containing the values to be inserted in the referenced list. * @param index - The position that must be inserted in the referenced list. * @param pageRef The reference to the page within the current context. * @param options The object containing additional information to perform the INSERT operation. * @param option.skipStateUpdate The flag that determines if the Redux State must be updated. * @example insert() * In this example, the API inserts a row for list page and inserts an INSERT instruction for the submit action. * ``` * getPConnect().getListActions().insert({}, 0, 'caseInfo.content', { skipStateUpdate: false }) * ``` */ insert(payload: object, index: number, pageRef?: string, options?: { skipStateUpdate?: boolean; }): void; /** * Adds the UPDATE page instruction to the referenced list in context. * @param payload - The object containing the values to be updated in the referenced list. * @param index - The position in the referenced list that must be updated. * @param options The object containing additional information to perform the UPDATE operation. * @param option.skipStateUpdate The flag that determines if the Redux State must be updated. * @param option.pageRef The reference to the page within the current context. * @example update() * In this example, the API updates a row for list page with the provided payload and inserts the UPDATE instruction for the submit action. * ``` * getPConnect().getListActions().update({ Name: 'John', Experience: 2 }, 0, { skipStateUpdate: false, pageRef: "caseInfo.content.Employee" }); * ``` */ update(payload: object, index: number, options?: { pageRef?: string; skipStateUpdate?: boolean; }): void; /** * Adds the UPDATE page instruction for a specific field in a row to the referenced list in context. * @param propertyName - The property name of the field that must be updated. * @param value - The value of the field that must be updated. * @param options The object containing additional information to perform the UPDATE operation. * @param option.skipStateUpdate The flag that determines if the Redux State must be updated. * @param option.isArrayDeepMerge flag to decide whether to deep merge the objects or values inside array or not * @example updateProperty() * In this example, the API updates the Name property in the row for the referenced list page with the provided payload and * inserts the UPDATE instruction for the submit action. * ``` * getPConnect().getListActions().updateProperty('.Name', 'John Doe'); * ``` */ updateProperty(propertyName: undefined | string, value: GenericObject | undefined, options?: { skipStateUpdate?: boolean; isArrayDeepMerge?: boolean; skipDirtyValidation?: boolean; }): void; /** * Adds the DELETE page instruction to the referenced list in context. * @param index - The position that must be deleted in the referenced list. * @param pageRef The reference to the page within the current context. * @example deleteEntry() * In this example, the API deletes the specified row in the referenced list page and inserts the DELETE instruction for the submit action. * ``` * getPConnect().getListActions().deleteEntry(0, 'caseInfo.content') * ``` */ deleteEntry(index: number, pageRef?: string, options?: { skipStateUpdate?: boolean; }): void; /** * Adds the MOVE page instruction to the referenced list in context. * @param fromIndex - The position in the list from which the row must be moved. * @param toIndex - The position in the list to which the row must be moved. * @example reorder() * In this example, the API reorders the row for the referenced list page with the provided * indexes and inserts the MOVE instruction for the submit action. * ``` * getPConnect().getListActions().reorder(1, 0); * ``` * The page instructions for the submit action is as shown below: * pageInstructions: [ { target: ".EmployeeDetails", listIndex: 2, listMoveToIndex: 1, instruction: "MOVE" } ] */ reorder(fromIndex: number, toIndex: number): void; /** * Updates the Redux Store on selection of rows and adds the SELECT/DESELECT page instruction to the referenced list in context. * @param rows - The array containing the details of the selected/deselected rows. * @param options The object containing additional information to perform the SELECT/DESELECT operation. * @param option.skipPageInstructions The flag that determines if the page instructions must be added to the referenced list. * @example setSelectedRows() * In this example, the API selects the rows for the given payload for the referenced list page and inserts the INSERT/DELETE instruction for the submit action. * ``` * getPConnect().getListActions().setSelectedRows( [ { $key: '0759409f-4146-439c-aa25-57d4f495fee5', $selected: true, Name: 'Alice' pyGUID: "0759409f-4146-439c-aa25-57d4f495fee5" } ]); *``` */ setSelectedRows(rows: GenericObject[], options?: { skipPageInstructions: boolean; }): Promise; /** * Get the unique keys of each selected row in an array from the referenced list in context. * @param withPayload - determines if all the data in the selected rows must be included in the response. default value is false. * if withPayload is set to true all the data in the selected rows are included in the response. * if withPayload is set to false only the unique ids for the selected rows are included in the response. * @returns - list of id's along with payload for the selected rows * @example getSelectedRows() * In this example, the API returns the unique ids of the selected rows as an array. * ``` * getPConnect().getListActions().setSelectedRows(false) * [ { pyGUID : "1f8cce17-619d-41e9-94a3-179426eb5569" }, { pyGUID : "02517df0-f460-4673-b873-2fea889af6d2" } ] *``` */ getSelectedRows(withPayload?: boolean): Promise; /** * Deletes all the previously selected rows by adding the DELETE ALL page instruction to the case or data reference list and updates the * Redux Store. * @example clearSelectedRows() * In this example, the API deletes all the selected rows for the list page and inserts the DELETE ALL * instruction for the submit action. * ``` * getPConnect().getListActions().clearSelectedRows() * ``` */ clearSelectedRows(): Promise; /** * Use this API to communicate if the referenced editable list is mounted on the screen to facilitate generation of * page-instructions. * @param isVisible - determines if the referenced list is mounted on the screen. * if isVisible is set to true, the referenced editable list is mounted on the screen thereby allowing page-instructions to be generated. * if isVisible is set to false, the referenced editable list is not mounted on the screen thereby not allowing page-instructions to be generated. * @example setVisibility() * In this example, the API communicates that the referenced editable list is mounted on the screen, thus allowing the page-instructions * to be generated. * ``` * getPConnect().getListActions().setVisibility(true) * ``` */ setVisibility(isVisible: boolean): void; /** * Adds the UPDATE page-instructions to default populated rows of the referenced list in the context. * Note: Use this API when the list has existing rows whose data needs to be passed in the payload of the submit action, and * after last entry in the list is mounted. * @param property - the unique property of list to which the UPDATE page-instructions must be added. * @param propertyNames - fields of the referenced list to which the UPDATE page-instructions must be added. * @param uniqueField - unique field for the row to which the UPDATE page-instructions must be added. * @example initDefaultPageInstructions() * In this example, the API adds the UPDATE page-instructions to default populated rows of the list 'Employees' for pyGUID and pyName fields which * are uniquely identified by value of EmbedListUUID__ field. * ``` * getPConnect().getListActions().initDefaultPageInstructions('.Employees', ['pyGUID', 'pyName'], '.EmbedListUUID__') * ``` */ initDefaultPageInstructions(property: string, propertyNames: string[], uniqueField?: string): void; /** * Adds the DELETE_ALL page instruction to the referenced list in context. * @param property - the unique property of list to which the DELETE_ALL page-instructions must be added. * @param options The object containing additional information to perform the DELETE_ALL operation. * @param options.skipStateUpdate flag to decide whether redux state should be update * default value : false * skipStateUpdate : true is passed then redux state will be updated * skipStateUpdate : false is passed then redux state will not be updated * @example deleteAll() * In this example, the API adds the DELETE_ALL page instruction to ShippingAddress and doesnot update the redux state. * ``` * getPConnect().getListActions().deleteAll('.ShippingAddress', { skipStateUpdate : false }); * ``` */ deleteAll(property: string, options?: { skipStateUpdate?: boolean; }): void; /** * Adds the REPLACE page instruction to the referenced list in context. * Note: This is explicitely used for Address field when we change country. * @param property - The unique property of list to which REPLACE page-instrcution will be added. * @param payload - The object containing the property & its value to be replaced in the referenced list. * @example replacePage() * In this example, the API changes the datapresent in property pyCountry and resets the associated fields in the page 'ShippingAddress'. * ``` * getPConnect().getListActions().replacePage('.ShippingAddress', {pyCountry : IND"}) * ``` */ replacePage(property: string, payload: object, options?: { skipStateUpdate?: boolean; }): void; /** * Adds the DELETE page instruction to the referenced list in context. * @param property - The unique property of list to which DELETE page page-instrcution will be added. * @example deletePage() * In this example, the API deletes the page 'ShippingAddress'. * ``` * getPConnect().getListActions().deletePage('.ShippingAddress') * ``` */ deletePage(property: string, options?: { skipStateUpdate?: boolean; }): void; }