@para-ui/core 4.0.0-rc.6 → 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/AutoTips/index.js +2 -2
- package/Cascader/index.js +4 -5
- package/ComboSelect/index.js +13 -15
- package/ComboSelect/lang/en_US.d.ts +1 -0
- package/ComboSelect/lang/index.d.ts +2 -0
- package/ComboSelect/lang/zh_CN.d.ts +1 -0
- package/CopyText/index.js +7 -5
- package/DatePicker/index.js +1 -3
- package/DatePicker/util.d.ts +6 -6
- package/DynamicMultiBox/index.js +7 -564
- package/Form/index.js +4 -8
- package/FormItem/index.js +4 -8
- package/FunctionModal/index.js +2 -2
- package/Menu/index.js +1 -1
- package/OperateBtn/index.js +8 -6
- package/Pagination/index.js +1 -1
- package/QuickReply/QuickReplyCode/index.d.ts +10 -0
- package/QuickReply/index.d.ts +87 -0
- package/QuickReply/index.js +550 -0
- package/QuickReply/lang/en_US.d.ts +14 -0
- package/QuickReply/lang/index.d.ts +29 -0
- package/QuickReply/lang/zh_CN.d.ts +14 -0
- package/README.md +2 -105
- package/Select/index.js +5 -3
- package/SelectInput/index.js +1 -1
- package/Selector/index.js +326 -3
- package/SelectorPicker/index.js +6 -5
- package/Stepper/index.js +1 -1
- package/Styles/theme.scss +1 -0
- package/Switch/index.js +6 -6
- package/Table/index.js +410 -472
- package/Tabs/index.js +3 -3
- package/Tag/index.js +55 -84
- package/TextEditor/index.js +3 -3
- package/TextField/index.js +1 -1
- package/TimePicker/index.js +1 -3
- package/Timeline/index.js +20 -14
- package/ToggleButton/index.js +26 -25
- package/Tooltip/index.js +27 -26
- package/Transfer/index.js +44 -49
- package/Tree/index.js +4 -8
- package/Upload/index.js +410 -627
- package/_verture/index-28a6bc3a.js +559 -0
- package/_verture/{index-3cdaba96.js → index-9784b09c.js} +18 -3
- package/_verture/{index-e0f9064d.js → index-bd14bb50.js} +1 -1
- package/_verture/{index-4fafd0a0.js → index-e3011376.js} +312 -394
- package/_verture/{slicedToArray-75fa4188.js → slicedToArray-8223a2ef.js} +1 -1
- package/index.d.ts +2 -0
- package/index.js +12 -10
- package/locale/en-US.d.ts +14 -0
- package/locale/index.d.ts +28 -0
- package/locale/index.js +30 -2
- package/locale/zh-CN.d.ts +14 -0
- package/package.json +3 -2
- package/umd/AutoTips.js +1 -1
- package/umd/Breadcrumbs.js +1 -1
- package/umd/Button.js +7 -7
- package/umd/ButtonGroup.js +1 -1
- package/umd/Cascader.js +1 -1
- package/umd/ComboSelect.js +4 -4
- package/umd/CopyText.js +2 -2
- package/umd/DatePicker.js +7 -7
- package/umd/Descriptions.js +1 -1
- package/umd/Desktop.js +1 -1
- package/umd/Drawer.js +1 -1
- package/umd/DynamicMultiBox.js +4 -4
- package/umd/Form.js +4 -4
- package/umd/FormItem.js +4 -4
- package/umd/FunctionModal.js +1 -1
- package/umd/InputLang.js +1 -1
- package/umd/Menu.js +1 -1
- package/umd/Modal.js +1 -1
- package/umd/MultiBox.js +1 -1
- package/umd/OperateBtn.js +2 -2
- package/umd/PageHeader.js +1 -1
- package/umd/Pagination.js +2 -2
- package/umd/PopConfirm.js +1 -1
- package/umd/QuickReply.js +55 -0
- package/umd/Search.js +1 -1
- package/umd/Select.js +2 -2
- package/umd/SelectInput.js +2 -2
- package/umd/Selector.js +1 -1
- package/umd/SelectorPicker.js +2 -2
- package/umd/SingleBox.js +1 -1
- package/umd/Stepper.js +1 -1
- package/umd/Switch.js +1 -1
- package/umd/Table.js +2 -2
- package/umd/Tabs.js +1 -1
- package/umd/Tag.js +1 -1
- package/umd/TextField.js +1 -1
- package/umd/TimePicker.js +5 -5
- package/umd/Title.js +1 -1
- package/umd/ToggleButton.js +1 -1
- package/umd/Transfer.js +1 -1
- package/umd/Tree.js +4 -4
- package/umd/Upload.js +1 -1
- package/umd/locale.js +1 -1
- package/_verture/index-d63bd287.js +0 -327
- package/_verture/toConsumableArray-c7a8028f.js +0 -19
- /package/_verture/{modalContext-8534f23d.js → modalContext-e4361800.js} +0 -0
- /package/_verture/{typeof-b240b062.js → typeof-c310ee4a.js} +0 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { s as sortable_esm } from './sortable.esm-49896035.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
function getAugmentedNamespace(n) {
|
|
5
|
+
var f = n.default;
|
|
6
|
+
if (typeof f == "function") {
|
|
7
|
+
var a = function () {
|
|
8
|
+
return f.apply(this, arguments);
|
|
9
|
+
};
|
|
10
|
+
a.prototype = f.prototype;
|
|
11
|
+
} else a = {};
|
|
12
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
13
|
+
Object.keys(n).forEach(function (k) {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
15
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return n[k];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
return a;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var dist = {exports: {}};
|
|
26
|
+
|
|
27
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(sortable_esm);
|
|
28
|
+
|
|
29
|
+
var classnames = {exports: {}};
|
|
30
|
+
|
|
31
|
+
/*!
|
|
32
|
+
Copyright (c) 2018 Jed Watson.
|
|
33
|
+
Licensed under the MIT License (MIT), see
|
|
34
|
+
http://jedwatson.github.io/classnames
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
(function (module) {
|
|
38
|
+
/* global define */
|
|
39
|
+
|
|
40
|
+
(function () {
|
|
41
|
+
|
|
42
|
+
var hasOwn = {}.hasOwnProperty;
|
|
43
|
+
|
|
44
|
+
function classNames() {
|
|
45
|
+
var classes = [];
|
|
46
|
+
|
|
47
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
48
|
+
var arg = arguments[i];
|
|
49
|
+
if (!arg) continue;
|
|
50
|
+
|
|
51
|
+
var argType = typeof arg;
|
|
52
|
+
|
|
53
|
+
if (argType === 'string' || argType === 'number') {
|
|
54
|
+
classes.push(arg);
|
|
55
|
+
} else if (Array.isArray(arg)) {
|
|
56
|
+
if (arg.length) {
|
|
57
|
+
var inner = classNames.apply(null, arg);
|
|
58
|
+
if (inner) {
|
|
59
|
+
classes.push(inner);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
} else if (argType === 'object') {
|
|
63
|
+
if (arg.toString === Object.prototype.toString) {
|
|
64
|
+
for (var key in arg) {
|
|
65
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
66
|
+
classes.push(key);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
classes.push(arg.toString());
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return classes.join(' ');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (module.exports) {
|
|
79
|
+
classNames.default = classNames;
|
|
80
|
+
module.exports = classNames;
|
|
81
|
+
} else {
|
|
82
|
+
window.classNames = classNames;
|
|
83
|
+
}
|
|
84
|
+
}());
|
|
85
|
+
} (classnames));
|
|
86
|
+
|
|
87
|
+
var isProduction = process.env.NODE_ENV === 'production';
|
|
88
|
+
var prefix = 'Invariant failed';
|
|
89
|
+
function invariant(condition, message) {
|
|
90
|
+
if (condition) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (isProduction) {
|
|
94
|
+
throw new Error(prefix);
|
|
95
|
+
}
|
|
96
|
+
var provided = typeof message === 'function' ? message() : message;
|
|
97
|
+
var value = provided ? prefix + ": " + provided : prefix;
|
|
98
|
+
throw new Error(value);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
var tinyInvariant_esm = /*#__PURE__*/Object.freeze({
|
|
102
|
+
__proto__: null,
|
|
103
|
+
'default': invariant
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
var require$$3 = /*@__PURE__*/getAugmentedNamespace(tinyInvariant_esm);
|
|
107
|
+
|
|
108
|
+
(function (module) {
|
|
109
|
+
var $8zHUo$sortablejs = require$$0;
|
|
110
|
+
var $8zHUo$classnames = classnames.exports;
|
|
111
|
+
var $8zHUo$react = React__default;
|
|
112
|
+
var $8zHUo$tinyinvariant = require$$3;
|
|
113
|
+
|
|
114
|
+
function $parcel$interopDefault(a) {
|
|
115
|
+
return a && a.__esModule ? a.default : a;
|
|
116
|
+
}
|
|
117
|
+
function $parcel$export(e, n, v, s) {
|
|
118
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
119
|
+
}
|
|
120
|
+
function $parcel$exportWildcard(dest, source) {
|
|
121
|
+
Object.keys(source).forEach(function(key) {
|
|
122
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
Object.defineProperty(dest, key, {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function get() {
|
|
129
|
+
return source[key];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return dest;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
$parcel$export(module.exports, "Sortable", () => $882b6d93070905b3$re_export$Sortable);
|
|
138
|
+
$parcel$export(module.exports, "Direction", () => $882b6d93070905b3$re_export$Direction);
|
|
139
|
+
$parcel$export(module.exports, "DOMRect", () => $882b6d93070905b3$re_export$DOMRect);
|
|
140
|
+
$parcel$export(module.exports, "GroupOptions", () => $882b6d93070905b3$re_export$GroupOptions);
|
|
141
|
+
$parcel$export(module.exports, "MoveEvent", () => $882b6d93070905b3$re_export$MoveEvent);
|
|
142
|
+
$parcel$export(module.exports, "Options", () => $882b6d93070905b3$re_export$Options);
|
|
143
|
+
$parcel$export(module.exports, "PullResult", () => $882b6d93070905b3$re_export$PullResult);
|
|
144
|
+
$parcel$export(module.exports, "PutResult", () => $882b6d93070905b3$re_export$PutResult);
|
|
145
|
+
$parcel$export(module.exports, "SortableEvent", () => $882b6d93070905b3$re_export$SortableEvent);
|
|
146
|
+
$parcel$export(module.exports, "SortableOptions", () => $882b6d93070905b3$re_export$SortableOptions);
|
|
147
|
+
$parcel$export(module.exports, "Utils", () => $882b6d93070905b3$re_export$Utils);
|
|
148
|
+
$parcel$export(module.exports, "ReactSortable", () => $7fe8e3ea572bda7a$export$11bbed9ee0012c13);
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
function $eb03e74f8f7db1f3$export$1d0aa160432dfea5(node) {
|
|
155
|
+
if (node.parentElement !== null) node.parentElement.removeChild(node);
|
|
156
|
+
}
|
|
157
|
+
function $eb03e74f8f7db1f3$export$6d240faa51aa562f(parent, newChild, index) {
|
|
158
|
+
const refChild = parent.children[index] || null;
|
|
159
|
+
parent.insertBefore(newChild, refChild);
|
|
160
|
+
}
|
|
161
|
+
function $eb03e74f8f7db1f3$export$77f49a256021c8de(customs) {
|
|
162
|
+
customs.forEach((curr)=>$eb03e74f8f7db1f3$export$1d0aa160432dfea5(curr.element)
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function $eb03e74f8f7db1f3$export$a6177d5829f70ebc(customs) {
|
|
166
|
+
customs.forEach((curr)=>{
|
|
167
|
+
$eb03e74f8f7db1f3$export$6d240faa51aa562f(curr.parentElement, curr.element, curr.oldIndex);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function $eb03e74f8f7db1f3$export$4655efe700f887a(evt, list) {
|
|
171
|
+
const mode = $eb03e74f8f7db1f3$export$1fc0f6205829e19c(evt);
|
|
172
|
+
const parentElement = {
|
|
173
|
+
parentElement: evt.from
|
|
174
|
+
};
|
|
175
|
+
let custom = [];
|
|
176
|
+
switch(mode){
|
|
177
|
+
case "normal":
|
|
178
|
+
/* eslint-disable */ const item = {
|
|
179
|
+
element: evt.item,
|
|
180
|
+
newIndex: evt.newIndex,
|
|
181
|
+
oldIndex: evt.oldIndex,
|
|
182
|
+
parentElement: evt.from
|
|
183
|
+
};
|
|
184
|
+
custom = [
|
|
185
|
+
item
|
|
186
|
+
];
|
|
187
|
+
break;
|
|
188
|
+
case "swap":
|
|
189
|
+
const drag = {
|
|
190
|
+
element: evt.item,
|
|
191
|
+
oldIndex: evt.oldIndex,
|
|
192
|
+
newIndex: evt.newIndex,
|
|
193
|
+
...parentElement
|
|
194
|
+
};
|
|
195
|
+
const swap = {
|
|
196
|
+
element: evt.swapItem,
|
|
197
|
+
oldIndex: evt.newIndex,
|
|
198
|
+
newIndex: evt.oldIndex,
|
|
199
|
+
...parentElement
|
|
200
|
+
};
|
|
201
|
+
custom = [
|
|
202
|
+
drag,
|
|
203
|
+
swap
|
|
204
|
+
];
|
|
205
|
+
break;
|
|
206
|
+
case "multidrag":
|
|
207
|
+
custom = evt.oldIndicies.map((curr, index)=>({
|
|
208
|
+
element: curr.multiDragElement,
|
|
209
|
+
oldIndex: curr.index,
|
|
210
|
+
newIndex: evt.newIndicies[index].index,
|
|
211
|
+
...parentElement
|
|
212
|
+
})
|
|
213
|
+
);
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
/* eslint-enable */ const customs = $eb03e74f8f7db1f3$export$bc06a3af7dc65f53(custom, list);
|
|
217
|
+
return customs;
|
|
218
|
+
}
|
|
219
|
+
function $eb03e74f8f7db1f3$export$c25cf8080bd305ec(normalized, list) {
|
|
220
|
+
const a = $eb03e74f8f7db1f3$export$be2da95e6167b0bd(normalized, list);
|
|
221
|
+
const b = $eb03e74f8f7db1f3$export$eca851ee65ae17e4(normalized, a);
|
|
222
|
+
return b;
|
|
223
|
+
}
|
|
224
|
+
function $eb03e74f8f7db1f3$export$be2da95e6167b0bd(normalized, list) {
|
|
225
|
+
const newList = [
|
|
226
|
+
...list
|
|
227
|
+
];
|
|
228
|
+
normalized.concat().reverse().forEach((curr)=>newList.splice(curr.oldIndex, 1)
|
|
229
|
+
);
|
|
230
|
+
return newList;
|
|
231
|
+
}
|
|
232
|
+
function $eb03e74f8f7db1f3$export$eca851ee65ae17e4(normalized, list, evt, clone) {
|
|
233
|
+
const newList = [
|
|
234
|
+
...list
|
|
235
|
+
];
|
|
236
|
+
normalized.forEach((curr)=>{
|
|
237
|
+
const newItem = clone && evt && clone(curr.item, evt);
|
|
238
|
+
newList.splice(curr.newIndex, 0, newItem || curr.item);
|
|
239
|
+
});
|
|
240
|
+
return newList;
|
|
241
|
+
}
|
|
242
|
+
function $eb03e74f8f7db1f3$export$1fc0f6205829e19c(evt) {
|
|
243
|
+
if (evt.oldIndicies && evt.oldIndicies.length > 0) return "multidrag";
|
|
244
|
+
if (evt.swapItem) return "swap";
|
|
245
|
+
return "normal";
|
|
246
|
+
}
|
|
247
|
+
function $eb03e74f8f7db1f3$export$bc06a3af7dc65f53(inputs, list) {
|
|
248
|
+
const normalized = inputs.map((curr)=>({
|
|
249
|
+
...curr,
|
|
250
|
+
item: list[curr.oldIndex]
|
|
251
|
+
})
|
|
252
|
+
).sort((a, b)=>a.oldIndex - b.oldIndex
|
|
253
|
+
);
|
|
254
|
+
return normalized;
|
|
255
|
+
}
|
|
256
|
+
function $eb03e74f8f7db1f3$export$7553c81e62e31b7e(props) {
|
|
257
|
+
/* eslint-disable */ const { list: // react sortable props
|
|
258
|
+
list , setList: setList , children: children , tag: tag , style: style , className: className , clone: clone , onAdd: // sortable options that have methods we want to overwrite
|
|
259
|
+
onAdd , onChange: onChange , onChoose: onChoose , onClone: onClone , onEnd: onEnd , onFilter: onFilter , onRemove: onRemove , onSort: onSort , onStart: onStart , onUnchoose: onUnchoose , onUpdate: onUpdate , onMove: onMove , onSpill: onSpill , onSelect: onSelect , onDeselect: onDeselect , ...options } = props;
|
|
260
|
+
/* eslint-enable */ return options;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
/** Holds a global reference for which react element is being dragged */ // @todo - use context to manage this. How does one use 2 different providers?
|
|
265
|
+
const $7fe8e3ea572bda7a$var$store = {
|
|
266
|
+
dragging: null
|
|
267
|
+
};
|
|
268
|
+
class $7fe8e3ea572bda7a$export$11bbed9ee0012c13 extends $8zHUo$react.Component {
|
|
269
|
+
constructor(props){
|
|
270
|
+
super(props);
|
|
271
|
+
// @todo forward ref this component
|
|
272
|
+
this.ref = /*#__PURE__*/ $8zHUo$react.createRef();
|
|
273
|
+
// make all state false because we can't change sortable unless a mouse gesture is made.
|
|
274
|
+
const newList = [
|
|
275
|
+
...props.list
|
|
276
|
+
];
|
|
277
|
+
newList.forEach((item)=>{
|
|
278
|
+
Object.assign(item, {
|
|
279
|
+
chosen: false,
|
|
280
|
+
selected: false
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
props.setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
284
|
+
($parcel$interopDefault($8zHUo$tinyinvariant))(//@ts-expect-error: Doesn't exist. Will deprecate soon.
|
|
285
|
+
!props.plugins, `
|
|
286
|
+
Plugins prop is no longer supported.
|
|
287
|
+
Instead, mount it with "Sortable.mount(new MultiDrag())"
|
|
288
|
+
Please read the updated README.md at https://github.com/SortableJS/react-sortablejs.
|
|
289
|
+
`);
|
|
290
|
+
}
|
|
291
|
+
componentDidMount() {
|
|
292
|
+
if (this.ref.current === null) return;
|
|
293
|
+
const newOptions = this.makeOptions();
|
|
294
|
+
($parcel$interopDefault($8zHUo$sortablejs)).create(this.ref.current, newOptions);
|
|
295
|
+
}
|
|
296
|
+
componentDidUpdate(prevProps) {
|
|
297
|
+
if (prevProps.disabled !== this.props.disabled && this.sortable) this.sortable.option("disabled", this.props.disabled);
|
|
298
|
+
}
|
|
299
|
+
render() {
|
|
300
|
+
const { tag: tag , style: style , className: className , id: id } = this.props;
|
|
301
|
+
const classicProps = {
|
|
302
|
+
style: style,
|
|
303
|
+
className: className,
|
|
304
|
+
id: id
|
|
305
|
+
};
|
|
306
|
+
// if no tag, default to a `div` element.
|
|
307
|
+
const newTag = !tag || tag === null ? "div" : tag;
|
|
308
|
+
return(/*#__PURE__*/ $8zHUo$react.createElement(newTag, {
|
|
309
|
+
// @todo - find a way (perhaps with the callback) to allow AntD components to work
|
|
310
|
+
ref: this.ref,
|
|
311
|
+
...classicProps
|
|
312
|
+
}, this.getChildren()));
|
|
313
|
+
}
|
|
314
|
+
getChildren() {
|
|
315
|
+
const { children: children , dataIdAttr: dataIdAttr , selectedClass: selectedClass = "sortable-selected" , chosenClass: chosenClass = "sortable-chosen" , dragClass: /* eslint-disable */ dragClass = "sortable-drag" , fallbackClass: fallbackClass = "sortable-falback" , ghostClass: ghostClass = "sortable-ghost" , swapClass: swapClass = "sortable-swap-highlight" , filter: /* eslint-enable */ filter = "sortable-filter" , list: list , } = this.props;
|
|
316
|
+
// if no children, don't do anything.
|
|
317
|
+
if (!children || children == null) return null;
|
|
318
|
+
const dataid = dataIdAttr || "data-id";
|
|
319
|
+
/* eslint-disable-next-line */ return $8zHUo$react.Children.map(children, (child, index)=>{
|
|
320
|
+
if (child === undefined) return undefined;
|
|
321
|
+
const item = list[index] || {
|
|
322
|
+
};
|
|
323
|
+
const { className: prevClassName } = child.props;
|
|
324
|
+
// @todo - handle the function if avalable. I don't think anyone will be doing this soon.
|
|
325
|
+
const filtered = typeof filter === "string" && {
|
|
326
|
+
[filter.replace(".", "")]: !!item.filtered
|
|
327
|
+
};
|
|
328
|
+
const className = ($parcel$interopDefault($8zHUo$classnames))(prevClassName, {
|
|
329
|
+
[selectedClass]: item.selected,
|
|
330
|
+
[chosenClass]: item.chosen,
|
|
331
|
+
...filtered
|
|
332
|
+
});
|
|
333
|
+
return(/*#__PURE__*/ $8zHUo$react.cloneElement(child, {
|
|
334
|
+
[dataid]: child.key,
|
|
335
|
+
className: className
|
|
336
|
+
}));
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
/** Appends the `sortable` property to this component */ get sortable() {
|
|
340
|
+
const el = this.ref.current;
|
|
341
|
+
if (el === null) return null;
|
|
342
|
+
const key = Object.keys(el).find((k)=>k.includes("Sortable")
|
|
343
|
+
);
|
|
344
|
+
if (!key) return null;
|
|
345
|
+
//@ts-expect-error: fix me.
|
|
346
|
+
return el[key];
|
|
347
|
+
}
|
|
348
|
+
/** Converts all the props from `ReactSortable` into the `options` object that `Sortable.create(el, [options])` can use. */ makeOptions() {
|
|
349
|
+
const DOMHandlers = [
|
|
350
|
+
"onAdd",
|
|
351
|
+
"onChoose",
|
|
352
|
+
"onDeselect",
|
|
353
|
+
"onEnd",
|
|
354
|
+
"onRemove",
|
|
355
|
+
"onSelect",
|
|
356
|
+
"onSpill",
|
|
357
|
+
"onStart",
|
|
358
|
+
"onUnchoose",
|
|
359
|
+
"onUpdate",
|
|
360
|
+
];
|
|
361
|
+
const NonDOMHandlers = [
|
|
362
|
+
"onChange",
|
|
363
|
+
"onClone",
|
|
364
|
+
"onFilter",
|
|
365
|
+
"onSort",
|
|
366
|
+
];
|
|
367
|
+
const newOptions = $eb03e74f8f7db1f3$export$7553c81e62e31b7e(this.props);
|
|
368
|
+
DOMHandlers.forEach((name)=>newOptions[name] = this.prepareOnHandlerPropAndDOM(name)
|
|
369
|
+
);
|
|
370
|
+
NonDOMHandlers.forEach((name)=>newOptions[name] = this.prepareOnHandlerProp(name)
|
|
371
|
+
);
|
|
372
|
+
/** onMove has 2 arguments and needs to be handled seperately. */ const onMove1 = (evt, originalEvt)=>{
|
|
373
|
+
const { onMove: onMove } = this.props;
|
|
374
|
+
const defaultValue = evt.willInsertAfter || -1;
|
|
375
|
+
if (!onMove) return defaultValue;
|
|
376
|
+
const result = onMove(evt, originalEvt, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
377
|
+
if (typeof result === "undefined") return false;
|
|
378
|
+
return result;
|
|
379
|
+
};
|
|
380
|
+
return {
|
|
381
|
+
...newOptions,
|
|
382
|
+
onMove: onMove1
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/** Prepares a method that will be used in the sortable options to call an `on[Handler]` prop & an `on[Handler]` ReactSortable method. */ prepareOnHandlerPropAndDOM(evtName) {
|
|
386
|
+
return (evt)=>{
|
|
387
|
+
// call the component prop
|
|
388
|
+
this.callOnHandlerProp(evt, evtName);
|
|
389
|
+
// calls state change
|
|
390
|
+
//@ts-expect-error: until @types multidrag item is in
|
|
391
|
+
this[evtName](evt);
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
/** Prepares a method that will be used in the sortable options to call an `on[Handler]` prop */ prepareOnHandlerProp(evtName) {
|
|
395
|
+
return (evt)=>{
|
|
396
|
+
// call the component prop
|
|
397
|
+
this.callOnHandlerProp(evt, evtName);
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
/** Calls the `props.on[Handler]` function */ callOnHandlerProp(evt, evtName) {
|
|
401
|
+
const propEvent = this.props[evtName];
|
|
402
|
+
if (propEvent) propEvent(evt, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
403
|
+
}
|
|
404
|
+
// SORTABLE DOM HANDLING
|
|
405
|
+
onAdd(evt) {
|
|
406
|
+
const { list: list , setList: setList , clone: clone } = this.props;
|
|
407
|
+
/* eslint-disable-next-line */ const otherList = [
|
|
408
|
+
...$7fe8e3ea572bda7a$var$store.dragging.props.list
|
|
409
|
+
];
|
|
410
|
+
const customs = $eb03e74f8f7db1f3$export$4655efe700f887a(evt, otherList);
|
|
411
|
+
$eb03e74f8f7db1f3$export$77f49a256021c8de(customs);
|
|
412
|
+
const newList = $eb03e74f8f7db1f3$export$eca851ee65ae17e4(customs, list, evt, clone);
|
|
413
|
+
newList.forEach((item)=>{
|
|
414
|
+
Object.assign(item, {
|
|
415
|
+
selected: false
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
419
|
+
}
|
|
420
|
+
onRemove(evt) {
|
|
421
|
+
const { list: list , setList: setList } = this.props;
|
|
422
|
+
const mode = $eb03e74f8f7db1f3$export$1fc0f6205829e19c(evt);
|
|
423
|
+
const customs = $eb03e74f8f7db1f3$export$4655efe700f887a(evt, list);
|
|
424
|
+
$eb03e74f8f7db1f3$export$a6177d5829f70ebc(customs);
|
|
425
|
+
let newList = [
|
|
426
|
+
...list
|
|
427
|
+
];
|
|
428
|
+
// remove state if not in clone mode. otherwise, keep.
|
|
429
|
+
if (evt.pullMode !== "clone") newList = $eb03e74f8f7db1f3$export$be2da95e6167b0bd(customs, newList);
|
|
430
|
+
else {
|
|
431
|
+
// switch used to get the clone
|
|
432
|
+
let customClones = customs;
|
|
433
|
+
switch(mode){
|
|
434
|
+
case "multidrag":
|
|
435
|
+
customClones = customs.map((item, index)=>({
|
|
436
|
+
...item,
|
|
437
|
+
element: evt.clones[index]
|
|
438
|
+
})
|
|
439
|
+
);
|
|
440
|
+
break;
|
|
441
|
+
case "normal":
|
|
442
|
+
customClones = customs.map((item)=>({
|
|
443
|
+
...item,
|
|
444
|
+
element: evt.clone
|
|
445
|
+
})
|
|
446
|
+
);
|
|
447
|
+
break;
|
|
448
|
+
case "swap":
|
|
449
|
+
default:
|
|
450
|
+
($parcel$interopDefault($8zHUo$tinyinvariant))(true, `mode "${mode}" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "${mode}" plugin`);
|
|
451
|
+
}
|
|
452
|
+
$eb03e74f8f7db1f3$export$77f49a256021c8de(customClones);
|
|
453
|
+
// replace selected items with cloned items
|
|
454
|
+
customs.forEach((curr)=>{
|
|
455
|
+
const index = curr.oldIndex;
|
|
456
|
+
/* eslint-disable-next-line */ const newItem = this.props.clone(curr.item, evt);
|
|
457
|
+
newList.splice(index, 1, newItem);
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
// remove item.selected from list
|
|
461
|
+
newList.forEach((item)=>{
|
|
462
|
+
Object.assign(item, {
|
|
463
|
+
selected: false
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
467
|
+
}
|
|
468
|
+
onUpdate(evt) {
|
|
469
|
+
const { list: list , setList: setList } = this.props;
|
|
470
|
+
const customs = $eb03e74f8f7db1f3$export$4655efe700f887a(evt, list);
|
|
471
|
+
$eb03e74f8f7db1f3$export$77f49a256021c8de(customs);
|
|
472
|
+
$eb03e74f8f7db1f3$export$a6177d5829f70ebc(customs);
|
|
473
|
+
const newList = $eb03e74f8f7db1f3$export$c25cf8080bd305ec(customs, list);
|
|
474
|
+
return setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
475
|
+
}
|
|
476
|
+
onStart() {
|
|
477
|
+
$7fe8e3ea572bda7a$var$store.dragging = this;
|
|
478
|
+
}
|
|
479
|
+
onEnd() {
|
|
480
|
+
$7fe8e3ea572bda7a$var$store.dragging = null;
|
|
481
|
+
}
|
|
482
|
+
onChoose(evt) {
|
|
483
|
+
const { list: list , setList: setList } = this.props;
|
|
484
|
+
const newList = list.map((item, index)=>{
|
|
485
|
+
if (index === evt.oldIndex) Object.assign(item, {
|
|
486
|
+
chosen: true
|
|
487
|
+
});
|
|
488
|
+
return item;
|
|
489
|
+
});
|
|
490
|
+
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
491
|
+
}
|
|
492
|
+
onUnchoose(evt) {
|
|
493
|
+
const { list: list , setList: setList } = this.props;
|
|
494
|
+
const newList = list.map((item, index)=>{
|
|
495
|
+
if (index === evt.oldIndex) Object.assign(item, {
|
|
496
|
+
chosen: false
|
|
497
|
+
});
|
|
498
|
+
return item;
|
|
499
|
+
});
|
|
500
|
+
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
501
|
+
}
|
|
502
|
+
onSpill(evt) {
|
|
503
|
+
const { removeOnSpill: removeOnSpill , revertOnSpill: revertOnSpill } = this.props;
|
|
504
|
+
if (removeOnSpill && !revertOnSpill) $eb03e74f8f7db1f3$export$1d0aa160432dfea5(evt.item);
|
|
505
|
+
}
|
|
506
|
+
onSelect(evt) {
|
|
507
|
+
const { list: list , setList: setList } = this.props;
|
|
508
|
+
const newList = [
|
|
509
|
+
...list
|
|
510
|
+
];
|
|
511
|
+
newList.forEach((item)=>{
|
|
512
|
+
Object.assign(item, {
|
|
513
|
+
chosen: false
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
evt.newIndicies.forEach((curr)=>{
|
|
517
|
+
const index = curr.index;
|
|
518
|
+
if (index === -1) {
|
|
519
|
+
console.log(`"${evt.type}" had indice of "${curr.index}", which is probably -1 and doesn't usually happen here.`);
|
|
520
|
+
console.log(evt);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
newList[index].selected = true;
|
|
524
|
+
});
|
|
525
|
+
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
526
|
+
}
|
|
527
|
+
onDeselect(evt) {
|
|
528
|
+
const { list: list , setList: setList } = this.props;
|
|
529
|
+
const newList = [
|
|
530
|
+
...list
|
|
531
|
+
];
|
|
532
|
+
newList.forEach((item)=>{
|
|
533
|
+
Object.assign(item, {
|
|
534
|
+
chosen: false
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
evt.newIndicies.forEach((curr)=>{
|
|
538
|
+
const index = curr.index;
|
|
539
|
+
if (index === -1) return;
|
|
540
|
+
newList[index].selected = true;
|
|
541
|
+
});
|
|
542
|
+
setList(newList, this.sortable, $7fe8e3ea572bda7a$var$store);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
$7fe8e3ea572bda7a$export$11bbed9ee0012c13.defaultProps = {
|
|
546
|
+
clone: (item)=>item
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
var $faefaad95e5fcca0$exports = {};
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
$parcel$exportWildcard(module.exports, $faefaad95e5fcca0$exports);
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
} (dist));
|
|
558
|
+
|
|
559
|
+
export { dist as d };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-55ed4bd2.js';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { _ as
|
|
3
|
+
import { _ as _arrayLikeToArray, a as _unsupportedIterableToArray, b as _slicedToArray, c as _arrayWithHoles, d as _nonIterableRest } from './slicedToArray-8223a2ef.js';
|
|
4
4
|
import { _ as _defineProperty, a as _toPropertyKey } from './defineProperty-1d116156.js';
|
|
5
|
-
import { _ as _slicedToArray, a as _arrayWithHoles, b as _unsupportedIterableToArray, c as _nonIterableRest } from './slicedToArray-75fa4188.js';
|
|
6
5
|
import { _ as _typeof$1 } from './typeof-adeedc13.js';
|
|
7
6
|
import * as React$4 from 'react';
|
|
8
7
|
import React__default, { useState as useState$1, useMemo as useMemo$1, useCallback, useRef, useEffect } from 'react';
|
|
9
8
|
import ReactDOM, { unstable_batchedUpdates, createPortal, flushSync } from 'react-dom';
|
|
10
9
|
import CSSMotion from 'rc-motion';
|
|
11
10
|
import clsx from 'clsx';
|
|
12
|
-
import { _ as _typeof$2 } from './typeof-
|
|
11
|
+
import { _ as _typeof$2 } from './typeof-c310ee4a.js';
|
|
13
12
|
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
|
|
14
13
|
import Right from '@para-ui/icons/Right';
|
|
15
14
|
import Down from '@para-ui/icons/Down';
|
|
@@ -39,6 +38,22 @@ function _extends() {
|
|
|
39
38
|
return _extends.apply(this, arguments);
|
|
40
39
|
}
|
|
41
40
|
|
|
41
|
+
function _arrayWithoutHoles(arr) {
|
|
42
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _iterableToArray(iter) {
|
|
46
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _nonIterableSpread() {
|
|
50
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function _toConsumableArray(arr) {
|
|
54
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
55
|
+
}
|
|
56
|
+
|
|
42
57
|
function ownKeys(e, r) {
|
|
43
58
|
var t = Object.keys(e);
|
|
44
59
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { TextField } from '../TextField/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { b as _slicedToArray } from './slicedToArray-8223a2ef.js';
|
|
5
5
|
import { RadioGroup } from '../RadioGroup/index.js';
|
|
6
6
|
import Select from '../Select/index.js';
|
|
7
7
|
import { CheckboxGroup } from '../CheckboxGroup/index.js';
|