@egova/egova-api 1.0.264 → 1.0.265

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.
@@ -65849,6 +65849,7 @@ var project_detail_tree = __webpack_require__("9355");
65849
65849
 
65850
65850
 
65851
65851
 
65852
+
65852
65853
  var project_detail_tree_extends = undefined && undefined.__extends || function () {
65853
65854
  var _extendStatics = function extendStatics(d, b) {
65854
65855
  _extendStatics = Object.setPrototypeOf || {
@@ -66392,25 +66393,45 @@ function (_super) {
66392
66393
  }
66393
66394
 
66394
66395
  this.renderData = this.filterData(this.data.$clone());
66395
- };
66396
+ }; // /**
66397
+ // * 判断一个节点是否是与关键字匹配的叶子节点,或者是包含符合条件的叶子节点的祖先节点
66398
+ // * @param node
66399
+ // */
66400
+ // public match(node: any) {
66401
+ // if (!node.children || node.children.length === 0) {
66402
+ // return (node.title || node.name).indexOf(this.keyword) !== -1 && (this.type === "all" || this.type === node.method);
66403
+ // } else {
66404
+ // let flag = false;
66405
+ // node.children.forEach((v: any) => {
66406
+ // flag = this.match(v) ? this.match(v) : flag;
66407
+ // });
66408
+ // return flag;
66409
+ // }
66410
+ // }
66411
+
66396
66412
  /**
66397
- * 判断一个节点是否是与关键字匹配的叶子节点,或者是包含符合条件的叶子节点的祖先节点
66398
- * @param node
66399
- */
66413
+ * 判断一个节点是否是与关键字匹配的叶子节点或者目录节点,或者是包含符合条件的叶子节点的祖先节点
66414
+ * 如果匹配的是目录节点,那么目录下的节点无需过滤
66415
+ * @param node
66416
+ */
66400
66417
 
66401
66418
 
66402
66419
  ProjectTree.prototype.match = function (node) {
66403
66420
  var _this = this;
66404
66421
 
66405
- if (!node.children || node.children.length === 0) {
66406
- return (node.title || node.name).indexOf(this.keyword) !== -1 && (this.type === "all" || this.type === node.method);
66407
- } else {
66408
- var flag_1 = false;
66422
+ var matched = (node.title || node.name).indexOf(this.keyword) !== -1;
66423
+ var childrenMatched = false;
66424
+
66425
+ if (!matched && node.children) {
66409
66426
  node.children.forEach(function (v) {
66410
- flag_1 = _this.match(v) ? _this.match(v) : flag_1;
66427
+ childrenMatched = _this.match(v).matched || _this.match(v).childrenMatched || childrenMatched;
66411
66428
  });
66412
- return flag_1;
66413
66429
  }
66430
+
66431
+ return {
66432
+ matched: matched,
66433
+ childrenMatched: childrenMatched
66434
+ };
66414
66435
  };
66415
66436
  /**
66416
66437
  * 处理渲染数据,只保留与关键字匹配的叶子节点和其祖先节点
@@ -66423,15 +66444,19 @@ function (_super) {
66423
66444
 
66424
66445
  if (!data || !Array.isArray(data)) return data;
66425
66446
  var d = data.filter(function (v) {
66426
- return _this.match(v);
66447
+ return _this.match(v).childrenMatched;
66427
66448
  });
66428
66449
  d = d.map(function (v) {
66429
66450
  if (v.children) {
66451
+ v.expand = true;
66430
66452
  v.children = _this.filterData(v.children);
66431
66453
  }
66432
66454
 
66433
66455
  return v;
66434
66456
  });
66457
+ d = d.concat(data.filter(function (v) {
66458
+ return _this.match(v).matched;
66459
+ }));
66435
66460
  return d;
66436
66461
  };
66437
66462
 
package/dist/index.umd.js CHANGED
@@ -65858,6 +65858,7 @@ var project_detail_tree = __webpack_require__("9355");
65858
65858
 
65859
65859
 
65860
65860
 
65861
+
65861
65862
  var project_detail_tree_extends = undefined && undefined.__extends || function () {
65862
65863
  var _extendStatics = function extendStatics(d, b) {
65863
65864
  _extendStatics = Object.setPrototypeOf || {
@@ -66401,25 +66402,45 @@ function (_super) {
66401
66402
  }
66402
66403
 
66403
66404
  this.renderData = this.filterData(this.data.$clone());
66404
- };
66405
+ }; // /**
66406
+ // * 判断一个节点是否是与关键字匹配的叶子节点,或者是包含符合条件的叶子节点的祖先节点
66407
+ // * @param node
66408
+ // */
66409
+ // public match(node: any) {
66410
+ // if (!node.children || node.children.length === 0) {
66411
+ // return (node.title || node.name).indexOf(this.keyword) !== -1 && (this.type === "all" || this.type === node.method);
66412
+ // } else {
66413
+ // let flag = false;
66414
+ // node.children.forEach((v: any) => {
66415
+ // flag = this.match(v) ? this.match(v) : flag;
66416
+ // });
66417
+ // return flag;
66418
+ // }
66419
+ // }
66420
+
66405
66421
  /**
66406
- * 判断一个节点是否是与关键字匹配的叶子节点,或者是包含符合条件的叶子节点的祖先节点
66407
- * @param node
66408
- */
66422
+ * 判断一个节点是否是与关键字匹配的叶子节点或者目录节点,或者是包含符合条件的叶子节点的祖先节点
66423
+ * 如果匹配的是目录节点,那么目录下的节点无需过滤
66424
+ * @param node
66425
+ */
66409
66426
 
66410
66427
 
66411
66428
  ProjectTree.prototype.match = function (node) {
66412
66429
  var _this = this;
66413
66430
 
66414
- if (!node.children || node.children.length === 0) {
66415
- return (node.title || node.name).indexOf(this.keyword) !== -1 && (this.type === "all" || this.type === node.method);
66416
- } else {
66417
- var flag_1 = false;
66431
+ var matched = (node.title || node.name).indexOf(this.keyword) !== -1;
66432
+ var childrenMatched = false;
66433
+
66434
+ if (!matched && node.children) {
66418
66435
  node.children.forEach(function (v) {
66419
- flag_1 = _this.match(v) ? _this.match(v) : flag_1;
66436
+ childrenMatched = _this.match(v).matched || _this.match(v).childrenMatched || childrenMatched;
66420
66437
  });
66421
- return flag_1;
66422
66438
  }
66439
+
66440
+ return {
66441
+ matched: matched,
66442
+ childrenMatched: childrenMatched
66443
+ };
66423
66444
  };
66424
66445
  /**
66425
66446
  * 处理渲染数据,只保留与关键字匹配的叶子节点和其祖先节点
@@ -66432,15 +66453,19 @@ function (_super) {
66432
66453
 
66433
66454
  if (!data || !Array.isArray(data)) return data;
66434
66455
  var d = data.filter(function (v) {
66435
- return _this.match(v);
66456
+ return _this.match(v).childrenMatched;
66436
66457
  });
66437
66458
  d = d.map(function (v) {
66438
66459
  if (v.children) {
66460
+ v.expand = true;
66439
66461
  v.children = _this.filterData(v.children);
66440
66462
  }
66441
66463
 
66442
66464
  return v;
66443
66465
  });
66466
+ d = d.concat(data.filter(function (v) {
66467
+ return _this.match(v).matched;
66468
+ }));
66444
66469
  return d;
66445
66470
  };
66446
66471