@smartsoft001/crud-shell-angular 1.1.722 → 1.1.724

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.
@@ -1411,43 +1411,97 @@
1411
1411
  { type: angular.MenuService }
1412
1412
  ]; };
1413
1413
 
1414
+ var CrudListGroupService = /** @class */ (function () {
1415
+ function CrudListGroupService(facade) {
1416
+ this.facade = facade;
1417
+ this._destroyed = [];
1418
+ }
1419
+ CrudListGroupService.prototype.change = function (val, item, groups, force) {
1420
+ if (val || force) {
1421
+ item.changed = true;
1422
+ var current = this.facade.filter.query.find(function (q) { return q.key === item.key && q.type === '='; });
1423
+ if (!current) {
1424
+ current = {
1425
+ key: item.key,
1426
+ type: "=",
1427
+ value: null
1428
+ };
1429
+ this.facade.filter.query.push(current);
1430
+ }
1431
+ current.value = item.value;
1432
+ current.hidden = true;
1433
+ this.facade.read(Object.assign(Object.assign({}, this.facade.filter), { offset: 0 }));
1434
+ }
1435
+ };
1436
+ CrudListGroupService.prototype.destroy = function (groups) {
1437
+ this._destroyed = __spreadArray(__spreadArray([], __read((this._destroyed ? this._destroyed : []))), __read(groups.filter(function (g) { return g.changed; })));
1438
+ this.refresh();
1439
+ };
1440
+ CrudListGroupService.prototype.refresh = function () {
1441
+ var list = this._destroyed;
1442
+ this._destroyed = [];
1443
+ var newQuery = this.facade.filter.query.filter(function (q) { return !list.some(function (i) { return q.key === i.key; }); });
1444
+ this.facade.read(Object.assign(Object.assign({}, this.facade.filter), { query: newQuery }));
1445
+ };
1446
+ return CrudListGroupService;
1447
+ }());
1448
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1449
+ CrudListGroupService.decorators = [
1450
+ { type: i0.Injectable }
1451
+ ];
1452
+ /**
1453
+ * @type {function(): !Array<(null|{
1454
+ * type: ?,
1455
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1456
+ * })>}
1457
+ * @nocollapse
1458
+ */
1459
+ CrudListGroupService.ctorParameters = function () { return [
1460
+ { type: CrudFacade }
1461
+ ]; };
1462
+ __decorate([
1463
+ lodashDecorators.debounce(250),
1464
+ __metadata("design:type", Function),
1465
+ __metadata("design:paramtypes", []),
1466
+ __metadata("design:returntype", void 0)
1467
+ ], CrudListGroupService.prototype, "refresh", null);
1468
+
1414
1469
  var GroupComponent = /** @class */ (function (_super) {
1415
1470
  __extends(GroupComponent, _super);
1416
- function GroupComponent(styleService, elementRef, facade, cd) {
1471
+ function GroupComponent(styleService, elementRef, facade, cd, groupService) {
1417
1472
  var _this = _super.call(this) || this;
1418
1473
  _this.styleService = styleService;
1419
1474
  _this.elementRef = elementRef;
1420
1475
  _this.facade = facade;
1421
1476
  _this.cd = cd;
1477
+ _this.groupService = groupService;
1422
1478
  return _this;
1423
1479
  }
1424
- GroupComponent.prototype.change = function (val, item) {
1480
+ GroupComponent.prototype.change = function (val, item, force) {
1425
1481
  var _this = this;
1482
+ if (force === void 0) { force = false; }
1426
1483
  this.groups.filter(function (i) { return i.value !== item.value || i.key !== item.key; }).forEach(function (i) {
1427
1484
  i.show = false;
1428
1485
  });
1486
+ this.groupService.change(val, item, this.groups, force);
1429
1487
  if (val) {
1430
- var current = this.facade.filter.query.find(function (q) { return q.key === item.key && q.type === '='; });
1431
- if (!current) {
1432
- current = {
1433
- key: item.key,
1434
- type: "=",
1435
- value: null
1436
- };
1437
- this.facade.filter.query.push(current);
1438
- }
1439
- current.value = item.value;
1440
- current.hidden = true;
1441
- this.facade.read(Object.assign(Object.assign({}, this.facade.filter), { offset: 0 }));
1442
1488
  setTimeout(function () {
1443
1489
  item.show = val;
1444
1490
  _this.cd.detectChanges();
1445
1491
  });
1446
1492
  }
1493
+ else {
1494
+ item.show = val;
1495
+ this.cd.detectChanges();
1496
+ }
1447
1497
  };
1448
1498
  GroupComponent.prototype.ngOnInit = function () {
1449
1499
  this.styleService.init(this.elementRef);
1450
1500
  };
1501
+ GroupComponent.prototype.ngOnDestroy = function () {
1502
+ this.groupService.destroy(this.groups);
1503
+ _super.prototype.ngOnDestroy.call(this);
1504
+ };
1451
1505
  return GroupComponent;
1452
1506
  }(angular.BaseComponent));
1453
1507
  /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
@@ -1469,7 +1523,8 @@
1469
1523
  { type: angular.StyleService },
1470
1524
  { type: i0.ElementRef },
1471
1525
  { type: CrudFacade },
1472
- { type: i0.ChangeDetectorRef }
1526
+ { type: i0.ChangeDetectorRef },
1527
+ { type: CrudListGroupService }
1473
1528
  ]; };
