How to use the @delon/util.deepMergeKey function in @delon/util

To help you get started, we’ve selected a few @delon/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ng-alain / delon / packages / abc / table / table.component.ts View on Github external
_btnClick(record: STData, btn: STColumnButton, e?: Event) {
    // should be stop propagation when expandRowByClick is true
    if (e && this.expandRowByClick === true) {
      e.stopPropagation();
    }
    if (btn.type === 'modal' || btn.type === 'static') {
      const { modal } = btn;
      const obj = { [modal!.paramsName!]: record };
      (this.modalHelper[btn.type === 'modal' ? 'create' : 'createStatic'] as any)(
        modal!.component,
        { ...obj, ...(modal!.params && modal!.params!(record)) },
        deepMergeKey({}, true, this.copyCog.modal, modal),
      )
        .pipe(filter(w => typeof w !== 'undefined'))
        .subscribe(res => this.btnCallback(record, btn, res));
      return;
    } else if (btn.type === 'drawer') {
      const { drawer } = btn;
      const obj = { [drawer!.paramsName!]: record };
      this.drawerHelper
        .create(
          drawer!.title!,
          drawer!.component,
          { ...obj, ...(drawer!.params && drawer!.params!(record)) },
          deepMergeKey({}, true, this.copyCog.drawer, drawer),
        )
        .pipe(filter(w => typeof w !== 'undefined'))
        .subscribe(res => this.btnCallback(record, btn, res));
github ng-alain / delon / packages / abc / table / table.component.ts View on Github external
set res(value: STRes) {
    const item = deepMergeKey({}, true, this.cog.res, value);
    const reName = item.reName;
    if (!Array.isArray(reName.list)) reName.list = reName.list.split('.');
    if (!Array.isArray(reName.total)) reName.total = reName.total.split('.');
    this._res = item;
  }
  /** 分页器配置 */
github ng-alain / delon / packages / abc / date-picker / range.component.ts View on Github external
constructor(cog: DatePickerConfig) {
    this._cog = deepMergeKey(new DateRangePickerConfig(), true, cog && cog.range);
    Object.assign(this, this._cog);
  }
github ng-alain / delon / packages / abc / date-picker / range.component.ts View on Github external
set shortcut(val: DateRangePickerShortcut | null) {
    const item = deepMergeKey({}, true, this._cog.shortcuts, val == null ? {} : val) as DateRangePickerShortcut;
    if (typeof val === 'boolean') {
      item.enabled = val;
    }
    this._shortcut = item;
  }
  get shortcut() {
github ng-alain / delon / packages / abc / table / table.component.ts View on Github external
private modalHelper: ModalHelper,
    private drawerHelper: DrawerHelper,
    @Inject(DOCUMENT) private doc: any,
    private columnSource: STColumnSource,
    private dataSource: STDataSource,
    private delonI18n: DelonLocaleService,
  ) {
    this.delonI18n.change.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
      this.locale = this.delonI18n.getData('st');
      if (this._columns.length > 0) {
        this.page = this.clonePage;
        this.cd();
      }
    });

    this.copyCog = deepMergeKey(new STConfig(), true, cog);
    delete this.copyCog.multiSort;
    Object.assign(this, this.copyCog);
    if (cog.multiSort && cog.multiSort.global !== false) {
      this.multiSort = { ...cog.multiSort };
    }

    i18nSrv.change
      .pipe(
        takeUntil(this.unsubscribe$),
        filter(() => this._columns.length > 0),
      )
      .subscribe(() => this.refreshColumns());
  }
github ng-alain / delon / packages / abc / table / table.component.ts View on Github external
setRow(index: number, item: STData): this {
    this._data[index] = deepMergeKey(this._data[index], false, item);
    this._data = this.dataSource.optimizeData({ columns: this._columns, result: this._data, rowClassName: this.rowClassName });
    this.cdr.detectChanges();
    return this;
  }
github ng-alain / delon / packages / abc / table / table.component.ts View on Github external
modal!.component,
        { ...obj, ...(modal!.params && modal!.params!(record)) },
        deepMergeKey({}, true, this.copyCog.modal, modal),
      )
        .pipe(filter(w => typeof w !== 'undefined'))
        .subscribe(res => this.btnCallback(record, btn, res));
      return;
    } else if (btn.type === 'drawer') {
      const { drawer } = btn;
      const obj = { [drawer!.paramsName!]: record };
      this.drawerHelper
        .create(
          drawer!.title!,
          drawer!.component,
          { ...obj, ...(drawer!.params && drawer!.params!(record)) },
          deepMergeKey({}, true, this.copyCog.drawer, drawer),
        )
        .pipe(filter(w => typeof w !== 'undefined'))
        .subscribe(res => this.btnCallback(record, btn, res));
      return;
    } else if (btn.type === 'link') {
      const clickRes = this.btnCallback(record, btn);
      if (typeof clickRes === 'string') {
        this.router.navigateByUrl(clickRes, { state: this.routerState });
      }
      return;
    }
    this.btnCallback(record, btn);
  }
github ng-alain / delon / packages / abc / table / table.component.ts View on Github external
set page(value: STPage) {
    this.clonePage = value;
    const item = deepMergeKey({}, true, new STConfig().page, this.cog.page, value);
    const { total } = item;
    if (typeof total === 'string' && total.length) {
      this.totalTpl = total;
    } else if (toBoolean(total)) {
      this.totalTpl = this.locale.total;
    } else {
      this.totalTpl = '';
    }
    this._page = item;
  }
  /** 是否多排序,当 `sort` 多个相同值时自动合并,建议后端支持时使用 */