@smartsoft001/crud-shell-angular 1.1.733 → 1.1.737

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.
Files changed (210) hide show
  1. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  2. package/{esm2015/lib/+state/crud.actions.js → esm2020/lib/+state/crud.actions.mjs} +0 -0
  3. package/esm2020/lib/+state/crud.effects.mjs +182 -0
  4. package/esm2020/lib/+state/crud.facade.mjs +88 -0
  5. package/esm2020/lib/+state/crud.reducer.mjs +212 -0
  6. package/{esm2015/lib/+state/crud.selectors.js → esm2020/lib/+state/crud.selectors.mjs} +0 -0
  7. package/esm2020/lib/components/components.module.mjs +109 -0
  8. package/esm2020/lib/components/export/export.component.mjs +47 -0
  9. package/esm2020/lib/components/filter/base/base.component.mjs +140 -0
  10. package/esm2020/lib/components/filter/check/check.component.mjs +36 -0
  11. package/esm2020/lib/components/filter/date/date.component.mjs +41 -0
  12. package/esm2020/lib/components/filter/date-with-edit/date-with-edit.component.mjs +44 -0
  13. package/esm2020/lib/components/filter/filter.component.mjs +29 -0
  14. package/esm2020/lib/components/filter/flag/flag.component.mjs +16 -0
  15. package/{esm2015/lib/components/filter/index.js → esm2020/lib/components/filter/index.mjs} +0 -0
  16. package/esm2020/lib/components/filter/int/int.component.mjs +33 -0
  17. package/esm2020/lib/components/filter/radio/radio.component.mjs +16 -0
  18. package/esm2020/lib/components/filter/text/text.component.mjs +16 -0
  19. package/esm2020/lib/components/filters/filters.component.mjs +111 -0
  20. package/esm2020/lib/components/filters-config/filters-config.component.mjs +37 -0
  21. package/esm2020/lib/components/group/group.component.mjs +54 -0
  22. package/{esm2015/lib/components/index.js → esm2020/lib/components/index.mjs} +0 -0
  23. package/esm2020/lib/components/multiselect/multiselect.component.mjs +68 -0
  24. package/esm2020/lib/crud-full.module.mjs +105 -0
  25. package/esm2020/lib/crud.config.mjs +17 -0
  26. package/esm2020/lib/crud.module.mjs +107 -0
  27. package/esm2020/lib/factories/list-pagination/list-pagination.factory.mjs +69 -0
  28. package/{esm2015/lib/models/index.js → esm2020/lib/models/index.mjs} +0 -0
  29. package/{esm2015/lib/models/interfaces.js → esm2020/lib/models/interfaces.mjs} +0 -0
  30. package/esm2020/lib/pages/index.mjs +7 -0
  31. package/esm2020/lib/pages/item/base/base.component.mjs +44 -0
  32. package/esm2020/lib/pages/item/item.component.mjs +393 -0
  33. package/esm2020/lib/pages/item/standard/standard.component.mjs +15 -0
  34. package/esm2020/lib/pages/list/base/base.component.mjs +23 -0
  35. package/esm2020/lib/pages/list/list.component.mjs +343 -0
  36. package/esm2020/lib/pages/list/standard/standard.component.mjs +34 -0
  37. package/esm2020/lib/pipes/form-options/form-options.pipe.mjs +55 -0
  38. package/{esm2015/lib/pipes/index.js → esm2020/lib/pipes/index.mjs} +0 -0
  39. package/esm2020/lib/pipes/pipes.module.mjs +20 -0
  40. package/{esm2015/lib/providers/model-possibilities/model-possibilities.provider.js → esm2020/lib/providers/model-possibilities/model-possibilities.provider.mjs} +0 -0
  41. package/esm2020/lib/services/crud/crud.service.mjs +138 -0
  42. package/esm2020/lib/services/list-group/list-group.service.mjs +60 -0
  43. package/esm2020/lib/services/page/page.service.mjs +41 -0
  44. package/{esm2015/lib/services/search/search.service.js → esm2020/lib/services/search/search.service.mjs} +9 -8
  45. package/esm2020/lib/services/socket/socket.service.mjs +17 -0
  46. package/esm2020/smartsoft001-crud-shell-angular.mjs +5 -0
  47. package/fesm2015/smartsoft001-crud-shell-angular.mjs +2568 -0
  48. package/fesm2015/smartsoft001-crud-shell-angular.mjs.map +1 -0
  49. package/fesm2020/smartsoft001-crud-shell-angular.mjs +2728 -0
  50. package/fesm2020/smartsoft001-crud-shell-angular.mjs.map +1 -0
  51. package/lib/+state/crud.effects.d.ts +3 -0
  52. package/lib/+state/crud.effects.d.ts.map +1 -1
  53. package/lib/+state/crud.facade.d.ts +3 -0
  54. package/lib/+state/crud.facade.d.ts.map +1 -1
  55. package/lib/components/components.module.d.ts +22 -0
  56. package/lib/components/components.module.d.ts.map +1 -1
  57. package/lib/components/export/export.component.d.ts +3 -0
  58. package/lib/components/export/export.component.d.ts.map +1 -1
  59. package/lib/components/filter/base/base.component.d.ts +3 -0
  60. package/lib/components/filter/base/base.component.d.ts.map +1 -1
  61. package/lib/components/filter/check/check.component.d.ts +3 -0
  62. package/lib/components/filter/check/check.component.d.ts.map +1 -1
  63. package/lib/components/filter/date/date.component.d.ts +3 -0
  64. package/lib/components/filter/date/date.component.d.ts.map +1 -1
  65. package/lib/components/filter/date-with-edit/date-with-edit.component.d.ts +4 -1
  66. package/lib/components/filter/date-with-edit/date-with-edit.component.d.ts.map +1 -1
  67. package/lib/components/filter/filter.component.d.ts +3 -0
  68. package/lib/components/filter/filter.component.d.ts.map +1 -1
  69. package/lib/components/filter/flag/flag.component.d.ts +3 -0
  70. package/lib/components/filter/flag/flag.component.d.ts.map +1 -1
  71. package/lib/components/filter/int/int.component.d.ts +3 -0
  72. package/lib/components/filter/int/int.component.d.ts.map +1 -1
  73. package/lib/components/filter/radio/radio.component.d.ts +3 -0
  74. package/lib/components/filter/radio/radio.component.d.ts.map +1 -1
  75. package/lib/components/filter/text/text.component.d.ts +3 -0
  76. package/lib/components/filter/text/text.component.d.ts.map +1 -1
  77. package/lib/components/filters/filters.component.d.ts +3 -0
  78. package/lib/components/filters/filters.component.d.ts.map +1 -1
  79. package/lib/components/filters-config/filters-config.component.d.ts +3 -0
  80. package/lib/components/filters-config/filters-config.component.d.ts.map +1 -1
  81. package/lib/components/group/group.component.d.ts +3 -0
  82. package/lib/components/group/group.component.d.ts.map +1 -1
  83. package/lib/components/multiselect/multiselect.component.d.ts +3 -0
  84. package/lib/components/multiselect/multiselect.component.d.ts.map +1 -1
  85. package/lib/crud-full.module.d.ts +20 -0
  86. package/lib/crud-full.module.d.ts.map +1 -1
  87. package/lib/crud.config.d.ts +5 -0
  88. package/lib/crud.config.d.ts.map +1 -1
  89. package/lib/crud.module.d.ts +13 -0
  90. package/lib/crud.module.d.ts.map +1 -1
  91. package/lib/factories/list-pagination/list-pagination.factory.d.ts +3 -0
  92. package/lib/factories/list-pagination/list-pagination.factory.d.ts.map +1 -1
  93. package/lib/pages/index.d.ts +5 -1
  94. package/lib/pages/index.d.ts.map +1 -1
  95. package/lib/pages/item/base/base.component.d.ts +3 -0
  96. package/lib/pages/item/base/base.component.d.ts.map +1 -1
  97. package/lib/pages/item/item.component.d.ts +3 -0
  98. package/lib/pages/item/item.component.d.ts.map +1 -1
  99. package/lib/pages/item/standard/standard.component.d.ts +3 -0
  100. package/lib/pages/item/standard/standard.component.d.ts.map +1 -1
  101. package/lib/pages/list/base/base.component.d.ts +3 -0
  102. package/lib/pages/list/base/base.component.d.ts.map +1 -1
  103. package/lib/pages/list/list.component.d.ts +3 -0
  104. package/lib/pages/list/list.component.d.ts.map +1 -1
  105. package/lib/pages/list/standard/standard.component.d.ts +3 -0
  106. package/lib/pages/list/standard/standard.component.d.ts.map +1 -1
  107. package/lib/pipes/form-options/form-options.pipe.d.ts +3 -0
  108. package/lib/pipes/form-options/form-options.pipe.d.ts.map +1 -1
  109. package/lib/pipes/pipes.module.d.ts +5 -0
  110. package/lib/pipes/pipes.module.d.ts.map +1 -1
  111. package/lib/services/crud/crud.service.d.ts +3 -0
  112. package/lib/services/crud/crud.service.d.ts.map +1 -1
  113. package/lib/services/list-group/list-group.service.d.ts +3 -0
  114. package/lib/services/list-group/list-group.service.d.ts.map +1 -1
  115. package/lib/services/page/page.service.d.ts +3 -0
  116. package/lib/services/page/page.service.d.ts.map +1 -1
  117. package/lib/services/search/search.service.d.ts +3 -0
  118. package/lib/services/search/search.service.d.ts.map +1 -1
  119. package/lib/services/socket/socket.service.d.ts +5 -0
  120. package/lib/services/socket/socket.service.d.ts.map +1 -1
  121. package/package.json +39 -26
  122. package/smartsoft001-crud-shell-angular.d.ts +1 -17
  123. package/smartsoft001-crud-shell-angular.d.ts.map +1 -1
  124. package/bundles/smartsoft001-crud-shell-angular.umd.js +0 -3332
  125. package/bundles/smartsoft001-crud-shell-angular.umd.js.map +0 -1
  126. package/esm2015/lib/+state/crud.effects.js +0 -178
  127. package/esm2015/lib/+state/crud.facade.js +0 -92
  128. package/esm2015/lib/+state/crud.reducer.js +0 -92
  129. package/esm2015/lib/components/components.module.js +0 -65
  130. package/esm2015/lib/components/export/export.component.js +0 -55
  131. package/esm2015/lib/components/filter/base/base.component.js +0 -144
  132. package/esm2015/lib/components/filter/check/check.component.js +0 -34
  133. package/esm2015/lib/components/filter/date/date.component.js +0 -42
  134. package/esm2015/lib/components/filter/date-with-edit/date-with-edit.component.js +0 -43
  135. package/esm2015/lib/components/filter/filter.component.js +0 -30
  136. package/esm2015/lib/components/filter/flag/flag.component.js +0 -13
  137. package/esm2015/lib/components/filter/int/int.component.js +0 -31
  138. package/esm2015/lib/components/filter/radio/radio.component.js +0 -13
  139. package/esm2015/lib/components/filter/text/text.component.js +0 -13
  140. package/esm2015/lib/components/filters/filters.component.js +0 -124
  141. package/esm2015/lib/components/filters-config/filters-config.component.js +0 -46
  142. package/esm2015/lib/components/group/group.component.js +0 -65
  143. package/esm2015/lib/components/multiselect/multiselect.component.js +0 -74
  144. package/esm2015/lib/crud-full.module.js +0 -83
  145. package/esm2015/lib/crud.config.js +0 -14
  146. package/esm2015/lib/crud.module.js +0 -84
  147. package/esm2015/lib/factories/list-pagination/list-pagination.factory.js +0 -73
  148. package/esm2015/lib/pages/index.js +0 -3
  149. package/esm2015/lib/pages/item/base/base.component.js +0 -44
  150. package/esm2015/lib/pages/item/item.component.js +0 -383
  151. package/esm2015/lib/pages/item/standard/standard.component.js +0 -13
  152. package/esm2015/lib/pages/list/base/base.component.js +0 -30
  153. package/esm2015/lib/pages/list/list.component.js +0 -319
  154. package/esm2015/lib/pages/list/standard/standard.component.js +0 -39
  155. package/esm2015/lib/pipes/form-options/form-options.pipe.js +0 -56
  156. package/esm2015/lib/pipes/pipes.module.js +0 -16
  157. package/esm2015/lib/services/crud/crud.service.js +0 -143
  158. package/esm2015/lib/services/list-group/list-group.service.js +0 -61
  159. package/esm2015/lib/services/page/page.service.js +0 -48
  160. package/esm2015/lib/services/socket/socket.service.js +0 -14
  161. package/esm2015/smartsoft001-crud-shell-angular.js +0 -22
  162. package/fesm2015/smartsoft001-crud-shell-angular.js +0 -2676
  163. package/fesm2015/smartsoft001-crud-shell-angular.js.map +0 -1
  164. package/lib/+state/crud.effects.ngfactory.d.ts.map +0 -1
  165. package/lib/+state/crud.facade.ngfactory.d.ts.map +0 -1
  166. package/lib/components/components.module.ngfactory.d.ts.map +0 -1
  167. package/lib/components/export/export.component.ngfactory.d.ts.map +0 -1
  168. package/lib/components/export/export.component.scss.shim.ngstyle.d.ts.map +0 -1
  169. package/lib/components/filter/check/check.component.ngfactory.d.ts.map +0 -1
  170. package/lib/components/filter/check/check.component.scss.shim.ngstyle.d.ts.map +0 -1
  171. package/lib/components/filter/date/date.component.ngfactory.d.ts.map +0 -1
  172. package/lib/components/filter/date/date.component.scss.shim.ngstyle.d.ts.map +0 -1
  173. package/lib/components/filter/date-with-edit/date-with-edit.component.ngfactory.d.ts.map +0 -1
  174. package/lib/components/filter/date-with-edit/date-with-edit.component.scss.shim.ngstyle.d.ts.map +0 -1
  175. package/lib/components/filter/filter.component.ngfactory.d.ts.map +0 -1
  176. package/lib/components/filter/filter.component.scss.shim.ngstyle.d.ts.map +0 -1
  177. package/lib/components/filter/flag/flag.component.ngfactory.d.ts.map +0 -1
  178. package/lib/components/filter/flag/flag.component.scss.shim.ngstyle.d.ts.map +0 -1
  179. package/lib/components/filter/int/int.component.ngfactory.d.ts.map +0 -1
  180. package/lib/components/filter/int/int.component.scss.shim.ngstyle.d.ts.map +0 -1
  181. package/lib/components/filter/radio/radio.component.ngfactory.d.ts.map +0 -1
  182. package/lib/components/filter/radio/radio.component.scss.shim.ngstyle.d.ts.map +0 -1
  183. package/lib/components/filter/text/text.component.ngfactory.d.ts.map +0 -1
  184. package/lib/components/filter/text/text.component.scss.shim.ngstyle.d.ts.map +0 -1
  185. package/lib/components/filters/filters.component.ngfactory.d.ts.map +0 -1
  186. package/lib/components/filters/filters.component.scss.shim.ngstyle.d.ts.map +0 -1
  187. package/lib/components/filters-config/filters-config.component.ngfactory.d.ts.map +0 -1
  188. package/lib/components/filters-config/filters-config.component.scss.shim.ngstyle.d.ts.map +0 -1
  189. package/lib/components/group/group.component.ngfactory.d.ts.map +0 -1
  190. package/lib/components/group/group.component.scss.shim.ngstyle.d.ts.map +0 -1
  191. package/lib/components/multiselect/multiselect.component.ngfactory.d.ts.map +0 -1
  192. package/lib/components/multiselect/multiselect.component.scss.shim.ngstyle.d.ts.map +0 -1
  193. package/lib/crud-full.module.ngfactory.d.ts.map +0 -1
  194. package/lib/crud.config.ngfactory.d.ts.map +0 -1
  195. package/lib/crud.module.ngfactory.d.ts.map +0 -1
  196. package/lib/factories/list-pagination/list-pagination.factory.ngfactory.d.ts.map +0 -1
  197. package/lib/pages/item/item.component.ngfactory.d.ts.map +0 -1
  198. package/lib/pages/item/standard/standard.component.ngfactory.d.ts.map +0 -1
  199. package/lib/pages/item/standard/standard.component.scss.shim.ngstyle.d.ts.map +0 -1
  200. package/lib/pages/list/list.component.ngfactory.d.ts.map +0 -1
  201. package/lib/pages/list/standard/standard.component.ngfactory.d.ts.map +0 -1
  202. package/lib/pages/list/standard/standard.component.scss.shim.ngstyle.d.ts.map +0 -1
  203. package/lib/pipes/form-options/form-options.pipe.ngfactory.d.ts.map +0 -1
  204. package/lib/pipes/pipes.module.ngfactory.d.ts.map +0 -1
  205. package/lib/services/crud/crud.service.ngfactory.d.ts.map +0 -1
  206. package/lib/services/list-group/list-group.service.ngfactory.d.ts.map +0 -1
  207. package/lib/services/page/page.service.ngfactory.d.ts.map +0 -1
  208. package/lib/services/search/search.service.ngfactory.d.ts.map +0 -1
  209. package/lib/services/socket/socket.service.ngfactory.d.ts.map +0 -1
  210. package/smartsoft001-crud-shell-angular.metadata.json +0 -1
