@panneau/modal-resource-form 4.0.39 → 4.0.40-alpha.3
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.
- package/dist/index.d.ts +8 -9
- package/dist/index.js +103 -44
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Resource } from '@panneau/core';
|
|
2
|
+
import { Resource, Item } from '@panneau/core';
|
|
3
3
|
|
|
4
4
|
interface ModalResourceFormProps {
|
|
5
|
-
id
|
|
6
|
-
resource?: Resource | null;
|
|
5
|
+
id?: string;
|
|
6
|
+
resource?: Resource | string | null;
|
|
7
7
|
type?: string | null;
|
|
8
|
-
item?:
|
|
9
|
-
id?: string;
|
|
10
|
-
} | null;
|
|
8
|
+
item?: Item | null;
|
|
11
9
|
isCreate?: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
withoutCloseOnComplete?: boolean;
|
|
11
|
+
onComplete?: ((value: Item) => void) | null;
|
|
12
|
+
onClosed?: (() => void) | null;
|
|
14
13
|
className?: string | null;
|
|
15
14
|
}
|
|
16
|
-
declare function ModalResourceForm({ id, resource, type, item, isCreate,
|
|
15
|
+
declare function ModalResourceForm({ id, resource: providedResource, type, item, isCreate, onComplete, onClosed, withoutCloseOnComplete, className, }: ModalResourceFormProps): react_jsx_runtime.JSX.Element;
|
|
17
16
|
|
|
18
17
|
export { ModalResourceForm as default };
|
package/dist/index.js
CHANGED
|
@@ -1,60 +1,119 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
1
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { usePanneauResource } from '@panneau/core/contexts';
|
|
2
5
|
import ResourceForm from '@panneau/form-resource';
|
|
3
6
|
import { useResourceValues } from '@panneau/intl';
|
|
4
7
|
import Dialog from '@panneau/modal-dialog';
|
|
5
8
|
import { jsx } from 'react/jsx-runtime';
|
|
6
9
|
|
|
7
|
-
function ModalResourceForm(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
function ModalResourceForm(t0) {
|
|
11
|
+
const $ = c(19);
|
|
12
|
+
const {
|
|
13
|
+
id,
|
|
14
|
+
resource: t1,
|
|
15
|
+
type: t2,
|
|
16
|
+
item: t3,
|
|
17
|
+
isCreate: t4,
|
|
18
|
+
onComplete: t5,
|
|
19
|
+
onClosed: t6,
|
|
20
|
+
withoutCloseOnComplete: t7,
|
|
21
|
+
className: t8
|
|
22
|
+
} = t0;
|
|
23
|
+
const providedResource = t1 === undefined ? null : t1;
|
|
24
|
+
const type = t2 === undefined ? null : t2;
|
|
25
|
+
const item = t3 === undefined ? null : t3;
|
|
26
|
+
const isCreate = t4 === undefined ? false : t4;
|
|
27
|
+
const onComplete = t5 === undefined ? null : t5;
|
|
28
|
+
const onClosed = t6 === undefined ? null : t6;
|
|
29
|
+
const withoutCloseOnComplete = t7 === undefined ? false : t7;
|
|
30
|
+
const className = t8 === undefined ? null : t8;
|
|
31
|
+
const [opened, setOpened] = useState(true);
|
|
32
|
+
let t9;
|
|
33
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
34
|
+
t9 = () => {
|
|
35
|
+
setOpened(false);
|
|
36
|
+
};
|
|
37
|
+
$[0] = t9;
|
|
38
|
+
} else {
|
|
39
|
+
t9 = $[0];
|
|
40
|
+
}
|
|
41
|
+
const requestClose = t9;
|
|
42
|
+
const resource = usePanneauResource(providedResource);
|
|
43
|
+
const resourceValues = useResourceValues(resource);
|
|
44
|
+
let t10;
|
|
45
|
+
if ($[1] !== onComplete || $[2] !== withoutCloseOnComplete) {
|
|
46
|
+
t10 = value => {
|
|
47
|
+
if (onComplete !== null) {
|
|
48
|
+
onComplete(value);
|
|
49
|
+
}
|
|
50
|
+
if (!withoutCloseOnComplete) {
|
|
51
|
+
setOpened(false);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
$[1] = onComplete;
|
|
55
|
+
$[2] = withoutCloseOnComplete;
|
|
56
|
+
$[3] = t10;
|
|
57
|
+
} else {
|
|
58
|
+
t10 = $[3];
|
|
59
|
+
}
|
|
60
|
+
const onFormComplete = t10;
|
|
61
|
+
const t11 = id || `resource-form-modal-${resource?.id}`;
|
|
62
|
+
let t12;
|
|
63
|
+
if ($[4] !== isCreate || $[5] !== resourceValues) {
|
|
64
|
+
t12 = !isCreate ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
28
65
|
id: "mCfzkJ",
|
|
29
|
-
|
|
30
|
-
"type": 0,
|
|
31
|
-
"value": "Edit "
|
|
32
|
-
}, {
|
|
33
|
-
"type": 1,
|
|
34
|
-
"value": "a_singular"
|
|
35
|
-
}]
|
|
66
|
+
values: resourceValues
|
|
36
67
|
}) : /*#__PURE__*/jsx(FormattedMessage, {
|
|
37
|
-
values: resourceValues,
|
|
38
68
|
id: "6viUpq",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children: /*#__PURE__*/jsx(ResourceForm, {
|
|
69
|
+
values: resourceValues
|
|
70
|
+
});
|
|
71
|
+
$[4] = isCreate;
|
|
72
|
+
$[5] = resourceValues;
|
|
73
|
+
$[6] = t12;
|
|
74
|
+
} else {
|
|
75
|
+
t12 = $[6];
|
|
76
|
+
}
|
|
77
|
+
let t13;
|
|
78
|
+
if ($[7] !== item || $[8] !== onFormComplete || $[9] !== resource || $[10] !== type) {
|
|
79
|
+
t13 = /*#__PURE__*/jsx(ResourceForm, {
|
|
51
80
|
resource: resource,
|
|
52
81
|
type: type,
|
|
53
82
|
item: item,
|
|
54
|
-
|
|
83
|
+
onComplete: onFormComplete,
|
|
55
84
|
isModal: true
|
|
56
|
-
})
|
|
57
|
-
|
|
85
|
+
});
|
|
86
|
+
$[7] = item;
|
|
87
|
+
$[8] = onFormComplete;
|
|
88
|
+
$[9] = resource;
|
|
89
|
+
$[10] = type;
|
|
90
|
+
$[11] = t13;
|
|
91
|
+
} else {
|
|
92
|
+
t13 = $[11];
|
|
93
|
+
}
|
|
94
|
+
let t14;
|
|
95
|
+
if ($[12] !== className || $[13] !== onClosed || $[14] !== opened || $[15] !== t11 || $[16] !== t12 || $[17] !== t13) {
|
|
96
|
+
t14 = /*#__PURE__*/jsx(Dialog, {
|
|
97
|
+
id: t11,
|
|
98
|
+
title: t12,
|
|
99
|
+
size: "lg",
|
|
100
|
+
visible: opened,
|
|
101
|
+
requestClose: requestClose,
|
|
102
|
+
onClosed: onClosed,
|
|
103
|
+
className: className,
|
|
104
|
+
children: t13
|
|
105
|
+
});
|
|
106
|
+
$[12] = className;
|
|
107
|
+
$[13] = onClosed;
|
|
108
|
+
$[14] = opened;
|
|
109
|
+
$[15] = t11;
|
|
110
|
+
$[16] = t12;
|
|
111
|
+
$[17] = t13;
|
|
112
|
+
$[18] = t14;
|
|
113
|
+
} else {
|
|
114
|
+
t14 = $[18];
|
|
115
|
+
}
|
|
116
|
+
return t14;
|
|
58
117
|
}
|
|
59
118
|
|
|
60
119
|
export { ModalResourceForm as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/modal-resource-form",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.40-alpha.3",
|
|
4
4
|
"description": "Resource form modal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.28.6",
|
|
55
|
-
"@panneau/core": "^4.0.
|
|
56
|
-
"@panneau/form-resource": "^4.0.
|
|
57
|
-
"@panneau/intl": "^4.0.
|
|
58
|
-
"@panneau/modal-dialog": "^4.0.
|
|
59
|
-
"@panneau/themes": "^4.0.
|
|
55
|
+
"@panneau/core": "^4.0.40-alpha.3",
|
|
56
|
+
"@panneau/form-resource": "^4.0.40-alpha.3",
|
|
57
|
+
"@panneau/intl": "^4.0.40-alpha.3",
|
|
58
|
+
"@panneau/modal-dialog": "^4.0.40-alpha.3",
|
|
59
|
+
"@panneau/themes": "^4.0.40-alpha.3",
|
|
60
60
|
"classnames": "^2.5.1",
|
|
61
61
|
"lodash": "^4.17.21",
|
|
62
62
|
"react-intl": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0"
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "1735964a2702ae0480b642225286e4184f36680d"
|
|
68
68
|
}
|