UNPKG

@cute-dw/core

Version:

This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need

989 lines 52 kB
import { AfterViewInit, EventEmitter, OnDestroy, OnInit } from '@angular/core'; import { BehaviorSubject, Observable, Subscription } from 'rxjs'; import { DwObject, DwStyle, BufferType, ItemStatus, SaveAsType, DataStoreOptions, DwBandType } from '../datastore/DataStoreOptions'; import { ResultCode } from '../util/enum/ResultCode'; import { DwController } from '../controllers/DwController'; import { DataStore, DSRowGroup } from '../datastore/DataStore'; import { MenuOwner } from '../util/interface/MenuOwner'; import { MenuItem } from '../util/interface/MenuItem'; import { IDataStore } from '../datastore/IDataStore'; import { EventProducer } from '../util/rxjs/EventProducer'; import { DwClickedEvent, DwColumnsChangeEvent, DwDeleteRowEvent, DwDoubleClickedEvent, DwEditChangedEvent, DwInsertRowEvent, DwItemChangedEvent, DwItemErrorEvent, DwItemFocusChangedEvent, DwProcessEnterEvent, DwRowFocusChangedEvent, DwRowFocusChangingEvent } from '../datastore/events'; import { CodeTableItem } from '../datastore/TableColumn'; import { HttpService } from '../services/http.service'; import * as i0 from "@angular/core"; type EvalOptions = { defValue?: any; prefix?: string; suffix?: string; }; /** * A DataWindow object allows users to display, manipulate, and update database or other information. * @version 1.0.0 * @author Alexander V. Strelkov <alv.strelkov@gmail.com> * @copyright © ALEXANDER STRELKOV 2022 * @license MIT * @see {@link DataStore} */ export declare abstract class DataWindow implements OnInit, OnDestroy, AfterViewInit, IDataStore<any>, MenuOwner { private _dataStore; private _primaryDS; private _primaryDSCreationStamp; private _controller; private _canRedraw; private _currentCell; private _intervalId; private _columnNames; private _primaryCreateSubscription; protected _rootSubscription: Subscription; /** Auto run setRow() method on data changed */ autoSetRow: boolean; tag: any; get controller(): DwController | undefined; set controller(co: DwController | undefined); get ds(): DataStore<any>; set ds(mainDS: DataStore<any> | undefined); /** Actual data in the Primary! buffer */ dwData: any[]; /** Controls array in the detail band */ controls: DwObject[]; /** Control names in the detail band */ get columnNames(): string[]; set columnNames(value: string[]); cuteOnClick: EventEmitter<DwClickedEvent>; cuteOnDoubleClick: EventEmitter<DwDoubleClickedEvent>; cuteOnGetFocus: EventEmitter<Event>; cuteOnLoseFocus: EventEmitter<Event>; cuteOnTimer: EventEmitter<void>; readonly onColumnsChange$: BehaviorSubject<DwColumnsChangeEvent>; readonly onDeleteRow$: EventProducer<DwDeleteRowEvent>; readonly onEditChanged$: EventProducer<DwEditChangedEvent>; readonly onInsertRow$: EventProducer<DwInsertRowEvent>; readonly onItemChanged$: EventProducer<DwItemChangedEvent>; readonly onItemError$: EventProducer<DwItemErrorEvent>; readonly onItemFocusChanged$: EventProducer<DwItemFocusChangedEvent>; readonly onProcessEnter$: EventProducer<DwProcessEnterEvent>; readonly onRowFocusChanged$: EventProducer<DwRowFocusChangedEvent>; readonly onRowFocusChanging$: EventProducer<DwRowFocusChangingEvent>; protected readonly dweRedraw$: EventProducer<void>; protected readonly dweRowDeleted$: EventProducer<DwDeleteRowEvent>; constructor(); /** * Collect all subscriptions into the one place */ protected subscribeOnEvents(): void; /** * Unsubscribe all subscriptions that was set before */ protected unsubscribeFromEvents(): void; protected dataStreamHandler(data: any[]): void; protected insertRowHandler(event: DwInsertRowEvent): ResultCode; protected processEnterHandler(event: DwProcessEnterEvent): ResultCode; /** * Occurs when the user clicks a button inside a DataWindow object * @param col * @param row * @param event */ buttonClicked(col: string, row: number, event: MouseEvent): void; doubleClicked(row: number, dwo: DwObject | null, event: MouseEvent): void; /** * Occurs when the context menu item clicked * @param mi {@link MenuItem} object * * @abstract * @since 0.0.0 */ menuItemClicked(mi: MenuItem): void; /** * Current cell in the `Grid` style */ get currentCell(): number; set currentCell(index: number); /** * Returns redraw flag that was set by setRedraw method * @see {@link setRedraw} * @since 0.0.0 */ get canRedraw(): boolean; /** * @since 0.0.0 */ get httpService(): Readonly<HttpService> | undefined; /** * Loading status * @readonly * @since 0.0.0 */ get loading(): boolean; /** * Updating status * @readonly * @since 0.0.0 */ get updating(): boolean; /** * Primary buffer data * @since 0.0.0 */ get data(): any[]; /** * Gets data stream as Observable object * @readonly * @since 0.0.0 */ get dataStream(): Observable<any[]>; /** * Checks for any updates that may be pending * @readonly * @since 0.0.0 */ get updatesPending(): boolean; /** * Current filter value * @since 0.0.0 */ get filterValue(): string | null; set filterValue(value: string | null); /** * Current sort value * @since 0.0.0 */ get sortValue(): string | null; set sortValue(value: string | null); /** * Displays rows in a DataWindow that pass the current filter criteria. Rows that do not meet the filter criteria are moved to the filter buffer. * When the {@link retrieve} method retrieves data for the DataWindow, it applies the filter that was defined * for the DataWindow object, if any. * * @returns Returns `Promise` of 1 if it succeeds and -1 if an error occurs. * @async * @see {@link filterValue} * @since 0.0.0 */ applyFilter(): Promise<ResultCode>; /** * Sorts the rows in a DataWindow control or DataStore using the DataWindow's current sort criteria. * When the {@link retrieve} method retrieves data for the DataStore, it applies the sort criteria that were defined for * the DataStore object, if any. * @returns Returns a `Promise` of 1 if it succeeds and -1 if an error occurs. * @async * @see {@link sortValue} * @since 0.0.0 */ applySort(): Promise<ResultCode>; /** * Returns style of the DataWindow * @abstract * @since 0.0.0 */ abstract getStyle(): DwStyle; /** * Sets focus to the DataWindow control. * @returns Returns 1 if it succeeds and -1 if an error occurs. * @abstract * @since 0.0.0 */ abstract setFocus(): ResultCode; /** * For compatibility only * @see {@link setFocus} * @since 0.0.0 */ focus(): void; /** * Applies the contents of the DataWindow's edit control to the current item in the buffer of a DataWindow control or DataStore. * The data in the edit control must pass the validation rule for the column before it can be stored in the item. * @returns Returns 1 if it succeeds and -1 if it fails (for example, the data did not pass validation). * @since 0.0.0 */ acceptText(): ResultCode; /** * Creates a DataWindow object using {@link DataStoreOptions} object. It fully substitutes the current internal structure of a DataStore object. * * @param options An object of `DataStoreOptions` class * @returns 1 if it succeeds and -1 if an error occurs. * @since 0.5.0 */ create(options: DataStoreOptions): ResultCode; /** * Cancels the retrieval process in a DataWindow/DataStore object * @see {@link retrieve} * @since 0.0.0 */ dbCancel(): void; /** * Gets array of DataWindow controls * @param band Target band to which controls must belong. Default is `all`. * @returns Array of `DwObject` objects */ getControlsArray(band?: "all" | DwBandType): DwObject[]; /** * Gets cloned value of the current config options * @returns DataStoreOptions * @since 0.0.0 */ getOptions(): DataStoreOptions; /** * Reports the modification status of a row or a column within a row. The modification status determines the type of * SQL statement the Update method will generate for the row or column. * @param row A value identifying the row for which you want the status * @param column The column for which you want the status. Column can be a column number or a column name. * The column number is the number of the column as it is listed in the Column Specification. * @param bufferType A value identifying the DataWindow buffer containing the row for which you want status * @returns * A value of the `ItemStatus` enumerated datatype. If column is null, getItemStatus returns the status of row. * If there is no DataWindow object assigned to the DataWindow control or DataStore, getItemStatus returns undefined. * @since 0.0.0 */ getItemStatus(row: number, column?: number | string | null, bufferType?: BufferType): ItemStatus | undefined; /** * Changes the modification status of a row or a column within a row. The modification status determines the type of * SQL statement the Update method will generate for the row. * @param row The row location in which you want to set the status. * @param column The column location in which you want to set the status. Column can be a column number or a column name. * To set the status for the row, enter null for column. * @param bufferType A value identifying the DataWindow buffer that contains the row. * @param status A value of the ItemStatus enumerated datatype * @returns 1 if it succeeds and -1 if an error occurs. * @since 0.0.0 */ setItemStatus(row: number, column: number | string | null, bufferType: BufferType, status: ItemStatus): ResultCode; /** * Sets the value of a row and column in a DataWindow control or DataStore to the specified value. * * @param row The row location of the data. * @param column The column location of the data. Column can be a column number or a column name. The column number is the number of the column as it is listed in the Column Specification * @param value The value to which you want to set the data at the row and column location. The datatype of the value must be the same datatype as the column * @returns Returns 1 if it succeeds and -1 if an error occurs. * @see {@link getItem} * @since 0.0.0 */ setItem(row: number, column: string | number, value: any): ResultCode; /** * Reports whether the row has been modified. * * @param row Row number or object to check * @param dwbuffer Internal DataStore buffer type * @returns {boolean} _true_ if the row has been modified and _false_ if it has not. * @see {@link isRowNew} * @see {@link getNextModified} * @since 0.0.0 */ isRowModified(row: Object | number, dwbuffer?: BufferType): boolean; /** * Reports whether the row has been newly inserted. * * @param row Row number or object to check * @param dwbuffer Internal DataStore buffer type * @returns {boolean} _true_ if the row is new and _false_ if it was retrieved from the database. * @see {@link isRowModified} * @since 0.0.0 */ isRowNew(row: Object | number, dwbuffer?: BufferType): boolean; /** * Returns the number of rows currently available in the DataWindow (all the rows retrieved minus any deleted rows * plus any inserted rows minus any rows that have been filtered out). * @returns Number of rows * @since 0.0.0 */ rowCount(): number; /** * Gets row count in the filtered rows buffer * @returns Row count * @see {@link deletedCount} * @see {@link rowCount} * @since 0.0.0 */ filteredCount(): number; /** * Gets row count in the deleted rows buffer * @returns Row count * @see {@link rowCount} * @see {@link filteredCount} * @see {@link modifiedCount} * @since 0.0.0 */ deletedCount(): number; /** * Reports the number of rows that have been modified but not updated in a DataWindow or DataStore. * @returns {number} The number of rows that have been modified in the primary and filter buffer. * Returns 0 if no rows have been modified or if all modified rows have been updated in the database table. * @see {@link rowCount} * @see {@link deletedCount} * @since 0.0.0 */ modifiedCount(): number; /** * Deletes a row from the primary buffer of a DataWindow control, DataStore object. * If the DataWindow is not updatable, all storage associated with the row is cleared. * If the DataWindow is updatable, DeleteRow moves the row to the DataWindow's delete buffer * The row is not deleted from the database table until the application calls the Update method. * * @param row A value identifying the row you want to delete. To delete the current row, specify `NaN` for row. * @returns 1 if the row is successfully deleted and -1 if an error occurs. * @since 0.0.0 */ deleteRow(row?: number): ResultCode; /** * Reports the values of properties of a DataWindow object and controls within the DataWindow object. * Each column and graphic control in the DataWindow has a set of properties. You specify one or more * properties as a string, and Describe returns the values of the properties. * @param propertyList A string list (array) of properties or Evaluate functions * @returns * Returns array of values that includes a primitive value for each property or Evaluate function. * If the property list contains only one item, Describe returns single value. * Describe returns an undefined value if there is no value for a property. * Describe returns null for property if its value is not a primitive. * @example * let arr = dw.describe("datawindow.paginator.pageSize", "datawindow.paginator.showFirstLastPage"); * console.log(arr); // 20, true * let dh = dw.describe("datawindow.header.height"); * console.log(dh); // 48 * let foo = dw.describe("datawindow.bla-bla.bla"); * console.log(foo); // undefined * * @since 0.0.0 */ describe(...propertyList: string[]): any[] | any; /** * Evaluates CuteScript expression on DataWindow's row * * @param expr Expression on `CuteScript` * @param row Row index in the DataStore * @param options Additional parameters that change the meaning of the result * @returns Result of script evaluation * @since 0.0.0 */ eval(expr: any, row: any, options?: EvalOptions): any; /** * Allows you to evaluate DataWindow expressions within a javascript code using data in the DataWindow. * * @param expr Expression you want to evaluate directly * @param row The number of the row for which you want to evaluate the expression. * @returns Result of evaluation * @see {@link evalExpr} * @since 0.0.0 */ evaluate(expr: string | null, row: number | {}): any; /** * Finds the next row in a DataWindow or DataStore in which data meets a specified condition. * * @param expr A string whose value is a boolean expression that you want to use as the search criterion. The expression includes column names. * @param startRow A value identifying the row location at which to begin the search. * Start can be greater than the number of last row in DataStore for searching in backward direction. * @param endRow A value identifying the row location at which to end the search. End can be greater than the number of the last row. * To search backward, make end row less than start. * @returns {number} Returns the number of the first row that meets the search criteria within the search range. Returns -1 if no rows are found and one of these negative numbers if an error occurs: * -2 General error, * -3 Bad argument * @since 0.0.0 */ find(expr: string, startRow: number, endRow: number): number; /** * Returns a sorted set of unique values calculated by the specified expression over each row of the DataStore * @param expr Expression to evaluate over each row * @returns Sorted set of the distinct values */ distinctValues(expr: string): Set<any>; /** * Gets index of the row object in the Primary! buffer * * @param oRow Object * @returns Object's index value if found, -1 if object was not found in the buffer * @since 0.0.0 */ indexOf(oRow: any): number; /** * Inserts a row in a DataWindow or DataStore. If any columns have default values, the row is initialized with * these values before it is displayed. InsertRow simply inserts the row without changing the display or the current row. * To scroll to the row and make it the current row, call ScrollToRow. To simply make it the current row, call SetRow. * A newly inserted row (with a status flag of New!) is not included in the modified count until data is entered in the row * (its status flag becomes NewModified!). * * @param row {number} A value identifying the row before which you want to insert a row. To insert a row at the end, specify Infinity. * @returns The number of the row that was added if it succeeds and -1 if an error occurs. * @since 0.0.0 */ insertRow(row?: number): number; /** * Saves the contents of a DataWindow or DataStore in the format you specify * @param exportType An enumerated value of the `SaveAsType` * @param headings Optional. Add headers string for CSV and TXT formats. Default value is _true_. * @returns A `Promise` that resolves to string in the specified format */ exportString(exportType: SaveAsType, headings?: boolean): Promise<string>; /** * Inserts data into a DataWindow control or DataStore from tab-separated, comma-separated, or XML/JSON data in a string. * * @param importType An enumerated value of the `SaveAsType` * @param source A string from which you want to copy the data. The string should contain tab-separated or comma-separated columns or XML/JSON with one row per line * @param options Optional object with the following optional properties: ** _startRow_ The number of the first detail row in the string that you want to copy. The default is 0. ** _endRow_ The number of the last detail row in the string that you want to copy. The default is the rest of the rows. ** _startCol_ The number of the first column in the string that you want to copy. The default is 0. ** _endCol_ The number of the last column in the string that you want to copy. The default is the rest of the columns. ** _dwStartCol_ The number of the first column in the DataWindow control or DataStore that should receive data. The default is 0. * @returns {Promise} A `Promise` that resolves to the number of rows that were imported if it succeeds or one of the following negative integers if an error occurs: ** -1 No rows or startrow value supplied is greater than the number of rows in the string, ** -3 Invalid argument, ** -4 Invalid input, ** -11 XML Parsing Error; XML parser libraries not found or XML not well-formed, ** -12 XML Template does not exist or does not match the DataWindow, ** -13 Unsupported DataWindow style for import, ** -14 Error resolving DataWindow nesting ** -15 JSON Parsing Error * @since 0.0.0 * @async */ importString(importType: SaveAsType, source: string, options?: { startRow?: number; endRow?: number; startCol?: number; endCol?: number; dwStartCol?: number; }): Promise<number>; /** * Accesses the database to retrieve values for all columns that can be updated and refreshes all timestamp columns in a row in a DataWindow control or DataStore. The values from the database are redisplayed in the row. * @param row A value identifying the row to reselect * @returns `Promise` object that returns 1 if it is successful and -1 if the row cannot be reselected (for example, the DataWindow object cannot be updated or the row was deleted by another user) * @since 0.0.0 * @see {@link reselectRows} */ reselectRow(row: number): Promise<ResultCode>; /** * Gets data from the specified row and column values in the specified Buffer. You can obtain the * data that was originally retrieved and stored in the database from the original buffer, * as well as the current value in the primary, delete, or filter buffers. * * @param row A value identifying the row location of the data. * @param column The column location of the data. Column can be a column number or a column name. * @param bufferType A value identifying the DataWindow buffer from which you want to get the data. * @param original A boolean indicating whether you want to return the original or current values for row and column: * _true_ - returns the original values (the values initially retrieved from the database). * _false_ - (Default) returns the current values. * @returns Returns the value in the specified row and column. Returns _null_ if the column value is null or * if there is no DataWindow object assigned to the DataWindow control or DataStore. * @since 0.0.0 */ getItem(row: number, column: string | number, bufferType?: BufferType, original?: boolean): any | null; /** * Reports the number of the current row in a DataWindow control or DataStore object. * @returns The number of the current row in dwcontrol. Returns -1 if no row is current * @since 0.0.0 */ getRow(): number; /** * Sets the current row in a DataWindow control or DataStore. * @param newRow The row you want to make current * @returns Returns 1 if it succeeds, 0 if the row is the current row indeed, and -1 if an error occurs. * @since 0.0.0 * @description * This method emits the following events: * * {@link DwRowFocusChangingEvent} * * {@link DwRowFocusChangedEvent} */ setRow(newRow: number): ResultCode; /** * Gets the unique row identifier of a row in a DataWindow control or DataStore object from the row number associated with that row. * The row identifier value is not the same as the row number value used in many DataWindow and DataStore function calls and * should not be used for the row number value. Instead, you should first convert the unique row identifier into a row number by calling * GetRowFromRowId. * * @param row A number specifying the row number for which you want the associated row identifier. * @param bufferType A value of the dwBuffer enumerated datatype. Default is Primary! * @returns Returns the row identifier in buffer. Returns -1 if the row identifier is not in the current buffer and -1 if an error occurs. * @see {@link getRowFromRowId} * @since 0.0.0 */ getRowIdFromRow(row: number | Object, bufferType?: BufferType): number; /** * Gets the row number of a row in a DataWindow control or DataStore object from the unique row identifier associated with that row. * * @param rowID A number specifying the row identifier for which you want the associated row number. * @param bufferType A value of the dwBuffer enumerated datatype. Default is Primary! * @returns Returns the row number in buffer. Returns -1 if the row number is not in the current buffer * @see {@link getRowIdFromRow} * @since 0.0.0 */ getRowFromRowId(rowID: number, bufferType?: BufferType): number; /** * Gets current row's data object * * @param {number} row Optional row number. Default is current row in the DataWindow/DataStore * @returns Row object or null if row number is invalid * @since 0.0.0 */ getRowObject(row?: number): any; /** * Obtains the first visible row in the DataWindow control * @returns {number} Row number or -1 if error occurs * @since 0.0.0 */ getFirstVisibleRow(): number; /** * Obtains the last visible row in the DataWindow control * @returns {number} Row number or -1 if error occurs * @since 0.0.0 */ getLastVisibleRow(): number; /** * Obtains the number of the column the user clicked or double-clicked in a DataWindow control or DataStore object. * @returns Returns the number of the column that the user clicked or double-clicked in dwcontrol. * Returns -1 if the user did not click or double-click a column (for example, the user double-clicked outside the data area, * in text or spaces between columns, or in the header, summary, or footer area). * @abstract * @since 0.0.0 */ getClickedColumn(): number; /** * Gets visible columns count in the DataWindow * @since 0.0.0 */ getControlCount(): number; /** * Gets count of table columns * @returns Number of columns * @since 0.0.0 */ columnCount(): number; /** * Obtains the number of the current column. The current column is the column that has focus. * @returns The number of the current column in dwcontrol. Returns -1 if no column is current. * @since 0.0.0 */ getColumn(): number; /** * Obtains the name of the current column. The current column is the column that has the focus. * @returns Returns the name of the current column in dwcontrol. * Returns the empty string ("") if no column is current or if an error occurs. * @since 0.0.0 */ getColumnName(): string; /** * Obtains the column's data type by its index or name * @param col {number|string} Column identifier * @returns {string} Column's data type or "!" if column with specified name/index is not found * @since 0.0.0 */ getColumnType(col: number | string): string; /** * Obtains DataWindow control as a DwObject object by its index or name. * * @param indexOrName Optional. DataWindow control's ordered number or string name. If this parameter is null function applies a current cell * number. Default value is null * @returns {DwObject|null} DataWindow's control object * * @example * const dw = (dwEmpList) as DwBaseComponent; * let dwo = dw.getDwObject(0); * let cName = dwo.name; // ID * dwo = dw.getDwObject("emp_name"); * let cType = dwo.colType; * * @see {@link currentCell} * @since 0.0.0 */ getDwObject(indexOrName?: number | string | null): DwObject | null; /** * Obtains the values in the code table for the column * * @param column The column for which you want to get CodeTable items. Column can be a column number (integer) or a column name (string). * @returns CodeTable items array * @since 0.0.0 */ getValues(column: string | number): CodeTableItem[] | undefined; /** * Obtains the value of an item in a value list or code table associated with a column in a DataWindow * * @param column The column for which you want the item. Column can be a column number (integer) or a column name (string). * @param index The number of the item in the value list or the code table for the edit style. * @returns Returns the item identified by index in the value list. Returns null if the index is not valid or the column does not have a value list or code table. * @since 0.0.0 */ getValue(column: string | number, index: number): CodeTableItem | undefined; getValueByCode(column: string | number, value: string | number | null): CodeTableItem | undefined; /** * Determines if the specified `column` has a table of display values and corresponding data values * @param column Column's name or number * @returns _True_ if the column definition contains a code table structure, else returns _false_ */ hasCodeTable(column: string | number): boolean; /** * Obtains the display value in the code table associated with the data value in the specified column. * @param column The column for which you want the code table display value. Column's value can be a text or column's definition number * @param value Key value to search the display value in the code table * @returns {string} Display text for the column's value or value itself if it was not found in the column's value list or code table * @see {@link getValue} * @see {@link getValueByCode} * @since 0.0.0 */ getDisplayValue(column: string | number, value: any): string; /** * * @param nCol * @returns */ getControlCssWidth(nCol: number): string; /** * Accesses the database to retrieve rows with values of parameters, filter and sort conditions that is * currently used in the DataWindow/DataStore. * @returns {Promise} Promise object * @since 0.0.0 */ reselectRows(): Promise<number>; /** * Clears all the data from a DataWindow control or DataStore object. * Reset is not the same as deleting rows from the DataWindow object or * child DataWindow. Reset affects the application only, not the database. * If you delete rows and then call the Update method, the rows are deleted from * the database table associated with the DataWindow object. If you call Reset and * then call Update, no changes are made to the table. * * @returns 1 if it succeeds and -1 if an error occurs. The return value is usually not used. * @since 0.0.0 */ reset(): ResultCode; /** * When a row is changed, inserted, or deleted, its update flag is set, making it marked for update. * By default, the Update method turns these flags off. If you want to coordinate updates of more than * one DataWindow or DataStore, however, you can prevent Update from clearing the flags. Then, after you verify * that all the updates succeeded, you can call ResetUpdate for each DataWindow to clear the flags. * If one of the updates failed, you can keep the update flags, prompt the user to fix the problem, and * try the updates again. * You can find out which rows are marked for update with the GetItemStatus method. If a row is in the * delete buffer or if it is in the primary or filter buffer and has NewModified! or DataModified! status, * its update flag is set. After update flags are cleared, all rows have the status NotModified! or New! and * the delete buffer is empty * @returns Completion code * @see {@link update} * @since 0.0.0 */ resetUpdate(): ResultCode; /** * Retrieves rows from the database for a DataWindow control or DataStore. If arguments are included, * the argument values are used for the retrieval arguments in the SQL SELECT statement for the DataWindow * object or child DataWindow. * * @method retrieve * @param {...any} args One or more values that you want to use as retrieval arguments * @returns {Promise} Promise object * @since 0.0.0 */ retrieve(...args: any): Promise<number>; /** * Updates the DataWindow with the changes made in a DataWindow control or DataStore. * Method {@link update} can also call {@link acceptText} for the current row and column before it updates the database. * @param accept (optional) A `boolean` value specifying whether the DataWindow control or DataStore should automatically perform an AcceptText prior to performing the update. Default is _true_. * @param resetflag (optional) A `boolean` value specifying whether the DataWindow control or DataStore should automatically reset the update flags. Default is _true_. * @returns {Promise<ResultCode>} `Promise` of update result code: Success(1), Failure(-1) or Nothing(0) happenings * @see {@link acceptText} * @see {@link resetUpdate} * @see {@link updatesPending} * @see {@link updating} * @since 0.0.0 */ update(accept?: boolean, resetflag?: boolean): Promise<ResultCode>; /** * Copies a range of rows from one DataWindow control (or DataStore object) to another, or from one buffer to another within a single DataWindow control (or DataStore). * * @param startrow The number of the first row you want to copy. * @param endrow The number of the last row you want to copy. * @param srcbuffer A value of the BufferType identifying the DataWindow buffer from which you want to copy rows. * @param target A reference to the DataWindow control or DataStore object to which you want to copy the rows. Target can be the same DataWindow (or DataStore) or another DataWindow (or DataStore) * @param beforerow The number of the row before which you want to insert the copied rows. To insert after the last row, use any value that is greater than the number of existing rows. * @param destbuffer A value of the BufferType enumerated datatype identifying the target DataWindow buffer for the copied rows. * @returns Returns 1 if it succeeds, 0 if nothing happens and -1 if an error occurs. * @since 0.0.0 */ rowsCopy(startrow: number, endrow: number, srcbuffer: BufferType, target: DataStore<any>, beforerow: number, destbuffer: BufferType): ResultCode; /** * Clears a range of rows from one DataWindow control (or DataStore) and inserts them in another. * Alternatively, RowsMove moves rows from one buffer to another within a single DataWindow control * (or DataStore). * * @param startrow The number of the first row you want to move. * @param endrow The number of the last row you want to move. * @param srcbuffer A value of the BufferType identifying the DataWindow buffer from which you want to move rows. * @param target A reference to the DataWindow control or DataStore object to which you want to move the rows. Target can be the same DataWindow (or DataStore) or another DataWindow (or DataStore) * @param beforerow The number of the row before which you want to insert the moved rows. To insert after the last row, use any value that is greater than the number of existing rows. * @param destbuffer A value of the BufferType enumerated datatype identifying the target DataWindow buffer for the moving rows. * @returns Returns 1 if it succeeds, 0 if nothing happens and -1 if an error occurs. * @since 0.0.0 */ rowsMove(startrow: number, endrow: number, srcbuffer: BufferType, target: DataStore<any>, beforerow: number, destbuffer: BufferType): ResultCode; /** * Discards a range of rows in a DataWindow control. Once a row has been discarded using RowsDiscard, you cannot restore the row. * You have to retrieve it again from the database. * * @param startrow The number of the first row you want to discard. * @param endrow The number of the last row you want to discard. * @param dwbuffer A value of the BufferType enumerated datatype * @returns Returns 1 if it succeeds, 0 if nothing was deleted and -1 if an error occurs. * @since 0.0.0 */ rowsDiscard(startrow: number, endrow: number, dwbuffer?: BufferType): ResultCode; /** * Sets the current column in a DataWindow control or DataStore. * * @param col The column you want to make current. Column can be a column number or a column name. * @returns Returns 1 if it succeeds and -1 if an error occurs. * If column is less than 0 or greater than the number of columns - 1, SetColumn fails. * @since 0.0.0 * @event DwItemFocusChangedEvent */ setColumn(col: number | string): ResultCode; /** * Controls the automatic redrawing of an object or control after each change to its properties. * By default, CuteDW redraws a control after each change to properties that affect appearance. * Use SetRedraw to turn off redrawing temporarily in order to avoid flicker and reduce redrawing time * when you are making several changes to the properties of an object or control. * If the window is not visible, SetRedraw fails. * * @param redraw A boolean value that controls whether DataWindow redraws an object automatically after a change. Values are: * _true_ - Automatically redraw the object or control after each change to its properties, * _false_ - Do not redraw after each change. * @returns Returns 1 if it succeeds and -1 if an error occurs. * @since 0.0.0 */ setRedraw(redraw: boolean): ResultCode; /** * Gets the total number of pages when a DataWindow object is being viewed * @returns The total number of pages */ pageCount(): number; /** * Gets the number of the current page * @returns The number of the current page */ pageIndex(): number; /** * Gets the maximum number of rows per page * @returns The current page size */ pageSize(): number; /** * Scrolls the DataWindow a specified number of lines up or down. * * @param lines A value specifying the direction and number of lines you want to scroll. To scroll down, use a positive value. To scroll up, use a negative value. * @returns The `Promise` to return the line number of the first visible line in dwcontrol if it succeeds, or -1 if an error occurs. * * @abstract * @async * @since 0.0.0 * @see {@link scrollFirstPage} * @see {@link scrollLastPage} * @see {@link scrollNextPage} * @see {@link scrollNextRow} * @see {@link scrollPriorPage} * @see {@link scrollPriorRow} * @see {@link scrollToRow} * */ scroll(lines: number): Promise<number>; /** * Scrolls a Web DataWindow control to the first page, displaying the result set's first group of rows in the Web page. (A page is the number of rows that are displayed in the DataWindow control at one time.) ScrollFirstPage changes the current row, but not the current column. * @returns The `Promise` of a numeric result denoting 1 if the method succeeds and -1 if an error occurs. * * @abstract * @async * @since 0.0.0 */ scrollFirstPage(): Promise<ResultCode>; /** * Scrolls a Web DataWindow control to the last page, displaying the result set's last group of rows in the Web page. (A page is the number of rows that are displayed in the DataWindow control at one time.) ScrollLastPage changes the current row, but not the current column. * @returns The `Promise` of a numeric result denoting 1 if the method succeeds and -1 if an error occurs. * * @abstract * @async * @since 0.0.0 */ scrollLastPage(): Promise<ResultCode>; /** * Scrolls a DataWindow control forward one page, displaying the next group of rows in the DataWindow's display area. * (A page is the number of rows that can be displayed in the DataWindow control at one time.) * {@link scrollNextPage} changes the current row, but not the current column. * @returns The `Promise` of a numeric result denoting 1 if the method succeeds and -1 if an error occurs. * * @abstract * @async * @since 0.0.0 */ scrollNextPage(): Promise<ResultCode>; /** * Scrolls a DataWindow control to the next row (forward one row). * ScrollNextRow changes the current row, but not the current column. * @returns The `Promise` of a numeric result denoting 1 if the method succeeds and -1 if an error occurs. * * @abstract * @since 0.0.0 */ scrollNextRow(): Promise<ResultCode>; /** * Scrolls a DataWindow control backward one page, displaying another group of rows in the DataWindow's display area. * @returns The `Promise` of a numeric result denoting 1 if the method succeeds and -1 if an error occurs. * * @abstract * @async * @since 0.0.0 */ scrollPriorPage(): Promise<ResultCode>; /** * Scrolls a DataWindow control backward one row. ScrollPriorRow changes the current row but not the current column. * @returns The `Promise` of a numeric result denoting 1 if the method succeeds and -1 if an error occurs. * * @abstract * @async * @since 0.0.0 */ scrollPriorRow(): Promise<ResultCode>; /** * Scrolls a DataWindow control to the specified row. The current row changes if * highlight value is true. * * @param row {number} A value identifying the row to which you want to scroll. * @param highlight {boolean} Set row as the current row in the DataWindow * @param smooth {boolean} Apply smooth scrolling or not * @param alignTo {auto|top|bottom} Edge of row to align * @returns Returns 1 if it succeeds and -1 if an error occurs * * @abstract * @async * @since 0.0.0 */ protected scrollToNthRow(row: number, highlight?: boolean, smooth?: boolean, alignTo?: "auto" | "top" | "bottom"): Promise<ResultCode>; /** * Scrolls a DataWindow control to the specified row. _ScrollToRow_ changes the current row but not the current column * @param row A value identifying the row to which you want to scroll. * If row is 0, _ScrollToRow_ scrolls to the first row. * If row is greater than the last row number, it scrolls to the last row. * If row is visible without scrolling, the DataWindow does not scroll. * @returns The number of the row to which the DataWindow scrolls if it succeeds and -1 if an error occurs. * * @abstract * @async * @since 0.0.0 */ scrollToRow(row: number): Promise<number>; /** * Shares data retrieved by one DataWindow control (or DataStore), which is referred to as the * primary DataWindow, with another DataWindow control (or DataStore), referred to as the secondary * DataWindow. * The controls do not share formatting; only the data is shared, including data in the _primary_ buffer, * the _delete_ buffer, the _filter_ buffer, and the sort order. * * @param child The name of the secondary DataWindow with which the control dwprimary will share the data. * @returns Returns 1 if it succeeds and -1 if an error occurs. * @see {@link shareDataOff} * @since 0.0.0 */ shareData(child: DataStore<any>): ResultCode; /** * Turns off the sharing of data buffers for a DataWindow control or DataStore. * When you call ShareDataOff for a secondary DataWindow, that control no longer * contains data, but the primary DataWindow and other secondary controls are not affected. * When you call ShareDataOff for the primary DataWindow, all secondary DataWindows are disconnected and * no longer contain data. * @returns Returns 1 if it succeeds and -1 if an error occurs. * @see {@link shareData} * @since 0.0.0 */ shareDataOff(): ResultCode; /** * Checks whether the DataWindow is shared by any other DataStore/DataWindow object * @returns _true_ if the DataWindow has any secondary DataStore/DataWindow that was shared with this DataWindow object, else _false_ */ isShared(): boolean; /** * Reports the number of the next highlighted row after a specified row in a DataWindow control or DataStore object. * * @param row A value identifying the location of the row after which you want to search for the next selected row. Specify -1 to begin searching at the first row. * @returns Returns the number of the first row that is selected after row in dwcontrol. Returns -1 if no row is selected after the specified row. * @since 0.0.0 */ getSelectedRow(row: number): number; /** * Gets selected rows array * @returns Readonly array of row objects * @since 0.0.0 */ getSelectedRows(): readonly any[]; /** * Whether the number of selected elements matches the total number of rows. * * @returns true if all rows was selected, else false * @since 0.0.0 */ isAllSelected(): boolean; /** * Determines whether a row is selected in a DataWindow or DataStore. A selected row is highlighted using reverse video. * @param row A value identifying the row you want to test to see if it is selected * @returns Returns true if row in dwcontrol is selected and false if it is not selected. If row is greater than the number of rows in dwcontrol or negative, IsSelected also returns false. * @since 0.0.0 */ isSelected(row: number): boolean; /** * Reports if DataWindow has selected rows * @returns true if DataWindow has selected rows, else returns false * @since 0.0.0 */ hasSelectedRows(): boolean; /** * Selects all rows if they are not all selected, otherwise clear selection. * @returns 1 if it succeeds and -1 if an error occurs. * @since 0.0.0 */ masterToggle(): ResultCode; /** * Reports if DataWindow has selected rows and how many * @returns Number of selected rows in the DataWindow/DataStore * @since 0.0.0 */ selectedCount(): number; /** * Highlights or removes highlights from rows in a DataWindow control or DataStore. You can select all rows or a single row. * SelectRow does not affect which row is current. It does not select rows in the database. * @param row A value identifying the row you want to select or deselect. Specify Infinity to select or deselect all rows. * @param select A boolean value that determines whether the row is selected or not selected: ** _true_ - select the row(s) so that they are highlighted. ** _false_ - deselect the row(s) so that they are not highlighted. * @returns 1 if it succeeds and -1 if an error occurs. * @since 0.0.0 */ selectRow(row: number, select: boolean): ResultCode; /** * Toggles selection status on specified row * @row A value identifying the row you want to toggle selection * @returns New selection status or _undefined_ if an error occurs * @since 0.0.0 */ selectToggle(row: number): boolean | undefined; /** * Searches for the next break for the specified group. A group break occurs when the value in the column for the group changes. * `findGroupChange` reports the row that begins the next section. * @description * If the starting row begins a new section at the specified level, then that row is the one returned. * To continue searching for subsequent breaks, increment the starting row so that the search resumes with * the second row in the group. * @param row A value identifying the row at which you want to begin searching for the group break. * @param level The number of the group for which you are searching. Groups are numbered in the order in which you defined them. * The return value observes these rules based on the value of row. If the starting row is: * · _The first row in a group_, then `findGroupChange` returns the starting row number * · _A row within a group_, other than the last group, then `findGroupChange` returns the row number of the first row of the next group * · _A row in the last group_, other than the first row of the last group, then `findGroupChange` returns -1 * @returns The number of the row whose group column has a new value, meaning that it begins a new group. * Returns -1 if the value in the group column did not change and -100 if an error occurs. * @since 0.0.0 */ findGroupChange(row: number, level: number): number; /** * Gets the number of groups defined in the DataWindow/DataStore object * @returns Group count */ groupCount(): number; /** * Recalculates the breaks in the grouping levels in a DataStore/DataWindow. * * @description * Use `groupCalc` to force the DataWindow object to recalculate the breaks in the grouping levels * after you have added or modified rows in a