@@ -1,3332 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngrx/store'), require('@angular/core'), require('@smartsoft001/angular'), require('rxjs/operators'), require('@smartsoft001/models'), require('moment'), require('lodash-decorators'), require('@ionic/angular'), require('rxjs'), require('lodash'), require('@angular/forms'), require('@angular/common'), require('@angular/common/http'), require('reflect-metadata'), require('@angular/router'), require('@ngx-translate/core')) :
3
- typeof define === 'function' && define.amd ? define('@smartsoft001/crud-shell-angular', ['exports', '@ngrx/store', '@angular/core', '@smartsoft001/angular', 'rxjs/operators', '@smartsoft001/models', 'moment', 'lodash-decorators', '@ionic/angular', 'rxjs', 'lodash', '@angular/forms', '@angular/common', '@angular/common/http', 'reflect-metadata', '@angular/router', '@ngx-translate/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.smartsoft001 = global.smartsoft001 || {}, global.smartsoft001["crud-shell-angular"] = {}), global.store, global.ng.core, global.angular, global.rxjs.operators, global.models, global.moment, global.lodashDecorators, global.angular$1, global.rxjs, global._, global.ng.forms, global.ng.common, global.ng.common.http, null, global.ng.router, global.core));
5
- })(this, (function (exports, store, i0, angular, operators, models, moment, lodashDecorators, angular$1, rxjs, _, forms, common, http, reflectMetadata, router, core) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
27
- var ___namespace = /*#__PURE__*/_interopNamespace(_);
28
-
29
- var getCrudState = function (entity) { return store.createFeatureSelector(entity); };
30
- var getCrudSelected = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.selected; }); };
31
- var getCrudMultiSelected = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.multiSelected; }); };
32
- var getCrudList = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.list; }); };
33
- var getCrudTotalCount = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.totalCount; }); };
34
- var getCrudLinks = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.links; }); };
35
- var getCrudLoaded = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.loaded; }); };
36
- var getCrudFilter = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.filter; }); };
37
- var getCrudError = function (entity) { return store.createSelector(getCrudState(entity), function (state) { return state.error; }); };
38
-
39
- /*! *****************************************************************************
40
- Copyright (c) Microsoft Corporation.
41
-
42
- Permission to use, copy, modify, and/or distribute this software for any
43
- purpose with or without fee is hereby granted.
44
-
45
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
46
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
47
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
48
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
49
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
50
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51
- PERFORMANCE OF THIS SOFTWARE.
52
- ***************************************************************************** */
53
- /* global Reflect, Promise */
54
- var extendStatics = function (d, b) {
55
- extendStatics = Object.setPrototypeOf ||
56
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
57
- function (d, b) { for (var p in b)
58
- if (Object.prototype.hasOwnProperty.call(b, p))
59
- d[p] = b[p]; };
60
- return extendStatics(d, b);
61
- };
62
- function __extends(d, b) {
63
- if (typeof b !== "function" && b !== null)
64
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
65
- extendStatics(d, b);
66
- function __() { this.constructor = d; }
67
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
68
- }
69
- var __assign = function () {
70
- __assign = Object.assign || function __assign(t) {
71
- for (var s, i = 1, n = arguments.length; i < n; i++) {
72
- s = arguments[i];
73
- for (var p in s)
74
- if (Object.prototype.hasOwnProperty.call(s, p))
75
- t[p] = s[p];
76
- }
77
- return t;
78
- };
79
- return __assign.apply(this, arguments);
80
- };
81
- function __rest(s, e) {
82
- var t = {};
83
- for (var p in s)
84
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
85
- t[p] = s[p];
86
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
87
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
88
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
89
- t[p[i]] = s[p[i]];
90
- }
91
- return t;
92
- }
93
- function __decorate(decorators, target, key, desc) {
94
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
95
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
96
- r = Reflect.decorate(decorators, target, key, desc);
97
- else
98
- for (var i = decorators.length - 1; i >= 0; i--)
99
- if (d = decorators[i])
100
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
101
- return c > 3 && r && Object.defineProperty(target, key, r), r;
102
- }
103
- function __param(paramIndex, decorator) {
104
- return function (target, key) { decorator(target, key, paramIndex); };
105
- }
106
- function __metadata(metadataKey, metadataValue) {
107
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
108
- return Reflect.metadata(metadataKey, metadataValue);
109
- }
110
- function __awaiter(thisArg, _arguments, P, generator) {
111
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
112
- return new (P || (P = Promise))(function (resolve, reject) {
113
- function fulfilled(value) { try {
114
- step(generator.next(value));
115
- }
116
- catch (e) {
117
- reject(e);
118
- } }
119
- function rejected(value) { try {
120
- step(generator["throw"](value));
121
- }
122
- catch (e) {
123
- reject(e);
124
- } }
125
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
126
- step((generator = generator.apply(thisArg, _arguments || [])).next());
127
- });
128
- }
129
- function __generator(thisArg, body) {
130
- var _ = { label: 0, sent: function () { if (t[0] & 1)
131
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
132
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
133
- function verb(n) { return function (v) { return step([n, v]); }; }
134
- function step(op) {
135
- if (f)
136
- throw new TypeError("Generator is already executing.");
137
- while (_)
138
- try {
139
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
140
- return t;
141
- if (y = 0, t)
142
- op = [op[0] & 2, t.value];
143
- switch (op[0]) {
144
- case 0:
145
- case 1:
146
- t = op;
147
- break;
148
- case 4:
149
- _.label++;
150
- return { value: op[1], done: false };
151
- case 5:
152
- _.label++;
153
- y = op[1];
154
- op = [0];
155
- continue;
156
- case 7:
157
- op = _.ops.pop();
158
- _.trys.pop();
159
- continue;
160
- default:
161
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
162
- _ = 0;
163
- continue;
164
- }
165
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
166
- _.label = op[1];
167
- break;
168
- }
169
- if (op[0] === 6 && _.label < t[1]) {
170
- _.label = t[1];
171
- t = op;
172
- break;
173
- }
174
- if (t && _.label < t[2]) {
175
- _.label = t[2];
176
- _.ops.push(op);
177
- break;
178
- }
179
- if (t[2])
180
- _.ops.pop();
181
- _.trys.pop();
182
- continue;
183
- }
184
- op = body.call(thisArg, _);
185
- }
186
- catch (e) {
187
- op = [6, e];
188
- y = 0;
189
- }
190
- finally {
191
- f = t = 0;
192
- }
193
- if (op[0] & 5)
194
- throw op[1];
195
- return { value: op[0] ? op[1] : void 0, done: true };
196
- }
197
- }
198
- var __createBinding = Object.create ? (function (o, m, k, k2) {
199
- if (k2 === undefined)
200
- k2 = k;
201
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
202
- }) : (function (o, m, k, k2) {
203
- if (k2 === undefined)
204
- k2 = k;
205
- o[k2] = m[k];
206
- });
207
- function __exportStar(m, o) {
208
- for (var p in m)
209
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
210
- __createBinding(o, m, p);
211
- }
212
- function __values(o) {
213
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
214
- if (m)
215
- return m.call(o);
216
- if (o && typeof o.length === "number")
217
- return {
218
- next: function () {
219
- if (o && i >= o.length)
220
- o = void 0;
221
- return { value: o && o[i++], done: !o };
222
- }
223
- };
224
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
225
- }
226
- function __read(o, n) {
227
- var m = typeof Symbol === "function" && o[Symbol.iterator];
228
- if (!m)
229
- return o;
230
- var i = m.call(o), r, ar = [], e;
231
- try {
232
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
233
- ar.push(r.value);
234
- }
235
- catch (error) {
236
- e = { error: error };
237
- }
238
- finally {
239
- try {
240
- if (r && !r.done && (m = i["return"]))
241
- m.call(i);
242
- }
243
- finally {
244
- if (e)
245
- throw e.error;
246
- }
247
- }
248
- return ar;
249
- }
250
- /** @deprecated */
251
- function __spread() {
252
- for (var ar = [], i = 0; i < arguments.length; i++)
253
- ar = ar.concat(__read(arguments[i]));
254
- return ar;
255
- }
256
- /** @deprecated */
257
- function __spreadArrays() {
258
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
259
- s += arguments[i].length;
260
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
261
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
262
- r[k] = a[j];
263
- return r;
264
- }
265
- function __spreadArray(to, from, pack) {
266
- if (pack || arguments.length === 2)
267
- for (var i = 0, l = from.length, ar; i < l; i++) {
268
- if (ar || !(i in from)) {
269
- if (!ar)
270
- ar = Array.prototype.slice.call(from, 0, i);
271
- ar[i] = from[i];
272
- }
273
- }
274
- return to.concat(ar || Array.prototype.slice.call(from));
275
- }
276
- function __await(v) {
277
- return this instanceof __await ? (this.v = v, this) : new __await(v);
278
- }
279
- function __asyncGenerator(thisArg, _arguments, generator) {
280
- if (!Symbol.asyncIterator)
281
- throw new TypeError("Symbol.asyncIterator is not defined.");
282
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
283
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
284
- function verb(n) { if (g[n])
285
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
286
- function resume(n, v) { try {
287
- step(g[n](v));
288
- }
289
- catch (e) {
290
- settle(q[0][3], e);
291
- } }
292
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
293
- function fulfill(value) { resume("next", value); }
294
- function reject(value) { resume("throw", value); }
295
- function settle(f, v) { if (f(v), q.shift(), q.length)
296
- resume(q[0][0], q[0][1]); }
297
- }
298
- function __asyncDelegator(o) {
299
- var i, p;
300
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
301
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
302
- }
303
- function __asyncValues(o) {
304
- if (!Symbol.asyncIterator)
305
- throw new TypeError("Symbol.asyncIterator is not defined.");
306
- var m = o[Symbol.asyncIterator], i;
307
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
308
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
309
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
310
- }
311
- function __makeTemplateObject(cooked, raw) {
312
- if (Object.defineProperty) {
313
- Object.defineProperty(cooked, "raw", { value: raw });
314
- }
315
- else {
316
- cooked.raw = raw;
317
- }
318
- return cooked;
319
- }
320
- ;
321
- var __setModuleDefault = Object.create ? (function (o, v) {
322
- Object.defineProperty(o, "default", { enumerable: true, value: v });
323
- }) : function (o, v) {
324
- o["default"] = v;
325
- };
326
- function __importStar(mod) {
327
- if (mod && mod.__esModule)
328
- return mod;
329
- var result = {};
330
- if (mod != null)
331
- for (var k in mod)
332
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
333
- __createBinding(result, mod, k);
334
- __setModuleDefault(result, mod);
335
- return result;
336
- }
337
- function __importDefault(mod) {
338
- return (mod && mod.__esModule) ? mod : { default: mod };
339
- }
340
- function __classPrivateFieldGet(receiver, state, kind, f) {
341
- if (kind === "a" && !f)
342
- throw new TypeError("Private accessor was defined without a getter");
343
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
344
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
345
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
346
- }
347
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
348
- if (kind === "m")
349
- throw new TypeError("Private method is not writable");
350
- if (kind === "a" && !f)
351
- throw new TypeError("Private accessor was defined without a setter");
352
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
353
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
354
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
355
- }
356
-
357
- var CrudConfig = /** @class */ (function () {
358
- function CrudConfig() {
359
- }
360
- return CrudConfig;
361
- }());
362
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
363
- CrudConfig.decorators = [
364
- { type: i0.Injectable }
365
- ];
366
- var CrudFullConfig = /** @class */ (function (_super) {
367
- __extends(CrudFullConfig, _super);
368
- function CrudFullConfig() {
369
- return _super !== null && _super.apply(this, arguments) || this;
370
- }
371
- return CrudFullConfig;
372
- }(CrudConfig));
373
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
374
- CrudFullConfig.decorators = [
375
- { type: i0.Injectable }
376
- ];
377
-
378
- /*
379
- * Create
380
- */
381
- var create = function (entity, item) {
382
- return {
383
- type: "[" + entity + "] Create",
384
- item: item
385
- };
386
- };
387
- var createSuccess = function (entity, item) {
388
- return {
389
- type: "[" + entity + "] Create Success",
390
- item: item
391
- };
392
- };
393
- var createFailure = function (entity, item, error) {
394
- return {
395
- type: "[" + entity + "] Create Failure",
396
- item: item,
397
- error: error
398
- };
399
- };
400
- /*
401
- * Create many
402
- */
403
- var createMany = function (entity, data) {
404
- return {
405
- type: "[" + entity + "] Create Many",
406
- data: data
407
- };
408
- };
409
- var createManySuccess = function (entity, data) {
410
- return {
411
- type: "[" + entity + "] Create Many Success",
412
- data: data
413
- };
414
- };
415
- var createManyFailure = function (entity, data, error) {
416
- return {
417
- type: "[" + entity + "] Create Many Failure",
418
- data: data,
419
- error: error
420
- };
421
- };
422
- /*
423
- * Read
424
- */
425
- var read = function (entity, filter) {
426
- if (filter === void 0) { filter = null; }
427
- return {
428
- type: "[" + entity + "] Read",
429
- filter: filter
430
- };
431
- };
432
- var readSuccess = function (entity, filter, result) {
433
- return {
434
- type: "[" + entity + "] Read Success",
435
- result: result,
436
- filter: filter
437
- };
438
- };
439
- var readFailure = function (entity, filter, error) {
440
- return {
441
- type: "[" + entity + "] Read Failure",
442
- filter: filter,
443
- error: error
444
- };
445
- };
446
- /*
447
- * Export
448
- */
449
- var exportList = function (entity, filter, format) {
450
- if (filter === void 0) { filter = null; }
451
- return {
452
- type: "[" + entity + "] Export",
453
- filter: filter,
454
- format: format
455
- };
456
- };
457
- var exportListSuccess = function (entity, filter) {
458
- return {
459
- type: "[" + entity + "] Export Success",
460
- filter: filter
461
- };
462
- };
463
- var exportListFailure = function (entity, filter, error) {
464
- return {
465
- type: "[" + entity + "] Export Failure",
466
- filter: filter,
467
- error: error
468
- };
469
- };
470
- /*
471
- * Select
472
- */
473
- var select = function (entity, id) {
474
- return {
475
- type: "[" + entity + "] Select",
476
- id: id
477
- };
478
- };
479
- var selectSuccess = function (entity, id, item) {
480
- return {
481
- type: "[" + entity + "] Select Success",
482
- id: id,
483
- item: item
484
- };
485
- };
486
- var selectFailure = function (entity, id, error) {
487
- return {
488
- type: "[" + entity + "] Select Failure",
489
- id: id,
490
- error: error
491
- };
492
- };
493
- var unselect = function (entity) {
494
- return {
495
- type: "[" + entity + "] Unselect"
496
- };
497
- };
498
- /*
499
- * MultiSelect
500
- */
501
- var multiSelect = function (entity, items) {
502
- return {
503
- type: "[" + entity + "] MultiSelect",
504
- items: items
505
- };
506
- };
507
- /*
508
- * Update
509
- */
510
- var update = function (entity, item) {
511
- return {
512
- type: "[" + entity + "] Update",
513
- item: item
514
- };
515
- };
516
- var updateSuccess = function (entity, item) {
517
- return {
518
- type: "[" + entity + "] Update Success",
519
- item: item
520
- };
521
- };
522
- var updateFailure = function (entity, item, error) {
523
- return {
524
- type: "[" + entity + "] Update Failure",
525
- item: item,
526
- error: error
527
- };
528
- };
529
- /*
530
- * Update partial
531
- */
532
- var updatePartial = function (entity, item) {
533
- return {
534
- type: "[" + entity + "] Update partial",
535
- item: item
536
- };
537
- };
538
- var updatePartialSuccess = function (entity, item) {
539
- return {
540
- type: "[" + entity + "] Update partial Success",
541
- item: item
542
- };
543
- };
544
- var updatePartialFailure = function (entity, item, error) {
545
- return {
546
- type: "[" + entity + "] Update partial Failure",
547
- item: item,
548
- error: error
549
- };
550
- };
551
- /*
552
- * Update partial many
553
- */
554
- var updatePartialMany = function (entity, items) {
555
- return {
556
- type: "[" + entity + "] Update partial many",
557
- items: items
558
- };
559
- };
560
- var updatePartialManySuccess = function (entity, items) {
561
- return {
562
- type: "[" + entity + "] Update partial many Success",
563
- items: items
564
- };
565
- };
566
- var updatePartialManyFailure = function (entity, items, error) {
567
- return {
568
- type: "[" + entity + "] Update partial many Failure",
569
- items: items,
570
- error: error
571
- };
572
- };
573
- /*
574
- * Delete
575
- */
576
- var deleteItem = function (entity, id) {
577
- return {
578
- type: "[" + entity + "] Delete",
579
- id: id
580
- };
581
- };
582
- var deleteSuccess = function (entity, id) {
583
- return {
584
- type: "[" + entity + "] Delete Success",
585
- id: id
586
- };
587
- };
588
- var deleteFailure = function (entity, id, error) {
589
- return {
590
- type: "[" + entity + "] Delete Failure",
591
- id: id,
592
- error: error
593
- };
594
- };
595
-
596
- var CrudFacade = /** @class */ (function () {
597
- function CrudFacade(store$1, config) {
598
- var _this = this;
599
- this.store = store$1;
600
- this.config = config;
601
- this.loaded$ = this.store.pipe(store.select(getCrudLoaded(this.config.entity)));
602
- this.loading$ = this.store.pipe(store.select(getCrudLoaded(this.config.entity)), operators.map(function (l) { return !l; }));
603
- this.selected$ = this.store.pipe(store.select(getCrudSelected(this.config.entity)), operators.tap(function (s) {
604
- _this.selected = s;
605
- }));
606
- this.multiSelected$ = this.store.pipe(store.select(getCrudMultiSelected(this.config.entity)), operators.tap(function (s) {
607
- _this.multiSelected = s;
608
- }));
609
- this.list$ = this.store.pipe(store.select(getCrudList(this.config.entity)), operators.tap(function (l) {
610
- _this.list = l;
611
- }));
612
- this.filter$ = this.store.pipe(store.select(getCrudFilter(this.config.entity)), operators.tap(function (f) {
613
- _this.filter = f;
614
- }));
615
- this.totalCount$ = this.store.pipe(store.select(getCrudTotalCount(this.config.entity)));
616
- this.links$ = this.store.pipe(store.select(getCrudLinks(this.config.entity)));
617
- this.error$ = this.store.pipe(store.select(getCrudError(this.config.entity)));
618
- if (angular.NgrxStoreService.store) {
619
- this.store = angular.NgrxStoreService.store;
620
- }
621
- }
622
- CrudFacade.prototype.create = function (item) {
623
- this.store.dispatch(create(this.config.entity, item));
624
- };
625
- CrudFacade.prototype.createMany = function (items, options) {
626
- this.store.dispatch(createMany(this.config.entity, { items: items, options: options }));
627
- };
628
- CrudFacade.prototype.read = function (filter) {
629
- if (filter === void 0) { filter = null; }
630
- var baseQuery = [];
631
- if (this.config.baseQuery) {
632
- baseQuery = this.config.baseQuery;
633
- }
634
- var fullFilter = Object.assign(Object.assign({}, (filter ? filter : {})), { query: filter && filter.query ? filter.query : baseQuery });
635
- this.store.dispatch(read(this.config.entity, fullFilter));
636
- };
637
- CrudFacade.prototype.select = function (id) {
638
- this.store.dispatch(select(this.config.entity, id));
639
- };
640
- CrudFacade.prototype.unselect = function () {
641
- this.store.dispatch(unselect(this.config.entity));
642
- };
643
- CrudFacade.prototype.multiSelect = function (items) {
644
- this.store.dispatch(multiSelect(this.config.entity, items));
645
- };
646
- CrudFacade.prototype.update = function (item) {
647
- this.getStore().dispatch(update(this.config.entity, item));
648
- };
649
- CrudFacade.prototype.export = function (filter, format) {
650
- if (filter === void 0) { filter = null; }
651
- if (format === void 0) { format = null; }
652
- this.getStore().dispatch(exportList(this.config.entity, filter, format));
653
- };
654
- CrudFacade.prototype.updatePartial = function (item) {
655
- this.getStore().dispatch(updatePartial(this.config.entity, item));
656
- };
657
- CrudFacade.prototype.updatePartialMany = function (items) {
658
- this.getStore().dispatch(updatePartialMany(this.config.entity, items));
659
- };
660
- CrudFacade.prototype.delete = function (id) {
661
- this.getStore().dispatch(deleteItem(this.config.entity, id));
662
- };
663
- CrudFacade.prototype.getStore = function () {
664
- if (angular.NgrxStoreService.store)
665
- return angular.NgrxStoreService.store;
666
- return this.store;
667
- };
668
- return CrudFacade;
669
- }());
670
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
671
- CrudFacade.decorators = [
672
- { type: i0.Injectable }
673
- ];
674
- /**
675
- * @type {function(): !Array<(null|{
676
- * type: ?,
677
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
678
- * })>}
679
- * @nocollapse
680
- */
681
- CrudFacade.ctorParameters = function () { return [
682
- { type: store.Store },
683
- { type: CrudConfig }
684
- ]; };
685
-
686
- var ExportComponent = /** @class */ (function (_super) {
687
- __extends(ExportComponent, _super);
688
- function ExportComponent(facade, popoverService, styleService, elementRef) {
689
- var _this = _super.call(this) || this;
690
- _this.facade = facade;
691
- _this.popoverService = popoverService;
692
- _this.styleService = styleService;
693
- _this.elementRef = elementRef;
694
- _this.buttonExportCsvOptions = _this.initButtonExportOptions('csv');
695
- _this.buttonExportXlsxOptions = _this.initButtonExportOptions('xlsx');
696
- _this.loading$ = _this.facade.loading$;
697
- return _this;
698
- }
699
- ExportComponent.prototype.ngOnInit = function () {
700
- this.styleService.init(this.elementRef);
701
- };
702
- ExportComponent.prototype.initButtonExportOptions = function (format) {
703
- var _this = this;
704
- return {
705
- click: function () {
706
- _this.facade.export(Object.assign(Object.assign({}, _this.facade.filter), { offset: null, limit: null }), format);
707
- var subscription = _this.facade.loaded$.subscribe(function (val) {
708
- if (!val)
709
- return;
710
- _this.popoverService.close();
711
- subscription.unsubscribe();
712
- });
713
- },
714
- loading$: this.facade.loading$,
715
- expand: 'block'
716
- };
717
- };
718
- return ExportComponent;
719
- }(angular.BaseComponent));
720
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
721
- ExportComponent.decorators = [
722
- { type: i0.Component, args: [{
723
- selector: 'smart-crud-export',
724
- template: "<div class=\"smart-content\">\n <p>\n <smart-button [options]=\"buttonExportCsvOptions\">CSV</smart-button>\n </p>\n <p>\n <smart-button [options]=\"buttonExportXlsxOptions\">XLSX</smart-button>\n </p>\n</div>",
725
- styles: [".smart-content{padding:1.2rem}.smart-content p{margin:.6rem 0}.smart-content smart-button{width:100%;display:block}\n"]
726
- },] }
727
- ];
728
- /**
729
- * @type {function(): !Array<(null|{
730
- * type: ?,
731
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
732
- * })>}
733
- * @nocollapse
734
- */
735
- ExportComponent.ctorParameters = function () { return [
736
- { type: CrudFacade },
737
- { type: angular.PopoverService },
738
- { type: angular.StyleService },
739
- { type: i0.ElementRef }
740
- ]; };
741
-
742
- var FilterComponent = /** @class */ (function () {
743
- function FilterComponent() {
744
- this.FieldType = models.FieldType;
745
- }
746
- FilterComponent.prototype.ngOnInit = function () { };
747
- return FilterComponent;
748
- }());
749
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
750
- FilterComponent.decorators = [
751
- { type: i0.Component, args: [{
752
- selector: "smart-crud-filter",
753
- template: "<ion-item [ngSwitch]=\"item.fieldType\">\n <smart-crud-filter-date\n *ngSwitchCase=\"FieldType.date\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date>\n\n <smart-crud-filter-date-with-edit\n *ngSwitchCase=\"FieldType.dateWithEdit\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date-with-edit>\n\n <smart-crud-filter-radio\n *ngSwitchCase=\"FieldType.radio\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-radio>\n\n <smart-crud-filter-check\n *ngSwitchCase=\"FieldType.check\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-check>\n\n <smart-crud-filter-flag\n *ngSwitchCase=\"FieldType.flag\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-flag>\n\n <smart-crud-filter-int\n *ngSwitchCase=\"FieldType.int\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-int>\n\n <smart-crud-filter-text\n *ngSwitchDefault\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-text>\n</ion-item>\n",
754
- styles: [""]
755
- },] }
756
- ];
757
- /**
758
- * @type {function(): !Array<(null|{
759
- * type: ?,
760
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
761
- * })>}
762
- * @nocollapse
763
- */
764
- FilterComponent.ctorParameters = function () { return []; };
765
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
766
- FilterComponent.propDecorators = {
767
- item: [{ type: i0.Input }],
768
- filter: [{ type: i0.Input }]
769
- };
770
-
771
- /**
772
- * @deprecated - please, use IModelPossibilitiesProvider from @smartsoft001/angular
773
- */
774
- var ICrudModelPossibilitiesProvider = /** @class */ (function () {
775
- function ICrudModelPossibilitiesProvider() {
776
- }
777
- return ICrudModelPossibilitiesProvider;
778
- }());
779
- /**
780
- * @deprecated - please, use MODEL_POSSIBILITIES_PROVIDER from @smartsoft001/angular
781
- */
782
- var CRUD_MODEL_POSSIBILITIES_PROVIDER = new i0.InjectionToken("CRUD_MODEL_POSSIBILITIES_PROVIDER");
783
-
784
- var BaseComponent = /** @class */ (function () {
785
- function BaseComponent(facade, config, modelPossibilitiesProvider) {
786
- this.facade = facade;
787
- this.config = config;
788
- this.modelPossibilitiesProvider = modelPossibilitiesProvider;
789
- }
790
- Object.defineProperty(BaseComponent.prototype, "value", {
791
- get: function () {
792
- var _this = this;
793
- if (this.isArrayType()) {
794
- return this.filter.query
795
- .filter(function (q) { return q.key === _this.item.key && q.type === _this.item.type; })
796
- .map(function (q) { return q.value; });
797
- }
798
- var query = this.filter.query.find(function (q) { return q.key === _this.item.key && q.type === _this.item.type; });
799
- return query === null || query === void 0 ? void 0 : query.value;
800
- },
801
- set: function (val) {
802
- this.refresh(val);
803
- },
804
- enumerable: false,
805
- configurable: true
806
- });
807
- Object.defineProperty(BaseComponent.prototype, "minValue", {
808
- get: function () {
809
- var _this = this;
810
- if (this.isArrayType()) {
811
- return this.filter.query
812
- .filter(function (q) { return q.key === _this.item.key && q.type === ">="; })
813
- .map(function (q) { return q.value; });
814
- }
815
- var query = this.filter.query.find(function (q) { return q.key === _this.item.key && q.type === ">="; });
816
- return query === null || query === void 0 ? void 0 : query.value;
817
- },
818
- set: function (val) {
819
- this.refresh(val, ">=");
820
- },
821
- enumerable: false,
822
- configurable: true
823
- });
824
- Object.defineProperty(BaseComponent.prototype, "maxValue", {
825
- get: function () {
826
- var _this = this;
827
- if (this.isArrayType()) {
828
- return this.filter.query
829
- .filter(function (q) { return q.key === _this.item.key && q.type === "<="; })
830
- .map(function (q) { return q.value; });
831
- }
832
- var query = this.filter.query.find(function (q) { return q.key === _this.item.key && q.type === "<="; });
833
- return query === null || query === void 0 ? void 0 : query.value;
834
- },
835
- set: function (val) {
836
- this.refresh(val, "<=");
837
- },
838
- enumerable: false,
839
- configurable: true
840
- });
841
- BaseComponent.prototype.refresh = function (val, type) {
842
- var _this = this;
843
- if (type === void 0) { type = null; }
844
- if (!type)
845
- type = this.item.type;
846
- if (this.isArrayType()) {
847
- this.refreshForArray(val, type);
848
- return;
849
- }
850
- var query = this.filter.query.find(function (q) { return q.key === _this.item.key && q.type === type; });
851
- if (val === null || val === undefined || val === '') {
852
- var index = this.filter.query.indexOf(query);
853
- if (index > -1) {
854
- this.filter.query.splice(index, 1);
855
- }
856
- this.facade.read(this.filter);
857
- return;
858
- }
859
- if (!query) {
860
- query = {
861
- key: this.item.key,
862
- type: type,
863
- value: null,
864
- };
865
- this.filter.query.push(query);
866
- }
867
- query.value = val;
868
- query.label = this.item.label;
869
- this.facade.read(this.filter);
870
- };
871
- BaseComponent.prototype.ngOnInit = function () {
872
- this.initPossibilities();
873
- };
874
- BaseComponent.prototype.initPossibilities = function () {
875
- var possibilities = this.item.possibilities$;
876
- if (this.modelPossibilitiesProvider) {
877
- var possibilitiesFromProvider = this.modelPossibilitiesProvider.get(this.config.type);
878
- if (possibilitiesFromProvider && possibilitiesFromProvider[this.item.key])
879
- possibilities = possibilitiesFromProvider[this.item.key];
880
- }
881
- this.possibilities$ = possibilities;
882
- };
883
- BaseComponent.prototype.isArrayType = function () {
884
- var _a;
885
- return (((_a = this.item) === null || _a === void 0 ? void 0 : _a.fieldType) === models.FieldType.check);
886
- };
887
- BaseComponent.prototype.refreshForArray = function (vals, type) {
888
- var _this = this;
889
- var queries = this.filter.query.filter(function (q) { return q.key === _this.item.key && q.type === type; });
890
- queries.forEach(function (query) {
891
- var index = _this.filter.query.indexOf(query);
892
- if (index > -1) {
893
- _this.filter.query.splice(index, 1);
894
- }
895
- });
896
- if (vals === null || vals === undefined || !vals.length) {
897
- this.facade.read(this.filter);
898
- return;
899
- }
900
- vals.forEach(function (val) {
901
- var query = {
902
- key: _this.item.key,
903
- type: type,
904
- value: val,
905
- };
906
- _this.filter.query.push(query);
907
- });
908
- this.facade.read(this.filter);
909
- };
910
- return BaseComponent;
911
- }());
912
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
913
- BaseComponent.decorators = [
914
- { type: i0.Directive }
915
- ];
916
- /**
917
- * @type {function(): !Array<(null|{
918
- * type: ?,
919
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
920
- * })>}
921
- * @nocollapse
922
- */
923
- BaseComponent.ctorParameters = function () { return [
924
- { type: CrudFacade },
925
- { type: CrudConfig },
926
- { type: ICrudModelPossibilitiesProvider, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [CRUD_MODEL_POSSIBILITIES_PROVIDER,] }] }
927
- ]; };
928
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
929
- BaseComponent.propDecorators = {
930
- item: [{ type: i0.Input }],
931
- filter: [{ type: i0.Input }]
932
- };
933
- __decorate([
934
- lodashDecorators.Debounce(500),
935
- __metadata("design:type", Function),
936
- __metadata("design:paramtypes", [Object, Object]),
937
- __metadata("design:returntype", void 0)
938
- ], BaseComponent.prototype, "refresh", null);
939
-
940
- var FilterDateComponent = /** @class */ (function (_super) {
941
- __extends(FilterDateComponent, _super);
942
- function FilterDateComponent() {
943
- return _super !== null && _super.apply(this, arguments) || this;
944
- }
945
- Object.defineProperty(FilterDateComponent.prototype, "allowAdvanced", {
946
- get: function () {
947
- var _a;
948
- return ((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) === '=';
949
- },
950
- enumerable: false,
951
- configurable: true
952
- });
953
- Object.defineProperty(FilterDateComponent.prototype, "customValue", {
954
- get: function () {
955
- return this.value;
956
- },
957
- set: function (val) {
958
- var _a;
959
- var momentDate = moment__namespace(val);
960
- this.value = ((_a = val) === null || _a === void 0 ? void 0 : _a.length) >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
961
- },
962
- enumerable: false,
963
- configurable: true
964
- });
965
- Object.defineProperty(FilterDateComponent.prototype, "customMinValue", {
966
- get: function () {
967
- return this.minValue;
968
- },
969
- set: function (val) {
970
- var _a;
971
- var momentDate = moment__namespace(val);
972
- this.minValue = ((_a = val) === null || _a === void 0 ? void 0 : _a.length) >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
973
- },
974
- enumerable: false,
975
- configurable: true
976
- });
977
- Object.defineProperty(FilterDateComponent.prototype, "customMaxValue", {
978
- get: function () {
979
- return this.maxValue;
980
- },
981
- set: function (val) {
982
- var _a;
983
- var momentDate = moment__namespace(val);
984
- this.maxValue = ((_a = val) === null || _a === void 0 ? void 0 : _a.length) >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
985
- },
986
- enumerable: false,
987
- configurable: true
988
- });
989
- return FilterDateComponent;
990
- }(BaseComponent));
991
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
992
- FilterDateComponent.decorators = [
993
- { type: i0.Component, args: [{
994
- selector: 'smart-crud-filter-date',
995
- template: "<ion-row>\n <ion-col>\n <ion-label position=\"floating\">\n {{ item.label | translate }}\n </ion-label>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"></ion-datetime>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>",
996
- styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"]
997
- },] }
998
- ];
999
-
1000
- var FilterDateWithEditComponent = /** @class */ (function (_super) {
1001
- __extends(FilterDateWithEditComponent, _super);
1002
- function FilterDateWithEditComponent() {
1003
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1004
- _this._subscriptions = new rxjs.Subscription();
1005
- _this.advanced = false;
1006
- return _this;
1007
- }
1008
- FilterDateWithEditComponent.prototype.open = function () {
1009
- this.dateTimePicker.open();
1010
- };
1011
- FilterDateWithEditComponent.prototype.ngOnInit = function () {
1012
- var _this = this;
1013
- _super.prototype.ngOnInit.call(this);
1014
- if (this.dateTimePicker) {
1015
- this._subscriptions.add(this.dateTimePicker.ionChange.subscribe(function (val) {
1016
- _this.customValue = val.detail.value;
1017
- }));
1018
- }
1019
- else {
1020
- console.error('dateTimePicker not found!');
1021
- }
1022
- };
1023
- FilterDateWithEditComponent.prototype.ngOnDestroy = function () {
1024
- if (this._subscriptions) {
1025
- this._subscriptions.unsubscribe();
1026
- }
1027
- };
1028
- return FilterDateWithEditComponent;
1029
- }(FilterDateComponent));
1030
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1031
- FilterDateWithEditComponent.decorators = [
1032
- { type: i0.Component, args: [{
1033
- selector: 'smart-crud-filter-date-with-edit',
1034
- template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n <ion-datetime [hidden]=\"true\"\n displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"></ion-datetime>\n </ion-col>\n <ion-col size=\"auto\">\n <ion-button (click)=\"open()\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"calendar-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"advanced = !advanced\" class=\"squere-button\" [disabled]=\"minValue || maxValue\">\n <ion-icon *ngIf=\"!advanced\" slot=\"icon-only\" name=\"settings-outline\"></ion-icon>\n <ion-icon *ngIf=\"advanced\" slot=\"icon-only\" name=\"settings\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>\n<ion-row *ngIf=\"(advanced || minValue || maxValue) && allowAdvanced\">\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customMinValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n <ion-datetime [hidden]=\"true\"\n [(ngModel)]=\"customMinValue\"\n displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"></ion-datetime>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"customMinValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '>=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'to' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD\"\n [(ngModel)]=\"customMaxValue\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n <ion-datetime [hidden]=\"true\"\n displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customMaxValue\"></ion-datetime>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"customMaxValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '<=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>",
1035
- styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"]
1036
- },] }
1037
- ];
1038
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
1039
- FilterDateWithEditComponent.propDecorators = {
1040
- dateTimePicker: [{ type: i0.ViewChild, args: [angular$1.IonDatetime, { read: angular$1.IonDatetime, static: false },] }]
1041
- };
1042
-
1043
- var FilterRadioComponent = /** @class */ (function (_super) {
1044
- __extends(FilterRadioComponent, _super);
1045
- function FilterRadioComponent() {
1046
- return _super !== null && _super.apply(this, arguments) || this;
1047
- }
1048
- return FilterRadioComponent;
1049
- }(BaseComponent));
1050
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1051
- FilterRadioComponent.decorators = [
1052
- { type: i0.Component, args: [{
1053
- selector: 'smart-crud-filter-radio',
1054
- template: "<ion-row>\n <ion-col>\n <ion-radio-group [(ngModel)]=\"value\">\n <ion-item-divider>\n <ion-icon slot=\"start\" name=\"filter-outline\"></ion-icon>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-button *ngIf=\"value\" slot=\"end\" color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-item-divider>\n\n <ion-item *ngFor=\"let item of possibilities$ | async\">\n <ion-label>{{ item.text | translate }}</ion-label>\n <ion-radio [value]=\"item.id\"></ion-radio>\n </ion-item>\n </ion-radio-group>\n </ion-col>\n <!-- <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col> -->\n</ion-row>",
1055
- styles: [":host{width:100%;margin-bottom:1.2rem}:host ion-radio{margin-right:2.4rem}:host ion-item-divider{font-weight:300;--padding-end: .8rem;font-size:1.2rem;--ion-background-color: linear-gradient(90deg, transparent, var(--ion-color-light))}:host ion-item-divider ion-icon{margin-right:1.6rem;font-size:1.6rem;--color: var(--ion-color-primary)}:host ion-item-divider ion-label{--padding: var(--smart-button-padding-left)/2 var(--smart-button-padding-top)/2 var(--smart-button-padding-right)/2 var(--smart-button-padding-bottom)/2}:host ion-item-divider .squere-button{margin:0;font-size:18px;height:36px;width:36px;padding:0;--padding-start: .2em;--padding-end: .2em}:host ion-item-divider .squere-button ion-icon{margin:0;padding:0}\n"]
1056
- },] }
1057
- ];
1058
-
1059
- var FilterTextComponent = /** @class */ (function (_super) {
1060
- __extends(FilterTextComponent, _super);
1061
- function FilterTextComponent() {
1062
- return _super !== null && _super.apply(this, arguments) || this;
1063
- }
1064
- return FilterTextComponent;
1065
- }(BaseComponent));
1066
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1067
- FilterTextComponent.decorators = [
1068
- { type: i0.Component, args: [{
1069
- selector: 'smart-crud-filter-text',
1070
- template: "<ion-row>\n <ion-col>\n <ion-label position=\"floating\">\n {{ item.label | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"value\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>",
1071
- styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"]
1072
- },] }
1073
- ];
1074
-
1075
- var FilterFlagComponent = /** @class */ (function (_super) {
1076
- __extends(FilterFlagComponent, _super);
1077
- function FilterFlagComponent() {
1078
- return _super !== null && _super.apply(this, arguments) || this;
1079
- }
1080
- return FilterFlagComponent;
1081
- }(BaseComponent));
1082
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1083
- FilterFlagComponent.decorators = [
1084
- { type: i0.Component, args: [{
1085
- selector: 'smart-crud-filter-flag',
1086
- template: "<ion-row>\n <ion-col>\n <div class=\"flag-container\">\n <ion-label position=\"static\">\n {{ item.label | translate }}\n </ion-label>\n <ion-checkbox [(ngModel)]=\"value\" slot=\"end\"></ion-checkbox>\n </div>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>",
1087
- styles: [":host{width:100%}:host .flag-container{width:100%;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;padding:0 1.2rem 0 0}:host .flag-container ion-label{--color: var(--smart-color-dark);vertical-align:middle;padding:1.6rem 0}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"]
1088
- },] }
1089
- ];
1090
-
1091
- var FilterCheckComponent = /** @class */ (function (_super) {
1092
- __extends(FilterCheckComponent, _super);
1093
- function FilterCheckComponent() {
1094
- return _super !== null && _super.apply(this, arguments) || this;
1095
- }
1096
- FilterCheckComponent.prototype.ngAfterContentInit = function () {
1097
- var _this = this;
1098
- this.list$ = rxjs.combineLatest([this.possibilities$, this.facade.filter$]).pipe((operators.map(function (_a) {
1099
- var _b = __read(_a, 1), possibilities = _b[0];
1100
- return possibilities.map(function (pos) { return ({
1101
- value: pos,
1102
- isCheck: _this.value.some(function (r) { return r === pos.id; })
1103
- }); });
1104
- })));
1105
- };
1106
- FilterCheckComponent.prototype.onCheckChange = function (checked, entry) {
1107
- if (checked && !this.value.some(function (r) { return r === entry.value.id; })) {
1108
- this.value = __spreadArray(__spreadArray([], __read(this.value)), [
1109
- entry.value.id
1110
- ]);
1111
- }
1112
- if (!checked && this.value.some(function (r) { return r === entry.value.id; })) {
1113
- this.value = this.value.filter(function (r) { return r !== entry.value.id; });
1114
- }
1115
- };
1116
- return FilterCheckComponent;
1117
- }(BaseComponent));
1118
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1119
- FilterCheckComponent.decorators = [
1120
- { type: i0.Component, args: [{
1121
- selector: 'smart-crud-filter-check',
1122
- template: "<ion-row>\n <ion-col>\n <ion-item-divider>\n <ion-icon slot=\"start\" name=\"filter-outline\"></ion-icon>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-button *ngIf=\"value && value.length\" slot=\"end\" color=\"danger\" (click)=\"refresh([])\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-item-divider>\n <ion-item *ngFor=\"let entry of list$ | async\">\n <ion-label>{{entry.value.text | translate}}</ion-label>\n <ion-checkbox slot=\"end\" [checked]=\"entry.isCheck\" (ionChange)=\"onCheckChange($event.detail.checked, entry)\"></ion-checkbox>\n </ion-item>\n </ion-col>\n <!-- <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col> -->\n</ion-row>",
1123
- styles: [":host{width:100%;margin-bottom:1.2rem}:host ion-radio{margin-right:2.4rem}:host ion-item-divider{font-weight:300;--padding-end: .8rem;font-size:1.2rem;--ion-background-color: linear-gradient(90deg, transparent, var(--ion-color-light))}:host ion-item-divider ion-icon{margin-right:1.6rem;font-size:1.6rem;--color: var(--ion-color-primary)}:host ion-item-divider ion-label{--padding: var(--smart-button-padding-left)/2 var(--smart-button-padding-top)/2 var(--smart-button-padding-right)/2 var(--smart-button-padding-bottom)/2}:host ion-item-divider .squere-button{margin:0;font-size:18px;height:36px;width:36px;padding:0;--padding-start: .2em;--padding-end: .2em}:host ion-item-divider .squere-button ion-icon{margin:0;padding:0}\n"]
1124
- },] }
1125
- ];
1126
-
1127
- var FilterIntComponent = /** @class */ (function (_super) {
1128
- __extends(FilterIntComponent, _super);
1129
- function FilterIntComponent() {
1130
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1131
- _this._subscriptions = new rxjs.Subscription();
1132
- _this.advanced = false;
1133
- return _this;
1134
- }
1135
- Object.defineProperty(FilterIntComponent.prototype, "allowAdvanced", {
1136
- get: function () {
1137
- var _a;
1138
- return ((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) === '=';
1139
- },
1140
- enumerable: false,
1141
- configurable: true
1142
- });
1143
- FilterIntComponent.prototype.ngOnInit = function () {
1144
- _super.prototype.ngOnInit.call(this);
1145
- };
1146
- FilterIntComponent.prototype.ngOnDestroy = function () {
1147
- if (this._subscriptions) {
1148
- this._subscriptions.unsubscribe();
1149
- }
1150
- };
1151
- return FilterIntComponent;
1152
- }(BaseComponent));
1153
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1154
- FilterIntComponent.decorators = [
1155
- { type: i0.Component, args: [{
1156
- selector: 'smart-crud-filter-int',
1157
- template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"value\" type=\"number\" step=\"1\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"advanced = !advanced\" class=\"squere-button\" [disabled]=\"minValue || maxValue\">\n <ion-icon *ngIf=\"!advanced\" slot=\"icon-only\" name=\"settings-outline\"></ion-icon>\n <ion-icon *ngIf=\"advanced\" slot=\"icon-only\" name=\"settings\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value\">\n <ion-button color=\"danger\" (click)=\"refresh(null)\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>\n<ion-row *ngIf=\"(advanced || minValue || maxValue) && allowAdvanced\">\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"minValue\" type=\"number\" step=\"1\"></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"minValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '>=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'to' | translate }}\n </ion-label>\n <ion-input [(ngModel)]=\"maxValue\" type=\"number\" step=\"1\"></ion-input>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"maxValue\">\n <ion-button color=\"danger\" (click)=\"refresh(null, '<=')\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"close-outline\"></ion-icon>\n </ion-button>\n </ion-col>\n</ion-row>",
1158
- styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"]
1159
- },] }
1160
- ];
1161
-
1162
- /**
1163
- * This component is only to use in crud module
1164
- * @requires CrudModule
1165
- * @example
1166
- *
1167
- * html: <smart-crud-filters></smart-crud-filters>
1168
- *
1169
- * use on the model:
1170
- * @Model({
1171
- titleKey: 'body',
1172
- filters: [
1173
- {
1174
- label: 'testNegation',
1175
- key: 'body',
1176
- type: '!=',
1177
- },
1178
- {
1179
- label: 'fromDate',
1180
- key: 'createDate',
1181
- type: '<=',
1182
- fieldType: FieldType.dateWithEdit
1183
- },
1184
- {
1185
- label: 'select',
1186
- key: 'type',
1187
- type: '=',
1188
- fieldType: FieldType.radio,
1189
- possibilities$: of([
1190
- {
1191
- id: 1, text: 'Test 1'
1192
- },
1193
- {
1194
- id: 2, text: 'Test 2'
1195
- }
1196
- ])
1197
- }
1198
- ]
1199
- })
1200
- *
1201
- * use on the field (list.filter property):
1202
- * @Field({
1203
- create: modifyMetdata,
1204
- update: {
1205
- ...modifyMetdata,
1206
- multi: true
1207
- },
1208
- type: FieldType.longText,
1209
- details: true,
1210
- list: {
1211
- order: 2,
1212
- filter: true
1213
- }
1214
- })
1215
- body: string;
1216
- */
1217
- var FiltersComponent = /** @class */ (function () {
1218
- function FiltersComponent(menuService, config, facade, styleService, elementRef) {
1219
- this.menuService = menuService;
1220
- this.config = config;
1221
- this.facade = facade;
1222
- this.styleService = styleService;
1223
- this.elementRef = elementRef;
1224
- }
1225
- FiltersComponent.prototype.onClose = function () {
1226
- return __awaiter(this, void 0, void 0, function () {
1227
- return __generator(this, function (_c) {
1228
- switch (_c.label) {
1229
- case 0: return [4 /*yield*/, this.menuService.closeEnd()];
1230
- case 1:
1231
- _c.sent();
1232
- return [2 /*return*/];
1233
- }
1234
- });
1235
- });
1236
- };
1237
- FiltersComponent.prototype.ngOnInit = function () {
1238
- this.styleService.init(this.elementRef);
1239
- var modelFilters = models.getModelOptions(this.config.type).filters;
1240
- this.list = __spreadArray(__spreadArray([], __read((modelFilters ? modelFilters.map(function (item) {
1241
- if (!item.label) {
1242
- item.label = 'MODEL.' + item.key;
1243
- }
1244
- return item;
1245
- }) : []))), __read(models.getModelFieldsWithOptions(new this.config.type())
1246
- .filter(function (item) { var _a, _b; return (_b = (_a = item.options) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b.filter; })
1247
- .map(function (item) { return ({
1248
- key: item.key,
1249
- type: item.options.type === models.FieldType.text || item.options.type === models.FieldType.longText
1250
- ? '~=' : '=',
1251
- label: 'MODEL.' + item.key,
1252
- fieldType: item.options.type
1253
- }); })));
1254
- this.filter$ = this.facade.filter$;
1255
- };
1256
- return FiltersComponent;
1257
- }());
1258
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1259
- FiltersComponent.decorators = [
1260
- { type: i0.Component, args: [{
1261
- selector: 'smart-crud-filters',
1262
- template: "<ion-header [hidden]=\"hideMenu\">\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"onClose()\">\n <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'filters' | translate }}</ion-title>\n </ion-toolbar>\n</ion-header>\n<div class=\"filter-content\">\n <ng-container *ngIf=\"filter$ | async; let filter\">\n <ng-container *ngFor=\"let item of list\">\n <smart-crud-filter [item]=\"item\" [filter]=\"filter\"></smart-crud-filter>\n </ng-container>\n </ng-container>\n <div class=\"menu-bottom-space\">\n &nbsp;\n </div>\n</div>",
1263
- styles: [":host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}}@media only screen and (max-width: 420px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}ion-modal :host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}}:host ion-toolbar.ios{height:4.6rem;--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}@media only screen and (max-width: 420px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}:host ion-toolbar.ios.toolbar-searchbar ion-buttons{height:var(--smart-button-height);margin:.4rem}:host ion-toolbar ion-menu-button{color:var(--ion-color-light)}:host ion-toolbar ion-buttons.ios{height:var(--smart-button-height);margin:0}:host .filter-content{display:block;overflow:auto;overflow-x:hidden}:host .menu-bottom-space{height:75px}\n"]
1264
- },] }
1265
- ];
1266
- /**
1267
- * @type {function(): !Array<(null|{
1268
- * type: ?,
1269
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1270
- * })>}
1271
- * @nocollapse
1272
- */
1273
- FiltersComponent.ctorParameters = function () { return [
1274
- { type: angular.MenuService },
1275
- { type: CrudConfig },
1276
- { type: CrudFacade },
1277
- { type: angular.StyleService },
1278
- { type: i0.ElementRef }
1279
- ]; };
1280
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
1281
- FiltersComponent.propDecorators = {
1282
- hideMenu: [{ type: i0.Input }]
1283
- };
1284
-
1285
- var FiltersConfigComponent = /** @class */ (function () {
1286
- function FiltersConfigComponent(facade, styleService, elementRef) {
1287
- this.facade = facade;
1288
- this.styleService = styleService;
1289
- this.elementRef = elementRef;
1290
- }
1291
- FiltersConfigComponent.prototype.onRemoveQuery = function (item) {
1292
- var index = this.facade.filter.query.indexOf(item);
1293
- if (index > -1) {
1294
- this.facade.filter.query.splice(index, 1);
1295
- }
1296
- this.facade.read(this.facade.filter);
1297
- };
1298
- FiltersConfigComponent.prototype.ngOnInit = function () {
1299
- this.styleService.init(this.elementRef);
1300
- this.query$ = this.facade.filter$.pipe(operators.map(function (filter) {
1301
- var _a;
1302
- return (_a = filter === null || filter === void 0 ? void 0 : filter.query) === null || _a === void 0 ? void 0 : _a.filter(function (i) { return !i.hidden; });
1303
- }));
1304
- };
1305
- return FiltersConfigComponent;
1306
- }());
1307
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1308
- FiltersConfigComponent.decorators = [
1309
- { type: i0.Component, args: [{
1310
- selector: 'smart-crud-filters-config',
1311
- template: " <ng-container *ngIf=\"query$ | async; let query\">\n <ion-toolbar *ngIf=\"query?.length\">\n <ion-chip *ngFor=\"let item of query\" (click)=\"onRemoveQuery(item)\" color=\"medium\" outline=\"true\">\n <ion-icon name=\"filter-circle-outline\" color=\"primary\"></ion-icon>\n <ion-label>{{ 'MODEL.' + item.key | translate }} {{ item.type }} {{ item.value | translate }}</ion-label>\n <ion-icon name=\"close\" color=\"danger\"></ion-icon>\n </ion-chip>\n </ion-toolbar>\n</ng-container>",
1312
- styles: [":host ion-label{font-size:calc(var(--default-font-size) - 2px)}\n"]
1313
- },] }
1314
- ];
1315
- /**
1316
- * @type {function(): !Array<(null|{
1317
- * type: ?,
1318
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1319
- * })>}
1320
- * @nocollapse
1321
- */
1322
- FiltersConfigComponent.ctorParameters = function () { return [
1323
- { type: CrudFacade },
1324
- { type: angular.StyleService },
1325
- { type: i0.ElementRef }
1326
- ]; };
1327
-
1328
- var MultiselectComponent = /** @class */ (function () {
1329
- function MultiselectComponent(facade, config, menuService) {
1330
- var _this = this;
1331
- this.facade = facade;
1332
- this.config = config;
1333
- this.menuService = menuService;
1334
- this.buttonOptions = {
1335
- click: function () { return __awaiter(_this, void 0, void 0, function () {
1336
- var result;
1337
- var _this = this;
1338
- return __generator(this, function (_b) {
1339
- switch (_b.label) {
1340
- case 0:
1341
- result = this._list.map(function (item) {
1342
- return Object.assign(Object.assign({}, _this._changes), { id: item.id });
1343
- });
1344
- this.facade.updatePartialMany(result);
1345
- return [4 /*yield*/, this.menuService.closeEnd()];
1346
- case 1:
1347
- _b.sent();
1348
- return [2 /*return*/];
1349
- }
1350
- });
1351
- }); },
1352
- confirm: true
1353
- };
1354
- this.list$ = this.facade.multiSelected$.pipe(operators.tap(function (list) {
1355
- _this.lock = true;
1356
- var model = new _this.config.type();
1357
- var fieldsWithOptions = models.getModelFieldsWithOptions(model)
1358
- .filter(function (f) { var _a; return (_a = f.options.update) === null || _a === void 0 ? void 0 : _a.multi; });
1359
- fieldsWithOptions.forEach(function (_b) {
1360
- var key = _b.key;
1361
- var uniques = ___namespace.uniq(list.map(function (i) { return i[key]; }));
1362
- if (uniques.length === 1) {
1363
- model[key] = uniques[0];
1364
- }
1365
- });
1366
- _this.item = model;
1367
- }));
1368
- }
1369
- MultiselectComponent.prototype.onClose = function () {
1370
- return __awaiter(this, void 0, void 0, function () {
1371
- return __generator(this, function (_b) {
1372
- switch (_b.label) {
1373
- case 0: return [4 /*yield*/, this.menuService.closeEnd()];
1374
- case 1:
1375
- _b.sent();
1376
- return [2 /*return*/];
1377
- }
1378
- });
1379
- });
1380
- };
1381
- MultiselectComponent.prototype.onPartialChange = function (changes, list) {
1382
- this.lock = false;
1383
- this._list = list;
1384
- this._changes = changes;
1385
- };
1386
- MultiselectComponent.prototype.onValidChange = function (valid) {
1387
- this.valid = valid;
1388
- };
1389
- MultiselectComponent.prototype.ngOnInit = function () {
1390
- };
1391
- return MultiselectComponent;
1392
- }());
1393
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1394
- MultiselectComponent.decorators = [
1395
- { type: i0.Component, args: [{
1396
- selector: 'smart-crud-multiselect',
1397
- template: "<ng-container *ngIf=\"list$ | async; let list\">\n <ion-header>\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"onClose()\">\n <ion-icon slot=\"icon-only\" name=\"close\"> </ion-icon>\n </ion-button>\n </ion-buttons>\n <ion-title>{{ 'selected' | translate }}: {{ list?.length }}</ion-title>\n </ion-toolbar>\n </ion-header>\n\n <div *ngIf=\"item\">\n <smart-form [options]=\"item | smartFormOptions : 'multiUpdate' : config.type\" (valuePartialChange)=\"onPartialChange($event, list)\" (validChange)=\"onValidChange($event)\"></smart-form>\n\n <smart-button style=\"float: right\" [disabled]=\"lock || !valid\" [options]=\"buttonOptions\">{{ 'change' | translate }}</smart-button>\n </div>\n</ng-container>",
1398
- styles: [":host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}}:host ion-toolbar.ios{height:4.6rem;--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}@media only screen and (max-width: 420px){:host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-primary), var(--ion-color-tertiary));--color: var(--ion-color-light)}:host ion-toolbar.ios ion-title{text-align:left;padding-left:5.2rem}:host ion-toolbar.ios ion-icon{color:var(--ion-color-light)}}.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));--color: var(--ion-color-dark)}@media only screen and (max-width: 992px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}@media only screen and (max-width: 420px){.modal-wrapper :host ion-toolbar.ios{--background: linear-gradient(33deg, var(--ion-color-light), var(--ion-color-light-shade));color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-title{text-align:left;padding-left:1.2rem}.modal-wrapper :host ion-toolbar.ios ion-icon{color:var(--ion-color-dark)}.modal-wrapper :host ion-toolbar.ios ion-buttons{margin:0}}:host ion-toolbar ion-menu-button{color:var(--ion-color-light)}:host ion-toolbar ion-buttons.ios{height:var(--smart-button-height);margin:0}\n"]
1399
- },] }
1400
- ];
1401
- /**
1402
- * @type {function(): !Array<(null|{
1403
- * type: ?,
1404
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1405
- * })>}
1406
- * @nocollapse
1407
- */
1408
- MultiselectComponent.ctorParameters = function () { return [
1409
- { type: CrudFacade },
1410
- { type: CrudConfig },
1411
- { type: angular.MenuService }
1412
- ]; };
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
-
1469
- var GroupComponent = /** @class */ (function (_super) {
1470
- __extends(GroupComponent, _super);
1471
- function GroupComponent(styleService, elementRef, facade, cd, groupService) {
1472
- var _this = _super.call(this) || this;
1473
- _this.styleService = styleService;
1474
- _this.elementRef = elementRef;
1475
- _this.facade = facade;
1476
- _this.cd = cd;
1477
- _this.groupService = groupService;
1478
- return _this;
1479
- }
1480
- GroupComponent.prototype.change = function (val, item, force) {
1481
- var _this = this;
1482
- if (force === void 0) { force = false; }
1483
- this.groups.filter(function (i) { return i.value !== item.value || i.key !== item.key; }).forEach(function (i) {
1484
- i.show = false;
1485
- });
1486
- this.groupService.change(val, item, this.groups, force);
1487
- if (val) {
1488
- setTimeout(function () {
1489
- item.show = val;
1490
- _this.cd.detectChanges();
1491
- });
1492
- }
1493
- else {
1494
- item.show = val;
1495
- this.cd.detectChanges();
1496
- }
1497
- };
1498
- GroupComponent.prototype.ngOnInit = function () {
1499
- this.styleService.init(this.elementRef);
1500
- };
1501
- GroupComponent.prototype.ngOnDestroy = function () {
1502
- this.groupService.destroy(this.groups);
1503
- _super.prototype.ngOnDestroy.call(this);
1504
- };
1505
- return GroupComponent;
1506
- }(angular.BaseComponent));
1507
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1508
- GroupComponent.decorators = [
1509
- { type: i0.Component, args: [{
1510
- selector: 'smart-crud-group',
1511
- template: "<smart-accordion *ngFor=\"let item of groups\" [(show)]=\"item.show\" (showChange)=\"change($event, item)\">\n <smart-accordion-header [ngClass]=\"{ 'accordion-show': item.show }\">{{ item.text | translate }}</smart-accordion-header>\n <smart-accordion-body>\n <smart-list *ngIf=\"item.show && !item.children && listOptions\" [options]=\"listOptions\"></smart-list>\n <div *ngIf=\"item.children\" style=\"margin-left: 50px\">\n <smart-crud-group [groups]=\"item.children\" [listOptions]=\"listOptions\"></smart-crud-group>\n </div>\n </smart-accordion-body>\n</smart-accordion>\n<br/><br/><br/>",
1512
- styles: [".accordion-show{font-weight:bolder}\n"]
1513
- },] }
1514
- ];
1515
- /**
1516
- * @type {function(): !Array<(null|{
1517
- * type: ?,
1518
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1519
- * })>}
1520
- * @nocollapse
1521
- */
1522
- GroupComponent.ctorParameters = function () { return [
1523
- { type: angular.StyleService },
1524
- { type: i0.ElementRef },
1525
- { type: CrudFacade },
1526
- { type: i0.ChangeDetectorRef },
1527
- { type: CrudListGroupService }
1528
- ]; };
1529
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
1530
- GroupComponent.propDecorators = {
1531
- groups: [{ type: i0.Input }],
1532
- listOptions: [{ type: i0.Input }]
1533
- };
1534
-
1535
- var SocketService = /** @class */ (function () {
1536
- function SocketService() {
1537
- }
1538
- return SocketService;
1539
- }());
1540
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1541
- SocketService.decorators = [
1542
- { type: i0.Injectable }
1543
- ];
1544
- var NotSocketService = /** @class */ (function () {
1545
- function NotSocketService() {
1546
- }
1547
- return NotSocketService;
1548
- }());
1549
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1550
- NotSocketService.decorators = [
1551
- { type: i0.Injectable }
1552
- ];
1553
-
1554
- var FormOptionsPipe = /** @class */ (function () {
1555
- function FormOptionsPipe(modelPossibilitiesProvider) {
1556
- this.modelPossibilitiesProvider = modelPossibilitiesProvider;
1557
- }
1558
- FormOptionsPipe.prototype.transform = function (item, mode, type, uniqueProvider, inputComponents) {
1559
- if (!mode || !type)
1560
- return null;
1561
- var possibilities = {};
1562
- if (type && this.modelPossibilitiesProvider) {
1563
- possibilities = this.modelPossibilitiesProvider.get(type);
1564
- }
1565
- if (mode === "create") {
1566
- return {
1567
- mode: "create",
1568
- possibilities: possibilities,
1569
- inputComponents: inputComponents,
1570
- uniqueProvider: uniqueProvider,
1571
- model: new type(),
1572
- };
1573
- }
1574
- else {
1575
- var model_1 = new type();
1576
- if (item) {
1577
- Object.keys(item).forEach(function (key) {
1578
- model_1[key] = item[key];
1579
- });
1580
- }
1581
- return {
1582
- mode: mode,
1583
- uniqueProvider: uniqueProvider,
1584
- possibilities: possibilities,
1585
- inputComponents: inputComponents,
1586
- model: model_1,
1587
- };
1588
- }
1589
- };
1590
- return FormOptionsPipe;
1591
- }());
1592
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1593
- FormOptionsPipe.decorators = [
1594
- { type: i0.Pipe, args: [{
1595
- name: "smartFormOptions",
1596
- },] }
1597
- ];
1598
- /**
1599
- * @type {function(): !Array<(null|{
1600
- * type: ?,
1601
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1602
- * })>}
1603
- * @nocollapse
1604
- */
1605
- FormOptionsPipe.ctorParameters = function () { return [
1606
- { type: ICrudModelPossibilitiesProvider, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [CRUD_MODEL_POSSIBILITIES_PROVIDER,] }] }
1607
- ]; };
1608
-
1609
- var CrudPipesModule = /** @class */ (function () {
1610
- function CrudPipesModule() {
1611
- }
1612
- return CrudPipesModule;
1613
- }());
1614
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1615
- CrudPipesModule.decorators = [
1616
- { type: i0.NgModule, args: [{
1617
- declarations: [
1618
- FormOptionsPipe
1619
- ],
1620
- exports: [
1621
- FormOptionsPipe
1622
- ]
1623
- },] }
1624
- ];
1625
-
1626
- var CrudService = /** @class */ (function () {
1627
- function CrudService(config, http, socket) {
1628
- this.config = config;
1629
- this.http = http;
1630
- this.socket = socket;
1631
- this._formatMap = {
1632
- csv: "text/csv",
1633
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1634
- };
1635
- }
1636
- // changes(criteria: { id?: string } = {}): Observable<ItemChangedData> {
1637
- // this.socket.emit("changes", criteria);
1638
- // return this.socket.fromEvent("changes");
1639
- // }
1640
- // TODO : Location is null
1641
- CrudService.prototype.create = function (item) {
1642
- return this.http
1643
- .post(this.config.apiUrl, item, { observe: "response" })
1644
- .pipe(operators.map(function (response) {
1645
- var location = response.headers["Location"];
1646
- if (!location)
1647
- return null;
1648
- var array = location.split("/");
1649
- return array[array.length - 1];
1650
- }));
1651
- };
1652
- CrudService.prototype.createMany = function (items, options) {
1653
- return this.http.post(this.config.apiUrl + "/bulk?mode=" + options.mode, items);
1654
- };
1655
- CrudService.prototype.getById = function (id) {
1656
- return this.http.get(this.config.apiUrl + "/" + id);
1657
- };
1658
- CrudService.prototype.getList = function (filter) {
1659
- if (filter === void 0) { filter = null; }
1660
- return this.http.get(this.config.apiUrl + this.getQuery(filter));
1661
- };
1662
- CrudService.prototype.exportList = function (filter, format) {
1663
- if (filter === void 0) { filter = null; }
1664
- if (!format) {
1665
- format = "csv";
1666
- }
1667
- if (format === "xlsx") {
1668
- return this.http
1669
- .get(this.config.apiUrl + this.getQuery(filter), {
1670
- headers: {
1671
- "Content-Type": this._formatMap[format],
1672
- },
1673
- observe: "response",
1674
- reportProgress: false,
1675
- responseType: "blob",
1676
- })
1677
- .pipe(operators.map(function (res) {
1678
- var downloadLink = document.createElement("a");
1679
- var blob = res.body;
1680
- var url = URL.createObjectURL(blob);
1681
- downloadLink.href = url;
1682
- downloadLink.download = "data." + format;
1683
- document.body.appendChild(downloadLink);
1684
- downloadLink.click();
1685
- document.body.removeChild(downloadLink);
1686
- }));
1687
- }
1688
- return this.http
1689
- .get(this.config.apiUrl + this.getQuery(filter), {
1690
- headers: {
1691
- "Content-Type": this._formatMap[format],
1692
- },
1693
- responseType: "text",
1694
- })
1695
- .pipe(operators.map(function (res) {
1696
- var downloadLink = document.createElement("a");
1697
- var blob = new Blob(["\ufeff", res]);
1698
- var url = URL.createObjectURL(blob);
1699
- downloadLink.href = url;
1700
- downloadLink.download = "data." + format;
1701
- document.body.appendChild(downloadLink);
1702
- downloadLink.click();
1703
- document.body.removeChild(downloadLink);
1704
- }));
1705
- };
1706
- CrudService.prototype.update = function (item) {
1707
- return this.http.put(this.config.apiUrl + "/" + item.id, item);
1708
- };
1709
- CrudService.prototype.updatePartial = function (item) {
1710
- return this.http.patch(this.config.apiUrl + "/" + item.id, item);
1711
- };
1712
- CrudService.prototype.updatePartialMany = function (items) {
1713
- var _this = this;
1714
- return rxjs.forkJoin(items.map(function (item) {
1715
- return _this.updatePartial(item);
1716
- }));
1717
- };
1718
- CrudService.prototype.delete = function (id) {
1719
- return this.http.delete(this.config.apiUrl + "/" + id);
1720
- };
1721
- CrudService.prototype.getQuery = function (filter) {
1722
- var query = "";
1723
- if (filter && filter.searchText) {
1724
- query += "&$search=" + filter.searchText;
1725
- }
1726
- if (filter && filter.limit) {
1727
- query += "&limit=" + filter.limit + "&offset=" + (filter.offset ? filter.offset : 0);
1728
- }
1729
- if (filter && filter.sortBy) {
1730
- query += "&sort=" + ((filter.sortDesc ? "-" : "") + filter.sortBy);
1731
- }
1732
- if (filter && filter.query) {
1733
- filter.query.forEach(function (q) {
1734
- if (q.value
1735
- && (typeof q.value === 'string')
1736
- && q.value.match(/^-?\d+$/)
1737
- && q.value[0] !== "'"
1738
- && q.value[0] !== '"') {
1739
- query += "&" + q.key + q.type + ("'" + q.value + "'");
1740
- }
1741
- else {
1742
- query += "&" + q.key + q.type + q.value;
1743
- }
1744
- });
1745
- }
1746
- return query ? "?" + query.replace("&", "") : "";
1747
- };
1748
- return CrudService;
1749
- }());
1750
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1751
- CrudService.decorators = [
1752
- { type: i0.Injectable }
1753
- ];
1754
- /**
1755
- * @type {function(): !Array<(null|{
1756
- * type: ?,
1757
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1758
- * })>}
1759
- * @nocollapse
1760
- */
1761
- CrudService.ctorParameters = function () { return [
1762
- { type: CrudConfig },
1763
- { type: http.HttpClient },
1764
- { type: SocketService, decorators: [{ type: i0.Optional }] }
1765
- ]; };
1766
-
1767
- var CrudEffects = /** @class */ (function () {
1768
- function CrudEffects(actions$, service, config, store, state) {
1769
- this.actions$ = actions$;
1770
- this.service = service;
1771
- this.config = config;
1772
- this.store = store;
1773
- this.state = state;
1774
- }
1775
- CrudEffects.prototype.init = function () {
1776
- var _this = this;
1777
- var metadata = Reflect.getMetadata(this.config.entity, CrudEffects);
1778
- if (metadata)
1779
- return;
1780
- Reflect.defineMetadata(this.config.entity, true, CrudEffects);
1781
- this.actions$.subscribe(function (action) {
1782
- switch (action.type) {
1783
- case "[" + _this.config.entity + "] Create":
1784
- _this.service
1785
- .create(action.item)
1786
- .pipe(operators.tap(function () { return _this.store.dispatch(createSuccess(_this.config.entity, action.item)); }), operators.catchError(function (error) {
1787
- _this.store.dispatch(createFailure(_this.config.entity, action.item, error));
1788
- return rxjs.of();
1789
- }))
1790
- .subscribe();
1791
- break;
1792
- case "[" + _this.config.entity + "] Create Success":
1793
- var createState = _this.state.getValue()[_this.config.entity];
1794
- _this.store.dispatch(read(_this.config.entity, createState.filter ? Object.assign(Object.assign({}, createState.filter), { offset: 0 }) : null));
1795
- break;
1796
- case "[" + _this.config.entity + "] Create Many":
1797
- _this.service
1798
- .createMany(action.data.items, action.data.options)
1799
- .pipe(operators.tap(function () { return _this.store.dispatch(createManySuccess(_this.config.entity, {
1800
- items: action.data.items,
1801
- options: action.data.options,
1802
- })); }), operators.catchError(function (error) {
1803
- _this.store.dispatch(createManyFailure(_this.config.entity, {
1804
- items: action.data.items,
1805
- options: action.data.options,
1806
- }, error));
1807
- return rxjs.of();
1808
- }))
1809
- .subscribe();
1810
- break;
1811
- case "[" + _this.config.entity + "] Create Many Success":
1812
- var createManyState = _this.state.getValue()[_this.config.entity];
1813
- _this.store.dispatch(read(_this.config.entity, createManyState.filter
1814
- ? Object.assign(Object.assign({}, createManyState.filter), { offset: 0 }) : null));
1815
- break;
1816
- case "[" + _this.config.entity + "] Read":
1817
- _this.service
1818
- .getList(action.filter)
1819
- .pipe(operators.tap(function (result) { return _this.store.dispatch(readSuccess(_this.config.entity, action.filter, result)); }), operators.catchError(function (error) {
1820
- _this.store.dispatch(readFailure(_this.config.entity, action.filter, error));
1821
- return rxjs.of();
1822
- }))
1823
- .subscribe();
1824
- break;
1825
- case "[" + _this.config.entity + "] Export":
1826
- _this.service
1827
- .exportList(action.filter, action.format)
1828
- .pipe(operators.tap(function (result) { return _this.store.dispatch(exportListSuccess(_this.config.entity, action.filter)); }), operators.catchError(function (error) {
1829
- _this.store.dispatch(exportListFailure(_this.config.entity, action.filter, error));
1830
- return rxjs.of();
1831
- }))
1832
- .subscribe();
1833
- break;
1834
- case "[" + _this.config.entity + "] Select":
1835
- _this.service
1836
- .getById(action.id)
1837
- .pipe(operators.tap(function (result) { return _this.store.dispatch(selectSuccess(_this.config.entity, action.id, result)); }), operators.catchError(function (error) {
1838
- _this.store.dispatch(selectFailure(_this.config.entity, action.id, error));
1839
- return rxjs.of();
1840
- }))
1841
- .subscribe();
1842
- break;
1843
- case "[" + _this.config.entity + "] Update":
1844
- _this.service
1845
- .updatePartial(action.item)
1846
- .pipe(operators.tap(function () { return _this.store.dispatch(updateSuccess(_this.config.entity, action.item)); }), operators.catchError(function (error) {
1847
- _this.store.dispatch(updateFailure(_this.config.entity, action.item, error));
1848
- _this.store.dispatch(read(_this.config.entity));
1849
- return rxjs.of();
1850
- }))
1851
- .subscribe();
1852
- break;
1853
- case "[" + _this.config.entity + "] Update Success":
1854
- _this.store
1855
- .pipe(store.select(getCrudFilter(_this.config.entity)), operators.first())
1856
- .subscribe(function (filter) {
1857
- _this.store.dispatch(read(_this.config.entity, Object.assign(Object.assign({}, filter), { offset: 0 })));
1858
- _this.store.dispatch(select(_this.config.entity, action.item.id));
1859
- });
1860
- break;
1861
- case "[" + _this.config.entity + "] Update partial":
1862
- _this.service
1863
- .updatePartial(action.item)
1864
- .pipe(operators.tap(function () { return _this.store.dispatch(updatePartialSuccess(_this.config.entity, action.item)); }), operators.catchError(function (error) {
1865
- _this.store.dispatch(updatePartialFailure(_this.config.entity, action.item, error));
1866
- _this.store.dispatch(read(_this.config.entity));
1867
- return rxjs.of();
1868
- }))
1869
- .subscribe();
1870
- break;
1871
- case "[" + _this.config.entity + "] Update partial Success":
1872
- _this.store
1873
- .pipe(store.select(getCrudFilter(_this.config.entity)), operators.first())
1874
- .subscribe(function (filter) {
1875
- _this.store.dispatch(read(_this.config.entity, Object.assign(Object.assign({}, filter), { offset: 0 })));
1876
- _this.store.dispatch(select(_this.config.entity, action.item.id));
1877
- });
1878
- break;
1879
- case "[" + _this.config.entity + "] Update partial many":
1880
- _this.service
1881
- .updatePartialMany(action.items)
1882
- .pipe(operators.tap(function () { return _this.store.dispatch(updatePartialManySuccess(_this.config.entity, action.items)); }), operators.catchError(function (error) {
1883
- _this.store.dispatch(updatePartialManyFailure(_this.config.entity, action.items, error));
1884
- _this.store.dispatch(read(_this.config.entity));
1885
- return rxjs.of();
1886
- }))
1887
- .subscribe();
1888
- break;
1889
- case "[" + _this.config.entity + "] Update partial many Success":
1890
- _this.store
1891
- .pipe(store.select(getCrudFilter(_this.config.entity)), operators.first())
1892
- .subscribe(function (filter) {
1893
- _this.store.dispatch(read(_this.config.entity, Object.assign(Object.assign({}, filter), { offset: 0 })));
1894
- });
1895
- break;
1896
- case "[" + _this.config.entity + "] Delete":
1897
- _this.service
1898
- .delete(action.id)
1899
- .pipe(operators.tap(function () { return _this.store.dispatch(deleteSuccess(_this.config.entity, action.id)); }), operators.catchError(function (error) {
1900
- _this.store.dispatch(deleteFailure(_this.config.entity, action.id, error));
1901
- return rxjs.of();
1902
- }))
1903
- .subscribe();
1904
- break;
1905
- case "[" + _this.config.entity + "] Delete Success":
1906
- _this.store
1907
- .pipe(store.select(getCrudFilter(_this.config.entity)), operators.first())
1908
- .subscribe(function (filter) {
1909
- _this.store.dispatch(read(_this.config.entity, Object.assign(Object.assign({}, filter), { offset: 0 })));
1910
- });
1911
- break;
1912
- default:
1913
- break;
1914
- }
1915
- });
1916
- };
1917
- return CrudEffects;
1918
- }());
1919
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1920
- CrudEffects.decorators = [
1921
- { type: i0.Injectable }
1922
- ];
1923
- /**
1924
- * @type {function(): !Array<(null|{
1925
- * type: ?,
1926
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1927
- * })>}
1928
- * @nocollapse
1929
- */
1930
- CrudEffects.ctorParameters = function () { return [
1931
- { type: store.ActionsSubject },
1932
- { type: CrudService },
1933
- { type: CrudConfig },
1934
- { type: store.Store },
1935
- { type: store.State }
1936
- ]; };
1937
-
1938
- var CrudListPaginationFactory = /** @class */ (function () {
1939
- function CrudListPaginationFactory(facade) {
1940
- this.facade = facade;
1941
- }
1942
- CrudListPaginationFactory.prototype.create = function (options) {
1943
- return __awaiter(this, void 0, void 0, function () {
1944
- var _this = this;
1945
- return __generator(this, function (_a) {
1946
- return [2 /*return*/, {
1947
- mode: options.mode,
1948
- limit: options.limit,
1949
- loadNextPage: function () {
1950
- if (!options.provider.getLinks() || !options.provider.getLinks().next)
1951
- return Promise.resolve(false);
1952
- return new Promise(function (res) {
1953
- var sub = _this.facade.loaded$.subscribe(function (l) {
1954
- if (l) {
1955
- // if (sub && !sub.closed) sub.unsubscribe();
1956
- setTimeout(function () {
1957
- res(options.provider.getLinks() &&
1958
- options.provider.getLinks().next);
1959
- });
1960
- }
1961
- });
1962
- _this.facade.read(Object.assign(Object.assign({}, options.provider.getFilter()), { offset: options.provider.getFilter().offset +
1963
- options.provider.getFilter().limit }));
1964
- });
1965
- },
1966
- loadPrevPage: function () {
1967
- if (!options.provider.getLinks() || !options.provider.getLinks().prev)
1968
- return Promise.resolve(false);
1969
- return new Promise(function (res) {
1970
- var sub = _this.facade.loaded$.subscribe(function (l) {
1971
- if (l) {
1972
- // if (sub && !sub.closed) sub.unsubscribe();
1973
- setTimeout(function () {
1974
- res(options.provider.getLinks() &&
1975
- options.provider.getLinks().prev);
1976
- });
1977
- }
1978
- });
1979
- _this.facade.read(Object.assign(Object.assign({}, options.provider.getFilter()), { offset: options.provider.getFilter().offset -
1980
- options.provider.getFilter().limit }));
1981
- });
1982
- },
1983
- page$: this.facade.filter$.pipe(operators.map(function (f) {
1984
- return (f === null || f === void 0 ? void 0 : f.limit) ? f.offset / f.limit + 1 : 0;
1985
- })),
1986
- totalPages$: rxjs.combineLatest(this.facade.filter$, this.facade.totalCount$).pipe(operators.map(function (_a) {
1987
- var _b = __read(_a, 2), filter = _b[0], totalCount = _b[1];
1988
- return (filter === null || filter === void 0 ? void 0 : filter.limit) ? Math.ceil(totalCount / filter.limit) : 0;
1989
- })),
1990
- }];
1991
- });
1992
- });
1993
- };
1994
- return CrudListPaginationFactory;
1995
- }());
1996
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1997
- CrudListPaginationFactory.decorators = [
1998
- { type: i0.Injectable }
1999
- ];
2000
- /**
2001
- * @type {function(): !Array<(null|{
2002
- * type: ?,
2003
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
2004
- * })>}
2005
- * @nocollapse
2006
- */
2007
- CrudListPaginationFactory.ctorParameters = function () { return [
2008
- { type: CrudFacade }
2009
- ]; };
2010
-
2011
- var COMPONENTS = [
2012
- ExportComponent,
2013
- FilterComponent,
2014
- FilterTextComponent,
2015
- FiltersConfigComponent,
2016
- FilterDateComponent,
2017
- FilterDateWithEditComponent,
2018
- FilterRadioComponent,
2019
- FiltersComponent,
2020
- FilterFlagComponent,
2021
- FilterCheckComponent,
2022
- FilterIntComponent,
2023
- MultiselectComponent,
2024
- GroupComponent
2025
- ];
2026
- var CrudComponentsModule = /** @class */ (function () {
2027
- function CrudComponentsModule() {
2028
- }
2029
- return CrudComponentsModule;
2030
- }());
2031
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2032
- CrudComponentsModule.decorators = [
2033
- { type: i0.NgModule, args: [{
2034
- declarations: __spreadArray([], __read(COMPONENTS)),
2035
- imports: [
2036
- //AuthSharedModule,
2037
- store.StoreModule,
2038
- angular.SharedModule,
2039
- CrudPipesModule,
2040
- forms.FormsModule,
2041
- common.CommonModule
2042
- ],
2043
- exports: __spreadArray([
2044
- CrudPipesModule
2045
- ], __read(COMPONENTS)),
2046
- entryComponents: __spreadArray([], __read(COMPONENTS)),
2047
- providers: [
2048
- CrudService,
2049
- CrudEffects,
2050
- CrudFacade,
2051
- SocketService,
2052
- CrudListPaginationFactory,
2053
- ]
2054
- },] }
2055
- ];
2056
-
2057
- var initialState = {
2058
- loaded: false
2059
- };
2060
- var crudReducer = function (state, action, entity) {
2061
- if (state === void 0) { state = initialState; }
2062
- switch (action.type) {
2063
- case "[" + entity + "] Create":
2064
- return Object.assign(Object.assign({}, state), { loaded: false, error: null });
2065
- case "[" + entity + "] Create Success":
2066
- return Object.assign(Object.assign({}, state), { loaded: true, error: null });
2067
- case "[" + entity + "] Create Failure":
2068
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2069
- case "[" + entity + "] Create Many":
2070
- return Object.assign(Object.assign({}, state), { loaded: false, error: null });
2071
- case "[" + entity + "] Create Many Success":
2072
- return Object.assign(Object.assign({}, state), { loaded: true, error: null });
2073
- case "[" + entity + "] Create Many Failure":
2074
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2075
- case "[" + entity + "] Export":
2076
- return Object.assign(Object.assign({}, state), { loaded: false });
2077
- case "[" + entity + "] Export Success":
2078
- return Object.assign(Object.assign({}, state), { loaded: true });
2079
- case "[" + entity + "] Export Failure":
2080
- return Object.assign(Object.assign({}, state), { loaded: true });
2081
- case "[" + entity + "] Read":
2082
- return Object.assign(Object.assign({}, state), { loaded: false, filter: action.filter, error: null, totalCount: null, links: null });
2083
- case "[" + entity + "] Read Success":
2084
- var list_1 = [];
2085
- if (action.filter
2086
- && action.filter.offset
2087
- && state.list
2088
- && action.filter.paginationMode !== angular.PaginationMode.singlePage) {
2089
- state.list.forEach(function (i) {
2090
- list_1.push(i);
2091
- });
2092
- list_1 = __spreadArray(__spreadArray([], __read(list_1)), __read(action.result.data));
2093
- }
2094
- else {
2095
- list_1 = action.result.data;
2096
- }
2097
- return Object.assign(Object.assign({}, state), { loaded: true, list: list_1, totalCount: action.result.totalCount, links: action.result.links, error: null });
2098
- case "[" + entity + "] Read Failure":
2099
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2100
- case "[" + entity + "] Select":
2101
- return Object.assign(Object.assign({}, state), { loaded: false, selected: null, error: null });
2102
- case "[" + entity + "] Select Success":
2103
- return Object.assign(Object.assign({}, state), { loaded: true, selected: action.item, error: null });
2104
- case "[" + entity + "] Select Failure":
2105
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2106
- case "[" + entity + "] MultiSelect":
2107
- return Object.assign(Object.assign({}, state), { multiSelected: __spreadArray([], __read(action.items)) });
2108
- case "[" + entity + "] Unselect":
2109
- return Object.assign(Object.assign({}, state), { loaded: true, selected: null, error: null });
2110
- case "[" + entity + "] Update":
2111
- return Object.assign(Object.assign({}, state), { loaded: false, error: null });
2112
- case "[" + entity + "] Update Success":
2113
- return Object.assign(Object.assign({}, state), { loaded: true, error: null });
2114
- case "[" + entity + "] Update Failure":
2115
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2116
- case "[" + entity + "] Update partial":
2117
- return Object.assign(Object.assign({}, state), { loaded: false, error: null });
2118
- case "[" + entity + "] Update partial Success":
2119
- return Object.assign(Object.assign({}, state), { loaded: true, error: null });
2120
- case "[" + entity + "] Update partial Failure":
2121
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2122
- case "[" + entity + "] Update partial many":
2123
- return Object.assign(Object.assign({}, state), { loaded: false, error: null });
2124
- case "[" + entity + "] Update partial many Success":
2125
- return Object.assign(Object.assign({}, state), { multiSelected: [], loaded: true, error: null });
2126
- case "[" + entity + "] Update partial many Failure":
2127
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2128
- case "[" + entity + "] Delete":
2129
- return Object.assign(Object.assign({}, state), { loaded: false, error: null });
2130
- case "[" + entity + "] Delete Success":
2131
- return Object.assign(Object.assign({}, state), { loaded: true, error: null });
2132
- case "[" + entity + "] Delete Failure":
2133
- return Object.assign(Object.assign({}, state), { loaded: true, error: action.error });
2134
- default:
2135
- return state;
2136
- }
2137
- };
2138
- var ɵ0 = crudReducer;
2139
- function getReducer(entity) {
2140
- return function (state, action) {
2141
- return crudReducer(state, action, entity);
2142
- };
2143
- }
2144
-
2145
- var PageService = /** @class */ (function () {
2146
- function PageService(authService, config) {
2147
- this.authService = authService;
2148
- this.config = config;
2149
- }
2150
- PageService.prototype.checkPermissions = function () {
2151
- var val = this.config;
2152
- var modelOptions = models.getModelOptions(val.type);
2153
- if (val.add &&
2154
- modelOptions.create &&
2155
- modelOptions.create.permissions &&
2156
- !this.authService.expectPermissions(modelOptions.create.permissions)) {
2157
- val.add = false;
2158
- }
2159
- if (val.edit &&
2160
- modelOptions.update &&
2161
- modelOptions.update.permissions &&
2162
- !this.authService.expectPermissions(modelOptions.update.permissions)) {
2163
- val.edit = false;
2164
- }
2165
- if (val.remove &&
2166
- modelOptions.remove &&
2167
- modelOptions.remove.permissions &&
2168
- !this.authService.expectPermissions(modelOptions.remove.permissions)) {
2169
- val.remove = false;
2170
- }
2171
- };
2172
- return PageService;
2173
- }());
2174
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2175
- PageService.decorators = [
2176
- { type: i0.Injectable }
2177
- ];
2178
- /**
2179
- * @type {function(): !Array<(null|{
2180
- * type: ?,
2181
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
2182
- * })>}
2183
- * @nocollapse
2184
- */
2185
- PageService.ctorParameters = function () { return [
2186
- { type: angular.AuthService },
2187
- { type: CrudFullConfig }
2188
- ]; };
2189
-
2190
- var CrudSearchService = /** @class */ (function () {
2191
- function CrudSearchService() {
2192
- this._filterSource = new rxjs.BehaviorSubject(null);
2193
- this._enabledSource = new rxjs.BehaviorSubject(false);
2194
- this.enabled$ = this._enabledSource.asObservable();
2195
- this.filter$ = rxjs.combineLatest([
2196
- this._filterSource.asObservable(), this.enabled$
2197
- ]).pipe(operators.map(function (_a) {
2198
- var _b = __read(_a, 2), filter = _b[0], enabled = _b[1];
2199
- if (!enabled)
2200
- return {};
2201
- return filter;
2202
- }));
2203
- }
2204
- Object.defineProperty(CrudSearchService.prototype, "filter", {
2205
- get: function () {
2206
- if (!this._enabledSource.value)
2207
- return {};
2208
- return this._filterSource.value;
2209
- },
2210
- enumerable: false,
2211
- configurable: true
2212
- });
2213
- Object.defineProperty(CrudSearchService.prototype, "enabled", {
2214
- get: function () {
2215
- return this._enabledSource.value;
2216
- },
2217
- enumerable: false,
2218
- configurable: true
2219
- });
2220
- CrudSearchService.prototype.setFilter = function (val) {
2221
- this._filterSource.next(val);
2222
- };
2223
- CrudSearchService.prototype.setEnabled = function (val) {
2224
- this._enabledSource.next(val);
2225
- };
2226
- return CrudSearchService;
2227
- }());
2228
- /** @nocollapse */ CrudSearchService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CrudSearchService_Factory() { return new CrudSearchService(); }, token: CrudSearchService, providedIn: "root" });
2229
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2230
- CrudSearchService.decorators = [
2231
- { type: i0.Injectable, args: [{
2232
- providedIn: 'root'
2233
- },] }
2234
- ];
2235
-
2236
- var ListComponent = /** @class */ (function (_super) {
2237
- __extends(ListComponent, _super);
2238
- function ListComponent(facade, router, dynamicComponentLoader, injector, cd, menuService, hardwareService, paginationFacade, styleService, elementRef, pageService, config, searchService, moduleRef, componentFactoryResolver) {
2239
- var _this = _super.call(this, cd, moduleRef, componentFactoryResolver) || this;
2240
- _this.facade = facade;
2241
- _this.router = router;
2242
- _this.dynamicComponentLoader = dynamicComponentLoader;
2243
- _this.injector = injector;
2244
- _this.cd = cd;
2245
- _this.menuService = menuService;
2246
- _this.hardwareService = hardwareService;
2247
- _this.paginationFacade = paginationFacade;
2248
- _this.styleService = styleService;
2249
- _this.elementRef = elementRef;
2250
- _this.pageService = pageService;
2251
- _this.config = config;
2252
- _this.searchService = searchService;
2253
- _this.moduleRef = moduleRef;
2254
- _this.componentFactoryResolver = componentFactoryResolver;
2255
- _this.filter$ = _this.facade.filter$.pipe(operators.tap(function (filter) {
2256
- _this.filter = filter;
2257
- }));
2258
- _this.dynamicContents = new i0.QueryList();
2259
- _this.facade.links$.pipe(_this.takeUntilDestroy).subscribe(function (links) {
2260
- _this.links = links;
2261
- });
2262
- return _this;
2263
- }
2264
- ListComponent.prototype.refreshProperties = function () {
2265
- this.baseInstance.listOptions = this.listOptions;
2266
- };
2267
- ListComponent.prototype.ngOnInit = function () {
2268
- var _a, _b, _c, _d, _e, _f, _g;
2269
- return __awaiter(this, void 0, void 0, function () {
2270
- var newFilter, endButtons, compiledComponents, _h, _j;
2271
- var _this = this;
2272
- return __generator(this, function (_k) {
2273
- switch (_k.label) {
2274
- case 0: return [4 /*yield*/, this.pageService.checkPermissions()];
2275
- case 1:
2276
- _k.sent();
2277
- newFilter = null;
2278
- if (((_a = this.config.list) === null || _a === void 0 ? void 0 : _a.resetQuery) === 'beforeInit') {
2279
- 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);
2280
- }
2281
- else if (this.filter) {
2282
- newFilter = this.filter;
2283
- }
2284
- else {
2285
- 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
2286
- ? 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
2287
- ? 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
2288
- ? 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
2289
- ? this.config.sort["defaultDesc"] : null, query: this.config.baseQuery ? __spreadArray([], __read(this.config.baseQuery)) : [] }, this.searchService.filter);
2290
- }
2291
- this.facade.read(newFilter);
2292
- endButtons = this.getEndButtons();
2293
- this.pageOptions = {
2294
- title: this.config.title,
2295
- search: this.config.search
2296
- ? {
2297
- text$: this.filter$.pipe(operators.map(function (f) { return (f ? f.searchText : null); })),
2298
- set: function (txt) {
2299
- if (txt !== _this.filter.searchText)
2300
- _this.facade.read(Object.assign(Object.assign({}, _this.filter), { searchText: txt, offset: 0 }));
2301
- },
2302
- }
2303
- : null,
2304
- endButtons: endButtons,
2305
- };
2306
- return [4 /*yield*/, this.dynamicComponentLoader.getComponentsWithFactories({
2307
- components: __spreadArray(__spreadArray(__spreadArray([], __read((this.config.details &&
2308
- this.config.details["components"] &&
2309
- this.config.details["components"].top
2310
- ? [this.config.details["components"].top]
2311
- : []))), __read((this.config.details &&
2312
- this.config.details["components"] &&
2313
- this.config.details["components"].bottom
2314
- ? [this.config.details["components"].bottom]
2315
- : []))), __read((this.config.list &&
2316
- this.config.list["components"] &&
2317
- this.config.list["components"].top
2318
- ? [this.config.list["components"].top]
2319
- : []))),
2320
- })];
2321
- case 2:
2322
- compiledComponents = _k.sent();
2323
- _h = this;
2324
- _j = {
2325
- provider: {
2326
- getData: function (filter) {
2327
- var global = Object.assign(Object.assign({}, _this.filter), filter);
2328
- _this.facade.read(global);
2329
- },
2330
- onChangeMultiSelected: function (list) { return __awaiter(_this, void 0, void 0, function () {
2331
- return __generator(this, function (_h) {
2332
- switch (_h.label) {
2333
- case 0:
2334
- if (!(list.length && !this.menuService.openedEnd)) return [3 /*break*/, 2];
2335
- return [4 /*yield*/, this.menuService.openEnd({
2336
- injector: this.injector,
2337
- component: MultiselectComponent,
2338
- })];
2339
- case 1:
2340
- _h.sent();
2341
- return [3 /*break*/, 4];
2342
- case 2:
2343
- if (!(!list.length && this.menuService.openedEnd)) return [3 /*break*/, 4];
2344
- return [4 /*yield*/, this.menuService.closeEnd()];
2345
- case 3:
2346
- _h.sent();
2347
- _h.label = 4;
2348
- case 4:
2349
- this.facade.multiSelect(list);
2350
- return [2 /*return*/];
2351
- }
2352
- });
2353
- }); },
2354
- list$: this.facade.list$,
2355
- loading$: this.facade.loaded$.pipe(operators.map(function (l) { return !l; })),
2356
- },
2357
- cellPipe: this.config.list ? this.config.list.cellPipe : null,
2358
- mode: (_g = this.config.list) === null || _g === void 0 ? void 0 : _g.mode,
2359
- type: this.config.type,
2360
- details: this.config.details
2361
- ? {
2362
- provider: {
2363
- getData: function (id) {
2364
- _this.facade.select(id);
2365
- },
2366
- clearData: function () {
2367
- _this.facade.unselect();
2368
- },
2369
- item$: this.facade.selected$,
2370
- loading$: this.facade.loaded$.pipe(operators.map(function (l) { return !l; })),
2371
- },
2372
- componentFactories: {
2373
- top: this.config.details &&
2374
- this.config.details["components"] &&
2375
- this.config.details["components"].top
2376
- ? compiledComponents.find(function (cc) { return cc.component === _this.config.details["components"].top; }).factory
2377
- : null,
2378
- bottom: this.config.details &&
2379
- this.config.details["components"] &&
2380
- this.config.details["components"].bottom
2381
- ? compiledComponents.find(function (cc) { return cc.component ===
2382
- _this.config.details["components"].bottom; }).factory
2383
- : null,
2384
- },
2385
- }
2386
- : null,
2387
- item: !!this.config.edit || this.config.details
2388
- ? {
2389
- options: {
2390
- routingPrefix: "/" + this.router.routerState.snapshot.url + "/",
2391
- edit: !!this.config.edit,
2392
- },
2393
- }
2394
- : null,
2395
- remove: this.config.remove
2396
- ? {
2397
- provider: {
2398
- invoke: function (id) { return _this.facade.delete(id); },
2399
- },
2400
- }
2401
- : null
2402
- };
2403
- return [4 /*yield*/, this.paginationFacade.create({
2404
- mode: this.config.list.paginationMode,
2405
- limit: this.config.pagination.limit,
2406
- provider: {
2407
- getFilter: function () {
2408
- return _this.filter;
2409
- },
2410
- getLinks: function () { return _this.links; },
2411
- },
2412
- })];
2413
- case 3:
2414
- _h.listOptions = (_j.pagination = _k.sent(),
2415
- _j.sort = this.config.sort,
2416
- _j);
2417
- this.cd.detectChanges();
2418
- this.initCloseMenu();
2419
- this.initTopComponent(compiledComponents);
2420
- this.refreshDynamicInstance();
2421
- return [2 /*return*/];
2422
- }
2423
- });
2424
- });
2425
- };
2426
- ListComponent.prototype.initCloseMenu = function () {
2427
- var _this = this;
2428
- this.router.events.pipe(this.takeUntilDestroy).subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
2429
- return __generator(this, function (_h) {
2430
- switch (_h.label) {
2431
- case 0: return [4 /*yield*/, this.clear()];
2432
- case 1:
2433
- _h.sent();
2434
- return [2 /*return*/];
2435
- }
2436
- });
2437
- }); });
2438
- };
2439
- ListComponent.prototype.clear = function () {
2440
- return __awaiter(this, void 0, void 0, function () {
2441
- return __generator(this, function (_h) {
2442
- switch (_h.label) {
2443
- case 0: return [4 /*yield*/, this.menuService.closeEnd()];
2444
- case 1:
2445
- _h.sent();
2446
- this.listOptions = Object.assign(Object.assign({}, this.listOptions), { select: null });
2447
- this.facade.multiSelect([]);
2448
- return [2 /*return*/];
2449
- }
2450
- });
2451
- });
2452
- };
2453
- ListComponent.prototype.getEndButtons = function () {
2454
- var _this = this;
2455
- var _a, _b, _c, _d, _e;
2456
- var fieldsWithOptions = models.getModelFieldsWithOptions(new this.config.type());
2457
- var modelOptions = models.getModelOptions(this.config.type);
2458
- var showFilters = fieldsWithOptions.some(function (x) { var _a, _b; return (_b = (_a = x.options) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b.filter; }) || ((_a = modelOptions === null || modelOptions === void 0 ? void 0 : modelOptions.filters) === null || _a === void 0 ? void 0 : _a.length);
2459
- var showMultiEdit = this.config.edit &&
2460
- fieldsWithOptions.some(function (x) { var _a, _b; return (_b = (_a = x.options) === null || _a === void 0 ? void 0 : _a.update) === null || _b === void 0 ? void 0 : _b.multi; }) &&
2461
- !this.hardwareService.isMobile &&
2462
- (!((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.list) === null || _c === void 0 ? void 0 : _c.mode) ||
2463
- ((_e = (_d = this.config) === null || _d === void 0 ? void 0 : _d.list) === null || _e === void 0 ? void 0 : _e.mode) === angular.ListMode.desktop);
2464
- return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((showMultiEdit
2465
- ? [
2466
- {
2467
- icon: "checkbox-outline",
2468
- text: "multi",
2469
- handler: function () { return __awaiter(_this, void 0, void 0, function () {
2470
- return __generator(this, function (_h) {
2471
- switch (_h.label) {
2472
- case 0:
2473
- this.listOptions = Object.assign(Object.assign({}, this.listOptions), { select: this.listOptions.select === "multi" ? null : "multi" });
2474
- this.facade.multiSelect([]);
2475
- if (!this.menuService.openedEnd) return [3 /*break*/, 2];
2476
- return [4 /*yield*/, this.menuService.closeEnd()];
2477
- case 1:
2478
- _h.sent();
2479
- _h.label = 2;
2480
- case 2:
2481
- this.cd.detectChanges();
2482
- return [2 /*return*/];
2483
- }
2484
- });
2485
- }); },
2486
- },
2487
- ]
2488
- : []))), __read((showFilters
2489
- ? [
2490
- {
2491
- icon: "filter-outline",
2492
- text: "filters",
2493
- handler: function () { return __awaiter(_this, void 0, void 0, function () {
2494
- return __generator(this, function (_h) {
2495
- switch (_h.label) {
2496
- case 0: return [4 /*yield*/, this.menuService.openEnd({
2497
- injector: this.injector,
2498
- component: FiltersComponent,
2499
- })];
2500
- case 1:
2501
- _h.sent();
2502
- return [2 /*return*/];
2503
- }
2504
- });
2505
- }); },
2506
- },
2507
- ]
2508
- : []))), __read((this.config.add
2509
- ? [
2510
- {
2511
- icon: "add",
2512
- text: "add",
2513
- handler: function () {
2514
- _this.router.navigate([
2515
- "/" + _this.router.routerState.snapshot.url + "/add",
2516
- ]);
2517
- },
2518
- },
2519
- ]
2520
- : []))), __read((this.config.export
2521
- ? [
2522
- {
2523
- text: "export",
2524
- icon: "download-outline",
2525
- type: "popover",
2526
- component: ExportComponent,
2527
- },
2528
- ]
2529
- : []))), __read((this.config.buttons ? this.config.buttons : [])));
2530
- };
2531
- ListComponent.prototype.initTopComponent = function (compiledComponents) {
2532
- var _this = this;
2533
- var factory = this.config.list &&
2534
- this.config.list["components"] &&
2535
- this.config.list["components"].top
2536
- ? compiledComponents.find(function (cc) { return cc.component === _this.config.list["components"].top; }).factory
2537
- : null;
2538
- setTimeout(function () {
2539
- if (factory && !_this.topTpl.get(0)) {
2540
- _this.topTpl.createComponent(factory);
2541
- }
2542
- });
2543
- };
2544
- return ListComponent;
2545
- }(angular.CreateDynamicComponent('crud-list-page')));
2546
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2547
- ListComponent.decorators = [
2548
- { type: i0.Component, args: [{
2549
- selector: "smart-crud-list-page",
2550
- template: "\n <smart-page [options]=\"pageOptions\" *ngIf=\"filter$ | async\">\n <div #topTpl></div>\n <smart-crud-list-standard-page *ngIf=\"template === 'default'\" [listOptions]=\"listOptions\">\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n </smart-crud-list-standard-page>\n <ng-template #contentTpl>\n <ng-content></ng-content>\n </ng-template>\n <div class=\"dynamic-content\"></div>\n </smart-page>\n "
2551
- },] }
2552
- ];
2553
- /**
2554
- * @type {function(): !Array<(null|{
2555
- * type: ?,
2556
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
2557
- * })>}
2558
- * @nocollapse
2559
- */
2560
- ListComponent.ctorParameters = function () { return [
2561
- { type: CrudFacade },
2562
- { type: router.Router },
2563
- { type: angular.DynamicComponentLoader },
2564
- { type: i0.Injector },
2565
- { type: i0.ChangeDetectorRef },
2566
- { type: angular.MenuService },
2567
- { type: angular.HardwareService },
2568
- { type: CrudListPaginationFactory },
2569
- { type: angular.StyleService },
2570
- { type: i0.ElementRef },
2571
- { type: PageService },
2572
- { type: CrudFullConfig },
2573
- { type: CrudSearchService },
2574
- { type: i0.NgModuleRef },
2575
- { type: i0.ComponentFactoryResolver }
2576
- ]; };
2577
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
2578
- ListComponent.propDecorators = {
2579
- topTpl: [{ type: i0.ViewChild, args: ["topTpl", { read: i0.ViewContainerRef, static: false },] }],
2580
- contentTpl: [{ type: i0.ViewChild, args: ["contentTpl", { read: i0.TemplateRef, static: false },] }],
2581
- dynamicContents: [{ type: i0.ViewChildren, args: [angular.DynamicContentDirective, { read: angular.DynamicContentDirective },] }]
2582
- };
2583
-
2584
- var CrudItemPageBaseComponent = /** @class */ (function (_super) {
2585
- __extends(CrudItemPageBaseComponent, _super);
2586
- function CrudItemPageBaseComponent(config, facade) {
2587
- var _this = _super.call(this) || this;
2588
- _this.config = config;
2589
- _this.facade = facade;
2590
- _this.formComponents = new i0.QueryList();
2591
- _this.onPartialChange = new i0.EventEmitter();
2592
- _this.onChange = new i0.EventEmitter();
2593
- _this.onValidChange = new i0.EventEmitter();
2594
- _this.selected$ = facade.selected$;
2595
- return _this;
2596
- }
2597
- return CrudItemPageBaseComponent;
2598
- }(angular.BaseComponent));
2599
- CrudItemPageBaseComponent.smartType = "crud-item-page";
2600
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2601
- CrudItemPageBaseComponent.decorators = [
2602
- { type: i0.Directive }
2603
- ];
2604
- /**
2605
- * @type {function(): !Array<(null|{
2606
- * type: ?,
2607
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
2608
- * })>}
2609
- * @nocollapse
2610
- */
2611
- CrudItemPageBaseComponent.ctorParameters = function () { return [
2612
- { type: CrudFullConfig },
2613
- { type: CrudFacade }
2614
- ]; };
2615
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
2616
- CrudItemPageBaseComponent.propDecorators = {
2617
- contentTpl: [{ type: i0.ViewChild, args: ["contentTpl", { read: i0.ViewContainerRef, static: true },] }],
2618
- formComponents: [{ type: i0.ViewChildren, args: [angular.FormComponent, { read: angular.FormComponent },] }],
2619
- detailsOptions: [{ type: i0.Input }],
2620
- mode: [{ type: i0.Input }],
2621
- uniqueProvider: [{ type: i0.Input }],
2622
- onPartialChange: [{ type: i0.Output }],
2623
- onChange: [{ type: i0.Output }],
2624
- onValidChange: [{ type: i0.Output }]
2625
- };
2626
-
2627
- var ItemStandardComponent = /** @class */ (function (_super) {
2628
- __extends(ItemStandardComponent, _super);
2629
- function ItemStandardComponent() {
2630
- return _super !== null && _super.apply(this, arguments) || this;
2631
- }
2632
- return ItemStandardComponent;
2633
- }(CrudItemPageBaseComponent));
2634
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2635
- ItemStandardComponent.decorators = [
2636
- { type: i0.Component, args: [{
2637
- selector: "smart-crud-item-standard-page",
2638
- template: "<ng-container *ngIf=\"mode === 'details'; else editTpl\">\n <smart-details *ngIf=\"detailsOptions\" [options]='detailsOptions'></smart-details>\n</ng-container>\n\n<ng-template #editTpl>\n <smart-form\n [options]=\"\n (selected$ | async)\n | smartFormOptions : mode:config?.type:uniqueProvider : config.inputComponents\n \"\n (valuePartialChange)=\"onPartialChange.emit($event)\"\n (valueChange)=\"onChange.emit($event)\"\n (validChange)=\"onValidChange.emit($event)\"\n ></smart-form>\n</ng-template>\n\n<br/><br/>",
2639
- styles: [""]
2640
- },] }
2641
- ];
2642
-
2643
- var ItemComponent = /** @class */ (function (_super) {
2644
- __extends(ItemComponent, _super);
2645
- function ItemComponent(router, activeRoute, facade, service, route, dynamicComponentLoader, translateService, config, location, cd, authService, styleService, elementRef, toastService, pageService, moduleRef, componentFactoryResolver, detailsService) {
2646
- var _this = _super.call(this, cd, moduleRef, componentFactoryResolver) || this;
2647
- _this.router = router;
2648
- _this.activeRoute = activeRoute;
2649
- _this.facade = facade;
2650
- _this.service = service;
2651
- _this.route = route;
2652
- _this.dynamicComponentLoader = dynamicComponentLoader;
2653
- _this.translateService = translateService;
2654
- _this.config = config;
2655
- _this.location = location;
2656
- _this.cd = cd;
2657
- _this.styleService = styleService;
2658
- _this.elementRef = elementRef;
2659
- _this.toastService = toastService;
2660
- _this.pageService = pageService;
2661
- _this.moduleRef = moduleRef;
2662
- _this.componentFactoryResolver = componentFactoryResolver;
2663
- _this.detailsService = detailsService;
2664
- _this.pageOptions = {
2665
- title: "",
2666
- showBackButton: true,
2667
- hideMenuButton: true,
2668
- };
2669
- _this.formValid = false;
2670
- _this.standardComponents = new i0.QueryList();
2671
- _this.dynamicContents = new i0.QueryList();
2672
- _this.selected$ = _this.facade.selected$;
2673
- return _this;
2674
- }
2675
- Object.defineProperty(ItemComponent.prototype, "mode", {
2676
- get: function () {
2677
- return this._mode;
2678
- },
2679
- set: function (val) {
2680
- this._mode = val;
2681
- this.refreshDynamicInstance();
2682
- },
2683
- enumerable: false,
2684
- configurable: true
2685
- });
2686
- ItemComponent.prototype.refreshProperties = function () {
2687
- var _this = this;
2688
- this.baseInstance.detailsOptions = this.detailsOptions;
2689
- this.baseInstance.mode = this.mode;
2690
- this.baseInstance.uniqueProvider = this.uniqueProvider;
2691
- this.baseInstance.onPartialChange.pipe(this.takeUntilDestroy).subscribe(function (val) { return _this.onPartialChange(val); });
2692
- this.baseInstance.onChange.pipe(this.takeUntilDestroy).subscribe(function (val) { return _this.onChange(val); });
2693
- this.baseInstance.onValidChange.pipe(this.takeUntilDestroy).subscribe(function (val) { return _this.onValidChange(val); });
2694
- };
2695
- ItemComponent.prototype.ngOnInit = function () {
2696
- return __awaiter(this, void 0, void 0, function () {
2697
- var compiledComponents;
2698
- var _this = this;
2699
- return __generator(this, function (_c) {
2700
- switch (_c.label) {
2701
- case 0:
2702
- this.detailsService.init();
2703
- this.styleService.init(this.elementRef);
2704
- this.pageService.checkPermissions();
2705
- if (!this.router.routerState.snapshot.url.endsWith("/add")) return [3 /*break*/, 2];
2706
- this.mode = "create";
2707
- return [4 /*yield*/, this.generateComponents('add')];
2708
- case 1:
2709
- _c.sent();
2710
- return [3 /*break*/, 5];
2711
- case 2:
2712
- this.mode = this.config.details ? "details" : "update";
2713
- if (!(this.mode === 'update')) return [3 /*break*/, 4];
2714
- return [4 /*yield*/, this.generateComponents('edit')];
2715
- case 3:
2716
- _c.sent();
2717
- _c.label = 4;
2718
- case 4:
2719
- this.activeRoute.params
2720
- .pipe(this.takeUntilDestroy)
2721
- .subscribe(function (_c) {
2722
- var id = _c.id;
2723
- _this.facade.select(id);
2724
- _this.id = id;
2725
- });
2726
- this.activeRoute.queryParams
2727
- .pipe(this.takeUntilDestroy)
2728
- .subscribe(function (_c) {
2729
- var edit = _c.edit;
2730
- if (edit) {
2731
- _this.mode = "update";
2732
- _this.generateComponents('edit');
2733
- }
2734
- });
2735
- _c.label = 5;
2736
- case 5:
2737
- this.uniqueProvider = function (values) { return __awaiter(_this, void 0, void 0, function () {
2738
- var filter, totalCount;
2739
- return __generator(this, function (_c) {
2740
- switch (_c.label) {
2741
- case 0:
2742
- filter = {
2743
- query: [],
2744
- };
2745
- Object.keys(values).forEach(function (key) {
2746
- filter.query.push({
2747
- key: key,
2748
- value: values[key],
2749
- type: "=",
2750
- });
2751
- });
2752
- if (this.id) {
2753
- filter.query.push({
2754
- key: "id",
2755
- value: this.id,
2756
- type: "!=",
2757
- });
2758
- }
2759
- return [4 /*yield*/, this.service.getList(filter).toPromise()];
2760
- case 1:
2761
- totalCount = (_c.sent()).totalCount;
2762
- return [2 /*return*/, !totalCount];
2763
- }
2764
- });
2765
- }); };
2766
- if (!this.config.details) return [3 /*break*/, 7];
2767
- return [4 /*yield*/, this.dynamicComponentLoader.getComponentsWithFactories({
2768
- components: __spreadArray(__spreadArray([], __read((this.config.details &&
2769
- this.config.details["components"] &&
2770
- this.config.details["components"].top
2771
- ? [this.config.details["components"].top]
2772
- : []))), __read((this.config.details &&
2773
- this.config.details["components"] &&
2774
- this.config.details["components"].bottom
2775
- ? [this.config.details["components"].bottom]
2776
- : []))),
2777
- })];
2778
- case 6:
2779
- compiledComponents = _c.sent();
2780
- this.detailsOptions = {
2781
- type: this.config.type,
2782
- item$: this.facade.selected$,
2783
- cellPipe: this.config.details ? this.config.details.cellPipe : null,
2784
- componentFactories: {
2785
- top: this.config.details &&
2786
- this.config.details["components"] &&
2787
- this.config.details["components"].top
2788
- ? compiledComponents.find(function (cc) { return cc.component === _this.config.details["components"].top; }).factory
2789
- : null,
2790
- bottom: this.config.details &&
2791
- this.config.details["components"] &&
2792
- this.config.details["components"].bottom
2793
- ? compiledComponents.find(function (cc) { return cc.component === _this.config.details["components"].bottom; }).factory
2794
- : null,
2795
- },
2796
- };
2797
- _c.label = 7;
2798
- case 7:
2799
- this.initPageOptions();
2800
- this.facade.selected$.pipe(this.takeUntilDestroy).subscribe(function (item) {
2801
- _this.item = item;
2802
- _this.initPageOptions();
2803
- _this.cd.detectChanges();
2804
- });
2805
- this.refreshDynamicInstance();
2806
- return [2 /*return*/];
2807
- }
2808
- });
2809
- });
2810
- };
2811
- ItemComponent.prototype.generateComponents = function (mode) {
2812
- var _a, _b;
2813
- return __awaiter(this, void 0, void 0, function () {
2814
- var compiledComponents, topComponentFactory, bottomComponentFactory;
2815
- var _this = this;
2816
- return __generator(this, function (_c) {
2817
- switch (_c.label) {
2818
- case 0: return [4 /*yield*/, this.dynamicComponentLoader.getComponentsWithFactories({
2819
- components: __spreadArray(__spreadArray([], __read((this.config[mode] &&
2820
- this.config[mode]["components"] &&
2821
- this.config[mode]["components"].top
2822
- ? [this.config[mode]["components"].top]
2823
- : []))), __read((this.config[mode] &&
2824
- this.config[mode]["components"] &&
2825
- this.config[mode]["components"].bottom
2826
- ? [this.config[mode]["components"].bottom]
2827
- : []))),
2828
- })];
2829
- case 1:
2830
- compiledComponents = _c.sent();
2831
- topComponentFactory = (_a = compiledComponents.find(function (cc) { var _a; return cc.component === ((_a = _this.config[mode]["components"]) === null || _a === void 0 ? void 0 : _a.top); })) === null || _a === void 0 ? void 0 : _a.factory;
2832
- bottomComponentFactory = (_b = compiledComponents.find(function (cc) { var _a; return cc.component === ((_a = _this.config[mode]["components"]) === null || _a === void 0 ? void 0 : _a.bottom); })) === null || _b === void 0 ? void 0 : _b.factory;
2833
- if (!this.topTpl.get(0) && topComponentFactory) {
2834
- this.topTpl.createComponent(topComponentFactory);
2835
- }
2836
- if (!this.bottomTpl.get(0) && bottomComponentFactory) {
2837
- this.bottomTpl.createComponent(bottomComponentFactory);
2838
- }
2839
- return [2 /*return*/];
2840
- }
2841
- });
2842
- });
2843
- };
2844
- ItemComponent.prototype.onPartialChange = function (val) {
2845
- this.formPartialValue = val;
2846
- };
2847
- ItemComponent.prototype.onChange = function (val) {
2848
- this.formValue = val;
2849
- };
2850
- ItemComponent.prototype.onValidChange = function (val) {
2851
- this.formValid = val;
2852
- };
2853
- ItemComponent.prototype.initPageOptions = function () {
2854
- this.pageOptions = Object.assign(Object.assign({}, this.pageOptions), { title: this.getTitle(), endButtons: this.getButtons() });
2855
- };
2856
- ItemComponent.prototype.getButtons = function () {
2857
- var _this = this;
2858
- switch (this.mode) {
2859
- case "create":
2860
- return [
2861
- {
2862
- icon: "add",
2863
- text: "add",
2864
- handler: function () {
2865
- if (_this.checkFirstInvalid()) {
2866
- return;
2867
- }
2868
- _this.facade.create(_this.formValue);
2869
- _this.location.back();
2870
- },
2871
- },
2872
- ];
2873
- case "update":
2874
- return __spreadArray(__spreadArray([], __read((this.config.details
2875
- ? [
2876
- {
2877
- icon: "close",
2878
- text: "cancel",
2879
- handler: function () {
2880
- _this.mode = "details";
2881
- _this.initPageOptions();
2882
- _this.topTpl.clear();
2883
- _this.bottomTpl.clear();
2884
- },
2885
- disabled$: new rxjs.BehaviorSubject(false),
2886
- },
2887
- ]
2888
- : []))), [
2889
- {
2890
- icon: "save",
2891
- text: "save",
2892
- handler: function () {
2893
- if (_this.checkFirstInvalid()) {
2894
- return;
2895
- }
2896
- _this.formPartialValue.id = _this.id;
2897
- _this.facade.updatePartial(_this.formPartialValue);
2898
- if (_this.config.details) {
2899
- _this.mode = "details";
2900
- _this.initPageOptions();
2901
- }
2902
- else {
2903
- _this.location.back();
2904
- }
2905
- },
2906
- },
2907
- ]);
2908
- case "details":
2909
- return this.config.edit
2910
- ? [
2911
- {
2912
- icon: "create",
2913
- text: "edit",
2914
- handler: function () {
2915
- _this.mode = "update";
2916
- _this.generateComponents('edit');
2917
- _this.initPageOptions();
2918
- },
2919
- disabled$: new rxjs.BehaviorSubject(false),
2920
- },
2921
- ]
2922
- : [];
2923
- }
2924
- };
2925
- ItemComponent.prototype.getTitle = function () {
2926
- var options = models.getModelOptions(this.config.type);
2927
- var prefix = options.titleKey && this.item ? this.removeParagraph(this.item[options.titleKey]) + ' - ' : '';
2928
- switch (this.mode) {
2929
- case "create":
2930
- return "add";
2931
- case "update":
2932
- return prefix + this.translateService.instant("change");
2933
- case "details":
2934
- return prefix + this.translateService.instant("details");
2935
- }
2936
- };
2937
- ItemComponent.prototype.removeParagraph = function (val) {
2938
- if (!val || val.indexOf('<p>') !== 0)
2939
- return val;
2940
- var div = document.createElement("div");
2941
- div.innerHTML = val;
2942
- var item = div.querySelectorAll("p").item(0);
2943
- return item.innerHTML;
2944
- };
2945
- ItemComponent.prototype.checkFirstInvalid = function () {
2946
- this.cd.detectChanges();
2947
- var form = this.template === 'default'
2948
- ? this.standardComponents.first.formComponents.first.form
2949
- : this.baseInstance.formComponents.first.form;
2950
- this.cd.detectChanges();
2951
- if (form.valid)
2952
- return false;
2953
- var invalidFields = [];
2954
- this.getInvalidFields(form, invalidFields, '');
2955
- this.toastService.info({
2956
- title: this.translateService.instant('INPUT.ERRORS.requires'),
2957
- message: invalidFields.slice(0, 3).join('<br/>')
2958
- });
2959
- return true;
2960
- };
2961
- ItemComponent.prototype.getInvalidFields = function (control, invalidFields, baseField, key) {
2962
- var _this = this;
2963
- if (key === void 0) { key = null; }
2964
- var _a;
2965
- if (control.valid)
2966
- return;
2967
- var field = key ? baseField + ' > ' + this.translateService.instant('MODEL.' + key) : baseField;
2968
- if ((_a = control.errors) === null || _a === void 0 ? void 0 : _a.customMessage) {
2969
- invalidFields.push(field + (" (" + control.errors.customMessage + ")"));
2970
- return;
2971
- }
2972
- if (control instanceof forms.FormControl) {
2973
- invalidFields.push(field);
2974
- }
2975
- if (control instanceof forms.FormGroup) {
2976
- Object.keys(control.controls).forEach(function (groupKey) {
2977
- _this.getInvalidFields(control.controls[groupKey], invalidFields, field, groupKey);
2978
- });
2979
- }
2980
- if (control instanceof forms.FormArray) {
2981
- control.controls.forEach(function (c, index) {
2982
- _this.getInvalidFields(c, invalidFields, field + ("(" + (index + 1) + ")"));
2983
- });
2984
- }
2985
- };
2986
- return ItemComponent;
2987
- }(angular.CreateDynamicComponent('crud-item-page')));
2988
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2989
- ItemComponent.decorators = [
2990
- { type: i0.Component, args: [{
2991
- selector: "smart-crud-item-page",
2992
- template: "\n <smart-page [options]=\"pageOptions\">\n <div #topTpl class=\"top-content\"></div>\n <smart-crud-item-standard-page *ngIf=\"template === 'default'\"\n [detailsOptions]=\"detailsOptions\"\n [mode]=\"mode\"\n [uniqueProvider]=\"uniqueProvider\"\n (onPartialChange)=\"onPartialChange($event)\"\n (onChange)=\"onChange($event)\"\n (onValidChange)=\"onValidChange($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTpl\"></ng-container>\n </smart-crud-item-standard-page>\n <ng-template #contentTpl>\n <ng-content></ng-content>\n </ng-template>\n <div class=\"dynamic-content\"></div>\n <div #bottomTpl class=\"bottom-content\"></div>\n </smart-page>\n "
2993
- },] }
2994
- ];
2995
- /**
2996
- * @type {function(): !Array<(null|{
2997
- * type: ?,
2998
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
2999
- * })>}
3000
- * @nocollapse
3001
- */
3002
- ItemComponent.ctorParameters = function () { return [
3003
- { type: router.Router },
3004
- { type: router.ActivatedRoute },
3005
- { type: CrudFacade },
3006
- { type: CrudService },
3007
- { type: router.ActivatedRoute },
3008
- { type: angular.DynamicComponentLoader },
3009
- { type: core.TranslateService },
3010
- { type: CrudFullConfig },
3011
- { type: common.Location },
3012
- { type: i0.ChangeDetectorRef },
3013
- { type: angular.AuthService },
3014
- { type: angular.StyleService },
3015
- { type: i0.ElementRef },
3016
- { type: angular.ToastService },
3017
- { type: PageService },
3018
- { type: i0.NgModuleRef },
3019
- { type: i0.ComponentFactoryResolver },
3020
- { type: angular.DetailsService }
3021
- ]; };
3022
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
3023
- ItemComponent.propDecorators = {
3024
- standardComponents: [{ type: i0.ViewChildren, args: [ItemStandardComponent, { read: ItemStandardComponent },] }],
3025
- content: [{ type: i0.ViewChild, args: [angular$1.IonContent, { static: true },] }],
3026
- contentTpl: [{ type: i0.ViewChild, args: ["contentTpl", { read: i0.TemplateRef, static: false },] }],
3027
- topTpl: [{ type: i0.ViewChild, args: ["topTpl", { read: i0.ViewContainerRef, static: true },] }],
3028
- bottomTpl: [{ type: i0.ViewChild, args: ["bottomTpl", { read: i0.ViewContainerRef, static: true },] }],
3029
- dynamicContents: [{ type: i0.ViewChildren, args: [angular.DynamicContentDirective, { read: angular.DynamicContentDirective },] }]
3030
- };
3031
-
3032
- var CrudListPageBaseComponent = /** @class */ (function (_super) {
3033
- __extends(CrudListPageBaseComponent, _super);
3034
- function CrudListPageBaseComponent(config) {
3035
- var _this = _super.call(this) || this;
3036
- _this.config = config;
3037
- return _this;
3038
- }
3039
- return CrudListPageBaseComponent;
3040
- }(angular.BaseComponent));
3041
- CrudListPageBaseComponent.smartType = "crud-list-page";
3042
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
3043
- CrudListPageBaseComponent.decorators = [
3044
- { type: i0.Directive }
3045
- ];
3046
- /**
3047
- * @type {function(): !Array<(null|{
3048
- * type: ?,
3049
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
3050
- * })>}
3051
- * @nocollapse
3052
- */
3053
- CrudListPageBaseComponent.ctorParameters = function () { return [
3054
- { type: CrudFullConfig }
3055
- ]; };
3056
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
3057
- CrudListPageBaseComponent.propDecorators = {
3058
- contentTpl: [{ type: i0.ViewChild, args: ["contentTpl", { read: i0.ViewContainerRef, static: true },] }],
3059
- listOptions: [{ type: i0.Input }]
3060
- };
3061
-
3062
- var ListStandardComponent = /** @class */ (function (_super) {
3063
- __extends(ListStandardComponent, _super);
3064
- function ListStandardComponent(facade, config) {
3065
- var _this = _super.call(this, config) || this;
3066
- _this.facade = facade;
3067
- _this.config = config;
3068
- _this.isSearch$ = _this.facade.filter$.pipe(operators.map(function (filter) {
3069
- return !!(filter === null || filter === void 0 ? void 0 : filter.searchText);
3070
- }));
3071
- return _this;
3072
- }
3073
- return ListStandardComponent;
3074
- }(CrudListPageBaseComponent));
3075
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
3076
- ListStandardComponent.decorators = [
3077
- { type: i0.Component, args: [{
3078
- selector: "smart-crud-list-standard-page",
3079
- 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>",
3080
- providers: [
3081
- CrudListGroupService
3082
- ],
3083
- styles: [""]
3084
- },] }
3085
- ];
3086
- /**
3087
- * @type {function(): !Array<(null|{
3088
- * type: ?,
3089
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
3090
- * })>}
3091
- * @nocollapse
3092
- */
3093
- ListStandardComponent.ctorParameters = function () { return [
3094
- { type: CrudFacade },
3095
- { type: CrudFullConfig }
3096
- ]; };
3097
-
3098
- var PAGES = [
3099
- ItemComponent,
3100
- ListComponent,
3101
- ListStandardComponent,
3102
- ItemStandardComponent
3103
- ];
3104
- var CrudFullModule = /** @class */ (function () {
3105
- function CrudFullModule(store, config, effects) {
3106
- angular.NgrxStoreService.addReducer(config.entity, config.reducerFactory
3107
- ? config.reducerFactory()
3108
- : getReducer(config.entity));
3109
- effects.init();
3110
- }
3111
- return CrudFullModule;
3112
- }());
3113
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
3114
- CrudFullModule.decorators = [
3115
- { type: i0.NgModule, args: [{
3116
- declarations: __spreadArray([], __read(PAGES)),
3117
- imports: [
3118
- store.StoreModule,
3119
- angular.SharedModule,
3120
- CrudPipesModule,
3121
- router.RouterModule.forChild([
3122
- { path: '', component: ListComponent },
3123
- { path: 'add', component: ItemComponent },
3124
- { path: ':id', component: ItemComponent }
3125
- ]),
3126
- forms.FormsModule,
3127
- common.CommonModule,
3128
- CrudComponentsModule
3129
- ],
3130
- exports: __spreadArray(__spreadArray([], __read(PAGES)), [
3131
- CrudComponentsModule
3132
- ]),
3133
- entryComponents: __spreadArray([], __read(PAGES)),
3134
- providers: [
3135
- CrudService,
3136
- CrudListGroupService,
3137
- PageService,
3138
- CrudEffects,
3139
- CrudFacade,
3140
- CrudListPaginationFactory,
3141
- ]
3142
- },] }
3143
- ];
3144
- /**
3145
- * @type {function(): !Array<(null|{
3146
- * type: ?,
3147
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
3148
- * })>}
3149
- * @nocollapse
3150
- */
3151
- CrudFullModule.ctorParameters = function () { return [
3152
- { type: store.Store },
3153
- { type: CrudConfig },
3154
- { type: CrudEffects }
3155
- ]; };
3156
-
3157
- var CrudCoreModule = /** @class */ (function () {
3158
- function CrudCoreModule(config, effects) {
3159
- angular.NgrxStoreService.addReducer(config.entity, config.reducerFactory
3160
- ? config.reducerFactory()
3161
- : getReducer(config.entity));
3162
- effects.init();
3163
- }
3164
- return CrudCoreModule;
3165
- }());
3166
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
3167
- CrudCoreModule.decorators = [
3168
- { type: i0.NgModule, args: [{
3169
- imports: [
3170
- //AuthSharedModule,
3171
- store.StoreModule,
3172
- angular.SharedModule,
3173
- CrudPipesModule,
3174
- forms.FormsModule,
3175
- common.CommonModule,
3176
- CrudComponentsModule,
3177
- angular.NgrxSharedModule,
3178
- ],
3179
- exports: [CrudComponentsModule],
3180
- providers: [
3181
- CrudService,
3182
- CrudListGroupService,
3183
- PageService,
3184
- CrudEffects,
3185
- CrudFacade,
3186
- SocketService,
3187
- CrudListPaginationFactory,
3188
- ],
3189
- },] }
3190
- ];
3191
- /**
3192
- * @type {function(): !Array<(null|{
3193
- * type: ?,
3194
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
3195
- * })>}
3196
- * @nocollapse
3197
- */
3198
- CrudCoreModule.ctorParameters = function () { return [
3199
- { type: CrudConfig },
3200
- { type: CrudEffects }
3201
- ]; };
3202
- var CrudModule = /** @class */ (function () {
3203
- function CrudModule() {
3204
- }
3205
- CrudModule.forFeature = function (options) {
3206
- return {
3207
- ngModule: options.routing ? CrudFullModule : CrudCoreModule,
3208
- providers: __spreadArray([
3209
- { provide: CrudConfig, useValue: options.config },
3210
- { provide: CrudFullConfig, useValue: options.config },
3211
- {
3212
- provide: angular.FILE_SERVICE_CONFIG,
3213
- useValue: { apiUrl: options.config.apiUrl },
3214
- }
3215
- ], __read((options.socket
3216
- ? [SocketService]
3217
- : [{ provide: SocketService, useClass: NotSocketService }]))),
3218
- };
3219
- };
3220
- return CrudModule;
3221
- }());
3222
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
3223
- CrudModule.decorators = [
3224
- { type: i0.NgModule, args: [{},] }
3225
- ];
3226
-
3227
- /**
3228
- * Generated bundle index. Do not edit.
3229
- */
3230
-
3231
- exports.CRUD_MODEL_POSSIBILITIES_PROVIDER = CRUD_MODEL_POSSIBILITIES_PROVIDER;
3232
- exports.CrudComponentsModule = CrudComponentsModule;
3233
- exports.CrudConfig = CrudConfig;
3234
- exports.CrudCoreModule = CrudCoreModule;
3235
- exports.CrudEffects = CrudEffects;
3236
- exports.CrudFacade = CrudFacade;
3237
- exports.CrudFullConfig = CrudFullConfig;
3238
- exports.CrudFullModule = CrudFullModule;
3239
- exports.CrudItemPageBaseComponent = CrudItemPageBaseComponent;
3240
- exports.CrudListPageBaseComponent = CrudListPageBaseComponent;
3241
- exports.CrudListPaginationFactory = CrudListPaginationFactory;
3242
- exports.CrudModule = CrudModule;
3243
- exports.CrudPipesModule = CrudPipesModule;
3244
- exports.CrudSearchService = CrudSearchService;
3245
- exports.CrudService = CrudService;
3246
- exports.ExportComponent = ExportComponent;
3247
- exports.FilterCheckComponent = FilterCheckComponent;
3248
- exports.FilterComponent = FilterComponent;
3249
- exports.FilterDateComponent = FilterDateComponent;
3250
- exports.FilterDateWithEditComponent = FilterDateWithEditComponent;
3251
- exports.FilterFlagComponent = FilterFlagComponent;
3252
- exports.FilterIntComponent = FilterIntComponent;
3253
- exports.FilterRadioComponent = FilterRadioComponent;
3254
- exports.FilterTextComponent = FilterTextComponent;
3255
- exports.FiltersComponent = FiltersComponent;
3256
- exports.FiltersConfigComponent = FiltersConfigComponent;
3257
- exports.FormOptionsPipe = FormOptionsPipe;
3258
- exports.GroupComponent = GroupComponent;
3259
- exports.ICrudModelPossibilitiesProvider = ICrudModelPossibilitiesProvider;
3260
- exports.MultiselectComponent = MultiselectComponent;
3261
- exports.PageService = PageService;
3262
- exports.create = create;
3263
- exports.createFailure = createFailure;
3264
- exports.createMany = createMany;
3265
- exports.createManyFailure = createManyFailure;
3266
- exports.createManySuccess = createManySuccess;
3267
- exports.createSuccess = createSuccess;
3268
- exports.deleteFailure = deleteFailure;
3269
- exports.deleteItem = deleteItem;
3270
- exports.deleteSuccess = deleteSuccess;
3271
- exports.exportList = exportList;
3272
- exports.exportListFailure = exportListFailure;
3273
- exports.exportListSuccess = exportListSuccess;
3274
- exports.getCrudError = getCrudError;
3275
- exports.getCrudFilter = getCrudFilter;
3276
- exports.getCrudLinks = getCrudLinks;
3277
- exports.getCrudList = getCrudList;
3278
- exports.getCrudLoaded = getCrudLoaded;
3279
- exports.getCrudMultiSelected = getCrudMultiSelected;
3280
- exports.getCrudSelected = getCrudSelected;
3281
- exports.getCrudState = getCrudState;
3282
- exports.getCrudTotalCount = getCrudTotalCount;
3283
- exports.getReducer = getReducer;
3284
- exports.initialState = initialState;
3285
- exports.multiSelect = multiSelect;
3286
- exports.read = read;
3287
- exports.readFailure = readFailure;
3288
- exports.readSuccess = readSuccess;
3289
- exports.select = select;
3290
- exports.selectFailure = selectFailure;
3291
- exports.selectSuccess = selectSuccess;
3292
- exports.unselect = unselect;
3293
- exports.update = update;
3294
- exports.updateFailure = updateFailure;
3295
- exports.updatePartial = updatePartial;
3296
- exports.updatePartialFailure = updatePartialFailure;
3297
- exports.updatePartialMany = updatePartialMany;
3298
- exports.updatePartialManyFailure = updatePartialManyFailure;
3299
- exports.updatePartialManySuccess = updatePartialManySuccess;
3300
- exports.updatePartialSuccess = updatePartialSuccess;
3301
- exports.updateSuccess = updateSuccess;
3302
- exports["ɵ0"] = ɵ0;
3303
- exports["ɵa"] = CrudPipesModule;
3304
- exports["ɵb"] = FormOptionsPipe;
3305
- exports["ɵc"] = CrudComponentsModule;
3306
- exports["ɵd"] = ExportComponent;
3307
- exports["ɵe"] = FilterComponent;
3308
- exports["ɵf"] = FilterTextComponent;
3309
- exports["ɵg"] = FiltersConfigComponent;
3310
- exports["ɵh"] = FilterDateComponent;
3311
- exports["ɵi"] = FilterDateWithEditComponent;
3312
- exports["ɵj"] = FilterRadioComponent;
3313
- exports["ɵk"] = FiltersComponent;
3314
- exports["ɵl"] = FilterFlagComponent;
3315
- exports["ɵm"] = FilterCheckComponent;
3316
- exports["ɵn"] = FilterIntComponent;
3317
- exports["ɵo"] = MultiselectComponent;
3318
- exports["ɵp"] = GroupComponent;
3319
- exports["ɵq"] = CrudListGroupService;
3320
- exports["ɵr"] = SocketService;
3321
- exports["ɵs"] = NotSocketService;
3322
- exports["ɵt"] = ItemComponent;
3323
- exports["ɵu"] = ItemStandardComponent;
3324
- exports["ɵv"] = CrudItemPageBaseComponent;
3325
- exports["ɵw"] = ListComponent;
3326
- exports["ɵx"] = ListStandardComponent;
3327
- exports["ɵy"] = CrudListPageBaseComponent;
3328
-
3329
- Object.defineProperty(exports, '__esModule', { value: true });
3330
-
3331
- }));
3332
- //# sourceMappingURL=smartsoft001-crud-shell-angular.umd.js.map