@panneau/form-resource 4.0.2 → 4.0.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/es/index.js +147 -126
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { FormattedMessage } from 'react-intl';
|
|
|
12
12
|
import Button from '@panneau/element-button';
|
|
13
13
|
import Form from '@panneau/element-form';
|
|
14
14
|
import { useResourceValues } from '@panneau/intl';
|
|
15
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
16
|
|
|
16
17
|
var _excluded$2 = ["resource", "action", "previous", "status", "value", "onSubmit", "errors", "generalError", "loading", "className"];
|
|
17
18
|
function DeleteForm(_ref) {
|
|
@@ -41,7 +42,7 @@ function DeleteForm(_ref) {
|
|
|
41
42
|
});
|
|
42
43
|
// const { text, background } = usePanneauColorScheme();
|
|
43
44
|
|
|
44
|
-
return /*#__PURE__*/
|
|
45
|
+
return /*#__PURE__*/jsx(Form, _objectSpread(_objectSpread({
|
|
45
46
|
className: classNames(['form', _defineProperty({
|
|
46
47
|
'invalid-feedback': generalError !== null
|
|
47
48
|
}, className, className !== null)]),
|
|
@@ -50,62 +51,70 @@ function DeleteForm(_ref) {
|
|
|
50
51
|
withoutActions: true,
|
|
51
52
|
withoutErrors: true,
|
|
52
53
|
disabled: loading
|
|
53
|
-
}, props),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
54
|
+
}, props), {}, {
|
|
55
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
56
|
+
className: classNames(['card', _defineProperty({}, className, className !== null)]),
|
|
57
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
58
|
+
className: "card-body",
|
|
59
|
+
children: [/*#__PURE__*/jsx(FormattedMessage, {
|
|
60
|
+
values: resourceValues,
|
|
61
|
+
id: "yzfiXJ",
|
|
62
|
+
defaultMessage: [{
|
|
63
|
+
"type": 0,
|
|
64
|
+
"value": "Are you sure you want to delete "
|
|
65
|
+
}, {
|
|
66
|
+
"type": 1,
|
|
67
|
+
"value": "the_singular"
|
|
68
|
+
}, {
|
|
69
|
+
"type": 0,
|
|
70
|
+
"value": " #"
|
|
71
|
+
}, {
|
|
72
|
+
"type": 1,
|
|
73
|
+
"value": "id"
|
|
74
|
+
}, {
|
|
75
|
+
"type": 0,
|
|
76
|
+
"value": "?"
|
|
77
|
+
}]
|
|
78
|
+
}), generalError ? /*#__PURE__*/jsx("p", {
|
|
79
|
+
className: "text-danger",
|
|
80
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
81
|
+
id: "y9zauY",
|
|
82
|
+
defaultMessage: [{
|
|
83
|
+
"type": 0,
|
|
84
|
+
"value": "An error occured and we could not delete this item successfully."
|
|
85
|
+
}]
|
|
86
|
+
})
|
|
87
|
+
}) : null]
|
|
88
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
89
|
+
className: "card-body d-flex",
|
|
90
|
+
children: [previous !== null ? /*#__PURE__*/jsx(Button, {
|
|
91
|
+
href: previous,
|
|
92
|
+
className: "me-2",
|
|
93
|
+
theme: "secondary",
|
|
94
|
+
outline: true,
|
|
95
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
96
|
+
id: "PyxZY2",
|
|
97
|
+
defaultMessage: [{
|
|
98
|
+
"type": 0,
|
|
99
|
+
"value": "Cancel"
|
|
100
|
+
}]
|
|
101
|
+
})
|
|
102
|
+
}) : null, /*#__PURE__*/jsx(Button, {
|
|
103
|
+
type: "submit",
|
|
104
|
+
className: "ms-auto",
|
|
105
|
+
theme: "danger",
|
|
106
|
+
disabled: loading,
|
|
107
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
108
|
+
id: "Bhu3B2",
|
|
109
|
+
defaultMessage: [{
|
|
110
|
+
"type": 0,
|
|
111
|
+
"value": "Delete"
|
|
112
|
+
}]
|
|
113
|
+
})
|
|
114
|
+
})]
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
}));
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
var _excluded$1 = ["resource", "action", "previous", "status", "value", "onSubmit", "errors", "generalError", "loading", "className"];
|
|
@@ -134,7 +143,7 @@ function DuplicateForm(_ref) {
|
|
|
134
143
|
var resourceValues = useResourceValues(resource, {
|
|
135
144
|
id: id
|
|
136
145
|
});
|
|
137
|
-
return /*#__PURE__*/
|
|
146
|
+
return /*#__PURE__*/jsx(Form, _objectSpread(_objectSpread({
|
|
138
147
|
className: classNames(['form', _defineProperty({
|
|
139
148
|
'invalid-feedback': generalError !== null
|
|
140
149
|
}, className, className !== null)]),
|
|
@@ -143,62 +152,70 @@ function DuplicateForm(_ref) {
|
|
|
143
152
|
withoutActions: true,
|
|
144
153
|
withoutErrors: true,
|
|
145
154
|
disabled: loading
|
|
146
|
-
}, props),
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
155
|
+
}, props), {}, {
|
|
156
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
157
|
+
className: classNames(['card', _defineProperty({}, className, className !== null)]),
|
|
158
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
159
|
+
className: "card-body",
|
|
160
|
+
children: [/*#__PURE__*/jsx(FormattedMessage, {
|
|
161
|
+
values: resourceValues,
|
|
162
|
+
id: "ZhnMCD",
|
|
163
|
+
defaultMessage: [{
|
|
164
|
+
"type": 0,
|
|
165
|
+
"value": "Are you sure you want to duplicate "
|
|
166
|
+
}, {
|
|
167
|
+
"type": 1,
|
|
168
|
+
"value": "the_singular"
|
|
169
|
+
}, {
|
|
170
|
+
"type": 0,
|
|
171
|
+
"value": " #"
|
|
172
|
+
}, {
|
|
173
|
+
"type": 1,
|
|
174
|
+
"value": "id"
|
|
175
|
+
}, {
|
|
176
|
+
"type": 0,
|
|
177
|
+
"value": "?"
|
|
178
|
+
}]
|
|
179
|
+
}), generalError ? /*#__PURE__*/jsx("p", {
|
|
180
|
+
className: "text-danger",
|
|
181
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
182
|
+
id: "y9zauY",
|
|
183
|
+
defaultMessage: [{
|
|
184
|
+
"type": 0,
|
|
185
|
+
"value": "An error occured and we could not delete this item successfully."
|
|
186
|
+
}]
|
|
187
|
+
})
|
|
188
|
+
}) : null]
|
|
189
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
190
|
+
className: "card-body d-flex",
|
|
191
|
+
children: [previous !== null ? /*#__PURE__*/jsx(Button, {
|
|
192
|
+
href: previous,
|
|
193
|
+
className: "me-2",
|
|
194
|
+
theme: "secondary",
|
|
195
|
+
outline: true,
|
|
196
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
197
|
+
id: "PyxZY2",
|
|
198
|
+
defaultMessage: [{
|
|
199
|
+
"type": 0,
|
|
200
|
+
"value": "Cancel"
|
|
201
|
+
}]
|
|
202
|
+
})
|
|
203
|
+
}) : null, /*#__PURE__*/jsx(Button, {
|
|
204
|
+
type: "submit",
|
|
205
|
+
className: "ms-auto",
|
|
206
|
+
theme: "warning",
|
|
207
|
+
disabled: loading,
|
|
208
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
209
|
+
id: "HzCxmr",
|
|
210
|
+
defaultMessage: [{
|
|
211
|
+
"type": 0,
|
|
212
|
+
"value": "Duplicate"
|
|
213
|
+
}]
|
|
214
|
+
})
|
|
215
|
+
})]
|
|
216
|
+
})]
|
|
217
|
+
})
|
|
218
|
+
}));
|
|
202
219
|
}
|
|
203
220
|
|
|
204
221
|
var _excluded = ["component", "header", "resource", "onSuccess", "item", "type", "isDelete", "isDuplicate", "isModal", "withContainer"];
|
|
@@ -379,7 +396,7 @@ function ResourceForm(_ref) {
|
|
|
379
396
|
useEffect(function () {
|
|
380
397
|
setValue(getInitialValue());
|
|
381
398
|
}, [getInitialValue, setValue]);
|
|
382
|
-
var element = /*#__PURE__*/
|
|
399
|
+
var element = /*#__PURE__*/jsx(FormComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
383
400
|
status: status,
|
|
384
401
|
resource: resource,
|
|
385
402
|
item: item,
|
|
@@ -393,18 +410,22 @@ function ResourceForm(_ref) {
|
|
|
393
410
|
onChange: setValue,
|
|
394
411
|
loading: loading
|
|
395
412
|
}));
|
|
396
|
-
return /*#__PURE__*/
|
|
413
|
+
return /*#__PURE__*/jsxs(FormProvider, {
|
|
397
414
|
value: value,
|
|
398
|
-
setValue: setValue
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
415
|
+
setValue: setValue,
|
|
416
|
+
children: [finalWithHeader ? header : /*#__PURE__*/jsx("div", {
|
|
417
|
+
className: "w-100 mb-3"
|
|
418
|
+
}), finalWithContainer ? /*#__PURE__*/jsx("div", {
|
|
419
|
+
className: "container-sm py-4",
|
|
420
|
+
children: /*#__PURE__*/jsx("div", {
|
|
421
|
+
className: "row justify-content-center",
|
|
422
|
+
children: /*#__PURE__*/jsx("div", {
|
|
423
|
+
className: "col-12 col-md-8 col-lg-7",
|
|
424
|
+
children: element
|
|
425
|
+
})
|
|
426
|
+
})
|
|
427
|
+
}) : element]
|
|
428
|
+
});
|
|
408
429
|
}
|
|
409
430
|
|
|
410
431
|
export { ResourceForm as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/form-resource",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Default resource forms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@panneau/element-button": "^4.0.2",
|
|
55
55
|
"@panneau/element-form": "^4.0.2",
|
|
56
56
|
"@panneau/field-fields": "^4.0.2",
|
|
57
|
-
"@panneau/intl": "^4.0.
|
|
57
|
+
"@panneau/intl": "^4.0.3",
|
|
58
58
|
"@panneau/themes": "^4.0.2",
|
|
59
59
|
"classnames": "^2.5.1",
|
|
60
60
|
"lodash-es": "^4.17.21",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "26b5ab7536b0e8c3197d40d302fc2681e7c7122e"
|
|
68
68
|
}
|