antd-solid 0.0.21 → 0.0.23
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/css/index.css +1 -1
- package/dist/index.esm.js +2604 -1107
- package/dist/index.umd.js +1 -1
- package/es/Button/index.d.ts +5 -2
- package/es/Button/index.js +21 -8
- package/es/Checkbox/Group.js +2 -2
- package/es/Checkbox/index.js +26 -13
- package/es/CodeInput/index.js +3 -0
- package/es/Collapse/Item.js +50 -8
- package/es/Collapse/index.js +5 -3
- package/es/ColorPicker/ColorPickerInput.js +225 -210
- package/es/ColorPicker/ColorPickerSelect.js +61 -4
- package/es/ColorPicker/ColorPickerSlider.js +100 -67
- package/es/ColorPicker/index.js +66 -17
- package/es/ContextMenu/index.js +5 -1
- package/es/Cursor/index.d.ts +13 -2
- package/es/Cursor/index.js +59 -16
- package/es/Divider/index.js +12 -3
- package/es/Drawer/index.js +89 -43
- package/es/Dropdown/index.js +4 -2
- package/es/Element/index.js +2 -6
- package/es/Empty/PRESENTED_IMAGE_SIMPLE.js +12 -4
- package/es/Empty/assets/EmptySvg.js +3 -3
- package/es/Empty/assets/SimpleEmptySvg.js +3 -3
- package/es/Empty/index.js +12 -4
- package/es/Form/FormItem.js +76 -47
- package/es/Fragment/index.js +3 -1
- package/es/Image/index.js +31 -11
- package/es/Input/TextArea.js +31 -5
- package/es/Input/index.d.ts +5 -0
- package/es/Input/index.js +123 -46
- package/es/InputNumber/index.js +11 -4
- package/es/Menu/InternalMenu.js +96 -38
- package/es/Message/Message.js +11 -7
- package/es/Modal/index.js +107 -55
- package/es/Modal/useModal.js +14 -5
- package/es/Modal/warning.js +14 -5
- package/es/Popconfirm/index.js +36 -24
- package/es/Popover/index.js +20 -11
- package/es/Progress/Circle.js +63 -14
- package/es/Progress/index.js +38 -14
- package/es/Radio/Button.js +20 -4
- package/es/Radio/index.js +35 -5
- package/es/RangeInput/index.js +80 -24
- package/es/Result/index.js +27 -6
- package/es/Segmented/index.js +33 -13
- package/es/Select/index.d.ts +1 -1
- package/es/Select/index.js +39 -7
- package/es/SelectInput/index.d.ts +2 -1
- package/es/SelectInput/index.js +119 -51
- package/es/Slider/index.js +84 -11
- package/es/Space/index.js +2 -2
- package/es/Spin/index.js +26 -14
- package/es/Switch/index.js +6 -4
- package/es/Table/index.js +40 -18
- package/es/Tabs/index.js +195 -91
- package/es/Timeline/index.d.ts +1 -2
- package/es/Timeline/index.js +14 -4
- package/es/Tooltip/index.d.ts +1 -1
- package/es/Tooltip/index.js +40 -20
- package/es/Transformer/index.js +123 -59
- package/es/Tree/SingleLevelTree.js +191 -30
- package/es/TreeFor/index.js +3 -3
- package/es/TreeSelect/index.js +6 -4
- package/es/Upload/index.js +38 -4
- package/es/assets/svg/ColorPickUp.js +19 -6
- package/es/assets/svg/Crosshair.js +45 -6
- package/es/assets/svg/Resize.js +19 -6
- package/es/assets/svg/Rotate.js +14 -13
- package/es/assets/svg/RotateArrow.js +15 -20
- package/es/hooks/useClickAway.js +4 -6
- package/es/index.d.ts +1 -1
- package/es/utils/setupGlobalDrag.js +13 -4
- package/package.json +12 -14
- package/es/utils/DOMRect.d.ts +0 -22
- package/es/utils/DOMRect.js +0 -41
package/es/Upload/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { delegateEvents, insert, use, effect, className, setAttribute, template } from 'solid-js/web';
|
|
2
2
|
import { nanoid } from 'nanoid';
|
|
3
|
-
import { mergeProps } from 'solid-js';
|
|
3
|
+
import { mergeProps, createSignal } from 'solid-js';
|
|
4
4
|
|
|
5
|
-
var _tmpl$ =
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/template(`<span><input class=hidden type=file>`);
|
|
6
6
|
/**
|
|
7
7
|
* 根据一个 File 对象创建一个 UploadFile 对象
|
|
8
8
|
* @param file
|
|
@@ -55,6 +55,7 @@ async function request(uploadFileSignal, customRequest) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
const Upload = _props => {
|
|
58
|
+
let input;
|
|
58
59
|
const props = mergeProps({
|
|
59
60
|
customRequest: ({
|
|
60
61
|
file,
|
|
@@ -70,9 +71,42 @@ const Upload = _props => {
|
|
|
70
71
|
}).then(onSuccess).catch(onError);
|
|
71
72
|
}
|
|
72
73
|
}, _props);
|
|
73
|
-
return
|
|
74
|
+
return (() => {
|
|
75
|
+
var _el$ = _tmpl$(),
|
|
76
|
+
_el$2 = _el$.firstChild;
|
|
77
|
+
_el$.$$click = () => input?.click();
|
|
78
|
+
insert(_el$, () => props.children, _el$2);
|
|
79
|
+
_el$2.$$input = e => {
|
|
80
|
+
const fileList = [];
|
|
81
|
+
for (const file of Array.from(e.target.files ?? [])) {
|
|
82
|
+
// eslint-disable-next-line solid/reactivity
|
|
83
|
+
const uploadFileSignal = createSignal(createUploadFile(file));
|
|
84
|
+
request(uploadFileSignal, props.customRequest);
|
|
85
|
+
fileList.push(uploadFileSignal);
|
|
86
|
+
}
|
|
87
|
+
props.onAdd?.(fileList);
|
|
88
|
+
e.target.value = '';
|
|
89
|
+
};
|
|
90
|
+
var _ref$ = input;
|
|
91
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : input = _el$2;
|
|
92
|
+
effect(_p$ => {
|
|
93
|
+
var _v$ = props.class,
|
|
94
|
+
_v$2 = props.accept,
|
|
95
|
+
_v$3 = props.multiple;
|
|
96
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
97
|
+
_v$2 !== _p$.t && setAttribute(_el$2, "accept", _p$.t = _v$2);
|
|
98
|
+
_v$3 !== _p$.a && (_el$2.multiple = _p$.a = _v$3);
|
|
99
|
+
return _p$;
|
|
100
|
+
}, {
|
|
101
|
+
e: undefined,
|
|
102
|
+
t: undefined,
|
|
103
|
+
a: undefined
|
|
104
|
+
});
|
|
105
|
+
return _el$;
|
|
106
|
+
})();
|
|
74
107
|
};
|
|
75
108
|
Upload.request = request;
|
|
76
109
|
Upload.createUploadFile = createUploadFile;
|
|
110
|
+
delegateEvents(["click", "input"]);
|
|
77
111
|
|
|
78
112
|
export { Upload as default };
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { effect, setAttribute, style, template } from 'solid-js/web';
|
|
2
2
|
import { commonStyle } from './common.js';
|
|
3
3
|
|
|
4
|
-
var _tmpl$ =
|
|
4
|
+
var _tmpl$ = /*#__PURE__*/template(`<svg viewBox="0 0 1024 1024"xmlns=http://www.w3.org/2000/svg><path d="M856.2176 347.904l-90.624 90.624 53.504 53.504a52.3264 52.3264 0 1 1-73.984 73.984l-71.5776-71.6288-444.928 444.9792a25.6 25.6 0 0 1-13.4656 7.0656l-133.1712 24.576a25.6 25.6 0 0 1-29.7984-29.7984l24.576-133.1712a25.6 25.6 0 0 1 7.0656-13.4656l444.928-444.9792-71.68-71.6288a52.3264 52.3264 0 0 1 73.984-73.984l53.504 53.504 90.624-90.624a128 128 0 0 1 181.0432 181.0432z m-291.328 37.888l-439.296 439.3472-16.384 88.7808 88.832-16.384 439.296-439.296-72.448-72.448z">`);
|
|
5
5
|
const ColorPickUpSvg = props => {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
return (() => {
|
|
7
|
+
var _el$ = _tmpl$();
|
|
8
|
+
effect(_p$ => {
|
|
9
|
+
var _v$ = props.class,
|
|
10
|
+
_v$2 = {
|
|
11
|
+
...commonStyle,
|
|
12
|
+
...props.style
|
|
13
|
+
};
|
|
14
|
+
_v$ !== _p$.e && setAttribute(_el$, "class", _p$.e = _v$);
|
|
15
|
+
_p$.t = style(_el$, _v$2, _p$.t);
|
|
16
|
+
return _p$;
|
|
17
|
+
}, {
|
|
18
|
+
e: undefined,
|
|
19
|
+
t: undefined
|
|
20
|
+
});
|
|
21
|
+
return _el$;
|
|
22
|
+
})();
|
|
10
23
|
};
|
|
11
24
|
|
|
12
25
|
export { ColorPickUpSvg as default };
|
|
@@ -1,12 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { use, effect, setAttribute, style, template } from 'solid-js/web';
|
|
2
2
|
import { commonStyle } from './common.js';
|
|
3
3
|
|
|
4
|
-
var _tmpl$ =
|
|
4
|
+
var _tmpl$ = /*#__PURE__*/template(`<svg viewBox="0 0 26 26"version=1.1 xmlns=http://www.w3.org/2000/svg><line x1=50% x2=50% y2=100% stroke-width=3></line><line x1=50% x2=50% y2=100% stroke-width=1></line><line x1=100% y1=50% y2=50% stroke-width=3></line><line x1=100% y1=50% y2=50% stroke-width=1></line><circle cx=50% cy=50% r=32.7% fill=none stroke-width=3></circle><circle cx=50% cy=50% r=32.7% fill=none stroke-width=1>`);
|
|
5
5
|
const CrosshairSvg = props => {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
return (() => {
|
|
7
|
+
var _el$ = _tmpl$(),
|
|
8
|
+
_el$2 = _el$.firstChild,
|
|
9
|
+
_el$3 = _el$2.nextSibling,
|
|
10
|
+
_el$4 = _el$3.nextSibling,
|
|
11
|
+
_el$5 = _el$4.nextSibling,
|
|
12
|
+
_el$6 = _el$5.nextSibling,
|
|
13
|
+
_el$7 = _el$6.nextSibling;
|
|
14
|
+
var _ref$ = props.ref;
|
|
15
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : props.ref = _el$;
|
|
16
|
+
effect(_p$ => {
|
|
17
|
+
var _v$ = props.class,
|
|
18
|
+
_v$2 = {
|
|
19
|
+
...commonStyle,
|
|
20
|
+
...props.style
|
|
21
|
+
},
|
|
22
|
+
_v$3 = props.outerColor,
|
|
23
|
+
_v$4 = props.innerColor,
|
|
24
|
+
_v$5 = props.outerColor,
|
|
25
|
+
_v$6 = props.innerColor,
|
|
26
|
+
_v$7 = props.outerColor,
|
|
27
|
+
_v$8 = props.innerColor;
|
|
28
|
+
_v$ !== _p$.e && setAttribute(_el$, "class", _p$.e = _v$);
|
|
29
|
+
_p$.t = style(_el$, _v$2, _p$.t);
|
|
30
|
+
_v$3 !== _p$.a && setAttribute(_el$2, "stroke", _p$.a = _v$3);
|
|
31
|
+
_v$4 !== _p$.o && setAttribute(_el$3, "stroke", _p$.o = _v$4);
|
|
32
|
+
_v$5 !== _p$.i && setAttribute(_el$4, "stroke", _p$.i = _v$5);
|
|
33
|
+
_v$6 !== _p$.n && setAttribute(_el$5, "stroke", _p$.n = _v$6);
|
|
34
|
+
_v$7 !== _p$.s && setAttribute(_el$6, "stroke", _p$.s = _v$7);
|
|
35
|
+
_v$8 !== _p$.h && setAttribute(_el$7, "stroke", _p$.h = _v$8);
|
|
36
|
+
return _p$;
|
|
37
|
+
}, {
|
|
38
|
+
e: undefined,
|
|
39
|
+
t: undefined,
|
|
40
|
+
a: undefined,
|
|
41
|
+
o: undefined,
|
|
42
|
+
i: undefined,
|
|
43
|
+
n: undefined,
|
|
44
|
+
s: undefined,
|
|
45
|
+
h: undefined
|
|
46
|
+
});
|
|
47
|
+
return _el$;
|
|
48
|
+
})();
|
|
10
49
|
};
|
|
11
50
|
|
|
12
51
|
export { CrosshairSvg as default };
|
package/es/assets/svg/Resize.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { effect, setAttribute, style, template } from 'solid-js/web';
|
|
2
2
|
import { commonStyle } from './common.js';
|
|
3
3
|
|
|
4
|
-
var _tmpl$ =
|
|
4
|
+
var _tmpl$ = /*#__PURE__*/template(`<svg viewBox="0 0 1024 1024"xmlns=http://www.w3.org/2000/svg><path fill=black stroke=white stroke-width=50 d="M531.2 179.2l130.133333 140.8c4.266667 4.266667 6.4 10.666667 6.4 14.933333-2.133333 4.266667-6.4 6.4-14.933333 6.4h-85.333333v341.333334h85.333333c8.533333 0 12.8 2.133333 14.933333 6.4 2.133333 4.266667 0 8.533333-6.4 14.933333l-130.133333 140.8c-4.266667 6.4-12.8 8.533333-19.2 8.533333s-14.933333-2.133333-19.2-8.533333l-130.133333-140.8c-4.266667-4.266667-6.4-10.666667-6.4-14.933333 2.133333-4.266667 6.4-6.4 14.933333-6.4h85.333333v-341.333334h-85.333333c-8.533333 0-12.8-2.133333-14.933333-6.4-2.133333-4.266667 0-8.533333 6.4-14.933333l130.133333-140.8c4.266667-6.4 12.8-8.533333 19.2-8.533333s14.933333 2.133333 19.2 8.533333z">`);
|
|
5
5
|
const Resize = props => {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
return (() => {
|
|
7
|
+
var _el$ = _tmpl$();
|
|
8
|
+
effect(_p$ => {
|
|
9
|
+
var _v$ = props.class,
|
|
10
|
+
_v$2 = {
|
|
11
|
+
...commonStyle,
|
|
12
|
+
...props.style
|
|
13
|
+
};
|
|
14
|
+
_v$ !== _p$.e && setAttribute(_el$, "class", _p$.e = _v$);
|
|
15
|
+
_p$.t = style(_el$, _v$2, _p$.t);
|
|
16
|
+
return _p$;
|
|
17
|
+
}, {
|
|
18
|
+
e: undefined,
|
|
19
|
+
t: undefined
|
|
20
|
+
});
|
|
21
|
+
return _el$;
|
|
22
|
+
})();
|
|
10
23
|
};
|
|
11
24
|
|
|
12
25
|
export { Resize as default };
|
package/es/assets/svg/Rotate.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spread, mergeProps, template } from 'solid-js/web';
|
|
2
2
|
import { commonStyle } from './common.js';
|
|
3
3
|
|
|
4
|
-
var _tmpl$ = "
|
|
4
|
+
var _tmpl$ = /*#__PURE__*/template(`<svg viewBox="0 0 27 27"xmlns=http://www.w3.org/2000/svg><g><path data-follow-fill=currentColor fill-rule=evenodd clip-rule=evenodd d="M13.55 27c7.269 0 13.161-5.893 13.161-13.162C26.711 6.569 20.82.677 13.55.677 6.281.677.389 6.569.389 13.838c0 7.269 5.892 13.161 13.161 13.161Zm8.062-10.286 2.062-2.872c.409-.556.22-1.08-.45-1.08h-1.17c-.508-4.132-4.116-7.479-8.502-7.479-2.324 0-4.443.99-5.932 2.52-.467.426-.467 1.015-.131 1.367.343.376.9.442 1.415 0a6.48 6.48 0 0 1 4.648-1.964c3.371 0 6.071 2.455 6.562 5.556h-1.276c-.655 0-.851.524-.45 1.08l2.07 2.872c.32.45.826.45 1.154 0Zm-8.061 5.678c2.34 0 4.459-.99 5.948-2.52.459-.434.459-1.023.131-1.375-.352-.376-.9-.433-1.424.008a6.457 6.457 0 0 1-4.655 1.964 6.61 6.61 0 0 1-6.555-5.556h1.26c.663 0 .851-.523.45-1.072l-2.062-2.88c-.327-.45-.834-.45-1.153 0l-2.07 2.872c-.401.557-.221 1.08.45 1.08h1.186c.507 4.133 4.116 7.48 8.494 7.48Z"fill=currentColor>`);
|
|
5
5
|
const Rotate = props => {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
6
|
+
return (() => {
|
|
7
|
+
var _el$ = _tmpl$();
|
|
8
|
+
spread(_el$, mergeProps(props, {
|
|
9
|
+
get style() {
|
|
10
|
+
return {
|
|
11
|
+
...commonStyle,
|
|
12
|
+
...props.style
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}), true, true);
|
|
16
|
+
return _el$;
|
|
17
|
+
})();
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export { Rotate as default };
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spread, mergeProps, template } from 'solid-js/web';
|
|
2
2
|
import { commonStyle } from './common.js';
|
|
3
3
|
|
|
4
|
-
var _tmpl$ =
|
|
4
|
+
var _tmpl$ = /*#__PURE__*/template(`<svg viewBox="0 0 1000 1000"xmlns=http://www.w3.org/2000/svg><path fill=black stroke-width=50 stroke=white d="M 100,700 l 210,-150 v 105 Q 700,700 655,310 h -105 L 700,100 l 150,210 h -105 Q 745,745 310,745 v 105 L 100,700">`);
|
|
5
5
|
const RotateArrowSvg = props => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...commonStyle,
|
|
20
|
-
...props.style
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}), () => ssr(_tmpl$, `M ${escape(startX, true)},${escape(startY, true)} l ${escape(arrowLength, true)},${-halfArrowWidth} v ${escape(halfArrowWidth, true) - escape(halfCurveWidth, true)} Q ${escape(startY, true)},${escape(startY, true)} ${escape(startY, true) - escape(halfCurveWidth, true)},${escape(startX, true) + escape(arrowLength, true)} h ${escape(halfCurveWidth, true) - escape(halfArrowWidth, true)} L ${escape(startY, true)},${escape(startX, true)} l ${escape(halfArrowWidth, true)},${escape(arrowLength, true)} h ${escape(halfCurveWidth, true) - escape(halfArrowWidth, true)} Q ${escape(startY, true) + escape(halfCurveWidth, true)},${escape(startY, true) + escape(halfCurveWidth, true)} ${escape(startX, true) + escape(arrowLength, true)},${escape(startY, true) + escape(halfCurveWidth, true)} v ${escape(halfArrowWidth, true) - escape(halfCurveWidth, true)} L ${escape(startX, true)},${escape(startY, true)}`), true);
|
|
6
|
+
return (() => {
|
|
7
|
+
var _el$ = _tmpl$();
|
|
8
|
+
_el$.firstChild;
|
|
9
|
+
spread(_el$, mergeProps(props, {
|
|
10
|
+
get style() {
|
|
11
|
+
return {
|
|
12
|
+
...commonStyle,
|
|
13
|
+
...props.style
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}), true, true);
|
|
17
|
+
return _el$;
|
|
18
|
+
})();
|
|
24
19
|
};
|
|
25
20
|
|
|
26
21
|
export { RotateArrowSvg as default };
|
package/es/hooks/useClickAway.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onCleanup } from 'solid-js';
|
|
2
2
|
import { compact } from 'lodash-es';
|
|
3
3
|
import { toArray } from '../utils/array.js';
|
|
4
4
|
|
|
@@ -9,11 +9,9 @@ function useClickAway(onClickAway, target) {
|
|
|
9
9
|
onClickAway(event);
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
window.removeEventListener('click', onClick);
|
|
16
|
-
});
|
|
12
|
+
window.addEventListener('click', onClick);
|
|
13
|
+
onCleanup(() => {
|
|
14
|
+
window.removeEventListener('click', onClick);
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
|
package/es/index.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export type { DropdownProps } from './Dropdown';
|
|
|
69
69
|
export { default as Element } from './Element';
|
|
70
70
|
export type { ElementProps } from './Element';
|
|
71
71
|
export { default as Cursor } from './Cursor';
|
|
72
|
-
export type { CursorProps } from './Cursor';
|
|
72
|
+
export type { CursorProps, CursorIntance } from './Cursor';
|
|
73
73
|
export { default as Space } from './Space';
|
|
74
74
|
export { default as CodeInput } from './CodeInput';
|
|
75
75
|
export type { CodeInputProps } from './CodeInput';
|
|
@@ -8,15 +8,23 @@
|
|
|
8
8
|
* @param cursor - 拖拽过程中的 style.cursor
|
|
9
9
|
*/
|
|
10
10
|
function setupGlobalDrag(onMove, onEnd, cursor) {
|
|
11
|
-
|
|
11
|
+
// 防止拖拽时误选中文字等
|
|
12
|
+
const originalUserSelect = document.body.style.userSelect;
|
|
13
|
+
document.body.style.userSelect = 'none';
|
|
12
14
|
const originalCursor = document.documentElement.style.cursor;
|
|
13
15
|
if (cursor) {
|
|
14
16
|
document.documentElement.style.cursor = cursor;
|
|
15
17
|
}
|
|
18
|
+
// 防止 mouseup 被 disabled 元素吞掉
|
|
19
|
+
const style = document.createElement('style');
|
|
20
|
+
style.textContent = `
|
|
21
|
+
:disabled {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
document.head.appendChild(style);
|
|
16
26
|
const abortController = new AbortController();
|
|
17
27
|
window.addEventListener('mousemove', e => {
|
|
18
|
-
// 延迟设置 document.body.style.pointerEvents,直到 mousemove 触发,这样才算 drag。避免影响自身及子元素的 click 事件
|
|
19
|
-
document.body.style.pointerEvents = 'none'; // 防止 mouseup 被 disabled 元素吞掉,以及拖拽时误选中文字等
|
|
20
28
|
onMove(e);
|
|
21
29
|
}, {
|
|
22
30
|
signal: abortController.signal,
|
|
@@ -24,10 +32,11 @@ function setupGlobalDrag(onMove, onEnd, cursor) {
|
|
|
24
32
|
});
|
|
25
33
|
window.addEventListener('mouseup', e => {
|
|
26
34
|
onEnd?.(e);
|
|
27
|
-
document.body.style.
|
|
35
|
+
document.body.style.userSelect = originalUserSelect;
|
|
28
36
|
if (cursor) {
|
|
29
37
|
document.documentElement.style.cursor = originalCursor;
|
|
30
38
|
}
|
|
39
|
+
document.head.removeChild(style);
|
|
31
40
|
abortController.abort();
|
|
32
41
|
}, {
|
|
33
42
|
once: true,
|
package/package.json
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"types": "es/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"docs:dev": "vitepress dev docs",
|
|
11
|
-
"docs:build": "node scripts/annotationNonProductionCode && vitepress build docs && node scripts/cancelAnnotationNonProductionCode",
|
|
12
|
-
"docs:preview": "vitepress preview docs",
|
|
13
|
-
"build": "rm -rf dist && rm -rf es && rm -rf css && NODE_ENV=production && npx rollup -c && npm run build:unocss",
|
|
14
|
-
"build:unocss": "npx unocss './src/**' -o css/index.css -m",
|
|
15
|
-
"test": "vitest",
|
|
16
|
-
"prepare": "husky install"
|
|
17
|
-
},
|
|
18
9
|
"devDependencies": {
|
|
19
10
|
"@iconify-json/ant-design": "^1.1.5",
|
|
20
11
|
"@rollup/plugin-babel": "^6.0.3",
|
|
@@ -32,7 +23,7 @@
|
|
|
32
23
|
"@unocss/reset": "^0.57.1",
|
|
33
24
|
"@unocss/transformer-variant-group": "^0.51.6",
|
|
34
25
|
"@unocss/vite": "^0.51.6",
|
|
35
|
-
"babel-preset-solid": "^1.
|
|
26
|
+
"babel-preset-solid": "^1.7.3",
|
|
36
27
|
"eslint": "^8.56.0",
|
|
37
28
|
"eslint-config-prettier": "^8.8.0",
|
|
38
29
|
"eslint-config-standard-with-typescript": "^43.0.0",
|
|
@@ -61,7 +52,6 @@
|
|
|
61
52
|
"dependencies": {
|
|
62
53
|
"@ant-design/colors": "^7.0.2",
|
|
63
54
|
"@ctrl/tinycolor": "^4.1.0",
|
|
64
|
-
"antd": "^5.10.2",
|
|
65
55
|
"classnames": "^2.3.2",
|
|
66
56
|
"lodash-es": "^4.17.21",
|
|
67
57
|
"nanoid": "^5.0.1",
|
|
@@ -81,5 +71,13 @@
|
|
|
81
71
|
"dist",
|
|
82
72
|
"es",
|
|
83
73
|
"css"
|
|
84
|
-
]
|
|
85
|
-
|
|
74
|
+
],
|
|
75
|
+
"scripts": {
|
|
76
|
+
"docs:dev": "vitepress dev docs",
|
|
77
|
+
"docs:build": "node scripts/annotationNonProductionCode && vitepress build docs && node scripts/cancelAnnotationNonProductionCode",
|
|
78
|
+
"docs:preview": "vitepress preview docs",
|
|
79
|
+
"build": "rm -rf dist && rm -rf es && rm -rf css && NODE_ENV=production && npx rollup -c && npm run build:unocss",
|
|
80
|
+
"build:unocss": "npx unocss './src/**' -o css/index.css -m",
|
|
81
|
+
"test": "vitest"
|
|
82
|
+
}
|
|
83
|
+
}
|
package/es/utils/DOMRect.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare class DOMRect {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
7
|
-
static fromRect(otherRect: DOMRect): DOMRect;
|
|
8
|
-
get top(): number;
|
|
9
|
-
get left(): number;
|
|
10
|
-
get right(): number;
|
|
11
|
-
get bottom(): number;
|
|
12
|
-
toJSON(): {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
top: number;
|
|
18
|
-
left: number;
|
|
19
|
-
right: number;
|
|
20
|
-
bottom: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
package/es/utils/DOMRect.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
class DOMRect {
|
|
2
|
-
x;
|
|
3
|
-
y;
|
|
4
|
-
width;
|
|
5
|
-
height;
|
|
6
|
-
constructor(x = 0, y = 0, width = 0, height = 0) {
|
|
7
|
-
this.x = x;
|
|
8
|
-
this.y = y;
|
|
9
|
-
this.width = width;
|
|
10
|
-
this.height = height;
|
|
11
|
-
}
|
|
12
|
-
static fromRect(otherRect) {
|
|
13
|
-
return new DOMRect(otherRect.x, otherRect.y, otherRect.width, otherRect.height);
|
|
14
|
-
}
|
|
15
|
-
get top() {
|
|
16
|
-
return this.y;
|
|
17
|
-
}
|
|
18
|
-
get left() {
|
|
19
|
-
return this.x;
|
|
20
|
-
}
|
|
21
|
-
get right() {
|
|
22
|
-
return this.x + this.width;
|
|
23
|
-
}
|
|
24
|
-
get bottom() {
|
|
25
|
-
return this.y + this.height;
|
|
26
|
-
}
|
|
27
|
-
toJSON() {
|
|
28
|
-
return {
|
|
29
|
-
x: this.x,
|
|
30
|
-
y: this.y,
|
|
31
|
-
width: this.width,
|
|
32
|
-
height: this.height,
|
|
33
|
-
top: this.top,
|
|
34
|
-
left: this.left,
|
|
35
|
-
right: this.right,
|
|
36
|
-
bottom: this.bottom
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { DOMRect };
|