@panneau/action-duplicate 4.0.2 → 4.0.5
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 +61 -54
- package/package.json +5 -5
package/es/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
1
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import { useState, useCallback } from 'react';
|
|
4
6
|
import { postJSON, getCSRFHeaders } from '@folklore/fetch';
|
|
5
7
|
import classNames from 'classnames';
|
|
6
|
-
import { useState, useCallback } from 'react';
|
|
7
8
|
import { FormattedMessage } from 'react-intl';
|
|
8
9
|
import { useModalsComponentsManager } from '@panneau/core/contexts';
|
|
9
10
|
import { useActionProps } from '@panneau/core/hooks';
|
|
10
11
|
import Button from '@panneau/element-button';
|
|
12
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
13
|
|
|
12
14
|
var _excluded = ["id", "title", "description", "endpoint", "action", "label", "icon", "value", "theme", "disabled", "onChange", "onConfirmed", "valueLabelPath", "modalComponent", "withConfirmation", "className"];
|
|
13
15
|
function DuplicateAction(_ref) {
|
|
@@ -43,7 +45,7 @@ function DuplicateAction(_ref) {
|
|
|
43
45
|
_ref$className = _ref.className,
|
|
44
46
|
className = _ref$className === void 0 ? null : _ref$className,
|
|
45
47
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
var label = initialLabel || /*#__PURE__*/
|
|
48
|
+
var label = initialLabel || /*#__PURE__*/jsx(FormattedMessage, {
|
|
47
49
|
id: "HzCxmr",
|
|
48
50
|
defaultMessage: [{
|
|
49
51
|
"type": 0,
|
|
@@ -88,65 +90,70 @@ function DuplicateAction(_ref) {
|
|
|
88
90
|
setError(err);
|
|
89
91
|
});
|
|
90
92
|
}, [ids, endpoint, action, onChange, onClose, setError, onConfirmed]);
|
|
91
|
-
return /*#__PURE__*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"type": 0,
|
|
104
|
-
"value": "Duplicate"
|
|
105
|
-
}]
|
|
106
|
-
}),
|
|
107
|
-
onConfirm: onConfirm,
|
|
108
|
-
onClose: onClose,
|
|
109
|
-
confirmButton: {
|
|
110
|
-
label: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
111
|
-
id: "UaVu03",
|
|
93
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
94
|
+
children: [/*#__PURE__*/jsx(Button, _objectSpread({
|
|
95
|
+
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
96
|
+
label: label,
|
|
97
|
+
icon: icon,
|
|
98
|
+
onClick: withConfirmation ? onOpen : null,
|
|
99
|
+
disabled: disabled,
|
|
100
|
+
theme: disabled ? 'secondary' : theme
|
|
101
|
+
}, props)), modalOpen ? /*#__PURE__*/jsxs(ModalComponent, {
|
|
102
|
+
id: modalKey,
|
|
103
|
+
title: title || /*#__PURE__*/jsx(FormattedMessage, {
|
|
104
|
+
id: "8T+JE7",
|
|
112
105
|
defaultMessage: [{
|
|
113
106
|
"type": 0,
|
|
114
|
-
"value": "
|
|
107
|
+
"value": "Duplicate"
|
|
115
108
|
}]
|
|
116
109
|
}),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
110
|
+
onConfirm: onConfirm,
|
|
111
|
+
onClose: onClose,
|
|
112
|
+
confirmButton: {
|
|
113
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
114
|
+
id: "UaVu03",
|
|
115
|
+
defaultMessage: [{
|
|
116
|
+
"type": 0,
|
|
117
|
+
"value": "Confirm"
|
|
118
|
+
}]
|
|
119
|
+
}),
|
|
120
|
+
theme: 'danger'
|
|
121
|
+
},
|
|
122
|
+
cancelButton: {
|
|
123
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
124
|
+
id: "PyxZY2",
|
|
125
|
+
defaultMessage: [{
|
|
126
|
+
"type": 0,
|
|
127
|
+
"value": "Cancel"
|
|
128
|
+
}]
|
|
129
|
+
})
|
|
130
|
+
},
|
|
131
|
+
children: [description !== null ? description : /*#__PURE__*/jsx("p", {
|
|
132
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
133
|
+
id: "XmY7D8",
|
|
134
|
+
defaultMessage: [{
|
|
135
|
+
"type": 0,
|
|
136
|
+
"value": "The following items will be duplicated: "
|
|
137
|
+
}, {
|
|
138
|
+
"type": 1,
|
|
139
|
+
"value": "ids"
|
|
140
|
+
}, {
|
|
141
|
+
"type": 0,
|
|
142
|
+
"value": ". Are you sure you want to continue?"
|
|
143
|
+
}],
|
|
144
|
+
values: {
|
|
145
|
+
ids: idLabels
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
}), error !== null ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
149
|
+
id: "cutyQH",
|
|
122
150
|
defaultMessage: [{
|
|
123
151
|
"type": 0,
|
|
124
|
-
"value": "
|
|
152
|
+
"value": "An error has occured."
|
|
125
153
|
}]
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
id: "XmY7D8",
|
|
130
|
-
defaultMessage: [{
|
|
131
|
-
"type": 0,
|
|
132
|
-
"value": "The following items will be duplicated: "
|
|
133
|
-
}, {
|
|
134
|
-
"type": 1,
|
|
135
|
-
"value": "ids"
|
|
136
|
-
}, {
|
|
137
|
-
"type": 0,
|
|
138
|
-
"value": ". Are you sure you want to continue?"
|
|
139
|
-
}],
|
|
140
|
-
values: {
|
|
141
|
-
ids: idLabels
|
|
142
|
-
}
|
|
143
|
-
})), error !== null ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
144
|
-
id: "cutyQH",
|
|
145
|
-
defaultMessage: [{
|
|
146
|
-
"type": 0,
|
|
147
|
-
"value": "An error has occured."
|
|
148
|
-
}]
|
|
149
|
-
}) : null) : null);
|
|
154
|
+
}) : null]
|
|
155
|
+
}) : null]
|
|
156
|
+
});
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
export { DuplicateAction as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/action-duplicate",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "Duplicate action",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.12.5",
|
|
52
52
|
"@folklore/fetch": "^0.1.21",
|
|
53
|
-
"@panneau/core": "^4.0.
|
|
54
|
-
"@panneau/element-button": "^4.0.
|
|
55
|
-
"@panneau/themes": "^4.0.
|
|
53
|
+
"@panneau/core": "^4.0.5",
|
|
54
|
+
"@panneau/element-button": "^4.0.5",
|
|
55
|
+
"@panneau/themes": "^4.0.5",
|
|
56
56
|
"classnames": "^2.5.1",
|
|
57
57
|
"prop-types": "^15.7.2",
|
|
58
58
|
"react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "ac8b065e8c7ada1d176d15eff1c0fa53599ad31f"
|
|
64
64
|
}
|