@evlop/commons 1.0.215 → 1.0.217
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,20 @@
|
|
1
1
|
export declare const SHOW_MODAL = "modal/show";
|
2
|
+
export declare const UPDATE_MODAL = "modal/update";
|
2
3
|
export declare const CLOSE_MODAL = "modal/close";
|
3
|
-
export
|
4
|
-
|
4
|
+
export interface AppModal {
|
5
|
+
id: number;
|
5
6
|
component: any;
|
6
|
-
props:
|
7
|
+
props: any;
|
8
|
+
closeable: boolean;
|
9
|
+
}
|
10
|
+
export declare const showModal: (options: Partial<AppModal>) => {
|
11
|
+
type: string;
|
12
|
+
modal: AppModal;
|
13
|
+
};
|
14
|
+
export declare const updateModal: (id: AppModal['id'], options: Partial<AppModal>) => {
|
15
|
+
type: string;
|
16
|
+
id: number;
|
17
|
+
modalUpdates: Partial<AppModal>;
|
7
18
|
};
|
8
19
|
export declare const closeModal: (id: any) => {
|
9
20
|
type: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modals.d.ts","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,eAAO,MAAM,SAAS
|
1
|
+
{"version":3,"file":"modals.d.ts","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;CACtB;AAGD,eAAO,MAAM,SAAS,YAAa,QAAQ,QAAQ,CAAC;;;CAiBnD,CAAC;AAEF,eAAO,MAAM,WAAW,OAAQ,QAAQ,CAAC,IAAI,CAAC,WAAW,QAAQ,QAAQ,CAAC;;;;CAMzE,CAAA;AAED,eAAO,MAAM,UAAU;;;CAGrB,CAAC;;AAIH,wBAcC"}
|
@@ -1,15 +1,36 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.closeModal = exports.showModal = exports.CLOSE_MODAL = exports.SHOW_MODAL = void 0;
|
3
|
+
exports.closeModal = exports.updateModal = exports.showModal = exports.CLOSE_MODAL = exports.UPDATE_MODAL = exports.SHOW_MODAL = void 0;
|
4
4
|
const lodash_1 = require("lodash");
|
5
5
|
exports.SHOW_MODAL = 'modal/show';
|
6
|
+
exports.UPDATE_MODAL = 'modal/update';
|
6
7
|
exports.CLOSE_MODAL = 'modal/close';
|
7
|
-
const showModal = (component, props = {})
|
8
|
-
|
9
|
-
component,
|
10
|
-
|
11
|
-
|
8
|
+
// export const showModal = (component, props = {})=>({
|
9
|
+
const showModal = (options) => {
|
10
|
+
const { id = lodash_1.random(Number.MAX_SAFE_INTEGER), component, props = {}, closeable = true } = options;
|
11
|
+
if (!component) {
|
12
|
+
throw new Error('Modal component is required');
|
13
|
+
}
|
14
|
+
const modal = {
|
15
|
+
id,
|
16
|
+
component,
|
17
|
+
props,
|
18
|
+
closeable,
|
19
|
+
};
|
20
|
+
return {
|
21
|
+
type: exports.SHOW_MODAL,
|
22
|
+
modal,
|
23
|
+
};
|
24
|
+
};
|
12
25
|
exports.showModal = showModal;
|
26
|
+
const updateModal = (id, options) => {
|
27
|
+
return {
|
28
|
+
type: exports.UPDATE_MODAL,
|
29
|
+
id,
|
30
|
+
modalUpdates: options,
|
31
|
+
};
|
32
|
+
};
|
33
|
+
exports.updateModal = updateModal;
|
13
34
|
const closeModal = (id) => ({
|
14
35
|
type: exports.CLOSE_MODAL,
|
15
36
|
id,
|
@@ -20,13 +41,11 @@ exports.default = (state = initialState, action) => {
|
|
20
41
|
switch (action.type) {
|
21
42
|
case exports.SHOW_MODAL:
|
22
43
|
return [
|
23
|
-
...state,
|
24
|
-
|
25
|
-
id: lodash_1.random(Number.MAX_SAFE_INTEGER),
|
26
|
-
component: action.component,
|
27
|
-
props: action.props,
|
28
|
-
}
|
44
|
+
...state.filter(m => m.id !== action.modal.id),
|
45
|
+
action.modal,
|
29
46
|
];
|
47
|
+
case exports.UPDATE_MODAL:
|
48
|
+
return state.map(m => m.id === action.id ? Object.assign(Object.assign({}, m), action.modalUpdates) : m);
|
30
49
|
case exports.CLOSE_MODAL:
|
31
50
|
return state.filter(m => m.id !== action.id);
|
32
51
|
default:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modals.js","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"modals.js","sourceRoot":"","sources":["../../../src/reducers/modals.tsx"],"names":[],"mappings":";;;AAAA,mCAAwC;AAE3B,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,WAAW,GAAG,aAAa,CAAC;AASzC,uDAAuD;AAChD,MAAM,SAAS,GAAG,CAAC,OAA0B,EAAC,EAAE;IACnD,MAAM,EAAC,EAAE,GAAG,eAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,EAAE,SAAS,GAAG,IAAI,EAAC,GAAG,OAAO,CAAC;IAEhG,IAAI,CAAC,SAAS,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;KAClD;IAED,MAAM,KAAK,GAAa;QACpB,EAAE;QACF,SAAS;QACT,KAAK;QACL,SAAS;KACZ,CAAC;IACF,OAAO;QACH,IAAI,EAAE,kBAAU;QAChB,KAAK;KACR,CAAA;AACL,CAAC,CAAC;AAjBW,QAAA,SAAS,aAiBpB;AAEK,MAAM,WAAW,GAAG,CAAC,EAAkB,EAAE,OAA0B,EAAC,EAAE;IACzE,OAAO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