@zauru-sdk/redux 6.0.0 → 6.3.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.
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearFormErrors = exports.clearFieldError = exports.setFieldError = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialState = {
|
|
7
|
+
formValidations: {},
|
|
8
|
+
};
|
|
9
|
+
const formValidationSlice = (0, toolkit_1.createSlice)({
|
|
10
|
+
name: "formValidation",
|
|
11
|
+
initialState,
|
|
12
|
+
reducers: {
|
|
13
|
+
setFieldError: (state, action) => {
|
|
14
|
+
if (!state.formValidations[action.payload.formName]) {
|
|
15
|
+
state.formValidations[action.payload.formName] = {};
|
|
16
|
+
}
|
|
17
|
+
state.formValidations[action.payload.formName][action.payload.name] =
|
|
18
|
+
action.payload.error;
|
|
19
|
+
},
|
|
20
|
+
clearFieldError: (state, action) => {
|
|
21
|
+
delete state.formValidations[action.payload.formName]?.[action.payload.name];
|
|
22
|
+
},
|
|
23
|
+
clearFormErrors: (state, action) => {
|
|
24
|
+
delete state.formValidations[action.payload.formName];
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
_a = formValidationSlice.actions, exports.setFieldError = _a.setFieldError, exports.clearFieldError = _a.clearFieldError, exports.clearFormErrors = _a.clearFormErrors;
|
|
29
|
+
exports.default = formValidationSlice.reducer;
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./agency.slice.js"), exports);
|
|
18
18
|
__exportStar(require("./automaticNumbers.slice.js"), exports);
|
|
19
19
|
__exportStar(require("./catalogs.slice.js"), exports);
|
|
20
|
+
__exportStar(require("./formValidation.slice.js"), exports);
|
|
20
21
|
__exportStar(require("./formsSavedData.slice.js"), exports);
|
|
21
22
|
__exportStar(require("./profile.slice.js"), exports);
|
|
22
23
|
__exportStar(require("./reception.slice.js"), exports);
|
package/dist/esm/store.js
CHANGED
|
@@ -15,6 +15,7 @@ const templates_slice_js_1 = __importDefault(require("./slices/templates.slice.j
|
|
|
15
15
|
const automaticNumbers_slice_js_1 = __importDefault(require("./slices/automaticNumbers.slice.js"));
|
|
16
16
|
const tables_slice_js_1 = __importDefault(require("./slices/tables.slice.js"));
|
|
17
17
|
const formsSavedData_slice_js_1 = __importDefault(require("./slices/formsSavedData.slice.js"));
|
|
18
|
+
const formValidation_slice_js_1 = __importDefault(require("./slices/formValidation.slice.js"));
|
|
18
19
|
/**
|
|
19
20
|
* Full Redux snapshot key in `localStorage`. Written by
|
|
20
21
|
* `persistanceLocalStorageMiddleware` after every action.
|
|
@@ -68,6 +69,7 @@ const buildSliceInitialStates = () => ({
|
|
|
68
69
|
automaticNumbers: (0, automaticNumbers_slice_js_1.default)(undefined, { type: "@@INIT" }),
|
|
69
70
|
tables: (0, tables_slice_js_1.default)(undefined, { type: "@@INIT" }),
|
|
70
71
|
formSavedData: (0, formsSavedData_slice_js_1.default)(undefined, { type: "@@INIT" }),
|
|
72
|
+
formValidation: (0, formValidation_slice_js_1.default)(undefined, { type: "@@INIT" }),
|
|
71
73
|
});
|
|
72
74
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
73
75
|
const preloadedState = (() => {
|
|
@@ -183,6 +185,7 @@ exports.store = (0, toolkit_1.configureStore)({
|
|
|
183
185
|
automaticNumbers: automaticNumbers_slice_js_1.default,
|
|
184
186
|
tables: tables_slice_js_1.default,
|
|
185
187
|
formSavedData: formsSavedData_slice_js_1.default,
|
|
188
|
+
formValidation: formValidation_slice_js_1.default,
|
|
186
189
|
},
|
|
187
190
|
preloadedState,
|
|
188
191
|
middleware: (getDefaultMiddleware) => new toolkit_1.Tuple(persistanceLocalStorageMiddleware),
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type FormValidations = {
|
|
2
|
+
formValidations: {
|
|
3
|
+
[key: string]: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare const setFieldError: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
+
formName: string;
|
|
10
|
+
name: string;
|
|
11
|
+
error: string;
|
|
12
|
+
}, "formValidation/setFieldError">, clearFieldError: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
|
+
formName: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}, "formValidation/clearFieldError">, clearFormErrors: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
16
|
+
formName: string;
|
|
17
|
+
}, "formValidation/clearFormErrors">;
|
|
18
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<FormValidations>;
|
|
19
|
+
export default _default;
|
package/dist/slices/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./agency.slice.js";
|
|
2
2
|
export * from "./automaticNumbers.slice.js";
|
|
3
3
|
export * from "./catalogs.slice.js";
|
|
4
|
+
export * from "./formValidation.slice.js";
|
|
4
5
|
export * from "./formsSavedData.slice.js";
|
|
5
6
|
export * from "./profile.slice.js";
|
|
6
7
|
export * from "./reception.slice.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/redux",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Estructura de Redux propuesta para el desarrollo de webapps en Zauru.",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@reduxjs/toolkit": "^2.2.1",
|
|
29
|
-
"@zauru-sdk/types": "^6.
|
|
29
|
+
"@zauru-sdk/types": "^6.3.0",
|
|
30
30
|
"react": "^18.2.0",
|
|
31
31
|
"react-dom": "^18.2.0",
|
|
32
32
|
"react-redux": "^9.1.0",
|
|
33
33
|
"react-select": "^5.8.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "a6e4e5f9cdbe1a3ae8043f7769a08dc273d62215"
|
|
36
36
|
}
|