How to use the @delon/util.deepCopy 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-data-source.ts View on Github external
if (Array.isArray(result)) {
            ret = result;
            retTotal = ret.length;
            retPs = retTotal;
            showPage = false;
          } else {
            // list
            ret = deepGet(result, res.reName!.list as string[], []);
            if (ret == null || !Array.isArray(ret)) {
              ret = [];
            }
            // total
            const resultTotal = res.reName!.total && deepGet(result, res.reName!.total as string[], null);
            retTotal = resultTotal == null ? total || 0 : +resultTotal;
          }
          return deepCopy(ret);
        }),
      );
github ng-alain / delon / packages / abc / sidebar-nav / sidebar-nav.spec.ts View on Github external
it('should be hide group name', () => {
        createComp();
        page.checkCount('.sidebar-nav__group-title');
        const data = deepCopy(MOCKMENUS) as Nav[];
        data[0].group = false;
        menuSrv.add(data);
        fixture.detectChanges();
        page.checkCount('.sidebar-nav__group-title', 0);
      });
github ng-alain / delon / src / app / shared / components / code-box / code-box.component.ts View on Github external
set item(value: any) {
    if (!this._orgItem) {
      this._orgItem = deepCopy(value);
    }
    const ret: any = {
      meta: value.meta,
      code: value.code.trim(),
      title: this.i18n.get(value.meta.title),
      summary: this.sanitizer.bypassSecurityTrustHtml(this.i18n.get(value.summary)),
      browser: +value.meta.browser > 0 ? +value.meta.browser : null,
      bg: value.meta.bg,
      urls: value.urls,
    };
    this._item = ret;
  }
  get item() {
github ng-alain / delon / packages / form / src / utils.ts View on Github external
export function getCopyEnum(list: any[], formData: any, readOnly: boolean) {
  return getEnum(deepCopy(list || []), formData, readOnly);
}
github ng-alain / delon / src / app / shared / components / docs / docs.component.ts View on Github external
private genData() {
    const item = deepCopy(this.item);
    const ret: any = {
      demo: item.demo,
      urls: item.urls,
      con: item.content[this.i18n.lang] || item.content[this.i18n.defaultLang],
    };

    if (ret.demo && this.codes && this.codes.length) {
      this.genDemoTitle();
      const toc = ret.con.toc as any[];
      const apiPos = toc.findIndex(w => w.title === 'API');
      toc.splice(
        apiPos === -1 ? 0 : apiPos,
        0,
        ...[
          {
            h: 2,
github ng-alain / delon / packages / abc / sidebar-nav / sidebar-nav.spec.ts View on Github external
function createComp(needMockNavigateByUrl = true, callback?: () => void) {
    fixture = TestBed.createComponent(TestComponent);
    dl = fixture.debugElement;
    context = fixture.componentInstance;
    fixture.detectChanges();
    router = injector.get(Router);
    setSrv = injector.get(SettingsService);
    menuSrv = injector.get(MenuService);
    doc = injector.get(DOCUMENT);
    menuSrv.add(deepCopy(MOCKMENUS));
    page = new PageObject();
    if (needMockNavigateByUrl) spyOn(router, 'navigateByUrl');
    if (callback) callback();
  }
github ng-alain / delon / packages / form / spec / base.spec.ts View on Github external
chainSchema(schema: SFSchema, overObject: SFSchema): this {
    context.schema = {
      ...deepCopy(schema),
      properties: { a: overObject },
    };
    return this.dc();
  }
github dotnetcore / OSharp / samples / web / ui-clients / ng-alain8 / src / app / layout / default / setting-drawer / setting-drawer.component.ts View on Github external
private resetData(nowData?: {}, run = true) {
    nowData = nowData || {};
    const data = deepCopy(DEFAULT_VARS);
    Object.keys(data).forEach(key => {
      const value = nowData![`@${key}`] || data[key].default || '';
      data[key].value = value === `@primary-color` ? this.color : value;
    });
    this.data = data;
    if (run) {
      this.cdr.detectChanges();
      this.runLess();
    }
  }