fantasy-ngzorro 2.2.22 → 2.2.23

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.
@@ -7314,7 +7314,9 @@ class HdFormLinesComponent {
7314
7314
  }));
7315
7315
  }
7316
7316
  formGroupObj.lineIndex = this.fb.control(this.linesFormArray.controls.length + 1, []);
7317
- formGroupObj.isHdFormLineSearchAdd = this.fb.control(this.isFilterData, []);
7317
+ // 仅真正新增/复制的行在插入前单独置 true;搜索重建已有行必须为 false,
7318
+ // 否则筛选态下点「添加」会把第一行可见数据再插入一份
7319
+ formGroupObj.isHdFormLineSearchAdd = this.fb.control(false, []);
7318
7320
  /** @type {?} */
7319
7321
  let formGroupSubmit = this.fb.group(formGroupObj);
7320
7322
  this.formLines.forEach((/**
@@ -7394,6 +7396,7 @@ class HdFormLinesComponent {
7394
7396
  const insertAt = this.getInsertIndexAfter(afterLine);
7395
7397
  /** @type {?} */
7396
7398
  const newLine = this.newLineItem();
7399
+ this.markSearchAddedLine(newLine);
7397
7400
  this.linesFormArray.insert(insertAt, newLine);
7398
7401
  this.calculateLineNumber();
7399
7402
  this.addLineEvent.emit(newLine);
@@ -7429,7 +7432,10 @@ class HdFormLinesComponent {
7429
7432
  const sourceValues = line.getRawValue();
7430
7433
  /** @type {?} */
7431
7434
  const insertAt = sourceIndex + 1;
7432
- this.linesFormArray.insert(insertAt, this.createLineFromValues(sourceValues, false, true));
7435
+ /** @type {?} */
7436
+ const copiedLine = this.createLineFromValues(sourceValues, false, true);
7437
+ this.markSearchAddedLine(copiedLine);
7438
+ this.linesFormArray.insert(insertAt, copiedLine);
7433
7439
  this.calculateLineNumber();
7434
7440
  setTimeout((/**
7435
7441
  * @return {?}
@@ -7492,6 +7498,22 @@ class HdFormLinesComponent {
7492
7498
  this.collectDomData();
7493
7499
  }), 0);
7494
7500
  }
7501
+ /**
7502
+ * 筛选结果中新增/复制的行打标,写回全量数据后立即清掉
7503
+ * @private
7504
+ * @param {?} line
7505
+ * @return {?}
7506
+ */
7507
+ markSearchAddedLine(line) {
7508
+ if (!this.isFilterData || !line) {
7509
+ return;
7510
+ }
7511
+ /** @type {?} */
7512
+ const flag = line.get("isHdFormLineSearchAdd");
7513
+ if (flag) {
7514
+ flag.setValue(true, { emitEvent: false });
7515
+ }
7516
+ }
7495
7517
  /**
7496
7518
  * 在指定行后方的插入下标;无行则追加到末尾
7497
7519
  * @private
@@ -7562,8 +7584,7 @@ class HdFormLinesComponent {
7562
7584
  }));
7563
7585
  }
7564
7586
  else if (lines.length > this.filterIndexStore.length) {
7565
- // 有新增数据的情况
7566
- // step 1: 先找新增的index下标
7587
+ // 有新增数据的情况:只认本次标记的新行,并插到筛选视图中的对应位置
7567
7588
  /** @type {?} */
7568
7589
  const getNowLines = this.validateHdFormLines.getRawValue().lines;
7569
7590
  /** @type {?} */
@@ -7574,10 +7595,29 @@ class HdFormLinesComponent {
7574
7595
  break;
7575
7596
  }
7576
7597
  }
7577
- if (addIndex !== -1) {
7578
- this.storeFormLinesData.splice(this.filterIndexStore[addIndex - 1] + 1, 0, getNowLines[addIndex]);
7598
+ if (addIndex !== -1 && this.filterIndexStore.length > 0) {
7599
+ /** @type {?} */
7600
+ const insertAt = addIndex <= 0
7601
+ ? this.filterIndexStore[0]
7602
+ : this.filterIndexStore[addIndex - 1] + 1;
7603
+ /** @type {?} */
7604
+ const addedLine = Object.assign({}, getNowLines[addIndex], { isHdFormLineSearchAdd: false });
7605
+ this.storeFormLinesData.splice(insertAt, 0, addedLine);
7606
+ for (let i = 0; i < this.filterIndexStore.length; i++) {
7607
+ if (this.filterIndexStore[i] >= insertAt) {
7608
+ this.filterIndexStore[i]++;
7609
+ }
7610
+ }
7611
+ this.filterIndexStore.splice(addIndex, 0, insertAt);
7612
+ if (this.filterStoreFormLinesData) {
7613
+ this.filterStoreFormLinesData.splice(addIndex, 0, addedLine);
7614
+ }
7615
+ /** @type {?} */
7616
+ const flagCtrl = ((/** @type {?} */ (this.linesFormArray.at(addIndex)))).get("isHdFormLineSearchAdd");
7617
+ if (flagCtrl) {
7618
+ flagCtrl.setValue(false, { emitEvent: false });
7619
+ }
7579
7620
  }
7580
- this.filterIndexStore.push(this.filterIndexStore[addIndex - 1] + 1);
7581
7621
  }
7582
7622
  else {
7583
7623
  // 有删除数据的情况