@panneau/action-duplicate 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.js +214 -114
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,157 +1,257 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
4
2
|
import { postJSON, getCSRFHeaders } from '@folklore/fetch';
|
|
5
|
-
import { useState
|
|
3
|
+
import { useState } from 'react';
|
|
6
4
|
import { FormattedMessage } from 'react-intl';
|
|
7
|
-
import { useActionProps } from '@panneau/action-actions';
|
|
8
5
|
import { useModalsComponentsManager } from '@panneau/core/contexts';
|
|
9
6
|
import Button from '@panneau/element-button';
|
|
10
|
-
import { jsxs, Fragment
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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
|
|
76
153
|
}, {
|
|
77
|
-
credentials:
|
|
154
|
+
credentials: "include",
|
|
78
155
|
headers: getCSRFHeaders()
|
|
79
|
-
})).then(
|
|
156
|
+
})).then(response => {
|
|
80
157
|
if (onConfirmed !== null) {
|
|
81
158
|
onConfirmed(response);
|
|
82
159
|
}
|
|
83
160
|
if (onChange !== null) {
|
|
84
161
|
onChange(response);
|
|
85
162
|
}
|
|
86
|
-
|
|
87
|
-
})["catch"](function (err) {
|
|
163
|
+
}).catch(err => {
|
|
88
164
|
setError(err);
|
|
89
165
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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, {
|
|
93
181
|
className: className,
|
|
94
182
|
label: label,
|
|
95
183
|
icon: icon,
|
|
96
|
-
onClick:
|
|
184
|
+
onClick: t21,
|
|
97
185
|
disabled: disabled,
|
|
98
|
-
theme:
|
|
99
|
-
|
|
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, {
|
|
100
203
|
id: modalKey,
|
|
101
204
|
title: title || /*#__PURE__*/jsx(FormattedMessage, {
|
|
102
|
-
id: "8T+JE7"
|
|
103
|
-
defaultMessage: [{
|
|
104
|
-
"type": 0,
|
|
105
|
-
"value": "Duplicate"
|
|
106
|
-
}]
|
|
205
|
+
id: "8T+JE7"
|
|
107
206
|
}),
|
|
108
207
|
onConfirm: onConfirm,
|
|
109
|
-
|
|
208
|
+
onClosed: onClosed,
|
|
110
209
|
confirmButton: {
|
|
111
210
|
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
112
|
-
id: "UaVu03"
|
|
113
|
-
defaultMessage: [{
|
|
114
|
-
"type": 0,
|
|
115
|
-
"value": "Confirm"
|
|
116
|
-
}]
|
|
211
|
+
id: "UaVu03"
|
|
117
212
|
}),
|
|
118
|
-
theme:
|
|
213
|
+
theme: "danger"
|
|
119
214
|
},
|
|
120
215
|
cancelButton: {
|
|
121
216
|
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
122
|
-
id: "PyxZY2"
|
|
123
|
-
defaultMessage: [{
|
|
124
|
-
"type": 0,
|
|
125
|
-
"value": "Cancel"
|
|
126
|
-
}]
|
|
217
|
+
id: "PyxZY2"
|
|
127
218
|
})
|
|
128
219
|
},
|
|
129
220
|
children: [description !== null ? description : /*#__PURE__*/jsx("p", {
|
|
130
221
|
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
131
222
|
id: "XmY7D8",
|
|
132
|
-
defaultMessage: [{
|
|
133
|
-
"type": 0,
|
|
134
|
-
"value": "The following items will be duplicated: "
|
|
135
|
-
}, {
|
|
136
|
-
"type": 1,
|
|
137
|
-
"value": "ids"
|
|
138
|
-
}, {
|
|
139
|
-
"type": 0,
|
|
140
|
-
"value": ". Are you sure you want to continue?"
|
|
141
|
-
}],
|
|
142
223
|
values: {
|
|
143
224
|
ids: idLabels
|
|
144
225
|
}
|
|
145
226
|
})
|
|
146
227
|
}), error !== null ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
147
|
-
id: "cutyQH"
|
|
148
|
-
defaultMessage: [{
|
|
149
|
-
"type": 0,
|
|
150
|
-
"value": "An error has occured."
|
|
151
|
-
}]
|
|
228
|
+
id: "cutyQH"
|
|
152
229
|
}) : null]
|
|
153
|
-
}) : null
|
|
154
|
-
|
|
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;
|
|
155
255
|
}
|
|
156
256
|
|
|
157
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.3",
|
|
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.3",
|
|
57
|
+
"@panneau/element-button": "^4.0.40-alpha.3",
|
|
58
|
+
"@panneau/themes": "^4.0.40-alpha.3",
|
|
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": "1735964a2702ae0480b642225286e4184f36680d"
|
|
66
66
|
}
|