@smartsoft001/crud-shell-angular 1.2.90 → 2.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/.storybook/addons.js +1 -0
  2. package/.storybook/config.js +5 -0
  3. package/.storybook/tsconfig.json +8 -0
  4. package/.storybook/webpack.config.js +7 -0
  5. package/jest.config.ts +38 -0
  6. package/ng-package.json +7 -0
  7. package/package.json +12 -23
  8. package/project.json +49 -0
  9. package/src/index.ts +13 -0
  10. package/src/lib/+state/crud.facade.ts +82 -0
  11. package/src/lib/+state/crud.feature.methods.ts +258 -0
  12. package/src/lib/+state/crud.feature.store.ts +77 -0
  13. package/src/lib/components/components.module.ts +58 -0
  14. package/src/lib/components/export/export.component.ts +69 -0
  15. package/src/lib/components/filter/base/base.component.ts +175 -0
  16. package/src/lib/components/filter/check/check.component.scss +25 -0
  17. package/src/lib/components/filter/check/check.component.ts +72 -0
  18. package/src/lib/components/filter/date/date.component.html +30 -0
  19. package/src/lib/components/filter/date/date.component.ts +70 -0
  20. package/src/lib/components/filter/date-time/date-time.component.html +62 -0
  21. package/src/lib/components/filter/date-time/date-time.component.ts +56 -0
  22. package/src/lib/components/filter/date-with-edit/date-with-edit.component.html +109 -0
  23. package/src/lib/components/filter/date-with-edit/date-with-edit.component.ts +70 -0
  24. package/src/lib/components/filter/filter.component.html +52 -0
  25. package/src/lib/components/filter/filter.component.ts +34 -0
  26. package/src/lib/components/filter/flag/flag.component.ts +55 -0
  27. package/src/lib/components/filter/index.ts +9 -0
  28. package/src/lib/components/filter/int/int.component.html +74 -0
  29. package/src/lib/components/filter/int/int.component.ts +57 -0
  30. package/src/lib/components/filter/radio/radio.component.ts +74 -0
  31. package/src/lib/components/filter/text/text.component.ts +46 -0
  32. package/src/lib/components/filters/filters.component.scss +150 -0
  33. package/src/lib/components/filters/filters.component.ts +157 -0
  34. package/src/lib/components/filters-config/filters-config.component.ts +69 -0
  35. package/src/lib/components/group/group.component.ts +93 -0
  36. package/src/lib/components/index.ts +7 -0
  37. package/src/lib/components/multiselect/multiselect.component.html +41 -0
  38. package/src/lib/components/multiselect/multiselect.component.scss +125 -0
  39. package/src/lib/components/multiselect/multiselect.component.ts +104 -0
  40. package/src/lib/crud-full.module.ts +51 -0
  41. package/src/lib/crud.config.ts +79 -0
  42. package/src/lib/crud.module.ts +72 -0
  43. package/src/lib/factories/list-pagination/list-pagination.factory.ts +77 -0
  44. package/src/lib/models/index.ts +1 -0
  45. package/src/lib/models/interfaces.ts +34 -0
  46. package/src/lib/pages/index.ts +6 -0
  47. package/src/lib/pages/item/base/base.component.ts +54 -0
  48. package/src/lib/pages/item/item.component.ts +513 -0
  49. package/src/lib/pages/item/standard/standard.component.scss +0 -0
  50. package/src/lib/pages/item/standard/standard.component.ts +50 -0
  51. package/src/lib/pages/list/base/base.component.ts +29 -0
  52. package/src/lib/pages/list/list.component.stories.ts +77 -0
  53. package/src/lib/pages/list/list.component.ts +438 -0
  54. package/src/lib/pages/list/standard/standard.component.ts +42 -0
  55. package/src/lib/pipes/form-options/form-options.pipe.ts +61 -0
  56. package/src/lib/pipes/index.ts +2 -0
  57. package/src/lib/pipes/pipes.module.ts +9 -0
  58. package/src/lib/providers/model-possibilities/model-possibilities.provider.ts +19 -0
  59. package/src/lib/services/crud/crud.service.spec.ts +303 -0
  60. package/src/lib/services/crud/crud.service.ts +178 -0
  61. package/src/lib/services/list-group/list-group.service.spec.ts +87 -0
  62. package/src/lib/services/list-group/list-group.service.ts +65 -0
  63. package/src/lib/services/page/page.service.spec.ts +143 -0
  64. package/src/lib/services/page/page.service.ts +44 -0
  65. package/src/lib/services/search/search.service.spec.ts +134 -0
  66. package/src/lib/services/search/search.service.ts +42 -0
  67. package/test-setup.ts +0 -0
  68. package/tsconfig.json +13 -0
  69. package/tsconfig.lib.json +31 -0
  70. package/tsconfig.lib.prod.json +11 -0
  71. package/tsconfig.spec.json +10 -0
  72. package/tslint.json +10 -0
  73. package/esm2022/index.mjs +0 -18
  74. package/esm2022/lib/+state/crud.actions.mjs +0 -224
  75. package/esm2022/lib/+state/crud.effects.mjs +0 -182
  76. package/esm2022/lib/+state/crud.facade.mjs +0 -91
  77. package/esm2022/lib/+state/crud.reducer.mjs +0 -214
  78. package/esm2022/lib/+state/crud.selectors.mjs +0 -11
  79. package/esm2022/lib/components/components.module.mjs +0 -110
  80. package/esm2022/lib/components/export/export.component.mjs +0 -47
  81. package/esm2022/lib/components/filter/base/base.component.mjs +0 -152
  82. package/esm2022/lib/components/filter/check/check.component.mjs +0 -36
  83. package/esm2022/lib/components/filter/date/date.component.mjs +0 -47
  84. package/esm2022/lib/components/filter/date-time/date-time.component.mjs +0 -43
  85. package/esm2022/lib/components/filter/date-with-edit/date-with-edit.component.mjs +0 -49
  86. package/esm2022/lib/components/filter/filter.component.mjs +0 -30
  87. package/esm2022/lib/components/filter/flag/flag.component.mjs +0 -16
  88. package/esm2022/lib/components/filter/index.mjs +0 -10
  89. package/esm2022/lib/components/filter/int/int.component.mjs +0 -38
  90. package/esm2022/lib/components/filter/radio/radio.component.mjs +0 -16
  91. package/esm2022/lib/components/filter/text/text.component.mjs +0 -16
  92. package/esm2022/lib/components/filters/filters.component.mjs +0 -111
  93. package/esm2022/lib/components/filters-config/filters-config.component.mjs +0 -37
  94. package/esm2022/lib/components/group/group.component.mjs +0 -54
  95. package/esm2022/lib/components/index.mjs +0 -8
  96. package/esm2022/lib/components/multiselect/multiselect.component.mjs +0 -71
  97. package/esm2022/lib/crud-full.module.mjs +0 -103
  98. package/esm2022/lib/crud.config.mjs +0 -17
  99. package/esm2022/lib/crud.module.mjs +0 -106
  100. package/esm2022/lib/factories/list-pagination/list-pagination.factory.mjs +0 -69
  101. package/esm2022/lib/models/index.mjs +0 -2
  102. package/esm2022/lib/models/interfaces.mjs +0 -2
  103. package/esm2022/lib/pages/index.mjs +0 -7
  104. package/esm2022/lib/pages/item/base/base.component.mjs +0 -44
  105. package/esm2022/lib/pages/item/item.component.mjs +0 -395
  106. package/esm2022/lib/pages/item/standard/standard.component.mjs +0 -15
  107. package/esm2022/lib/pages/list/base/base.component.mjs +0 -23
  108. package/esm2022/lib/pages/list/list.component.mjs +0 -355
  109. package/esm2022/lib/pages/list/standard/standard.component.mjs +0 -34
  110. package/esm2022/lib/pipes/form-options/form-options.pipe.mjs +0 -55
  111. package/esm2022/lib/pipes/index.mjs +0 -3
  112. package/esm2022/lib/pipes/pipes.module.mjs +0 -20
  113. package/esm2022/lib/providers/model-possibilities/model-possibilities.provider.mjs +0 -11
  114. package/esm2022/lib/services/crud/crud.service.mjs +0 -138
  115. package/esm2022/lib/services/list-group/list-group.service.mjs +0 -60
  116. package/esm2022/lib/services/page/page.service.mjs +0 -41
  117. package/esm2022/lib/services/search/search.service.mjs +0 -41
  118. package/esm2022/lib/services/socket/socket.service.mjs +0 -17
  119. package/esm2022/smartsoft001-crud-shell-angular.mjs +0 -5
  120. package/fesm2022/smartsoft001-crud-shell-angular.mjs +0 -2810
  121. package/fesm2022/smartsoft001-crud-shell-angular.mjs.map +0 -1
  122. package/index.d.ts +0 -18
  123. package/index.d.ts.map +0 -1
  124. package/lib/+state/crud.actions.d.ts +0 -152
  125. package/lib/+state/crud.actions.d.ts.map +0 -1
  126. package/lib/+state/crud.effects.d.ts +0 -18
  127. package/lib/+state/crud.effects.d.ts.map +0 -1
  128. package/lib/+state/crud.facade.d.ts +0 -44
  129. package/lib/+state/crud.facade.d.ts.map +0 -1
  130. package/lib/+state/crud.reducer.d.ts +0 -43
  131. package/lib/+state/crud.reducer.d.ts.map +0 -1
  132. package/lib/+state/crud.selectors.d.ts +0 -10
  133. package/lib/+state/crud.selectors.d.ts.map +0 -1
  134. package/lib/components/components.module.d.ts +0 -27
  135. package/lib/components/components.module.d.ts.map +0 -1
  136. package/lib/components/export/export.component.d.ts +0 -21
  137. package/lib/components/export/export.component.d.ts.map +0 -1
  138. package/lib/components/filter/base/base.component.d.ts +0 -39
  139. package/lib/components/filter/base/base.component.d.ts.map +0 -1
  140. package/lib/components/filter/check/check.component.d.ts +0 -19
  141. package/lib/components/filter/check/check.component.d.ts.map +0 -1
  142. package/lib/components/filter/date/date.component.d.ts +0 -16
  143. package/lib/components/filter/date/date.component.d.ts.map +0 -1
  144. package/lib/components/filter/date-time/date-time.component.d.ts +0 -15
  145. package/lib/components/filter/date-time/date-time.component.d.ts.map +0 -1
  146. package/lib/components/filter/date-with-edit/date-with-edit.component.d.ts +0 -17
  147. package/lib/components/filter/date-with-edit/date-with-edit.component.d.ts.map +0 -1
  148. package/lib/components/filter/filter.component.d.ts +0 -14
  149. package/lib/components/filter/filter.component.d.ts.map +0 -1
  150. package/lib/components/filter/flag/flag.component.d.ts +0 -8
  151. package/lib/components/filter/flag/flag.component.d.ts.map +0 -1
  152. package/lib/components/filter/index.d.ts +0 -10
  153. package/lib/components/filter/index.d.ts.map +0 -1
  154. package/lib/components/filter/int/int.component.d.ts +0 -15
  155. package/lib/components/filter/int/int.component.d.ts.map +0 -1
  156. package/lib/components/filter/radio/radio.component.d.ts +0 -8
  157. package/lib/components/filter/radio/radio.component.d.ts.map +0 -1
  158. package/lib/components/filter/text/text.component.d.ts +0 -8
  159. package/lib/components/filter/text/text.component.d.ts.map +0 -1
  160. package/lib/components/filters/filters.component.d.ts +0 -83
  161. package/lib/components/filters/filters.component.d.ts.map +0 -1
  162. package/lib/components/filters-config/filters-config.component.d.ts +0 -19
  163. package/lib/components/filters-config/filters-config.component.d.ts.map +0 -1
  164. package/lib/components/group/group.component.d.ts +0 -23
  165. package/lib/components/group/group.component.d.ts.map +0 -1
  166. package/lib/components/index.d.ts +0 -8
  167. package/lib/components/index.d.ts.map +0 -1
  168. package/lib/components/multiselect/multiselect.component.d.ts +0 -28
  169. package/lib/components/multiselect/multiselect.component.d.ts.map +0 -1
  170. package/lib/crud-full.module.d.ts +0 -28
  171. package/lib/crud-full.module.d.ts.map +0 -1
  172. package/lib/crud.config.d.ts +0 -65
  173. package/lib/crud.config.d.ts.map +0 -1
  174. package/lib/crud.module.d.ts +0 -34
  175. package/lib/crud.module.d.ts.map +0 -1
  176. package/lib/factories/list-pagination/list-pagination.factory.d.ts +0 -20
  177. package/lib/factories/list-pagination/list-pagination.factory.d.ts.map +0 -1
  178. package/lib/models/index.d.ts +0 -2
  179. package/lib/models/index.d.ts.map +0 -1
  180. package/lib/models/interfaces.d.ts +0 -30
  181. package/lib/models/interfaces.d.ts.map +0 -1
  182. package/lib/pages/index.d.ts +0 -7
  183. package/lib/pages/index.d.ts.map +0 -1
  184. package/lib/pages/item/base/base.component.d.ts +0 -25
  185. package/lib/pages/item/base/base.component.d.ts.map +0 -1
  186. package/lib/pages/item/item.component.d.ts +0 -70
  187. package/lib/pages/item/item.component.d.ts.map +0 -1
  188. package/lib/pages/item/standard/standard.component.d.ts +0 -8
  189. package/lib/pages/item/standard/standard.component.d.ts.map +0 -1
  190. package/lib/pages/list/base/base.component.d.ts +0 -15
  191. package/lib/pages/list/base/base.component.d.ts.map +0 -1
  192. package/lib/pages/list/list.component.d.ts +0 -54
  193. package/lib/pages/list/list.component.d.ts.map +0 -1
  194. package/lib/pages/list/standard/standard.component.d.ts +0 -14
  195. package/lib/pages/list/standard/standard.component.d.ts.map +0 -1
  196. package/lib/pipes/form-options/form-options.pipe.d.ts +0 -15
  197. package/lib/pipes/form-options/form-options.pipe.d.ts.map +0 -1
  198. package/lib/pipes/index.d.ts +0 -3
  199. package/lib/pipes/index.d.ts.map +0 -1
  200. package/lib/pipes/pipes.module.d.ts +0 -8
  201. package/lib/pipes/pipes.module.d.ts.map +0 -1
  202. package/lib/providers/model-possibilities/model-possibilities.provider.d.ts +0 -18
  203. package/lib/providers/model-possibilities/model-possibilities.provider.d.ts.map +0 -1
  204. package/lib/services/crud/crud.service.d.ts +0 -38
  205. package/lib/services/crud/crud.service.d.ts.map +0 -1
  206. package/lib/services/list-group/list-group.service.d.ts +0 -15
  207. package/lib/services/list-group/list-group.service.d.ts.map +0 -1
  208. package/lib/services/page/page.service.d.ts +0 -12
  209. package/lib/services/page/page.service.d.ts.map +0 -1
  210. package/lib/services/search/search.service.d.ts +0 -16
  211. package/lib/services/search/search.service.d.ts.map +0 -1
  212. package/lib/services/socket/socket.service.d.ts +0 -10
  213. package/lib/services/socket/socket.service.d.ts.map +0 -1
  214. package/smartsoft001-crud-shell-angular.d.ts.map +0 -1
