antd-solid 0.0.12 → 0.0.13
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 +10 -77
- package/dist/index.esm.js +7819 -2492
- package/dist/index.umd.js +1 -1
- package/es/Alert/index.d.ts +10 -0
- package/es/Alert/index.js +26 -0
- package/es/Button/index.d.ts +16 -4
- package/es/Button/index.js +107 -59
- package/es/Button/index.scss.js +1 -1
- package/es/Checkbox/Group.d.ts +19 -0
- package/es/Checkbox/Group.js +49 -0
- package/es/Checkbox/index.d.ts +15 -0
- package/es/Checkbox/index.js +60 -0
- package/es/CodeInput/index.d.ts +18 -0
- package/es/CodeInput/index.js +72 -0
- package/es/Collapse/Item.d.ts +46 -0
- package/es/Collapse/Item.js +130 -0
- package/es/Collapse/context.d.ts +5 -0
- package/es/Collapse/context.js +8 -0
- package/es/Collapse/index.d.ts +25 -10
- package/es/Collapse/index.js +95 -74
- package/es/Collapse/utils.d.ts +8 -0
- package/es/Collapse/utils.js +35 -0
- package/es/ColorPicker/ColorPickerInput.d.ts +3 -0
- package/es/ColorPicker/ColorPickerInput.js +250 -0
- package/es/ColorPicker/ColorPickerSelect.d.ts +3 -0
- package/es/ColorPicker/ColorPickerSelect.js +71 -0
- package/es/ColorPicker/ColorPickerSlider.d.ts +3 -0
- package/es/ColorPicker/ColorPickerSlider.js +115 -0
- package/es/ColorPicker/color.d.ts +24 -0
- package/es/ColorPicker/color.js +63 -0
- package/es/ColorPicker/context.d.ts +9 -0
- package/es/ColorPicker/context.js +5 -0
- package/es/ColorPicker/index.d.ts +31 -0
- package/es/ColorPicker/index.js +139 -0
- package/es/Command/context.d.ts +9 -0
- package/es/Command/context.js +11 -0
- package/es/Command/createCommand.d.ts +17 -0
- package/es/Command/createCommand.js +112 -0
- package/es/Command/index.d.ts +7 -0
- package/es/Command/index.js +9 -0
- package/es/Command/useCommandProps.d.ts +13 -0
- package/es/Command/useCommandProps.js +28 -0
- package/es/Compact/CompactContextIsolator.d.ts +3 -0
- package/es/Compact/CompactContextIsolator.js +15 -0
- package/es/Compact/context.d.ts +4 -0
- package/es/Compact/context.js +7 -0
- package/es/Compact/index.d.ts +11 -9
- package/es/Compact/index.js +28 -13
- package/es/Compact/index.scss.js +6 -0
- package/es/ConfigProvider/context.d.ts +11 -0
- package/es/ConfigProvider/context.js +15 -0
- package/es/ConfigProvider/dark/colorAlgorithm.d.ts +2 -0
- package/es/ConfigProvider/dark/colorAlgorithm.js +9 -0
- package/es/ConfigProvider/dark/colors.d.ts +3 -0
- package/es/ConfigProvider/dark/colors.js +47 -0
- package/es/ConfigProvider/dark/index.d.ts +2 -0
- package/es/ConfigProvider/dark/index.js +11 -0
- package/es/ConfigProvider/index.d.ts +32 -0
- package/es/ConfigProvider/index.js +44 -0
- package/es/ConfigProvider/light/colorAlgorithm.d.ts +2 -0
- package/es/ConfigProvider/light/colorAlgorithm.js +9 -0
- package/es/ConfigProvider/light/colors.d.ts +3 -0
- package/es/ConfigProvider/light/colors.js +45 -0
- package/es/ConfigProvider/light/index.d.ts +2 -0
- package/es/ConfigProvider/light/index.js +11 -0
- package/es/ConfigProvider/seed.d.ts +3 -0
- package/es/ConfigProvider/seed.js +22 -0
- package/es/ConfigProvider/types/index.d.ts +594 -0
- package/es/ConfigProvider/types/index.js +1 -0
- package/es/ConfigProvider/utils/genColorMapToken.d.ts +7 -0
- package/es/ConfigProvider/utils/genColorMapToken.js +85 -0
- package/es/ConfigProvider/utils/getAlphaColor.d.ts +2 -0
- package/es/ConfigProvider/utils/getAlphaColor.js +44 -0
- package/es/ConfigProvider/utils/index.d.ts +3 -0
- package/es/ConfigProvider/utils/index.js +181 -0
- package/es/ContextMenu/index.d.ts +8 -0
- package/es/ContextMenu/index.js +99 -0
- package/es/Cursor/index.d.ts +6 -0
- package/es/Cursor/index.js +71 -0
- package/es/DelayShow/index.d.ts +16 -0
- package/es/DelayShow/index.js +27 -0
- package/es/Divider/index.d.ts +17 -0
- package/es/Divider/index.js +71 -0
- package/es/Drawer/index.d.ts +20 -16
- package/es/Drawer/index.js +162 -111
- package/es/Drawer/index.scss.js +1 -1
- package/es/Dropdown/index.d.ts +16 -0
- package/es/Dropdown/index.js +47 -0
- package/es/Element/index.d.ts +10 -0
- package/es/Element/index.js +42 -0
- package/es/Empty/PRESENTED_IMAGE_SIMPLE.d.ts +2 -1
- package/es/Empty/PRESENTED_IMAGE_SIMPLE.js +25 -9
- package/es/Empty/assets/EmptySvg.js +1 -1
- package/es/Empty/assets/SimpleEmptySvg.js +1 -1
- package/es/Empty/index.d.ts +4 -2
- package/es/Empty/index.js +23 -13
- package/es/Form/Form.d.ts +8 -5
- package/es/Form/Form.js +50 -34
- package/es/Form/FormItem.d.ts +10 -5
- package/es/Form/FormItem.js +121 -104
- package/es/Form/context.d.ts +9 -9
- package/es/Form/context.js +4 -2
- package/es/Fragment/index.d.ts +4 -0
- package/es/Fragment/index.js +7 -0
- package/es/Image/index.d.ts +10 -0
- package/es/Image/index.js +37 -0
- package/es/Input/TextArea.d.ts +23 -0
- package/es/Input/TextArea.js +84 -0
- package/es/Input/index.d.ts +44 -0
- package/es/Input/index.js +213 -0
- package/es/Input/index.scss.js +6 -0
- package/es/InputNumber/index.d.ts +30 -0
- package/es/InputNumber/index.js +122 -0
- package/es/{InputNumber.test.js → InputNumber/index.test.js} +2 -1
- package/es/Menu/InternalMenu.d.ts +22 -0
- package/es/Menu/InternalMenu.js +196 -0
- package/es/Menu/index.d.ts +75 -0
- package/es/Menu/index.js +64 -0
- package/es/Message/Message.d.ts +9 -0
- package/es/Message/Message.js +34 -0
- package/es/Message/index.d.ts +12 -0
- package/es/Message/index.js +80 -0
- package/es/Message/index.scss.js +6 -0
- package/es/Message/useMessage.d.ts +6 -0
- package/es/Message/useMessage.js +54 -0
- package/es/Modal/index.d.ts +73 -0
- package/es/Modal/index.js +237 -0
- package/es/Modal/index.scss.js +6 -0
- package/es/Modal/useModal.d.ts +5 -0
- package/es/Modal/useModal.js +51 -0
- package/es/Modal/warning.d.ts +5 -0
- package/es/Modal/warning.js +43 -0
- package/es/{Popconfirm.d.ts → Popconfirm/index.d.ts} +2 -2
- package/es/Popconfirm/index.js +62 -0
- package/es/{Popover.d.ts → Popover/index.d.ts} +2 -2
- package/es/{Popover.js → Popover/index.js} +7 -12
- package/es/Progress/Circle.d.ts +16 -0
- package/es/Progress/Circle.js +122 -0
- package/es/Progress/index.d.ts +5 -2
- package/es/Progress/index.js +70 -65
- package/es/Radio/Button.d.ts +7 -0
- package/es/Radio/Button.js +72 -0
- package/es/Radio/Group.d.ts +18 -0
- package/es/Radio/Group.js +57 -0
- package/es/Radio/index.d.ts +14 -0
- package/es/Radio/index.js +68 -0
- package/es/RangeInput/index.d.ts +23 -0
- package/es/RangeInput/index.js +208 -0
- package/es/Result/index.js +49 -0
- package/es/Segmented/index.d.ts +10 -7
- package/es/Segmented/index.js +54 -53
- package/es/Select/index.d.ts +17 -0
- package/es/Select/index.js +75 -0
- package/es/SelectInput/index.d.ts +39 -0
- package/es/SelectInput/index.js +245 -0
- package/es/Slider/index.d.ts +47 -0
- package/es/Slider/index.js +177 -0
- package/es/Space/index.d.ts +13 -0
- package/es/Space/index.js +16 -0
- package/es/Spin/index.d.ts +19 -0
- package/es/Spin/index.js +82 -0
- package/es/{Switch.d.ts → Switch/index.d.ts} +9 -0
- package/es/Switch/index.js +41 -0
- package/es/{Table.d.ts → Table/index.d.ts} +6 -2
- package/es/Table/index.js +71 -0
- package/es/Tabs/index.d.ts +49 -0
- package/es/Tabs/index.js +256 -0
- package/es/Timeline/index.js +31 -0
- package/es/Tooltip/context.d.ts +5 -0
- package/es/Tooltip/context.js +5 -0
- package/es/Tooltip/index.d.ts +64 -0
- package/es/Tooltip/index.js +499 -0
- package/es/Transformer/index.d.ts +88 -0
- package/es/Transformer/index.js +882 -0
- package/es/Tree/SingleLevelTree.d.ts +28 -0
- package/es/Tree/SingleLevelTree.js +299 -0
- package/es/Tree/index.d.ts +83 -0
- package/es/Tree/index.js +197 -0
- package/es/TreeFor/index.d.ts +31 -0
- package/es/TreeFor/index.js +80 -0
- package/es/TreeSelect/index.d.ts +26 -0
- package/es/TreeSelect/index.js +98 -0
- package/es/{Upload.d.ts → Upload/index.d.ts} +8 -1
- package/es/Upload/index.js +112 -0
- package/es/assets/svg/ColorPickUp.d.ts +4 -0
- package/es/assets/svg/ColorPickUp.js +25 -0
- package/es/assets/svg/Crosshair.d.ts +7 -0
- package/es/assets/svg/Crosshair.js +51 -0
- package/es/assets/svg/Resize.d.ts +4 -0
- package/es/assets/svg/Resize.js +25 -0
- package/es/assets/svg/Rotate.d.ts +4 -0
- package/es/assets/svg/Rotate.js +20 -0
- package/es/assets/svg/RotateArrow.d.ts +4 -0
- package/es/assets/svg/RotateArrow.js +21 -0
- package/es/assets/svg/common.d.ts +2 -0
- package/es/assets/svg/common.js +9 -0
- package/es/hooks/createControllableValue.d.ts +1 -1
- package/es/hooks/createControllableValue.js +16 -17
- package/es/hooks/createTransition.d.ts +6 -2
- package/es/hooks/createTransition.js +12 -8
- package/es/hooks/useClickAway.d.ts +1 -1
- package/es/hooks/useClickAway.js +4 -3
- package/es/hooks/useComponentSize.d.ts +3 -0
- package/es/hooks/useComponentSize.js +12 -0
- package/es/hooks/useCounter.d.ts +12 -0
- package/es/hooks/useCounter.js +30 -0
- package/es/hooks/useFocus.d.ts +2 -0
- package/es/hooks/useFocus.js +24 -0
- package/es/hooks/useHover.d.ts +2 -0
- package/es/hooks/useHover.js +33 -0
- package/es/hooks/useLocale.d.ts +1 -0
- package/es/hooks/useLocale.js +11 -0
- package/es/hooks/useMouse.d.ts +1 -0
- package/es/hooks/useMouse.js +18 -0
- package/es/hooks/useScroll.d.ts +2 -0
- package/es/hooks/useScroll.js +29 -0
- package/es/hooks/useSize.d.ts +8 -2
- package/es/hooks/useSize.js +25 -13
- package/es/hooks/useVirtualList.d.ts +14 -0
- package/es/hooks/useVirtualList.js +45 -0
- package/es/index.d.ts +59 -8
- package/es/index.js +51 -21
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +9 -0
- package/es/locale/index.d.ts +5 -0
- package/es/locale/index.js +1 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +9 -0
- package/es/types/index.d.ts +11 -2
- package/es/utils/animation.d.ts +6 -0
- package/es/utils/animation.js +20 -0
- package/es/utils/array.d.ts +2 -1
- package/es/utils/array.js +5 -1
- package/es/utils/domPoint.d.ts +7 -0
- package/es/utils/domPoint.js +11 -0
- package/es/utils/math.d.ts +17 -0
- package/es/utils/math.js +25 -0
- package/es/utils/number.d.ts +1 -0
- package/es/utils/number.js +14 -0
- package/es/utils/setupGlobalDrag.d.ts +10 -0
- package/es/utils/setupGlobalDrag.js +38 -0
- package/es/utils/solid.d.ts +2 -2
- package/es/utils/solid.js +7 -8
- package/package.json +10 -11
- package/es/ColorPicker.d.ts +0 -8
- package/es/ColorPicker.js +0 -6
- package/es/DatePicker.d.ts +0 -19
- package/es/DatePicker.js +0 -9
- package/es/Image.d.ts +0 -9
- package/es/Image.js +0 -22
- package/es/Input.d.ts +0 -29
- package/es/Input.js +0 -144
- package/es/InputNumber.d.ts +0 -11
- package/es/InputNumber.js +0 -92
- package/es/Modal.d.ts +0 -47
- package/es/Modal.js +0 -210
- package/es/Popconfirm.js +0 -64
- package/es/Radio.d.ts +0 -27
- package/es/Radio.js +0 -93
- package/es/Result.js +0 -29
- package/es/Select.d.ts +0 -16
- package/es/Select.js +0 -113
- package/es/Skeleton.d.ts +0 -9
- package/es/Skeleton.js +0 -9
- package/es/Spin.d.ts +0 -10
- package/es/Spin.js +0 -28
- package/es/Switch.js +0 -30
- package/es/Table.js +0 -57
- package/es/Tabs.d.ts +0 -17
- package/es/Tabs.js +0 -117
- package/es/Timeline.js +0 -30
- package/es/Tooltip.d.ts +0 -34
- package/es/Tooltip.js +0 -302
- package/es/Tree.d.ts +0 -28
- package/es/Tree.js +0 -198
- package/es/Upload.js +0 -96
- package/es/hooks/createUpdateEffect.d.ts +0 -5
- package/es/hooks/createUpdateEffect.js +0 -12
- package/es/utils/EventEmitter.d.ts +0 -7
- package/es/utils/EventEmitter.js +0 -13
- package/es/utils/ReactToSolid.d.ts +0 -8
- package/es/utils/ReactToSolid.js +0 -30
- package/es/utils/SolidToReact.d.ts +0 -8
- package/es/utils/SolidToReact.js +0 -23
- package/es/utils/component.d.ts +0 -31
- package/es/utils/component.js +0 -68
- package/es/utils/zh_CN.d.ts +0 -2
- package/es/utils/zh_CN.js +0 -236
- package/src/Button/index.scss +0 -9
- package/src/Button/index.tsx +0 -137
- package/src/Collapse/index.tsx +0 -86
- package/src/ColorPicker.tsx +0 -11
- package/src/Compact/index.tsx +0 -20
- package/src/DatePicker.tsx +0 -30
- package/src/Drawer/index.scss +0 -53
- package/src/Drawer/index.tsx +0 -211
- package/src/Empty/PRESENTED_IMAGE_SIMPLE.tsx +0 -15
- package/src/Empty/assets/EmptySvg.tsx +0 -43
- package/src/Empty/assets/SimpleEmptySvg.tsx +0 -16
- package/src/Empty/index.tsx +0 -25
- package/src/Form/Form.tsx +0 -94
- package/src/Form/FormItem.tsx +0 -141
- package/src/Form/context.ts +0 -16
- package/src/Form/index.ts +0 -13
- package/src/Image.tsx +0 -29
- package/src/Input.tsx +0 -202
- package/src/InputNumber.test.tsx +0 -46
- package/src/InputNumber.tsx +0 -139
- package/src/Modal.tsx +0 -221
- package/src/Popconfirm.tsx +0 -75
- package/src/Popover.tsx +0 -30
- package/src/Progress/index.tsx +0 -81
- package/src/Radio.tsx +0 -142
- package/src/Result.tsx +0 -38
- package/src/Segmented/index.tsx +0 -95
- package/src/Select.tsx +0 -138
- package/src/Skeleton.tsx +0 -14
- package/src/Spin.tsx +0 -34
- package/src/Switch.tsx +0 -34
- package/src/Table.tsx +0 -53
- package/src/Tabs.tsx +0 -131
- package/src/Timeline.tsx +0 -33
- package/src/Tooltip.tsx +0 -340
- package/src/Tree.tsx +0 -247
- package/src/Upload.tsx +0 -143
- package/src/hooks/createControllableValue.ts +0 -68
- package/src/hooks/createTransition.ts +0 -52
- package/src/hooks/createUpdateEffect.ts +0 -16
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useClickAway.ts +0 -18
- package/src/hooks/useSize.ts +0 -26
- package/src/index.ts +0 -47
- package/src/types/index.ts +0 -5
- package/src/utils/EventEmitter.ts +0 -15
- package/src/utils/ReactToSolid.tsx +0 -38
- package/src/utils/SolidToReact.tsx +0 -27
- package/src/utils/array.ts +0 -21
- package/src/utils/component.tsx +0 -85
- package/src/utils/solid.ts +0 -61
- package/src/utils/zh_CN.ts +0 -236
- /package/es/{InputNumber.test.d.ts → InputNumber/index.test.d.ts} +0 -0
- /package/es/{Result.d.ts → Result/index.d.ts} +0 -0
- /package/es/{Timeline.d.ts → Timeline/index.d.ts} +0 -0
package/es/hooks/useClickAway.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { onCleanup } from 'solid-js';
|
|
2
|
+
import { compact } from 'lodash-es';
|
|
2
3
|
import { toArray } from '../utils/array.js';
|
|
3
4
|
|
|
4
5
|
function useClickAway(onClickAway, target) {
|
|
5
6
|
const onClick = event => {
|
|
6
|
-
const targets = target ? toArray(target()) : [];
|
|
7
|
+
const targets = compact(target ? toArray(target()) : []);
|
|
7
8
|
if (targets.every(item => !item.contains(event.target))) {
|
|
8
9
|
onClickAway(event);
|
|
9
10
|
}
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
window.addEventListener('click', onClick);
|
|
12
13
|
onCleanup(() => {
|
|
13
|
-
|
|
14
|
+
window.removeEventListener('click', onClick);
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext, createMemo } from 'solid-js';
|
|
2
|
+
import ConfigProviderContext from '../ConfigProvider/context.js';
|
|
3
|
+
|
|
4
|
+
function useComponentSize(size) {
|
|
5
|
+
const {
|
|
6
|
+
componentSize
|
|
7
|
+
} = useContext(ConfigProviderContext);
|
|
8
|
+
const _size = createMemo(() => size() ?? componentSize());
|
|
9
|
+
return _size;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useComponentSize as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Accessor, type Setter } from 'solid-js';
|
|
2
|
+
declare function useCounter(initialValue: number, options?: {
|
|
3
|
+
min?: number | Accessor<number>;
|
|
4
|
+
max?: number | Accessor<number>;
|
|
5
|
+
step?: number | Accessor<number>;
|
|
6
|
+
}): readonly [Accessor<number>, {
|
|
7
|
+
readonly set: Setter<number>;
|
|
8
|
+
readonly inc: (stepValue?: number) => number;
|
|
9
|
+
readonly dec: (stepValue?: number) => number;
|
|
10
|
+
readonly reset: () => number;
|
|
11
|
+
}];
|
|
12
|
+
export default useCounter;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { clamp } from 'lodash-es';
|
|
2
|
+
import { createSignal } from 'solid-js';
|
|
3
|
+
import NP from 'number-precision';
|
|
4
|
+
import { unwrapFunction } from '../utils/solid.js';
|
|
5
|
+
|
|
6
|
+
function useCounter(initialValue, options) {
|
|
7
|
+
const [value, setValue] = createSignal(initialValue);
|
|
8
|
+
const step = options?.step ?? 1;
|
|
9
|
+
const set = v => {
|
|
10
|
+
const newV = typeof v === 'function' ? v(value()) : v;
|
|
11
|
+
return setValue(clamp(newV, unwrapFunction(options?.min ?? -Infinity), unwrapFunction(options?.max ?? Infinity)));
|
|
12
|
+
};
|
|
13
|
+
const inc = stepValue => {
|
|
14
|
+
return set(NP.plus(value(), stepValue ?? unwrapFunction(step)));
|
|
15
|
+
};
|
|
16
|
+
const dec = stepValue => {
|
|
17
|
+
return set(NP.minus(value(), stepValue ?? unwrapFunction(step)));
|
|
18
|
+
};
|
|
19
|
+
const reset = () => {
|
|
20
|
+
return setValue(initialValue);
|
|
21
|
+
};
|
|
22
|
+
return [value, {
|
|
23
|
+
set,
|
|
24
|
+
inc,
|
|
25
|
+
dec,
|
|
26
|
+
reset
|
|
27
|
+
}];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { useCounter as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createSignal, createEffect, onCleanup } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
function useFocus(target) {
|
|
4
|
+
const [hover, setHover] = createSignal(false);
|
|
5
|
+
createEffect(() => {
|
|
6
|
+
const _target = target();
|
|
7
|
+
if (!_target) return;
|
|
8
|
+
const onMouseEnter = () => {
|
|
9
|
+
setHover(true);
|
|
10
|
+
};
|
|
11
|
+
_target.addEventListener('focusin', onMouseEnter);
|
|
12
|
+
const onMouseLeave = () => {
|
|
13
|
+
setHover(false);
|
|
14
|
+
};
|
|
15
|
+
_target.addEventListener('focusout', onMouseLeave);
|
|
16
|
+
onCleanup(() => {
|
|
17
|
+
_target.removeEventListener('focusin', onMouseEnter);
|
|
18
|
+
_target.removeEventListener('focusout', onMouseLeave);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return hover;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { useFocus as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createSignal, createEffect, onCleanup } from 'solid-js';
|
|
2
|
+
import { toArray } from '../utils/array.js';
|
|
3
|
+
|
|
4
|
+
function useHover(target) {
|
|
5
|
+
const [hover, setHover] = createSignal(false);
|
|
6
|
+
createEffect(() => {
|
|
7
|
+
const _target = target();
|
|
8
|
+
if (!_target) {
|
|
9
|
+
setHover(false);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const onMouseEnter = () => {
|
|
13
|
+
setHover(true);
|
|
14
|
+
};
|
|
15
|
+
const onMouseLeave = () => {
|
|
16
|
+
setHover(false);
|
|
17
|
+
};
|
|
18
|
+
const targetList = toArray(_target);
|
|
19
|
+
targetList.forEach(item => {
|
|
20
|
+
item.addEventListener('mouseenter', onMouseEnter);
|
|
21
|
+
item.addEventListener('mouseleave', onMouseLeave);
|
|
22
|
+
});
|
|
23
|
+
onCleanup(() => {
|
|
24
|
+
targetList.forEach(item => {
|
|
25
|
+
item.removeEventListener('mouseenter', onMouseEnter);
|
|
26
|
+
item.removeEventListener('mouseleave', onMouseLeave);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return hover;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { useHover as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useLocale(): import("solid-js").Accessor<import("../locale").Locale>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useMouse(): import("solid-js").Accessor<MouseEvent | undefined>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createSignal, onCleanup } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
function useMouse() {
|
|
4
|
+
const [mouse, setMouse] = createSignal();
|
|
5
|
+
const abortController = new AbortController();
|
|
6
|
+
window.addEventListener('mousemove', e => {
|
|
7
|
+
setMouse(e);
|
|
8
|
+
}, {
|
|
9
|
+
capture: true,
|
|
10
|
+
signal: abortController.signal
|
|
11
|
+
});
|
|
12
|
+
onCleanup(() => {
|
|
13
|
+
abortController.abort();
|
|
14
|
+
});
|
|
15
|
+
return mouse;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useMouse as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isEqual } from 'lodash-es';
|
|
2
|
+
import { createSignal, createEffect, onCleanup } from 'solid-js';
|
|
3
|
+
|
|
4
|
+
function useScroll(target) {
|
|
5
|
+
const [scroll, setScroll] = createSignal({
|
|
6
|
+
left: 0,
|
|
7
|
+
top: 0
|
|
8
|
+
}, {
|
|
9
|
+
equals: isEqual
|
|
10
|
+
});
|
|
11
|
+
createEffect(() => {
|
|
12
|
+
const _target = target();
|
|
13
|
+
if (!_target) return;
|
|
14
|
+
const onScroll = () => {
|
|
15
|
+
setScroll({
|
|
16
|
+
left: _target.scrollLeft,
|
|
17
|
+
top: _target.scrollTop
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
onScroll();
|
|
21
|
+
_target.addEventListener('scroll', onScroll);
|
|
22
|
+
onCleanup(() => {
|
|
23
|
+
_target.removeEventListener('scroll', onScroll);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
return scroll;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { useScroll as default };
|
package/es/hooks/useSize.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { Accessor } from 'solid-js';
|
|
2
|
-
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* 获取元素尺寸
|
|
4
|
+
* @param target
|
|
5
|
+
* @param type 宽高的类型,'client' 代表 clientWidth、clientHeight,'offset' 代表 offsetWidth、offsetHeight
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export default function useSize(target: Accessor<HTMLElement | undefined>, type?: 'client' | 'offset'): Accessor<{
|
|
3
9
|
width: number;
|
|
4
10
|
height: number;
|
|
5
11
|
} | undefined>;
|
package/es/hooks/useSize.js
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEqual } from 'lodash-es';
|
|
2
|
+
import { createSignal, createEffect, onCleanup } from 'solid-js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 获取元素尺寸
|
|
6
|
+
* @param target
|
|
7
|
+
* @param type 宽高的类型,'client' 代表 clientWidth、clientHeight,'offset' 代表 offsetWidth、offsetHeight
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
function useSize(target, type = 'client') {
|
|
11
|
+
const [size, setSize] = createSignal(undefined, {
|
|
12
|
+
equals: isEqual
|
|
13
|
+
});
|
|
14
|
+
createEffect(() => {
|
|
15
|
+
const _target = target();
|
|
16
|
+
if (!_target) return;
|
|
17
|
+
const callback = () => {
|
|
11
18
|
setSize({
|
|
12
|
-
width: _target.clientWidth,
|
|
13
|
-
height: _target.clientHeight
|
|
19
|
+
width: type === 'offset' ? _target.offsetWidth : _target.clientWidth,
|
|
20
|
+
height: type === 'offset' ? _target.offsetHeight : _target.clientHeight
|
|
14
21
|
});
|
|
15
|
-
}
|
|
22
|
+
};
|
|
23
|
+
// ResizeObserver observe 后虽然也会立刻执行 callback,但它执行不及时
|
|
24
|
+
callback();
|
|
25
|
+
const ro = new ResizeObserver(callback);
|
|
16
26
|
ro.observe(_target);
|
|
17
|
-
onCleanup(() =>
|
|
27
|
+
onCleanup(() => {
|
|
28
|
+
ro.disconnect();
|
|
29
|
+
});
|
|
18
30
|
});
|
|
19
31
|
return size;
|
|
20
32
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
export interface Options {
|
|
3
|
+
containerTarget: Accessor<HTMLElement>;
|
|
4
|
+
wrapperTarget: Accessor<HTMLElement>;
|
|
5
|
+
itemSize: Accessor<number>;
|
|
6
|
+
/**
|
|
7
|
+
* 垂直或者水平方向,默认 vertical
|
|
8
|
+
*/
|
|
9
|
+
layout?: Accessor<'vertical' | 'horizontal'>;
|
|
10
|
+
}
|
|
11
|
+
declare const useVirtualList: <T = any>(list: Accessor<T[]>, options: Options) => {
|
|
12
|
+
list: Accessor<T[]>;
|
|
13
|
+
};
|
|
14
|
+
export default useVirtualList;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createSignal, createMemo, createEffect, onCleanup, untrack } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
const useVirtualList = (list, options) => {
|
|
4
|
+
const [range, setRange] = createSignal([0, 0]);
|
|
5
|
+
const layout = createMemo(() => options.layout?.() ?? 'vertical');
|
|
6
|
+
const calculateRange = () => {
|
|
7
|
+
const container = options.containerTarget();
|
|
8
|
+
const wrapper = options.wrapperTarget();
|
|
9
|
+
const wrapperStyle = getComputedStyle(wrapper);
|
|
10
|
+
const scrollSize = layout() === 'vertical' ? container.scrollTop - parseFloat(wrapperStyle.borderTopWidth) - parseFloat(wrapperStyle.paddingTop) : container.scrollLeft - parseFloat(wrapperStyle.borderLeftWidth) - parseFloat(wrapperStyle.paddingLeft);
|
|
11
|
+
const clientSize = layout() === 'vertical' ? container.clientHeight : container.clientWidth;
|
|
12
|
+
const start = Math.floor(Math.max(scrollSize, 0) / options.itemSize());
|
|
13
|
+
const end = Math.ceil(Math.max(scrollSize + clientSize, 0) / options.itemSize());
|
|
14
|
+
setRange([start, end]);
|
|
15
|
+
const totalSize = options.itemSize() * list().length;
|
|
16
|
+
const translateSize = start * options.itemSize();
|
|
17
|
+
if (layout() === 'vertical') {
|
|
18
|
+
wrapper.style.marginTop = `${translateSize}px`;
|
|
19
|
+
wrapper.style.height = `${totalSize - translateSize}px`;
|
|
20
|
+
} else {
|
|
21
|
+
wrapper.style.marginLeft = `${translateSize}px`;
|
|
22
|
+
wrapper.style.width = `${totalSize - translateSize}px`;
|
|
23
|
+
}
|
|
24
|
+
wrapper.style.boxSizing = 'content-box';
|
|
25
|
+
};
|
|
26
|
+
createEffect(() => {
|
|
27
|
+
const container = options.containerTarget();
|
|
28
|
+
const onScroll = () => {
|
|
29
|
+
untrack(calculateRange);
|
|
30
|
+
};
|
|
31
|
+
container.addEventListener('scroll', onScroll);
|
|
32
|
+
onCleanup(() => {
|
|
33
|
+
container.removeEventListener('scroll', onScroll);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
createEffect(() => {
|
|
37
|
+
calculateRange();
|
|
38
|
+
});
|
|
39
|
+
const rangeList = createMemo(() => list().slice(...range()));
|
|
40
|
+
return {
|
|
41
|
+
list: rangeList
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { useVirtualList as default };
|
package/es/index.d.ts
CHANGED
|
@@ -1,45 +1,96 @@
|
|
|
1
1
|
export { default as Button } from './Button';
|
|
2
2
|
export { default as Input } from './Input';
|
|
3
|
-
export type { InputProps } from './Input';
|
|
3
|
+
export type { InputProps, TextAreaProps } from './Input';
|
|
4
4
|
export { default as InputNumber } from './InputNumber';
|
|
5
5
|
export type { InputNumberProps } from './InputNumber';
|
|
6
6
|
export { default as Timeline } from './Timeline';
|
|
7
7
|
export { default as Modal } from './Modal';
|
|
8
|
-
export type {
|
|
8
|
+
export type { ModalProps } from './Modal';
|
|
9
9
|
export { default as Drawer } from './Drawer';
|
|
10
|
-
export type { DrawerProps
|
|
11
|
-
export {
|
|
10
|
+
export type { DrawerProps } from './Drawer';
|
|
11
|
+
export type { RangeInputProps } from './RangeInput';
|
|
12
|
+
export { default as RangeInput } from './RangeInput';
|
|
13
|
+
export type { SelectInputProps } from './SelectInput';
|
|
14
|
+
export { default as SelectInput } from './SelectInput';
|
|
12
15
|
export { default as Select } from './Select';
|
|
16
|
+
export type { SelectProps, SelectOption } from './Select';
|
|
13
17
|
export { default as Tree } from './Tree';
|
|
14
18
|
export type { TreeProps } from './Tree';
|
|
15
19
|
export { default as Popover } from './Popover';
|
|
20
|
+
export type { PopoverProps } from './Popover';
|
|
16
21
|
export { default as Tooltip } from './Tooltip';
|
|
22
|
+
export type { TooltipProps } from './Tooltip';
|
|
17
23
|
export { default as ColorPicker } from './ColorPicker';
|
|
18
24
|
export type { ColorPickerProps } from './ColorPicker';
|
|
19
25
|
export { default as Result } from './Result';
|
|
20
26
|
export { default as Progress } from './Progress';
|
|
21
27
|
export type { ProgressProps } from './Progress';
|
|
22
28
|
export { default as Tabs } from './Tabs';
|
|
23
|
-
export type { TabsProps,
|
|
29
|
+
export type { TabsProps, TabItem } from './Tabs';
|
|
24
30
|
export { default as Popconfirm } from './Popconfirm';
|
|
31
|
+
export type { PopconfirmProps } from './Popconfirm';
|
|
25
32
|
export { default as Upload } from './Upload';
|
|
26
33
|
export type { UploadProps, UploadFile } from './Upload';
|
|
27
34
|
export { default as Radio } from './Radio';
|
|
28
|
-
export type { RadioProps
|
|
35
|
+
export type { RadioProps } from './Radio';
|
|
36
|
+
export type { RadioGroupProps } from './Radio/Group';
|
|
29
37
|
export { default as Form } from './Form';
|
|
30
38
|
export type { FormInstance, FormProps, FormItemProps, FormItemComponentProps } from './Form';
|
|
31
39
|
export { default as Switch } from './Switch';
|
|
32
40
|
export type { SwitchProps } from './Switch';
|
|
33
|
-
export { default as Skeleton } from './Skeleton';
|
|
34
41
|
export { default as Spin } from './Spin';
|
|
35
42
|
export { default as Image } from './Image';
|
|
43
|
+
export type { ImageProps } from './Image';
|
|
36
44
|
export { default as Table } from './Table';
|
|
37
45
|
export type { TableProps, TableColumn } from './Table';
|
|
38
46
|
export { default as Compact } from './Compact';
|
|
47
|
+
export { default as CompactContextIsolator } from './Compact/CompactContextIsolator';
|
|
39
48
|
export type { CollapseProps, CollapseItem } from './Collapse';
|
|
40
49
|
export { default as Collapse } from './Collapse';
|
|
41
50
|
export { default as Empty } from './Empty';
|
|
42
51
|
export type { SegmentedProps } from './Segmented';
|
|
43
52
|
export { default as Segmented } from './Segmented';
|
|
53
|
+
export type { AlertProps } from './Alert';
|
|
54
|
+
export { default as Alert } from './Alert';
|
|
55
|
+
export { default as Checkbox } from './Checkbox';
|
|
56
|
+
export type { CheckboxProps } from './Checkbox';
|
|
57
|
+
export { default as TreeSelect } from './TreeSelect';
|
|
58
|
+
export type { TreeSelectProps, TreeSelectNode } from './TreeSelect';
|
|
59
|
+
export { default as Divider } from './Divider';
|
|
60
|
+
export type { DividerProps } from './Divider';
|
|
61
|
+
export { default as Slider } from './Slider';
|
|
62
|
+
export type { SliderProps } from './Slider';
|
|
63
|
+
export { default as Transformer } from './Transformer';
|
|
64
|
+
export type { TransformerProps, TransformValue, TransformerInstance } from './Transformer';
|
|
65
|
+
export { default as Menu } from './Menu';
|
|
66
|
+
export type { MenuProps, MenuItem, MenuItemType, MenuDividerType } from './Menu';
|
|
67
|
+
export { default as Dropdown } from './Dropdown';
|
|
68
|
+
export type { DropdownProps } from './Dropdown';
|
|
69
|
+
export { default as Element } from './Element';
|
|
70
|
+
export type { ElementProps } from './Element';
|
|
71
|
+
export { default as Cursor } from './Cursor';
|
|
72
|
+
export type { CursorProps } from './Cursor';
|
|
73
|
+
export { default as Space } from './Space';
|
|
74
|
+
export { default as CodeInput } from './CodeInput';
|
|
75
|
+
export type { CodeInputProps } from './CodeInput';
|
|
76
|
+
export { default as message } from './Message';
|
|
77
|
+
export type { MessageApi } from './Message';
|
|
78
|
+
export { default as Command } from './Command';
|
|
79
|
+
export { default as ContextMenu } from './ContextMenu';
|
|
80
|
+
export { default as ConfigProvider } from './ConfigProvider';
|
|
81
|
+
export { default as Fragment } from './Fragment';
|
|
82
|
+
export { default as DelayShow } from './DelayShow';
|
|
83
|
+
export { default as TreeFor } from './TreeFor';
|
|
44
84
|
export { default as createControllableValue } from './hooks/createControllableValue';
|
|
45
|
-
export {
|
|
85
|
+
export { default as useClickAway } from './hooks/useClickAway';
|
|
86
|
+
export { default as useSize } from './hooks/useSize';
|
|
87
|
+
export { default as useScroll } from './hooks/useScroll';
|
|
88
|
+
export { default as useHover } from './hooks/useHover';
|
|
89
|
+
export { default as useFocus } from './hooks/useFocus';
|
|
90
|
+
export { default as useVirtualList } from './hooks/useVirtualList';
|
|
91
|
+
export { default as useCounter } from './hooks/useCounter';
|
|
92
|
+
export { default as useMouse } from './hooks/useMouse';
|
|
93
|
+
export { setupGlobalDrag } from './utils/setupGlobalDrag';
|
|
94
|
+
export type { ComponentSize } from './types';
|
|
95
|
+
export { default as enUS } from './locale/en_US';
|
|
96
|
+
export { default as zhCN } from './locale/zh_CN';
|
package/es/index.js
CHANGED
|
@@ -1,30 +1,60 @@
|
|
|
1
1
|
export { default as Button } from './Button/index.js';
|
|
2
|
-
export { default as Input } from './Input.js';
|
|
3
|
-
export { default as InputNumber } from './InputNumber.js';
|
|
4
|
-
export { default as Timeline } from './Timeline.js';
|
|
5
|
-
export { default as Modal } from './Modal.js';
|
|
2
|
+
export { default as Input } from './Input/index.js';
|
|
3
|
+
export { default as InputNumber } from './InputNumber/index.js';
|
|
4
|
+
export { default as Timeline } from './Timeline/index.js';
|
|
5
|
+
export { default as Modal } from './Modal/index.js';
|
|
6
6
|
export { default as Drawer } from './Drawer/index.js';
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as
|
|
7
|
+
export { default as RangeInput } from './RangeInput/index.js';
|
|
8
|
+
export { default as SelectInput } from './SelectInput/index.js';
|
|
9
|
+
export { default as Select } from './Select/index.js';
|
|
10
|
+
export { default as Tree } from './Tree/index.js';
|
|
11
|
+
export { default as Popover } from './Popover/index.js';
|
|
12
|
+
export { default as Tooltip } from './Tooltip/index.js';
|
|
13
|
+
export { default as ColorPicker } from './ColorPicker/index.js';
|
|
14
|
+
export { default as Result } from './Result/index.js';
|
|
14
15
|
export { default as Progress } from './Progress/index.js';
|
|
15
|
-
export { default as Tabs } from './Tabs.js';
|
|
16
|
-
export { default as Popconfirm } from './Popconfirm.js';
|
|
17
|
-
export { default as Upload } from './Upload.js';
|
|
18
|
-
export { default as Radio } from './Radio.js';
|
|
16
|
+
export { default as Tabs } from './Tabs/index.js';
|
|
17
|
+
export { default as Popconfirm } from './Popconfirm/index.js';
|
|
18
|
+
export { default as Upload } from './Upload/index.js';
|
|
19
|
+
export { default as Radio } from './Radio/index.js';
|
|
19
20
|
export { default as Form } from './Form/index.js';
|
|
20
|
-
export { default as Switch } from './Switch.js';
|
|
21
|
-
export { default as
|
|
22
|
-
export { default as
|
|
23
|
-
export { default as
|
|
24
|
-
export { default as Table } from './Table.js';
|
|
21
|
+
export { default as Switch } from './Switch/index.js';
|
|
22
|
+
export { default as Spin } from './Spin/index.js';
|
|
23
|
+
export { default as Image } from './Image/index.js';
|
|
24
|
+
export { default as Table } from './Table/index.js';
|
|
25
25
|
export { default as Compact } from './Compact/index.js';
|
|
26
|
+
export { default as CompactContextIsolator } from './Compact/CompactContextIsolator.js';
|
|
26
27
|
export { default as Collapse } from './Collapse/index.js';
|
|
27
28
|
export { default as Empty } from './Empty/index.js';
|
|
28
29
|
export { default as Segmented } from './Segmented/index.js';
|
|
30
|
+
export { default as Alert } from './Alert/index.js';
|
|
31
|
+
export { default as Checkbox } from './Checkbox/index.js';
|
|
32
|
+
export { default as TreeSelect } from './TreeSelect/index.js';
|
|
33
|
+
export { default as Divider } from './Divider/index.js';
|
|
34
|
+
export { default as Slider } from './Slider/index.js';
|
|
35
|
+
export { default as Transformer } from './Transformer/index.js';
|
|
36
|
+
export { default as Menu } from './Menu/index.js';
|
|
37
|
+
export { default as Dropdown } from './Dropdown/index.js';
|
|
38
|
+
export { default as Element } from './Element/index.js';
|
|
39
|
+
export { default as Cursor } from './Cursor/index.js';
|
|
40
|
+
export { default as Space } from './Space/index.js';
|
|
41
|
+
export { default as CodeInput } from './CodeInput/index.js';
|
|
42
|
+
export { default as message } from './Message/index.js';
|
|
43
|
+
export { default as Command } from './Command/index.js';
|
|
44
|
+
export { default as ContextMenu } from './ContextMenu/index.js';
|
|
45
|
+
export { default as ConfigProvider } from './ConfigProvider/index.js';
|
|
46
|
+
export { default as Fragment } from './Fragment/index.js';
|
|
47
|
+
export { default as DelayShow } from './DelayShow/index.js';
|
|
48
|
+
export { default as TreeFor } from './TreeFor/index.js';
|
|
29
49
|
export { default as createControllableValue } from './hooks/createControllableValue.js';
|
|
30
|
-
export {
|
|
50
|
+
export { default as useClickAway } from './hooks/useClickAway.js';
|
|
51
|
+
export { default as useSize } from './hooks/useSize.js';
|
|
52
|
+
export { default as useScroll } from './hooks/useScroll.js';
|
|
53
|
+
export { default as useHover } from './hooks/useHover.js';
|
|
54
|
+
export { default as useFocus } from './hooks/useFocus.js';
|
|
55
|
+
export { default as useVirtualList } from './hooks/useVirtualList.js';
|
|
56
|
+
export { default as useCounter } from './hooks/useCounter.js';
|
|
57
|
+
export { default as useMouse } from './hooks/useMouse.js';
|
|
58
|
+
export { setupGlobalDrag } from './utils/setupGlobalDrag.js';
|
|
59
|
+
export { default as enUS } from './locale/en_US.js';
|
|
60
|
+
export { default as zhCN } from './locale/zh_CN.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/es/types/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import { type JSXElement } from 'solid-js';
|
|
1
|
+
import { type JSXElement, type JSX } from 'solid-js';
|
|
2
2
|
export type Key = string | number;
|
|
3
|
-
export type StringOrJSXElement =
|
|
3
|
+
export type StringOrJSXElement = JSXElement | (() => JSXElement);
|
|
4
|
+
export interface StyleProps {
|
|
5
|
+
class?: string;
|
|
6
|
+
style?: JSX.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
export interface RootStyleProps {
|
|
9
|
+
rootClass?: string;
|
|
10
|
+
rootStyle?: JSX.CSSProperties;
|
|
11
|
+
}
|
|
12
|
+
export type ComponentSize = 'small' | 'middle' | 'large';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import cs from 'classnames';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 水波动画
|
|
5
|
+
* @param parent
|
|
6
|
+
* @param color
|
|
7
|
+
*/
|
|
8
|
+
function wave(parent, color) {
|
|
9
|
+
const div = document.createElement('div');
|
|
10
|
+
div.style.color = color;
|
|
11
|
+
div.className = cs('absolute inset-0 z--1 rounded-inherit border-solid border-[currentColor] keyframes-wave [animation:wave_ease-out_.3s]');
|
|
12
|
+
const onAnimationEnd = () => {
|
|
13
|
+
div.remove();
|
|
14
|
+
div.removeEventListener('animationend', onAnimationEnd);
|
|
15
|
+
};
|
|
16
|
+
div.addEventListener('animationend', onAnimationEnd);
|
|
17
|
+
parent.insertBefore(div, parent.childNodes[0]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { wave };
|
package/es/utils/array.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 如果传入一个非数组字段,则将其转化为数组
|
|
3
3
|
* @param value
|
|
4
|
+
* @param allowNil 如果设置为 false,则 value isNil 的情况下,会返回空数组
|
|
4
5
|
* @returns
|
|
5
6
|
*/
|
|
6
|
-
export declare function toArray<T>(value: T | T[]): T[];
|
|
7
|
+
export declare function toArray<T>(value: T | T[], allowNil?: boolean): T[];
|
|
7
8
|
export interface StandardNode {
|
|
8
9
|
children?: this[];
|
|
9
10
|
}
|