@smartsoft001/crud-shell-react 0.0.0-stage → 2.193.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.
- package/README.md +12 -3
- package/package.json +29 -4
- package/src/index.d.ts +19 -0
- package/src/index.js +23 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/export/export.d.ts +7 -0
- package/src/lib/components/export/export.js +15 -0
- package/src/lib/components/export/export.js.map +1 -0
- package/src/lib/components/export/export.types.d.ts +8 -0
- package/src/lib/components/export/export.types.js +3 -0
- package/src/lib/components/export/export.types.js.map +1 -0
- package/src/lib/components/export/index.d.ts +3 -0
- package/src/lib/components/export/index.js +7 -0
- package/src/lib/components/export/index.js.map +1 -0
- package/src/lib/components/export/use-crud-export.d.ts +16 -0
- package/src/lib/components/export/use-crud-export.js +74 -0
- package/src/lib/components/export/use-crud-export.js.map +1 -0
- package/src/lib/components/filter/base/use-crud-filter.d.ts +68 -0
- package/src/lib/components/filter/base/use-crud-filter.js +248 -0
- package/src/lib/components/filter/base/use-crud-filter.js.map +1 -0
- package/src/lib/components/filter/check/filter-check.d.ts +7 -0
- package/src/lib/components/filter/check/filter-check.js +45 -0
- package/src/lib/components/filter/check/filter-check.js.map +1 -0
- package/src/lib/components/filter/date/filter-date.d.ts +7 -0
- package/src/lib/components/filter/date/filter-date.js +19 -0
- package/src/lib/components/filter/date/filter-date.js.map +1 -0
- package/src/lib/components/filter/date/use-crud-filter-date.d.ts +23 -0
- package/src/lib/components/filter/date/use-crud-filter-date.js +41 -0
- package/src/lib/components/filter/date/use-crud-filter-date.js.map +1 -0
- package/src/lib/components/filter/date/use-crud-filter-ng-model.d.ts +6 -0
- package/src/lib/components/filter/date/use-crud-filter-ng-model.js +25 -0
- package/src/lib/components/filter/date/use-crud-filter-ng-model.js.map +1 -0
- package/src/lib/components/filter/date-time/filter-date-time.d.ts +8 -0
- package/src/lib/components/filter/date-time/filter-date-time.js +27 -0
- package/src/lib/components/filter/date-time/filter-date-time.js.map +1 -0
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.d.ts +9 -0
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js +42 -0
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js.map +1 -0
- package/src/lib/components/filter/filter.d.ts +8 -0
- package/src/lib/components/filter/filter.js +43 -0
- package/src/lib/components/filter/filter.js.map +1 -0
- package/src/lib/components/filter/filter.types.d.ts +17 -0
- package/src/lib/components/filter/filter.types.js +3 -0
- package/src/lib/components/filter/filter.types.js.map +1 -0
- package/src/lib/components/filter/flag/filter-flag.d.ts +7 -0
- package/src/lib/components/filter/flag/filter-flag.js +20 -0
- package/src/lib/components/filter/flag/filter-flag.js.map +1 -0
- package/src/lib/components/filter/index.d.ts +13 -0
- package/src/lib/components/filter/index.js +17 -0
- package/src/lib/components/filter/index.js.map +1 -0
- package/src/lib/components/filter/int/filter-int.d.ts +12 -0
- package/src/lib/components/filter/int/filter-int.js +47 -0
- package/src/lib/components/filter/int/filter-int.js.map +1 -0
- package/src/lib/components/filter/radio/filter-radio.d.ts +7 -0
- package/src/lib/components/filter/radio/filter-radio.js +20 -0
- package/src/lib/components/filter/radio/filter-radio.js.map +1 -0
- package/src/lib/components/filter/text/filter-text.d.ts +7 -0
- package/src/lib/components/filter/text/filter-text.js +20 -0
- package/src/lib/components/filter/text/filter-text.js.map +1 -0
- package/src/lib/components/filters/filters.d.ts +10 -0
- package/src/lib/components/filters/filters.js +20 -0
- package/src/lib/components/filters/filters.js.map +1 -0
- package/src/lib/components/filters/filters.types.d.ts +5 -0
- package/src/lib/components/filters/filters.types.js +3 -0
- package/src/lib/components/filters/filters.types.js.map +1 -0
- package/src/lib/components/filters/index.d.ts +3 -0
- package/src/lib/components/filters/index.js +7 -0
- package/src/lib/components/filters/index.js.map +1 -0
- package/src/lib/components/filters/use-crud-filters.d.ts +17 -0
- package/src/lib/components/filters/use-crud-filters.js +63 -0
- package/src/lib/components/filters/use-crud-filters.js.map +1 -0
- package/src/lib/components/filters-config/filters-config.d.ts +6 -0
- package/src/lib/components/filters-config/filters-config.js +38 -0
- package/src/lib/components/filters-config/filters-config.js.map +1 -0
- package/src/lib/components/filters-config/index.d.ts +1 -0
- package/src/lib/components/filters-config/index.js +5 -0
- package/src/lib/components/filters-config/index.js.map +1 -0
- package/src/lib/components/group/group.d.ts +10 -0
- package/src/lib/components/group/group.js +19 -0
- package/src/lib/components/group/group.js.map +1 -0
- package/src/lib/components/group/group.types.d.ts +8 -0
- package/src/lib/components/group/group.types.js +3 -0
- package/src/lib/components/group/group.types.js.map +1 -0
- package/src/lib/components/group/index.d.ts +3 -0
- package/src/lib/components/group/index.js +7 -0
- package/src/lib/components/group/index.js.map +1 -0
- package/src/lib/components/group/use-crud-group.d.ts +17 -0
- package/src/lib/components/group/use-crud-group.js +50 -0
- package/src/lib/components/group/use-crud-group.js.map +1 -0
- package/src/lib/components/multiselect/index.d.ts +2 -0
- package/src/lib/components/multiselect/index.js +6 -0
- package/src/lib/components/multiselect/index.js.map +1 -0
- package/src/lib/components/multiselect/multiselect.d.ts +10 -0
- package/src/lib/components/multiselect/multiselect.js +25 -0
- package/src/lib/components/multiselect/multiselect.js.map +1 -0
- package/src/lib/components/multiselect/use-crud-multiselect.d.ts +24 -0
- package/src/lib/components/multiselect/use-crud-multiselect.js +72 -0
- package/src/lib/components/multiselect/use-crud-multiselect.js.map +1 -0
- package/src/lib/crud.config.d.ts +67 -0
- package/src/lib/crud.config.js +3 -0
- package/src/lib/crud.config.js.map +1 -0
- package/src/lib/crud.context.d.ts +23 -0
- package/src/lib/crud.context.js +25 -0
- package/src/lib/crud.context.js.map +1 -0
- package/src/lib/crud.provider.d.ts +16 -0
- package/src/lib/crud.provider.js +69 -0
- package/src/lib/crud.provider.js.map +1 -0
- package/src/lib/factories/form-options.d.ts +10 -0
- package/src/lib/factories/form-options.js +26 -0
- package/src/lib/factories/form-options.js.map +1 -0
- package/src/lib/hooks.d.ts +15 -0
- package/src/lib/hooks.js +66 -0
- package/src/lib/hooks.js.map +1 -0
- package/src/lib/models/index.d.ts +1 -0
- package/src/lib/models/index.js +5 -0
- package/src/lib/models/index.js.map +1 -0
- package/src/lib/models/interfaces.d.ts +29 -0
- package/src/lib/models/interfaces.js +3 -0
- package/src/lib/models/interfaces.js.map +1 -0
- package/src/lib/pages/crud-pages.d.ts +32 -0
- package/src/lib/pages/crud-pages.js +64 -0
- package/src/lib/pages/crud-pages.js.map +1 -0
- package/src/lib/pages/index.d.ts +12 -0
- package/src/lib/pages/index.js +16 -0
- package/src/lib/pages/index.js.map +1 -0
- package/src/lib/pages/item/item-page.d.ts +18 -0
- package/src/lib/pages/item/item-page.js +31 -0
- package/src/lib/pages/item/item-page.js.map +1 -0
- package/src/lib/pages/item/item-page.types.d.ts +47 -0
- package/src/lib/pages/item/item-page.types.js +3 -0
- package/src/lib/pages/item/item-page.types.js.map +1 -0
- package/src/lib/pages/item/standard/item-page-standard.d.ts +10 -0
- package/src/lib/pages/item/standard/item-page-standard.js +19 -0
- package/src/lib/pages/item/standard/item-page-standard.js.map +1 -0
- package/src/lib/pages/item/use-crud-item-page-base.d.ts +22 -0
- package/src/lib/pages/item/use-crud-item-page-base.js +47 -0
- package/src/lib/pages/item/use-crud-item-page-base.js.map +1 -0
- package/src/lib/pages/item/use-crud-item-page.d.ts +44 -0
- package/src/lib/pages/item/use-crud-item-page.js +297 -0
- package/src/lib/pages/item/use-crud-item-page.js.map +1 -0
- package/src/lib/pages/list/list-page.d.ts +17 -0
- package/src/lib/pages/list/list-page.js +32 -0
- package/src/lib/pages/list/list-page.js.map +1 -0
- package/src/lib/pages/list/list-page.types.d.ts +27 -0
- package/src/lib/pages/list/list-page.types.js +3 -0
- package/src/lib/pages/list/list-page.types.js.map +1 -0
- package/src/lib/pages/list/standard/list-page-standard.d.ts +13 -0
- package/src/lib/pages/list/standard/list-page-standard.js +28 -0
- package/src/lib/pages/list/standard/list-page-standard.js.map +1 -0
- package/src/lib/pages/list/use-crud-list-page.d.ts +35 -0
- package/src/lib/pages/list/use-crud-list-page.js +309 -0
- package/src/lib/pages/list/use-crud-list-page.js.map +1 -0
- package/src/lib/pages/use-crud-bound-component.d.ts +10 -0
- package/src/lib/pages/use-crud-bound-component.js +28 -0
- package/src/lib/pages/use-crud-bound-component.js.map +1 -0
- package/src/lib/pages/use-crud-page-config.d.ts +9 -0
- package/src/lib/pages/use-crud-page-config.js +19 -0
- package/src/lib/pages/use-crud-page-config.js.map +1 -0
- package/src/lib/providers/model-label.provider.d.ts +11 -0
- package/src/lib/providers/model-label.provider.js +27 -0
- package/src/lib/providers/model-label.provider.js.map +1 -0
- package/src/lib/services/crud/crud.service.d.ts +44 -0
- package/src/lib/services/crud/crud.service.js +113 -0
- package/src/lib/services/crud/crud.service.js.map +1 -0
- package/src/lib/services/list-group/list-group.service.d.ts +18 -0
- package/src/lib/services/list-group/list-group.service.js +52 -0
- package/src/lib/services/list-group/list-group.service.js.map +1 -0
- package/src/lib/services/page/page.service.d.ts +8 -0
- package/src/lib/services/page/page.service.js +33 -0
- package/src/lib/services/page/page.service.js.map +1 -0
- package/src/lib/services/search/search.service.d.ts +14 -0
- package/src/lib/services/search/search.service.js +28 -0
- package/src/lib/services/search/search.service.js.map +1 -0
- package/src/lib/state/crud.actions.d.ts +157 -0
- package/src/lib/state/crud.actions.js +257 -0
- package/src/lib/state/crud.actions.js.map +1 -0
- package/src/lib/state/crud.effects.d.ts +20 -0
- package/src/lib/state/crud.effects.js +128 -0
- package/src/lib/state/crud.effects.js.map +1 -0
- package/src/lib/state/crud.facade.d.ts +43 -0
- package/src/lib/state/crud.facade.js +93 -0
- package/src/lib/state/crud.facade.js.map +1 -0
- package/src/lib/state/crud.reducer.d.ts +20 -0
- package/src/lib/state/crud.reducer.js +218 -0
- package/src/lib/state/crud.reducer.js.map +1 -0
- package/src/lib/state/crud.selectors.d.ts +9 -0
- package/src/lib/state/crud.selectors.js +25 -0
- package/src/lib/state/crud.selectors.js.map +1 -0
- package/src/lib/state/crud.store.d.ts +17 -0
- package/src/lib/state/crud.store.js +33 -0
- package/src/lib/state/crud.store.js.map +1 -0
- package/src/lib/state/index.d.ts +6 -0
- package/src/lib/state/index.js +10 -0
- package/src/lib/state/index.js.map +1 -0
- package/styles.css +6001 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteFailure = exports.deleteSuccess = exports.deleteItem = exports.updatePartialManyFailure = exports.updatePartialManySuccess = exports.updatePartialMany = exports.updatePartialFailure = exports.updatePartialSuccess = exports.updatePartial = exports.updateFailure = exports.updateSuccess = exports.update = exports.multiSelect = exports.unselect = exports.selectFailure = exports.selectSuccess = exports.select = exports.exportListFailure = exports.exportListSuccess = exports.exportList = exports.clear = exports.readFailure = exports.readSuccess = exports.read = exports.createManyFailure = exports.createManySuccess = exports.createMany = exports.createFailure = exports.createSuccess = exports.create = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Create
|
|
6
|
+
*/
|
|
7
|
+
const create = function (entity, item) {
|
|
8
|
+
return {
|
|
9
|
+
type: `[${entity}] Create`,
|
|
10
|
+
item,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.create = create;
|
|
14
|
+
const createSuccess = function (entity, item) {
|
|
15
|
+
return {
|
|
16
|
+
type: `[${entity}] Create Success`,
|
|
17
|
+
item,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.createSuccess = createSuccess;
|
|
21
|
+
const createFailure = function (entity, item, error) {
|
|
22
|
+
return {
|
|
23
|
+
type: `[${entity}] Create Failure`,
|
|
24
|
+
item,
|
|
25
|
+
error,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.createFailure = createFailure;
|
|
29
|
+
/*
|
|
30
|
+
* Create many
|
|
31
|
+
*/
|
|
32
|
+
const createMany = function (entity, data) {
|
|
33
|
+
return {
|
|
34
|
+
type: `[${entity}] Create Many`,
|
|
35
|
+
data,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.createMany = createMany;
|
|
39
|
+
const createManySuccess = function (entity, data) {
|
|
40
|
+
return {
|
|
41
|
+
type: `[${entity}] Create Many Success`,
|
|
42
|
+
data,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.createManySuccess = createManySuccess;
|
|
46
|
+
const createManyFailure = function (entity, data, error) {
|
|
47
|
+
return {
|
|
48
|
+
type: `[${entity}] Create Many Failure`,
|
|
49
|
+
data,
|
|
50
|
+
error,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
exports.createManyFailure = createManyFailure;
|
|
54
|
+
/*
|
|
55
|
+
* Read
|
|
56
|
+
*/
|
|
57
|
+
const read = function (entity, filter) {
|
|
58
|
+
return {
|
|
59
|
+
type: `[${entity}] Read`,
|
|
60
|
+
filter: filter,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.read = read;
|
|
64
|
+
const readSuccess = function (entity, filter, result) {
|
|
65
|
+
return {
|
|
66
|
+
type: `[${entity}] Read Success`,
|
|
67
|
+
result,
|
|
68
|
+
filter,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.readSuccess = readSuccess;
|
|
72
|
+
const readFailure = function (entity, filter, error) {
|
|
73
|
+
return {
|
|
74
|
+
type: `[${entity}] Read Failure`,
|
|
75
|
+
filter,
|
|
76
|
+
error,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.readFailure = readFailure;
|
|
80
|
+
/*
|
|
81
|
+
* Clear
|
|
82
|
+
*/
|
|
83
|
+
const clear = function (entity) {
|
|
84
|
+
return {
|
|
85
|
+
type: `[${entity}] Clear`,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
exports.clear = clear;
|
|
89
|
+
/*
|
|
90
|
+
* Export
|
|
91
|
+
*/
|
|
92
|
+
const exportList = function (entity, filter = null, format) {
|
|
93
|
+
return {
|
|
94
|
+
type: `[${entity}] Export`,
|
|
95
|
+
filter: filter,
|
|
96
|
+
format,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
exports.exportList = exportList;
|
|
100
|
+
const exportListSuccess = function (entity, filter) {
|
|
101
|
+
return {
|
|
102
|
+
type: `[${entity}] Export Success`,
|
|
103
|
+
filter,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
exports.exportListSuccess = exportListSuccess;
|
|
107
|
+
const exportListFailure = function (entity, filter, error) {
|
|
108
|
+
return {
|
|
109
|
+
type: `[${entity}] Export Failure`,
|
|
110
|
+
filter,
|
|
111
|
+
error,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
exports.exportListFailure = exportListFailure;
|
|
115
|
+
/*
|
|
116
|
+
* Select
|
|
117
|
+
*/
|
|
118
|
+
const select = function (entity, id) {
|
|
119
|
+
return {
|
|
120
|
+
type: `[${entity}] Select`,
|
|
121
|
+
id,
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
exports.select = select;
|
|
125
|
+
const selectSuccess = function (entity, id, item) {
|
|
126
|
+
return {
|
|
127
|
+
type: `[${entity}] Select Success`,
|
|
128
|
+
id,
|
|
129
|
+
item,
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
exports.selectSuccess = selectSuccess;
|
|
133
|
+
const selectFailure = function (entity, id, error) {
|
|
134
|
+
return {
|
|
135
|
+
type: `[${entity}] Select Failure`,
|
|
136
|
+
id,
|
|
137
|
+
error,
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
exports.selectFailure = selectFailure;
|
|
141
|
+
const unselect = function (entity) {
|
|
142
|
+
return {
|
|
143
|
+
type: `[${entity}] Unselect`,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
exports.unselect = unselect;
|
|
147
|
+
/*
|
|
148
|
+
* MultiSelect
|
|
149
|
+
*/
|
|
150
|
+
const multiSelect = function (entity, items) {
|
|
151
|
+
return {
|
|
152
|
+
type: `[${entity}] MultiSelect`,
|
|
153
|
+
items,
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
exports.multiSelect = multiSelect;
|
|
157
|
+
/*
|
|
158
|
+
* Update
|
|
159
|
+
*/
|
|
160
|
+
const update = function (entity, item) {
|
|
161
|
+
return {
|
|
162
|
+
type: `[${entity}] Update`,
|
|
163
|
+
item,
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
exports.update = update;
|
|
167
|
+
const updateSuccess = function (entity, item) {
|
|
168
|
+
return {
|
|
169
|
+
type: `[${entity}] Update Success`,
|
|
170
|
+
item,
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
exports.updateSuccess = updateSuccess;
|
|
174
|
+
const updateFailure = function (entity, item, error) {
|
|
175
|
+
return {
|
|
176
|
+
type: `[${entity}] Update Failure`,
|
|
177
|
+
item,
|
|
178
|
+
error,
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
exports.updateFailure = updateFailure;
|
|
182
|
+
/*
|
|
183
|
+
* Update partial
|
|
184
|
+
*/
|
|
185
|
+
const updatePartial = function (entity, item) {
|
|
186
|
+
return {
|
|
187
|
+
type: `[${entity}] Update partial`,
|
|
188
|
+
item,
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
exports.updatePartial = updatePartial;
|
|
192
|
+
const updatePartialSuccess = function (entity, item) {
|
|
193
|
+
return {
|
|
194
|
+
type: `[${entity}] Update partial Success`,
|
|
195
|
+
item,
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
exports.updatePartialSuccess = updatePartialSuccess;
|
|
199
|
+
const updatePartialFailure = function (entity, item, error) {
|
|
200
|
+
return {
|
|
201
|
+
type: `[${entity}] Update partial Failure`,
|
|
202
|
+
item,
|
|
203
|
+
error,
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
exports.updatePartialFailure = updatePartialFailure;
|
|
207
|
+
/*
|
|
208
|
+
* Update partial many
|
|
209
|
+
*/
|
|
210
|
+
const updatePartialMany = function (entity, items) {
|
|
211
|
+
return {
|
|
212
|
+
type: `[${entity}] Update partial many`,
|
|
213
|
+
items,
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
exports.updatePartialMany = updatePartialMany;
|
|
217
|
+
const updatePartialManySuccess = function (entity, items) {
|
|
218
|
+
return {
|
|
219
|
+
type: `[${entity}] Update partial many Success`,
|
|
220
|
+
items,
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
exports.updatePartialManySuccess = updatePartialManySuccess;
|
|
224
|
+
const updatePartialManyFailure = function (entity, items, error) {
|
|
225
|
+
return {
|
|
226
|
+
type: `[${entity}] Update partial many Failure`,
|
|
227
|
+
items,
|
|
228
|
+
error,
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
exports.updatePartialManyFailure = updatePartialManyFailure;
|
|
232
|
+
/*
|
|
233
|
+
* Delete
|
|
234
|
+
*/
|
|
235
|
+
const deleteItem = function (entity, id) {
|
|
236
|
+
return {
|
|
237
|
+
type: `[${entity}] Delete`,
|
|
238
|
+
id,
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
exports.deleteItem = deleteItem;
|
|
242
|
+
const deleteSuccess = function (entity, id) {
|
|
243
|
+
return {
|
|
244
|
+
type: `[${entity}] Delete Success`,
|
|
245
|
+
id,
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
exports.deleteSuccess = deleteSuccess;
|
|
249
|
+
const deleteFailure = function (entity, id, error) {
|
|
250
|
+
return {
|
|
251
|
+
type: `[${entity}] Delete Failure`,
|
|
252
|
+
id,
|
|
253
|
+
error,
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
exports.deleteFailure = deleteFailure;
|
|
257
|
+
//# sourceMappingURL=crud.actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.actions.js","sourceRoot":"","sources":["../../../../../../../../packages/crud/shell/react/src/lib/state/crud.actions.ts"],"names":[],"mappings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AAU;QAC1B,EAAE;KACH,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,UAAU,cAQrB;AAEK,MAAM,aAAa,GAAG,UAC3B,MAAc,EACd,EAAU;IAEV,OAAO;QACL,IAAI,EAAE,IAAI,MAAM,kBAAkB;QAClC,EAAE;KACH,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,aAAa,iBAQxB;AAEK,MAAM,aAAa,GAAG,UAC3B,MAAc,EACd,EAAU,EACV,KAAU;IAEV,OAAO;QACL,IAAI,EAAE,IAAI,MAAM,kBAAkB;QAClC,EAAE;QACF,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IEntity } from '@smartsoft001/domain-core';
|
|
2
|
+
import { CrudStore } from './crud.store';
|
|
3
|
+
import { CrudService } from '../services/crud/crud.service';
|
|
4
|
+
/**
|
|
5
|
+
* The side effects of the CRUD actions, ported from the Angular
|
|
6
|
+
* `CrudEffects`: each request action calls the service and dispatches its
|
|
7
|
+
* success or failure; a successful write reloads the list from the first page
|
|
8
|
+
* (and re-selects the updated item).
|
|
9
|
+
*
|
|
10
|
+
* Unlike the Angular effects, which warned about every action they did not
|
|
11
|
+
* handle (including other entities' actions), unhandled actions are ignored.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CrudEffects<T extends IEntity<string>> {
|
|
14
|
+
service: CrudService<T>;
|
|
15
|
+
/** Public so a feature can switch to a new service, e.g. a new `apiUrl`. */
|
|
16
|
+
constructor(service: CrudService<T>);
|
|
17
|
+
/** Starts handling the actions of `store`; returns the unsubscribe. */
|
|
18
|
+
init(store: CrudStore): () => void;
|
|
19
|
+
private handle;
|
|
20
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CrudEffects = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const CrudActions = tslib_1.__importStar(require("./crud.actions"));
|
|
6
|
+
const crud_selectors_1 = require("./crud.selectors");
|
|
7
|
+
/**
|
|
8
|
+
* The side effects of the CRUD actions, ported from the Angular
|
|
9
|
+
* `CrudEffects`: each request action calls the service and dispatches its
|
|
10
|
+
* success or failure; a successful write reloads the list from the first page
|
|
11
|
+
* (and re-selects the updated item).
|
|
12
|
+
*
|
|
13
|
+
* Unlike the Angular effects, which warned about every action they did not
|
|
14
|
+
* handle (including other entities' actions), unhandled actions are ignored.
|
|
15
|
+
*/
|
|
16
|
+
class CrudEffects {
|
|
17
|
+
service;
|
|
18
|
+
/** Public so a feature can switch to a new service, e.g. a new `apiUrl`. */
|
|
19
|
+
constructor(service) {
|
|
20
|
+
this.service = service;
|
|
21
|
+
}
|
|
22
|
+
/** Starts handling the actions of `store`; returns the unsubscribe. */
|
|
23
|
+
init(store) {
|
|
24
|
+
return store.onAction((action) => this.handle(action, store));
|
|
25
|
+
}
|
|
26
|
+
handle(action, store) {
|
|
27
|
+
const entity = store.entity;
|
|
28
|
+
const dispatch = (next) => store.dispatch(next);
|
|
29
|
+
switch (action.type) {
|
|
30
|
+
case `[${entity}] Create`:
|
|
31
|
+
this.service
|
|
32
|
+
.create(action['item'])
|
|
33
|
+
.then(() => dispatch(CrudActions.createSuccess(entity, action['item'])))
|
|
34
|
+
.catch((error) => dispatch(CrudActions.createFailure(entity, action['item'], error)));
|
|
35
|
+
break;
|
|
36
|
+
case `[${entity}] Create Success`:
|
|
37
|
+
case `[${entity}] Create Many Success`: {
|
|
38
|
+
const filter = (0, crud_selectors_1.getCrudFilter)(store.get());
|
|
39
|
+
dispatch(CrudActions.read(entity, filter ? { ...filter, offset: 0 } : undefined));
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case `[${entity}] Create Many`:
|
|
43
|
+
this.service
|
|
44
|
+
.createMany(action['data'].items, action['data'].options)
|
|
45
|
+
.then(() => dispatch(CrudActions.createManySuccess(entity, {
|
|
46
|
+
items: action['data'].items,
|
|
47
|
+
options: action['data'].options,
|
|
48
|
+
})))
|
|
49
|
+
.catch((error) => dispatch(CrudActions.createManyFailure(entity, {
|
|
50
|
+
items: action['data'].items,
|
|
51
|
+
options: action['data'].options,
|
|
52
|
+
}, error)));
|
|
53
|
+
break;
|
|
54
|
+
case `[${entity}] Read`:
|
|
55
|
+
this.service
|
|
56
|
+
.getList(action['filter'])
|
|
57
|
+
.then((result) => dispatch(CrudActions.readSuccess(entity, action['filter'], result)))
|
|
58
|
+
.catch((error) => dispatch(CrudActions.readFailure(entity, action['filter'], error)));
|
|
59
|
+
break;
|
|
60
|
+
case `[${entity}] Export`:
|
|
61
|
+
this.service
|
|
62
|
+
.exportList(action['filter'], action['format'])
|
|
63
|
+
.then(() => dispatch(CrudActions.exportListSuccess(entity, action['filter'])))
|
|
64
|
+
.catch((error) => dispatch(CrudActions.exportListFailure(entity, action['filter'], error)));
|
|
65
|
+
break;
|
|
66
|
+
case `[${entity}] Select`:
|
|
67
|
+
this.service
|
|
68
|
+
.getById(action['id'])
|
|
69
|
+
.then((result) => dispatch(CrudActions.selectSuccess(entity, action['id'], result)))
|
|
70
|
+
.catch((error) => dispatch(CrudActions.selectFailure(entity, action['id'], error)));
|
|
71
|
+
break;
|
|
72
|
+
// The Angular effects sent a full update as a PATCH too; kept as is,
|
|
73
|
+
// since the NestJS shell treats both the same way.
|
|
74
|
+
case `[${entity}] Update`:
|
|
75
|
+
this.service
|
|
76
|
+
.updatePartial(action['item'])
|
|
77
|
+
.then(() => dispatch(CrudActions.updateSuccess(entity, action['item'])))
|
|
78
|
+
.catch((error) => {
|
|
79
|
+
dispatch(CrudActions.updateFailure(entity, action['item'], error));
|
|
80
|
+
dispatch(CrudActions.read(entity));
|
|
81
|
+
});
|
|
82
|
+
break;
|
|
83
|
+
case `[${entity}] Update partial`:
|
|
84
|
+
this.service
|
|
85
|
+
.updatePartial(action['item'])
|
|
86
|
+
.then(() => dispatch(CrudActions.updatePartialSuccess(entity, action['item'])))
|
|
87
|
+
.catch((error) => {
|
|
88
|
+
dispatch(CrudActions.updatePartialFailure(entity, action['item'], error));
|
|
89
|
+
dispatch(CrudActions.read(entity));
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
case `[${entity}] Update Success`:
|
|
93
|
+
case `[${entity}] Update partial Success`:
|
|
94
|
+
dispatch(CrudActions.read(entity, {
|
|
95
|
+
...(0, crud_selectors_1.getCrudFilter)(store.get()),
|
|
96
|
+
offset: 0,
|
|
97
|
+
}));
|
|
98
|
+
dispatch(CrudActions.select(entity, action['item'].id));
|
|
99
|
+
break;
|
|
100
|
+
case `[${entity}] Update partial many`:
|
|
101
|
+
this.service
|
|
102
|
+
.updatePartialMany(action['items'])
|
|
103
|
+
.then(() => dispatch(CrudActions.updatePartialManySuccess(entity, action['items'])))
|
|
104
|
+
.catch((error) => {
|
|
105
|
+
dispatch(CrudActions.updatePartialManyFailure(entity, action['items'], error));
|
|
106
|
+
dispatch(CrudActions.read(entity));
|
|
107
|
+
});
|
|
108
|
+
break;
|
|
109
|
+
case `[${entity}] Update partial many Success`:
|
|
110
|
+
case `[${entity}] Delete Success`:
|
|
111
|
+
dispatch(CrudActions.read(entity, {
|
|
112
|
+
...(0, crud_selectors_1.getCrudFilter)(store.get()),
|
|
113
|
+
offset: 0,
|
|
114
|
+
}));
|
|
115
|
+
break;
|
|
116
|
+
case `[${entity}] Delete`:
|
|
117
|
+
this.service
|
|
118
|
+
.delete(action['id'])
|
|
119
|
+
.then(() => dispatch(CrudActions.deleteSuccess(entity, action['id'])))
|
|
120
|
+
.catch((error) => dispatch(CrudActions.deleteFailure(entity, action['id'], error)));
|
|
121
|
+
break;
|
|
122
|
+
default:
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.CrudEffects = CrudEffects;
|
|
128
|
+
//# sourceMappingURL=crud.effects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.effects.js","sourceRoot":"","sources":["../../../../../../../../packages/crud/shell/react/src/lib/state/crud.effects.ts"],"names":[],"mappings":";;;;AAEA,oEAA8C;AAE9C,qDAAiD;AAIjD;;;;;;;;GAQG;AACH,MAAa,WAAW;IAEH;IADnB,4EAA4E;IAC5E,YAAmB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAE9C,uEAAuE;IACvE,IAAI,CAAC,KAAgB;QACnB,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;IAEO,MAAM,CAAC,MAAkB,EAAE,KAAgB;QACjD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,MAAM,QAAQ,GAAG,CAAC,IAAgB,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE5D,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,IAAI,MAAM,UAAU;gBACvB,IAAI,CAAC,OAAO;qBACT,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;qBACtB,IAAI,CAAC,GAAG,EAAE,CACT,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAC5D;qBACA,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACf,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CACnE,CAAC;gBACJ,MAAM;YAER,KAAK,IAAI,MAAM,kBAAkB,CAAC;YAClC,KAAK,IAAI,MAAM,uBAAuB,CAAC,CAAC,CAAC;gBACvC,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,KAAK,CAAC,GAAG,EAAE,CAAC,C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AM,CAAC,OAAO,CAAC,CAAC,CAC9D,CACF;qBACA,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;oBACf,QAAQ,CACN,WAAW,CAAC,wBAAwB,CAClC,MAAM,EACN,MAAM,CAAC,OAAO,CAAC,EACf,KAAK,CACN,CACF,CAAC;oBACF,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBACrC,CAAC,CAAC,CAAC;gBACL,MAAM;YAER,KAAK,IAAI,MAAM,+BAA+B,CAAC;YAC/C,KAAK,IAAI,MAAM,kBAAkB;gBAC/B,QAAQ,CACN,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;oBACvB,GAAG,IAAA,8BAAa,EAAC,KAAK,CAAC,GAAG,EAAE,CAAC;oBAC7B,MAAM,EAAE,CAAC;iBACV,CAAC,CACH,CAAC;gBACF,MAAM;YAER,KAAK,IAAI,MAAM,UAAU;gBACvB,IAAI,CAAC,OAAO;qBACT,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;qBACpB,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;qBACrE,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACf,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CACjE,CAAC;gBACJ,MAAM;YAER;gBACE,MAAM;QACV,CAAC;IACH,CAAC;CACF;AApLD,kCAoLC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IEntity } from '@smartsoft001/domain-core';
|
|
2
|
+
import { CrudConfig } from '../crud.config';
|
|
3
|
+
import { ICrudCreateManyOptions, ICrudFilter } from '../models';
|
|
4
|
+
import { CrudState } from './crud.reducer';
|
|
5
|
+
import { CrudStore } from './crud.store';
|
|
6
|
+
/**
|
|
7
|
+
* The API the pages and components use to read and change a CRUD feature,
|
|
8
|
+
* with the method names of the Angular `CrudFacade`. The state is read through
|
|
9
|
+
* getters (`facade.list`), and `useCrudState` re-renders a component when it
|
|
10
|
+
* changes, where the Angular facade exposed signals.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CrudFacade<T extends IEntity<string>> {
|
|
13
|
+
readonly store: CrudStore;
|
|
14
|
+
private readonly config;
|
|
15
|
+
constructor(store: CrudStore, config: CrudConfig<T>);
|
|
16
|
+
get state(): CrudState<T>;
|
|
17
|
+
get loaded(): boolean | undefined;
|
|
18
|
+
get loading(): boolean;
|
|
19
|
+
get selected(): T | undefined;
|
|
20
|
+
get multiSelected(): T[] | undefined;
|
|
21
|
+
get list(): T[] | undefined;
|
|
22
|
+
get filter(): ICrudFilter | undefined;
|
|
23
|
+
get totalCount(): number | undefined;
|
|
24
|
+
get links(): any;
|
|
25
|
+
get error(): any;
|
|
26
|
+
create(item: T): void;
|
|
27
|
+
createMany(items: Array<T>, options: ICrudCreateManyOptions): void;
|
|
28
|
+
/** Reads the list; without a `query` of its own the filter gets `baseQuery`. */
|
|
29
|
+
read(filter?: ICrudFilter): void;
|
|
30
|
+
clear(): void;
|
|
31
|
+
select(id: string): void;
|
|
32
|
+
unselect(): void;
|
|
33
|
+
multiSelect(items: Array<T>): void;
|
|
34
|
+
update(item: T): void;
|
|
35
|
+
export(filter?: ICrudFilter, format?: string): void;
|
|
36
|
+
updatePartial(item: Partial<T> & {
|
|
37
|
+
id: string;
|
|
38
|
+
}): void;
|
|
39
|
+
updatePartialMany(items: (Partial<T> & {
|
|
40
|
+
id: string;
|
|
41
|
+
})[]): void;
|
|
42
|
+
delete(id: string): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CrudFacade = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const CrudActions = tslib_1.__importStar(require("./crud.actions"));
|
|
6
|
+
/**
|
|
7
|
+
* The API the pages and components use to read and change a CRUD feature,
|
|
8
|
+
* with the method names of the Angular `CrudFacade`. The state is read through
|
|
9
|
+
* getters (`facade.list`), and `useCrudState` re-renders a component when it
|
|
10
|
+
* changes, where the Angular facade exposed signals.
|
|
11
|
+
*/
|
|
12
|
+
class CrudFacade {
|
|
13
|
+
store;
|
|
14
|
+
config;
|
|
15
|
+
constructor(store, config) {
|
|
16
|
+
this.store = store;
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
get state() {
|
|
20
|
+
return this.store.get();
|
|
21
|
+
}
|
|
22
|
+
get loaded() {
|
|
23
|
+
return this.state.loaded;
|
|
24
|
+
}
|
|
25
|
+
get loading() {
|
|
26
|
+
return !this.state.loaded;
|
|
27
|
+
}
|
|
28
|
+
get selected() {
|
|
29
|
+
return this.state.selected ?? undefined;
|
|
30
|
+
}
|
|
31
|
+
get multiSelected() {
|
|
32
|
+
return this.state.multiSelected;
|
|
33
|
+
}
|
|
34
|
+
get list() {
|
|
35
|
+
return this.state.list;
|
|
36
|
+
}
|
|
37
|
+
get filter() {
|
|
38
|
+
return this.state.filter ?? undefined;
|
|
39
|
+
}
|
|
40
|
+
get totalCount() {
|
|
41
|
+
return this.state.totalCount ?? undefined;
|
|
42
|
+
}
|
|
43
|
+
get links() {
|
|
44
|
+
return this.state.links;
|
|
45
|
+
}
|
|
46
|
+
get error() {
|
|
47
|
+
return this.state.error;
|
|
48
|
+
}
|
|
49
|
+
create(item) {
|
|
50
|
+
this.store.dispatch(CrudActions.create(this.config.entity, item));
|
|
51
|
+
}
|
|
52
|
+
createMany(items, options) {
|
|
53
|
+
this.store.dispatch(CrudActions.createMany(this.config.entity, { items, options }));
|
|
54
|
+
}
|
|
55
|
+
/** Reads the list; without a `query` of its own the filter gets `baseQuery`. */
|
|
56
|
+
read(filter = {}) {
|
|
57
|
+
const baseQuery = this.config.baseQuery ?? [];
|
|
58
|
+
const fullFilter = {
|
|
59
|
+
...(filter ? filter : {}),
|
|
60
|
+
query: filter && filter.query ? filter.query : baseQuery,
|
|
61
|
+
};
|
|
62
|
+
this.store.dispatch(CrudActions.read(this.config.entity, fullFilter));
|
|
63
|
+
}
|
|
64
|
+
clear() {
|
|
65
|
+
this.store.dispatch(CrudActions.clear(this.config.entity));
|
|
66
|
+
}
|
|
67
|
+
select(id) {
|
|
68
|
+
this.store.dispatch(CrudActions.select(this.config.entity, id));
|
|
69
|
+
}
|
|
70
|
+
unselect() {
|
|
71
|
+
this.store.dispatch(CrudActions.unselect(this.config.entity));
|
|
72
|
+
}
|
|
73
|
+
multiSelect(items) {
|
|
74
|
+
this.store.dispatch(CrudActions.multiSelect(this.config.entity, items));
|
|
75
|
+
}
|
|
76
|
+
update(item) {
|
|
77
|
+
this.store.dispatch(CrudActions.update(this.config.entity, item));
|
|
78
|
+
}
|
|
79
|
+
export(filter = {}, format) {
|
|
80
|
+
this.store.dispatch(CrudActions.exportList(this.config.entity, filter, format));
|
|
81
|
+
}
|
|
82
|
+
updatePartial(item) {
|
|
83
|
+
this.store.dispatch(CrudActions.updatePartial(this.config.entity, item));
|
|
84
|
+
}
|
|
85
|
+
updatePartialMany(items) {
|
|
86
|
+
this.store.dispatch(CrudActions.updatePartialMany(this.config.entity, items));
|
|
87
|
+
}
|
|
88
|
+
delete(id) {
|
|
89
|
+
this.store.dispatch(CrudActions.deleteItem(this.config.entity, id));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.CrudFacade = CrudFacade;
|
|
93
|
+
//# sourceMappingURL=crud.facade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.facade.js","sourceRoot":"","sources":["../../../../../../../../packages/crud/shell/react/src/lib/state/crud.facade.ts"],"names":[],"mappings":";;;;AAQA,oEAA8C;AAI9C;;;;;GAKG;AACH,MAAa,UAAU;IAEV;IACQ;IAFnB,YACW,KAAgB,EACR,MAAq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EAAE,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,CAAC,SAAsB,EAAE,EAAE,MAAe;QAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CACjB,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAC3D,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,IAAiC;QAC7C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,iBAAiB,CAAC,KAAsC;QACtD,IAAI,CAAC,KAAK,CAAC,QAAQ,CACjB,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CACzD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,EAAU;QACf,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;CACF;AA1GD,gCA0GC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IEntity } from '@smartsoft001/domain-core';
|
|
2
|
+
import { ICrudFilter } from '../models';
|
|
3
|
+
import { CrudAction } from './crud.actions';
|
|
4
|
+
/** The state of one CRUD feature, as the Angular NgRx feature held it. */
|
|
5
|
+
export interface CrudState<T extends IEntity<string>> {
|
|
6
|
+
selected?: T | null;
|
|
7
|
+
multiSelected?: Array<T>;
|
|
8
|
+
list?: T[];
|
|
9
|
+
totalCount?: number | null;
|
|
10
|
+
filter?: ICrudFilter | null;
|
|
11
|
+
links?: any;
|
|
12
|
+
/** False while a request of the feature is in flight. */
|
|
13
|
+
loaded: boolean;
|
|
14
|
+
/** The error of the last failed request, if any. */
|
|
15
|
+
error?: any;
|
|
16
|
+
}
|
|
17
|
+
export declare const initialState: CrudState<any>;
|
|
18
|
+
export type CrudReducer = (state: CrudState<any>, action: CrudAction) => CrudState<any>;
|
|
19
|
+
/** The reducer of the feature named `entity`. */
|
|
20
|
+
export declare function getReducer(entity: string): CrudReducer;
|