@@ -1,2810 +0,0 @@
1
- import * as i1 from '@ngrx/store';
2
- import { createFeatureSelector, createSelector, select as select$1, StoreModule } from '@ngrx/store';
3
- import * as i0 from '@angular/core';
4
- import { Injectable, Component, InjectionToken, Directive, Optional, Inject, Input, ViewChild, Pipe, NgModule, ViewContainerRef, QueryList, TemplateRef, ViewChildren, EventEmitter, Output } from '@angular/core';
5
- import * as i3 from '@smartsoft001/angular';
6
- import { NgrxStoreService, BaseComponent as BaseComponent$1, SharedModule, PaginationMode, CreateDynamicComponent, ListMode, DynamicContentDirective, FormComponent, NgrxSharedModule, FILE_SERVICE_CONFIG } from '@smartsoft001/angular';
7
- import { map, tap, first, catchError } from 'rxjs/operators';
8
- import { FieldType, getModelOptions, getModelFieldsWithOptions } from '@smartsoft001/models';
9
- import * as i2 from '@ionic/angular';
10
- import { IonDatetime, IonContent } from '@ionic/angular';
11
- import * as i3$1 from '@angular/common';
12
- import { CommonModule } from '@angular/common';
13
- import { __decorate, __metadata } from 'tslib';
14
- import { Debounce, debounce } from 'lodash-decorators';
15
- import * as i4 from '@ngx-translate/core';
16
- import * as i1$1 from '@angular/forms';
17
- import { FormsModule, UntypedFormControl, UntypedFormGroup, UntypedFormArray } from '@angular/forms';
18
- import moment from 'moment';
19
- import { GuidService, SpecificationService } from '@smartsoft001/utils';
20
- import { Subscription, combineLatest, forkJoin, of, BehaviorSubject, Subject } from 'rxjs';
21
- import * as _ from 'lodash';
22
- import * as i6 from 'ng-dynamic-component';
23
- import { DynamicIoModule } from 'ng-dynamic-component';
24
- import * as i2$1 from '@angular/common/http';
25
- import 'reflect-metadata';
26
- import * as i1$2 from '@angular/router';
27
- import { RouterModule } from '@angular/router';
28
-
29
- const getCrudState = (entity) => createFeatureSelector(entity);
30
- const getCrudSelected = (entity) => createSelector(getCrudState(entity), (state) => state.selected);
31
- const getCrudMultiSelected = (entity) => createSelector(getCrudState(entity), (state) => state.multiSelected);
32
- const getCrudList = (entity) => createSelector(getCrudState(entity), (state) => state.list);
33
- const getCrudTotalCount = (entity) => createSelector(getCrudState(entity), (state) => state.totalCount);
34
- const getCrudLinks = (entity) => createSelector(getCrudState(entity), (state) => state.links);
35
- const getCrudLoaded = (entity) => createSelector(getCrudState(entity), (state) => state.loaded);
36
- const getCrudFilter = (entity) => createSelector(getCrudState(entity), (state) => state.filter);
37
- const getCrudError = (entity) => createSelector(getCrudState(entity), (state) => state.error);
38
-
39
- class CrudConfig {
40
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
41
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudConfig }); }
42
- }
43
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudConfig, decorators: [{
44
- type: Injectable
45
- }] });
46
- class CrudFullConfig extends CrudConfig {
47
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFullConfig, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
48
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFullConfig }); }
49
- }
50
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFullConfig, decorators: [{
51
- type: Injectable
52
- }] });
53
-
54
- /*
55
- * Create
56
- */
57
- const create = function (entity, item) {
58
- return {
59
- type: `[${entity}] Create`,
60
- item
61
- };
62
- };
63
- const createSuccess = function (entity, item) {
64
- return {
65
- type: `[${entity}] Create Success`,
66
- item
67
- };
68
- };
69
- const createFailure = function (entity, item, error) {
70
- return {
71
- type: `[${entity}] Create Failure`,
72
- item,
73
- error
74
- };
75
- };
76
- /*
77
- * Create many
78
- */
79
- const createMany = function (entity, data) {
80
- return {
81
- type: `[${entity}] Create Many`,
82
- data
83
- };
84
- };
85
- const createManySuccess = function (entity, data) {
86
- return {
87
- type: `[${entity}] Create Many Success`,
88
- data
89
- };
90
- };
91
- const createManyFailure = function (entity, data, error) {
92
- return {
93
- type: `[${entity}] Create Many Failure`,
94
- data,
95
- error
96
- };
97
- };
98
- /*
99
- * Read
100
- */
101
- const read = function (entity, filter = null) {
102
- return {
103
- type: `[${entity}] Read`,
104
- filter
105
- };
106
- };
107
- const readSuccess = function (entity, filter, result) {
108
- return {
109
- type: `[${entity}] Read Success`,
110
- result,
111
- filter
112
- };
113
- };
114
- const readFailure = function (entity, filter, error) {
115
- return {
116
- type: `[${entity}] Read Failure`,
117
- filter,
118
- error
119
- };
120
- };
121
- /*
122
- * Clear
123
- */
124
- const clear = function (entity) {
125
- return {
126
- type: `[${entity}] Clear`
127
- };
128
- };
129
- /*
130
- * Export
131
- */
132
- const exportList = function (entity, filter = null, format) {
133
- return {
134
- type: `[${entity}] Export`,
135
- filter,
136
- format
137
- };
138
- };
139
- const exportListSuccess = function (entity, filter) {
140
- return {
141
- type: `[${entity}] Export Success`,
142
- filter
143
- };
144
- };
145
- const exportListFailure = function (entity, filter, error) {
146
- return {
147
- type: `[${entity}] Export Failure`,
148
- filter,
149
- error
150
- };
151
- };
152
- /*
153
- * Select
154
- */
155
- const select = function (entity, id) {
156
- return {
157
- type: `[${entity}] Select`,
158
- id
159
- };
160
- };
161
- const selectSuccess = function (entity, id, item) {
162
- return {
163
- type: `[${entity}] Select Success`,
164
- id,
165
- item
166
- };
167
- };
168
- const selectFailure = function (entity, id, error) {
169
- return {
170
- type: `[${entity}] Select Failure`,
171
- id,
172
- error
173
- };
174
- };
175
- const unselect = function (entity) {
176
- return {
177
- type: `[${entity}] Unselect`
178
- };
179
- };
180
- /*
181
- * MultiSelect
182
- */
183
- const multiSelect = function (entity, items) {
184
- return {
185
- type: `[${entity}] MultiSelect`,
186
- items
187
- };
188
- };
189
- /*
190
- * Update
191
- */
192
- const update = function (entity, item) {
193
- return {
194
- type: `[${entity}] Update`,
195
- item
196
- };
197
- };
198
- const updateSuccess = function (entity, item) {
199
- return {
200
- type: `[${entity}] Update Success`,
201
- item
202
- };
203
- };
204
- const updateFailure = function (entity, item, error) {
205
- return {
206
- type: `[${entity}] Update Failure`,
207
- item,
208
- error
209
- };
210
- };
211
- /*
212
- * Update partial
213
- */
214
- const updatePartial = function (entity, item) {
215
- return {
216
- type: `[${entity}] Update partial`,
217
- item
218
- };
219
- };
220
- const updatePartialSuccess = function (entity, item) {
221
- return {
222
- type: `[${entity}] Update partial Success`,
223
- item
224
- };
225
- };
226
- const updatePartialFailure = function (entity, item, error) {
227
- return {
228
- type: `[${entity}] Update partial Failure`,
229
- item,
230
- error
231
- };
232
- };
233
- /*
234
- * Update partial many
235
- */
236
- const updatePartialMany = function (entity, items) {
237
- return {
238
- type: `[${entity}] Update partial many`,
239
- items
240
- };
241
- };
242
- const updatePartialManySuccess = function (entity, items) {
243
- return {
244
- type: `[${entity}] Update partial many Success`,
245
- items
246
- };
247
- };
248
- const updatePartialManyFailure = function (entity, items, error) {
249
- return {
250
- type: `[${entity}] Update partial many Failure`,
251
- items,
252
- error
253
- };
254
- };
255
- /*
256
- * Delete
257
- */
258
- const deleteItem = function (entity, id) {
259
- return {
260
- type: `[${entity}] Delete`,
261
- id
262
- };
263
- };
264
- const deleteSuccess = function (entity, id) {
265
- return {
266
- type: `[${entity}] Delete Success`,
267
- id
268
- };
269
- };
270
- const deleteFailure = function (entity, id, error) {
271
- return {
272
- type: `[${entity}] Delete Failure`,
273
- id,
274
- error
275
- };
276
- };
277
-
278
- class CrudFacade {
279
- constructor(store, config) {
280
- this.store = store;
281
- this.config = config;
282
- this.loaded$ = this.store.pipe(select$1(getCrudLoaded(this.config.entity)));
283
- this.loading$ = this.store.pipe(select$1(getCrudLoaded(this.config.entity)), map(l => !l));
284
- this.selected$ = this.store.pipe(select$1(getCrudSelected(this.config.entity)), tap(s => {
285
- this.selected = s;
286
- }));
287
- this.multiSelected$ = this.store.pipe(select$1(getCrudMultiSelected(this.config.entity)), tap(s => {
288
- this.multiSelected = s;
289
- }));
290
- this.list$ = this.store.pipe(select$1(getCrudList(this.config.entity)), tap(l => {
291
- this.list = l;
292
- }));
293
- this.filter$ = this.store.pipe(select$1(getCrudFilter(this.config.entity)), tap(f => {
294
- this.filter = f;
295
- }));
296
- this.totalCount$ = this.store.pipe(select$1(getCrudTotalCount(this.config.entity)));
297
- this.links$ = this.store.pipe(select$1(getCrudLinks(this.config.entity)));
298
- this.error$ = this.store.pipe(select$1(getCrudError(this.config.entity)));
299
- if (NgrxStoreService.store) {
300
- this.store = NgrxStoreService.store;
301
- }
302
- }
303
- create(item) {
304
- this.store.dispatch(create(this.config.entity, item));
305
- }
306
- createMany(items, options) {
307
- this.store.dispatch(createMany(this.config.entity, { items, options }));
308
- }
309
- read(filter = null) {
310
- let baseQuery = [];
311
- if (this.config.baseQuery) {
312
- baseQuery = this.config.baseQuery;
313
- }
314
- const fullFilter = {
315
- ...(filter ? filter : {}),
316
- query: filter && filter.query ? filter.query : baseQuery
317
- };
318
- this.store.dispatch(read(this.config.entity, fullFilter));
319
- }
320
- clear() {
321
- this.store.dispatch(clear(this.config.entity));
322
- }
323
- select(id) {
324
- this.store.dispatch(select(this.config.entity, id));
325
- }
326
- unselect() {
327
- this.store.dispatch(unselect(this.config.entity));
328
- }
329
- multiSelect(items) {
330
- this.store.dispatch(multiSelect(this.config.entity, items));
331
- }
332
- update(item) {
333
- this.getStore().dispatch(update(this.config.entity, item));
334
- }
335
- export(filter = null, format = null) {
336
- this.getStore().dispatch(exportList(this.config.entity, filter, format));
337
- }
338
- updatePartial(item) {
339
- this.getStore().dispatch(updatePartial(this.config.entity, item));
340
- }
341
- updatePartialMany(items) {
342
- this.getStore().dispatch(updatePartialMany(this.config.entity, items));
343
- }
344
- delete(id) {
345
- this.getStore().dispatch(deleteItem(this.config.entity, id));
346
- }
347
- getStore() {
348
- if (NgrxStoreService.store)
349
- return NgrxStoreService.store;
350
- return this.store;
351
- }
352
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFacade, deps: [{ token: i1.Store }, { token: CrudConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
353
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFacade }); }
354
- }
355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFacade, decorators: [{
356
- type: Injectable
357
- }], ctorParameters: function () { return [{ type: i1.Store }, { type: CrudConfig }]; } });
358
-
359
- class ExportComponent extends BaseComponent$1 {
360
- constructor(facade, popoverService, styleService, elementRef) {
361
- super();
362
- this.facade = facade;
363
- this.popoverService = popoverService;
364
- this.styleService = styleService;
365
- this.elementRef = elementRef;
366
- this.buttonExportCsvOptions = this.initButtonExportOptions('csv');
367
- this.buttonExportXlsxOptions = this.initButtonExportOptions('xlsx');
368
- this.loading$ = this.facade.loading$;
369
- }
370
- ngOnInit() {
371
- this.styleService.init(this.elementRef);
372
- }
373
- initButtonExportOptions(format) {
374
- return {
375
- click: () => {
376
- this.facade.export({
377
- ...this.facade.filter,
378
- offset: null,
379
- limit: null
380
- }, format);
381
- const subscription = this.facade.loaded$.subscribe(val => {
382
- if (!val)
383
- return;
384
- this.popoverService.close();
385
- subscription.unsubscribe();
386
- });
387
- },
388
- loading$: this.facade.loading$,
389
- expand: 'block'
390
- };
391
- }
392
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ExportComponent, deps: [{ token: CrudFacade }, { token: i3.PopoverService }, { token: i3.StyleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
393
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: ExportComponent, selector: "smart-crud-export", usesInheritance: true, ngImport: i0, 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>", styles: [".smart-content{padding:1.2rem}.smart-content p{margin:.6rem 0}.smart-content smart-button{width:100%;display:block}\n"], dependencies: [{ kind: "component", type: i3.ButtonComponent, selector: "smart-button", inputs: ["options", "disabled"] }] }); }
394
- }
395
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ExportComponent, decorators: [{
396
- type: Component,
397
- args: [{ selector: 'smart-crud-export', 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>", styles: [".smart-content{padding:1.2rem}.smart-content p{margin:.6rem 0}.smart-content smart-button{width:100%;display:block}\n"] }]
398
- }], ctorParameters: function () { return [{ type: CrudFacade }, { type: i3.PopoverService }, { type: i3.StyleService }, { type: i0.ElementRef }]; } });
399
-
400
- /**
401
- * @deprecated - please, use IModelPossibilitiesProvider from @smartsoft001/angular
402
- */
403
- class ICrudModelPossibilitiesProvider {
404
- }
405
- /**
406
- * @deprecated - please, use MODEL_POSSIBILITIES_PROVIDER from @smartsoft001/angular
407
- */
408
- const CRUD_MODEL_POSSIBILITIES_PROVIDER = new InjectionToken("CRUD_MODEL_POSSIBILITIES_PROVIDER");
409
-
410
- class BaseComponent {
411
- get value() {
412
- if (this.isArrayType()) {
413
- return this.filter.query
414
- .filter((q) => q.key === this.item.key && q.type === this.item.type)
415
- .map(q => q.value);
416
- }
417
- const query = this.filter.query.find((q) => q.key === this.item.key && q.type === this.item.type);
418
- return query?.value;
419
- }
420
- set value(val) {
421
- this.refresh(val);
422
- }
423
- get minValue() {
424
- if (this.isArrayType()) {
425
- return this.filter.query
426
- .filter((q) => q.key === this.item.key && q.type === ">=")
427
- .map(q => q.value);
428
- }
429
- const query = this.filter.query.find((q) => q.key === this.item.key && q.type === ">=");
430
- return query?.value;
431
- }
432
- set minValue(val) {
433
- this.refresh(val, ">=");
434
- }
435
- get maxValue() {
436
- if (this.isArrayType()) {
437
- return this.filter.query
438
- .filter((q) => q.key === this.item.key && q.type === "<=")
439
- .map(q => q.value);
440
- }
441
- const query = this.filter.query.find((q) => q.key === this.item.key && q.type === "<=");
442
- return query?.value;
443
- }
444
- set maxValue(val) {
445
- this.refresh(val, "<=");
446
- }
447
- get lang() {
448
- return this.translateService.currentLang;
449
- }
450
- constructor(facade, config, modelPossibilitiesProvider, translateService) {
451
- this.facade = facade;
452
- this.config = config;
453
- this.modelPossibilitiesProvider = modelPossibilitiesProvider;
454
- this.translateService = translateService;
455
- }
456
- refresh(val, type = null) {
457
- if (!type)
458
- type = this.item.type;
459
- this.filter.offset = 0;
460
- if (this.isArrayType()) {
461
- this.refreshForArray(val, type);
462
- return;
463
- }
464
- let query = this.filter.query.find((q) => q.key === this.item.key && q.type === type);
465
- if (val === null || val === undefined || val === '') {
466
- const index = this.filter.query.indexOf(query);
467
- if (index > -1) {
468
- this.filter.query.splice(index, 1);
469
- }
470
- this.facade.read(this.filter);
471
- return;
472
- }
473
- if (!query) {
474
- query = {
475
- key: this.item.key,
476
- type: type,
477
- value: null,
478
- };
479
- this.filter.query.push(query);
480
- }
481
- query.value = val;
482
- query.label = this.item.label;
483
- this.facade.read(this.filter);
484
- }
485
- clear() {
486
- this.filter.query = this.filter.query.filter((q) => q.key !== this.item.key);
487
- this.filter.offset = 0;
488
- this.facade.read(this.filter);
489
- }
490
- ngOnInit() {
491
- this.initPossibilities();
492
- }
493
- initPossibilities() {
494
- let possibilities = this.item.possibilities$;
495
- if (this.modelPossibilitiesProvider) {
496
- const possibilitiesFromProvider = this.modelPossibilitiesProvider.get(this.config.type);
497
- if (possibilitiesFromProvider && possibilitiesFromProvider[this.item.key])
498
- possibilities = possibilitiesFromProvider[this.item.key];
499
- }
500
- this.possibilities$ = possibilities;
501
- }
502
- isArrayType() {
503
- return (this.item?.fieldType === FieldType.check);
504
- }
505
- refreshForArray(vals, type) {
506
- const queries = this.filter.query.filter((q) => q.key === this.item.key && q.type === type);
507
- queries.forEach(query => {
508
- const index = this.filter.query.indexOf(query);
509
- if (index > -1) {
510
- this.filter.query.splice(index, 1);
511
- }
512
- });
513
- if (vals === null || vals === undefined || !vals.length) {
514
- this.facade.read(this.filter);
515
- return;
516
- }
517
- vals.forEach(val => {
518
- const query = {
519
- key: this.item.key,
520
- type: type,
521
- value: val,
522
- };
523
- this.filter.query.push(query);
524
- });
525
- this.facade.read(this.filter);
526
- }
527
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: BaseComponent, deps: [{ token: CrudFacade }, { token: CrudConfig }, { token: CRUD_MODEL_POSSIBILITIES_PROVIDER, optional: true }, { token: i4.TranslateService }], target: i0.ɵɵFactoryTarget.Directive }); }
528
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: BaseComponent, inputs: { item: "item", filter: "filter" }, ngImport: i0 }); }
529
- }
530
- __decorate([
531
- Debounce(500),
532
- __metadata("design:type", Function),
533
- __metadata("design:paramtypes", [Object, Object]),
534
- __metadata("design:returntype", void 0)
535
- ], BaseComponent.prototype, "refresh", null);
536
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: BaseComponent, decorators: [{
537
- type: Directive
538
- }], ctorParameters: function () { return [{ type: CrudFacade }, { type: CrudConfig }, { type: ICrudModelPossibilitiesProvider, decorators: [{
539
- type: Optional
540
- }, {
541
- type: Inject,
542
- args: [CRUD_MODEL_POSSIBILITIES_PROVIDER]
543
- }] }, { type: i4.TranslateService }]; }, propDecorators: { item: [{
544
- type: Input
545
- }], filter: [{
546
- type: Input
547
- }], refresh: [] } });
548
-
549
- class FilterTextComponent extends BaseComponent {
550
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
551
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterTextComponent, selector: "smart-crud-filter-text", usesInheritance: true, ngImport: i0, 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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
552
- }
553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterTextComponent, decorators: [{
554
- type: Component,
555
- args: [{ selector: 'smart-crud-filter-text', 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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
556
- }] });
557
-
558
- class FilterDateComponent extends BaseComponent {
559
- constructor() {
560
- super(...arguments);
561
- this.id = GuidService.create();
562
- }
563
- get allowAdvanced() {
564
- return this.item?.type === '=';
565
- }
566
- set customValue(val) {
567
- const momentDate = moment(val);
568
- this.value = val?.length >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
569
- }
570
- get customValue() {
571
- return this.value;
572
- }
573
- set customMinValue(val) {
574
- const momentDate = moment(val);
575
- this.minValue = val?.length >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
576
- }
577
- get customMinValue() {
578
- return this.minValue;
579
- }
580
- set customMaxValue(val) {
581
- const momentDate = moment(val);
582
- this.maxValue = val?.length >= 10 && momentDate.isValid() ? momentDate.format('YYYY-MM-DD') : val;
583
- }
584
- get customMaxValue() {
585
- return this.maxValue;
586
- }
587
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterDateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
588
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterDateComponent, selector: "smart-crud-filter-date", usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-item button=\"true\" id=\"open-date-input-{{ id }}\" color=\"primary\">\n <ion-text>{{ customValue ? customValue : ('select' | translate) }}</ion-text>\n <ion-popover trigger=\"open-date-input-{{ id }}\" show-backdrop=\"false\">\n <ng-template>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n presentation=\"date\"\n ></ion-datetime>\n </ng-template>\n </ion-popover>\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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonDatetime, selector: "ion-datetime", inputs: ["cancelText", "clearText", "color", "dayValues", "disabled", "doneText", "firstDayOfWeek", "highlightedDates", "hourCycle", "hourValues", "isDateEnabled", "locale", "max", "min", "minuteValues", "mode", "monthValues", "multiple", "name", "preferWheel", "presentation", "readonly", "showClearButton", "showDefaultButtons", "showDefaultTimeLabel", "showDefaultTitle", "size", "titleSelectedDatesFormatter", "value", "yearValues"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "component", type: i2.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "component", type: i2.IonPopover, selector: "ion-popover", inputs: ["alignment", "animated", "arrow", "keepContentsMounted", "backdropDismiss", "cssClass", "dismissOnSelect", "enterAnimation", "event", "isOpen", "keyboardClose", "leaveAnimation", "mode", "showBackdrop", "translucent", "trigger", "triggerAction", "reference", "size", "side"] }, { kind: "directive", type: i2.SelectValueAccessor, selector: "ion-range, ion-select, ion-radio-group, ion-segment, ion-datetime" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
589
- }
590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterDateComponent, decorators: [{
591
- type: Component,
592
- args: [{ selector: 'smart-crud-filter-date', template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n <ion-item button=\"true\" id=\"open-date-input-{{ id }}\" color=\"primary\">\n <ion-text>{{ customValue ? customValue : ('select' | translate) }}</ion-text>\n <ion-popover trigger=\"open-date-input-{{ id }}\" show-backdrop=\"false\">\n <ng-template>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n presentation=\"date\"\n ></ion-datetime>\n </ng-template>\n </ion-popover>\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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
593
- }] });
594
-
595
- class FilterDateWithEditComponent extends FilterDateComponent {
596
- constructor() {
597
- super(...arguments);
598
- this._subscriptions = new Subscription();
599
- this.advanced = false;
600
- this.id = GuidService.create();
601
- }
602
- toggleAdvanced() {
603
- this.advanced = !this.advanced;
604
- if (this.advanced)
605
- this.value = null;
606
- }
607
- ngOnInit() {
608
- super.ngOnInit();
609
- if (this.dateTimePicker) {
610
- this._subscriptions.add(this.dateTimePicker.ionChange.subscribe((val) => {
611
- this.customValue = val.detail.value;
612
- }));
613
- }
614
- else {
615
- console.error('dateTimePicker not found!');
616
- }
617
- }
618
- ngOnDestroy() {
619
- if (this._subscriptions) {
620
- this._subscriptions.unsubscribe();
621
- }
622
- }
623
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterDateWithEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
624
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterDateWithEditComponent, selector: "smart-crud-filter-date-with-edit", viewQueries: [{ propertyName: "dateTimePicker", first: true, predicate: IonDatetime, descendants: true, read: IonDatetime }], usesInheritance: true, ngImport: i0, 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 *ngIf=\"!advanced\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"!advanced\">\n <ion-button id=\"open-date-input-{{ id }}\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"calendar-outline\"></ion-icon>\n <ion-popover trigger=\"open-date-input-{{ id }}\" show-backdrop=\"false\">\n <ng-template>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n presentation=\"date\"\n first-day-of-week=\"1\"\n locale=\"{{ lang }}\"\n ></ion-datetime>\n </ng-template>\n </ion-popover>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"toggleAdvanced()\" 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 || minValue || maxValue\">\n <ion-button color=\"danger\" (click)=\"clear()\" 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-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-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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonDatetime, selector: "ion-datetime", inputs: ["cancelText", "clearText", "color", "dayValues", "disabled", "doneText", "firstDayOfWeek", "highlightedDates", "hourCycle", "hourValues", "isDateEnabled", "locale", "max", "min", "minuteValues", "mode", "monthValues", "multiple", "name", "preferWheel", "presentation", "readonly", "showClearButton", "showDefaultButtons", "showDefaultTimeLabel", "showDefaultTitle", "size", "titleSelectedDatesFormatter", "value", "yearValues"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "component", type: i2.IonPopover, selector: "ion-popover", inputs: ["alignment", "animated", "arrow", "keepContentsMounted", "backdropDismiss", "cssClass", "dismissOnSelect", "enterAnimation", "event", "isOpen", "keyboardClose", "leaveAnimation", "mode", "showBackdrop", "translucent", "trigger", "triggerAction", "reference", "size", "side"] }, { kind: "directive", type: i2.SelectValueAccessor, selector: "ion-range, ion-select, ion-radio-group, ion-segment, ion-datetime" }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
625
- }
626
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterDateWithEditComponent, decorators: [{
627
- type: Component,
628
- args: [{ selector: 'smart-crud-filter-date-with-edit', 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 *ngIf=\"!advanced\"\n [pattern]=\"'([12]\\\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\\\d|3[01]))'\"\n ></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"!advanced\">\n <ion-button id=\"open-date-input-{{ id }}\" class=\"squere-button\">\n <ion-icon slot=\"icon-only\" name=\"calendar-outline\"></ion-icon>\n <ion-popover trigger=\"open-date-input-{{ id }}\" show-backdrop=\"false\">\n <ng-template>\n <ion-datetime displayFormat=\"YYYY-MM-DD\"\n pickerFormat=\"YYYY-MM-DD\"\n [(ngModel)]=\"customValue\"\n presentation=\"date\"\n first-day-of-week=\"1\"\n locale=\"{{ lang }}\"\n ></ion-datetime>\n </ng-template>\n </ion-popover>\n </ion-button>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"toggleAdvanced()\" 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 || minValue || maxValue\">\n <ion-button color=\"danger\" (click)=\"clear()\" 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-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-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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
629
- }], propDecorators: { dateTimePicker: [{
630
- type: ViewChild,
631
- args: [IonDatetime, { read: IonDatetime, static: false }]
632
- }] } });
633
-
634
- class FilterDateTimeComponent extends FilterDateComponent {
635
- constructor() {
636
- super(...arguments);
637
- this._subscriptions = new Subscription();
638
- this.id = GuidService.create();
639
- }
640
- ngOnInit() {
641
- super.ngOnInit();
642
- if (this.dateTimePicker) {
643
- this._subscriptions.add(this.dateTimePicker.ionChange.subscribe((val) => {
644
- this.customValue = val.detail.value;
645
- }));
646
- }
647
- else {
648
- console.error('dateTimePicker not found!');
649
- }
650
- }
651
- ngOnDestroy() {
652
- if (this._subscriptions) {
653
- this._subscriptions.unsubscribe();
654
- }
655
- }
656
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterDateTimeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
657
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterDateTimeComponent, selector: "smart-crud-filter-date-time", viewQueries: [{ propertyName: "dateTimePicker", first: true, predicate: IonDatetime, descendants: true, read: IonDatetime }], usesInheritance: true, ngImport: i0, template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value || minValue || maxValue\">\n <ion-button color=\"danger\" (click)=\"clear()\" 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>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD HH:mm:ss\"\n [(ngModel)]=\"customMinValue\"\n pattern=\"^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$\"\n ></ion-input>\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 HH:mm:ss\"\n [(ngModel)]=\"customMaxValue\"\n pattern=\"^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$\"\n ></ion-input>\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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "directive", type: i2.TextValueAccessor, selector: "ion-input:not([type=number]),ion-textarea,ion-searchbar" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
658
- }
659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterDateTimeComponent, decorators: [{
660
- type: Component,
661
- args: [{ selector: 'smart-crud-filter-date-time', template: "<ion-row>\n <ion-col>\n <ion-label>\n {{ item.label | translate }}\n </ion-label>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"value || minValue || maxValue\">\n <ion-button color=\"danger\" (click)=\"clear()\" 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>\n <ion-col>\n <ion-item>\n <ion-label>\n {{ 'from' | translate }}\n </ion-label>\n <ion-input placeholder=\"YYYY-MM-DD HH:mm:ss\"\n [(ngModel)]=\"customMinValue\"\n pattern=\"^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$\"\n ></ion-input>\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 HH:mm:ss\"\n [(ngModel)]=\"customMaxValue\"\n pattern=\"^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$\"\n ></ion-input>\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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
662
- }], propDecorators: { dateTimePicker: [{
663
- type: ViewChild,
664
- args: [IonDatetime, { read: IonDatetime, static: false }]
665
- }] } });
666
-
667
- class FilterRadioComponent extends BaseComponent {
668
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
669
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterRadioComponent, selector: "smart-crud-filter-radio", usesInheritance: true, ngImport: i0, 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 || value === false\" 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>", 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"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRadio, selector: "ion-radio", inputs: ["color", "disabled", "justify", "labelPlacement", "legacy", "mode", "name", "value"] }, { kind: "component", type: i2.IonRadioGroup, selector: "ion-radio-group", inputs: ["allowEmptySelection", "name", "value"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "directive", type: i2.RadioValueAccessor, selector: "ion-radio" }, { kind: "directive", type: i2.SelectValueAccessor, selector: "ion-range, ion-select, ion-radio-group, ion-segment, ion-datetime" }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] }); }
670
- }
671
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterRadioComponent, decorators: [{
672
- type: Component,
673
- args: [{ selector: 'smart-crud-filter-radio', 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 || value === false\" 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>", 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"] }]
674
- }] });
675
-
676
- class FilterFlagComponent extends BaseComponent {
677
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterFlagComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
678
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterFlagComponent, selector: "smart-crud-filter-flag", usesInheritance: true, ngImport: i0, 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 === true || value === false\">\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>", 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"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCheckbox, selector: "ion-checkbox", inputs: ["checked", "color", "disabled", "indeterminate", "justify", "labelPlacement", "legacy", "mode", "name", "value"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "directive", type: i2.BooleanValueAccessor, selector: "ion-checkbox,ion-toggle" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
679
- }
680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterFlagComponent, decorators: [{
681
- type: Component,
682
- args: [{ selector: 'smart-crud-filter-flag', 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 === true || value === false\">\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>", 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"] }]
683
- }] });
684
-
685
- class FilterCheckComponent extends BaseComponent {
686
- ngAfterContentInit() {
687
- this.list$ = combineLatest([this.possibilities$, this.facade.filter$]).pipe((map(([possibilities]) => {
688
- return possibilities.map(pos => ({
689
- value: pos,
690
- isCheck: this.value.some(r => r === pos.id)
691
- }));
692
- })));
693
- }
694
- onCheckChange(checked, entry) {
695
- if (checked && !this.value.some(r => r === entry.value.id)) {
696
- this.value = [
697
- ...this.value,
698
- entry.value.id
699
- ];
700
- }
701
- if (!checked && this.value.some(r => r === entry.value.id)) {
702
- this.value = this.value.filter(r => r !== entry.value.id);
703
- }
704
- }
705
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterCheckComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
706
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterCheckComponent, selector: "smart-crud-filter-check", usesInheritance: true, ngImport: i0, 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>", 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"], dependencies: [{ kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCheckbox, selector: "ion-checkbox", inputs: ["checked", "color", "disabled", "indeterminate", "justify", "labelPlacement", "legacy", "mode", "name", "value"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "directive", type: i2.BooleanValueAccessor, selector: "ion-checkbox,ion-toggle" }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] }); }
707
- }
708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterCheckComponent, decorators: [{
709
- type: Component,
710
- args: [{ selector: 'smart-crud-filter-check', 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>", 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"] }]
711
- }] });
712
-
713
- class FilterIntComponent extends BaseComponent {
714
- constructor() {
715
- super(...arguments);
716
- this._subscriptions = new Subscription();
717
- this.advanced = false;
718
- }
719
- get allowAdvanced() {
720
- return this.item?.type === '=';
721
- }
722
- ngOnInit() {
723
- super.ngOnInit();
724
- }
725
- ngOnDestroy() {
726
- if (this._subscriptions) {
727
- this._subscriptions.unsubscribe();
728
- }
729
- }
730
- toggleAdvanced() {
731
- this.advanced = !this.advanced;
732
- if (this.advanced)
733
- this.value = null;
734
- }
735
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterIntComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
736
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterIntComponent, selector: "smart-crud-filter-int", usesInheritance: true, ngImport: i0, 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\" *ngIf=\"!advanced\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"toggleAdvanced()\" 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 || minValue || maxValue\">\n <ion-button color=\"danger\" (click)=\"clear()\" 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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"], dependencies: [{ kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "legacy", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "directive", type: i2.NumericValueAccessor, selector: "ion-input[type=number]" }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
737
- }
738
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterIntComponent, decorators: [{
739
- type: Component,
740
- args: [{ selector: 'smart-crud-filter-int', 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\" *ngIf=\"!advanced\"></ion-input>\n </ion-col>\n <ion-col size=\"auto\" *ngIf=\"allowAdvanced\">\n <ion-button (click)=\"toggleAdvanced()\" 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 || minValue || maxValue\">\n <ion-button color=\"danger\" (click)=\"clear()\" 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>", styles: [":host{width:100%}:host .squere-button{height:var(--smart-button-height)!important;margin:.8rem}\n"] }]
741
- }] });
742
-
743
- class FilterComponent {
744
- constructor() {
745
- this.FieldType = FieldType;
746
- }
747
- ngOnInit() { }
748
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
749
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FilterComponent, selector: "smart-crud-filter", inputs: { item: "item", filter: "filter" }, ngImport: i0, 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-date-time\n *ngSwitchCase=\"FieldType.dateTime\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date-time>\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", styles: [""], dependencies: [{ kind: "component", type: i2.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "directive", type: i3$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: FilterTextComponent, selector: "smart-crud-filter-text" }, { kind: "component", type: FilterDateComponent, selector: "smart-crud-filter-date" }, { kind: "component", type: FilterDateWithEditComponent, selector: "smart-crud-filter-date-with-edit" }, { kind: "component", type: FilterDateTimeComponent, selector: "smart-crud-filter-date-time" }, { kind: "component", type: FilterRadioComponent, selector: "smart-crud-filter-radio" }, { kind: "component", type: FilterFlagComponent, selector: "smart-crud-filter-flag" }, { kind: "component", type: FilterCheckComponent, selector: "smart-crud-filter-check" }, { kind: "component", type: FilterIntComponent, selector: "smart-crud-filter-int" }] }); }
750
- }
751
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FilterComponent, decorators: [{
752
- type: Component,
753
- args: [{ selector: "smart-crud-filter", 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-date-time\n *ngSwitchCase=\"FieldType.dateTime\"\n [item]=\"item\"\n [filter]=\"filter\"\n ></smart-crud-filter-date-time>\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
- }], ctorParameters: function () { return []; }, propDecorators: { item: [{
755
- type: Input
756
- }], filter: [{
757
- type: Input
758
- }] } });
759
-
760
- /**
761
- * This component is only to use in crud module
762
- * @requires CrudModule
763
- * @example
764
- *
765
- * html: <smart-crud-filters></smart-crud-filters>
766
- *
767
- * use on the model:
768
- * @Model({
769
- titleKey: 'body',
770
- filters: [
771
- {
772
- label: 'testNegation',
773
- key: 'body',
774
- type: '!=',
775
- },
776
- {
777
- label: 'fromDate',
778
- key: 'createDate',
779
- type: '<=',
780
- fieldType: FieldType.dateWithEdit
781
- },
782
- {
783
- label: 'select',
784
- key: 'type',
785
- type: '=',
786
- fieldType: FieldType.radio,
787
- possibilities$: of([
788
- {
789
- id: 1, text: 'Test 1'
790
- },
791
- {
792
- id: 2, text: 'Test 2'
793
- }
794
- ])
795
- }
796
- ]
797
- })
798
- *
799
- * use on the field (list.filter property):
800
- * @Field({
801
- create: modifyMetdata,
802
- update: {
803
- ...modifyMetdata,
804
- multi: true
805
- },
806
- type: FieldType.longText,
807
- details: true,
808
- list: {
809
- order: 2,
810
- filter: true
811
- }
812
- })
813
- body: string;
814
- */
815
- class FiltersComponent {
816
- constructor(menuService, config, facade, styleService, elementRef) {
817
- this.menuService = menuService;
818
- this.config = config;
819
- this.facade = facade;
820
- this.styleService = styleService;
821
- this.elementRef = elementRef;
822
- }
823
- async onClose() {
824
- await this.menuService.closeEnd();
825
- }
826
- ngOnInit() {
827
- this.styleService.init(this.elementRef);
828
- const modelFilters = getModelOptions(this.config.type).filters;
829
- this.list = [
830
- ...(modelFilters ? modelFilters.map(item => {
831
- if (!item.label) {
832
- item.label = 'MODEL.' + item.key;
833
- }
834
- return item;
835
- }) : []),
836
- ...getModelFieldsWithOptions(new this.config.type())
837
- .filter(item => item.options?.list?.filter)
838
- .map(item => ({
839
- key: item.key,
840
- type: item.options.type === FieldType.text || item.options.type === FieldType.longText
841
- ? '~=' : '=',
842
- label: 'MODEL.' + item.key,
843
- fieldType: item.options.type
844
- }))
845
- ];
846
- this.filter$ = this.facade.filter$;
847
- }
848
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FiltersComponent, deps: [{ token: i3.MenuService }, { token: CrudConfig }, { token: CrudFacade }, { token: i3.StyleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
849
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FiltersComponent, selector: "smart-crud-filters", inputs: { hideMenu: "hideMenu" }, ngImport: i0, 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<ion-content style=\"height: 100vh;\">\n <ion-list>\n <ng-container *ngFor=\"let item of list\">\n <smart-crud-filter [item]=\"item\" [filter]=\"filter$ | async\"></smart-crud-filter>\n </ng-container>\n </ion-list>\n <div class=\"menu-bottom-space\">\n &nbsp;\n </div>\n</ion-content>", 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 .menu-bottom-space{height:75px}\n"], dependencies: [{ kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i2.IonContent, selector: "ion-content", inputs: ["color", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i2.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: i2.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: i2.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: FilterComponent, selector: "smart-crud-filter", inputs: ["item", "filter"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] }); }
850
- }
851
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FiltersComponent, decorators: [{
852
- type: Component,
853
- args: [{ selector: 'smart-crud-filters', 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<ion-content style=\"height: 100vh;\">\n <ion-list>\n <ng-container *ngFor=\"let item of list\">\n <smart-crud-filter [item]=\"item\" [filter]=\"filter$ | async\"></smart-crud-filter>\n </ng-container>\n </ion-list>\n <div class=\"menu-bottom-space\">\n &nbsp;\n </div>\n</ion-content>", 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 .menu-bottom-space{height:75px}\n"] }]
854
- }], ctorParameters: function () { return [{ type: i3.MenuService }, { type: CrudConfig }, { type: CrudFacade }, { type: i3.StyleService }, { type: i0.ElementRef }]; }, propDecorators: { hideMenu: [{
855
- type: Input
856
- }] } });
857
-
858
- class FiltersConfigComponent {
859
- constructor(facade, styleService, elementRef) {
860
- this.facade = facade;
861
- this.styleService = styleService;
862
- this.elementRef = elementRef;
863
- }
864
- onRemoveQuery(item) {
865
- const index = this.facade.filter.query.indexOf(item);
866
- if (index > -1) {
867
- this.facade.filter.query.splice(index, 1);
868
- }
869
- this.facade.read(this.facade.filter);
870
- }
871
- ngOnInit() {
872
- this.styleService.init(this.elementRef);
873
- this.query$ = this.facade.filter$.pipe(map(filter => {
874
- return filter?.query?.filter(i => !i.hidden);
875
- }));
876
- }
877
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FiltersConfigComponent, deps: [{ token: CrudFacade }, { token: i3.StyleService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
878
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: FiltersConfigComponent, selector: "smart-crud-filters-config", ngImport: i0, 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>", styles: [":host ion-label{font-size:calc(var(--default-font-size) - 2px)}\n"], dependencies: [{ kind: "component", type: i2.IonChip, selector: "ion-chip", inputs: ["color", "disabled", "mode", "outline"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] }); }
879
- }
880
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FiltersConfigComponent, decorators: [{
881
- type: Component,
882
- args: [{ selector: 'smart-crud-filters-config', 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>", styles: [":host ion-label{font-size:calc(var(--default-font-size) - 2px)}\n"] }]
883
- }], ctorParameters: function () { return [{ type: CrudFacade }, { type: i3.StyleService }, { type: i0.ElementRef }]; } });
884
-
885
- class FormOptionsPipe {
886
- constructor(modelPossibilitiesProvider) {
887
- this.modelPossibilitiesProvider = modelPossibilitiesProvider;
888
- }
889
- transform(item, mode, type, uniqueProvider, inputComponents) {
890
- if (!mode || !type)
891
- return null;
892
- let possibilities = {};
893
- if (type && this.modelPossibilitiesProvider) {
894
- possibilities = this.modelPossibilitiesProvider.get(type);
895
- }
896
- if (mode === "create") {
897
- return {
898
- mode: "create",
899
- possibilities,
900
- inputComponents,
901
- uniqueProvider,
902
- model: new type(),
903
- };
904
- }
905
- else {
906
- const model = new type();
907
- if (item) {
908
- Object.keys(item).forEach((key) => {
909
- model[key] = item[key];
910
- });
911
- }
912
- return {
913
- mode: mode,
914
- uniqueProvider,
915
- possibilities: possibilities,
916
- inputComponents,
917
- model: model,
918
- };
919
- }
920
- }
921
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FormOptionsPipe, deps: [{ token: CRUD_MODEL_POSSIBILITIES_PROVIDER, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }
922
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: FormOptionsPipe, name: "smartFormOptions" }); }
923
- }
924
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: FormOptionsPipe, decorators: [{
925
- type: Pipe,
926
- args: [{
927
- name: "smartFormOptions",
928
- }]
929
- }], ctorParameters: function () { return [{ type: ICrudModelPossibilitiesProvider, decorators: [{
930
- type: Optional
931
- }, {
932
- type: Inject,
933
- args: [CRUD_MODEL_POSSIBILITIES_PROVIDER]
934
- }] }]; } });
935
-
936
- class MultiselectComponent {
937
- constructor(facade, config, menuService) {
938
- this.facade = facade;
939
- this.config = config;
940
- this.menuService = menuService;
941
- this.buttonOptions = {
942
- click: async () => {
943
- const result = this._list.map(item => {
944
- return {
945
- ...this._changes,
946
- id: item.id
947
- };
948
- });
949
- this.facade.updatePartialMany(result);
950
- await this.menuService.closeEnd();
951
- },
952
- confirm: true
953
- };
954
- this.showForm = false;
955
- this.list$ = this.facade.multiSelected$.pipe(tap(list => {
956
- this.lock = true;
957
- const model = new this.config.type();
958
- const fieldsWithOptions = getModelFieldsWithOptions(model)
959
- .filter(f => f.options.update?.multi);
960
- this.showForm = !!fieldsWithOptions.length;
961
- fieldsWithOptions.forEach(({ key }) => {
962
- const uniques = _.uniq(list.map(i => i[key]));
963
- if (uniques.length === 1) {
964
- model[key] = uniques[0];
965
- }
966
- });
967
- this.item = model;
968
- }));
969
- }
970
- async onClose() {
971
- await this.menuService.closeEnd();
972
- }
973
- onPartialChange(changes, list) {
974
- this.lock = false;
975
- this._list = list;
976
- this._changes = changes;
977
- }
978
- onValidChange(valid) {
979
- this.valid = valid;
980
- }
981
- ngOnInit() {
982
- }
983
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: MultiselectComponent, deps: [{ token: CrudFacade }, { token: CrudFullConfig }, { token: i3.MenuService }], target: i0.ɵɵFactoryTarget.Component }); }
984
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: MultiselectComponent, selector: "smart-crud-multiselect", ngImport: i0, 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=\"config?.list?.components?.multi\">\n <ng-template [ngComponentOutlet]=\"config?.list?.components?.multi\"\n [ndcDynamicInputs]=\"{ items: list }\"\n ></ng-template>\n </div>\n\n <div *ngIf=\"showForm && 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>", 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"], dependencies: [{ kind: "component", type: i2.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i2.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i2.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: i2.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "directive", type: i3$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "smart-form", inputs: ["options"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }, { kind: "component", type: i3.ButtonComponent, selector: "smart-button", inputs: ["options", "disabled"] }, { kind: "directive", type: i6.DynamicIoDirective, selector: "[ndcDynamicInputs],[ndcDynamicOutputs]", inputs: ["ndcDynamicInputs", "ndcDynamicOutputs"], exportAs: ["ndcDynamicIo"] }, { kind: "directive", type: i6.ComponentOutletInjectorDirective, selector: "[ngComponentOutlet]", exportAs: ["ndcComponentOutletInjector"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: FormOptionsPipe, name: "smartFormOptions" }] }); }
985
- }
986
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: MultiselectComponent, decorators: [{
987
- type: Component,
988
- args: [{ selector: 'smart-crud-multiselect', 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=\"config?.list?.components?.multi\">\n <ng-template [ngComponentOutlet]=\"config?.list?.components?.multi\"\n [ndcDynamicInputs]=\"{ items: list }\"\n ></ng-template>\n </div>\n\n <div *ngIf=\"showForm && 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>", 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"] }]
989
- }], ctorParameters: function () { return [{ type: CrudFacade }, { type: CrudFullConfig }, { type: i3.MenuService }]; } });
990
-
991
- class CrudListGroupService {
992
- constructor(facade) {
993
- this.facade = facade;
994
- this._destroyed = [];
995
- }
996
- change(val, item, groups, force) {
997
- if (val || force) {
998
- item.changed = true;
999
- let current = this.facade.filter.query.find(q => q.key === item.key && q.type === '=');
1000
- if (!current) {
1001
- current = {
1002
- key: item.key,
1003
- type: "=",
1004
- value: null
1005
- };
1006
- this.facade.filter.query.push(current);
1007
- }
1008
- current.value = item.value;
1009
- current.hidden = true;
1010
- this.facade.read({
1011
- ...this.facade.filter,
1012
- offset: 0
1013
- });
1014
- }
1015
- }
1016
- destroy(groups) {
1017
- this._destroyed = [
1018
- ...(this._destroyed ? this._destroyed : []),
1019
- ...groups.filter(g => g.changed)
1020
- ];
1021
- this.refresh();
1022
- }
1023
- refresh() {
1024
- const list = this._destroyed;
1025
- this._destroyed = [];
1026
- const newQuery = this.facade.filter.query.filter(q => !list.some(i => q.key === i.key));
1027
- this.facade.read({
1028
- ...this.facade.filter,
1029
- query: newQuery,
1030
- });
1031
- }
1032
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListGroupService, deps: [{ token: CrudFacade }], target: i0.ɵɵFactoryTarget.Injectable }); }
1033
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListGroupService }); }
1034
- }
1035
- __decorate([
1036
- debounce(250),
1037
- __metadata("design:type", Function),
1038
- __metadata("design:paramtypes", []),
1039
- __metadata("design:returntype", void 0)
1040
- ], CrudListGroupService.prototype, "refresh", null);
1041
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListGroupService, decorators: [{
1042
- type: Injectable
1043
- }], ctorParameters: function () { return [{ type: CrudFacade }]; }, propDecorators: { refresh: [] } });
1044
-
1045
- class GroupComponent extends BaseComponent$1 {
1046
- constructor(styleService, elementRef, facade, cd, groupService) {
1047
- super();
1048
- this.styleService = styleService;
1049
- this.elementRef = elementRef;
1050
- this.facade = facade;
1051
- this.cd = cd;
1052
- this.groupService = groupService;
1053
- }
1054
- change(val, item, force = false) {
1055
- this.groups.filter(i => i.value !== item.value || i.key !== item.key).forEach(i => {
1056
- i.show = false;
1057
- });
1058
- this.groupService.change(val, item, this.groups, force);
1059
- if (val) {
1060
- setTimeout(() => {
1061
- item.show = val;
1062
- this.cd.detectChanges();
1063
- });
1064
- }
1065
- else {
1066
- item.show = val;
1067
- this.cd.detectChanges();
1068
- }
1069
- }
1070
- ngOnInit() {
1071
- this.styleService.init(this.elementRef);
1072
- }
1073
- ngOnDestroy() {
1074
- this.groupService.destroy(this.groups);
1075
- super.ngOnDestroy();
1076
- }
1077
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupComponent, deps: [{ token: i3.StyleService }, { token: i0.ElementRef }, { token: CrudFacade }, { token: i0.ChangeDetectorRef }, { token: CrudListGroupService }], target: i0.ɵɵFactoryTarget.Component }); }
1078
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: GroupComponent, selector: "smart-crud-group", inputs: { groups: "groups", listOptions: "listOptions" }, usesInheritance: true, ngImport: i0, 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/>", styles: [".accordion-show{font-weight:bolder}\n"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.ListComponent, selector: "smart-list", inputs: ["options"] }, { kind: "component", type: i3.AccordionComponent, selector: "smart-accordion", inputs: ["show"], outputs: ["showChange"] }, { kind: "component", type: i3.AccordionHeaderComponent, selector: "smart-accordion-header" }, { kind: "component", type: i3.AccordionBodyComponent, selector: "smart-accordion-body" }, { kind: "component", type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
1079
- }
1080
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupComponent, decorators: [{
1081
- type: Component,
1082
- args: [{ selector: 'smart-crud-group', 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/>", styles: [".accordion-show{font-weight:bolder}\n"] }]
1083
- }], ctorParameters: function () { return [{ type: i3.StyleService }, { type: i0.ElementRef }, { type: CrudFacade }, { type: i0.ChangeDetectorRef }, { type: CrudListGroupService }]; }, propDecorators: { groups: [{
1084
- type: Input
1085
- }], listOptions: [{
1086
- type: Input
1087
- }] } });
1088
-
1089
- class SocketService {
1090
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: SocketService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1091
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: SocketService }); }
1092
- }
1093
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: SocketService, decorators: [{
1094
- type: Injectable
1095
- }] });
1096
- class NotSocketService {
1097
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: NotSocketService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1098
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: NotSocketService }); }
1099
- }
1100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: NotSocketService, decorators: [{
1101
- type: Injectable
1102
- }] });
1103
-
1104
- class CrudPipesModule {
1105
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1106
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: CrudPipesModule, declarations: [FormOptionsPipe], exports: [FormOptionsPipe] }); }
1107
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudPipesModule }); }
1108
- }
1109
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudPipesModule, decorators: [{
1110
- type: NgModule,
1111
- args: [{
1112
- declarations: [
1113
- FormOptionsPipe
1114
- ],
1115
- exports: [
1116
- FormOptionsPipe
1117
- ]
1118
- }]
1119
- }] });
1120
-
1121
- class CrudService {
1122
- constructor(config, http, socket) {
1123
- this.config = config;
1124
- this.http = http;
1125
- this.socket = socket;
1126
- this._formatMap = {
1127
- csv: "text/csv",
1128
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1129
- };
1130
- }
1131
- // changes(criteria: { id?: string } = {}): Observable<ItemChangedData> {
1132
- // this.socket.emit("changes", criteria);
1133
- // return this.socket.fromEvent("changes");
1134
- // }
1135
- // TODO : Location is null
1136
- create(item) {
1137
- return this.http
1138
- .post(this.config.apiUrl, item, { observe: "response" })
1139
- .pipe(map((response) => {
1140
- const location = response.headers["Location"];
1141
- if (!location)
1142
- return null;
1143
- const array = location.split("/");
1144
- return array[array.length - 1];
1145
- }));
1146
- }
1147
- createMany(items, options) {
1148
- return this.http.post(this.config.apiUrl + "/bulk?mode=" + options.mode, items);
1149
- }
1150
- getById(id) {
1151
- return this.http.get(this.config.apiUrl + "/" + id);
1152
- }
1153
- getList(filter = null) {
1154
- return this.http.get(this.config.apiUrl + this.getQuery(filter));
1155
- }
1156
- exportList(filter = null, format) {
1157
- if (!format) {
1158
- format = "csv";
1159
- }
1160
- if (format === "xlsx") {
1161
- return this.http
1162
- .get(this.config.apiUrl + this.getQuery(filter), {
1163
- headers: {
1164
- "Content-Type": this._formatMap[format],
1165
- },
1166
- observe: "response",
1167
- reportProgress: false,
1168
- responseType: "blob",
1169
- })
1170
- .pipe(map((res) => {
1171
- const downloadLink = document.createElement("a");
1172
- const blob = res.body;
1173
- const url = URL.createObjectURL(blob);
1174
- downloadLink.href = url;
1175
- downloadLink.download = "data." + format;
1176
- document.body.appendChild(downloadLink);
1177
- downloadLink.click();
1178
- document.body.removeChild(downloadLink);
1179
- }));
1180
- }
1181
- return this.http
1182
- .get(this.config.apiUrl + this.getQuery(filter), {
1183
- headers: {
1184
- "Content-Type": this._formatMap[format],
1185
- },
1186
- responseType: "text",
1187
- })
1188
- .pipe(map((res) => {
1189
- const downloadLink = document.createElement("a");
1190
- const blob = new Blob(["\ufeff", res]);
1191
- const url = URL.createObjectURL(blob);
1192
- downloadLink.href = url;
1193
- downloadLink.download = "data." + format;
1194
- document.body.appendChild(downloadLink);
1195
- downloadLink.click();
1196
- document.body.removeChild(downloadLink);
1197
- }));
1198
- }
1199
- update(item) {
1200
- return this.http.put(this.config.apiUrl + "/" + item.id, item);
1201
- }
1202
- updatePartial(item) {
1203
- return this.http.patch(this.config.apiUrl + "/" + item.id, item);
1204
- }
1205
- updatePartialMany(items) {
1206
- return forkJoin(items.map(item => {
1207
- return this.updatePartial(item);
1208
- }));
1209
- }
1210
- delete(id) {
1211
- return this.http.delete(this.config.apiUrl + "/" + id);
1212
- }
1213
- getQuery(filter) {
1214
- let query = "";
1215
- if (filter && filter.searchText) {
1216
- query += "&$search=" + filter.searchText;
1217
- }
1218
- if (filter && filter.limit) {
1219
- query += `&limit=${filter.limit}&offset=${filter.offset ? filter.offset : 0}`;
1220
- }
1221
- if (filter && filter.sortBy) {
1222
- query += `&sort=${(filter.sortDesc ? "-" : "") + filter.sortBy}`;
1223
- }
1224
- if (filter && filter.query) {
1225
- filter.query.forEach((q) => {
1226
- if (q.value
1227
- && (typeof q.value === 'string')
1228
- && q.value.match(/^-?\d+$/)
1229
- && q.value[0] !== "'"
1230
- && q.value[0] !== '"') {
1231
- query += "&" + q.key + q.type + `'${q.value}'`;
1232
- }
1233
- else {
1234
- query += "&" + q.key + q.type + q.value;
1235
- }
1236
- });
1237
- }
1238
- return query ? "?" + query.replace("&", "") : "";
1239
- }
1240
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudService, deps: [{ token: CrudConfig }, { token: i2$1.HttpClient }, { token: SocketService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1241
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudService }); }
1242
- }
1243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudService, decorators: [{
1244
- type: Injectable
1245
- }], ctorParameters: function () { return [{ type: CrudConfig }, { type: i2$1.HttpClient }, { type: SocketService, decorators: [{
1246
- type: Optional
1247
- }] }]; } });
1248
-
1249
- class CrudEffects {
1250
- constructor(actions$, service, config, store, state) {
1251
- this.actions$ = actions$;
1252
- this.service = service;
1253
- this.config = config;
1254
- this.store = store;
1255
- this.state = state;
1256
- }
1257
- init() {
1258
- const metadata = Reflect.getMetadata(this.config.entity, CrudEffects);
1259
- if (metadata)
1260
- return;
1261
- Reflect.defineMetadata(this.config.entity, true, CrudEffects);
1262
- this.actions$.subscribe((action) => {
1263
- switch (action.type) {
1264
- case `[${this.config.entity}] Create`:
1265
- this.service
1266
- .create(action.item)
1267
- .pipe(tap(() => this.store.dispatch(createSuccess(this.config.entity, action.item))), catchError((error) => {
1268
- this.store.dispatch(createFailure(this.config.entity, action.item, error));
1269
- return of();
1270
- }))
1271
- .subscribe();
1272
- break;
1273
- case `[${this.config.entity}] Create Success`:
1274
- const createState = this.state.getValue()[this.config.entity];
1275
- this.store.dispatch(read(this.config.entity, createState.filter ? { ...createState.filter, offset: 0 } : null));
1276
- break;
1277
- case `[${this.config.entity}] Create Many`:
1278
- this.service
1279
- .createMany(action.data.items, action.data.options)
1280
- .pipe(tap(() => this.store.dispatch(createManySuccess(this.config.entity, {
1281
- items: action.data.items,
1282
- options: action.data.options,
1283
- }))), catchError((error) => {
1284
- this.store.dispatch(createManyFailure(this.config.entity, {
1285
- items: action.data.items,
1286
- options: action.data.options,
1287
- }, error));
1288
- return of();
1289
- }))
1290
- .subscribe();
1291
- break;
1292
- case `[${this.config.entity}] Create Many Success`:
1293
- const createManyState = this.state.getValue()[this.config.entity];
1294
- this.store.dispatch(read(this.config.entity, createManyState.filter
1295
- ? { ...createManyState.filter, offset: 0 }
1296
- : null));
1297
- break;
1298
- case `[${this.config.entity}] Read`:
1299
- this.service
1300
- .getList(action.filter)
1301
- .pipe(tap((result) => this.store.dispatch(readSuccess(this.config.entity, action.filter, result))), catchError((error) => {
1302
- this.store.dispatch(readFailure(this.config.entity, action.filter, error));
1303
- return of();
1304
- }))
1305
- .subscribe();
1306
- break;
1307
- case `[${this.config.entity}] Export`:
1308
- this.service
1309
- .exportList(action.filter, action.format)
1310
- .pipe(tap((result) => this.store.dispatch(exportListSuccess(this.config.entity, action.filter))), catchError((error) => {
1311
- this.store.dispatch(exportListFailure(this.config.entity, action.filter, error));
1312
- return of();
1313
- }))
1314
- .subscribe();
1315
- break;
1316
- case `[${this.config.entity}] Select`:
1317
- this.service
1318
- .getById(action.id)
1319
- .pipe(tap((result) => this.store.dispatch(selectSuccess(this.config.entity, action.id, result))), catchError((error) => {
1320
- this.store.dispatch(selectFailure(this.config.entity, action.id, error));
1321
- return of();
1322
- }))
1323
- .subscribe();
1324
- break;
1325
- case `[${this.config.entity}] Update`:
1326
- this.service
1327
- .updatePartial(action.item)
1328
- .pipe(tap(() => this.store.dispatch(updateSuccess(this.config.entity, action.item))), catchError((error) => {
1329
- this.store.dispatch(updateFailure(this.config.entity, action.item, error));
1330
- this.store.dispatch(read(this.config.entity));
1331
- return of();
1332
- }))
1333
- .subscribe();
1334
- break;
1335
- case `[${this.config.entity}] Update Success`:
1336
- this.store
1337
- .pipe(select$1(getCrudFilter(this.config.entity)), first())
1338
- .subscribe((filter) => {
1339
- this.store.dispatch(read(this.config.entity, {
1340
- ...filter,
1341
- offset: 0,
1342
- }));
1343
- this.store.dispatch(select(this.config.entity, action.item.id));
1344
- });
1345
- break;
1346
- case `[${this.config.entity}] Update partial`:
1347
- this.service
1348
- .updatePartial(action.item)
1349
- .pipe(tap(() => this.store.dispatch(updatePartialSuccess(this.config.entity, action.item))), catchError((error) => {
1350
- this.store.dispatch(updatePartialFailure(this.config.entity, action.item, error));
1351
- this.store.dispatch(read(this.config.entity));
1352
- return of();
1353
- }))
1354
- .subscribe();
1355
- break;
1356
- case `[${this.config.entity}] Update partial Success`:
1357
- this.store
1358
- .pipe(select$1(getCrudFilter(this.config.entity)), first())
1359
- .subscribe((filter) => {
1360
- this.store.dispatch(read(this.config.entity, {
1361
- ...filter,
1362
- offset: 0,
1363
- }));
1364
- this.store.dispatch(select(this.config.entity, action.item.id));
1365
- });
1366
- break;
1367
- case `[${this.config.entity}] Update partial many`:
1368
- this.service
1369
- .updatePartialMany(action.items)
1370
- .pipe(tap(() => this.store.dispatch(updatePartialManySuccess(this.config.entity, action.items))), catchError((error) => {
1371
- this.store.dispatch(updatePartialManyFailure(this.config.entity, action.items, error));
1372
- this.store.dispatch(read(this.config.entity));
1373
- return of();
1374
- }))
1375
- .subscribe();
1376
- break;
1377
- case `[${this.config.entity}] Update partial many Success`:
1378
- this.store
1379
- .pipe(select$1(getCrudFilter(this.config.entity)), first())
1380
- .subscribe((filter) => {
1381
- this.store.dispatch(read(this.config.entity, {
1382
- ...filter,
1383
- offset: 0,
1384
- }));
1385
- });
1386
- break;
1387
- case `[${this.config.entity}] Delete`:
1388
- this.service
1389
- .delete(action.id)
1390
- .pipe(tap(() => this.store.dispatch(deleteSuccess(this.config.entity, action.id))), catchError((error) => {
1391
- this.store.dispatch(deleteFailure(this.config.entity, action.id, error));
1392
- return of();
1393
- }))
1394
- .subscribe();
1395
- break;
1396
- case `[${this.config.entity}] Delete Success`:
1397
- this.store
1398
- .pipe(select$1(getCrudFilter(this.config.entity)), first())
1399
- .subscribe((filter) => {
1400
- this.store.dispatch(read(this.config.entity, {
1401
- ...filter,
1402
- offset: 0,
1403
- }));
1404
- });
1405
- break;
1406
- default:
1407
- break;
1408
- }
1409
- });
1410
- }
1411
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudEffects, deps: [{ token: i1.ActionsSubject }, { token: CrudService }, { token: CrudConfig }, { token: i1.Store }, { token: i1.State }], target: i0.ɵɵFactoryTarget.Injectable }); }
1412
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudEffects }); }
1413
- }
1414
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudEffects, decorators: [{
1415
- type: Injectable
1416
- }], ctorParameters: function () { return [{ type: i1.ActionsSubject }, { type: CrudService }, { type: CrudConfig }, { type: i1.Store }, { type: i1.State }]; } });
1417
-
1418
- class CrudListPaginationFactory {
1419
- constructor(facade) {
1420
- this.facade = facade;
1421
- }
1422
- async create(options) {
1423
- return {
1424
- mode: options.mode,
1425
- limit: options.limit,
1426
- loadNextPage: () => {
1427
- if (!options.provider.getLinks() || !options.provider.getLinks().next)
1428
- return Promise.resolve(false);
1429
- return new Promise((res) => {
1430
- const sub = this.facade.loaded$.subscribe((l) => {
1431
- if (l) {
1432
- // if (sub && !sub.closed) sub.unsubscribe();
1433
- setTimeout(() => {
1434
- res(options.provider.getLinks() &&
1435
- options.provider.getLinks().next);
1436
- });
1437
- }
1438
- });
1439
- this.facade.read({
1440
- ...options.provider.getFilter(),
1441
- offset: options.provider.getFilter().offset +
1442
- options.provider.getFilter().limit,
1443
- });
1444
- });
1445
- },
1446
- loadPrevPage: () => {
1447
- if (!options.provider.getLinks() || !options.provider.getLinks().prev)
1448
- return Promise.resolve(false);
1449
- return new Promise((res) => {
1450
- const sub = this.facade.loaded$.subscribe((l) => {
1451
- if (l) {
1452
- // if (sub && !sub.closed) sub.unsubscribe();
1453
- setTimeout(() => {
1454
- res(options.provider.getLinks() &&
1455
- options.provider.getLinks().prev);
1456
- });
1457
- }
1458
- });
1459
- this.facade.read({
1460
- ...options.provider.getFilter(),
1461
- offset: options.provider.getFilter().offset -
1462
- options.provider.getFilter().limit,
1463
- });
1464
- });
1465
- },
1466
- page$: this.facade.filter$.pipe(map((f) => {
1467
- return f?.limit ? f.offset / f.limit + 1 : 0;
1468
- })),
1469
- totalPages$: combineLatest(this.facade.filter$, this.facade.totalCount$).pipe(map(([filter, totalCount]) => {
1470
- return filter?.limit ? Math.ceil(totalCount / filter.limit) : 0;
1471
- })),
1472
- };
1473
- }
1474
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListPaginationFactory, deps: [{ token: CrudFacade }], target: i0.ɵɵFactoryTarget.Injectable }); }
1475
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListPaginationFactory }); }
1476
- }
1477
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListPaginationFactory, decorators: [{
1478
- type: Injectable
1479
- }], ctorParameters: function () { return [{ type: CrudFacade }]; } });
1480
-
1481
- const COMPONENTS = [
1482
- ExportComponent,
1483
- FilterComponent,
1484
- FilterTextComponent,
1485
- FiltersConfigComponent,
1486
- FilterDateComponent,
1487
- FilterDateWithEditComponent,
1488
- FilterDateTimeComponent,
1489
- FilterRadioComponent,
1490
- FiltersComponent,
1491
- FilterFlagComponent,
1492
- FilterCheckComponent,
1493
- FilterIntComponent,
1494
- MultiselectComponent,
1495
- GroupComponent,
1496
- ];
1497
- class CrudComponentsModule {
1498
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1499
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: CrudComponentsModule, declarations: [ExportComponent,
1500
- FilterComponent,
1501
- FilterTextComponent,
1502
- FiltersConfigComponent,
1503
- FilterDateComponent,
1504
- FilterDateWithEditComponent,
1505
- FilterDateTimeComponent,
1506
- FilterRadioComponent,
1507
- FiltersComponent,
1508
- FilterFlagComponent,
1509
- FilterCheckComponent,
1510
- FilterIntComponent,
1511
- MultiselectComponent,
1512
- GroupComponent], imports: [
1513
- //AuthSharedModule,
1514
- StoreModule,
1515
- SharedModule,
1516
- CrudPipesModule,
1517
- FormsModule,
1518
- CommonModule,
1519
- DynamicIoModule], exports: [CrudPipesModule, ExportComponent,
1520
- FilterComponent,
1521
- FilterTextComponent,
1522
- FiltersConfigComponent,
1523
- FilterDateComponent,
1524
- FilterDateWithEditComponent,
1525
- FilterDateTimeComponent,
1526
- FilterRadioComponent,
1527
- FiltersComponent,
1528
- FilterFlagComponent,
1529
- FilterCheckComponent,
1530
- FilterIntComponent,
1531
- MultiselectComponent,
1532
- GroupComponent] }); }
1533
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudComponentsModule, providers: [
1534
- CrudService,
1535
- CrudEffects,
1536
- CrudFacade,
1537
- SocketService,
1538
- CrudListPaginationFactory,
1539
- ], imports: [
1540
- //AuthSharedModule,
1541
- StoreModule,
1542
- SharedModule,
1543
- CrudPipesModule,
1544
- FormsModule,
1545
- CommonModule,
1546
- DynamicIoModule, CrudPipesModule] }); }
1547
- }
1548
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudComponentsModule, decorators: [{
1549
- type: NgModule,
1550
- args: [{
1551
- declarations: [...COMPONENTS],
1552
- imports: [
1553
- //AuthSharedModule,
1554
- StoreModule,
1555
- SharedModule,
1556
- CrudPipesModule,
1557
- FormsModule,
1558
- CommonModule,
1559
- DynamicIoModule,
1560
- ],
1561
- exports: [CrudPipesModule, ...COMPONENTS],
1562
- providers: [
1563
- CrudService,
1564
- CrudEffects,
1565
- CrudFacade,
1566
- SocketService,
1567
- CrudListPaginationFactory,
1568
- ],
1569
- }]
1570
- }] });
1571
-
1572
- const initialState = {
1573
- loaded: false
1574
- };
1575
- const crudReducer = (state = initialState, action, entity) => {
1576
- switch (action.type) {
1577
- case `[${entity}] Create`:
1578
- return {
1579
- ...state,
1580
- loaded: false,
1581
- error: null
1582
- };
1583
- case `[${entity}] Create Success`:
1584
- return {
1585
- ...state,
1586
- loaded: true,
1587
- error: null
1588
- };
1589
- case `[${entity}] Create Failure`:
1590
- return {
1591
- ...state,
1592
- loaded: true,
1593
- error: action.error
1594
- };
1595
- case `[${entity}] Create Many`:
1596
- return {
1597
- ...state,
1598
- loaded: false,
1599
- error: null
1600
- };
1601
- case `[${entity}] Create Many Success`:
1602
- return {
1603
- ...state,
1604
- loaded: true,
1605
- error: null
1606
- };
1607
- case `[${entity}] Create Many Failure`:
1608
- return {
1609
- ...state,
1610
- loaded: true,
1611
- error: action.error
1612
- };
1613
- case `[${entity}] Export`:
1614
- return {
1615
- ...state,
1616
- loaded: false
1617
- };
1618
- case `[${entity}] Export Success`:
1619
- return {
1620
- ...state,
1621
- loaded: true
1622
- };
1623
- case `[${entity}] Export Failure`:
1624
- return {
1625
- ...state,
1626
- loaded: true
1627
- };
1628
- case `[${entity}] Read`:
1629
- return {
1630
- ...state,
1631
- loaded: false,
1632
- filter: action.filter,
1633
- error: null,
1634
- totalCount: null,
1635
- links: null,
1636
- };
1637
- case `[${entity}] Read Success`:
1638
- let list = [];
1639
- if (action.filter
1640
- && action.filter.offset
1641
- && state.list
1642
- && action.filter.paginationMode !== PaginationMode.singlePage) {
1643
- state.list.forEach(i => {
1644
- list.push(i);
1645
- });
1646
- list = [
1647
- ...list,
1648
- ...action.result.data
1649
- ];
1650
- }
1651
- else {
1652
- list = action.result.data;
1653
- }
1654
- return {
1655
- ...state,
1656
- loaded: true,
1657
- list,
1658
- totalCount: action.result.totalCount,
1659
- links: action.result.links,
1660
- error: null
1661
- };
1662
- case `[${entity}] Clear`:
1663
- return { ...initialState };
1664
- case `[${entity}] Read Failure`:
1665
- return {
1666
- ...state,
1667
- loaded: true,
1668
- error: action.error
1669
- };
1670
- case `[${entity}] Select`:
1671
- return {
1672
- ...state,
1673
- loaded: false,
1674
- selected: null,
1675
- error: null
1676
- };
1677
- case `[${entity}] Select Success`:
1678
- return {
1679
- ...state,
1680
- loaded: true,
1681
- selected: action.item,
1682
- error: null
1683
- };
1684
- case `[${entity}] Select Failure`:
1685
- return {
1686
- ...state,
1687
- loaded: true,
1688
- error: action.error
1689
- };
1690
- case `[${entity}] MultiSelect`:
1691
- return {
1692
- ...state,
1693
- multiSelected: [...action.items]
1694
- };
1695
- case `[${entity}] Unselect`:
1696
- return {
1697
- ...state,
1698
- loaded: true,
1699
- selected: null,
1700
- error: null
1701
- };
1702
- case `[${entity}] Update`:
1703
- return {
1704
- ...state,
1705
- loaded: false,
1706
- error: null
1707
- };
1708
- case `[${entity}] Update Success`:
1709
- return {
1710
- ...state,
1711
- loaded: true,
1712
- error: null
1713
- };
1714
- case `[${entity}] Update Failure`:
1715
- return {
1716
- ...state,
1717
- loaded: true,
1718
- error: action.error
1719
- };
1720
- case `[${entity}] Update partial`:
1721
- return {
1722
- ...state,
1723
- loaded: false,
1724
- error: null
1725
- };
1726
- case `[${entity}] Update partial Success`:
1727
- return {
1728
- ...state,
1729
- loaded: true,
1730
- error: null
1731
- };
1732
- case `[${entity}] Update partial Failure`:
1733
- return {
1734
- ...state,
1735
- loaded: true,
1736
- error: action.error
1737
- };
1738
- case `[${entity}] Update partial many`:
1739
- return {
1740
- ...state,
1741
- loaded: false,
1742
- error: null
1743
- };
1744
- case `[${entity}] Update partial many Success`:
1745
- return {
1746
- ...state,
1747
- multiSelected: [],
1748
- loaded: true,
1749
- error: null
1750
- };
1751
- case `[${entity}] Update partial many Failure`:
1752
- return {
1753
- ...state,
1754
- loaded: true,
1755
- error: action.error
1756
- };
1757
- case `[${entity}] Delete`:
1758
- return {
1759
- ...state,
1760
- loaded: false,
1761
- error: null
1762
- };
1763
- case `[${entity}] Delete Success`:
1764
- return {
1765
- ...state,
1766
- loaded: true,
1767
- error: null
1768
- };
1769
- case `[${entity}] Delete Failure`:
1770
- return {
1771
- ...state,
1772
- loaded: true,
1773
- error: action.error
1774
- };
1775
- default:
1776
- return state;
1777
- }
1778
- };
1779
- function getReducer(entity) {
1780
- return (state, action) => {
1781
- return crudReducer(state, action, entity);
1782
- };
1783
- }
1784
-
1785
- class PageService {
1786
- constructor(authService, config) {
1787
- this.authService = authService;
1788
- this.config = config;
1789
- }
1790
- checkPermissions() {
1791
- const val = this.config;
1792
- const modelOptions = getModelOptions(val.type);
1793
- if (val.add &&
1794
- modelOptions.create &&
1795
- modelOptions.create.permissions &&
1796
- !this.authService.expectPermissions(modelOptions.create.permissions)) {
1797
- val.add = false;
1798
- }
1799
- if (val.edit &&
1800
- modelOptions.update &&
1801
- modelOptions.update.permissions &&
1802
- !this.authService.expectPermissions(modelOptions.update.permissions)) {
1803
- val.edit = false;
1804
- }
1805
- if (val.remove &&
1806
- modelOptions.remove &&
1807
- modelOptions.remove.permissions &&
1808
- !this.authService.expectPermissions(modelOptions.remove.permissions)) {
1809
- val.remove = false;
1810
- }
1811
- }
1812
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: PageService, deps: [{ token: i3.AuthService }, { token: CrudFullConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
1813
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: PageService }); }
1814
- }
1815
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: PageService, decorators: [{
1816
- type: Injectable
1817
- }], ctorParameters: function () { return [{ type: i3.AuthService }, { type: CrudFullConfig }]; } });
1818
-
1819
- class CrudSearchService {
1820
- constructor() {
1821
- this._filterSource = new BehaviorSubject(null);
1822
- this._enabledSource = new BehaviorSubject(false);
1823
- this.enabled$ = this._enabledSource.asObservable();
1824
- this.filter$ = combineLatest([
1825
- this._filterSource.asObservable(), this.enabled$
1826
- ]).pipe(map(([filter, enabled]) => {
1827
- if (!enabled)
1828
- return {};
1829
- return filter;
1830
- }));
1831
- }
1832
- get filter() {
1833
- if (!this._enabledSource.value)
1834
- return {};
1835
- return this._filterSource.value;
1836
- }
1837
- get enabled() {
1838
- return this._enabledSource.value;
1839
- }
1840
- setFilter(val) {
1841
- this._filterSource.next(val);
1842
- }
1843
- setEnabled(val) {
1844
- this._enabledSource.next(val);
1845
- }
1846
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudSearchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1847
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudSearchService, providedIn: 'root' }); }
1848
- }
1849
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudSearchService, decorators: [{
1850
- type: Injectable,
1851
- args: [{
1852
- providedIn: 'root'
1853
- }]
1854
- }] });
1855
-
1856
- class CrudListPageBaseComponent extends BaseComponent$1 {
1857
- static { this.smartType = "crud-list-page"; }
1858
- constructor(config) {
1859
- super();
1860
- this.config = config;
1861
- }
1862
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListPageBaseComponent, deps: [{ token: CrudFullConfig }], target: i0.ɵɵFactoryTarget.Directive }); }
1863
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: CrudListPageBaseComponent, inputs: { listOptions: "listOptions" }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0 }); }
1864
- }
1865
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudListPageBaseComponent, decorators: [{
1866
- type: Directive
1867
- }], ctorParameters: function () { return [{ type: CrudFullConfig }]; }, propDecorators: { contentTpl: [{
1868
- type: ViewChild,
1869
- args: ["contentTpl", { read: ViewContainerRef, static: true }]
1870
- }], listOptions: [{
1871
- type: Input
1872
- }] } });
1873
-
1874
- class ListStandardComponent extends CrudListPageBaseComponent {
1875
- constructor(facade, config) {
1876
- super(config);
1877
- this.facade = facade;
1878
- this.config = config;
1879
- this.isSearch$ = this.facade.filter$.pipe(map(filter => {
1880
- return !!filter?.searchText;
1881
- }));
1882
- }
1883
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ListStandardComponent, deps: [{ token: CrudFacade }, { token: CrudFullConfig }], target: i0.ɵɵFactoryTarget.Component }); }
1884
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: ListStandardComponent, selector: "smart-crud-list-standard-page", providers: [
1885
- CrudListGroupService
1886
- ], usesInheritance: true, ngImport: i0, 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>", styles: [""], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.ListComponent, selector: "smart-list", inputs: ["options"] }, { kind: "component", type: FiltersConfigComponent, selector: "smart-crud-filters-config" }, { kind: "component", type: GroupComponent, selector: "smart-crud-group", inputs: ["groups", "listOptions"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] }); }
1887
- }
1888
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ListStandardComponent, decorators: [{
1889
- type: Component,
1890
- args: [{ selector: "smart-crud-list-standard-page", providers: [
1891
- CrudListGroupService
1892
- ], 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>" }]
1893
- }], ctorParameters: function () { return [{ type: CrudFacade }, { type: CrudFullConfig }]; } });
1894
-
1895
- class ListComponent extends CreateDynamicComponent('crud-list-page') {
1896
- constructor(facade, router, dynamicComponentLoader, injector, cd, menuService, hardwareService, paginationFacade, styleService, elementRef, pageService, config, searchService, moduleRef, componentFactoryResolver) {
1897
- super(cd, moduleRef, componentFactoryResolver);
1898
- this.facade = facade;
1899
- this.router = router;
1900
- this.dynamicComponentLoader = dynamicComponentLoader;
1901
- this.injector = injector;
1902
- this.cd = cd;
1903
- this.menuService = menuService;
1904
- this.hardwareService = hardwareService;
1905
- this.paginationFacade = paginationFacade;
1906
- this.styleService = styleService;
1907
- this.elementRef = elementRef;
1908
- this.pageService = pageService;
1909
- this.config = config;
1910
- this.searchService = searchService;
1911
- this.moduleRef = moduleRef;
1912
- this.componentFactoryResolver = componentFactoryResolver;
1913
- this._cleanMultiSelected$ = new Subject();
1914
- this.filter$ = this.facade.filter$.pipe(tap((filter) => {
1915
- this.filter = filter;
1916
- }));
1917
- this.dynamicContents = new QueryList();
1918
- this.facade.links$.pipe(this.takeUntilDestroy).subscribe((links) => {
1919
- this.links = links;
1920
- });
1921
- }
1922
- refreshProperties() {
1923
- this.baseInstance.listOptions = this.listOptions;
1924
- }
1925
- async ngOnInit() {
1926
- await this.pageService.checkPermissions();
1927
- const options = getModelOptions(this.config.type);
1928
- let newFilter = null;
1929
- if (this.config.list?.resetQuery === 'beforeInit') {
1930
- newFilter = {
1931
- query: this.config.baseQuery ? [...this.config.baseQuery] : [],
1932
- paginationMode: this.config.list.paginationMode,
1933
- limit: this.config.pagination ? this.config.pagination.limit : null,
1934
- offset: this.config.pagination ? 0 : null,
1935
- sortBy: this.config.sort ? this.config.sort["default"] : null,
1936
- sortDesc: this.config.sort ? this.config.sort["defaultDesc"] : null,
1937
- ...this.searchService.filter
1938
- };
1939
- }
1940
- else if (this.filter) {
1941
- newFilter = this.filter;
1942
- }
1943
- else {
1944
- newFilter = {
1945
- paginationMode: this.config.list.paginationMode,
1946
- limit: this.searchService.filter?.limit ? this.searchService.filter.limit : this.config.pagination
1947
- ? this.config.pagination.limit : null,
1948
- offset: this.searchService.filter?.offset || this.searchService.filter?.offset === 0
1949
- ? this.searchService.filter.offset : this.config.pagination ? 0 : null,
1950
- sortBy: this.searchService.filter?.sortBy ? this.searchService.filter.sortBy : this.config.sort
1951
- ? this.config.sort["default"] : null,
1952
- sortDesc: this.searchService.filter?.sortDesc ? this.searchService.filter.sortDesc : this.config.sort
1953
- ? this.config.sort["defaultDesc"] : null,
1954
- query: this.config.baseQuery ? [...this.config.baseQuery] : [],
1955
- ...this.searchService.filter
1956
- };
1957
- }
1958
- this.facade.read(newFilter);
1959
- const endButtons = this.getEndButtons();
1960
- this.pageOptions = {
1961
- title: this.config.title,
1962
- search: this.config.search
1963
- ? {
1964
- text$: this.filter$.pipe(map((f) => (f ? f.searchText : null))),
1965
- set: (txt) => {
1966
- if (txt !== this.filter.searchText)
1967
- this.facade.read({
1968
- ...this.filter,
1969
- searchText: txt,
1970
- offset: 0,
1971
- });
1972
- },
1973
- }
1974
- : null,
1975
- endButtons: endButtons,
1976
- };
1977
- const compiledComponents = await this.dynamicComponentLoader.getComponentsWithFactories({
1978
- components: [
1979
- ...(this.config.details &&
1980
- this.config.details["components"] &&
1981
- this.config.details["components"].top
1982
- ? [this.config.details["components"].top]
1983
- : []),
1984
- ...(this.config.details &&
1985
- this.config.details["components"] &&
1986
- this.config.details["components"].bottom
1987
- ? [this.config.details["components"].bottom]
1988
- : []),
1989
- ...(this.config.list &&
1990
- this.config.list["components"] &&
1991
- this.config.list["components"].top
1992
- ? [this.config.list["components"].top]
1993
- : []),
1994
- ],
1995
- });
1996
- this.listOptions = {
1997
- provider: {
1998
- getData: (filter) => {
1999
- const global = {
2000
- ...this.filter,
2001
- ...filter,
2002
- };
2003
- this.facade.read(global);
2004
- },
2005
- onChangeMultiSelected: async (list) => {
2006
- if (list.length && !this.menuService.openedEnd) {
2007
- await this.menuService.openEnd({
2008
- injector: this.injector,
2009
- component: MultiselectComponent,
2010
- });
2011
- }
2012
- else if (!list.length && this.menuService.openedEnd) {
2013
- await this.menuService.closeEnd();
2014
- }
2015
- this.facade.multiSelect(list);
2016
- },
2017
- list$: this.facade.list$,
2018
- loading$: this.facade.loaded$.pipe(map((l) => !l)),
2019
- onCleanMultiSelected$: this._cleanMultiSelected$
2020
- },
2021
- cellPipe: this.config.list ? this.config.list.cellPipe : null,
2022
- mode: this.config.list?.mode,
2023
- type: this.config.type,
2024
- details: this.config.details
2025
- ? {
2026
- provider: {
2027
- getData: (id) => {
2028
- this.facade.select(id);
2029
- },
2030
- clearData: () => {
2031
- this.facade.unselect();
2032
- },
2033
- item$: this.facade.selected$,
2034
- loading$: this.facade.loaded$.pipe(map((l) => !l)),
2035
- },
2036
- componentFactories: {
2037
- top: this.config.details &&
2038
- this.config.details["components"] &&
2039
- this.config.details["components"].top
2040
- ? compiledComponents.find((cc) => cc.component === this.config.details["components"].top).factory
2041
- : null,
2042
- bottom: this.config.details &&
2043
- this.config.details["components"] &&
2044
- this.config.details["components"].bottom
2045
- ? compiledComponents.find((cc) => cc.component ===
2046
- this.config.details["components"].bottom).factory
2047
- : null,
2048
- },
2049
- }
2050
- : null,
2051
- item: !!this.config.edit || this.config.details
2052
- ? {
2053
- options: {
2054
- routingPrefix: "/" + this.router.routerState.snapshot.url + "/",
2055
- edit: !!this.config.edit,
2056
- },
2057
- }
2058
- : null,
2059
- remove: this.config.remove
2060
- ? {
2061
- provider: {
2062
- invoke: (id) => this.facade.delete(id),
2063
- check: (item) => {
2064
- return options?.remove?.enabled ? SpecificationService.valid(item, options?.remove?.enabled) : true;
2065
- }
2066
- },
2067
- }
2068
- : null,
2069
- pagination: await this.paginationFacade.create({
2070
- mode: this.config.list.paginationMode,
2071
- limit: this.config.pagination.limit,
2072
- provider: {
2073
- getFilter: () => {
2074
- return this.filter;
2075
- },
2076
- getLinks: () => this.links,
2077
- },
2078
- }),
2079
- sort: this.config.sort,
2080
- };
2081
- this.cd.detectChanges();
2082
- this.initCloseMenu();
2083
- this.initTopComponent(compiledComponents);
2084
- this.refreshDynamicInstance();
2085
- }
2086
- initCloseMenu() {
2087
- this.router.events.pipe(this.takeUntilDestroy).subscribe(async () => {
2088
- await this.clear();
2089
- });
2090
- }
2091
- async clear() {
2092
- await this.menuService.closeEnd();
2093
- this.listOptions = {
2094
- ...this.listOptions,
2095
- select: null,
2096
- };
2097
- this.facade.multiSelect([]);
2098
- }
2099
- getEndButtons() {
2100
- const fieldsWithOptions = getModelFieldsWithOptions(new this.config.type());
2101
- const modelOptions = getModelOptions(this.config.type);
2102
- const showFilters = fieldsWithOptions.some((x) => x.options?.list?.filter) || modelOptions?.filters?.length;
2103
- const showMultiEdit = this.config.list?.components?.multi ||
2104
- (this.config.edit &&
2105
- fieldsWithOptions.some((x) => x.options?.update?.multi) &&
2106
- !this.hardwareService.isMobile &&
2107
- (!this.config?.list?.mode ||
2108
- this.config?.list?.mode === ListMode.desktop));
2109
- return [
2110
- ...(showMultiEdit
2111
- ? [
2112
- {
2113
- icon: "checkbox-outline",
2114
- text: "multi",
2115
- handler: () => {
2116
- this.facade.multiSelect([]);
2117
- this._cleanMultiSelected$.next();
2118
- setTimeout(async () => {
2119
- this.listOptions = {
2120
- ...this.listOptions,
2121
- select: this.listOptions.select === "multi" ? null : "multi",
2122
- };
2123
- if (this.menuService.openedEnd)
2124
- await this.menuService.closeEnd();
2125
- this.cd.detectChanges();
2126
- });
2127
- },
2128
- },
2129
- ]
2130
- : []),
2131
- ...(showFilters
2132
- ? [
2133
- {
2134
- icon: "filter-outline",
2135
- text: "filters",
2136
- handler: async () => {
2137
- await this.menuService.openEnd({
2138
- injector: this.injector,
2139
- component: FiltersComponent,
2140
- });
2141
- },
2142
- },
2143
- ]
2144
- : []),
2145
- ...(this.config.add
2146
- ? [
2147
- {
2148
- icon: "add",
2149
- text: "add",
2150
- handler: () => {
2151
- this.router.navigate([
2152
- "/" + this.router.routerState.snapshot.url + "/add",
2153
- ]);
2154
- },
2155
- },
2156
- ]
2157
- : []),
2158
- ...(this.config.export
2159
- ? [
2160
- {
2161
- text: "export",
2162
- icon: "download-outline",
2163
- type: "popover",
2164
- component: ExportComponent,
2165
- },
2166
- ]
2167
- : []),
2168
- ...(this.config.buttons ? this.config.buttons : []),
2169
- ];
2170
- }
2171
- initTopComponent(compiledComponents) {
2172
- const factory = this.config.list &&
2173
- this.config.list["components"] &&
2174
- this.config.list["components"].top
2175
- ? compiledComponents.find((cc) => cc.component === this.config.list["components"].top).factory
2176
- : null;
2177
- setTimeout(() => {
2178
- if (factory && !this.topTpl.get(0)) {
2179
- this.topTpl.createComponent(factory);
2180
- }
2181
- });
2182
- }
2183
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ListComponent, deps: [{ token: CrudFacade }, { token: i1$2.Router }, { token: i3.DynamicComponentLoader }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: i3.MenuService }, { token: i3.HardwareService }, { token: CrudListPaginationFactory }, { token: i3.StyleService }, { token: i0.ElementRef }, { token: PageService }, { token: CrudFullConfig }, { token: CrudSearchService }, { token: i0.NgModuleRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component }); }
2184
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: ListComponent, selector: "smart-crud-list-page", viewQueries: [{ propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, read: ViewContainerRef }, { propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: TemplateRef }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, read: DynamicContentDirective }], usesInheritance: true, ngImport: i0, template: `
2185
- <smart-page [options]="pageOptions" *ngIf="filter$ | async">
2186
- <div #topTpl></div>
2187
- <smart-crud-list-standard-page *ngIf="template === 'default'" [listOptions]="listOptions">
2188
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2189
- </smart-crud-list-standard-page>
2190
- <ng-template #contentTpl>
2191
- <ng-content></ng-content>
2192
- </ng-template>
2193
- <div class="dynamic-content"></div>
2194
- </smart-page>
2195
- `, isInline: true, dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.PageComponent, selector: "smart-page", inputs: ["options"] }, { kind: "directive", type: i3.DynamicContentDirective, selector: ".dynamic-content" }, { kind: "component", type: ListStandardComponent, selector: "smart-crud-list-standard-page" }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }] }); }
2196
- }
2197
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ListComponent, decorators: [{
2198
- type: Component,
2199
- args: [{
2200
- selector: "smart-crud-list-page",
2201
- template: `
2202
- <smart-page [options]="pageOptions" *ngIf="filter$ | async">
2203
- <div #topTpl></div>
2204
- <smart-crud-list-standard-page *ngIf="template === 'default'" [listOptions]="listOptions">
2205
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2206
- </smart-crud-list-standard-page>
2207
- <ng-template #contentTpl>
2208
- <ng-content></ng-content>
2209
- </ng-template>
2210
- <div class="dynamic-content"></div>
2211
- </smart-page>
2212
- `
2213
- }]
2214
- }], ctorParameters: function () { return [{ type: CrudFacade }, { type: i1$2.Router }, { type: i3.DynamicComponentLoader }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i3.MenuService }, { type: i3.HardwareService }, { type: CrudListPaginationFactory }, { type: i3.StyleService }, { type: i0.ElementRef }, { type: PageService }, { type: CrudFullConfig }, { type: CrudSearchService }, { type: i0.NgModuleRef }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { topTpl: [{
2215
- type: ViewChild,
2216
- args: ["topTpl", { read: ViewContainerRef, static: false }]
2217
- }], contentTpl: [{
2218
- type: ViewChild,
2219
- args: ["contentTpl", { read: TemplateRef, static: false }]
2220
- }], dynamicContents: [{
2221
- type: ViewChildren,
2222
- args: [DynamicContentDirective, { read: DynamicContentDirective }]
2223
- }] } });
2224
-
2225
- class CrudItemPageBaseComponent extends BaseComponent$1 {
2226
- static { this.smartType = "crud-item-page"; }
2227
- constructor(config, facade) {
2228
- super();
2229
- this.config = config;
2230
- this.facade = facade;
2231
- this.formComponents = new QueryList();
2232
- this.onPartialChange = new EventEmitter();
2233
- this.onChange = new EventEmitter();
2234
- this.onValidChange = new EventEmitter();
2235
- this.selected$ = facade.selected$;
2236
- }
2237
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudItemPageBaseComponent, deps: [{ token: CrudFullConfig }, { token: CrudFacade }], target: i0.ɵɵFactoryTarget.Directive }); }
2238
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: CrudItemPageBaseComponent, inputs: { detailsOptions: "detailsOptions", mode: "mode", uniqueProvider: "uniqueProvider" }, outputs: { onPartialChange: "onPartialChange", onChange: "onChange", onValidChange: "onValidChange" }, viewQueries: [{ propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "formComponents", predicate: FormComponent, descendants: true, read: FormComponent }], usesInheritance: true, ngImport: i0 }); }
2239
- }
2240
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudItemPageBaseComponent, decorators: [{
2241
- type: Directive
2242
- }], ctorParameters: function () { return [{ type: CrudFullConfig }, { type: CrudFacade }]; }, propDecorators: { contentTpl: [{
2243
- type: ViewChild,
2244
- args: ["contentTpl", { read: ViewContainerRef, static: true }]
2245
- }], formComponents: [{
2246
- type: ViewChildren,
2247
- args: [FormComponent, { read: FormComponent }]
2248
- }], detailsOptions: [{
2249
- type: Input
2250
- }], mode: [{
2251
- type: Input
2252
- }], uniqueProvider: [{
2253
- type: Input
2254
- }], onPartialChange: [{
2255
- type: Output
2256
- }], onChange: [{
2257
- type: Output
2258
- }], onValidChange: [{
2259
- type: Output
2260
- }] } });
2261
-
2262
- class ItemStandardComponent extends CrudItemPageBaseComponent {
2263
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ItemStandardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2264
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: ItemStandardComponent, selector: "smart-crud-item-standard-page", usesInheritance: true, ngImport: i0, 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/>", styles: [""], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.FormComponent, selector: "smart-form", inputs: ["options"], outputs: ["invokeSubmit", "valueChange", "valuePartialChange", "validChange"] }, { kind: "component", type: i3.DetailsComponent, selector: "smart-details", inputs: ["options"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: FormOptionsPipe, name: "smartFormOptions" }] }); }
2265
- }
2266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ItemStandardComponent, decorators: [{
2267
- type: Component,
2268
- args: [{ selector: "smart-crud-item-standard-page", 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/>" }]
2269
- }] });
2270
-
2271
- class ItemComponent extends CreateDynamicComponent('crud-item-page') {
2272
- set mode(val) {
2273
- this._mode = val;
2274
- this.refreshDynamicInstance();
2275
- }
2276
- get mode() {
2277
- return this._mode;
2278
- }
2279
- constructor(router, activeRoute, facade, service, route, dynamicComponentLoader, translateService, config, location, cd, authService, styleService, elementRef, toastService, pageService, moduleRef, componentFactoryResolver, detailsService) {
2280
- super(cd, moduleRef, componentFactoryResolver);
2281
- this.router = router;
2282
- this.activeRoute = activeRoute;
2283
- this.facade = facade;
2284
- this.service = service;
2285
- this.route = route;
2286
- this.dynamicComponentLoader = dynamicComponentLoader;
2287
- this.translateService = translateService;
2288
- this.config = config;
2289
- this.location = location;
2290
- this.cd = cd;
2291
- this.styleService = styleService;
2292
- this.elementRef = elementRef;
2293
- this.toastService = toastService;
2294
- this.pageService = pageService;
2295
- this.moduleRef = moduleRef;
2296
- this.componentFactoryResolver = componentFactoryResolver;
2297
- this.detailsService = detailsService;
2298
- this.pageOptions = {
2299
- title: "",
2300
- showBackButton: true,
2301
- hideMenuButton: true,
2302
- };
2303
- this.formValid = false;
2304
- this.standardComponents = new QueryList();
2305
- this.dynamicContents = new QueryList();
2306
- this.selected$ = this.facade.selected$;
2307
- }
2308
- refreshProperties() {
2309
- this.baseInstance.detailsOptions = this.detailsOptions;
2310
- this.baseInstance.mode = this.mode;
2311
- this.baseInstance.uniqueProvider = this.uniqueProvider;
2312
- this.baseInstance.onPartialChange.pipe(this.takeUntilDestroy).subscribe(val => this.onPartialChange(val));
2313
- this.baseInstance.onChange.pipe(this.takeUntilDestroy).subscribe(val => this.onChange(val));
2314
- this.baseInstance.onValidChange.pipe(this.takeUntilDestroy).subscribe(val => this.onValidChange(val));
2315
- }
2316
- async ngOnInit() {
2317
- this.detailsService.init();
2318
- this.styleService.init(this.elementRef);
2319
- this.pageService.checkPermissions();
2320
- if (this.router.routerState.snapshot.url.split('?')[0].endsWith("/add")) {
2321
- this.mode = "create";
2322
- await this.generateComponents('add');
2323
- }
2324
- else {
2325
- this.mode = this.config.details ? "details" : "update";
2326
- if (this.mode === 'update') {
2327
- await this.generateComponents('edit');
2328
- }
2329
- this.activeRoute.params
2330
- .pipe(this.takeUntilDestroy)
2331
- .subscribe(({ id }) => {
2332
- this.facade.select(id);
2333
- this.id = id;
2334
- });
2335
- this.activeRoute.queryParams
2336
- .pipe(this.takeUntilDestroy)
2337
- .subscribe(({ edit }) => {
2338
- if (edit) {
2339
- this.mode = "update";
2340
- this.generateComponents('edit');
2341
- }
2342
- });
2343
- }
2344
- this.uniqueProvider = async (values) => {
2345
- const filter = {
2346
- query: [],
2347
- };
2348
- Object.keys(values).forEach((key) => {
2349
- filter.query.push({
2350
- key: key,
2351
- value: values[key],
2352
- type: "=",
2353
- });
2354
- });
2355
- if (this.id) {
2356
- filter.query.push({
2357
- key: "id",
2358
- value: this.id,
2359
- type: "!=",
2360
- });
2361
- }
2362
- const { totalCount } = await this.service.getList(filter).toPromise();
2363
- return !totalCount;
2364
- };
2365
- if (this.config.details) {
2366
- const compiledComponents = await this.dynamicComponentLoader.getComponentsWithFactories({
2367
- components: [
2368
- ...(this.config.details &&
2369
- this.config.details["components"] &&
2370
- this.config.details["components"].top
2371
- ? [this.config.details["components"].top]
2372
- : []),
2373
- ...(this.config.details &&
2374
- this.config.details["components"] &&
2375
- this.config.details["components"].bottom
2376
- ? [this.config.details["components"].bottom]
2377
- : []),
2378
- ],
2379
- });
2380
- this.detailsOptions = {
2381
- type: this.config.type,
2382
- item$: this.facade.selected$,
2383
- cellPipe: this.config.details ? this.config.details.cellPipe : null,
2384
- componentFactories: {
2385
- top: this.config.details &&
2386
- this.config.details["components"] &&
2387
- this.config.details["components"].top
2388
- ? compiledComponents.find((cc) => cc.component === this.config.details["components"].top).factory
2389
- : null,
2390
- bottom: this.config.details &&
2391
- this.config.details["components"] &&
2392
- this.config.details["components"].bottom
2393
- ? compiledComponents.find((cc) => cc.component === this.config.details["components"].bottom).factory
2394
- : null,
2395
- },
2396
- };
2397
- }
2398
- this.initPageOptions();
2399
- this.facade.selected$.pipe(this.takeUntilDestroy).subscribe(item => {
2400
- this.item = item;
2401
- this.initPageOptions();
2402
- this.cd.detectChanges();
2403
- });
2404
- this.refreshDynamicInstance();
2405
- }
2406
- async generateComponents(mode) {
2407
- const compiledComponents = await this.dynamicComponentLoader.getComponentsWithFactories({
2408
- components: [
2409
- ...(this.config[mode] &&
2410
- this.config[mode]["components"] &&
2411
- this.config[mode]["components"].top
2412
- ? [this.config[mode]["components"].top]
2413
- : []),
2414
- ...(this.config[mode] &&
2415
- this.config[mode]["components"] &&
2416
- this.config[mode]["components"].bottom
2417
- ? [this.config[mode]["components"].bottom]
2418
- : []),
2419
- ],
2420
- });
2421
- const topComponentFactory = compiledComponents.find((cc) => cc.component === this.config[mode]["components"]?.top)?.factory;
2422
- const bottomComponentFactory = compiledComponents.find((cc) => cc.component === this.config[mode]["components"]?.bottom)?.factory;
2423
- if (!this.topTpl.get(0) && topComponentFactory) {
2424
- this.topTpl.createComponent(topComponentFactory);
2425
- }
2426
- if (!this.bottomTpl.get(0) && bottomComponentFactory) {
2427
- this.bottomTpl.createComponent(bottomComponentFactory);
2428
- }
2429
- }
2430
- onPartialChange(val) {
2431
- this.formPartialValue = val;
2432
- }
2433
- onChange(val) {
2434
- this.formValue = val;
2435
- }
2436
- onValidChange(val) {
2437
- this.formValid = val;
2438
- }
2439
- initPageOptions() {
2440
- this.pageOptions = {
2441
- ...this.pageOptions,
2442
- title: this.getTitle(),
2443
- endButtons: this.getButtons(),
2444
- };
2445
- }
2446
- getButtons() {
2447
- const options = getModelOptions(this.config.type);
2448
- switch (this.mode) {
2449
- case "create":
2450
- return [
2451
- {
2452
- icon: "add",
2453
- text: "add",
2454
- handler: () => {
2455
- if (this.checkFirstInvalid()) {
2456
- return;
2457
- }
2458
- this.facade.create(this.formValue);
2459
- this.location.back();
2460
- },
2461
- },
2462
- ];
2463
- case "update":
2464
- return [
2465
- ...(this.config.details
2466
- ? [
2467
- {
2468
- icon: "close",
2469
- text: "cancel",
2470
- handler: () => {
2471
- this.mode = "details";
2472
- this.initPageOptions();
2473
- this.topTpl.clear();
2474
- this.bottomTpl.clear();
2475
- },
2476
- disabled$: new BehaviorSubject(false),
2477
- },
2478
- ]
2479
- : []),
2480
- {
2481
- icon: "save",
2482
- text: "save",
2483
- handler: () => {
2484
- if (this.checkFirstInvalid()) {
2485
- return;
2486
- }
2487
- this.formPartialValue.id = this.id;
2488
- this.facade.updatePartial(this.formPartialValue);
2489
- if (this.config.details) {
2490
- this.mode = "details";
2491
- this.initPageOptions();
2492
- }
2493
- else {
2494
- this.location.back();
2495
- }
2496
- },
2497
- },
2498
- ];
2499
- case "details":
2500
- return this.config.edit && (!options?.update?.enabled || SpecificationService.valid(this.item, options?.update?.enabled))
2501
- ? [
2502
- {
2503
- icon: "create",
2504
- text: "edit",
2505
- handler: () => {
2506
- this.mode = "update";
2507
- this.generateComponents('edit');
2508
- this.initPageOptions();
2509
- },
2510
- disabled$: new BehaviorSubject(false),
2511
- },
2512
- ]
2513
- : [];
2514
- }
2515
- }
2516
- getTitle() {
2517
- const options = getModelOptions(this.config.type);
2518
- const prefix = options.titleKey && this.item ? this.removeParagraph(this.item[options.titleKey]) + ' - ' : '';
2519
- switch (this.mode) {
2520
- case "create":
2521
- return "add";
2522
- case "update":
2523
- return prefix + this.translateService.instant("change");
2524
- case "details":
2525
- return prefix + this.translateService.instant("details");
2526
- }
2527
- }
2528
- removeParagraph(val) {
2529
- if (!val || val.indexOf('<p>') !== 0)
2530
- return val;
2531
- const div = document.createElement("div");
2532
- div.innerHTML = val;
2533
- const item = div.querySelectorAll("p").item(0);
2534
- return item.innerHTML;
2535
- }
2536
- checkFirstInvalid() {
2537
- this.cd.detectChanges();
2538
- const form = this.template === 'default'
2539
- ? this.standardComponents.first.formComponents.first.form
2540
- : this.baseInstance.formComponents.first.form;
2541
- this.cd.detectChanges();
2542
- if (form.valid)
2543
- return false;
2544
- const invalidFields = [];
2545
- this.getInvalidFields(form, invalidFields, '');
2546
- this.toastService.info({
2547
- title: this.translateService.instant('INPUT.ERRORS.requires'),
2548
- message: invalidFields.slice(0, 3).join('<br/>')
2549
- });
2550
- return true;
2551
- }
2552
- getInvalidFields(control, invalidFields, baseField, key = null) {
2553
- if (control.valid)
2554
- return;
2555
- const field = key ? baseField + ' > ' + this.translateService.instant('MODEL.' + key) : baseField;
2556
- if (control.errors?.customMessage) {
2557
- invalidFields.push(field + ` (${control.errors.customMessage})`);
2558
- return;
2559
- }
2560
- if (control instanceof UntypedFormControl) {
2561
- invalidFields.push(field);
2562
- }
2563
- if (control instanceof UntypedFormGroup) {
2564
- Object.keys(control.controls).forEach(groupKey => {
2565
- this.getInvalidFields(control.controls[groupKey], invalidFields, field, groupKey);
2566
- });
2567
- }
2568
- if (control instanceof UntypedFormArray) {
2569
- control.controls.forEach((c, index) => {
2570
- this.getInvalidFields(c, invalidFields, field + `(${index + 1})`);
2571
- });
2572
- }
2573
- }
2574
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ItemComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: CrudFacade }, { token: CrudService }, { token: i1$2.ActivatedRoute }, { token: i3.DynamicComponentLoader }, { token: i4.TranslateService }, { token: CrudFullConfig }, { token: i3$1.Location }, { token: i0.ChangeDetectorRef }, { token: i3.AuthService }, { token: i3.StyleService }, { token: i0.ElementRef }, { token: i3.ToastService }, { token: PageService }, { token: i0.NgModuleRef }, { token: i0.ComponentFactoryResolver }, { token: i3.DetailsService }], target: i0.ɵɵFactoryTarget.Component }); }
2575
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: ItemComponent, selector: "smart-crud-item-page", viewQueries: [{ propertyName: "content", first: true, predicate: IonContent, descendants: true, static: true }, { propertyName: "contentTpl", first: true, predicate: ["contentTpl"], descendants: true, read: TemplateRef }, { propertyName: "topTpl", first: true, predicate: ["topTpl"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "bottomTpl", first: true, predicate: ["bottomTpl"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "standardComponents", predicate: ItemStandardComponent, descendants: true, read: ItemStandardComponent }, { propertyName: "dynamicContents", predicate: DynamicContentDirective, descendants: true, read: DynamicContentDirective }], usesInheritance: true, ngImport: i0, template: `
2576
- <smart-page [options]="pageOptions">
2577
- <div #topTpl class="top-content"></div>
2578
- <smart-crud-item-standard-page *ngIf="template === 'default'"
2579
- [detailsOptions]="detailsOptions"
2580
- [mode]="mode"
2581
- [uniqueProvider]="uniqueProvider"
2582
- (onPartialChange)="onPartialChange($event)"
2583
- (onChange)="onChange($event)"
2584
- (onValidChange)="onValidChange($event)"
2585
- >
2586
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2587
- </smart-crud-item-standard-page>
2588
- <ng-template #contentTpl>
2589
- <ng-content></ng-content>
2590
- </ng-template>
2591
- <div class="dynamic-content"></div>
2592
- <div #bottomTpl class="bottom-content"></div>
2593
- </smart-page>
2594
- `, isInline: true, dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.PageComponent, selector: "smart-page", inputs: ["options"] }, { kind: "directive", type: i3.DynamicContentDirective, selector: ".dynamic-content" }, { kind: "component", type: ItemStandardComponent, selector: "smart-crud-item-standard-page" }] }); }
2595
- }
2596
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ItemComponent, decorators: [{
2597
- type: Component,
2598
- args: [{
2599
- selector: "smart-crud-item-page",
2600
- template: `
2601
- <smart-page [options]="pageOptions">
2602
- <div #topTpl class="top-content"></div>
2603
- <smart-crud-item-standard-page *ngIf="template === 'default'"
2604
- [detailsOptions]="detailsOptions"
2605
- [mode]="mode"
2606
- [uniqueProvider]="uniqueProvider"
2607
- (onPartialChange)="onPartialChange($event)"
2608
- (onChange)="onChange($event)"
2609
- (onValidChange)="onValidChange($event)"
2610
- >
2611
- <ng-container [ngTemplateOutlet]="contentTpl"></ng-container>
2612
- </smart-crud-item-standard-page>
2613
- <ng-template #contentTpl>
2614
- <ng-content></ng-content>
2615
- </ng-template>
2616
- <div class="dynamic-content"></div>
2617
- <div #bottomTpl class="bottom-content"></div>
2618
- </smart-page>
2619
- `
2620
- }]
2621
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: CrudFacade }, { type: CrudService }, { type: i1$2.ActivatedRoute }, { type: i3.DynamicComponentLoader }, { type: i4.TranslateService }, { type: CrudFullConfig }, { type: i3$1.Location }, { type: i0.ChangeDetectorRef }, { type: i3.AuthService }, { type: i3.StyleService }, { type: i0.ElementRef }, { type: i3.ToastService }, { type: PageService }, { type: i0.NgModuleRef }, { type: i0.ComponentFactoryResolver }, { type: i3.DetailsService }]; }, propDecorators: { standardComponents: [{
2622
- type: ViewChildren,
2623
- args: [ItemStandardComponent, { read: ItemStandardComponent }]
2624
- }], content: [{
2625
- type: ViewChild,
2626
- args: [IonContent, { static: true }]
2627
- }], contentTpl: [{
2628
- type: ViewChild,
2629
- args: ["contentTpl", { read: TemplateRef, static: false }]
2630
- }], topTpl: [{
2631
- type: ViewChild,
2632
- args: ["topTpl", { read: ViewContainerRef, static: true }]
2633
- }], bottomTpl: [{
2634
- type: ViewChild,
2635
- args: ["bottomTpl", { read: ViewContainerRef, static: true }]
2636
- }], dynamicContents: [{
2637
- type: ViewChildren,
2638
- args: [DynamicContentDirective, { read: DynamicContentDirective }]
2639
- }] } });
2640
-
2641
- const PAGES = [
2642
- ItemComponent,
2643
- ListComponent,
2644
- ListStandardComponent,
2645
- ItemStandardComponent
2646
- ];
2647
- class CrudFullModule {
2648
- constructor(store, config, effects) {
2649
- NgrxStoreService.addReducer(config.entity, config.reducerFactory
2650
- ? config.reducerFactory()
2651
- : getReducer(config.entity));
2652
- effects.init();
2653
- }
2654
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFullModule, deps: [{ token: i1.Store }, { token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule }); }
2655
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: CrudFullModule, declarations: [ItemComponent,
2656
- ListComponent,
2657
- ListStandardComponent,
2658
- ItemStandardComponent], imports: [StoreModule,
2659
- SharedModule,
2660
- CrudPipesModule, i1$2.RouterModule, FormsModule,
2661
- CommonModule,
2662
- CrudComponentsModule], exports: [ItemComponent,
2663
- ListComponent,
2664
- ListStandardComponent,
2665
- ItemStandardComponent, CrudComponentsModule] }); }
2666
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFullModule, providers: [
2667
- CrudService,
2668
- CrudListGroupService,
2669
- PageService,
2670
- CrudEffects,
2671
- CrudFacade,
2672
- CrudListPaginationFactory,
2673
- ], imports: [StoreModule,
2674
- SharedModule,
2675
- CrudPipesModule,
2676
- RouterModule.forChild([
2677
- { path: '', component: ListComponent },
2678
- { path: 'add', component: ItemComponent },
2679
- { path: ':id', component: ItemComponent }
2680
- ]),
2681
- FormsModule,
2682
- CommonModule,
2683
- CrudComponentsModule, CrudComponentsModule] }); }
2684
- }
2685
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudFullModule, decorators: [{
2686
- type: NgModule,
2687
- args: [{
2688
- declarations: [
2689
- ...PAGES
2690
- ],
2691
- imports: [
2692
- StoreModule,
2693
- SharedModule,
2694
- CrudPipesModule,
2695
- RouterModule.forChild([
2696
- { path: '', component: ListComponent },
2697
- { path: 'add', component: ItemComponent },
2698
- { path: ':id', component: ItemComponent }
2699
- ]),
2700
- FormsModule,
2701
- CommonModule,
2702
- CrudComponentsModule
2703
- ],
2704
- exports: [
2705
- ...PAGES,
2706
- CrudComponentsModule
2707
- ],
2708
- providers: [
2709
- CrudService,
2710
- CrudListGroupService,
2711
- PageService,
2712
- CrudEffects,
2713
- CrudFacade,
2714
- CrudListPaginationFactory,
2715
- ]
2716
- }]
2717
- }], ctorParameters: function () { return [{ type: i1.Store }, { type: CrudConfig }, { type: CrudEffects }]; } });
2718
-
2719
- class CrudCoreModule {
2720
- constructor(config, effects) {
2721
- NgrxStoreService.addReducer(config.entity, config.reducerFactory
2722
- ? config.reducerFactory()
2723
- : getReducer(config.entity));
2724
- effects.init();
2725
- }
2726
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudCoreModule, deps: [{ token: CrudConfig }, { token: CrudEffects }], target: i0.ɵɵFactoryTarget.NgModule }); }
2727
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: CrudCoreModule, imports: [
2728
- //AuthSharedModule,
2729
- StoreModule,
2730
- SharedModule,
2731
- CrudPipesModule,
2732
- FormsModule,
2733
- CommonModule,
2734
- CrudComponentsModule,
2735
- NgrxSharedModule], exports: [CrudComponentsModule] }); }
2736
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudCoreModule, providers: [
2737
- CrudService,
2738
- CrudListGroupService,
2739
- PageService,
2740
- CrudEffects,
2741
- CrudFacade,
2742
- SocketService,
2743
- CrudListPaginationFactory,
2744
- ], imports: [
2745
- //AuthSharedModule,
2746
- StoreModule,
2747
- SharedModule,
2748
- CrudPipesModule,
2749
- FormsModule,
2750
- CommonModule,
2751
- CrudComponentsModule,
2752
- NgrxSharedModule, CrudComponentsModule] }); }
2753
- }
2754
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudCoreModule, decorators: [{
2755
- type: NgModule,
2756
- args: [{
2757
- imports: [
2758
- //AuthSharedModule,
2759
- StoreModule,
2760
- SharedModule,
2761
- CrudPipesModule,
2762
- FormsModule,
2763
- CommonModule,
2764
- CrudComponentsModule,
2765
- NgrxSharedModule,
2766
- ],
2767
- exports: [CrudComponentsModule],
2768
- providers: [
2769
- CrudService,
2770
- CrudListGroupService,
2771
- PageService,
2772
- CrudEffects,
2773
- CrudFacade,
2774
- SocketService,
2775
- CrudListPaginationFactory,
2776
- ],
2777
- }]
2778
- }], ctorParameters: function () { return [{ type: CrudConfig }, { type: CrudEffects }]; } });
2779
- class CrudModule {
2780
- static forFeature(options) {
2781
- return {
2782
- ngModule: options.routing ? CrudFullModule : CrudCoreModule,
2783
- providers: [
2784
- { provide: CrudConfig, useValue: options.config },
2785
- { provide: CrudFullConfig, useValue: options.config },
2786
- {
2787
- provide: FILE_SERVICE_CONFIG,
2788
- useValue: { apiUrl: options.config.apiUrl },
2789
- },
2790
- ...(options.socket
2791
- ? [SocketService]
2792
- : [{ provide: SocketService, useClass: NotSocketService }]),
2793
- ],
2794
- };
2795
- }
2796
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2797
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: CrudModule }); }
2798
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudModule }); }
2799
- }
2800
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CrudModule, decorators: [{
2801
- type: NgModule,
2802
- args: [{}]
2803
- }] });
2804
-
2805
- /**
2806
- * Generated bundle index. Do not edit.
2807
- */
2808
-
2809
- export { CRUD_MODEL_POSSIBILITIES_PROVIDER, CrudComponentsModule, CrudConfig, CrudCoreModule, CrudEffects, CrudFacade, CrudFullConfig, CrudFullModule, CrudItemPageBaseComponent, CrudListPageBaseComponent, CrudListPaginationFactory, CrudModule, CrudPipesModule, CrudSearchService, CrudService, ExportComponent, FilterCheckComponent, FilterComponent, FilterDateComponent, FilterDateTimeComponent, FilterDateWithEditComponent, FilterFlagComponent, FilterIntComponent, FilterRadioComponent, FilterTextComponent, FiltersComponent, FiltersConfigComponent, FormOptionsPipe, GroupComponent, ICrudModelPossibilitiesProvider, ItemComponent, ItemStandardComponent, ListComponent, ListStandardComponent, MultiselectComponent, PAGES, PageService, clear, create, createFailure, createMany, createManyFailure, createManySuccess, createSuccess, deleteFailure, deleteItem, deleteSuccess, exportList, exportListFailure, exportListSuccess, getCrudError, getCrudFilter, getCrudLinks, getCrudList, getCrudLoaded, getCrudMultiSelected, getCrudSelected, getCrudState, getCrudTotalCount, getReducer, initialState, multiSelect, read, readFailure, readSuccess, select, selectFailure, selectSuccess, unselect, update, updateFailure, updatePartial, updatePartialFailure, updatePartialMany, updatePartialManyFailure, updatePartialManySuccess, updatePartialSuccess, updateSuccess };
2810
- //# sourceMappingURL=smartsoft001-crud-shell-angular.mjs.map