@softpak/components 20.12.13 → 20.12.16
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.
|
@@ -1,24 +1,52 @@
|
|
|
1
|
-
import { emptyProps, props } from '@ngrx/store';
|
|
1
|
+
import { emptyProps, props, createReducer, on } from '@ngrx/store';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const spxCreateApiActions = () => {
|
|
4
4
|
return {
|
|
5
5
|
Error: props(),
|
|
6
6
|
Load: props(),
|
|
7
7
|
Received: props(),
|
|
8
8
|
Reset: emptyProps(),
|
|
9
9
|
};
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
const spxCreateInitialStateForReducer = () => ({
|
|
13
13
|
data: null,
|
|
14
14
|
error: null,
|
|
15
15
|
loading: false,
|
|
16
16
|
loaded: false,
|
|
17
|
+
query: null,
|
|
18
|
+
queryNext: null,
|
|
17
19
|
});
|
|
18
20
|
|
|
21
|
+
function spxCreateApiReducer(actions) {
|
|
22
|
+
const initialState = spxCreateInitialStateForReducer();
|
|
23
|
+
return createReducer(initialState, on(actions.load, (state, { query }) => ({
|
|
24
|
+
...state,
|
|
25
|
+
loading: true,
|
|
26
|
+
loaded: false,
|
|
27
|
+
queryNext: query,
|
|
28
|
+
})), on(actions.received, (state, { result }) => ({
|
|
29
|
+
...state,
|
|
30
|
+
data: result,
|
|
31
|
+
error: null,
|
|
32
|
+
loading: false,
|
|
33
|
+
loaded: true,
|
|
34
|
+
query: state.queryNext,
|
|
35
|
+
queryNext: null,
|
|
36
|
+
})), on(actions.error, (state, { error }) => ({
|
|
37
|
+
...state,
|
|
38
|
+
error,
|
|
39
|
+
data: null,
|
|
40
|
+
loading: false,
|
|
41
|
+
loaded: false,
|
|
42
|
+
query: state.queryNext,
|
|
43
|
+
queryNext: null,
|
|
44
|
+
})), on(actions.reset, () => initialState));
|
|
45
|
+
}
|
|
46
|
+
|
|
19
47
|
/**
|
|
20
48
|
* Generated bundle index. Do not edit.
|
|
21
49
|
*/
|
|
22
50
|
|
|
23
|
-
export {
|
|
51
|
+
export { spxCreateApiActions, spxCreateApiReducer, spxCreateInitialStateForReducer };
|
|
24
52
|
//# sourceMappingURL=softpak-components-spx-redux.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"softpak-components-spx-redux.mjs","sources":["../../../../projects/softpak/components/spx-redux/src/spx-create-actions
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-redux.mjs","sources":["../../../../projects/softpak/components/spx-redux/src/spx-create-api-actions.ts","../../../../projects/softpak/components/spx-redux/src/spx-create-initial-state.ts","../../../../projects/softpak/components/spx-redux/src/spx-create-api-reducer.ts","../../../../projects/softpak/components/spx-redux/softpak-components-spx-redux.ts"],"sourcesContent":["import { ActionCreator, emptyProps, props } from \"@ngrx/store\";\n\nexport type WithProps<P extends object> = ActionCreator<string, (props: P) => P>;\nexport type WithoutProps = ActionCreator<string, () => object>;\n\nexport const spxCreateApiActions = <TQuery, TResult, TMsg = string>() => {\n return {\n Error: props<{ error: TMsg }>(),\n Load: props<{ query: TQuery }>(),\n Received: props<{ result: TResult }>(),\n Reset: emptyProps(),\n };\n}","import { SpxState } from \"./spx-state.interface\";\n\nexport const spxCreateInitialStateForReducer = <TQuery, TData, TError>(): SpxState<TQuery, TData, TError> => ({\n data: null,\n error: null,\n loading: false,\n loaded: false,\n query: null,\n queryNext: null,\n});\n","import { WithProps, WithoutProps } from \"./spx-create-api-actions\";\nimport { createReducer, on } from \"@ngrx/store\";\n\nimport { SpxState } from \"./spx-state.interface\";\nimport { spxCreateInitialStateForReducer } from \"./spx-create-initial-state\";\n\nexport interface SpxApiActions<TQuery, TData, TError> {\n error: WithProps<{ error: TError }>;\n load: WithProps<{ query: TQuery }>;\n received: WithProps<{ result: TData }>;\n reset: WithoutProps;\n}\n\nexport function spxCreateApiReducer<TQuery, TData, TError>(\n actions: SpxApiActions<TQuery, TData, TError>\n) {\n const initialState = spxCreateInitialStateForReducer<TQuery, TData, TError>();\n\n return createReducer(\n initialState,\n\n on(actions.load, (state: SpxState<TQuery, TData, TError>, { query }): SpxState<TQuery, TData, TError> => ({\n ...state,\n loading: true,\n loaded: false,\n queryNext: query,\n })),\n\n on(actions.received, (state: SpxState<TQuery, TData, TError>, { result }): SpxState<TQuery, TData, TError> => ({\n ...state,\n data: result as TData,\n error: null,\n loading: false,\n loaded: true,\n query: state.queryNext,\n queryNext: null,\n })),\n\n on(actions.error, (state: SpxState<TQuery, TData, TError>, { error }): SpxState<TQuery, TData, TError> => ({\n ...state,\n error,\n data: null,\n loading: false,\n loaded: false,\n query: state.queryNext,\n queryNext: null,\n })),\n\n on(actions.reset, (): SpxState<TQuery, TData, TError> => initialState)\n );\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAKO,MAAM,mBAAmB,GAAG,MAAqC;IACtE,OAAO;QACL,KAAK,EAAE,KAAK,EAAmB;QAC/B,IAAI,EAAE,KAAK,EAAqB;QAChC,QAAQ,EAAE,KAAK,EAAuB;QACtC,KAAK,EAAE,UAAU,EAAE;KACpB;AACH;;ACVO,MAAM,+BAA+B,GAAG,OAA+D;AAC5G,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,SAAS,EAAE,IAAI;AAChB,CAAA;;ACIK,SAAU,mBAAmB,CACjC,OAA6C,EAAA;AAE7C,IAAA,MAAM,YAAY,GAAG,+BAA+B,EAAyB;AAE7E,IAAA,OAAO,aAAa,CAClB,YAAY,EAEZ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,KAAsC,EAAE,EAAE,KAAK,EAAE,MAAuC;AACxG,QAAA,GAAG,KAAK;AACR,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,SAAS,EAAE,KAAK;AACjB,KAAA,CAAC,CAAC,EAEH,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAsC,EAAE,EAAE,MAAM,EAAE,MAAuC;AAC7G,QAAA,GAAG,KAAK;AACR,QAAA,IAAI,EAAE,MAAe;AACrB,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,KAAK,CAAC,SAAS;AACtB,QAAA,SAAS,EAAE,IAAI;AAChB,KAAA,CAAC,CAAC,EAEH,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,KAAsC,EAAE,EAAE,KAAK,EAAE,MAAuC;AACzG,QAAA,GAAG,KAAK;QACR,KAAK;AACL,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,OAAO,EAAE,KAAK;AACd,QAAA,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK,CAAC,SAAS;AACtB,QAAA,SAAS,EAAE,IAAI;AAChB,KAAA,CAAC,CAAC,EAEH,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,MAAuC,YAAY,CAAC,CACvE;AACH;;AClDA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softpak/components",
|
|
3
|
-
"version": "20.12.
|
|
3
|
+
"version": "20.12.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "20.x.x",
|
|
@@ -32,42 +32,42 @@
|
|
|
32
32
|
"types": "./index.d.ts",
|
|
33
33
|
"default": "./fesm2022/softpak-components.mjs"
|
|
34
34
|
},
|
|
35
|
-
"./spx-alert": {
|
|
36
|
-
"types": "./spx-alert/index.d.ts",
|
|
37
|
-
"default": "./fesm2022/softpak-components-spx-alert.mjs"
|
|
38
|
-
},
|
|
39
35
|
"./spx-404-page": {
|
|
40
36
|
"types": "./spx-404-page/index.d.ts",
|
|
41
37
|
"default": "./fesm2022/softpak-components-spx-404-page.mjs"
|
|
42
38
|
},
|
|
43
|
-
"./spx-
|
|
44
|
-
"types": "./spx-
|
|
45
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
46
|
-
},
|
|
47
|
-
"./spx-app-expiry": {
|
|
48
|
-
"types": "./spx-app-expiry/index.d.ts",
|
|
49
|
-
"default": "./fesm2022/softpak-components-spx-app-expiry.mjs"
|
|
39
|
+
"./spx-alert": {
|
|
40
|
+
"types": "./spx-alert/index.d.ts",
|
|
41
|
+
"default": "./fesm2022/softpak-components-spx-alert.mjs"
|
|
50
42
|
},
|
|
51
43
|
"./spx-button": {
|
|
52
44
|
"types": "./spx-button/index.d.ts",
|
|
53
45
|
"default": "./fesm2022/softpak-components-spx-button.mjs"
|
|
54
46
|
},
|
|
55
|
-
"./spx-
|
|
56
|
-
"types": "./spx-
|
|
57
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
47
|
+
"./spx-app-expiry": {
|
|
48
|
+
"types": "./spx-app-expiry/index.d.ts",
|
|
49
|
+
"default": "./fesm2022/softpak-components-spx-app-expiry.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./spx-app-configuration": {
|
|
52
|
+
"types": "./spx-app-configuration/index.d.ts",
|
|
53
|
+
"default": "./fesm2022/softpak-components-spx-app-configuration.mjs"
|
|
58
54
|
},
|
|
59
55
|
"./spx-capitalize": {
|
|
60
56
|
"types": "./spx-capitalize/index.d.ts",
|
|
61
57
|
"default": "./fesm2022/softpak-components-spx-capitalize.mjs"
|
|
62
58
|
},
|
|
63
|
-
"./spx-
|
|
64
|
-
"types": "./spx-
|
|
65
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
59
|
+
"./spx-change-details": {
|
|
60
|
+
"types": "./spx-change-details/index.d.ts",
|
|
61
|
+
"default": "./fesm2022/softpak-components-spx-change-details.mjs"
|
|
66
62
|
},
|
|
67
63
|
"./spx-channel-selection": {
|
|
68
64
|
"types": "./spx-channel-selection/index.d.ts",
|
|
69
65
|
"default": "./fesm2022/softpak-components-spx-channel-selection.mjs"
|
|
70
66
|
},
|
|
67
|
+
"./spx-card": {
|
|
68
|
+
"types": "./spx-card/index.d.ts",
|
|
69
|
+
"default": "./fesm2022/softpak-components-spx-card.mjs"
|
|
70
|
+
},
|
|
71
71
|
"./spx-check-digit": {
|
|
72
72
|
"types": "./spx-check-digit/index.d.ts",
|
|
73
73
|
"default": "./fesm2022/softpak-components-spx-check-digit.mjs"
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
"types": "./spx-confirm/index.d.ts",
|
|
77
77
|
"default": "./fesm2022/softpak-components-spx-confirm.mjs"
|
|
78
78
|
},
|
|
79
|
-
"./spx-form-section": {
|
|
80
|
-
"types": "./spx-form-section/index.d.ts",
|
|
81
|
-
"default": "./fesm2022/softpak-components-spx-form-section.mjs"
|
|
82
|
-
},
|
|
83
79
|
"./spx-form-view": {
|
|
84
80
|
"types": "./spx-form-view/index.d.ts",
|
|
85
81
|
"default": "./fesm2022/softpak-components-spx-form-view.mjs"
|
|
86
82
|
},
|
|
83
|
+
"./spx-form-section": {
|
|
84
|
+
"types": "./spx-form-section/index.d.ts",
|
|
85
|
+
"default": "./fesm2022/softpak-components-spx-form-section.mjs"
|
|
86
|
+
},
|
|
87
87
|
"./spx-helpers": {
|
|
88
88
|
"types": "./spx-helpers/index.d.ts",
|
|
89
89
|
"default": "./fesm2022/softpak-components-spx-helpers.mjs"
|
|
@@ -104,22 +104,22 @@
|
|
|
104
104
|
"types": "./spx-pagination/index.d.ts",
|
|
105
105
|
"default": "./fesm2022/softpak-components-spx-pagination.mjs"
|
|
106
106
|
},
|
|
107
|
-
"./spx-
|
|
108
|
-
"types": "./spx-
|
|
109
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
107
|
+
"./spx-progress-bar": {
|
|
108
|
+
"types": "./spx-progress-bar/index.d.ts",
|
|
109
|
+
"default": "./fesm2022/softpak-components-spx-progress-bar.mjs"
|
|
110
110
|
},
|
|
111
111
|
"./spx-pipes": {
|
|
112
112
|
"types": "./spx-pipes/index.d.ts",
|
|
113
113
|
"default": "./fesm2022/softpak-components-spx-pipes.mjs"
|
|
114
114
|
},
|
|
115
|
+
"./spx-patch": {
|
|
116
|
+
"types": "./spx-patch/index.d.ts",
|
|
117
|
+
"default": "./fesm2022/softpak-components-spx-patch.mjs"
|
|
118
|
+
},
|
|
115
119
|
"./spx-redux": {
|
|
116
120
|
"types": "./spx-redux/index.d.ts",
|
|
117
121
|
"default": "./fesm2022/softpak-components-spx-redux.mjs"
|
|
118
122
|
},
|
|
119
|
-
"./spx-progress-bar": {
|
|
120
|
-
"types": "./spx-progress-bar/index.d.ts",
|
|
121
|
-
"default": "./fesm2022/softpak-components-spx-progress-bar.mjs"
|
|
122
|
-
},
|
|
123
123
|
"./spx-stock-info": {
|
|
124
124
|
"types": "./spx-stock-info/index.d.ts",
|
|
125
125
|
"default": "./fesm2022/softpak-components-spx-stock-info.mjs"
|
|
@@ -136,18 +136,22 @@
|
|
|
136
136
|
"types": "./spx-toaster/index.d.ts",
|
|
137
137
|
"default": "./fesm2022/softpak-components-spx-toaster.mjs"
|
|
138
138
|
},
|
|
139
|
-
"./spx-tabs": {
|
|
140
|
-
"types": "./spx-tabs/index.d.ts",
|
|
141
|
-
"default": "./fesm2022/softpak-components-spx-tabs.mjs"
|
|
142
|
-
},
|
|
143
139
|
"./spx-suggestion": {
|
|
144
140
|
"types": "./spx-suggestion/index.d.ts",
|
|
145
141
|
"default": "./fesm2022/softpak-components-spx-suggestion.mjs"
|
|
146
142
|
},
|
|
143
|
+
"./spx-tabs": {
|
|
144
|
+
"types": "./spx-tabs/index.d.ts",
|
|
145
|
+
"default": "./fesm2022/softpak-components-spx-tabs.mjs"
|
|
146
|
+
},
|
|
147
147
|
"./spx-toggle": {
|
|
148
148
|
"types": "./spx-toggle/index.d.ts",
|
|
149
149
|
"default": "./fesm2022/softpak-components-spx-toggle.mjs"
|
|
150
150
|
},
|
|
151
|
+
"./spx-validation": {
|
|
152
|
+
"types": "./spx-validation/index.d.ts",
|
|
153
|
+
"default": "./fesm2022/softpak-components-spx-validation.mjs"
|
|
154
|
+
},
|
|
151
155
|
"./spx-update": {
|
|
152
156
|
"types": "./spx-update/index.d.ts",
|
|
153
157
|
"default": "./fesm2022/softpak-components-spx-update.mjs"
|
|
@@ -156,10 +160,6 @@
|
|
|
156
160
|
"types": "./spx-translate/index.d.ts",
|
|
157
161
|
"default": "./fesm2022/softpak-components-spx-translate.mjs"
|
|
158
162
|
},
|
|
159
|
-
"./spx-validation": {
|
|
160
|
-
"types": "./spx-validation/index.d.ts",
|
|
161
|
-
"default": "./fesm2022/softpak-components-spx-validation.mjs"
|
|
162
|
-
},
|
|
163
163
|
"./spx-validation-messages": {
|
|
164
164
|
"types": "./spx-validation-messages/index.d.ts",
|
|
165
165
|
"default": "./fesm2022/softpak-components-spx-validation-messages.mjs"
|
package/spx-redux/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as _ngrx_store from '@ngrx/store';
|
|
2
|
+
import { ActionCreator } from '@ngrx/store';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type WithProps<P extends object> = ActionCreator<string, (props: P) => P>;
|
|
5
|
+
type WithoutProps = ActionCreator<string, () => object>;
|
|
6
|
+
declare const spxCreateApiActions: <TQuery, TResult, TMsg = string>() => {
|
|
4
7
|
Error: _ngrx_store.ActionCreatorProps<{
|
|
5
8
|
error: TMsg;
|
|
6
9
|
}>;
|
|
@@ -13,14 +16,30 @@ declare function spxCreateActionsForAPI<TQuery, TResult, TMsg = string>(): {
|
|
|
13
16
|
Reset: _ngrx_store.ActionCreatorProps<void>;
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
interface SpxState<TData, TError> {
|
|
19
|
+
interface SpxState<TQuery, TData, TError> {
|
|
17
20
|
data: TData | null;
|
|
18
21
|
error: TError | null;
|
|
19
22
|
loading: boolean;
|
|
20
23
|
loaded: boolean;
|
|
24
|
+
queryNext: TQuery | null;
|
|
25
|
+
query: TQuery | null;
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
interface SpxApiActions<TQuery, TData, TError> {
|
|
29
|
+
error: WithProps<{
|
|
30
|
+
error: TError;
|
|
31
|
+
}>;
|
|
32
|
+
load: WithProps<{
|
|
33
|
+
query: TQuery;
|
|
34
|
+
}>;
|
|
35
|
+
received: WithProps<{
|
|
36
|
+
result: TData;
|
|
37
|
+
}>;
|
|
38
|
+
reset: WithoutProps;
|
|
39
|
+
}
|
|
40
|
+
declare function spxCreateApiReducer<TQuery, TData, TError>(actions: SpxApiActions<TQuery, TData, TError>): _ngrx_store.ActionReducer<SpxState<TQuery, TData, TError>, _ngrx_store.Action<string>>;
|
|
41
|
+
|
|
42
|
+
declare const spxCreateInitialStateForReducer: <TQuery, TData, TError>() => SpxState<TQuery, TData, TError>;
|
|
24
43
|
|
|
25
|
-
export {
|
|
26
|
-
export type { SpxState };
|
|
44
|
+
export { spxCreateApiActions, spxCreateApiReducer, spxCreateInitialStateForReducer };
|
|
45
|
+
export type { SpxApiActions, SpxState, WithProps, WithoutProps };
|