@stenajs-webui/redux 17.6.0 → 17.7.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/CHANGELOG.md +12 -0
- package/dist/common/ActionWithReducerId.d.ts +3 -3
- package/dist/common/EntityWithId.d.ts +3 -3
- package/dist/common/util/field-matcher.d.ts +1 -1
- package/dist/features/higher-order-reducers/entity-list-reducer/entity-list-action-creators.d.ts +17 -17
- package/dist/features/higher-order-reducers/entity-list-reducer/entity-list-actions.d.ts +52 -52
- package/dist/features/higher-order-reducers/entity-list-reducer/entity-list-reducer.d.ts +4 -4
- package/dist/features/higher-order-reducers/entity-list-reducer/entity-list-selectors.d.ts +6 -6
- package/dist/features/higher-order-reducers/record-object-reducer/record-object-action-creators.d.ts +7 -7
- package/dist/features/higher-order-reducers/record-object-reducer/record-object-actions.d.ts +17 -17
- package/dist/features/higher-order-reducers/record-object-reducer/record-object-reducer.d.ts +4 -4
- package/dist/features/higher-order-reducers/reducer-id-gate/reducer-id-action-wrapper.d.ts +12 -12
- package/dist/features/higher-order-reducers/reducer-id-gate/reducer-id-gate.d.ts +9 -9
- package/dist/features/reducer-factories/commit-reducer/commit-action-creators.d.ts +7 -7
- package/dist/features/reducer-factories/commit-reducer/commit-actions.d.ts +18 -18
- package/dist/features/reducer-factories/commit-reducer/commit-reducer.d.ts +3 -3
- package/dist/features/reducer-factories/commit-reducer/commit-selectors.d.ts +7 -7
- package/dist/features/reducer-factories/commit-reducer/commit-state.d.ts +4 -4
- package/dist/features/reducer-factories/editable-entity-reducer/editable-entity-action-creators.d.ts +11 -11
- package/dist/features/reducer-factories/editable-entity-reducer/editable-entity-actions.d.ts +27 -27
- package/dist/features/reducer-factories/editable-entity-reducer/editable-entity-reducer.d.ts +8 -8
- package/dist/features/reducer-factories/entity-by-id-reducer/entity-by-id-action-creators.d.ts +9 -9
- package/dist/features/reducer-factories/entity-by-id-reducer/entity-by-id-actions.d.ts +18 -18
- package/dist/features/reducer-factories/entity-by-id-reducer/entity-by-id-reducer.d.ts +11 -11
- package/dist/features/reducer-factories/entity-by-id-reducer/entity-by-id-selectors.d.ts +7 -7
- package/dist/features/reducer-factories/entity-crud-status-reducer/entity-crud-status-redux.d.ts +31 -31
- package/dist/features/reducer-factories/entity-reducer/entity-action-creators.d.ts +6 -6
- package/dist/features/reducer-factories/entity-reducer/entity-actions.d.ts +9 -9
- package/dist/features/reducer-factories/entity-reducer/entity-reducer.d.ts +4 -4
- package/dist/features/reducer-factories/entity-reducer/entity-selectors.d.ts +6 -6
- package/dist/features/reducer-factories/modified-field-reducer/modified-field-redux.d.ts +23 -23
- package/dist/features/reducer-factories/selected-ids-reducer/selected-ids-action-creators.d.ts +7 -7
- package/dist/features/reducer-factories/selected-ids-reducer/selected-ids-actions.d.ts +8 -8
- package/dist/features/reducer-factories/selected-ids-reducer/selected-ids-reducer.d.ts +9 -9
- package/dist/features/reducer-factories/selected-ids-reducer/selected-ids-selectors.d.ts +6 -6
- package/dist/features/reducer-factories/sort-order-by-id-reducer/hooks/use-sort-order-by-id.d.ts +3 -3
- package/dist/features/reducer-factories/sort-order-by-id-reducer/sort-order-by-id-action-creators.d.ts +7 -7
- package/dist/features/reducer-factories/sort-order-by-id-reducer/sort-order-by-id-actions.d.ts +8 -8
- package/dist/features/reducer-factories/sort-order-by-id-reducer/sort-order-by-id-reducer.d.ts +6 -6
- package/dist/features/reducer-factories/sort-order-by-id-reducer/sort-order-by-id-selectors.d.ts +8 -8
- package/dist/features/reducer-factories/sort-order-reducer/sort-order-action-creators.d.ts +6 -6
- package/dist/features/reducer-factories/sort-order-reducer/sort-order-actions.d.ts +9 -9
- package/dist/features/reducer-factories/sort-order-reducer/sort-order-reducer.d.ts +9 -9
- package/dist/features/reducer-factories/sort-order-reducer/sort-order-selectors.d.ts +6 -6
- package/dist/features/reducer-factories/value-by-id-reducer/value-by-id-action-creators.d.ts +7 -7
- package/dist/features/reducer-factories/value-by-id-reducer/value-by-id-actions.d.ts +13 -13
- package/dist/features/reducer-factories/value-by-id-reducer/value-by-id-reducer.d.ts +10 -10
- package/dist/features/reducer-factories/value-by-id-reducer/value-by-id-selectors.d.ts +6 -6
- package/dist/index.d.ts +44 -44
- package/dist/index.es.js +634 -656
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -722
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
- package/dist/common/util/__tests__/field-matcher.test.d.ts +0 -1
- package/dist/features/higher-order-reducers/entity-list-reducer/__tests__/entity-list-reducer.test.d.ts +0 -1
- package/dist/features/higher-order-reducers/record-object-reducer/__tests__/record-object-reducer.test.d.ts +0 -1
- package/dist/features/higher-order-reducers/reducer-id-gate/__tests__/reducer-id-gate.test.d.ts +0 -1
- package/dist/features/reducer-factories/entity-by-id-reducer/__tests__/entity-by-id-reducer.test.d.ts +0 -1
- package/dist/features/reducer-factories/entity-reducer/__tests__/entity-reducer.test.d.ts +0 -1
- package/dist/features/reducer-factories/selected-ids-reducer/__tests__/selected-ids-reducer.test.d.ts +0 -1
- package/dist/features/reducer-factories/sort-order-by-id-reducer/__tests__/sort-order-by-id-reducer.test.d.ts +0 -1
- package/dist/features/reducer-factories/sort-order-reducer/__tests__/sort-order-reducer.test.d.ts +0 -1
- package/dist/features/reducer-factories/value-by-id-reducer/__tests__/value-by-id-reducer.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,723 +1,2 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
/*! *****************************************************************************
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
***************************************************************************** */
|
|
19
|
-
|
|
20
|
-
var __assign = function() {
|
|
21
|
-
__assign = Object.assign || function __assign(t) {
|
|
22
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
23
|
-
s = arguments[i];
|
|
24
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
25
|
-
}
|
|
26
|
-
return t;
|
|
27
|
-
};
|
|
28
|
-
return __assign.apply(this, arguments);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function __spreadArray(to, from, pack) {
|
|
32
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
33
|
-
if (ar || !(i in from)) {
|
|
34
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
35
|
-
ar[i] = from[i];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
var createRecordObjectReducer = function (reducer) {
|
|
42
|
-
return function (state, action) {
|
|
43
|
-
var _a;
|
|
44
|
-
if (state === void 0) { state = {}; }
|
|
45
|
-
switch (action.type) {
|
|
46
|
-
case "RECORD_OBJECT:CLEAR_RECORD": {
|
|
47
|
-
var recordId = action.recordId;
|
|
48
|
-
var newState = __assign({}, state);
|
|
49
|
-
delete newState[recordId];
|
|
50
|
-
return newState;
|
|
51
|
-
}
|
|
52
|
-
case "RECORD_OBJECT:CLEAR_ALL_RECORDS": {
|
|
53
|
-
return {};
|
|
54
|
-
}
|
|
55
|
-
case "RECORD_OBJECT:ACTION": {
|
|
56
|
-
var recordId = action.recordId, innerAction = action.action;
|
|
57
|
-
return __assign(__assign({}, state), (_a = {}, _a[recordId] = reducer(state[recordId], innerAction), _a));
|
|
58
|
-
}
|
|
59
|
-
default:
|
|
60
|
-
return state;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
var createRecordObjectActions = function () { return ({
|
|
66
|
-
recordAction: function (recordId, action) { return ({
|
|
67
|
-
type: "RECORD_OBJECT:ACTION",
|
|
68
|
-
action: action,
|
|
69
|
-
recordId: recordId,
|
|
70
|
-
}); },
|
|
71
|
-
clearRecord: function (recordId) { return ({
|
|
72
|
-
type: "RECORD_OBJECT:CLEAR_RECORD",
|
|
73
|
-
recordId: recordId,
|
|
74
|
-
}); },
|
|
75
|
-
clearAllRecords: function () { return ({
|
|
76
|
-
type: "RECORD_OBJECT:CLEAR_ALL_RECORDS",
|
|
77
|
-
}); },
|
|
78
|
-
}); };
|
|
79
|
-
|
|
80
|
-
var reducerIdGate = function (reducerId, reducer) {
|
|
81
|
-
return function (state, action) {
|
|
82
|
-
var newState = state == null ? reducer(undefined, {}) : state;
|
|
83
|
-
if (!isValidReducerIdGateAction(action)) {
|
|
84
|
-
return newState;
|
|
85
|
-
}
|
|
86
|
-
if (reducerId !== action.reducerId ||
|
|
87
|
-
action.type !== "REDUCER_ID_GATE:ACTION") {
|
|
88
|
-
return newState;
|
|
89
|
-
}
|
|
90
|
-
return reducer(newState, action.action);
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
var reducerIdGateAction = function (reducerId, action) { return ({
|
|
94
|
-
type: "REDUCER_ID_GATE:ACTION",
|
|
95
|
-
action: action,
|
|
96
|
-
reducerId: reducerId,
|
|
97
|
-
}); };
|
|
98
|
-
var isValidReducerIdGateAction = function (action) {
|
|
99
|
-
return !!action.action &&
|
|
100
|
-
action.type === "REDUCER_ID_GATE:ACTION" &&
|
|
101
|
-
typeof action.reducerId === "string";
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
var wrapActionWithReducerIdGate = function (reducerId, actionCreator) {
|
|
105
|
-
return function () {
|
|
106
|
-
var args = [];
|
|
107
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
108
|
-
args[_i] = arguments[_i];
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
type: "REDUCER_ID_GATE:ACTION",
|
|
112
|
-
reducerId: reducerId,
|
|
113
|
-
action: actionCreator.apply(void 0, args),
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
var wrapActionsWithReducerIdGate = function (reducerId, actionCreators) {
|
|
118
|
-
var boundActionCreators = {};
|
|
119
|
-
for (var key in actionCreators) {
|
|
120
|
-
var actionCreator = actionCreators[key];
|
|
121
|
-
boundActionCreators[key] = wrapActionWithReducerIdGate(reducerId, actionCreator);
|
|
122
|
-
}
|
|
123
|
-
return boundActionCreators;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
var createCommitReducerActions = function (id) {
|
|
127
|
-
return {
|
|
128
|
-
setValues: function (values) { return ({
|
|
129
|
-
type: "COMMIT_REDUCER.SET_VALUES",
|
|
130
|
-
id: id,
|
|
131
|
-
values: values,
|
|
132
|
-
}); },
|
|
133
|
-
commitValues: function () { return ({
|
|
134
|
-
type: "COMMIT_REDUCER.COMMIT_VALUES",
|
|
135
|
-
id: id,
|
|
136
|
-
}); },
|
|
137
|
-
clearValues: function () { return ({
|
|
138
|
-
type: "COMMIT_REDUCER.CLEAR",
|
|
139
|
-
id: id,
|
|
140
|
-
}); },
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
var createCommitReducer = function (id, initialState) {
|
|
145
|
-
return function (state, action) {
|
|
146
|
-
if (state === void 0) { state = initialState; }
|
|
147
|
-
if (action.id !== id) {
|
|
148
|
-
return state;
|
|
149
|
-
}
|
|
150
|
-
switch (action.type) {
|
|
151
|
-
case "COMMIT_REDUCER.SET_VALUES": {
|
|
152
|
-
var values = action.values;
|
|
153
|
-
return __assign(__assign({}, state), { workspace: __assign(__assign({}, state.workspace), values) });
|
|
154
|
-
}
|
|
155
|
-
case "COMMIT_REDUCER.CLEAR": {
|
|
156
|
-
return __assign(__assign({}, state), { workspace: __assign({}, initialState.workspace) });
|
|
157
|
-
}
|
|
158
|
-
case "COMMIT_REDUCER.COMMIT_VALUES": {
|
|
159
|
-
return __assign(__assign({}, state), { committed: __assign({}, state.workspace) });
|
|
160
|
-
}
|
|
161
|
-
default:
|
|
162
|
-
return state;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
var createCommitReducerSelectors = function (id, stateSelector) {
|
|
168
|
-
return {
|
|
169
|
-
getWorkspaceValues: function (state) { return stateSelector(state, id).workspace; },
|
|
170
|
-
getCommittedValues: function (state) { return stateSelector(state, id).committed; },
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
var createEntityListActions = function () {
|
|
175
|
-
return {
|
|
176
|
-
addAtEnd: function (entity) { return ({ type: "ENTITY_LIST:ADD_AT_END", entity: entity }); },
|
|
177
|
-
addAtStart: function (entity) { return ({
|
|
178
|
-
entity: entity,
|
|
179
|
-
type: "ENTITY_LIST:ADD_AT_START",
|
|
180
|
-
}); },
|
|
181
|
-
clearList: function () { return ({ type: "ENTITY_LIST:CLEAR_LIST" }); },
|
|
182
|
-
removeFirst: function () { return ({ type: "ENTITY_LIST:REMOVE_FIRST" }); },
|
|
183
|
-
removeLast: function () { return ({ type: "ENTITY_LIST:REMOVE_LAST" }); },
|
|
184
|
-
removeAtIndex: function (index) { return ({
|
|
185
|
-
type: "ENTITY_LIST:REMOVE_AT_INDEX",
|
|
186
|
-
index: index,
|
|
187
|
-
}); },
|
|
188
|
-
removeByFieldMatch: function (fields) { return ({
|
|
189
|
-
type: "ENTITY_LIST:REMOVE_BY_FIELD_MATCH",
|
|
190
|
-
fields: fields,
|
|
191
|
-
}); },
|
|
192
|
-
remove: function (entity) { return ({ type: "ENTITY_LIST:REMOVE", entity: entity }); },
|
|
193
|
-
setList: function (list) { return ({ type: "ENTITY_LIST:SET_LIST", list: list }); },
|
|
194
|
-
toggle: function (entity) { return ({ type: "ENTITY_LIST:TOGGLE", entity: entity }); },
|
|
195
|
-
actionByFieldsMatch: function (fields, action) { return ({
|
|
196
|
-
type: "ENTITY_LIST:ACTION_BY_FIELDS_MATCH",
|
|
197
|
-
fields: fields,
|
|
198
|
-
action: action,
|
|
199
|
-
}); },
|
|
200
|
-
actionByIndex: function (index, action) { return ({
|
|
201
|
-
type: "ENTITY_LIST:ACTION_BY_INDEX",
|
|
202
|
-
index: index,
|
|
203
|
-
action: action,
|
|
204
|
-
}); },
|
|
205
|
-
actionOnAll: function (action) { return ({
|
|
206
|
-
type: "ENTITY_LIST:ACTION_ON_ALL",
|
|
207
|
-
action: action,
|
|
208
|
-
}); },
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
var fieldsMatch = function (entity, fields) {
|
|
213
|
-
var keys = Object.keys(fields);
|
|
214
|
-
if (keys.length === 0) {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
for (var i = 0; i < keys.length; i++) {
|
|
218
|
-
var key = keys[i];
|
|
219
|
-
if (entity[key] !== fields[key]) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return true;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
var createEntityListReducer = function (reducer) {
|
|
227
|
-
return function (state, action) {
|
|
228
|
-
if (state === void 0) { state = []; }
|
|
229
|
-
switch (action.type) {
|
|
230
|
-
case "ENTITY_LIST:SET_LIST": {
|
|
231
|
-
var list = action.list;
|
|
232
|
-
return list;
|
|
233
|
-
}
|
|
234
|
-
case "ENTITY_LIST:CLEAR_LIST": {
|
|
235
|
-
return [];
|
|
236
|
-
}
|
|
237
|
-
case "ENTITY_LIST:ADD_AT_END": {
|
|
238
|
-
var entity = action.entity;
|
|
239
|
-
return __spreadArray(__spreadArray([], state, true), [entity], false);
|
|
240
|
-
}
|
|
241
|
-
case "ENTITY_LIST:ADD_AT_START": {
|
|
242
|
-
var entity = action.entity;
|
|
243
|
-
return __spreadArray([entity], state, true);
|
|
244
|
-
}
|
|
245
|
-
case "ENTITY_LIST:REMOVE_FIRST": {
|
|
246
|
-
if (state.length === 0) {
|
|
247
|
-
throw new Error("Cannot remove, list is empty.");
|
|
248
|
-
}
|
|
249
|
-
var list = state.slice(1);
|
|
250
|
-
return list;
|
|
251
|
-
}
|
|
252
|
-
case "ENTITY_LIST:REMOVE_LAST": {
|
|
253
|
-
if (state.length === 0) {
|
|
254
|
-
throw new Error("Cannot remove, list is empty.");
|
|
255
|
-
}
|
|
256
|
-
var list = __spreadArray([], state, true);
|
|
257
|
-
list.pop();
|
|
258
|
-
return list;
|
|
259
|
-
}
|
|
260
|
-
case "ENTITY_LIST:REMOVE_AT_INDEX": {
|
|
261
|
-
var index = action.index;
|
|
262
|
-
if (index < 0) {
|
|
263
|
-
throw new Error("Index is lower than 0.");
|
|
264
|
-
}
|
|
265
|
-
if (index >= state.length) {
|
|
266
|
-
throw new Error("Index is outside of list bounds.");
|
|
267
|
-
}
|
|
268
|
-
var list = __spreadArray([], state, true);
|
|
269
|
-
list.splice(index, 1);
|
|
270
|
-
return list;
|
|
271
|
-
}
|
|
272
|
-
case "ENTITY_LIST:REMOVE_BY_FIELD_MATCH": {
|
|
273
|
-
var fields_1 = action.fields;
|
|
274
|
-
return state.filter(function (item) { return !fieldsMatch(item, fields_1); });
|
|
275
|
-
}
|
|
276
|
-
case "ENTITY_LIST:REMOVE": {
|
|
277
|
-
var entity_1 = action.entity;
|
|
278
|
-
return state.filter(function (item) { return item !== entity_1; });
|
|
279
|
-
}
|
|
280
|
-
case "ENTITY_LIST:TOGGLE": {
|
|
281
|
-
var entity_2 = action.entity;
|
|
282
|
-
var index = state.findIndex(function (item) { return item === entity_2 || fieldsMatch(item, entity_2); });
|
|
283
|
-
if (index >= 0) {
|
|
284
|
-
var list = __spreadArray([], state, true);
|
|
285
|
-
list.splice(index, index);
|
|
286
|
-
return list;
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
return __spreadArray(__spreadArray([], state, true), [entity_2], false);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
case "ENTITY_LIST:ACTION_BY_FIELDS_MATCH": {
|
|
293
|
-
var fields_2 = action.fields, innerAction_1 = action.action;
|
|
294
|
-
if (!reducer) {
|
|
295
|
-
throw new Error("No reducer specified, unable to handle 'actionByFieldsMatch'.");
|
|
296
|
-
}
|
|
297
|
-
return state.map(function (item) {
|
|
298
|
-
return fieldsMatch(item, fields_2) ? reducer(item, innerAction_1) : item;
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
case "ENTITY_LIST:ACTION_BY_INDEX": {
|
|
302
|
-
var index_1 = action.index, innerAction_2 = action.action;
|
|
303
|
-
if (!reducer) {
|
|
304
|
-
throw new Error("No reducer specified, unable to handle 'actionByIndex'.");
|
|
305
|
-
}
|
|
306
|
-
return state.map(function (item, i) {
|
|
307
|
-
return index_1 === i ? reducer(item, innerAction_2) : item;
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
case "ENTITY_LIST:ACTION_ON_ALL": {
|
|
311
|
-
var innerAction_3 = action.action;
|
|
312
|
-
if (!reducer) {
|
|
313
|
-
throw new Error("No reducer specified, unable to handle 'actionByIndex'.");
|
|
314
|
-
}
|
|
315
|
-
return state.map(function (item) { return reducer(item, innerAction_3); });
|
|
316
|
-
}
|
|
317
|
-
default:
|
|
318
|
-
return state;
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
var createEntityListSelectors = function (stateSelector) { return ({
|
|
324
|
-
getList: function (store) { return stateSelector(store); },
|
|
325
|
-
}); };
|
|
326
|
-
|
|
327
|
-
var entityByIdInitialState = { entities: {} };
|
|
328
|
-
var createEntityByIdReducer = function () {
|
|
329
|
-
return function (state, action) {
|
|
330
|
-
var _a, _b;
|
|
331
|
-
if (state === void 0) { state = entityByIdInitialState; }
|
|
332
|
-
switch (action.type) {
|
|
333
|
-
case "ENTITY_BY_ID:SET_ENTITY": {
|
|
334
|
-
var entity = action.entity;
|
|
335
|
-
return __assign(__assign({}, state), { entities: __assign(__assign({}, state.entities), (_a = {}, _a[entity.id] = entity, _a)) });
|
|
336
|
-
}
|
|
337
|
-
case "ENTITY_BY_ID:SET_ENTITY_FIELDS": {
|
|
338
|
-
var id = action.id, fields = action.fields;
|
|
339
|
-
return __assign(__assign({}, state), { entities: __assign(__assign({}, state.entities), (_b = {}, _b[id] = __assign(__assign({}, state.entities[id]), fields), _b)) });
|
|
340
|
-
}
|
|
341
|
-
case "ENTITY_BY_ID:CLEAR_ALL_ENTITIES": {
|
|
342
|
-
return __assign(__assign({}, state), { entities: {} });
|
|
343
|
-
}
|
|
344
|
-
case "ENTITY_BY_ID:CLEAR_ENTITY": {
|
|
345
|
-
var id = action.id;
|
|
346
|
-
var entities = __assign({}, state.entities);
|
|
347
|
-
delete entities[id];
|
|
348
|
-
return __assign(__assign({}, state), { entities: entities });
|
|
349
|
-
}
|
|
350
|
-
default:
|
|
351
|
-
return state;
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
var createEntityByIdActions = function () { return ({
|
|
357
|
-
setEntity: function (entity) { return ({
|
|
358
|
-
type: "ENTITY_BY_ID:SET_ENTITY",
|
|
359
|
-
entity: entity,
|
|
360
|
-
}); },
|
|
361
|
-
setEntityFields: function (id, fields) { return ({
|
|
362
|
-
type: "ENTITY_BY_ID:SET_ENTITY_FIELDS",
|
|
363
|
-
id: id,
|
|
364
|
-
fields: fields,
|
|
365
|
-
}); },
|
|
366
|
-
clearEntity: function (id) { return ({
|
|
367
|
-
type: "ENTITY_BY_ID:CLEAR_ENTITY",
|
|
368
|
-
id: id,
|
|
369
|
-
}); },
|
|
370
|
-
clearAllEntities: function () { return ({
|
|
371
|
-
type: "ENTITY_BY_ID:CLEAR_ALL_ENTITIES",
|
|
372
|
-
}); },
|
|
373
|
-
}); };
|
|
374
|
-
|
|
375
|
-
var createEntityByIdSelectors = function (stateSelector) { return ({
|
|
376
|
-
getState: stateSelector,
|
|
377
|
-
}); };
|
|
378
|
-
|
|
379
|
-
var createEntityReducer = function (initialEntity) {
|
|
380
|
-
var INITIAL_STATE = initialEntity;
|
|
381
|
-
return function (state, action) {
|
|
382
|
-
if (state === void 0) { state = INITIAL_STATE; }
|
|
383
|
-
switch (action.type) {
|
|
384
|
-
case "ENTITY:SET_ENTITY": {
|
|
385
|
-
var entity = action.entity;
|
|
386
|
-
return entity;
|
|
387
|
-
}
|
|
388
|
-
case "ENTITY:SET_ENTITY_FIELDS": {
|
|
389
|
-
var fields = action.fields;
|
|
390
|
-
return __assign(__assign({}, state), fields);
|
|
391
|
-
}
|
|
392
|
-
default:
|
|
393
|
-
return state;
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
var createEntityActions = function () { return ({
|
|
399
|
-
setEntity: function (entity) { return ({
|
|
400
|
-
type: "ENTITY:SET_ENTITY",
|
|
401
|
-
entity: entity,
|
|
402
|
-
}); },
|
|
403
|
-
setEntityFields: function (fields) { return ({
|
|
404
|
-
type: "ENTITY:SET_ENTITY_FIELDS",
|
|
405
|
-
fields: fields,
|
|
406
|
-
}); },
|
|
407
|
-
}); };
|
|
408
|
-
|
|
409
|
-
var createEntitySelectors = function (stateSelector) { return ({
|
|
410
|
-
getEntity: function (state) { return stateSelector(state); },
|
|
411
|
-
}); };
|
|
412
|
-
|
|
413
|
-
var createEntityCrudStatusReducer = function () {
|
|
414
|
-
return createEntityByIdReducer();
|
|
415
|
-
};
|
|
416
|
-
var createEntityCrudStatusActions = function () {
|
|
417
|
-
return createEntityByIdActions();
|
|
418
|
-
};
|
|
419
|
-
var createEntityCrudStatusSelectors = function (stateSelector) { return createEntityByIdSelectors(stateSelector); };
|
|
420
|
-
var createEntityCrudStatusRedux = function (stateSelector) {
|
|
421
|
-
var reducer = createEntityCrudStatusReducer();
|
|
422
|
-
var actions = createEntityCrudStatusActions();
|
|
423
|
-
var selectors = createEntityCrudStatusSelectors(stateSelector);
|
|
424
|
-
return {
|
|
425
|
-
reducer: reducer,
|
|
426
|
-
actions: actions,
|
|
427
|
-
selectors: selectors,
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
var createModifiedFieldRedux = function (stateSelector) {
|
|
432
|
-
var reducer = createEntityByIdReducer();
|
|
433
|
-
var selectors = createEntityByIdSelectors(stateSelector);
|
|
434
|
-
var actions = createEntityByIdActions();
|
|
435
|
-
return {
|
|
436
|
-
reducer: reducer,
|
|
437
|
-
selectors: selectors,
|
|
438
|
-
actions: actions,
|
|
439
|
-
};
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
var createEditableEntityReducer = function (initialEntity, initialId) {
|
|
443
|
-
var initialState = {
|
|
444
|
-
id: initialId,
|
|
445
|
-
editable: initialEntity,
|
|
446
|
-
persisted: initialEntity,
|
|
447
|
-
};
|
|
448
|
-
return function (state, action) {
|
|
449
|
-
if (state === void 0) { state = initialState; }
|
|
450
|
-
switch (action.type) {
|
|
451
|
-
case "EDITABLE_ENTITY:SET_ENTITY_ID": {
|
|
452
|
-
var id = action.id;
|
|
453
|
-
return __assign(__assign({}, state), { id: id });
|
|
454
|
-
}
|
|
455
|
-
case "EDITABLE_ENTITY:SET_ENTITY": {
|
|
456
|
-
var entity = action.entity;
|
|
457
|
-
return __assign(__assign({}, state), { persisted: entity, editable: entity });
|
|
458
|
-
}
|
|
459
|
-
case "EDITABLE_ENTITY:SET_PERSISTED_ENTITY": {
|
|
460
|
-
var entity = action.entity;
|
|
461
|
-
return __assign(__assign({}, state), { persisted: entity });
|
|
462
|
-
}
|
|
463
|
-
case "EDITABLE_ENTITY:SET_EDITABLE_ENTITY": {
|
|
464
|
-
var entity = action.entity;
|
|
465
|
-
return __assign(__assign({}, state), { editable: entity });
|
|
466
|
-
}
|
|
467
|
-
case "EDITABLE_ENTITY:SET_EDITABLE_ENTITY_FIELDS": {
|
|
468
|
-
var fields = action.fields;
|
|
469
|
-
return __assign(__assign({}, state), { editable: __assign(__assign({}, state.editable), fields) });
|
|
470
|
-
}
|
|
471
|
-
case "EDITABLE_ENTITY:REVERT_EDITABLE_ENTITY": {
|
|
472
|
-
return __assign(__assign({}, state), { editable: state.persisted });
|
|
473
|
-
}
|
|
474
|
-
case "EDITABLE_ENTITY:COMMIT_EDITABLE_ENTITY_TO_PERSISTED": {
|
|
475
|
-
return __assign(__assign({}, state), { persisted: state.editable });
|
|
476
|
-
}
|
|
477
|
-
default:
|
|
478
|
-
return state;
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
var createEditableEntityActions = function () { return ({
|
|
484
|
-
setEntityId: function (id) { return ({
|
|
485
|
-
type: "EDITABLE_ENTITY:SET_ENTITY_ID",
|
|
486
|
-
id: id,
|
|
487
|
-
}); },
|
|
488
|
-
setEntity: function (entity) { return ({ type: "EDITABLE_ENTITY:SET_ENTITY", entity: entity }); },
|
|
489
|
-
setPersistedEntity: function (entity) { return ({
|
|
490
|
-
type: "EDITABLE_ENTITY:SET_PERSISTED_ENTITY",
|
|
491
|
-
entity: entity,
|
|
492
|
-
}); },
|
|
493
|
-
setEditableEntity: function (entity) { return ({
|
|
494
|
-
type: "EDITABLE_ENTITY:SET_EDITABLE_ENTITY",
|
|
495
|
-
entity: entity,
|
|
496
|
-
}); },
|
|
497
|
-
setEditableEntityFields: function (fields) { return ({
|
|
498
|
-
type: "EDITABLE_ENTITY:SET_EDITABLE_ENTITY_FIELDS",
|
|
499
|
-
fields: fields,
|
|
500
|
-
}); },
|
|
501
|
-
revertEditableEntity: function () { return ({
|
|
502
|
-
type: "EDITABLE_ENTITY:REVERT_EDITABLE_ENTITY",
|
|
503
|
-
}); },
|
|
504
|
-
commitEditableEntityToPersisted: function () { return ({
|
|
505
|
-
type: "EDITABLE_ENTITY:COMMIT_EDITABLE_ENTITY_TO_PERSISTED",
|
|
506
|
-
}); },
|
|
507
|
-
}); };
|
|
508
|
-
|
|
509
|
-
var createSelectedIdsReducerInitialState = function (initialSelection) {
|
|
510
|
-
if (initialSelection === void 0) { initialSelection = []; }
|
|
511
|
-
return ({
|
|
512
|
-
selectedIds: initialSelection,
|
|
513
|
-
});
|
|
514
|
-
};
|
|
515
|
-
var INITIAL_STATE$1 = createSelectedIdsReducerInitialState();
|
|
516
|
-
var createSelectedIdsReducer = function (initialState) {
|
|
517
|
-
if (initialState === void 0) { initialState = INITIAL_STATE$1; }
|
|
518
|
-
return function (state, action) {
|
|
519
|
-
if (state === void 0) { state = initialState; }
|
|
520
|
-
switch (action.type) {
|
|
521
|
-
case "SELECTED_IDS:SET_SELECTED_IDS": {
|
|
522
|
-
var selectedIds = action.selectedIds;
|
|
523
|
-
return __assign(__assign({}, state), { selectedIds: selectedIds });
|
|
524
|
-
}
|
|
525
|
-
case "SELECTED_IDS:CLEAR_SELECTED_IDS": {
|
|
526
|
-
return __assign(__assign({}, state), { selectedIds: [] });
|
|
527
|
-
}
|
|
528
|
-
default:
|
|
529
|
-
return state;
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
};
|
|
533
|
-
var selectedIdsReducer = createSelectedIdsReducer();
|
|
534
|
-
|
|
535
|
-
var createSelectedIdsActions = function () { return ({
|
|
536
|
-
setSelectedIds: function (selectedIds) { return ({
|
|
537
|
-
selectedIds: selectedIds,
|
|
538
|
-
type: "SELECTED_IDS:SET_SELECTED_IDS",
|
|
539
|
-
}); },
|
|
540
|
-
clearSelectedIds: function () { return ({
|
|
541
|
-
type: "SELECTED_IDS:CLEAR_SELECTED_IDS",
|
|
542
|
-
}); },
|
|
543
|
-
}); };
|
|
544
|
-
var selectedIdsActions = createSelectedIdsActions();
|
|
545
|
-
|
|
546
|
-
var createSelectedIdsSelectors = function (stateSelector) { return ({
|
|
547
|
-
getState: stateSelector,
|
|
548
|
-
}); };
|
|
549
|
-
|
|
550
|
-
var INITIAL_STATE = {
|
|
551
|
-
ids: undefined,
|
|
552
|
-
};
|
|
553
|
-
var createSortOrderByIdReducer = function () {
|
|
554
|
-
return function (state, action) {
|
|
555
|
-
if (state === void 0) { state = INITIAL_STATE; }
|
|
556
|
-
switch (action.type) {
|
|
557
|
-
case "SORT_ORDER_BY_ID:SET_SORT_ORDER":
|
|
558
|
-
return __assign(__assign({}, state), { ids: action.ids });
|
|
559
|
-
case "SORT_ORDER_BY_ID:CLEAR_SORT_ORDER":
|
|
560
|
-
return __assign(__assign({}, state), { ids: undefined });
|
|
561
|
-
default:
|
|
562
|
-
return state;
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
};
|
|
566
|
-
var sortOrderByIdReducer = createSortOrderByIdReducer();
|
|
567
|
-
|
|
568
|
-
var createSortOrderByIdActions = function () {
|
|
569
|
-
return {
|
|
570
|
-
setSortOrder: function (ids) { return ({
|
|
571
|
-
ids: ids,
|
|
572
|
-
type: "SORT_ORDER_BY_ID:SET_SORT_ORDER",
|
|
573
|
-
}); },
|
|
574
|
-
clearSortOrder: function () { return ({
|
|
575
|
-
type: "SORT_ORDER_BY_ID:CLEAR_SORT_ORDER",
|
|
576
|
-
}); },
|
|
577
|
-
};
|
|
578
|
-
};
|
|
579
|
-
var sortOrderByIdActions = createSortOrderByIdActions();
|
|
580
|
-
|
|
581
|
-
var createSortOrderByIdSelectors = function (rootStateProvider) {
|
|
582
|
-
return {
|
|
583
|
-
getSortOrderByIdState: function (state) {
|
|
584
|
-
return rootStateProvider(state);
|
|
585
|
-
},
|
|
586
|
-
getSortOrder: function (state) {
|
|
587
|
-
return rootStateProvider(state).ids;
|
|
588
|
-
},
|
|
589
|
-
};
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
var createSortOrderReducerInitialState = function (sortBy, desc) {
|
|
593
|
-
if (sortBy === void 0) { sortBy = undefined; }
|
|
594
|
-
if (desc === void 0) { desc = false; }
|
|
595
|
-
return ({
|
|
596
|
-
sortBy: sortBy,
|
|
597
|
-
desc: desc,
|
|
598
|
-
});
|
|
599
|
-
};
|
|
600
|
-
var createSortOrderReducer = function (initialState) {
|
|
601
|
-
if (initialState === void 0) { initialState = { sortBy: undefined, desc: false }; }
|
|
602
|
-
return function (state, action) {
|
|
603
|
-
if (state === void 0) { state = initialState; }
|
|
604
|
-
switch (action.type) {
|
|
605
|
-
case "SORT_ORDER:SET_SORT_BY": {
|
|
606
|
-
var sortBy = action.sortBy, desc = action.desc;
|
|
607
|
-
return __assign(__assign({}, state), { sortBy: sortBy, desc: desc });
|
|
608
|
-
}
|
|
609
|
-
case "SORT_ORDER:CLEAR_SORT_ORDER": {
|
|
610
|
-
return __assign(__assign({}, state), { sortBy: undefined, desc: false });
|
|
611
|
-
}
|
|
612
|
-
default:
|
|
613
|
-
return state;
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
var createSortOrderActions = function () { return ({
|
|
619
|
-
sortBy: function (sortBy, desc) { return ({
|
|
620
|
-
desc: desc,
|
|
621
|
-
sortBy: sortBy,
|
|
622
|
-
type: "SORT_ORDER:SET_SORT_BY",
|
|
623
|
-
}); },
|
|
624
|
-
clearSortOrder: function () { return ({
|
|
625
|
-
type: "SORT_ORDER:CLEAR_SORT_ORDER",
|
|
626
|
-
}); },
|
|
627
|
-
}); };
|
|
628
|
-
|
|
629
|
-
var createSortOrderSelectors = function (stateProvider) { return ({
|
|
630
|
-
getState: stateProvider,
|
|
631
|
-
}); };
|
|
632
|
-
|
|
633
|
-
var valueByIdInitialState = { values: {} };
|
|
634
|
-
var createValueByIdReducer = function (initialValue) {
|
|
635
|
-
if (initialValue === void 0) { initialValue = valueByIdInitialState; }
|
|
636
|
-
return function (state, action) {
|
|
637
|
-
var _a;
|
|
638
|
-
if (state === void 0) { state = initialValue; }
|
|
639
|
-
switch (action.type) {
|
|
640
|
-
case "VALUE_BY_ID:SET_VALUE": {
|
|
641
|
-
var id = action.id, value = action.value;
|
|
642
|
-
return __assign(__assign({}, state), { values: __assign(__assign({}, state.values), (_a = {}, _a[id] = value, _a)) });
|
|
643
|
-
}
|
|
644
|
-
case "VALUE_BY_ID:CLEAR_ALL_VALUES": {
|
|
645
|
-
return __assign(__assign({}, state), { values: {} });
|
|
646
|
-
}
|
|
647
|
-
case "VALUE_BY_ID:CLEAR_VALUE": {
|
|
648
|
-
var id = action.id;
|
|
649
|
-
var values = __assign({}, state.values);
|
|
650
|
-
delete values[id];
|
|
651
|
-
return __assign(__assign({}, state), { values: values });
|
|
652
|
-
}
|
|
653
|
-
default:
|
|
654
|
-
return state;
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
var createValueByIdActions = function () { return ({
|
|
660
|
-
setValue: function (id, value) { return ({
|
|
661
|
-
type: "VALUE_BY_ID:SET_VALUE",
|
|
662
|
-
id: id,
|
|
663
|
-
value: value,
|
|
664
|
-
}); },
|
|
665
|
-
clearValue: function (id) { return ({
|
|
666
|
-
type: "VALUE_BY_ID:CLEAR_VALUE",
|
|
667
|
-
id: id,
|
|
668
|
-
}); },
|
|
669
|
-
clearAllValues: function () { return ({
|
|
670
|
-
type: "VALUE_BY_ID:CLEAR_ALL_VALUES",
|
|
671
|
-
}); },
|
|
672
|
-
}); };
|
|
673
|
-
|
|
674
|
-
var createValueByIdSelectors = function (stateSelector) { return ({
|
|
675
|
-
getState: stateSelector,
|
|
676
|
-
}); };
|
|
677
|
-
|
|
678
|
-
exports.createCommitReducer = createCommitReducer;
|
|
679
|
-
exports.createCommitReducerActions = createCommitReducerActions;
|
|
680
|
-
exports.createCommitReducerSelectors = createCommitReducerSelectors;
|
|
681
|
-
exports.createEditableEntityActions = createEditableEntityActions;
|
|
682
|
-
exports.createEditableEntityReducer = createEditableEntityReducer;
|
|
683
|
-
exports.createEntityActions = createEntityActions;
|
|
684
|
-
exports.createEntityByIdActions = createEntityByIdActions;
|
|
685
|
-
exports.createEntityByIdReducer = createEntityByIdReducer;
|
|
686
|
-
exports.createEntityByIdSelectors = createEntityByIdSelectors;
|
|
687
|
-
exports.createEntityCrudStatusActions = createEntityCrudStatusActions;
|
|
688
|
-
exports.createEntityCrudStatusReducer = createEntityCrudStatusReducer;
|
|
689
|
-
exports.createEntityCrudStatusRedux = createEntityCrudStatusRedux;
|
|
690
|
-
exports.createEntityCrudStatusSelectors = createEntityCrudStatusSelectors;
|
|
691
|
-
exports.createEntityListActions = createEntityListActions;
|
|
692
|
-
exports.createEntityListReducer = createEntityListReducer;
|
|
693
|
-
exports.createEntityListSelectors = createEntityListSelectors;
|
|
694
|
-
exports.createEntityReducer = createEntityReducer;
|
|
695
|
-
exports.createEntitySelectors = createEntitySelectors;
|
|
696
|
-
exports.createModifiedFieldRedux = createModifiedFieldRedux;
|
|
697
|
-
exports.createRecordObjectActions = createRecordObjectActions;
|
|
698
|
-
exports.createRecordObjectReducer = createRecordObjectReducer;
|
|
699
|
-
exports.createSelectedIdsActions = createSelectedIdsActions;
|
|
700
|
-
exports.createSelectedIdsReducer = createSelectedIdsReducer;
|
|
701
|
-
exports.createSelectedIdsReducerInitialState = createSelectedIdsReducerInitialState;
|
|
702
|
-
exports.createSelectedIdsSelectors = createSelectedIdsSelectors;
|
|
703
|
-
exports.createSortOrderActions = createSortOrderActions;
|
|
704
|
-
exports.createSortOrderByIdActions = createSortOrderByIdActions;
|
|
705
|
-
exports.createSortOrderByIdReducer = createSortOrderByIdReducer;
|
|
706
|
-
exports.createSortOrderByIdSelectors = createSortOrderByIdSelectors;
|
|
707
|
-
exports.createSortOrderReducer = createSortOrderReducer;
|
|
708
|
-
exports.createSortOrderReducerInitialState = createSortOrderReducerInitialState;
|
|
709
|
-
exports.createSortOrderSelectors = createSortOrderSelectors;
|
|
710
|
-
exports.createValueByIdActions = createValueByIdActions;
|
|
711
|
-
exports.createValueByIdReducer = createValueByIdReducer;
|
|
712
|
-
exports.createValueByIdSelectors = createValueByIdSelectors;
|
|
713
|
-
exports.entityByIdInitialState = entityByIdInitialState;
|
|
714
|
-
exports.reducerIdGate = reducerIdGate;
|
|
715
|
-
exports.reducerIdGateAction = reducerIdGateAction;
|
|
716
|
-
exports.selectedIdsActions = selectedIdsActions;
|
|
717
|
-
exports.selectedIdsReducer = selectedIdsReducer;
|
|
718
|
-
exports.sortOrderByIdActions = sortOrderByIdActions;
|
|
719
|
-
exports.sortOrderByIdReducer = sortOrderByIdReducer;
|
|
720
|
-
exports.valueByIdInitialState = valueByIdInitialState;
|
|
721
|
-
exports.wrapActionWithReducerIdGate = wrapActionWithReducerIdGate;
|
|
722
|
-
exports.wrapActionsWithReducerIdGate = wrapActionsWithReducerIdGate;
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O=e=>(t={},E)=>{switch(E.type){case"RECORD_OBJECT:CLEAR_RECORD":{const{recordId:r}=E,c={...t};return delete c[r],c}case"RECORD_OBJECT:CLEAR_ALL_RECORDS":return{};case"RECORD_OBJECT:ACTION":{const{recordId:r,action:c}=E;return{...t,[r]:e(t[r],c)}}default:return t}},N=()=>({recordAction:(e,t)=>({type:"RECORD_OBJECT:ACTION",action:t,recordId:e}),clearRecord:e=>({type:"RECORD_OBJECT:CLEAR_RECORD",recordId:e}),clearAllRecords:()=>({type:"RECORD_OBJECT:CLEAR_ALL_RECORDS"})}),Y=(e,t)=>(E,r)=>{let c=E==null?t(void 0,{}):E;return!B(r)||e!==r.reducerId||r.type!=="REDUCER_ID_GATE:ACTION"?c:t(c,r.action)},C=(e,t)=>({type:"REDUCER_ID_GATE:ACTION",action:t,reducerId:e}),B=e=>!!e.action&&e.type==="REDUCER_ID_GATE:ACTION"&&typeof e.reducerId=="string",_=(e,t)=>(...E)=>({type:"REDUCER_ID_GATE:ACTION",reducerId:e,action:t(...E)}),p=(e,t)=>{const E={};for(const r in t){const c=t[r];E[r]=_(e,c)}return E},f=e=>({setValues:t=>({type:"COMMIT_REDUCER.SET_VALUES",id:e,values:t}),commitValues:()=>({type:"COMMIT_REDUCER.COMMIT_VALUES",id:e}),clearValues:()=>({type:"COMMIT_REDUCER.CLEAR",id:e})}),V=(e,t)=>(E=t,r)=>{if(r.id!==e)return E;switch(r.type){case"COMMIT_REDUCER.SET_VALUES":{const{values:c}=r;return{...E,workspace:{...E.workspace,...c}}}case"COMMIT_REDUCER.CLEAR":return{...E,workspace:{...t.workspace}};case"COMMIT_REDUCER.COMMIT_VALUES":return{...E,committed:{...E.workspace}};default:return E}},M=(e,t)=>({getWorkspaceValues:E=>t(E,e).workspace,getCommittedValues:E=>t(E,e).committed}),w=()=>({addAtEnd:e=>({type:"ENTITY_LIST:ADD_AT_END",entity:e}),addAtStart:e=>({entity:e,type:"ENTITY_LIST:ADD_AT_START"}),clearList:()=>({type:"ENTITY_LIST:CLEAR_LIST"}),removeFirst:()=>({type:"ENTITY_LIST:REMOVE_FIRST"}),removeLast:()=>({type:"ENTITY_LIST:REMOVE_LAST"}),removeAtIndex:e=>({type:"ENTITY_LIST:REMOVE_AT_INDEX",index:e}),removeByFieldMatch:e=>({type:"ENTITY_LIST:REMOVE_BY_FIELD_MATCH",fields:e}),remove:e=>({type:"ENTITY_LIST:REMOVE",entity:e}),setList:e=>({type:"ENTITY_LIST:SET_LIST",list:e}),toggle:e=>({type:"ENTITY_LIST:TOGGLE",entity:e}),actionByFieldsMatch:(e,t)=>({type:"ENTITY_LIST:ACTION_BY_FIELDS_MATCH",fields:e,action:t}),actionByIndex:(e,t)=>({type:"ENTITY_LIST:ACTION_BY_INDEX",index:e,action:t}),actionOnAll:e=>({type:"ENTITY_LIST:ACTION_ON_ALL",action:e})}),n=(e,t)=>{const E=Object.keys(t);if(E.length===0)return!1;for(let r=0;r<E.length;r++){const c=E[r];if(e[c]!==t[c])return!1}return!0},h=e=>(t=[],E)=>{switch(E.type){case"ENTITY_LIST:SET_LIST":{const{list:r}=E;return r}case"ENTITY_LIST:CLEAR_LIST":return[];case"ENTITY_LIST:ADD_AT_END":{const{entity:r}=E;return[...t,r]}case"ENTITY_LIST:ADD_AT_START":{const{entity:r}=E;return[r,...t]}case"ENTITY_LIST:REMOVE_FIRST":{if(t.length===0)throw new Error("Cannot remove, list is empty.");const[,...r]=t;return r}case"ENTITY_LIST:REMOVE_LAST":{if(t.length===0)throw new Error("Cannot remove, list is empty.");const r=[...t];return r.pop(),r}case"ENTITY_LIST:REMOVE_AT_INDEX":{const{index:r}=E;if(r<0)throw new Error("Index is lower than 0.");if(r>=t.length)throw new Error("Index is outside of list bounds.");const c=[...t];return c.splice(r,1),c}case"ENTITY_LIST:REMOVE_BY_FIELD_MATCH":{const{fields:r}=E;return t.filter(c=>!n(c,r))}case"ENTITY_LIST:REMOVE":{const{entity:r}=E;return t.filter(c=>c!==r)}case"ENTITY_LIST:TOGGLE":{const{entity:r}=E,c=t.findIndex(T=>T===r||n(T,r));if(c>=0){const T=[...t];return T.splice(c,c),T}else return[...t,r]}case"ENTITY_LIST:ACTION_BY_FIELDS_MATCH":{const{fields:r,action:c}=E;if(!e)throw new Error("No reducer specified, unable to handle 'actionByFieldsMatch'.");return t.map(T=>n(T,r)?e(T,c):T)}case"ENTITY_LIST:ACTION_BY_INDEX":{const{index:r,action:c}=E;if(!e)throw new Error("No reducer specified, unable to handle 'actionByIndex'.");return t.map((T,D)=>r===D?e(T,c):T)}case"ENTITY_LIST:ACTION_ON_ALL":{const{action:r}=E;if(!e)throw new Error("No reducer specified, unable to handle 'actionByIndex'.");return t.map(c=>e(c,r))}default:return t}},m=e=>({getList:t=>e(t)}),i={entities:{}},s=()=>(e=i,t)=>{switch(t.type){case"ENTITY_BY_ID:SET_ENTITY":{const{entity:E}=t;return{...e,entities:{...e.entities,[E.id]:E}}}case"ENTITY_BY_ID:SET_ENTITY_FIELDS":{const{id:E,fields:r}=t;return{...e,entities:{...e.entities,[E]:{...e.entities[E],...r}}}}case"ENTITY_BY_ID:CLEAR_ALL_ENTITIES":return{...e,entities:{}};case"ENTITY_BY_ID:CLEAR_ENTITY":{const{id:E}=t,r={...e.entities};return delete r[E],{...e,entities:r}}default:return e}},I=()=>({setEntity:e=>({type:"ENTITY_BY_ID:SET_ENTITY",entity:e}),setEntityFields:(e,t)=>({type:"ENTITY_BY_ID:SET_ENTITY_FIELDS",id:e,fields:t}),clearEntity:e=>({type:"ENTITY_BY_ID:CLEAR_ENTITY",id:e}),clearAllEntities:()=>({type:"ENTITY_BY_ID:CLEAR_ALL_ENTITIES"})}),d=e=>({getState:e}),b=e=>{const t=e;return(E=t,r)=>{switch(r.type){case"ENTITY:SET_ENTITY":{const{entity:c}=r;return c}case"ENTITY:SET_ENTITY_FIELDS":{const{fields:c}=r;return{...E,...c}}default:return E}}},U=()=>({setEntity:e=>({type:"ENTITY:SET_ENTITY",entity:e}),setEntityFields:e=>({type:"ENTITY:SET_ENTITY_FIELDS",fields:e})}),v=e=>({getEntity:t=>e(t)}),o=()=>s(),S=()=>I(),u=e=>d(e),F=e=>{const t=o(),E=S(),r=u(e);return{reducer:t,actions:E,selectors:r}},g=e=>{const t=s(),E=d(e),r=I();return{reducer:t,selectors:E,actions:r}},G=(e,t)=>{const E={id:t,editable:e,persisted:e};return(r=E,c)=>{switch(c.type){case"EDITABLE_ENTITY:SET_ENTITY_ID":{const{id:T}=c;return{...r,id:T}}case"EDITABLE_ENTITY:SET_ENTITY":{const{entity:T}=c;return{...r,persisted:T,editable:T}}case"EDITABLE_ENTITY:SET_PERSISTED_ENTITY":{const{entity:T}=c;return{...r,persisted:T}}case"EDITABLE_ENTITY:SET_EDITABLE_ENTITY":{const{entity:T}=c;return{...r,editable:T}}case"EDITABLE_ENTITY:SET_EDITABLE_ENTITY_FIELDS":{const{fields:T}=c;return{...r,editable:{...r.editable,...T}}}case"EDITABLE_ENTITY:REVERT_EDITABLE_ENTITY":return{...r,editable:r.persisted};case"EDITABLE_ENTITY:COMMIT_EDITABLE_ENTITY_TO_PERSISTED":return{...r,persisted:r.editable};default:return r}}},x=()=>({setEntityId:e=>({type:"EDITABLE_ENTITY:SET_ENTITY_ID",id:e}),setEntity:e=>({type:"EDITABLE_ENTITY:SET_ENTITY",entity:e}),setPersistedEntity:e=>({type:"EDITABLE_ENTITY:SET_PERSISTED_ENTITY",entity:e}),setEditableEntity:e=>({type:"EDITABLE_ENTITY:SET_EDITABLE_ENTITY",entity:e}),setEditableEntityFields:e=>({type:"EDITABLE_ENTITY:SET_EDITABLE_ENTITY_FIELDS",fields:e}),revertEditableEntity:()=>({type:"EDITABLE_ENTITY:REVERT_EDITABLE_ENTITY"}),commitEditableEntityToPersisted:()=>({type:"EDITABLE_ENTITY:COMMIT_EDITABLE_ENTITY_TO_PERSISTED"})}),R=(e=[])=>({selectedIds:e}),k=R(),a=(e=k)=>(t=e,E)=>{switch(E.type){case"SELECTED_IDS:SET_SELECTED_IDS":{const{selectedIds:r}=E;return{...t,selectedIds:r}}case"SELECTED_IDS:CLEAR_SELECTED_IDS":return{...t,selectedIds:[]};default:return t}},j=a(),l=()=>({setSelectedIds:e=>({selectedIds:e,type:"SELECTED_IDS:SET_SELECTED_IDS"}),clearSelectedIds:()=>({type:"SELECTED_IDS:CLEAR_SELECTED_IDS"})}),J=l(),P=e=>({getState:e}),W={ids:void 0},A=()=>(e=W,t)=>{switch(t.type){case"SORT_ORDER_BY_ID:SET_SORT_ORDER":return{...e,ids:t.ids};case"SORT_ORDER_BY_ID:CLEAR_SORT_ORDER":return{...e,ids:void 0};default:return e}},H=A(),y=()=>({setSortOrder:e=>({ids:e,type:"SORT_ORDER_BY_ID:SET_SORT_ORDER"}),clearSortOrder:()=>({type:"SORT_ORDER_BY_ID:CLEAR_SORT_ORDER"})}),X=y(),$=e=>({getSortOrderByIdState:t=>e(t),getSortOrder:t=>e(t).ids}),q=(e=void 0,t=!1)=>({sortBy:e,desc:t}),z=(e={sortBy:void 0,desc:!1})=>(t=e,E)=>{switch(E.type){case"SORT_ORDER:SET_SORT_BY":{const{sortBy:r,desc:c}=E;return{...t,sortBy:r,desc:c}}case"SORT_ORDER:CLEAR_SORT_ORDER":return{...t,sortBy:void 0,desc:!1};default:return t}},K=()=>({sortBy:(e,t)=>({desc:t,sortBy:e,type:"SORT_ORDER:SET_SORT_BY"}),clearSortOrder:()=>({type:"SORT_ORDER:CLEAR_SORT_ORDER"})}),Q=e=>({getState:e}),L={values:{}},Z=(e=L)=>(t=e,E)=>{switch(E.type){case"VALUE_BY_ID:SET_VALUE":{const{id:r,value:c}=E;return{...t,values:{...t.values,[r]:c}}}case"VALUE_BY_ID:CLEAR_ALL_VALUES":return{...t,values:{}};case"VALUE_BY_ID:CLEAR_VALUE":{const{id:r}=E,c={...t.values};return delete c[r],{...t,values:c}}default:return t}},ee=()=>({setValue:(e,t)=>({type:"VALUE_BY_ID:SET_VALUE",id:e,value:t}),clearValue:e=>({type:"VALUE_BY_ID:CLEAR_VALUE",id:e}),clearAllValues:()=>({type:"VALUE_BY_ID:CLEAR_ALL_VALUES"})}),te=e=>({getState:e});exports.createCommitReducer=V;exports.createCommitReducerActions=f;exports.createCommitReducerSelectors=M;exports.createEditableEntityActions=x;exports.createEditableEntityReducer=G;exports.createEntityActions=U;exports.createEntityByIdActions=I;exports.createEntityByIdReducer=s;exports.createEntityByIdSelectors=d;exports.createEntityCrudStatusActions=S;exports.createEntityCrudStatusReducer=o;exports.createEntityCrudStatusRedux=F;exports.createEntityCrudStatusSelectors=u;exports.createEntityListActions=w;exports.createEntityListReducer=h;exports.createEntityListSelectors=m;exports.createEntityReducer=b;exports.createEntitySelectors=v;exports.createModifiedFieldRedux=g;exports.createRecordObjectActions=N;exports.createRecordObjectReducer=O;exports.createSelectedIdsActions=l;exports.createSelectedIdsReducer=a;exports.createSelectedIdsReducerInitialState=R;exports.createSelectedIdsSelectors=P;exports.createSortOrderActions=K;exports.createSortOrderByIdActions=y;exports.createSortOrderByIdReducer=A;exports.createSortOrderByIdSelectors=$;exports.createSortOrderReducer=z;exports.createSortOrderReducerInitialState=q;exports.createSortOrderSelectors=Q;exports.createValueByIdActions=ee;exports.createValueByIdReducer=Z;exports.createValueByIdSelectors=te;exports.entityByIdInitialState=i;exports.reducerIdGate=Y;exports.reducerIdGateAction=C;exports.selectedIdsActions=J;exports.selectedIdsReducer=j;exports.sortOrderByIdActions=X;exports.sortOrderByIdReducer=H;exports.valueByIdInitialState=L;exports.wrapActionWithReducerIdGate=_;exports.wrapActionsWithReducerIdGate=p;
|
|
723
2
|
//# sourceMappingURL=index.js.map
|