@panneau/action-duplicate 4.0.38 → 4.0.40-alpha.1
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.js +215 -117
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,159 +1,257 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
5
2
|
import { postJSON, getCSRFHeaders } from '@folklore/fetch';
|
|
6
|
-
import
|
|
7
|
-
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useState } from 'react';
|
|
8
4
|
import { FormattedMessage } from 'react-intl';
|
|
9
|
-
import { useActionProps } from '@panneau/action-actions';
|
|
10
5
|
import { useModalsComponentsManager } from '@panneau/core/contexts';
|
|
11
6
|
import Button from '@panneau/element-button';
|
|
12
|
-
import { jsxs, Fragment
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
9
|
+
function DuplicateAction(t0) {
|
|
10
|
+
const $ = c(51);
|
|
11
|
+
let id;
|
|
12
|
+
let props;
|
|
13
|
+
let t1;
|
|
14
|
+
let t10;
|
|
15
|
+
let t11;
|
|
16
|
+
let t12;
|
|
17
|
+
let t13;
|
|
18
|
+
let t14;
|
|
19
|
+
let t15;
|
|
20
|
+
let t2;
|
|
21
|
+
let t3;
|
|
22
|
+
let t4;
|
|
23
|
+
let t5;
|
|
24
|
+
let t6;
|
|
25
|
+
let t7;
|
|
26
|
+
let t8;
|
|
27
|
+
let t9;
|
|
28
|
+
if ($[0] !== t0) {
|
|
29
|
+
({
|
|
30
|
+
id,
|
|
31
|
+
title: t1,
|
|
32
|
+
description: t2,
|
|
33
|
+
endpoint: t3,
|
|
34
|
+
action: t4,
|
|
35
|
+
label: t5,
|
|
36
|
+
icon: t6,
|
|
37
|
+
value: t7,
|
|
38
|
+
theme: t8,
|
|
39
|
+
disabled: t9,
|
|
40
|
+
onChange: t10,
|
|
41
|
+
onConfirmed: t11,
|
|
42
|
+
valueLabelPath: t12,
|
|
43
|
+
modalComponent: t13,
|
|
44
|
+
withConfirmation: t14,
|
|
45
|
+
className: t15,
|
|
46
|
+
...props
|
|
47
|
+
} = t0);
|
|
48
|
+
$[0] = t0;
|
|
49
|
+
$[1] = id;
|
|
50
|
+
$[2] = props;
|
|
51
|
+
$[3] = t1;
|
|
52
|
+
$[4] = t10;
|
|
53
|
+
$[5] = t11;
|
|
54
|
+
$[6] = t12;
|
|
55
|
+
$[7] = t13;
|
|
56
|
+
$[8] = t14;
|
|
57
|
+
$[9] = t15;
|
|
58
|
+
$[10] = t2;
|
|
59
|
+
$[11] = t3;
|
|
60
|
+
$[12] = t4;
|
|
61
|
+
$[13] = t5;
|
|
62
|
+
$[14] = t6;
|
|
63
|
+
$[15] = t7;
|
|
64
|
+
$[16] = t8;
|
|
65
|
+
$[17] = t9;
|
|
66
|
+
} else {
|
|
67
|
+
id = $[1];
|
|
68
|
+
props = $[2];
|
|
69
|
+
t1 = $[3];
|
|
70
|
+
t10 = $[4];
|
|
71
|
+
t11 = $[5];
|
|
72
|
+
t12 = $[6];
|
|
73
|
+
t13 = $[7];
|
|
74
|
+
t14 = $[8];
|
|
75
|
+
t15 = $[9];
|
|
76
|
+
t2 = $[10];
|
|
77
|
+
t3 = $[11];
|
|
78
|
+
t4 = $[12];
|
|
79
|
+
t5 = $[13];
|
|
80
|
+
t6 = $[14];
|
|
81
|
+
t7 = $[15];
|
|
82
|
+
t8 = $[16];
|
|
83
|
+
t9 = $[17];
|
|
84
|
+
}
|
|
85
|
+
const title = t1 === undefined ? null : t1;
|
|
86
|
+
const description = t2 === undefined ? null : t2;
|
|
87
|
+
const endpoint = t3 === undefined ? "/duplicate" : t3;
|
|
88
|
+
const action = t4 === undefined ? null : t4;
|
|
89
|
+
const initialLabel = t5 === undefined ? null : t5;
|
|
90
|
+
const icon = t6 === undefined ? "copy" : t6;
|
|
91
|
+
const value = t7 === undefined ? null : t7;
|
|
92
|
+
const theme = t8 === undefined ? "secondary" : t8;
|
|
93
|
+
const disabled = t9 === undefined ? false : t9;
|
|
94
|
+
const onChange = t10 === undefined ? null : t10;
|
|
95
|
+
const onConfirmed = t11 === undefined ? null : t11;
|
|
96
|
+
const valueLabelPath = t12 === undefined ? null : t12;
|
|
97
|
+
const modalComponent = t13 === undefined ? "confirm" : t13;
|
|
98
|
+
const withConfirmation = t14 === undefined ? false : t14;
|
|
99
|
+
const className = t15 === undefined ? null : t15;
|
|
100
|
+
let t16;
|
|
101
|
+
if ($[18] !== initialLabel) {
|
|
102
|
+
t16 = initialLabel || /*#__PURE__*/jsx(FormattedMessage, {
|
|
103
|
+
id: "HzCxmr"
|
|
104
|
+
});
|
|
105
|
+
$[18] = initialLabel;
|
|
106
|
+
$[19] = t16;
|
|
107
|
+
} else {
|
|
108
|
+
t16 = $[19];
|
|
109
|
+
}
|
|
110
|
+
const label = t16;
|
|
111
|
+
const ModalComponents = useModalsComponentsManager();
|
|
112
|
+
let t17;
|
|
113
|
+
if ($[20] !== ModalComponents || $[21] !== modalComponent) {
|
|
114
|
+
t17 = ModalComponents.getComponent(modalComponent);
|
|
115
|
+
$[20] = ModalComponents;
|
|
116
|
+
$[21] = modalComponent;
|
|
117
|
+
$[22] = t17;
|
|
118
|
+
} else {
|
|
119
|
+
t17 = $[22];
|
|
120
|
+
}
|
|
121
|
+
const ModalComponent = t17;
|
|
122
|
+
const [modalOpen, setModalOpen] = useState(false);
|
|
123
|
+
const [error, setError] = useState(null);
|
|
124
|
+
const {
|
|
125
|
+
ids,
|
|
126
|
+
idLabels,
|
|
127
|
+
modalKey
|
|
128
|
+
} = useActionProps(id, value, valueLabelPath);
|
|
129
|
+
let t18;
|
|
130
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
131
|
+
t18 = () => {
|
|
132
|
+
setModalOpen(true);
|
|
133
|
+
};
|
|
134
|
+
$[23] = t18;
|
|
135
|
+
} else {
|
|
136
|
+
t18 = $[23];
|
|
137
|
+
}
|
|
138
|
+
const onOpen = t18;
|
|
139
|
+
let t19;
|
|
140
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
141
|
+
t19 = () => {
|
|
142
|
+
setModalOpen(false);
|
|
143
|
+
};
|
|
144
|
+
$[24] = t19;
|
|
145
|
+
} else {
|
|
146
|
+
t19 = $[24];
|
|
147
|
+
}
|
|
148
|
+
const onClosed = t19;
|
|
149
|
+
let t20;
|
|
150
|
+
if ($[25] !== action || $[26] !== endpoint || $[27] !== ids || $[28] !== onChange || $[29] !== onConfirmed) {
|
|
151
|
+
t20 = () => (action !== null ? action(ids) : postJSON(endpoint, {
|
|
152
|
+
ids
|
|
78
153
|
}, {
|
|
79
|
-
credentials:
|
|
154
|
+
credentials: "include",
|
|
80
155
|
headers: getCSRFHeaders()
|
|
81
|
-
})).then(
|
|
156
|
+
})).then(response => {
|
|
82
157
|
if (onConfirmed !== null) {
|
|
83
158
|
onConfirmed(response);
|
|
84
159
|
}
|
|
85
160
|
if (onChange !== null) {
|
|
86
161
|
onChange(response);
|
|
87
162
|
}
|
|
88
|
-
|
|
89
|
-
})["catch"](function (err) {
|
|
163
|
+
}).catch(err => {
|
|
90
164
|
setError(err);
|
|
91
165
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
166
|
+
$[25] = action;
|
|
167
|
+
$[26] = endpoint;
|
|
168
|
+
$[27] = ids;
|
|
169
|
+
$[28] = onChange;
|
|
170
|
+
$[29] = onConfirmed;
|
|
171
|
+
$[30] = t20;
|
|
172
|
+
} else {
|
|
173
|
+
t20 = $[30];
|
|
174
|
+
}
|
|
175
|
+
const onConfirm = t20;
|
|
176
|
+
const t21 = withConfirmation ? onOpen : null;
|
|
177
|
+
const t22 = disabled ? "secondary" : theme;
|
|
178
|
+
let t23;
|
|
179
|
+
if ($[31] !== className || $[32] !== disabled || $[33] !== icon || $[34] !== label || $[35] !== props || $[36] !== t21 || $[37] !== t22) {
|
|
180
|
+
t23 = /*#__PURE__*/jsx(Button, {
|
|
181
|
+
className: className,
|
|
96
182
|
label: label,
|
|
97
183
|
icon: icon,
|
|
98
|
-
onClick:
|
|
184
|
+
onClick: t21,
|
|
99
185
|
disabled: disabled,
|
|
100
|
-
theme:
|
|
101
|
-
|
|
186
|
+
theme: t22,
|
|
187
|
+
...props
|
|
188
|
+
});
|
|
189
|
+
$[31] = className;
|
|
190
|
+
$[32] = disabled;
|
|
191
|
+
$[33] = icon;
|
|
192
|
+
$[34] = label;
|
|
193
|
+
$[35] = props;
|
|
194
|
+
$[36] = t21;
|
|
195
|
+
$[37] = t22;
|
|
196
|
+
$[38] = t23;
|
|
197
|
+
} else {
|
|
198
|
+
t23 = $[38];
|
|
199
|
+
}
|
|
200
|
+
let t24;
|
|
201
|
+
if ($[39] !== ModalComponent || $[40] !== description || $[41] !== error || $[42] !== idLabels || $[43] !== modalKey || $[44] !== modalOpen || $[45] !== onConfirm || $[46] !== title) {
|
|
202
|
+
t24 = modalOpen ? /*#__PURE__*/jsxs(ModalComponent, {
|
|
102
203
|
id: modalKey,
|
|
103
204
|
title: title || /*#__PURE__*/jsx(FormattedMessage, {
|
|
104
|
-
id: "8T+JE7"
|
|
105
|
-
defaultMessage: [{
|
|
106
|
-
"type": 0,
|
|
107
|
-
"value": "Duplicate"
|
|
108
|
-
}]
|
|
205
|
+
id: "8T+JE7"
|
|
109
206
|
}),
|
|
110
207
|
onConfirm: onConfirm,
|
|
111
|
-
|
|
208
|
+
onClosed: onClosed,
|
|
112
209
|
confirmButton: {
|
|
113
210
|
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
114
|
-
id: "UaVu03"
|
|
115
|
-
defaultMessage: [{
|
|
116
|
-
"type": 0,
|
|
117
|
-
"value": "Confirm"
|
|
118
|
-
}]
|
|
211
|
+
id: "UaVu03"
|
|
119
212
|
}),
|
|
120
|
-
theme:
|
|
213
|
+
theme: "danger"
|
|
121
214
|
},
|
|
122
215
|
cancelButton: {
|
|
123
216
|
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
124
|
-
id: "PyxZY2"
|
|
125
|
-
defaultMessage: [{
|
|
126
|
-
"type": 0,
|
|
127
|
-
"value": "Cancel"
|
|
128
|
-
}]
|
|
217
|
+
id: "PyxZY2"
|
|
129
218
|
})
|
|
130
219
|
},
|
|
131
220
|
children: [description !== null ? description : /*#__PURE__*/jsx("p", {
|
|
132
221
|
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
133
222
|
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
223
|
values: {
|
|
145
224
|
ids: idLabels
|
|
146
225
|
}
|
|
147
226
|
})
|
|
148
227
|
}), error !== null ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
149
|
-
id: "cutyQH"
|
|
150
|
-
defaultMessage: [{
|
|
151
|
-
"type": 0,
|
|
152
|
-
"value": "An error has occured."
|
|
153
|
-
}]
|
|
228
|
+
id: "cutyQH"
|
|
154
229
|
}) : null]
|
|
155
|
-
}) : null
|
|
156
|
-
|
|
230
|
+
}) : null;
|
|
231
|
+
$[39] = ModalComponent;
|
|
232
|
+
$[40] = description;
|
|
233
|
+
$[41] = error;
|
|
234
|
+
$[42] = idLabels;
|
|
235
|
+
$[43] = modalKey;
|
|
236
|
+
$[44] = modalOpen;
|
|
237
|
+
$[45] = onConfirm;
|
|
238
|
+
$[46] = title;
|
|
239
|
+
$[47] = t24;
|
|
240
|
+
} else {
|
|
241
|
+
t24 = $[47];
|
|
242
|
+
}
|
|
243
|
+
let t25;
|
|
244
|
+
if ($[48] !== t23 || $[49] !== t24) {
|
|
245
|
+
t25 = /*#__PURE__*/jsxs(Fragment, {
|
|
246
|
+
children: [t23, t24]
|
|
247
|
+
});
|
|
248
|
+
$[48] = t23;
|
|
249
|
+
$[49] = t24;
|
|
250
|
+
$[50] = t25;
|
|
251
|
+
} else {
|
|
252
|
+
t25 = $[50];
|
|
253
|
+
}
|
|
254
|
+
return t25;
|
|
157
255
|
}
|
|
158
256
|
|
|
159
257
|
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.40-alpha.1",
|
|
4
4
|
"description": "Duplicate action",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.28.6",
|
|
55
55
|
"@folklore/fetch": "^0.1.21",
|
|
56
|
-
"@panneau/core": "^4.0.
|
|
57
|
-
"@panneau/element-button": "^4.0.
|
|
58
|
-
"@panneau/themes": "^4.0.
|
|
56
|
+
"@panneau/core": "^4.0.40-alpha.1",
|
|
57
|
+
"@panneau/element-button": "^4.0.40-alpha.1",
|
|
58
|
+
"@panneau/themes": "^4.0.40-alpha.1",
|
|
59
59
|
"classnames": "^2.5.1",
|
|
60
60
|
"react-intl": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "66520f92373b3aa371222b354d60ed3cf3d20c96"
|
|
66
66
|
}
|