@softpak/components 20.12.14 → 20.12.17
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,12 +1,37 @@
|
|
|
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
|
+
};
|
|
11
|
+
|
|
12
|
+
function spxCreateApiReducer(actions, initialState) {
|
|
13
|
+
return createReducer(initialState, on(actions.load, (state, { query }) => ({
|
|
14
|
+
...state,
|
|
15
|
+
loading: true,
|
|
16
|
+
loaded: false,
|
|
17
|
+
queryNext: query,
|
|
18
|
+
})), on(actions.received, (state, { result }) => ({
|
|
19
|
+
...state,
|
|
20
|
+
data: result,
|
|
21
|
+
error: null,
|
|
22
|
+
loading: false,
|
|
23
|
+
loaded: true,
|
|
24
|
+
query: state.queryNext,
|
|
25
|
+
queryNext: null,
|
|
26
|
+
})), on(actions.error, (state, { error }) => ({
|
|
27
|
+
...state,
|
|
28
|
+
error,
|
|
29
|
+
data: null,
|
|
30
|
+
loading: false,
|
|
31
|
+
loaded: false,
|
|
32
|
+
query: state.queryNext,
|
|
33
|
+
queryNext: null,
|
|
34
|
+
})), on(actions.reset, () => initialState));
|
|
10
35
|
}
|
|
11
36
|
|
|
12
37
|
const spxCreateInitialStateForReducer = () => ({
|
|
@@ -14,11 +39,13 @@ const spxCreateInitialStateForReducer = () => ({
|
|
|
14
39
|
error: null,
|
|
15
40
|
loading: false,
|
|
16
41
|
loaded: false,
|
|
42
|
+
query: null,
|
|
43
|
+
queryNext: null,
|
|
17
44
|
});
|
|
18
45
|
|
|
19
46
|
/**
|
|
20
47
|
* Generated bundle index. Do not edit.
|
|
21
48
|
*/
|
|
22
49
|
|
|
23
|
-
export {
|
|
50
|
+
export { spxCreateApiActions, spxCreateApiReducer, spxCreateInitialStateForReducer };
|
|
24
51
|
//# 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-api-reducer.ts","../../../../projects/softpak/components/spx-redux/src/spx-create-initial-state.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 { 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 initialState: SpxState<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}","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","/**\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;;ACCM,SAAU,mBAAmB,CACjC,OAA6C,EAC7C,YAA6C,EAAA;AAE7C,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;;AC/CO,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;;ACTD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softpak/components",
|
|
3
|
-
"version": "20.12.
|
|
3
|
+
"version": "20.12.17",
|
|
4
4
|
"private": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "20.x.x",
|
|
@@ -36,57 +36,61 @@
|
|
|
36
36
|
"types": "./spx-404-page/index.d.ts",
|
|
37
37
|
"default": "./fesm2022/softpak-components-spx-404-page.mjs"
|
|
38
38
|
},
|
|
39
|
-
"./spx-app-configuration": {
|
|
40
|
-
"types": "./spx-app-configuration/index.d.ts",
|
|
41
|
-
"default": "./fesm2022/softpak-components-spx-app-configuration.mjs"
|
|
42
|
-
},
|
|
43
39
|
"./spx-alert": {
|
|
44
40
|
"types": "./spx-alert/index.d.ts",
|
|
45
41
|
"default": "./fesm2022/softpak-components-spx-alert.mjs"
|
|
46
42
|
},
|
|
43
|
+
"./spx-app-expiry": {
|
|
44
|
+
"types": "./spx-app-expiry/index.d.ts",
|
|
45
|
+
"default": "./fesm2022/softpak-components-spx-app-expiry.mjs"
|
|
46
|
+
},
|
|
47
47
|
"./spx-button": {
|
|
48
48
|
"types": "./spx-button/index.d.ts",
|
|
49
49
|
"default": "./fesm2022/softpak-components-spx-button.mjs"
|
|
50
50
|
},
|
|
51
|
-
"./spx-
|
|
52
|
-
"types": "./spx-
|
|
53
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
51
|
+
"./spx-app-configuration": {
|
|
52
|
+
"types": "./spx-app-configuration/index.d.ts",
|
|
53
|
+
"default": "./fesm2022/softpak-components-spx-app-configuration.mjs"
|
|
54
54
|
},
|
|
55
55
|
"./spx-capitalize": {
|
|
56
56
|
"types": "./spx-capitalize/index.d.ts",
|
|
57
57
|
"default": "./fesm2022/softpak-components-spx-capitalize.mjs"
|
|
58
58
|
},
|
|
59
|
-
"./spx-
|
|
60
|
-
"types": "./spx-
|
|
61
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
59
|
+
"./spx-card": {
|
|
60
|
+
"types": "./spx-card/index.d.ts",
|
|
61
|
+
"default": "./fesm2022/softpak-components-spx-card.mjs"
|
|
62
|
+
},
|
|
63
|
+
"./spx-check-digit": {
|
|
64
|
+
"types": "./spx-check-digit/index.d.ts",
|
|
65
|
+
"default": "./fesm2022/softpak-components-spx-check-digit.mjs"
|
|
62
66
|
},
|
|
63
67
|
"./spx-channel-selection": {
|
|
64
68
|
"types": "./spx-channel-selection/index.d.ts",
|
|
65
69
|
"default": "./fesm2022/softpak-components-spx-channel-selection.mjs"
|
|
66
70
|
},
|
|
67
|
-
"./spx-
|
|
68
|
-
"types": "./spx-
|
|
69
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
71
|
+
"./spx-change-details": {
|
|
72
|
+
"types": "./spx-change-details/index.d.ts",
|
|
73
|
+
"default": "./fesm2022/softpak-components-spx-change-details.mjs"
|
|
70
74
|
},
|
|
71
75
|
"./spx-confirm": {
|
|
72
76
|
"types": "./spx-confirm/index.d.ts",
|
|
73
77
|
"default": "./fesm2022/softpak-components-spx-confirm.mjs"
|
|
74
78
|
},
|
|
75
|
-
"./spx-
|
|
76
|
-
"types": "./spx-
|
|
77
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
78
|
-
},
|
|
79
|
-
"./spx-form-view": {
|
|
80
|
-
"types": "./spx-form-view/index.d.ts",
|
|
81
|
-
"default": "./fesm2022/softpak-components-spx-form-view.mjs"
|
|
79
|
+
"./spx-helpers": {
|
|
80
|
+
"types": "./spx-helpers/index.d.ts",
|
|
81
|
+
"default": "./fesm2022/softpak-components-spx-helpers.mjs"
|
|
82
82
|
},
|
|
83
83
|
"./spx-form-section": {
|
|
84
84
|
"types": "./spx-form-section/index.d.ts",
|
|
85
85
|
"default": "./fesm2022/softpak-components-spx-form-section.mjs"
|
|
86
86
|
},
|
|
87
|
-
"./spx-
|
|
88
|
-
"types": "./spx-
|
|
89
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
87
|
+
"./spx-form-view": {
|
|
88
|
+
"types": "./spx-form-view/index.d.ts",
|
|
89
|
+
"default": "./fesm2022/softpak-components-spx-form-view.mjs"
|
|
90
|
+
},
|
|
91
|
+
"./spx-inputs": {
|
|
92
|
+
"types": "./spx-inputs/index.d.ts",
|
|
93
|
+
"default": "./fesm2022/softpak-components-spx-inputs.mjs"
|
|
90
94
|
},
|
|
91
95
|
"./spx-number-check": {
|
|
92
96
|
"types": "./spx-number-check/index.d.ts",
|
|
@@ -96,38 +100,34 @@
|
|
|
96
100
|
"types": "./spx-navigation/index.d.ts",
|
|
97
101
|
"default": "./fesm2022/softpak-components-spx-navigation.mjs"
|
|
98
102
|
},
|
|
99
|
-
"./spx-pagination": {
|
|
100
|
-
"types": "./spx-pagination/index.d.ts",
|
|
101
|
-
"default": "./fesm2022/softpak-components-spx-pagination.mjs"
|
|
102
|
-
},
|
|
103
|
-
"./spx-inputs": {
|
|
104
|
-
"types": "./spx-inputs/index.d.ts",
|
|
105
|
-
"default": "./fesm2022/softpak-components-spx-inputs.mjs"
|
|
106
|
-
},
|
|
107
103
|
"./spx-patch": {
|
|
108
104
|
"types": "./spx-patch/index.d.ts",
|
|
109
105
|
"default": "./fesm2022/softpak-components-spx-patch.mjs"
|
|
110
106
|
},
|
|
107
|
+
"./spx-pagination": {
|
|
108
|
+
"types": "./spx-pagination/index.d.ts",
|
|
109
|
+
"default": "./fesm2022/softpak-components-spx-pagination.mjs"
|
|
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-redux": {
|
|
116
|
-
"types": "./spx-redux/index.d.ts",
|
|
117
|
-
"default": "./fesm2022/softpak-components-spx-redux.mjs"
|
|
118
|
-
},
|
|
119
115
|
"./spx-progress-bar": {
|
|
120
116
|
"types": "./spx-progress-bar/index.d.ts",
|
|
121
117
|
"default": "./fesm2022/softpak-components-spx-progress-bar.mjs"
|
|
122
118
|
},
|
|
123
|
-
"./spx-
|
|
124
|
-
"types": "./spx-
|
|
125
|
-
"default": "./fesm2022/softpak-components-spx-
|
|
119
|
+
"./spx-redux": {
|
|
120
|
+
"types": "./spx-redux/index.d.ts",
|
|
121
|
+
"default": "./fesm2022/softpak-components-spx-redux.mjs"
|
|
126
122
|
},
|
|
127
123
|
"./spx-spinner": {
|
|
128
124
|
"types": "./spx-spinner/index.d.ts",
|
|
129
125
|
"default": "./fesm2022/softpak-components-spx-spinner.mjs"
|
|
130
126
|
},
|
|
127
|
+
"./spx-stock-info": {
|
|
128
|
+
"types": "./spx-stock-info/index.d.ts",
|
|
129
|
+
"default": "./fesm2022/softpak-components-spx-stock-info.mjs"
|
|
130
|
+
},
|
|
131
131
|
"./spx-storage": {
|
|
132
132
|
"types": "./spx-storage/index.d.ts",
|
|
133
133
|
"default": "./fesm2022/softpak-components-spx-storage.mjs"
|
|
@@ -140,14 +140,14 @@
|
|
|
140
140
|
"types": "./spx-tabs/index.d.ts",
|
|
141
141
|
"default": "./fesm2022/softpak-components-spx-tabs.mjs"
|
|
142
142
|
},
|
|
143
|
-
"./spx-toaster": {
|
|
144
|
-
"types": "./spx-toaster/index.d.ts",
|
|
145
|
-
"default": "./fesm2022/softpak-components-spx-toaster.mjs"
|
|
146
|
-
},
|
|
147
143
|
"./spx-toggle": {
|
|
148
144
|
"types": "./spx-toggle/index.d.ts",
|
|
149
145
|
"default": "./fesm2022/softpak-components-spx-toggle.mjs"
|
|
150
146
|
},
|
|
147
|
+
"./spx-toaster": {
|
|
148
|
+
"types": "./spx-toaster/index.d.ts",
|
|
149
|
+
"default": "./fesm2022/softpak-components-spx-toaster.mjs"
|
|
150
|
+
},
|
|
151
151
|
"./spx-translate": {
|
|
152
152
|
"types": "./spx-translate/index.d.ts",
|
|
153
153
|
"default": "./fesm2022/softpak-components-spx-translate.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>, initialState: SpxState<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 };
|