1474
1529
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
1475
1530
  GroupComponent.propDecorators = {
@@ -2957,8 +3012,14 @@
2957
3012
 
2958
3013
  var ListStandardComponent = /** @class */ (function (_super) {
2959
3014
  __extends(ListStandardComponent, _super);
2960
- function ListStandardComponent() {
2961
- return _super !== null && _super.apply(this, arguments) || this;
3015
+ function ListStandardComponent(facade, config) {
3016
+ var _this = _super.call(this, config) || this;
3017
+ _this.facade = facade;
3018
+ _this.config = config;
3019
+ _this.isSearch$ = _this.facade.filter$.pipe(operators.map(function (filter) {
3020
+ return !!(filter === null || filter === void 0 ? void 0 : filter.searchText);
3021
+ }));
3022
+ return _this;
2962
3023
  }
2963
3024
  return ListStandardComponent;
2964
3025
  }(CrudListPageBaseComponent));
@@ -2966,10 +3027,24 @@
2966
3027
  ListStandardComponent.decorators = [
2967
3028
  { type: i0.Component, args: [{
2968
3029
  selector: "smart-crud-list-standard-page",
2969
- template: "<smart-crud-filters-config></smart-crud-filters-config>\n<smart-list *ngIf=\"listOptions\" [hidden]=\"config.list?.groups\" [options]=\"listOptions\"></smart-list>\n<smart-crud-group *ngIf=\"config.list?.groups\" [groups]=\"config.list?.groups\" [listOptions]=\"listOptions\">\n</smart-crud-group>",
3030
+ template: "<smart-crud-filters-config></smart-crud-filters-config>\n<smart-list *ngIf=\"listOptions\"\n [hidden]=\"!(!config.list?.groups || (isSearch$ | async))\"\n [options]=\"listOptions\"\n></smart-list>\n<smart-crud-group *ngIf=\"config.list?.groups && !(isSearch$ | async)\"\n [groups]=\"config.list?.groups\"\n [listOptions]=\"listOptions\"\n>\n</smart-crud-group>",
3031
+ providers: [
3032
+ CrudListGroupService
3033
+ ],
2970
3034
  styles: [""]
2971
3035
  },] }
2972
3036
  ];
3037
+ /**
3038
+ * @type {function(): !Array<(null|{
3039
+ * type: ?,
3040
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
3041
+ * })>}
3042
+ * @nocollapse
3043
+ */
3044
+ ListStandardComponent.ctorParameters = function () { return [
3045
+ { type: CrudFacade },
3046
+ { type: CrudFullConfig }
3047
+ ]; };
2973
3048
 
2974
3049
  var PAGES = [
2975
3050
  ItemComponent,
@@ -3009,6 +3084,7 @@
3009
3084
  entryComponents: __spreadArray([], __read(PAGES)),
3010
3085
  providers: [
3011
3086
  CrudService,
3087
+ CrudListGroupService,
3012
3088
  PageService,
3013
3089
  CrudEffects,
3014
3090
  CrudFacade,
@@ -3054,6 +3130,7 @@
3054
3130
  exports: [CrudComponentsModule],
3055
3131
  providers: [
3056
3132
  CrudService,
3133
+ CrudListGroupService,
3057
3134
  PageService,
3058
3135
  CrudEffects,
3059
3136
  CrudFacade,
@@ -3190,14 +3267,15 @@
3190
3267
  exports["ɵn"] = FilterIntComponent;
3191
3268
  exports["ɵo"] = MultiselectComponent;
3192
3269
  exports["ɵp"] = GroupComponent;
3193
- exports["ɵq"] = SocketService;
3194
- exports["ɵr"] = NotSocketService;
3195
- exports["ɵs"] = ItemComponent;
3196
- exports["ɵt"] = ItemStandardComponent;
3197
- exports["ɵu"] = CrudItemPageBaseComponent;
3198
- exports["ɵv"] = ListComponent;
3199
- exports["ɵw"] = ListStandardComponent;
3200
- exports["ɵx"] = CrudListPageBaseComponent;
3270
+ exports["ɵq"] = CrudListGroupService;
3271
+ exports["ɵr"] = SocketService;
3272
+ exports["ɵs"] = NotSocketService;
3273
+ exports["ɵt"] = ItemComponent;
3274
+ exports["ɵu"] = ItemStandardComponent;
3275
+ exports["ɵv"] = CrudItemPageBaseComponent;
3276
+ exports["ɵw"] = ListComponent;
3277
+ exports["ɵx"] = ListStandardComponent;
3278
+ exports["ɵy"] = CrudListPageBaseComponent;
3201
3279
 
3202
3280
  Object.defineProperty(exports, '__esModule', { value: true });
3203
3281