antd-solid 0.0.22 → 0.0.24
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 +148 -80
- package/dist/index.umd.js +1 -1
- package/es/Button/index.d.ts +5 -2
- package/es/Button/index.js +7 -12
- package/es/CodeInput/index.js +2 -1
- package/es/ColorPicker/ColorPickerInput.js +1 -0
- package/es/ColorPicker/index.js +5 -2
- package/es/Cursor/index.d.ts +13 -2
- package/es/Cursor/index.js +45 -14
- package/es/Drawer/index.js +6 -1
- package/es/Dropdown/index.js +4 -2
- package/es/Input/index.d.ts +5 -0
- package/es/Input/index.js +34 -14
- package/es/Menu/InternalMenu.js +4 -2
- package/es/RangeInput/index.js +4 -2
- package/es/Segmented/index.js +1 -1
- package/es/Select/index.d.ts +1 -1
- package/es/Select/index.js +5 -2
- package/es/SelectInput/index.d.ts +2 -1
- package/es/SelectInput/index.js +12 -8
- package/es/Timeline/index.d.ts +1 -2
- package/es/Tooltip/index.d.ts +1 -1
- package/es/Tooltip/index.js +10 -18
- package/es/index.d.ts +1 -1
- package/es/utils/setupGlobalDrag.js +13 -4
- package/package.json +1 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent, Dynamic, mergeProps as mergeProps$1, insert,
|
|
1
|
+
import { createComponent, Dynamic, mergeProps as mergeProps$1, insert, memo, spread, template, use, delegateEvents, render, Portal, effect, className, style, setAttribute } from 'solid-js/web';
|
|
2
2
|
import { createContext, mergeProps, useContext, onMount, createMemo, untrack, splitProps, createSignal, children, Show, createComputed, on, createEffect, onCleanup, createRenderEffect, For, createSelector, Switch as Switch$1, Match, getOwner, runWithOwner } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import { nanoid } from 'nanoid';
|
|
@@ -656,21 +656,16 @@ const Button$1 = _props => {
|
|
|
656
656
|
}
|
|
657
657
|
}), createComponent(Show, {
|
|
658
658
|
get when() {
|
|
659
|
-
return resolvedChildren();
|
|
659
|
+
return memo(() => !!resolvedChildren())() && !(props.hideChildrenWhenLoading && loading());
|
|
660
660
|
},
|
|
661
661
|
get children() {
|
|
662
662
|
var _el$2 = _tmpl$2$v();
|
|
663
|
+
spread(_el$2, mergeProps$1(() => props.contentHTMLAttributes, {
|
|
664
|
+
get ["class"]() {
|
|
665
|
+
return cs('inline-block leading-inherit', props.contentHTMLAttributes?.class);
|
|
666
|
+
}
|
|
667
|
+
}), false, true);
|
|
663
668
|
insert(_el$2, resolvedChildren);
|
|
664
|
-
effect(_p$ => {
|
|
665
|
-
var _v$ = cs('inline-block leading-inherit', props.contentClass),
|
|
666
|
-
_v$2 = props.contentStyle;
|
|
667
|
-
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
668
|
-
_p$.t = style(_el$2, _v$2, _p$.t);
|
|
669
|
-
return _p$;
|
|
670
|
-
}, {
|
|
671
|
-
e: undefined,
|
|
672
|
-
t: undefined
|
|
673
|
-
});
|
|
674
669
|
return _el$2;
|
|
675
670
|
}
|
|
676
671
|
})];
|
|
@@ -817,11 +812,9 @@ const CompactContext = createContext({
|
|
|
817
812
|
});
|
|
818
813
|
|
|
819
814
|
var _tmpl$$M = /*#__PURE__*/template(`<div>`),
|
|
820
|
-
_tmpl$2$u = /*#__PURE__*/template(`<
|
|
821
|
-
_tmpl$3$j = /*#__PURE__*/template(`<
|
|
822
|
-
_tmpl$4$d = /*#__PURE__*/template(`<div
|
|
823
|
-
_tmpl$5$9 = /*#__PURE__*/template(`<div class="[display:var(--actions-display)] absolute top-0 bottom-0 right-0 h-[calc(100%-2px)] translate-y-1px -translate-x-1px">`),
|
|
824
|
-
_tmpl$6$3 = /*#__PURE__*/template(`<div><input>`);
|
|
815
|
+
_tmpl$2$u = /*#__PURE__*/template(`<span class="ml-4px 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)]">`),
|
|
816
|
+
_tmpl$3$j = /*#__PURE__*/template(`<div class="[display:var(--actions-display)] absolute top-0 bottom-0 right-0 h-[calc(100%-2px)] translate-y-1px -translate-x-1px">`),
|
|
817
|
+
_tmpl$4$d = /*#__PURE__*/template(`<div><input>`);
|
|
825
818
|
const statusClassDict$1 = {
|
|
826
819
|
default: (disabled, foucs) => {
|
|
827
820
|
if (disabled) {
|
|
@@ -910,19 +903,33 @@ function CommonInput(props) {
|
|
|
910
903
|
},
|
|
911
904
|
get children() {
|
|
912
905
|
var _el$ = _tmpl$$M();
|
|
906
|
+
spread(_el$, mergeProps$1(() => props.addonBeforeHTMLAttributes, {
|
|
907
|
+
get ["class"]() {
|
|
908
|
+
return cs(props.addonBeforeHTMLAttributes?.class, 'ant-input-addon ant-input-addon-before', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-r-0');
|
|
909
|
+
}
|
|
910
|
+
}), false, true);
|
|
913
911
|
insert(_el$, addonBefore);
|
|
914
|
-
effect(() => className(_el$, cs('ant-input-addon', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-r-0')));
|
|
915
912
|
return _el$;
|
|
916
913
|
}
|
|
917
914
|
}), (() => {
|
|
918
|
-
var _el$2 = _tmpl$
|
|
915
|
+
var _el$2 = _tmpl$4$d(),
|
|
919
916
|
_el$4 = _el$2.firstChild;
|
|
917
|
+
spread(_el$2, mergeProps$1(() => props.affixWrapperHTMLAttributes, {
|
|
918
|
+
get ["class"]() {
|
|
919
|
+
return cs(props.affixWrapperHTMLAttributes?.class, 'ant-input-affix-wrapper', 'flex items-center w-full relative p:hover-child[input]:border-[--ant-color-primary] bg-[--ant-color-bg-container] p-[--ant-input-padding] border-1px border-solid', ['[--actions-display:none]', !props.disabled && 'hover:[--actions-display:block]'], statusClassDict$1[props.status ?? 'default'](!!props.disabled, foucs()));
|
|
920
|
+
}
|
|
921
|
+
}), false, true);
|
|
920
922
|
insert(_el$2, createComponent(Show, {
|
|
921
923
|
get when() {
|
|
922
924
|
return !isNil(prefix());
|
|
923
925
|
},
|
|
924
926
|
get children() {
|
|
925
|
-
var _el$3 = _tmpl
|
|
927
|
+
var _el$3 = _tmpl$$M();
|
|
928
|
+
spread(_el$3, mergeProps$1(() => props.prefixHTMLAttributes, {
|
|
929
|
+
get ["class"]() {
|
|
930
|
+
return cs(props.prefixHTMLAttributes?.class, 'mr-4px');
|
|
931
|
+
}
|
|
932
|
+
}), false, true);
|
|
926
933
|
insert(_el$3, prefix);
|
|
927
934
|
return _el$3;
|
|
928
935
|
}
|
|
@@ -960,7 +967,7 @@ function CommonInput(props) {
|
|
|
960
967
|
return showClearBtn();
|
|
961
968
|
},
|
|
962
969
|
get children() {
|
|
963
|
-
var _el$5 = _tmpl$
|
|
970
|
+
var _el$5 = _tmpl$2$u();
|
|
964
971
|
_el$5.$$click = e => {
|
|
965
972
|
e.stopPropagation();
|
|
966
973
|
inputRef.value = '';
|
|
@@ -978,7 +985,12 @@ function CommonInput(props) {
|
|
|
978
985
|
return !isNil(suffix());
|
|
979
986
|
},
|
|
980
987
|
get children() {
|
|
981
|
-
var _el$6 = _tmpl
|
|
988
|
+
var _el$6 = _tmpl$$M();
|
|
989
|
+
spread(_el$6, mergeProps$1(() => props.suffixHTMLAttributes, {
|
|
990
|
+
get ["class"]() {
|
|
991
|
+
return cs(props.suffixHTMLAttributes?.class, 'ml-4px');
|
|
992
|
+
}
|
|
993
|
+
}), false, true);
|
|
982
994
|
insert(_el$6, suffix);
|
|
983
995
|
return _el$6;
|
|
984
996
|
}
|
|
@@ -988,12 +1000,11 @@ function CommonInput(props) {
|
|
|
988
1000
|
return !isNil(actions());
|
|
989
1001
|
},
|
|
990
1002
|
get children() {
|
|
991
|
-
var _el$7 = _tmpl$
|
|
1003
|
+
var _el$7 = _tmpl$3$j();
|
|
992
1004
|
insert(_el$7, actions);
|
|
993
1005
|
return _el$7;
|
|
994
1006
|
}
|
|
995
1007
|
}), null);
|
|
996
|
-
effect(() => className(_el$2, cs('ant-input-affix-wrapper', 'flex items-center w-full relative p:hover-child[input]:border-[--ant-color-primary] bg-[--ant-color-bg-container] p-[--ant-input-padding] border-1px border-solid', ['[--actions-display:none]', !props.disabled && 'hover:[--actions-display:block]'], statusClassDict$1[props.status ?? 'default'](!!props.disabled, foucs()))));
|
|
997
1008
|
return _el$2;
|
|
998
1009
|
})(), createComponent(Show, {
|
|
999
1010
|
get when() {
|
|
@@ -1001,8 +1012,12 @@ function CommonInput(props) {
|
|
|
1001
1012
|
},
|
|
1002
1013
|
get children() {
|
|
1003
1014
|
var _el$8 = _tmpl$$M();
|
|
1015
|
+
spread(_el$8, mergeProps$1(() => props.addonAfterHTMLAttributes, {
|
|
1016
|
+
get ["class"]() {
|
|
1017
|
+
return cs(props.addonAfterHTMLAttributes?.class, 'ant-input-addon ant-input-addon-after', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-l-0');
|
|
1018
|
+
}
|
|
1019
|
+
}), false, true);
|
|
1004
1020
|
insert(_el$8, addonAfter);
|
|
1005
|
-
effect(() => className(_el$8, cs('ant-input-addon', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-l-0')));
|
|
1006
1021
|
return _el$8;
|
|
1007
1022
|
}
|
|
1008
1023
|
})];
|
|
@@ -1619,7 +1634,12 @@ const Drawer = _props => {
|
|
|
1619
1634
|
typeof _ref$ === "function" ? _ref$(r$) : drawerRef = r$;
|
|
1620
1635
|
},
|
|
1621
1636
|
get ["class"]() {
|
|
1622
|
-
return cs(props.class, '[font-size:var(--ant-font-size)] text-[var(--ant-color-text)] leading-[var(--ant-line-height)]', 'inset-0 z-1000',
|
|
1637
|
+
return cs(props.class, '[font-size:var(--ant-font-size)] text-[var(--ant-color-text)] leading-[var(--ant-line-height)]', 'inset-0 z-1000', !props.mask && {
|
|
1638
|
+
left: '!right-auto',
|
|
1639
|
+
right: '!left-auto',
|
|
1640
|
+
top: '!bottom-auto',
|
|
1641
|
+
bottom: '!top-auto'
|
|
1642
|
+
}[props.placement], isBody() ? 'fixed' : 'absolute');
|
|
1623
1643
|
},
|
|
1624
1644
|
get style() {
|
|
1625
1645
|
return {
|
|
@@ -2257,25 +2277,17 @@ const Tooltip = _props => {
|
|
|
2257
2277
|
get children() {
|
|
2258
2278
|
return [(() => {
|
|
2259
2279
|
var _el$ = _tmpl$$F();
|
|
2280
|
+
spread(_el$, mergeProps$1(() => props.contentHTMLAttributes, {
|
|
2281
|
+
get ["class"]() {
|
|
2282
|
+
return cs(props.contentHTMLAttributes?.class, 'px-8px py-6px [box-shadow:var(--ant-box-shadow)] rounded-[var(--ant-border-radius-lg)] overflow-auto translate-x-[--inner-translate-x] translate-y-[--inner-translate-y]', props.plain ? 'text-[var(--ant-color-text)] bg-[var(--ant-color-bg-container-tertiary)]' : 'text-[var(--ant-color-text-light-solid)] bg-[var(--ant-color-bg-spotlight)]');
|
|
2283
|
+
}
|
|
2284
|
+
}), false, true);
|
|
2260
2285
|
insert(_el$, createComponent(TooltipContext.Provider, {
|
|
2261
2286
|
value: context,
|
|
2262
2287
|
get children() {
|
|
2263
2288
|
return unwrapContent(props.content, () => setOpen(false));
|
|
2264
2289
|
}
|
|
2265
2290
|
}));
|
|
2266
|
-
effect(_p$ => {
|
|
2267
|
-
var _v$ = cs('px-8px py-6px [box-shadow:var(--ant-box-shadow)] rounded-[var(--ant-border-radius-lg)] overflow-auto', props.plain ? 'text-[var(--ant-color-text)] bg-[var(--ant-color-bg-container-tertiary)]' : 'text-[var(--ant-color-text-light-solid)] bg-[var(--ant-color-bg-spotlight)]'),
|
|
2268
|
-
_v$2 = {
|
|
2269
|
-
transform: 'translate(var(--inner-translate-x), var(--inner-translate-y))',
|
|
2270
|
-
...props.contentStyle
|
|
2271
|
-
};
|
|
2272
|
-
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
2273
|
-
_p$.t = style(_el$, _v$2, _p$.t);
|
|
2274
|
-
return _p$;
|
|
2275
|
-
}, {
|
|
2276
|
-
e: undefined,
|
|
2277
|
-
t: undefined
|
|
2278
|
-
});
|
|
2279
2291
|
return _el$;
|
|
2280
2292
|
})(), createComponent(Show, {
|
|
2281
2293
|
get when() {
|
|
@@ -2284,14 +2296,14 @@ const Tooltip = _props => {
|
|
|
2284
2296
|
get children() {
|
|
2285
2297
|
var _el$2 = _tmpl$$F();
|
|
2286
2298
|
effect(_p$ => {
|
|
2287
|
-
var _v$
|
|
2288
|
-
_v$
|
|
2299
|
+
var _v$ = cs('w-8px h-8px absolute border-transparent [box-shadow:var(--ant-box-shadow)]'),
|
|
2300
|
+
_v$2 = {
|
|
2289
2301
|
'clip-path': 'polygon(-100% -100%, 200% -100%, 200% 200%)',
|
|
2290
2302
|
'background-color': props.plain ? 'var(--ant-color-bg-container-tertiary)' : 'var(--ant-color-bg-spotlight)',
|
|
2291
2303
|
...ARROW_STYLE_DICT[mergePlacement(reversedMainPlacement(), reversedMinorPlacement())]
|
|
2292
2304
|
};
|
|
2293
|
-
_v$
|
|
2294
|
-
_p$.t = style(_el$2, _v$
|
|
2305
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
2306
|
+
_p$.t = style(_el$2, _v$2, _p$.t);
|
|
2295
2307
|
return _p$;
|
|
2296
2308
|
}, {
|
|
2297
2309
|
e: undefined,
|
|
@@ -2402,8 +2414,10 @@ function RangeInput(props) {
|
|
|
2402
2414
|
trigger: false,
|
|
2403
2415
|
placement: "bottomLeft",
|
|
2404
2416
|
arrow: false,
|
|
2405
|
-
|
|
2406
|
-
|
|
2417
|
+
contentHTMLAttributes: {
|
|
2418
|
+
style: {
|
|
2419
|
+
padding: 0
|
|
2420
|
+
}
|
|
2407
2421
|
},
|
|
2408
2422
|
content: () => (() => {
|
|
2409
2423
|
var _el$8 = _tmpl$3$g();
|
|
@@ -2563,9 +2577,9 @@ function SelectInput(_props) {
|
|
|
2563
2577
|
...props.style
|
|
2564
2578
|
}));
|
|
2565
2579
|
return createComponent(Element$1, {
|
|
2566
|
-
ref
|
|
2567
|
-
|
|
2568
|
-
|
|
2580
|
+
ref: el => {
|
|
2581
|
+
setRef(props, el);
|
|
2582
|
+
select = el;
|
|
2569
2583
|
},
|
|
2570
2584
|
get ["class"]() {
|
|
2571
2585
|
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');
|
|
@@ -2585,13 +2599,16 @@ function SelectInput(_props) {
|
|
|
2585
2599
|
return props.placement;
|
|
2586
2600
|
},
|
|
2587
2601
|
arrow: false,
|
|
2588
|
-
|
|
2589
|
-
|
|
2602
|
+
contentHTMLAttributes: {
|
|
2603
|
+
class: 'ant-select-dropdown',
|
|
2604
|
+
style: {
|
|
2605
|
+
padding: 0
|
|
2606
|
+
}
|
|
2590
2607
|
},
|
|
2591
2608
|
content: () => (() => {
|
|
2592
2609
|
var _el$5 = _tmpl$4$9();
|
|
2593
|
-
var _ref$
|
|
2594
|
-
typeof _ref$
|
|
2610
|
+
var _ref$ = tooltipContent;
|
|
2611
|
+
typeof _ref$ === "function" ? use(_ref$, _el$5) : tooltipContent = _el$5;
|
|
2595
2612
|
insert(_el$5, () => props.content(() => setOpen(false)));
|
|
2596
2613
|
effect(_$p => style(_el$5, {
|
|
2597
2614
|
...pick(style$1(), ['--ant-select-popup-font-size', '--ant-select-popup-match-width'])
|
|
@@ -2678,7 +2695,7 @@ function SelectInput(_props) {
|
|
|
2678
2695
|
get fallback() {
|
|
2679
2696
|
return createComponent(Show, {
|
|
2680
2697
|
get when() {
|
|
2681
|
-
return isUndefined(props.suffixIcon);
|
|
2698
|
+
return isUndefined(props.suffixIcon) || props.suffixIcon === true;
|
|
2682
2699
|
},
|
|
2683
2700
|
get fallback() {
|
|
2684
2701
|
return props.suffixIcon;
|
|
@@ -2796,12 +2813,15 @@ Empty.PRESENTED_IMAGE_SIMPLE = PRESENTED_IMAGE_SIMPLE;
|
|
|
2796
2813
|
var _tmpl$$y = /*#__PURE__*/template(`<div class=p-2px>`),
|
|
2797
2814
|
_tmpl$2$k = /*#__PURE__*/template(`<div>`);
|
|
2798
2815
|
function Select(props) {
|
|
2799
|
-
const [selectInputProps] = splitProps(props, ['multiple', 'allowClear', 'class', 'style', 'disabled', 'placeholder', 'status', 'size', 'variant', 'suffixIcon', 'placement', 'getPopupContainer']);
|
|
2816
|
+
const [selectInputProps] = splitProps(props, ['ref', 'multiple', 'allowClear', 'class', 'style', 'disabled', 'placeholder', 'status', 'size', 'variant', 'suffixIcon', 'placement', 'getPopupContainer', 'defaultOpen', 'open', 'onOpenChange']);
|
|
2800
2817
|
const [value, setValue] = createControllableValue(props);
|
|
2801
2818
|
const valueArr = createMemo(() => toArray(value(), false));
|
|
2802
2819
|
const selectedValue = createSelector(() => new Map(valueArr().map(v => [v, true])), (a, b) => b.has(a));
|
|
2803
2820
|
const optionDict = createMemo(() => new Map(props.options?.map(o => [o.value, o])));
|
|
2804
2821
|
return createComponent(SelectInput, mergeProps$1(selectInputProps, {
|
|
2822
|
+
get ["class"]() {
|
|
2823
|
+
return cs('ant-select', selectInputProps.class);
|
|
2824
|
+
},
|
|
2805
2825
|
labelRender: v => props.labelRender ? props.labelRender(optionDict().get(v), v) : unwrapStringOrJSXElement(optionDict().get(v)?.label) ?? v,
|
|
2806
2826
|
get value() {
|
|
2807
2827
|
return valueArr();
|
|
@@ -2838,7 +2858,7 @@ function Select(props) {
|
|
|
2838
2858
|
};
|
|
2839
2859
|
insert(_el$2, () => unwrapStringOrJSXElement(item.label));
|
|
2840
2860
|
effect(_p$ => {
|
|
2841
|
-
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),
|
|
2861
|
+
var _v$ = cs('ant-select-item', '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),
|
|
2842
2862
|
_v$2 = typeof item.label === 'string' || typeof item.label === 'number' ? item.label.toString() : undefined;
|
|
2843
2863
|
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
2844
2864
|
_v$2 !== _p$.t && setAttribute(_el$2, "title", _p$.t = _v$2);
|
|
@@ -3526,15 +3546,23 @@ const ColorPickerContext = createContext();
|
|
|
3526
3546
|
* @param cursor - 拖拽过程中的 style.cursor
|
|
3527
3547
|
*/
|
|
3528
3548
|
function setupGlobalDrag(onMove, onEnd, cursor) {
|
|
3529
|
-
|
|
3549
|
+
// 防止拖拽时误选中文字等
|
|
3550
|
+
const originalUserSelect = document.body.style.userSelect;
|
|
3551
|
+
document.body.style.userSelect = 'none';
|
|
3530
3552
|
const originalCursor = document.documentElement.style.cursor;
|
|
3531
3553
|
if (cursor) {
|
|
3532
3554
|
document.documentElement.style.cursor = cursor;
|
|
3533
3555
|
}
|
|
3556
|
+
// 防止 mouseup 被 disabled 元素吞掉
|
|
3557
|
+
const style = document.createElement('style');
|
|
3558
|
+
style.textContent = `
|
|
3559
|
+
:disabled {
|
|
3560
|
+
pointer-events: none;
|
|
3561
|
+
}
|
|
3562
|
+
`;
|
|
3563
|
+
document.head.appendChild(style);
|
|
3534
3564
|
const abortController = new AbortController();
|
|
3535
3565
|
window.addEventListener('mousemove', e => {
|
|
3536
|
-
// 延迟设置 document.body.style.pointerEvents,直到 mousemove 触发,这样才算 drag。避免影响自身及子元素的 click 事件
|
|
3537
|
-
document.body.style.pointerEvents = 'none'; // 防止 mouseup 被 disabled 元素吞掉,以及拖拽时误选中文字等
|
|
3538
3566
|
onMove(e);
|
|
3539
3567
|
}, {
|
|
3540
3568
|
signal: abortController.signal,
|
|
@@ -3542,10 +3570,11 @@ function setupGlobalDrag(onMove, onEnd, cursor) {
|
|
|
3542
3570
|
});
|
|
3543
3571
|
window.addEventListener('mouseup', e => {
|
|
3544
3572
|
onEnd?.(e);
|
|
3545
|
-
document.body.style.
|
|
3573
|
+
document.body.style.userSelect = originalUserSelect;
|
|
3546
3574
|
if (cursor) {
|
|
3547
3575
|
document.documentElement.style.cursor = originalCursor;
|
|
3548
3576
|
}
|
|
3577
|
+
document.head.removeChild(style);
|
|
3549
3578
|
abortController.abort();
|
|
3550
3579
|
}, {
|
|
3551
3580
|
once: true,
|
|
@@ -3960,6 +3989,7 @@ const ColorPickerInput = () => {
|
|
|
3960
3989
|
},
|
|
3961
3990
|
get children() {
|
|
3962
3991
|
return createComponent(Input, {
|
|
3992
|
+
"class": "ant-color-picker-hex-input",
|
|
3963
3993
|
size: "small",
|
|
3964
3994
|
get value() {
|
|
3965
3995
|
return hexInputValue();
|
|
@@ -4194,7 +4224,7 @@ const ColorPicker = props => {
|
|
|
4194
4224
|
var _el$ = _tmpl$$p(),
|
|
4195
4225
|
_el$2 = _el$.firstChild;
|
|
4196
4226
|
_el$2.$$click = () => {
|
|
4197
|
-
setColor(new Color());
|
|
4227
|
+
setColor(new Color(), true);
|
|
4198
4228
|
close();
|
|
4199
4229
|
};
|
|
4200
4230
|
return _el$;
|
|
@@ -4217,13 +4247,16 @@ const ColorPicker = props => {
|
|
|
4217
4247
|
return props.disabled ? false : 'click';
|
|
4218
4248
|
},
|
|
4219
4249
|
content: getPopoverContent,
|
|
4250
|
+
contentHTMLAttributes: {
|
|
4251
|
+
class: 'ant-color-picker'
|
|
4252
|
+
},
|
|
4220
4253
|
get placement() {
|
|
4221
4254
|
return props.placement ?? 'bottomLeft';
|
|
4222
4255
|
},
|
|
4223
4256
|
get children() {
|
|
4224
4257
|
return createComponent(Element$1, {
|
|
4225
4258
|
get ["class"]() {
|
|
4226
|
-
return cs('inline-block', props.disabled && 'cursor-not-allowed');
|
|
4259
|
+
return cs('ant-color-picker-trigger inline-block', props.disabled && 'cursor-not-allowed');
|
|
4227
4260
|
},
|
|
4228
4261
|
get children() {
|
|
4229
4262
|
var _el$4 = _tmpl$4$8();
|
|
@@ -4561,7 +4594,7 @@ const Segmented = props => {
|
|
|
4561
4594
|
children: item
|
|
4562
4595
|
}));
|
|
4563
4596
|
effect(_p$ => {
|
|
4564
|
-
var _v$ = cs(props.block && 'basis-0 grow-1', isDisabledValue(item) && 'cursor-not-allowed'),
|
|
4597
|
+
var _v$ = cs('ant-segmented-item', props.block && 'basis-0 grow-1', isDisabledValue(item) && 'cursor-not-allowed'),
|
|
4565
4598
|
_v$2 = cs('rounded-[var(--ant-border-radius-sm)] px-[var(--ant-padding-sm)] cursor-pointer [white-space:nowrap]', isSelected(unWarpValue(item)) && 'bg-[var(--ant-segmented-item-selected-bg)]', isDisabledValue(item) ? '[pointer-events:none] text-[var(--ant-color-text-disabled)]' : isSelected(unWarpValue(item)) ? 'shadow-[var(--ant-box-shadow-tertiary)] text-[var(--ant-segmented-item-selected-color)]' : 'text-[var(--ant-segmented-item-color)] hover:text-[var(--ant-segmented-item-hover-color)] hover:bg-[var(--ant-segmented-item-hover-bg)] active:bg-[var(--ant-segmented-item-active-bg)]', props.block && 'flex justify-center', {
|
|
4566
4599
|
small: 'leading-20px',
|
|
4567
4600
|
middle: 'leading-28px',
|
|
@@ -7140,8 +7173,10 @@ function InternalMenu(props) {
|
|
|
7140
7173
|
});
|
|
7141
7174
|
return _el$6;
|
|
7142
7175
|
})(),
|
|
7143
|
-
|
|
7144
|
-
|
|
7176
|
+
contentHTMLAttributes: {
|
|
7177
|
+
style: {
|
|
7178
|
+
padding: 0
|
|
7179
|
+
}
|
|
7145
7180
|
},
|
|
7146
7181
|
get children() {
|
|
7147
7182
|
return getLabel({
|
|
@@ -7294,8 +7329,10 @@ const Dropdown = _props => {
|
|
|
7294
7329
|
props.menu?.onClick?.(info);
|
|
7295
7330
|
}
|
|
7296
7331
|
})),
|
|
7297
|
-
|
|
7298
|
-
|
|
7332
|
+
contentHTMLAttributes: {
|
|
7333
|
+
style: {
|
|
7334
|
+
padding: 0
|
|
7335
|
+
}
|
|
7299
7336
|
}
|
|
7300
7337
|
}, popoverProps, {
|
|
7301
7338
|
get children() {
|
|
@@ -7305,6 +7342,18 @@ const Dropdown = _props => {
|
|
|
7305
7342
|
};
|
|
7306
7343
|
|
|
7307
7344
|
var _tmpl$$1 = /*#__PURE__*/template(`<span class="absolute pointer-events-none z-2000">`);
|
|
7345
|
+
function createCursor(props) {
|
|
7346
|
+
const container = document.createElement('div');
|
|
7347
|
+
document.body.appendChild(container);
|
|
7348
|
+
const _dispose = render(() => createComponent(Cursor, props), container);
|
|
7349
|
+
const dispose = () => {
|
|
7350
|
+
_dispose();
|
|
7351
|
+
document.body.removeChild(container);
|
|
7352
|
+
};
|
|
7353
|
+
return {
|
|
7354
|
+
dispose
|
|
7355
|
+
};
|
|
7356
|
+
}
|
|
7308
7357
|
const Cursor = props => {
|
|
7309
7358
|
const resolvedChildren = children(() => props.children);
|
|
7310
7359
|
const [hover, setHover] = createSignal(false);
|
|
@@ -7313,30 +7362,47 @@ const Cursor = props => {
|
|
|
7313
7362
|
y: 0
|
|
7314
7363
|
});
|
|
7315
7364
|
let originalCursor;
|
|
7365
|
+
const onMouseEnter = (_, _children) => {
|
|
7366
|
+
setHover(true);
|
|
7367
|
+
originalCursor = _children.style.cursor;
|
|
7368
|
+
_children.style.cursor = 'none';
|
|
7369
|
+
};
|
|
7370
|
+
const onMouseMove = e => {
|
|
7371
|
+
setCursorPosition({
|
|
7372
|
+
x: e.clientX,
|
|
7373
|
+
y: e.clientY
|
|
7374
|
+
});
|
|
7375
|
+
};
|
|
7376
|
+
const onMouseLeave = (_, _children) => {
|
|
7377
|
+
setHover(false);
|
|
7378
|
+
if (originalCursor) {
|
|
7379
|
+
_children.style.cursor = originalCursor;
|
|
7380
|
+
} else {
|
|
7381
|
+
_children.style.removeProperty('cursor');
|
|
7382
|
+
}
|
|
7383
|
+
originalCursor = undefined;
|
|
7384
|
+
};
|
|
7385
|
+
setRef(props, {
|
|
7386
|
+
onMouseEnter,
|
|
7387
|
+
onMouseMove,
|
|
7388
|
+
onMouseLeave
|
|
7389
|
+
});
|
|
7316
7390
|
createEffect(() => {
|
|
7317
7391
|
const _children = resolvedChildren();
|
|
7318
7392
|
if (!(_children instanceof HTMLElement || _children instanceof SVGElement)) return;
|
|
7319
7393
|
const abortController = new AbortController();
|
|
7320
|
-
_children.addEventListener('mouseenter',
|
|
7321
|
-
|
|
7322
|
-
originalCursor = _children.style.cursor;
|
|
7323
|
-
_children.style.cursor = 'none';
|
|
7394
|
+
_children.addEventListener('mouseenter', e => {
|
|
7395
|
+
onMouseEnter(e, _children);
|
|
7324
7396
|
}, {
|
|
7325
7397
|
capture: true,
|
|
7326
7398
|
signal: abortController.signal
|
|
7327
7399
|
});
|
|
7328
|
-
_children.addEventListener('mousemove',
|
|
7329
|
-
setCursorPosition({
|
|
7330
|
-
x: e.clientX,
|
|
7331
|
-
y: e.clientY
|
|
7332
|
-
});
|
|
7333
|
-
}, {
|
|
7400
|
+
_children.addEventListener('mousemove', onMouseMove, {
|
|
7334
7401
|
capture: true,
|
|
7335
7402
|
signal: abortController.signal
|
|
7336
7403
|
});
|
|
7337
|
-
_children.addEventListener('mouseleave',
|
|
7338
|
-
|
|
7339
|
-
if (originalCursor) _children.style.cursor = originalCursor;
|
|
7404
|
+
_children.addEventListener('mouseleave', e => {
|
|
7405
|
+
onMouseLeave(e, _children);
|
|
7340
7406
|
}, {
|
|
7341
7407
|
capture: true,
|
|
7342
7408
|
signal: abortController.signal
|
|
@@ -7370,6 +7436,7 @@ const Cursor = props => {
|
|
|
7370
7436
|
}
|
|
7371
7437
|
})];
|
|
7372
7438
|
};
|
|
7439
|
+
Cursor.createCursor = createCursor;
|
|
7373
7440
|
|
|
7374
7441
|
function Space(props) {
|
|
7375
7442
|
return createComponent(Element$1, {
|
|
@@ -7423,7 +7490,8 @@ const CodeInput = _props => {
|
|
|
7423
7490
|
ref: el => {
|
|
7424
7491
|
inputRefDict[item] = el;
|
|
7425
7492
|
},
|
|
7426
|
-
|
|
7493
|
+
rootClass: "!w-32px",
|
|
7494
|
+
"class": "!text-center",
|
|
7427
7495
|
get value() {
|
|
7428
7496
|
return value()[item];
|
|
7429
7497
|
},
|