ngx-rs-ant 0.10.5 → 0.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -989,7 +989,7 @@ class DataGridComponent {
989
989
  }
990
990
  reload() {
991
991
  this.columns.length = 0;
992
- this.service.getMetadataByView(this.tenant, this.className, this.view || '').subscribe((response) => {
992
+ this.service.getMetadataByView(this.tenant, this.className, this.view || '').subscribe(response => {
993
993
  const columns = [];
994
994
  for (let field of response.data.columns) {
995
995
  switch (field.type) {
@@ -1462,6 +1462,16 @@ class FormService {
1462
1462
  }
1463
1463
  });
1464
1464
  }
1465
+ getInitModelByTemplate(tenant, className, template) {
1466
+ let api = 'api/data/' + className + '/new';
1467
+ return this.http.get(api, {
1468
+ params: {
1469
+ tenant,
1470
+ className,
1471
+ template: template || ''
1472
+ }
1473
+ });
1474
+ }
1465
1475
  createOrUpdate(tenant, className, model) {
1466
1476
  let api = 'api/data/' + className;
1467
1477
  if (model.oid) {
@@ -1490,12 +1500,12 @@ class FormComponent {
1490
1500
  this.loading = false;
1491
1501
  }
1492
1502
  ngOnInit() {
1493
- this.service.getFormTemplateConfig(this.tenant, this.className, this.template).subscribe((response) => {
1503
+ this.loading = true;
1504
+ this.service.getFormTemplateConfig(this.tenant, this.className, this.template).subscribe(response => {
1494
1505
  this.config = response.data.template;
1495
1506
  if (this.copyOid || this.oid) {
1496
- this.loading = true;
1497
1507
  this.service.getOne(this.tenant, this.className, this.copyOid || this.oid, this.template)
1498
- .subscribe((response) => {
1508
+ .subscribe(response => {
1499
1509
  if (this.copyOid) {
1500
1510
  delete response.data.oid;
1501
1511
  }
@@ -1505,8 +1515,11 @@ class FormComponent {
1505
1515
  });
1506
1516
  }
1507
1517
  else {
1508
- this.model = {};
1509
- this.loaded = true;
1518
+ this.service.getInitModelByTemplate(this.tenant, this.className, this.template).subscribe(response => {
1519
+ this.model = response.data;
1520
+ this.loaded = true;
1521
+ this.loading = false;
1522
+ });
1510
1523
  }
1511
1524
  });
1512
1525
  }
@@ -1525,7 +1538,7 @@ class FormComponent {
1525
1538
  this.service.createOrUpdate(this.tenant, this.className, {
1526
1539
  oid: this.oid,
1527
1540
  ...this.model
1528
- }).subscribe((response) => {
1541
+ }).subscribe(response => {
1529
1542
  this.submitCallback.emit(response);
1530
1543
  });
1531
1544
  }