Skip to content

Commit

Permalink
feat(abc:st): add arrayProcessMethod in setRow
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Nov 27, 2024
1 parent 2547da9 commit 2c48f52
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/abc/st/st.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,26 @@ export class STComponent implements AfterViewInit, OnChanges {
* this.st.setRow(item, { price: 100 })
* ```
*/
setRow(index: number | STData, item: STData, options?: { refreshSchema?: boolean; emitReload?: boolean }): this {
setRow(
index: number | STData,
item: STData,
options?: {
refreshSchema?: boolean;
emitReload?: boolean;
/**
*
* @param arrayProcessMethod 数组处理方式
* - `true` 表示替换新值,不管新值为哪种类型
* - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)
*/
arrayProcessMethod?: boolean;
}
): this {
options = { refreshSchema: false, emitReload: false, ...options };
if (typeof index !== 'number') {
index = this._data.indexOf(index);
}
this._data[index] = deepMergeKey(this._data[index], false, item);
this._data[index] = deepMergeKey(this._data[index], options?.arrayProcessMethod ?? false, item);
this.optimizeData();
if (options.refreshSchema) {
this.resetColumns({ emitReload: options.emitReload });
Expand Down

0 comments on commit 2c48f52

Please sign in to comment.