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/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';
|
|
@@ -8,16 +8,17 @@ import useClickAway from '../hooks/useClickAway.js';
|
|
|
8
8
|
import Element from '../Element/index.js';
|
|
9
9
|
import useComponentSize from '../hooks/useComponentSize.js';
|
|
10
10
|
import CompactContext from '../Compact/context.js';
|
|
11
|
+
import { setRef } from '../utils/solid.js';
|
|
11
12
|
|
|
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 =
|
|
13
|
+
var _tmpl$ = /*#__PURE__*/template(`<div class=w-full>`),
|
|
14
|
+
_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)]">`),
|
|
15
|
+
_tmpl$3 = /*#__PURE__*/template(`<div tabindex=0><div>`),
|
|
16
|
+
_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)]">`),
|
|
17
|
+
_tmpl$5 = /*#__PURE__*/template(`<span class="inline-block w-0"> `),
|
|
18
|
+
_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)]">`),
|
|
19
|
+
_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">`),
|
|
20
|
+
_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">`),
|
|
21
|
+
_tmpl$9 = /*#__PURE__*/template(`<span class="i-ant-design:down-outlined text-[var(--ant-color-text-quaternary)] text-12px">`);
|
|
21
22
|
function SelectInput(_props) {
|
|
22
23
|
let select;
|
|
23
24
|
let tooltipContent;
|
|
@@ -44,7 +45,7 @@ function SelectInput(_props) {
|
|
|
44
45
|
const [hover, setHover] = createSignal(false);
|
|
45
46
|
const showClearBtn = createMemo(() => props.allowClear && hover() && valueArr().length > 0);
|
|
46
47
|
const optionLabelRender = v => props.labelRender ? props.labelRender(v) : String(v);
|
|
47
|
-
const style = createMemo(() => ({
|
|
48
|
+
const style$1 = createMemo(() => ({
|
|
48
49
|
'--ant-select-input-font-size': {
|
|
49
50
|
small: 'var(--ant-font-size)',
|
|
50
51
|
middle: 'var(--ant-font-size)',
|
|
@@ -67,11 +68,15 @@ function SelectInput(_props) {
|
|
|
67
68
|
...props.style
|
|
68
69
|
}));
|
|
69
70
|
return createComponent(Element, {
|
|
71
|
+
ref: el => {
|
|
72
|
+
setRef(props, el);
|
|
73
|
+
select = el;
|
|
74
|
+
},
|
|
70
75
|
get ["class"]() {
|
|
71
76
|
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
77
|
},
|
|
73
78
|
get style() {
|
|
74
|
-
return style();
|
|
79
|
+
return style$1();
|
|
75
80
|
},
|
|
76
81
|
get children() {
|
|
77
82
|
return createComponent(Tooltip, {
|
|
@@ -85,45 +90,53 @@ function SelectInput(_props) {
|
|
|
85
90
|
return props.placement;
|
|
86
91
|
},
|
|
87
92
|
arrow: false,
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
contentHTMLAttributes: {
|
|
94
|
+
class: 'ant-select-dropdown',
|
|
95
|
+
style: {
|
|
96
|
+
padding: 0
|
|
97
|
+
}
|
|
90
98
|
},
|
|
91
|
-
content: () =>
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
content: () => (() => {
|
|
100
|
+
var _el$5 = _tmpl$4();
|
|
101
|
+
var _ref$ = tooltipContent;
|
|
102
|
+
typeof _ref$ === "function" ? use(_ref$, _el$5) : tooltipContent = _el$5;
|
|
103
|
+
insert(_el$5, () => props.content(() => setOpen(false)));
|
|
104
|
+
effect(_$p => style(_el$5, {
|
|
105
|
+
...pick(style$1(), ['--ant-select-popup-font-size', '--ant-select-popup-match-width'])
|
|
106
|
+
}, _$p));
|
|
107
|
+
return _el$5;
|
|
108
|
+
})(),
|
|
94
109
|
get getPopupContainer() {
|
|
95
110
|
return props.getPopupContainer;
|
|
96
111
|
},
|
|
97
112
|
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, {
|
|
113
|
+
var _el$ = _tmpl$3(),
|
|
114
|
+
_el$3 = _el$.firstChild;
|
|
115
|
+
_el$.addEventListener("mouseleave", () => setHover(false));
|
|
116
|
+
_el$.addEventListener("mouseenter", () => setHover(true));
|
|
117
|
+
_el$.$$click = e => {
|
|
118
|
+
setOpen(v => !v);
|
|
119
|
+
setPopupMatchWidth(e.currentTarget.offsetWidth);
|
|
120
|
+
e.currentTarget.focus();
|
|
121
|
+
};
|
|
122
|
+
insert(_el$, createComponent(Show, {
|
|
115
123
|
get when() {
|
|
116
124
|
return valueArr().length;
|
|
117
125
|
},
|
|
118
126
|
get fallback() {
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
return (() => {
|
|
128
|
+
var _el$6 = _tmpl$6();
|
|
129
|
+
insert(_el$6, () => props.placeholder, null);
|
|
130
|
+
insert(_el$6, createComponent(Show, {
|
|
131
|
+
get when() {
|
|
132
|
+
return !props.placeholder;
|
|
133
|
+
},
|
|
134
|
+
get children() {
|
|
135
|
+
return _tmpl$5();
|
|
136
|
+
}
|
|
137
|
+
}), null);
|
|
138
|
+
return _el$6;
|
|
139
|
+
})();
|
|
127
140
|
},
|
|
128
141
|
get children() {
|
|
129
142
|
return createComponent(Show, {
|
|
@@ -134,48 +147,103 @@ function SelectInput(_props) {
|
|
|
134
147
|
return createComponent(Dynamic, {
|
|
135
148
|
component: () => {
|
|
136
149
|
const optionLabel = createMemo(() => optionLabelRender(valueArr()[0]));
|
|
137
|
-
return
|
|
150
|
+
return (() => {
|
|
151
|
+
var _el$8 = _tmpl$7();
|
|
152
|
+
insert(_el$8, optionLabel);
|
|
153
|
+
effect(() => setAttribute(_el$8, "title", typeof optionLabel() === 'string' ? optionLabel() : undefined));
|
|
154
|
+
return _el$8;
|
|
155
|
+
})();
|
|
138
156
|
}
|
|
139
157
|
});
|
|
140
158
|
},
|
|
141
159
|
get children() {
|
|
142
|
-
|
|
160
|
+
var _el$2 = _tmpl$();
|
|
161
|
+
insert(_el$2, createComponent(For, {
|
|
143
162
|
get each() {
|
|
144
163
|
return valueArr();
|
|
145
164
|
},
|
|
146
165
|
children: item => {
|
|
147
166
|
const optionLabel = createMemo(() => optionLabelRender(valueArr()[0]));
|
|
148
|
-
return
|
|
167
|
+
return (() => {
|
|
168
|
+
var _el$9 = _tmpl$8(),
|
|
169
|
+
_el$10 = _el$9.firstChild;
|
|
170
|
+
insert(_el$9, optionLabel, _el$10);
|
|
171
|
+
_el$10.$$click = () => setValue(valueArr().filter(v => v !== item));
|
|
172
|
+
effect(() => setAttribute(_el$9, "title", typeof optionLabel() === 'string' ? optionLabel() : undefined));
|
|
173
|
+
return _el$9;
|
|
174
|
+
})();
|
|
149
175
|
}
|
|
150
|
-
}))
|
|
176
|
+
}));
|
|
177
|
+
return _el$2;
|
|
151
178
|
}
|
|
152
179
|
});
|
|
153
180
|
}
|
|
154
|
-
})
|
|
181
|
+
}), _el$3);
|
|
182
|
+
insert(_el$3, createComponent(Show, {
|
|
155
183
|
get when() {
|
|
156
184
|
return showClearBtn();
|
|
157
185
|
},
|
|
158
186
|
get fallback() {
|
|
159
187
|
return createComponent(Show, {
|
|
160
188
|
get when() {
|
|
161
|
-
return isUndefined(props.suffixIcon);
|
|
189
|
+
return isUndefined(props.suffixIcon) || props.suffixIcon === true;
|
|
162
190
|
},
|
|
163
191
|
get fallback() {
|
|
164
192
|
return props.suffixIcon;
|
|
165
193
|
},
|
|
166
194
|
get children() {
|
|
167
|
-
return
|
|
195
|
+
return _tmpl$9();
|
|
168
196
|
}
|
|
169
197
|
});
|
|
170
198
|
},
|
|
171
199
|
get children() {
|
|
172
|
-
|
|
200
|
+
var _el$4 = _tmpl$2();
|
|
201
|
+
_el$4.$$click = e => {
|
|
202
|
+
e.stopPropagation();
|
|
203
|
+
setValue([]);
|
|
204
|
+
setOpen(false);
|
|
205
|
+
};
|
|
206
|
+
return _el$4;
|
|
173
207
|
}
|
|
174
|
-
}))
|
|
208
|
+
}));
|
|
209
|
+
effect(_p$ => {
|
|
210
|
+
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' && {
|
|
211
|
+
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)]'),
|
|
212
|
+
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)]'),
|
|
213
|
+
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)]')
|
|
214
|
+
}[props.status ?? 'default'], props.variant === 'filled' && {
|
|
215
|
+
default: cs('bg-[--ant-color-fill-tertiary]', !props.disabled && 'hover:bg-[--ant-color-fill-secondary]'),
|
|
216
|
+
error: cs('bg-[--ant-color-error-bg]', !props.disabled && 'hover:bg-[--ant-color-error-bg-hover]'),
|
|
217
|
+
warning: cs('bg-[--ant-color-warning-bg]', !props.disabled && 'hover:bg-[--ant-color-warning-bg-hover]')
|
|
218
|
+
}[props.status ?? 'default']),
|
|
219
|
+
_v$2 = {
|
|
220
|
+
small: '24px',
|
|
221
|
+
middle: '32px',
|
|
222
|
+
large: '40px'
|
|
223
|
+
}[size()],
|
|
224
|
+
_v$3 = {
|
|
225
|
+
small: '16px',
|
|
226
|
+
middle: '24px',
|
|
227
|
+
large: '32px'
|
|
228
|
+
}[size()],
|
|
229
|
+
_v$4 = cs('shrink-0 flex justify-end items-center p-[--ant-select-input-addon-after-padding] empty:hidden');
|
|
230
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
231
|
+
_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"));
|
|
232
|
+
_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"));
|
|
233
|
+
_v$4 !== _p$.o && className(_el$3, _p$.o = _v$4);
|
|
234
|
+
return _p$;
|
|
235
|
+
}, {
|
|
236
|
+
e: undefined,
|
|
237
|
+
t: undefined,
|
|
238
|
+
a: undefined,
|
|
239
|
+
o: undefined
|
|
240
|
+
});
|
|
241
|
+
return _el$;
|
|
175
242
|
}
|
|
176
243
|
});
|
|
177
244
|
}
|
|
178
245
|
});
|
|
179
246
|
}
|
|
247
|
+
delegateEvents(["click"]);
|
|
180
248
|
|
|
181
249
|
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
|
};
|
package/es/Table/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { createComponent,
|
|
1
|
+
import { createComponent, insert, effect, className, template } from 'solid-js/web';
|
|
2
2
|
import { For, Show } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import Empty from '../Empty/index.js';
|
|
5
5
|
import Element from '../Element/index.js';
|
|
6
6
|
import useComponentSize from '../hooks/useComponentSize.js';
|
|
7
7
|
|
|
8
|
-
var _tmpl$ =
|
|
9
|
-
_tmpl$2 =
|
|
10
|
-
_tmpl$3 =
|
|
11
|
-
_tmpl$4 =
|
|
8
|
+
var _tmpl$ = /*#__PURE__*/template(`<table class=w-full><thead><tr></tr></thead><tbody>`),
|
|
9
|
+
_tmpl$2 = /*#__PURE__*/template(`<th>`),
|
|
10
|
+
_tmpl$3 = /*#__PURE__*/template(`<tr class=hover:bg-[var(--ant-table-row-hover-bg)]>`),
|
|
11
|
+
_tmpl$4 = /*#__PURE__*/template(`<td>`);
|
|
12
12
|
const sizeClassDict = {
|
|
13
13
|
large: 'p-16px leading-22px',
|
|
14
14
|
middle: 'px-8px py-12px leading-22px',
|
|
@@ -19,22 +19,44 @@ const Table = props => {
|
|
|
19
19
|
return createComponent(Element, {
|
|
20
20
|
"class": "[font-size:var(--ant-font-size)] text-[var(--ant-color-text)] leading-[var(--ant-line-height)]",
|
|
21
21
|
get children() {
|
|
22
|
-
return [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
get each() {
|
|
29
|
-
return props.dataSource;
|
|
30
|
-
},
|
|
31
|
-
children: (row, i) => ssr(_tmpl$3, ssrHydrationKey(), escape(createComponent(For, {
|
|
22
|
+
return [(() => {
|
|
23
|
+
var _el$ = _tmpl$(),
|
|
24
|
+
_el$2 = _el$.firstChild,
|
|
25
|
+
_el$3 = _el$2.firstChild,
|
|
26
|
+
_el$4 = _el$2.nextSibling;
|
|
27
|
+
insert(_el$3, createComponent(For, {
|
|
32
28
|
get each() {
|
|
33
29
|
return props.columns;
|
|
34
30
|
},
|
|
35
|
-
children: item =>
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
children: item => (() => {
|
|
32
|
+
var _el$5 = _tmpl$2();
|
|
33
|
+
insert(_el$5, () => item.title);
|
|
34
|
+
effect(() => className(_el$5, cs(sizeClassDict[size()], 'bg-[var(--ant-table-header-bg)] font-bold [border-bottom:1px_solid_var(--ant-table-border-color)] text-left')));
|
|
35
|
+
return _el$5;
|
|
36
|
+
})()
|
|
37
|
+
}));
|
|
38
|
+
insert(_el$4, createComponent(For, {
|
|
39
|
+
get each() {
|
|
40
|
+
return props.dataSource;
|
|
41
|
+
},
|
|
42
|
+
children: (row, i) => (() => {
|
|
43
|
+
var _el$6 = _tmpl$3();
|
|
44
|
+
insert(_el$6, createComponent(For, {
|
|
45
|
+
get each() {
|
|
46
|
+
return props.columns;
|
|
47
|
+
},
|
|
48
|
+
children: item => (() => {
|
|
49
|
+
var _el$7 = _tmpl$4();
|
|
50
|
+
insert(_el$7, () => item.render(row, i));
|
|
51
|
+
effect(() => className(_el$7, cs(sizeClassDict[size()], '[border-bottom:1px_solid_var(--ant-table-border-color)]')));
|
|
52
|
+
return _el$7;
|
|
53
|
+
})()
|
|
54
|
+
}));
|
|
55
|
+
return _el$6;
|
|
56
|
+
})()
|
|
57
|
+
}));
|
|
58
|
+
return _el$;
|
|
59
|
+
})(), createComponent(Show, {
|
|
38
60
|
get when() {
|
|
39
61
|
return !props.dataSource.length;
|
|
40
62
|
},
|