antd-solid 0.0.20 → 0.0.22
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 +2508 -1078
- package/dist/index.umd.js +1 -1
- package/es/Button/index.js +25 -7
- 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 +224 -210
- package/es/ColorPicker/ColorPickerSelect.js +61 -4
- package/es/ColorPicker/ColorPickerSlider.js +100 -67
- package/es/ColorPicker/index.js +62 -16
- package/es/ContextMenu/index.js +5 -1
- package/es/Cursor/index.js +15 -3
- package/es/Divider/index.js +12 -3
- package/es/Drawer/index.js +83 -42
- 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.js +103 -46
- package/es/InputNumber/index.js +11 -4
- package/es/Menu/InternalMenu.js +93 -37
- 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 +76 -22
- package/es/Result/index.js +27 -6
- package/es/Segmented/index.js +33 -13
- package/es/Select/index.js +35 -6
- package/es/SelectInput/index.js +112 -48
- 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.js +14 -4
- package/es/Tooltip/index.js +48 -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/package.json +2 -2
- package/es/utils/DOMRect.d.ts +0 -22
- package/es/utils/DOMRect.js +0 -41
package/es/Select/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent, mergeProps,
|
|
1
|
+
import { delegateEvents, createComponent, mergeProps, insert, effect, className, setAttribute, template } from 'solid-js/web';
|
|
2
2
|
import { splitProps, createMemo, createSelector, Show, For } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import { isEmpty } from 'lodash-es';
|
|
@@ -8,8 +8,8 @@ import SelectInput from '../SelectInput/index.js';
|
|
|
8
8
|
import Empty from '../Empty/index.js';
|
|
9
9
|
import { unwrapStringOrJSXElement } from '../utils/solid.js';
|
|
10
10
|
|
|
11
|
-
var _tmpl$ =
|
|
12
|
-
_tmpl$2 =
|
|
11
|
+
var _tmpl$ = /*#__PURE__*/template(`<div class=p-2px>`),
|
|
12
|
+
_tmpl$2 = /*#__PURE__*/template(`<div>`);
|
|
13
13
|
function Select(props) {
|
|
14
14
|
const [selectInputProps] = splitProps(props, ['multiple', 'allowClear', 'class', 'style', 'disabled', 'placeholder', 'status', 'size', 'variant', 'suffixIcon', 'placement', 'getPopupContainer']);
|
|
15
15
|
const [value, setValue] = createControllableValue(props);
|
|
@@ -32,15 +32,44 @@ function Select(props) {
|
|
|
32
32
|
return createComponent(Empty.PRESENTED_IMAGE_SIMPLE, {});
|
|
33
33
|
},
|
|
34
34
|
get children() {
|
|
35
|
-
|
|
35
|
+
var _el$ = _tmpl$();
|
|
36
|
+
insert(_el$, createComponent(For, {
|
|
36
37
|
get each() {
|
|
37
38
|
return props.options;
|
|
38
39
|
},
|
|
39
|
-
children: item =>
|
|
40
|
-
|
|
40
|
+
children: item => (() => {
|
|
41
|
+
var _el$2 = _tmpl$2();
|
|
42
|
+
_el$2.$$click = () => {
|
|
43
|
+
if (!props.multiple) {
|
|
44
|
+
setValue(item.value);
|
|
45
|
+
close();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (valueArr().includes(item.value)) {
|
|
49
|
+
setValue(valueArr().filter(v => v !== item.value));
|
|
50
|
+
} else {
|
|
51
|
+
setValue([...valueArr(), item.value]);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
insert(_el$2, () => unwrapStringOrJSXElement(item.label));
|
|
55
|
+
effect(_p$ => {
|
|
56
|
+
var _v$ = cs('ellipsis box-content px-12px py-5px min-h-22px leading-22px hover:bg-[var(--ant-select-option-active-bg)] cursor-pointer rounded-[var(--ant-border-radius-sm)]', selectedValue(item.value) ? '!bg-[var(--ant-select-option-selected-bg)]' : '', item.class),
|
|
57
|
+
_v$2 = typeof item.label === 'string' || typeof item.label === 'number' ? item.label.toString() : undefined;
|
|
58
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
59
|
+
_v$2 !== _p$.t && setAttribute(_el$2, "title", _p$.t = _v$2);
|
|
60
|
+
return _p$;
|
|
61
|
+
}, {
|
|
62
|
+
e: undefined,
|
|
63
|
+
t: undefined
|
|
64
|
+
});
|
|
65
|
+
return _el$2;
|
|
66
|
+
})()
|
|
67
|
+
}));
|
|
68
|
+
return _el$;
|
|
41
69
|
}
|
|
42
70
|
})
|
|
43
71
|
}));
|
|
44
72
|
}
|
|
73
|
+
delegateEvents(["click"]);
|
|
45
74
|
|
|
46
75
|
export { Select as default };
|
package/es/SelectInput/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { delegateEvents, createComponent, use, insert, effect, style, Dynamic, setAttribute, className, template } from 'solid-js/web';
|
|
2
2
|
import { useContext, mergeProps, createMemo, createSignal, Show, For } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import { compact, pick, isUndefined } from 'lodash-es';
|
|
@@ -9,15 +9,15 @@ import Element from '../Element/index.js';
|
|
|
9
9
|
import useComponentSize from '../hooks/useComponentSize.js';
|
|
10
10
|
import CompactContext from '../Compact/context.js';
|
|
11
11
|
|
|
12
|
-
var _tmpl$ =
|
|
13
|
-
_tmpl$2 =
|
|
14
|
-
_tmpl$3 =
|
|
15
|
-
_tmpl$4 =
|
|
16
|
-
_tmpl$5 =
|
|
17
|
-
_tmpl$6 =
|
|
18
|
-
_tmpl$7 =
|
|
19
|
-
_tmpl$8 =
|
|
20
|
-
_tmpl$9 =
|
|
12
|
+
var _tmpl$ = /*#__PURE__*/template(`<div class=w-full>`),
|
|
13
|
+
_tmpl$2 = /*#__PURE__*/template(`<span class="right-[--ant-select-input-padding-right] i-ant-design:close-circle-filled cursor-pointer text-[var(--ant-color-text-quaternary)] hover:text-[var(--ant-color-text-tertiary)] active:text-[var(--ant-color-text)]">`),
|
|
14
|
+
_tmpl$3 = /*#__PURE__*/template(`<div tabindex=0><div>`),
|
|
15
|
+
_tmpl$4 = /*#__PURE__*/template(`<div class="w-[--ant-select-popup-match-width] max-h-400px overflow-auto [font-size:var(--ant-select-popup-font-size)]">`),
|
|
16
|
+
_tmpl$5 = /*#__PURE__*/template(`<span class="inline-block w-0"> `),
|
|
17
|
+
_tmpl$6 = /*#__PURE__*/template(`<span class="block w-full h-[calc(var(--ant-select-input-height)-2px)] leading-[calc(var(--ant-select-input-height)-2px)] text-[var(--ant-color-text-placeholder)]">`),
|
|
18
|
+
_tmpl$7 = /*#__PURE__*/template(`<div class="w-full h-[calc(var(--ant-select-input-height)-2px)] leading-[calc(var(--ant-select-input-height)-2px)] ellipsis">`),
|
|
19
|
+
_tmpl$8 = /*#__PURE__*/template(`<span class="inline-block my-2px mr-4px bg-[var(--ant-select-multiple-item-bg)] leading-[var(--ant-select-multiple-item-height)] h-[var(--ant-select-multiple-item-height)] pl-8px pr-4px rounded-[var(--ant-border-radius-sm)]"><span class="i-ant-design:close-outlined text-[var(--ant-color-icon)] hover:text-[var(--ant-color-icon-hover)] text-12px cursor-pointer">`),
|
|
20
|
+
_tmpl$9 = /*#__PURE__*/template(`<span class="i-ant-design:down-outlined text-[var(--ant-color-text-quaternary)] text-12px">`);
|
|
21
21
|
function SelectInput(_props) {
|
|
22
22
|
let select;
|
|
23
23
|
let tooltipContent;
|
|
@@ -44,7 +44,7 @@ function SelectInput(_props) {
|
|
|
44
44
|
const [hover, setHover] = createSignal(false);
|
|
45
45
|
const showClearBtn = createMemo(() => props.allowClear && hover() && valueArr().length > 0);
|
|
46
46
|
const optionLabelRender = v => props.labelRender ? props.labelRender(v) : String(v);
|
|
47
|
-
const style = createMemo(() => ({
|
|
47
|
+
const style$1 = createMemo(() => ({
|
|
48
48
|
'--ant-select-input-font-size': {
|
|
49
49
|
small: 'var(--ant-font-size)',
|
|
50
50
|
middle: 'var(--ant-font-size)',
|
|
@@ -67,11 +67,15 @@ function SelectInput(_props) {
|
|
|
67
67
|
...props.style
|
|
68
68
|
}));
|
|
69
69
|
return createComponent(Element, {
|
|
70
|
+
ref(r$) {
|
|
71
|
+
var _ref$ = select;
|
|
72
|
+
typeof _ref$ === "function" ? _ref$(r$) : select = r$;
|
|
73
|
+
},
|
|
70
74
|
get ["class"]() {
|
|
71
75
|
return cs('!p[.ant-input-addon]:my--1px !p[.ant-input-addon]:mx--12px', 'rounded-6px cursor-pointer inline-block text-[var(--ant-color-text)] leading-[var(--ant-line-height)]', isCompact && 'ant-compact-item', props.class, props.disabled && 'cursor-not-allowed');
|
|
72
76
|
},
|
|
73
77
|
get style() {
|
|
74
|
-
return style();
|
|
78
|
+
return style$1();
|
|
75
79
|
},
|
|
76
80
|
get children() {
|
|
77
81
|
return createComponent(Tooltip, {
|
|
@@ -88,42 +92,47 @@ function SelectInput(_props) {
|
|
|
88
92
|
contentStyle: {
|
|
89
93
|
padding: 0
|
|
90
94
|
},
|
|
91
|
-
content: () =>
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
content: () => (() => {
|
|
96
|
+
var _el$5 = _tmpl$4();
|
|
97
|
+
var _ref$2 = tooltipContent;
|
|
98
|
+
typeof _ref$2 === "function" ? use(_ref$2, _el$5) : tooltipContent = _el$5;
|
|
99
|
+
insert(_el$5, () => props.content(() => setOpen(false)));
|
|
100
|
+
effect(_$p => style(_el$5, {
|
|
101
|
+
...pick(style$1(), ['--ant-select-popup-font-size', '--ant-select-popup-match-width'])
|
|
102
|
+
}, _$p));
|
|
103
|
+
return _el$5;
|
|
104
|
+
})(),
|
|
94
105
|
get getPopupContainer() {
|
|
95
106
|
return props.getPopupContainer;
|
|
96
107
|
},
|
|
97
108
|
get children() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
middle: '32px',
|
|
109
|
-
large: '40px'
|
|
110
|
-
}[size()], true) + (";--ant-select-multiple-item-height:" + escape({
|
|
111
|
-
small: '16px',
|
|
112
|
-
middle: '24px',
|
|
113
|
-
large: '32px'
|
|
114
|
-
}[size()], true)), escape(createComponent(Show, {
|
|
109
|
+
var _el$ = _tmpl$3(),
|
|
110
|
+
_el$3 = _el$.firstChild;
|
|
111
|
+
_el$.addEventListener("mouseleave", () => setHover(false));
|
|
112
|
+
_el$.addEventListener("mouseenter", () => setHover(true));
|
|
113
|
+
_el$.$$click = e => {
|
|
114
|
+
setOpen(v => !v);
|
|
115
|
+
setPopupMatchWidth(e.currentTarget.offsetWidth);
|
|
116
|
+
e.currentTarget.focus();
|
|
117
|
+
};
|
|
118
|
+
insert(_el$, createComponent(Show, {
|
|
115
119
|
get when() {
|
|
116
120
|
return valueArr().length;
|
|
117
121
|
},
|
|
118
122
|
get fallback() {
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
return (() => {
|
|
124
|
+
var _el$6 = _tmpl$6();
|
|
125
|
+
insert(_el$6, () => props.placeholder, null);
|
|
126
|
+
insert(_el$6, createComponent(Show, {
|
|
127
|
+
get when() {
|
|
128
|
+
return !props.placeholder;
|
|
129
|
+
},
|
|
130
|
+
get children() {
|
|
131
|
+
return _tmpl$5();
|
|
132
|
+
}
|
|
133
|
+
}), null);
|
|
134
|
+
return _el$6;
|
|
135
|
+
})();
|
|
127
136
|
},
|
|
128
137
|
get children() {
|
|
129
138
|
return createComponent(Show, {
|
|
@@ -134,24 +143,39 @@ function SelectInput(_props) {
|
|
|
134
143
|
return createComponent(Dynamic, {
|
|
135
144
|
component: () => {
|
|
136
145
|
const optionLabel = createMemo(() => optionLabelRender(valueArr()[0]));
|
|
137
|
-
return
|
|
146
|
+
return (() => {
|
|
147
|
+
var _el$8 = _tmpl$7();
|
|
148
|
+
insert(_el$8, optionLabel);
|
|
149
|
+
effect(() => setAttribute(_el$8, "title", typeof optionLabel() === 'string' ? optionLabel() : undefined));
|
|
150
|
+
return _el$8;
|
|
151
|
+
})();
|
|
138
152
|
}
|
|
139
153
|
});
|
|
140
154
|
},
|
|
141
155
|
get children() {
|
|
142
|
-
|
|
156
|
+
var _el$2 = _tmpl$();
|
|
157
|
+
insert(_el$2, createComponent(For, {
|
|
143
158
|
get each() {
|
|
144
159
|
return valueArr();
|
|
145
160
|
},
|
|
146
161
|
children: item => {
|
|
147
162
|
const optionLabel = createMemo(() => optionLabelRender(valueArr()[0]));
|
|
148
|
-
return
|
|
163
|
+
return (() => {
|
|
164
|
+
var _el$9 = _tmpl$8(),
|
|
165
|
+
_el$10 = _el$9.firstChild;
|
|
166
|
+
insert(_el$9, optionLabel, _el$10);
|
|
167
|
+
_el$10.$$click = () => setValue(valueArr().filter(v => v !== item));
|
|
168
|
+
effect(() => setAttribute(_el$9, "title", typeof optionLabel() === 'string' ? optionLabel() : undefined));
|
|
169
|
+
return _el$9;
|
|
170
|
+
})();
|
|
149
171
|
}
|
|
150
|
-
}))
|
|
172
|
+
}));
|
|
173
|
+
return _el$2;
|
|
151
174
|
}
|
|
152
175
|
});
|
|
153
176
|
}
|
|
154
|
-
})
|
|
177
|
+
}), _el$3);
|
|
178
|
+
insert(_el$3, createComponent(Show, {
|
|
155
179
|
get when() {
|
|
156
180
|
return showClearBtn();
|
|
157
181
|
},
|
|
@@ -164,18 +188,58 @@ function SelectInput(_props) {
|
|
|
164
188
|
return props.suffixIcon;
|
|
165
189
|
},
|
|
166
190
|
get children() {
|
|
167
|
-
return
|
|
191
|
+
return _tmpl$9();
|
|
168
192
|
}
|
|
169
193
|
});
|
|
170
194
|
},
|
|
171
195
|
get children() {
|
|
172
|
-
|
|
196
|
+
var _el$4 = _tmpl$2();
|
|
197
|
+
_el$4.$$click = e => {
|
|
198
|
+
e.stopPropagation();
|
|
199
|
+
setValue([]);
|
|
200
|
+
setOpen(false);
|
|
201
|
+
};
|
|
202
|
+
return _el$4;
|
|
173
203
|
}
|
|
174
|
-
}))
|
|
204
|
+
}));
|
|
205
|
+
effect(_p$ => {
|
|
206
|
+
var _v$ = cs('p[.ant-input-addon]:border-transparent p[.ant-input-addon]:bg-transparent p[.ant-input-addon]:focus-within:border-transparent p[.ant-input-addon]:hover:border-transparent p[.ant-input-addon]:focus-within:[box-shadow:none]', 'relative h-[--ant-select-input-height] rounded-inherit py-1px flex items-center [font-size:var(--ant-select-input-font-size)] p-[--ant-select-input-padding]', props.disabled && '[pointer-events:none] bg-[var(--ant-color-bg-container-disabled)] color-[var(--ant-color-text-disabled)]', props.variant === 'outlined' && {
|
|
207
|
+
default: cs('border-1px border-solid border-[--ant-color-border] bg-[--ant-color-bg-container]', !props.disabled && 'hover:border-[var(--ant-color-primary)] focus-within:border-[var(--ant-color-primary)] focus-within:[box-shadow:0_0_0_2px_var(--ant-control-outline)]'),
|
|
208
|
+
error: cs('border-1px border-solid border-[--ant-color-error] bg-[--ant-color-bg-container]', !props.disabled && 'hover:border-[var(--ant-color-error-border-hover)] focus-within:[box-shadow:0_0_0_2px_rgba(255,38,5,.06)]'),
|
|
209
|
+
warning: cs('border-1px border-solid border-[--ant-color-warning] bg-[--ant-color-bg-container]', !props.disabled && 'hover:border-[var(--ant-color-warning-border-hover)] focus-within:[box-shadow:0_0_0_2px_rgba(255,215,5,.1)]')
|
|
210
|
+
}[props.status ?? 'default'], props.variant === 'filled' && {
|
|
211
|
+
default: cs('bg-[--ant-color-fill-tertiary]', !props.disabled && 'hover:bg-[--ant-color-fill-secondary]'),
|
|
212
|
+
error: cs('bg-[--ant-color-error-bg]', !props.disabled && 'hover:bg-[--ant-color-error-bg-hover]'),
|
|
213
|
+
warning: cs('bg-[--ant-color-warning-bg]', !props.disabled && 'hover:bg-[--ant-color-warning-bg-hover]')
|
|
214
|
+
}[props.status ?? 'default']),
|
|
215
|
+
_v$2 = {
|
|
216
|
+
small: '24px',
|
|
217
|
+
middle: '32px',
|
|
218
|
+
large: '40px'
|
|
219
|
+
}[size()],
|
|
220
|
+
_v$3 = {
|
|
221
|
+
small: '16px',
|
|
222
|
+
middle: '24px',
|
|
223
|
+
large: '32px'
|
|
224
|
+
}[size()],
|
|
225
|
+
_v$4 = cs('shrink-0 flex justify-end items-center p-[--ant-select-input-addon-after-padding] empty:hidden');
|
|
226
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
227
|
+
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("--ant-select-input-height", _v$2) : _el$.style.removeProperty("--ant-select-input-height"));
|
|
228
|
+
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("--ant-select-multiple-item-height", _v$3) : _el$.style.removeProperty("--ant-select-multiple-item-height"));
|
|
229
|
+
_v$4 !== _p$.o && className(_el$3, _p$.o = _v$4);
|
|
230
|
+
return _p$;
|
|
231
|
+
}, {
|
|
232
|
+
e: undefined,
|
|
233
|
+
t: undefined,
|
|
234
|
+
a: undefined,
|
|
235
|
+
o: undefined
|
|
236
|
+
});
|
|
237
|
+
return _el$;
|
|
175
238
|
}
|
|
176
239
|
});
|
|
177
240
|
}
|
|
178
241
|
});
|
|
179
242
|
}
|
|
243
|
+
delegateEvents(["click"]);
|
|
180
244
|
|
|
181
245
|
export { SelectInput as default };
|
package/es/Slider/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent,
|
|
1
|
+
import { delegateEvents, createComponent, insert, memo, use, effect, className, setAttribute, style, template } from 'solid-js/web';
|
|
2
2
|
import { mergeProps, createMemo, createSignal, children, createEffect, onCleanup, Show } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import { clamp, isNil } from 'lodash-es';
|
|
@@ -9,11 +9,13 @@ import useHover from '../hooks/useHover.js';
|
|
|
9
9
|
import useFocus from '../hooks/useFocus.js';
|
|
10
10
|
import Element from '../Element/index.js';
|
|
11
11
|
import { unwrapStringOrJSXElement } from '../utils/solid.js';
|
|
12
|
+
import { setupGlobalDrag } from '../utils/setupGlobalDrag.js';
|
|
12
13
|
|
|
13
|
-
var _tmpl$ =
|
|
14
|
-
_tmpl$2 =
|
|
15
|
-
_tmpl$3 =
|
|
14
|
+
var _tmpl$ = /*#__PURE__*/template(`<div>`),
|
|
15
|
+
_tmpl$2 = /*#__PURE__*/template(`<div class="absolute top-1/2 -translate-1/2 w-[--ant-slider-handle-size] h-[--ant-slider-handle-size]">`),
|
|
16
|
+
_tmpl$3 = /*#__PURE__*/template(`<div><div></div><div></div><div class="absolute left-[calc(var(--ant-slider-handle-size)/2)] right-[calc(var(--ant-slider-handle-size)/2)] top-1/2 -translate-y-1/2">`);
|
|
16
17
|
const Slider = _props => {
|
|
18
|
+
let containerRef;
|
|
17
19
|
let handleRef;
|
|
18
20
|
const props = mergeProps({
|
|
19
21
|
min: 0,
|
|
@@ -58,6 +60,10 @@ const Slider = _props => {
|
|
|
58
60
|
});
|
|
59
61
|
});
|
|
60
62
|
return createComponent(Element, {
|
|
63
|
+
ref(r$) {
|
|
64
|
+
var _ref$ = containerRef;
|
|
65
|
+
typeof _ref$ === "function" ? _ref$(r$) : containerRef = r$;
|
|
66
|
+
},
|
|
61
67
|
get ["class"]() {
|
|
62
68
|
return cs(props.class, 'relative cursor-pointer', props.disabled && 'cursor-not-allowed');
|
|
63
69
|
},
|
|
@@ -76,15 +82,48 @@ const Slider = _props => {
|
|
|
76
82
|
};
|
|
77
83
|
},
|
|
78
84
|
get children() {
|
|
79
|
-
|
|
85
|
+
var _el$ = _tmpl$3(),
|
|
86
|
+
_el$2 = _el$.firstChild,
|
|
87
|
+
_el$3 = _el$2.nextSibling,
|
|
88
|
+
_el$4 = _el$3.nextSibling;
|
|
89
|
+
_el$.$$click = e => {
|
|
90
|
+
const handleWidth = handleRef?.offsetWidth ?? 0;
|
|
91
|
+
const halfHandleWidth = handleWidth / 2;
|
|
92
|
+
const offsetX = clamp(e.offsetX - halfHandleWidth, 0, containerRef.offsetWidth - handleWidth);
|
|
93
|
+
setValue(props.min + offsetX / (containerRef.offsetWidth - handleWidth) * gap());
|
|
94
|
+
};
|
|
95
|
+
insert(_el$4, createComponent(Tooltip, {
|
|
80
96
|
get open() {
|
|
81
|
-
return props.tooltip && (isHover() || isFocus() || isDragging());
|
|
97
|
+
return memo(() => !!props.tooltip)() && (isHover() || isFocus() || isDragging());
|
|
82
98
|
},
|
|
83
99
|
get content() {
|
|
84
|
-
return typeof props.tooltip === 'object' && props.tooltip.formatter ? props.tooltip.formatter(value()) : value();
|
|
100
|
+
return memo(() => !!(typeof props.tooltip === 'object' && props.tooltip.formatter))() ? props.tooltip.formatter(value()) : value();
|
|
85
101
|
},
|
|
86
102
|
get children() {
|
|
87
|
-
|
|
103
|
+
var _el$5 = _tmpl$2();
|
|
104
|
+
_el$5.$$mousedown = e => {
|
|
105
|
+
const startX = e.clientX;
|
|
106
|
+
const startValue = value();
|
|
107
|
+
setIsDragging(true);
|
|
108
|
+
const handleWidth = handleRef.offsetWidth;
|
|
109
|
+
setupGlobalDrag(
|
|
110
|
+
// eslint-disable-next-line solid/reactivity
|
|
111
|
+
_e => {
|
|
112
|
+
const moveX = _e.clientX - startX;
|
|
113
|
+
setValue(startValue + moveX / (containerRef.offsetWidth - handleWidth) * gap());
|
|
114
|
+
},
|
|
115
|
+
// eslint-disable-next-line solid/reactivity
|
|
116
|
+
() => {
|
|
117
|
+
props.onChangeComplete?.(value());
|
|
118
|
+
setIsDragging(false);
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
_el$5.$$click = e => {
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
};
|
|
124
|
+
var _ref$2 = handleRef;
|
|
125
|
+
typeof _ref$2 === "function" ? use(_ref$2, _el$5) : handleRef = _el$5;
|
|
126
|
+
insert(_el$5, createComponent(Show, {
|
|
88
127
|
get when() {
|
|
89
128
|
return isNil(resolvedHandle());
|
|
90
129
|
},
|
|
@@ -92,13 +131,47 @@ const Slider = _props => {
|
|
|
92
131
|
return resolvedHandle();
|
|
93
132
|
},
|
|
94
133
|
get children() {
|
|
95
|
-
|
|
134
|
+
var _el$6 = _tmpl$();
|
|
135
|
+
effect(_p$ => {
|
|
136
|
+
var _v$ = cs('box-border w-full h-full bg-[--ant-color-bg-container-secondary] rounded-1/2 border-solid border-2px cursor-pointer', props.disabled ? 'border-[var(--ant-slider-handle-color-disabled)]' : ['border-[var(--ant-slider-handle-color)]', 'hover:border-[var(--ant-slider-handle-active-color)] hover:[outline:4px_solid_var(--ant-control-outline)]', 'focus:border-[var(--ant-slider-handle-active-color)] focus:[outline:4px_solid_var(--ant-control-outline)]']),
|
|
137
|
+
_v$2 = props.disabled ? undefined : '0';
|
|
138
|
+
_v$ !== _p$.e && className(_el$6, _p$.e = _v$);
|
|
139
|
+
_v$2 !== _p$.t && setAttribute(_el$6, "tabindex", _p$.t = _v$2);
|
|
140
|
+
return _p$;
|
|
141
|
+
}, {
|
|
142
|
+
e: undefined,
|
|
143
|
+
t: undefined
|
|
144
|
+
});
|
|
145
|
+
return _el$6;
|
|
96
146
|
}
|
|
97
|
-
}))
|
|
147
|
+
}));
|
|
148
|
+
effect(() => `${progress() * 100}%` != null ? _el$5.style.setProperty("left", `${progress() * 100}%`) : _el$5.style.removeProperty("left"));
|
|
149
|
+
return _el$5;
|
|
98
150
|
}
|
|
99
|
-
}))
|
|
151
|
+
}));
|
|
152
|
+
effect(_p$ => {
|
|
153
|
+
var _v$3 = cs(props.disabled && 'pointer-events-none'),
|
|
154
|
+
_v$4 = cs('[background:var(--ant-slider-rail-bg)] h-[--ant-slider-rail-size] rounded-[calc(var(--ant-slider-rail-size)/2)]', !props.disabled && 'hover:[background:var(--ant-slider-rail-hover-bg)]'),
|
|
155
|
+
_v$5 = props.railBgStyle,
|
|
156
|
+
_v$6 = cs('absolute left-0 top-1/2 -translate-y-1/2 h-[--ant-slider-rail-size] rounded-[calc(var(--ant-slider-rail-size)/2)]', props.disabled ? 'bg-[var(--ant-slider-track-bg-disabled)]' : ['bg-[var(--ant-slider-track-bg)] hover:bg-[var(--ant-slider-track-hover-bg)]']),
|
|
157
|
+
_v$7 = `${progress() * 100}%`;
|
|
158
|
+
_v$3 !== _p$.e && className(_el$, _p$.e = _v$3);
|
|
159
|
+
_v$4 !== _p$.t && className(_el$2, _p$.t = _v$4);
|
|
160
|
+
_p$.a = style(_el$2, _v$5, _p$.a);
|
|
161
|
+
_v$6 !== _p$.o && className(_el$3, _p$.o = _v$6);
|
|
162
|
+
_v$7 !== _p$.i && ((_p$.i = _v$7) != null ? _el$3.style.setProperty("width", _v$7) : _el$3.style.removeProperty("width"));
|
|
163
|
+
return _p$;
|
|
164
|
+
}, {
|
|
165
|
+
e: undefined,
|
|
166
|
+
t: undefined,
|
|
167
|
+
a: undefined,
|
|
168
|
+
o: undefined,
|
|
169
|
+
i: undefined
|
|
170
|
+
});
|
|
171
|
+
return _el$;
|
|
100
172
|
}
|
|
101
173
|
});
|
|
102
174
|
};
|
|
175
|
+
delegateEvents(["click", "mousedown"]);
|
|
103
176
|
|
|
104
177
|
export { Slider as default };
|
package/es/Space/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent, mergeProps } from 'solid-js/web';
|
|
1
|
+
import { createComponent, mergeProps, memo } from 'solid-js/web';
|
|
2
2
|
import { For } from 'solid-js';
|
|
3
3
|
import Element from '../Element/index.js';
|
|
4
4
|
import { unwrapStringOrJSXElement } from '../utils/solid.js';
|
|
@@ -7,7 +7,7 @@ function Space(props) {
|
|
|
7
7
|
return createComponent(Element, {
|
|
8
8
|
get children() {
|
|
9
9
|
return createComponent(For, mergeProps(props, {
|
|
10
|
-
children: (item, index) => [index() !== 0 && unwrapStringOrJSXElement(props.split), props.children(item, index)]
|
|
10
|
+
children: (item, index) => [memo(() => memo(() => index() !== 0)() && unwrapStringOrJSXElement(props.split)), memo(() => props.children(item, index))]
|
|
11
11
|
}));
|
|
12
12
|
}
|
|
13
13
|
});
|
package/es/Spin/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { insert, createComponent, effect, template } from 'solid-js/web';
|
|
2
2
|
import { mergeProps, children, Show } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import Element from '../Element/index.js';
|
|
5
5
|
import { unwrapStringOrJSXElement, isEmptyJSXElement } from '../utils/solid.js';
|
|
6
6
|
|
|
7
|
-
var _tmpl$ =
|
|
8
|
-
_tmpl$2 =
|
|
9
|
-
_tmpl$3 =
|
|
7
|
+
var _tmpl$ = /*#__PURE__*/template(`<div class="inline-flex flex-col items-center gap-8px text-[var(--ant-color-primary)]"><span class="i-ant-design:loading keyframes-spin [animation:spin_1s_linear_infinite]">`),
|
|
8
|
+
_tmpl$2 = /*#__PURE__*/template(`<div>`),
|
|
9
|
+
_tmpl$3 = /*#__PURE__*/template(`<div class="absolute inset-0 flex items-center justify-center bg-[var(--ant-color-bg-container)] opacity-40">`);
|
|
10
10
|
const Spin = _props => {
|
|
11
11
|
const props = mergeProps({
|
|
12
12
|
spinning: true,
|
|
@@ -14,14 +14,20 @@ const Spin = _props => {
|
|
|
14
14
|
}, _props);
|
|
15
15
|
const resolvedChildren = children(() => props.children);
|
|
16
16
|
const resolvedTip = children(() => unwrapStringOrJSXElement(props.tip));
|
|
17
|
-
const spin =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const spin = (() => {
|
|
18
|
+
var _el$ = _tmpl$(),
|
|
19
|
+
_el$2 = _el$.firstChild;
|
|
20
|
+
insert(_el$, createComponent(Show, {
|
|
21
|
+
get when() {
|
|
22
|
+
return !isEmptyJSXElement(resolvedTip());
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
return resolvedTip();
|
|
26
|
+
}
|
|
27
|
+
}), null);
|
|
28
|
+
effect(() => `${props.size}px` != null ? _el$2.style.setProperty("font-size", `${props.size}px`) : _el$2.style.removeProperty("font-size"));
|
|
29
|
+
return _el$;
|
|
30
|
+
})();
|
|
25
31
|
return createComponent(Show, {
|
|
26
32
|
get when() {
|
|
27
33
|
return !isEmptyJSXElement(resolvedChildren());
|
|
@@ -53,12 +59,18 @@ const Spin = _props => {
|
|
|
53
59
|
return props.style;
|
|
54
60
|
},
|
|
55
61
|
get children() {
|
|
56
|
-
return [
|
|
62
|
+
return [(() => {
|
|
63
|
+
var _el$3 = _tmpl$2();
|
|
64
|
+
insert(_el$3, resolvedChildren);
|
|
65
|
+
return _el$3;
|
|
66
|
+
})(), createComponent(Show, {
|
|
57
67
|
get when() {
|
|
58
68
|
return props.spinning;
|
|
59
69
|
},
|
|
60
70
|
get children() {
|
|
61
|
-
|
|
71
|
+
var _el$4 = _tmpl$3();
|
|
72
|
+
insert(_el$4, spin);
|
|
73
|
+
return _el$4;
|
|
62
74
|
}
|
|
63
75
|
})];
|
|
64
76
|
}
|
package/es/Switch/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createComponent,
|
|
1
|
+
import { createComponent, effect, className, template } from 'solid-js/web';
|
|
2
2
|
import cs from 'classnames';
|
|
3
3
|
import createControllableValue from '../hooks/createControllableValue.js';
|
|
4
4
|
import Element from '../Element/index.js';
|
|
5
5
|
import useComponentSize from '../hooks/useComponentSize.js';
|
|
6
6
|
|
|
7
|
-
var _tmpl$ =
|
|
7
|
+
var _tmpl$ = /*#__PURE__*/template(`<div>`);
|
|
8
8
|
const Switch = props => {
|
|
9
9
|
const size = useComponentSize(() => props.size);
|
|
10
10
|
const [checked, setChecked] = createControllableValue(props, {
|
|
@@ -27,11 +27,13 @@ const Switch = props => {
|
|
|
27
27
|
setChecked(c => !c);
|
|
28
28
|
},
|
|
29
29
|
get children() {
|
|
30
|
-
|
|
30
|
+
var _el$ = _tmpl$();
|
|
31
|
+
effect(() => className(_el$, cs('rounded-50% bg-white absolute top-1/2 -translate-y-1/2 transition-left', {
|
|
31
32
|
large: 'w-24px h-24px',
|
|
32
33
|
middle: 'w-18px h-18px',
|
|
33
34
|
small: 'w-12px h-12px'
|
|
34
|
-
}[size()], checked() ? 'right-2px' : 'left-2px')
|
|
35
|
+
}[size()], checked() ? 'right-2px' : 'left-2px')));
|
|
36
|
+
return _el$;
|
|
35
37
|
}
|
|
36
38
|
});
|
|
37
39
|
};
|