@smartsoft001/crud-shell-angular 1.1.684 → 1.1.689

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