@one-paragon/angular-utilities 2.8.1 → 2.8.2
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.
|
@@ -7206,11 +7206,12 @@ let _ei;
|
|
|
7206
7206
|
* @param [dispatchIf = defaultFilter] Optional. A method that takes the result of the selector and returns a boolean. The actions gets dispatched
|
|
7207
7207
|
* if true is returned. If no method is passed in than the action will be dispatched if the selector returns undefined or null.
|
|
7208
7208
|
*/
|
|
7209
|
-
const createActionableSelector = (selectorFactory, action, dispatchIf = defaultFilter) => {
|
|
7209
|
+
const createActionableSelector = (selectorFactory, action, dispatchIf = defaultFilter, defaultValue) => {
|
|
7210
7210
|
const options = {
|
|
7211
7211
|
selectorFactory,
|
|
7212
7212
|
action: (...props) => () => _store.dispatch(action(...props)),
|
|
7213
|
-
dispatchIf
|
|
7213
|
+
dispatchIf,
|
|
7214
|
+
defaultValue
|
|
7214
7215
|
};
|
|
7215
7216
|
const actionable = createActionResultSelector(options);
|
|
7216
7217
|
return (...props) => createSelector(actionable(...props), b => b.result);
|
|
@@ -7224,11 +7225,12 @@ const createActionSelector = (options) => {
|
|
|
7224
7225
|
const actionable = createActionResultSelector(options);
|
|
7225
7226
|
return ((...props) => createSelector(actionable(...props), b => b.result));
|
|
7226
7227
|
};
|
|
7227
|
-
const createActionableResultSelector = (selectorFactory, action, dispatchIf = defaultFilter) => {
|
|
7228
|
+
const createActionableResultSelector = (selectorFactory, action, dispatchIf = defaultFilter, defaultValue) => {
|
|
7228
7229
|
const options = {
|
|
7229
7230
|
selectorFactory,
|
|
7230
7231
|
action: (...props) => () => _store.dispatch(action(...props)),
|
|
7231
|
-
dispatchIf
|
|
7232
|
+
dispatchIf,
|
|
7233
|
+
defaultValue
|
|
7232
7234
|
};
|
|
7233
7235
|
return createActionResultSelector(options);
|
|
7234
7236
|
};
|
|
@@ -7244,7 +7246,7 @@ const createActionResultSelector = (options) => {
|
|
|
7244
7246
|
}
|
|
7245
7247
|
return ({
|
|
7246
7248
|
loading: needsDispatch,
|
|
7247
|
-
result: selected
|
|
7249
|
+
result: needsDispatch && options.defaultValue !== undefined ? options.defaultValue : selected
|
|
7248
7250
|
});
|
|
7249
7251
|
});
|
|
7250
7252
|
return slctr;
|