ngx-techlify-core 11.3.9 → 11.4.0

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.
@@ -2281,6 +2281,9 @@
2281
2281
  this.edit = false;
2282
2282
  this.sort = true;
2283
2283
  this.items = [];
2284
+ this.cache = false;
2285
+ this.perPage = 25;
2286
+ this.inDataSearch = false;
2284
2287
  this.selectionChange = new i0.EventEmitter();
2285
2288
  this.itemsChange = new i0.EventEmitter();
2286
2289
  this.isLoading = false;
@@ -2291,6 +2294,7 @@
2291
2294
  this.controlType = 'searchable-selctor';
2292
2295
  this.id = "searchable-selctor-" + SearchableSelectorComponent_1.nextId++;
2293
2296
  this.describedBy = '';
2297
+ this.cachedItems = [];
2294
2298
  this._required = false;
2295
2299
  this._disabled = false;
2296
2300
  this.selectorForm = formBuilder.group({
@@ -2386,7 +2390,7 @@
2386
2390
  _this.search(value);
2387
2391
  });
2388
2392
  this.filters = {
2389
- perPage: 25,
2393
+ perPage: this.perPage,
2390
2394
  search: '',
2391
2395
  page: 1,
2392
2396
  lastPage: 1
@@ -2402,8 +2406,15 @@
2402
2406
  SearchableSelectorComponent.prototype.fetchItemList = function () {
2403
2407
  var _this = this;
2404
2408
  this.isLoading = true;
2405
- rxjs.of().pipe(operators.startWith(true), operators.switchMap(function (_) { return rxjs.from(_this.http.get(_this.apiUrl, { params: _this.filters })); }), operators.finalize(function () { return _this.isLoading = false; }), untilDestroy.untilDestroyed(this)).subscribe(function (result) {
2409
+ var request = this.http.get(this.apiUrl, { params: this.filters });
2410
+ if (this.cache) {
2411
+ request = this.http.cache().get(this.apiUrl, { params: this.filters });
2412
+ }
2413
+ rxjs.of().pipe(operators.startWith(true), operators.switchMap(function (_) { return rxjs.from(request); }), operators.finalize(function () { return _this.isLoading = false; }), untilDestroy.untilDestroyed(this)).subscribe(function (result) {
2406
2414
  _this.items = _this.items.concat(result.data);
2415
+ if (_this.cache) {
2416
+ _this.cachedItems = _this.items;
2417
+ }
2407
2418
  _this.filters.page = result.current_page;
2408
2419
  _this.filters.lastPage = result.last_page;
2409
2420
  });
@@ -2477,7 +2488,24 @@
2477
2488
  else {
2478
2489
  this.filters.search = event;
2479
2490
  }
2480
- this.reloadData();
2491
+ // we need search field to search in data
2492
+ if (this.inDataSearch && this.searchField) {
2493
+ this.filterItems(event);
2494
+ }
2495
+ else {
2496
+ this.reloadData();
2497
+ }
2498
+ };
2499
+ SearchableSelectorComponent.prototype.filterItems = function (event) {
2500
+ var _this = this;
2501
+ if (event) {
2502
+ this.items = this.cachedItems.filter(function (value) {
2503
+ return value[_this.searchField].toLowerCase().search(event.toLowerCase()) != -1;
2504
+ });
2505
+ }
2506
+ else {
2507
+ this.items = this.cachedItems;
2508
+ }
2481
2509
  };
2482
2510
  SearchableSelectorComponent.prototype.addItem = function (event) {
2483
2511
  var _this = this;
@@ -2552,6 +2580,9 @@
2552
2580
  searchField: [{ type: i0.Input }],
2553
2581
  itemComponent: [{ type: i0.Input }],
2554
2582
  items: [{ type: i0.Input }],
2583
+ cache: [{ type: i0.Input }],
2584
+ perPage: [{ type: i0.Input }],
2585
+ inDataSearch: [{ type: i0.Input }],
2555
2586
  selectionChange: [{ type: i0.Output }],
2556
2587
  itemsChange: [{ type: i0.Output }],
2557
2588
  required: [{ type: i0.Input }],
@@ -3012,7 +3043,6 @@
3012
3043
  this.selectionChange.emit(range);
3013
3044
  };
3014
3045
  TimelineFilterComponent.prototype.onCustomDateChange = function (event) {
3015
- console.log(event);
3016
3046
  };
3017
3047
  TimelineFilterComponent.prototype.setDescribedByIds = function (ids) {
3018
3048
  this.describedBy = ids.join(' ');
@@ -7837,14 +7867,13 @@
7837
7867
  exports.ɵbt = UpdateViewModule;
7838
7868
  exports.ɵbu = UpdateViewComponent;
7839
7869
  exports.ɵbv = DataManager;
7840
- exports.ɵbw = DataManager;
7841
- exports.ɵbx = ErrorHandlerService;
7842
- exports.ɵby = AlertService;
7843
- exports.ɵbz = StorageService;
7870
+ exports.ɵbw = ErrorHandlerService;
7871
+ exports.ɵbx = StorageService;
7872
+ exports.ɵby = TechlifyFeatureService;
7873
+ exports.ɵbz = DataManager;
7844
7874
  exports.ɵc = ErrorSnackComponent;
7845
- exports.ɵca = TechlifyFeatureService;
7846
- exports.ɵcb = AuthenticationGuard;
7847
- exports.ɵcc = OnOffSwitchComponent;
7875
+ exports.ɵca = AuthenticationGuard;
7876
+ exports.ɵcb = OnOffSwitchComponent;
7848
7877
  exports.ɵd = HTTP_DYNAMIC_INTERCEPTORS;
7849
7878
  exports.ɵe = HttpService;
7850
7879
  exports.ɵf = RouteReusableStrategy;