@panneau/action-duplicate 3.0.308 → 4.0.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.
- package/es/index.js +37 -60
- package/package.json +7 -7
package/es/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import { postJSON, getCSRFHeaders } from '@folklore/fetch';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
6
|
import React, { useState, useCallback } from 'react';
|
|
8
7
|
import { FormattedMessage } from 'react-intl';
|
|
9
8
|
import { useModalsComponentsManager } from '@panneau/core/contexts';
|
|
@@ -11,66 +10,46 @@ import { useActionProps } from '@panneau/core/hooks';
|
|
|
11
10
|
import Button from '@panneau/element-button';
|
|
12
11
|
|
|
13
12
|
var _excluded = ["id", "title", "description", "endpoint", "action", "label", "icon", "value", "theme", "disabled", "onChange", "onConfirmed", "valueLabelPath", "modalComponent", "withConfirmation", "className"];
|
|
14
|
-
|
|
15
|
-
id
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
function DuplicateAction(_ref) {
|
|
14
|
+
var id = _ref.id,
|
|
15
|
+
_ref$title = _ref.title,
|
|
16
|
+
title = _ref$title === void 0 ? null : _ref$title,
|
|
17
|
+
_ref$description = _ref.description,
|
|
18
|
+
description = _ref$description === void 0 ? null : _ref$description,
|
|
19
|
+
_ref$endpoint = _ref.endpoint,
|
|
20
|
+
endpoint = _ref$endpoint === void 0 ? '/duplicate' : _ref$endpoint,
|
|
21
|
+
_ref$action = _ref.action,
|
|
22
|
+
action = _ref$action === void 0 ? null : _ref$action,
|
|
23
|
+
_ref$label = _ref.label,
|
|
24
|
+
initialLabel = _ref$label === void 0 ? null : _ref$label,
|
|
25
|
+
_ref$icon = _ref.icon,
|
|
26
|
+
icon = _ref$icon === void 0 ? 'copy' : _ref$icon,
|
|
27
|
+
_ref$value = _ref.value,
|
|
28
|
+
value = _ref$value === void 0 ? null : _ref$value,
|
|
29
|
+
_ref$theme = _ref.theme,
|
|
30
|
+
theme = _ref$theme === void 0 ? 'secondary' : _ref$theme,
|
|
31
|
+
_ref$disabled = _ref.disabled,
|
|
32
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
33
|
+
_ref$onChange = _ref.onChange,
|
|
34
|
+
onChange = _ref$onChange === void 0 ? null : _ref$onChange,
|
|
35
|
+
_ref$onConfirmed = _ref.onConfirmed,
|
|
36
|
+
onConfirmed = _ref$onConfirmed === void 0 ? null : _ref$onConfirmed,
|
|
37
|
+
_ref$valueLabelPath = _ref.valueLabelPath,
|
|
38
|
+
valueLabelPath = _ref$valueLabelPath === void 0 ? null : _ref$valueLabelPath,
|
|
39
|
+
_ref$modalComponent = _ref.modalComponent,
|
|
40
|
+
modalComponent = _ref$modalComponent === void 0 ? 'confirm' : _ref$modalComponent,
|
|
41
|
+
_ref$withConfirmation = _ref.withConfirmation,
|
|
42
|
+
withConfirmation = _ref$withConfirmation === void 0 ? false : _ref$withConfirmation,
|
|
43
|
+
_ref$className = _ref.className,
|
|
44
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
45
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
var label = initialLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
39
47
|
id: "HzCxmr",
|
|
40
48
|
defaultMessage: [{
|
|
41
49
|
"type": 0,
|
|
42
50
|
"value": "Duplicate"
|
|
43
51
|
}]
|
|
44
|
-
})
|
|
45
|
-
icon: 'copy',
|
|
46
|
-
value: null,
|
|
47
|
-
theme: 'secondary',
|
|
48
|
-
disabled: false,
|
|
49
|
-
onChange: null,
|
|
50
|
-
onConfirmed: null,
|
|
51
|
-
valueLabelPath: null,
|
|
52
|
-
modalComponent: 'confirm',
|
|
53
|
-
withConfirmation: false,
|
|
54
|
-
className: null
|
|
55
|
-
};
|
|
56
|
-
var DuplicateAction = function DuplicateAction(_ref) {
|
|
57
|
-
var id = _ref.id,
|
|
58
|
-
title = _ref.title,
|
|
59
|
-
description = _ref.description,
|
|
60
|
-
endpoint = _ref.endpoint,
|
|
61
|
-
action = _ref.action,
|
|
62
|
-
label = _ref.label,
|
|
63
|
-
icon = _ref.icon,
|
|
64
|
-
value = _ref.value,
|
|
65
|
-
theme = _ref.theme,
|
|
66
|
-
disabled = _ref.disabled,
|
|
67
|
-
onChange = _ref.onChange,
|
|
68
|
-
onConfirmed = _ref.onConfirmed,
|
|
69
|
-
valueLabelPath = _ref.valueLabelPath,
|
|
70
|
-
modalComponent = _ref.modalComponent,
|
|
71
|
-
withConfirmation = _ref.withConfirmation,
|
|
72
|
-
className = _ref.className,
|
|
73
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
52
|
+
});
|
|
74
53
|
var ModalComponents = useModalsComponentsManager();
|
|
75
54
|
var ModalComponent = ModalComponents.getComponent(modalComponent);
|
|
76
55
|
var _useState = useState(false),
|
|
@@ -108,7 +87,7 @@ var DuplicateAction = function DuplicateAction(_ref) {
|
|
|
108
87
|
})["catch"](function (err) {
|
|
109
88
|
setError(err);
|
|
110
89
|
});
|
|
111
|
-
}, [ids, endpoint, action, onChange, onClose, setError]);
|
|
90
|
+
}, [ids, endpoint, action, onChange, onClose, setError, onConfirmed]);
|
|
112
91
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
113
92
|
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
114
93
|
label: label,
|
|
@@ -168,8 +147,6 @@ var DuplicateAction = function DuplicateAction(_ref) {
|
|
|
168
147
|
"value": "An error has occured."
|
|
169
148
|
}]
|
|
170
149
|
}) : null) : null);
|
|
171
|
-
}
|
|
172
|
-
DuplicateAction.propTypes = propTypes;
|
|
173
|
-
DuplicateAction.defaultProps = defaultProps;
|
|
150
|
+
}
|
|
174
151
|
|
|
175
152
|
export { DuplicateAction as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/action-duplicate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Duplicate action",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.12.5",
|
|
52
|
-
"@folklore/fetch": "^0.1.
|
|
53
|
-
"@panneau/core": "^
|
|
54
|
-
"@panneau/element-button": "^
|
|
55
|
-
"@panneau/themes": "^
|
|
52
|
+
"@folklore/fetch": "^0.1.21",
|
|
53
|
+
"@panneau/core": "^4.0.0",
|
|
54
|
+
"@panneau/element-button": "^4.0.0",
|
|
55
|
+
"@panneau/themes": "^4.0.0",
|
|
56
56
|
"classnames": "^2.5.1",
|
|
57
57
|
"prop-types": "^15.7.2",
|
|
58
|
-
"react-intl": "^5.15.8
|
|
58
|
+
"react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "2cca874e0388b4a20c39aadb205c0e67d5a946fc"
|
|
64
64
|
}
|