fantasy-ngzorro 1.0.55 → 1.0.57

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ng-zorro-antd'), require('@angular/forms'), require('ng-zorro-antd/core'), require('lodash'), require('@angular/cdk/drag-drop'), require('ng-zorro-antd/table'), require('localforage'), require('ng-zorro-antd/modal')) :
3
- typeof define === 'function' && define.amd ? define('fantasy-ngzorro', ['exports', '@angular/core', '@angular/common', 'ng-zorro-antd', '@angular/forms', 'ng-zorro-antd/core', 'lodash', '@angular/cdk/drag-drop', 'ng-zorro-antd/table', 'localforage', 'ng-zorro-antd/modal'], factory) :
4
- (global = global || self, factory(global['fantasy-ngzorro'] = {}, global.ng.core, global.ng.common, global.ngZorroAntd, global.ng.forms, global.core$1, global.lodash, global.ng.cdk['drag-drop'], global.table, global.localforage, global.modal));
5
- }(this, (function (exports, core, common, ngZorroAntd, forms, core$1, lodash, dragDrop, table, localforage, modal) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ng-zorro-antd'), require('@angular/forms'), require('ng-zorro-antd/core'), require('lodash'), require('@angular/cdk/drag-drop'), require('ng-zorro-antd/table'), require('ng-zorro-antd/modal')) :
3
+ typeof define === 'function' && define.amd ? define('fantasy-ngzorro', ['exports', '@angular/core', '@angular/common', 'ng-zorro-antd', '@angular/forms', 'ng-zorro-antd/core', 'lodash', '@angular/cdk/drag-drop', 'ng-zorro-antd/table', 'ng-zorro-antd/modal'], factory) :
4
+ (global = global || self, factory(global['fantasy-ngzorro'] = {}, global.ng.core, global.ng.common, global.ngZorroAntd, global.ng.forms, global.core$1, global.lodash, global.ng.cdk['drag-drop'], global.table, global.modal));
5
+ }(this, (function (exports, core, common, ngZorroAntd, forms, core$1, lodash, dragDrop, table, modal) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -1771,7 +1771,7 @@
1771
1771
  // 缓存一下总的表单数据
1772
1772
  this.storeFormLinesData = this.formLinesData;
1773
1773
  this.init();
1774
- localforage.setItem(location.host, '12312321');
1774
+ // localforage.setItem(location.host, '12312321');
1775
1775
  };
1776
1776
  Object.defineProperty(HdFormLinesComponent.prototype, "linesFormArray", {
1777
1777
  get: /**
@@ -1902,7 +1902,9 @@
1902
1902
  */
1903
1903
  function () {
1904
1904
  var _this = this;
1905
- console.log('this.filterStr', this.filterStr);
1905
+ if (this.storeFormLinesData.length < 1) {
1906
+ return;
1907
+ }
1906
1908
  this.tableLoading = true;
1907
1909
  // 如果没有输入搜索字符串,则显示缓存内的所有数据
1908
1910
  if (!this.filterStr) {
@@ -1912,10 +1914,8 @@
1912
1914
  }
1913
1915
  /** @type {?} */
1914
1916
  var filterValue = this.filterStr.trim().toLowerCase();
1915
- console.log('this.filterValue', filterValue);
1916
1917
  this.isFilterData = true;
1917
1918
  this.filterIndexStore = [];
1918
- console.log('this.storeFormLinesData', this.storeFormLinesData);
1919
1919
  // 根据搜索字符串过滤数据
1920
1920
  /** @type {?} */
1921
1921
  var filteredData = this.storeFormLinesData.filter((/**
@@ -1928,12 +1928,13 @@
1928
1928
  try {
1929
1929
  for (var _b = __values(_this.formLines), _c = _b.next(); !_c.done; _c = _b.next()) {
1930
1930
  var item = _c.value;
1931
- /** @type {?} */
1932
- var value = data[item.name] ? data[item.name].toString().toLowerCase() : '';
1933
- console.log('value', value);
1934
- if (value.includes(filterValue)) {
1935
- _this.filterIndexStore.push(index);
1936
- return true;
1931
+ if ((item.hide && item.canSearch) || (!item.hide && item.name !== 'uuid')) {
1932
+ /** @type {?} */
1933
+ var value = data[item.name] ? data[item.name].toString().toLowerCase() : '';
1934
+ if (value.includes(filterValue)) {
1935
+ _this.filterIndexStore.push(index);
1936
+ return true;
1937
+ }
1937
1938
  }
1938
1939
  }
1939
1940
  }
@@ -2206,9 +2207,6 @@
2206
2207
  }));
2207
2208
  this.tableLoading = false;
2208
2209
  this.showForm = true;
2209
- if (this.formLinesData.length === 0) {
2210
- this.addFormLine();
2211
- }
2212
2210
  };
2213
2211
  /**
2214
2212
  * @param {?=} index
@@ -2302,86 +2300,93 @@
2302
2300
  */
2303
2301
  function (data) {
2304
2302
  var _this = this;
2305
- if (data && data.lines && this.filterIndexStore.length !== 0) {
2306
- /** @type {?} */
2307
- var lines_1 = data.lines;
2308
- if (lines_1.length === this.filterIndexStore.length) {
2309
- this.filterIndexStore.forEach((/**
2310
- * @param {?} item
2311
- * @param {?} index
2312
- * @return {?}
2313
- */
2314
- function (item, index) {
2315
- _this.storeFormLinesData[item] = __assign({}, _this.filterStoreFormLinesData[index], lines_1[index]);
2316
- }));
2317
- }
2318
- else if (lines_1.length > this.filterIndexStore.length) {
2319
- // 有新增数据的情况
2320
- // step 1: 先找新增的index下标
2303
+ if (this.isFilterData) {
2304
+ if (data && data.lines && this.filterIndexStore.length !== 0) {
2321
2305
  /** @type {?} */
2322
- var getNowLines = this.validateHdFormLines.getRawValue().lines;
2323
- /** @type {?} */
2324
- var addIndex = -1;
2325
- for (var i = 0; i < getNowLines.length; i++) {
2326
- if (getNowLines[i].isHdFormLineSearchAdd) {
2327
- addIndex = i;
2328
- break;
2329
- }
2330
- }
2331
- if (addIndex !== -1) {
2332
- this.storeFormLinesData.splice(this.filterIndexStore[addIndex - 1] + 1, 0, getNowLines[addIndex]);
2333
- }
2334
- this.filterIndexStore.push(this.filterIndexStore[addIndex - 1] + 1);
2335
- }
2336
- else {
2337
- // 有删除数据的情况
2338
- // step 1:先找到删除的index下标
2339
- /** @type {?} */
2340
- var deletedIndex_1 = -1;
2341
- /** @type {?} */
2342
- var count = 0;
2343
- if (lines_1.length === 0) {
2344
- deletedIndex_1 = 0;
2345
- }
2346
- else {
2347
- for (var i = 0; i < lines_1.length; i++) {
2348
- if (lines_1[i].lineIndex - count > 1) {
2349
- deletedIndex_1 = i;
2350
- break;
2351
- }
2352
- count++;
2353
- }
2354
- }
2355
- if (deletedIndex_1 !== -1) {
2356
- // step 2: 删除总数据中的对应数据, 把下标数组和lines长度对齐,同时把下标数组在deletedIndex后面的值全都-1
2357
- this.storeFormLinesData = this.storeFormLinesData.filter((/**
2306
+ var lines_1 = data.lines;
2307
+ if (lines_1.length === this.filterIndexStore.length) {
2308
+ this.filterIndexStore.forEach((/**
2358
2309
  * @param {?} item
2359
2310
  * @param {?} index
2360
2311
  * @return {?}
2361
2312
  */
2362
2313
  function (item, index) {
2363
- return index !== _this.filterIndexStore[deletedIndex_1];
2314
+ _this.storeFormLinesData[item] = __assign({}, _this.filterStoreFormLinesData[index], lines_1[index]);
2364
2315
  }));
2365
- this.filterIndexStore.splice(deletedIndex_1, 1);
2366
- for (var i = 0; i < this.filterIndexStore.length; i++) {
2367
- if (i >= deletedIndex_1) {
2368
- this.filterIndexStore[i]--;
2316
+ }
2317
+ else if (lines_1.length > this.filterIndexStore.length) {
2318
+ // 有新增数据的情况
2319
+ // step 1: 先找新增的index下标
2320
+ /** @type {?} */
2321
+ var getNowLines = this.validateHdFormLines.getRawValue().lines;
2322
+ /** @type {?} */
2323
+ var addIndex = -1;
2324
+ for (var i = 0; i < getNowLines.length; i++) {
2325
+ if (getNowLines[i].isHdFormLineSearchAdd) {
2326
+ addIndex = i;
2327
+ break;
2369
2328
  }
2370
2329
  }
2330
+ if (addIndex !== -1) {
2331
+ this.storeFormLinesData.splice(this.filterIndexStore[addIndex - 1] + 1, 0, getNowLines[addIndex]);
2332
+ }
2333
+ this.filterIndexStore.push(this.filterIndexStore[addIndex - 1] + 1);
2371
2334
  }
2372
2335
  else {
2373
- // step 2: 没有找到deletedIndex说明删除操作在最后一行
2336
+ // 有删除数据的情况
2337
+ // step 1:先找到删除的index下标
2374
2338
  /** @type {?} */
2375
- var filterIndex_1 = this.filterIndexStore[this.filterIndexStore.length - 1];
2376
- this.storeFormLinesData = this.storeFormLinesData.filter((/**
2377
- * @param {?} item
2378
- * @param {?} index
2379
- * @return {?}
2380
- */
2381
- function (item, index) {
2382
- return index !== filterIndex_1;
2383
- }));
2384
- this.filterIndexStore.pop();
2339
+ var deletedIndex_1 = -1;
2340
+ /** @type {?} */
2341
+ var count = 0;
2342
+ if (lines_1.length === 0) {
2343
+ deletedIndex_1 = 0;
2344
+ }
2345
+ else {
2346
+ for (var i = 0; i < lines_1.length; i++) {
2347
+ if (lines_1[i].lineIndex - count > 1) {
2348
+ deletedIndex_1 = i;
2349
+ break;
2350
+ }
2351
+ count++;
2352
+ }
2353
+ }
2354
+ if (deletedIndex_1 !== -1) {
2355
+ // step 2: 删除总数据中的对应数据, 把下标数组和lines长度对齐,同时把下标数组在deletedIndex后面的值全都-1
2356
+ this.storeFormLinesData = this.storeFormLinesData.filter((/**
2357
+ * @param {?} item
2358
+ * @param {?} index
2359
+ * @return {?}
2360
+ */
2361
+ function (item, index) {
2362
+ return index !== _this.filterIndexStore[deletedIndex_1];
2363
+ }));
2364
+ this.filterIndexStore.splice(deletedIndex_1, 1);
2365
+ for (var i = 0; i < this.filterIndexStore.length; i++) {
2366
+ if (i >= deletedIndex_1) {
2367
+ this.filterIndexStore[i]--;
2368
+ }
2369
+ }
2370
+ }
2371
+ else {
2372
+ // step 2: 没有找到deletedIndex说明删除操作在最后一行
2373
+ /** @type {?} */
2374
+ var filterIndex_1 = this.filterIndexStore[this.filterIndexStore.length - 1];
2375
+ this.storeFormLinesData = this.storeFormLinesData.filter((/**
2376
+ * @param {?} item
2377
+ * @param {?} index
2378
+ * @return {?}
2379
+ */
2380
+ function (item, index) {
2381
+ return index !== filterIndex_1;
2382
+ }));
2383
+ this.filterIndexStore.pop();
2384
+ }
2385
+ }
2386
+ }
2387
+ else {
2388
+ if (data && data.lines) {
2389
+ this.storeFormLinesData = data.lines;
2385
2390
  }
2386
2391
  }
2387
2392
  }
@@ -2390,17 +2395,23 @@
2390
2395
  this.storeFormLinesData = data.lines;
2391
2396
  }
2392
2397
  }
2393
- if (this.formValid) {
2394
- // 如果整体表单是true,不管子表单是什么,都变成子表单的状态
2398
+ // 总表单
2399
+ if (!this.isFilterData) {
2395
2400
  this.formValid = this.validateHdFormLines.valid;
2396
2401
  }
2397
2402
  else {
2398
- // 如果整体表单是false:1、子表单为true,需要重算;2、子表单为false,用子表单状态
2399
- if (this.validateHdFormLines.valid) {
2400
- this.formValid = this.innerGetValid();
2403
+ if (this.formValid) {
2404
+ // 如果整体表单是true,不管子表单是什么,都变成子表单的状态
2405
+ this.formValid = this.validateHdFormLines.valid;
2401
2406
  }
2402
2407
  else {
2403
- this.formValid = this.validateHdFormLines.valid;
2408
+ // 如果整体表单是false:1、子表单为true,需要重算;2、子表单为false,用子表单状态
2409
+ if (this.validateHdFormLines.valid) {
2410
+ this.formValid = this.innerGetValid();
2411
+ }
2412
+ else {
2413
+ this.formValid = this.validateHdFormLines.valid;
2414
+ }
2404
2415
  }
2405
2416
  }
2406
2417
  // this.calculateLineNumber();
@@ -3583,6 +3594,7 @@
3583
3594
  this.inputNumber = new InputNumber(); // number组件的min、max、step
3584
3595
  // 不可输入状态
3585
3596
  this.showTime = false; // 日期选择器是否包含时间
3597
+ this.canSearch = false; // 指明hide 情况下的控件是否可以被搜索,默认false
3586
3598
  }
3587
3599
  return FormLine;
3588
3600
  }());
@@ -3633,6 +3645,8 @@
3633
3645
  FormLine.prototype.showTime;
3634
3646
  /** @type {?} */
3635
3647
  FormLine.prototype.style;
3648
+ /** @type {?} */
3649
+ FormLine.prototype.canSearch;
3636
3650
  }
3637
3651
  var ColorOption = /** @class */ (function () {
3638
3652
  function ColorOption() {