@smartsoft001/crud-shell-angular 1.1.686 → 1.1.691

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.
@@ -2200,23 +2200,28 @@
2200
2200
  this.baseInstance.listOptions = this.listOptions;
2201
2201
  };
2202
2202
  ListComponent.prototype.ngOnInit = function () {
2203
- var _a, _b;
2203
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2204
2204
  return __awaiter(this, void 0, void 0, function () {
2205
- var endButtons, compiledComponents, _f, _g;
2205
+ var newFilter, endButtons, compiledComponents, _j, _k;
2206
2206
  var _this = this;
2207
- return __generator(this, function (_h) {
2208
- switch (_h.label) {
2207
+ return __generator(this, function (_l) {
2208
+ switch (_l.label) {
2209
2209
  case 0: return [4 /*yield*/, this.pageService.checkPermissions()];
2210
2210
  case 1:
2211
- _h.sent();
2211
+ _l.sent();
2212
+ newFilter = null;
2212
2213
  if (((_a = this.config.list) === null || _a === void 0 ? void 0 : _a.resetQuery) === 'beforeInit') {
2213
- this.facade.read(Object.assign({ query: this.config.baseQuery ? __spreadArray([], __read(this.config.baseQuery)) : [], paginationMode: this.config.list.paginationMode, limit: this.config.pagination ? this.config.pagination.limit : null, offset: this.config.pagination ? 0 : null, sortBy: this.config.sort ? this.config.sort["default"] : null, sortDesc: this.config.sort ? this.config.sort["defaultDesc"] : null }, this.searchService.filter));
2214
- }
2215
- else if (!this.searchService.filter) {
2216
- this.facade.read(Object.assign({ paginationMode: this.config.list.paginationMode, limit: this.config.pagination ? this.config.pagination.limit : null, offset: this.config.pagination ? 0 : null, sortBy: this.config.sort ? this.config.sort["default"] : null, sortDesc: this.config.sort ? this.config.sort["defaultDesc"] : null }, this.searchService.filter));
2214
+ newFilter = Object.assign({ query: this.config.baseQuery ? __spreadArray([], __read(this.config.baseQuery)) : [], paginationMode: this.config.list.paginationMode, limit: this.config.pagination ? this.config.pagination.limit : null, offset: this.config.pagination ? 0 : null, sortBy: this.config.sort ? this.config.sort["default"] : null, sortDesc: this.config.sort ? this.config.sort["defaultDesc"] : null }, this.searchService.filter);
2217
2215
  }
2218
2216
  else {
2219
- this.facade.read(Object.assign({}, this.searchService.filter));
2217
+ newFilter = Object.assign({ paginationMode: this.config.list.paginationMode, limit: ((_b = this.searchService.filter) === null || _b === void 0 ? void 0 : _b.limit) ? this.searchService.filter.limit : this.config.pagination
2218
+ ? this.config.pagination.limit : null, offset: ((_c = this.searchService.filter) === null || _c === void 0 ? void 0 : _c.offset) || ((_d = this.searchService.filter) === null || _d === void 0 ? void 0 : _d.offset) === 0
2219
+ ? this.searchService.filter.offset : this.config.pagination ? 0 : null, sortBy: ((_e = this.searchService.filter) === null || _e === void 0 ? void 0 : _e.sortBy) ? this.searchService.filter.sortBy : this.config.sort
2220
+ ? this.config.sort["default"] : null, sortDesc: ((_f = this.searchService.filter) === null || _f === void 0 ? void 0 : _f.sortDesc) ? this.searchService.filter.sortDesc : this.config.sort
2221
+ ? this.config.sort["defaultDesc"] : null, query: ((_g = this.searchService.filter) === null || _g === void 0 ? void 0 : _g.query) ? this.searchService : [] }, this.searchService.filter);
2222
+ }
2223
+ if (!this.searchService.filter || !___namespace.isEqual(newFilter, this.filter)) {
2224
+ this.facade.read(newFilter);
2220
2225
  }
2221
2226
  endButtons = this.getEndButtons();
2222
2227
  this.pageOptions = {
@@ -2248,17 +2253,17 @@
2248
2253
  : []))),
2249
2254
  })];
2250
2255
  case 2:
2251
- compiledComponents = _h.sent();
2252
- _f = this;
2253
- _g = {
2256
+ compiledComponents = _l.sent();
2257
+ _j = this;
2258
+ _k = {
2254
2259
  provider: {
2255
2260
  getData: function (filter) {
2256
2261
  var global = Object.assign(Object.assign({}, _this.filter), filter);
2257
2262
  _this.facade.read(global);
2258
2263
  },
2259
2264
  onChangeMultiSelected: function (list) { return __awaiter(_this, void 0, void 0, function () {
2260
- return __generator(this, function (_f) {
2261
- switch (_f.label) {
2265
+ return __generator(this, function (_j) {
2266
+ switch (_j.label) {
2262
2267
  case 0:
2263
2268
  if (!(list.length && !this.menuService.openedEnd)) return [3 /*break*/, 2];
2264
2269
  return [4 /*yield*/, this.menuService.openEnd({
@@ -2266,14 +2271,14 @@
2266
2271
  component: MultiselectComponent,
2267
2272
  })];
2268
2273
  case 1:
2269
- _f.sent();
2274
+ _j.sent();
2270
2275
  return [3 /*break*/, 4];
2271
2276
  case 2:
2272
2277
  if (!(!list.length && this.menuService.openedEnd)) return [3 /*break*/, 4];
2273
2278
  return [4 /*yield*/, this.menuService.closeEnd()];
2274
2279
  case 3:
2275
- _f.sent();
2276
- _f.label = 4;
2280
+ _j.sent();
2281
+ _j.label = 4;
2277
2282
  case 4:
2278
2283
  this.facade.multiSelect(list);
2279
2284
  return [2 /*return*/];
@@ -2284,7 +2289,7 @@
2284
2289
  loading$: this.facade.loaded$.pipe(operators.map(function (l) { return !l; })),
2285
2290
  },
2286
2291
  cellPipe: this.config.list ? this.config.list.cellPipe : null,
2287
- mode: (_b = this.config.list) === null || _b === void 0 ? void 0 : _b.mode,
2292
+ mode: (_h = this.config.list) === null || _h === void 0 ? void 0 : _h.mode,
2288
2293
  type: this.config.type,
2289
2294
  details: this.config.details
2290
2295
  ? {
@@ -2340,9 +2345,9 @@
2340
2345
  },
2341
2346
  })];
2342
2347
  case 3:
2343
- _f.listOptions = (_g.pagination = _h.sent(),
2344
- _g.sort = this.config.sort,
2345
- _g);
2348
+ _j.listOptions = (_k.pagination = _l.sent(),
2349
+ _k.sort = this.config.sort,
2350
+ _k);
2346
2351
  this.cd.detectChanges();
2347
2352
  this.initCloseMenu();
2348
2353
  this.initTopComponent(compiledComponents);
@@ -2355,11 +2360,11 @@
2355
2360
  ListComponent.prototype.initCloseMenu = function () {
2356
2361
  var _this = this;
2357
2362
  this.router.events.pipe(this.takeUntilDestroy).subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
2358
- return __generator(this, function (_f) {
2359
- switch (_f.label) {
2363
+ return __generator(this, function (_j) {
2364
+ switch (_j.label) {
2360
2365
  case 0: return [4 /*yield*/, this.clear()];
2361
2366
  case 1:
2362
- _f.sent();
2367
+ _j.sent();
2363
2368
  return [2 /*return*/];
2364
2369
  }
2365
2370
  });
@@ -2367,11 +2372,11 @@
2367
2372
  };
2368
2373
  ListComponent.prototype.clear = function () {
2369
2374
  return __awaiter(this, void 0, void 0, function () {
2370
- return __generator(this, function (_f) {
2371
- switch (_f.label) {
2375
+ return __generator(this, function (_j) {
2376
+ switch (_j.label) {
2372
2377
  case 0: return [4 /*yield*/, this.menuService.closeEnd()];
2373
2378
  case 1:
2374
- _f.sent();
2379
+ _j.sent();
2375
2380
  this.listOptions = Object.assign(Object.assign({}, this.listOptions), { select: null });
2376
2381
  this.facade.multiSelect([]);
2377
2382
  return [2 /*return*/];
@@ -2396,16 +2401,16 @@
2396
2401
  icon: "checkbox-outline",
2397
2402
  text: "multi",
2398
2403
  handler: function () { return __awaiter(_this, void 0, void 0, function () {
2399
- return __generator(this, function (_f) {
2400
- switch (_f.label) {
2404
+ return __generator(this, function (_j) {
2405
+ switch (_j.label) {
2401
2406
  case 0:
2402
2407
  this.listOptions = Object.assign(Object.assign({}, this.listOptions), { select: this.listOptions.select === "multi" ? null : "multi" });
2403
2408
  this.facade.multiSelect([]);
2404
2409
  if (!this.menuService.openedEnd) return [3 /*break*/, 2];
2405
2410
  return [4 /*yield*/, this.menuService.closeEnd()];
2406
2411
  case 1:
2407
- _f.sent();
2408
- _f.label = 2;
2412
+ _j.sent();
2413
+ _j.label = 2;
2409
2414
  case 2:
2410
2415
  this.cd.detectChanges();
2411
2416
  return [2 /*return*/];
@@ -2420,14 +2425,14 @@
2420
2425
  icon: "filter-outline",
2421
2426
  text: "filters",
2422
2427
  handler: function () { return __awaiter(_this, void 0, void 0, function () {
2423
- return __generator(this, function (_f) {
2424
- switch (_f.label) {
2428
+ return __generator(this, function (_j) {
2429
+ switch (_j.label) {
2425
2430
  case 0: return [4 /*yield*/, this.menuService.openEnd({
2426
2431
  injector: this.injector,
2427
2432
  component: FiltersComponent,
2428
2433
  })];
2429
2434
  case 1:
2430
- _f.sent();
2435
+ _j.sent();
2431
2436
  return [2 /*return*/];
2432
2437
  }
2433
2438
  });