antd-solid 0.0.12 → 0.0.14
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 +22 -21
- 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/src/Popover.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type Component, type JSXElement, Show } from 'solid-js'
|
|
2
|
-
import Tooltip, { Content, type TooltipProps } from './Tooltip'
|
|
3
|
-
|
|
4
|
-
interface PopoverProps extends TooltipProps {
|
|
5
|
-
title?: JSXElement
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Popover: Component<PopoverProps> = props => {
|
|
9
|
-
return (
|
|
10
|
-
<Tooltip
|
|
11
|
-
mode="light"
|
|
12
|
-
{...props}
|
|
13
|
-
content={close =>
|
|
14
|
-
<div>
|
|
15
|
-
<Show when={props.title}>
|
|
16
|
-
<div class="ant-mb-8px ant-flex ant-items-center">
|
|
17
|
-
<span class="ant-text-[rgba(0,0,0,0.88)] ant-font-600">{props.title}</span>
|
|
18
|
-
</div>
|
|
19
|
-
</Show>
|
|
20
|
-
|
|
21
|
-
<div class="ant-text-[rgba(0,0,0,0.88)]">
|
|
22
|
-
<Content content={props.content} close={close} />
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
}
|
|
26
|
-
/>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default Popover
|
package/src/Progress/index.tsx
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { mergeProps, type Component, Switch, Match, Show, createMemo } from 'solid-js'
|
|
2
|
-
import cs from 'classnames'
|
|
3
|
-
|
|
4
|
-
export interface ProgressProps {
|
|
5
|
-
/**
|
|
6
|
-
* 百分比
|
|
7
|
-
* 默认 0
|
|
8
|
-
*/
|
|
9
|
-
percent?: number
|
|
10
|
-
/**
|
|
11
|
-
* 状态
|
|
12
|
-
*/
|
|
13
|
-
status?: 'normal' | 'success' | 'error'
|
|
14
|
-
/**
|
|
15
|
-
* 'line' 类型进度条的高度
|
|
16
|
-
* 默认 8
|
|
17
|
-
*/
|
|
18
|
-
height?: number
|
|
19
|
-
/**
|
|
20
|
-
* 是否显示进度数值或状态图标
|
|
21
|
-
* 默认 true
|
|
22
|
-
*/
|
|
23
|
-
showInfo?: boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const Progress: Component<ProgressProps> = _props => {
|
|
27
|
-
const props = mergeProps(
|
|
28
|
-
{
|
|
29
|
-
percent: 0,
|
|
30
|
-
height: 8,
|
|
31
|
-
showInfo: true,
|
|
32
|
-
},
|
|
33
|
-
_props,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
const status = createMemo(() => {
|
|
37
|
-
if (props.status) return props.status
|
|
38
|
-
return props.percent >= 100 ? 'success' : 'normal'
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<div
|
|
43
|
-
class="ant-flex ant-items-center"
|
|
44
|
-
style={{
|
|
45
|
-
'--ant-progress-remaining-color': 'rgba(0, 0, 0, 0.06)',
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
<div
|
|
49
|
-
class={cs(
|
|
50
|
-
'ant-w-full ant-bg-[var(--ant-progress-remaining-color)]',
|
|
51
|
-
'before:ant-content-empty before:ant-block before:ant-bg-[var(--color)] before:ant-w-[var(--percent)] before:ant-h-full before:ant-rounded-inherit',
|
|
52
|
-
)}
|
|
53
|
-
style={{
|
|
54
|
-
height: `${props.height}px`,
|
|
55
|
-
'border-radius': `${props.height / 2}px`,
|
|
56
|
-
'--percent': `${props.percent}%`,
|
|
57
|
-
'--color': {
|
|
58
|
-
normal: 'var(--ant-color-primary)',
|
|
59
|
-
success: 'var(--ant-color-success)',
|
|
60
|
-
error: 'var(--ant-color-error)',
|
|
61
|
-
}[status()],
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
|
|
65
|
-
<Show when={props.showInfo}>
|
|
66
|
-
<span class="ant-shrink-0 ant-min-w-40px ant-ml-8px ant-text-center">
|
|
67
|
-
<Switch fallback={`${props.percent}%`}>
|
|
68
|
-
<Match when={status() === 'success'}>
|
|
69
|
-
<span class="i-ant-design:check-circle-filled ant-text-[var(--ant-color-success)]" />
|
|
70
|
-
</Match>
|
|
71
|
-
<Match when={status() === 'error'}>
|
|
72
|
-
<span class="i-ant-design:close-circle-filled ant-text-[var(--ant-color-error)]" />
|
|
73
|
-
</Match>
|
|
74
|
-
</Switch>
|
|
75
|
-
</span>
|
|
76
|
-
</Show>
|
|
77
|
-
</div>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default Progress
|
package/src/Radio.tsx
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type Component,
|
|
3
|
-
type JSXElement,
|
|
4
|
-
type ParentProps,
|
|
5
|
-
type JSX,
|
|
6
|
-
untrack,
|
|
7
|
-
For,
|
|
8
|
-
createSelector,
|
|
9
|
-
mergeProps,
|
|
10
|
-
} from 'solid-js'
|
|
11
|
-
import { Dynamic } from 'solid-js/web'
|
|
12
|
-
import cs from 'classnames'
|
|
13
|
-
import createControllableValue from './hooks/createControllableValue'
|
|
14
|
-
|
|
15
|
-
export interface RadioProps extends ParentProps {
|
|
16
|
-
defaultChecked?: boolean
|
|
17
|
-
checked?: boolean
|
|
18
|
-
/**
|
|
19
|
-
* input 的 value
|
|
20
|
-
*/
|
|
21
|
-
value?: string
|
|
22
|
-
onChange?: JSX.ChangeEventHandler<HTMLInputElement, Event>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface RadioGroupProps {
|
|
26
|
-
defaultValue?: string
|
|
27
|
-
value?: string
|
|
28
|
-
onChange?: JSX.ChangeEventHandler<HTMLInputElement, Event>
|
|
29
|
-
optionType?: 'default' | 'button'
|
|
30
|
-
options: Array<{ label: JSXElement; value: string; disabled?: boolean }>
|
|
31
|
-
block?: boolean
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const Radio: Component<RadioProps> & {
|
|
35
|
-
Group: Component<RadioGroupProps>
|
|
36
|
-
Button: Component<RadioProps>
|
|
37
|
-
} = props => {
|
|
38
|
-
const [checked, setChecked] = createControllableValue(props, {
|
|
39
|
-
defaultValue: false,
|
|
40
|
-
defaultValuePropName: 'defaultChecked',
|
|
41
|
-
valuePropName: 'checked',
|
|
42
|
-
trigger: null,
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<label class="ant-inline-flex ant-gap-4px ant-cursor-pointer ant-inline-flex ant-items-center">
|
|
47
|
-
<span
|
|
48
|
-
class={cs(
|
|
49
|
-
'ant-w-16px ant-h-16px ant-rounded-50% ant-[border:1px_solid_var(--ant-color-border)]',
|
|
50
|
-
checked() && 'ant-[border:5px_solid_var(--ant-color-primary)]',
|
|
51
|
-
)}
|
|
52
|
-
>
|
|
53
|
-
<input
|
|
54
|
-
class="ant-m-0 ant-hidden"
|
|
55
|
-
checked={checked()}
|
|
56
|
-
value={props.value ?? ''}
|
|
57
|
-
type="radio"
|
|
58
|
-
onInput={e => {
|
|
59
|
-
setChecked(e.target.checked)
|
|
60
|
-
untrack(() => props.onChange?.(e))
|
|
61
|
-
}}
|
|
62
|
-
/>
|
|
63
|
-
</span>
|
|
64
|
-
{props.children}
|
|
65
|
-
</label>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
Radio.Button = props => {
|
|
70
|
-
const [checked, setChecked] = createControllableValue(props, {
|
|
71
|
-
defaultValue: false,
|
|
72
|
-
defaultValuePropName: 'defaultChecked',
|
|
73
|
-
valuePropName: 'checked',
|
|
74
|
-
trigger: null,
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<label
|
|
79
|
-
class={cs(
|
|
80
|
-
'ant-px-15px ant-[border:1px_solid_rgb(217,217,217)] first:ant-rounded-l-6px last:ant-rounded-r-6px ant-h-32px ant-inline-flex ant-items-center hover:ant-text-[var(--ant-color-primary)] not[:last-child]:ant-border-r-transparent ant-cursor-pointer ant-flex-grow ant-justify-center',
|
|
81
|
-
checked() &&
|
|
82
|
-
'ant-text-[var(--ant-color-primary)] ant-[border:1px_solid_var(--ant-color-primary)] !ant-border-r-[var(--ant-color-primary)]',
|
|
83
|
-
)}
|
|
84
|
-
>
|
|
85
|
-
<input
|
|
86
|
-
class="ant-w-0 ant-h-0"
|
|
87
|
-
checked={checked()}
|
|
88
|
-
value={props.value ?? ''}
|
|
89
|
-
type="radio"
|
|
90
|
-
onInput={e => {
|
|
91
|
-
setChecked(e.target.checked)
|
|
92
|
-
untrack(() => props.onChange?.(e))
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
{props.children}
|
|
96
|
-
</label>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
Radio.Group = _props => {
|
|
101
|
-
const props = mergeProps(
|
|
102
|
-
{
|
|
103
|
-
optionType: 'default',
|
|
104
|
-
} as RadioGroupProps,
|
|
105
|
-
_props,
|
|
106
|
-
)
|
|
107
|
-
const [value, setValue] = createControllableValue<string>(props, {
|
|
108
|
-
trigger: null,
|
|
109
|
-
})
|
|
110
|
-
const isChecked = createSelector(value)
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<div
|
|
114
|
-
class={cs(
|
|
115
|
-
props.block ? 'ant-flex' : 'ant-inline-flex',
|
|
116
|
-
props.optionType === 'default' ? 'ant-gap-8px' : '',
|
|
117
|
-
)}
|
|
118
|
-
>
|
|
119
|
-
<For each={props.options}>
|
|
120
|
-
{option => (
|
|
121
|
-
<Dynamic
|
|
122
|
-
component={props.optionType === 'default' ? Radio : Radio.Button}
|
|
123
|
-
checked={isChecked(option.value)}
|
|
124
|
-
value={option.value}
|
|
125
|
-
onChange={
|
|
126
|
-
(e => {
|
|
127
|
-
setValue(option.value)
|
|
128
|
-
untrack(() => {
|
|
129
|
-
props.onChange?.(e)
|
|
130
|
-
})
|
|
131
|
-
}) as JSX.ChangeEventHandler<HTMLInputElement, Event>
|
|
132
|
-
}
|
|
133
|
-
>
|
|
134
|
-
{option.label}
|
|
135
|
-
</Dynamic>
|
|
136
|
-
)}
|
|
137
|
-
</For>
|
|
138
|
-
</div>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export default Radio
|
package/src/Result.tsx
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type JSXElement, type Component, type ParentProps } from 'solid-js'
|
|
2
|
-
import cs from 'classnames'
|
|
3
|
-
|
|
4
|
-
type ResultStatusType = 'success' | 'error' | 'info' | 'warning'
|
|
5
|
-
|
|
6
|
-
export interface ResultProps extends ParentProps {
|
|
7
|
-
status?: ResultStatusType
|
|
8
|
-
title?: JSXElement
|
|
9
|
-
subTitle?: JSXElement
|
|
10
|
-
extra?: JSXElement
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const statusIconMap = {
|
|
14
|
-
success: 'ant-text-#52c41a i-ant-design:check-circle-filled',
|
|
15
|
-
info: 'ant-text-[var(--ant-color-primary)] i-ant-design:exclamation-circle-filled',
|
|
16
|
-
warning: 'ant-text-#faad14 i-ant-design:warning-filled',
|
|
17
|
-
error: 'ant-text-#ff4d4f i-ant-design:close-circle-filled',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const Result: Component<ResultProps> = props => {
|
|
21
|
-
return (
|
|
22
|
-
<div class="ant-text-center ant-px-32px ant-py-48px">
|
|
23
|
-
<div class="ant-mb-24px">
|
|
24
|
-
<span class={cs(statusIconMap[props.status!], 'ant-text-72px')} />
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<div class="ant-my-8px ant-text-[rgba(0,0,0,.88)] ant-text-24px">{props.title}</div>
|
|
28
|
-
|
|
29
|
-
<div class="ant-text-[rgba(0,0,0,.45)] ant-text-14px">{props.subTitle}</div>
|
|
30
|
-
|
|
31
|
-
<div class="ant-mt-24px">{props.extra}</div>
|
|
32
|
-
|
|
33
|
-
<div class="ant-mt-24px">{props.children}</div>
|
|
34
|
-
</div>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default Result
|
package/src/Segmented/index.tsx
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { type Component, For, createSelector, type JSX, Show } from 'solid-js'
|
|
2
|
-
import cs from 'classnames'
|
|
3
|
-
import { type StringOrJSXElement, type Key } from '../types'
|
|
4
|
-
import createControllableValue from '../hooks/createControllableValue'
|
|
5
|
-
import { unwrapStringOrJSXElement } from '../utils/solid'
|
|
6
|
-
|
|
7
|
-
export interface SegmentedProps {
|
|
8
|
-
block?: boolean
|
|
9
|
-
disabled?: boolean
|
|
10
|
-
options: Array<
|
|
11
|
-
| string
|
|
12
|
-
| number
|
|
13
|
-
| {
|
|
14
|
-
label: StringOrJSXElement
|
|
15
|
-
value: string
|
|
16
|
-
disabled?: boolean
|
|
17
|
-
onClick?: (
|
|
18
|
-
e: MouseEvent & {
|
|
19
|
-
currentTarget: HTMLDivElement
|
|
20
|
-
target: Element
|
|
21
|
-
},
|
|
22
|
-
) => void
|
|
23
|
-
}
|
|
24
|
-
>
|
|
25
|
-
value?: Key
|
|
26
|
-
onChange?: (value: Key) => void
|
|
27
|
-
class?: string
|
|
28
|
-
style?: JSX.CSSProperties
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const unWarpValue = (value: SegmentedProps['options'][0]) =>
|
|
32
|
-
typeof value === 'object' ? value.value : value
|
|
33
|
-
|
|
34
|
-
const Segmented: Component<SegmentedProps> = props => {
|
|
35
|
-
const [value, setValue] = createControllableValue<Key>(props, {
|
|
36
|
-
defaultValue: unWarpValue(props.options[0]),
|
|
37
|
-
})
|
|
38
|
-
const isSelected = createSelector(value)
|
|
39
|
-
|
|
40
|
-
const isDisabledValue = (v: SegmentedProps['options'][0]) => {
|
|
41
|
-
if (props.disabled) return true
|
|
42
|
-
return typeof v === 'object' ? v.disabled : false
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div
|
|
47
|
-
class={cs(
|
|
48
|
-
'ant-bg-[var(--ant-color-bg-layout)] ant-rounded-[var(--ant-border-radius)] ant-p-2px',
|
|
49
|
-
props.block ? 'ant-flex' : 'ant-inline-flex',
|
|
50
|
-
props.class,
|
|
51
|
-
)}
|
|
52
|
-
style={{
|
|
53
|
-
'--ant-segmented-item-color': 'rgba(0, 0, 0, 0.65)',
|
|
54
|
-
'--ant-segmented-item-hover-bg': 'rgba(0, 0, 0, 0.06)',
|
|
55
|
-
'--ant-segmented-item-active-bg': 'rgba(0, 0, 0, 0.15)',
|
|
56
|
-
...props.style,
|
|
57
|
-
}}
|
|
58
|
-
>
|
|
59
|
-
<For each={props.options}>
|
|
60
|
-
{item => (
|
|
61
|
-
<div
|
|
62
|
-
class={cs(
|
|
63
|
-
props.block && 'ant-basis-0 ant-grow-1',
|
|
64
|
-
isDisabledValue(item) && 'ant-cursor-not-allowed',
|
|
65
|
-
)}
|
|
66
|
-
>
|
|
67
|
-
<div
|
|
68
|
-
class={cs(
|
|
69
|
-
'ant-rounded-[var(--ant-border-radius-sm)] ant-px-[var(--ant-padding-sm)] where:ant-cursor-pointer ant-leading-28px where:hover:ant-bg-[var(--ant-segmented-item-hover-bg)] where:active:ant-bg-[var(--ant-segmented-item-active-bg)]',
|
|
70
|
-
isSelected(unWarpValue(item)) &&
|
|
71
|
-
'ant-bg-white ant-shadow-[var(--ant-box-shadow-tertiary)]',
|
|
72
|
-
props.block && 'ant-flex ant-justify-center',
|
|
73
|
-
isDisabledValue(item) &&
|
|
74
|
-
'ant-[pointer-events:none] ant-text-[var(--ant-color-text-disabled)]',
|
|
75
|
-
)}
|
|
76
|
-
onClick={e => {
|
|
77
|
-
setValue(unWarpValue(item))
|
|
78
|
-
typeof item === 'object' && item.onClick?.(e)
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
81
|
-
<Show
|
|
82
|
-
when={typeof item !== 'object'}
|
|
83
|
-
fallback={typeof item === 'object' && unwrapStringOrJSXElement(item.label)}
|
|
84
|
-
>
|
|
85
|
-
{item as string | number}
|
|
86
|
-
</Show>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
)}
|
|
90
|
-
</For>
|
|
91
|
-
</div>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export default Segmented
|
package/src/Select.tsx
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type JSXElement,
|
|
3
|
-
type Component,
|
|
4
|
-
For,
|
|
5
|
-
createSelector,
|
|
6
|
-
createSignal,
|
|
7
|
-
Show,
|
|
8
|
-
createMemo,
|
|
9
|
-
} from 'solid-js'
|
|
10
|
-
import Tooltip from './Tooltip'
|
|
11
|
-
import { type Key } from './types'
|
|
12
|
-
import createControllableValue from './hooks/createControllableValue'
|
|
13
|
-
import cs from 'classnames'
|
|
14
|
-
import { useClickAway } from './hooks'
|
|
15
|
-
import { isNil } from 'lodash-es'
|
|
16
|
-
|
|
17
|
-
interface SelectOption {
|
|
18
|
-
label: JSXElement
|
|
19
|
-
value: Key
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface SelectProps {
|
|
23
|
-
value?: Key
|
|
24
|
-
onChange?: (value: Key) => void
|
|
25
|
-
options: SelectOption[]
|
|
26
|
-
placeholder?: string
|
|
27
|
-
allowClear?: boolean
|
|
28
|
-
class?: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const Select: Component<SelectProps> = props => {
|
|
32
|
-
let select: HTMLDivElement
|
|
33
|
-
|
|
34
|
-
const [value, setValue] = createControllableValue<Key | undefined>(props)
|
|
35
|
-
const selectedValue = createSelector(value)
|
|
36
|
-
const selectedOption = createMemo(() =>
|
|
37
|
-
!isNil(value()) ? props.options.find(option => option.value === value()) : undefined,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
const [open, setOpen] = createSignal(false)
|
|
41
|
-
useClickAway(
|
|
42
|
-
() => setOpen(false),
|
|
43
|
-
() => select!,
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const [width, setWidth] = createSignal(0)
|
|
47
|
-
const [hover, setHover] = createSignal(false)
|
|
48
|
-
const showClearBtn = createMemo(() => props.allowClear && hover() && !isNil(value()))
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Tooltip
|
|
52
|
-
mode="light"
|
|
53
|
-
open={open()}
|
|
54
|
-
onOpenChange={setOpen}
|
|
55
|
-
trigger={[]}
|
|
56
|
-
placement="bottomLeft"
|
|
57
|
-
arrow={false}
|
|
58
|
-
contentStyle={{
|
|
59
|
-
padding: 0,
|
|
60
|
-
}}
|
|
61
|
-
content={close => (
|
|
62
|
-
<div class="ant-bg-white ant-w-200px" style={{ width: `${width()}px` }}>
|
|
63
|
-
<For each={props.options}>
|
|
64
|
-
{item => (
|
|
65
|
-
<div
|
|
66
|
-
class={cs(
|
|
67
|
-
'ant-box-content ant-px-12px ant-py-5px ant-h-22px ant-leading-22px hover:ant-bg-[var(--hover-bg-color)]',
|
|
68
|
-
selectedValue(item.value) ? '!ant-bg-[var(--ant-select-option-selected-bg)]' : '',
|
|
69
|
-
)}
|
|
70
|
-
onClick={() => {
|
|
71
|
-
setValue(item.value)
|
|
72
|
-
close()
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
{item.label}
|
|
76
|
-
</div>
|
|
77
|
-
)}
|
|
78
|
-
</For>
|
|
79
|
-
</div>
|
|
80
|
-
)}
|
|
81
|
-
>
|
|
82
|
-
<div
|
|
83
|
-
ref={select!}
|
|
84
|
-
class={cs(
|
|
85
|
-
'ant-h-32px ant-leading-32px ant-rounded-6px ant-[border:1px_solid_var(--ant-color-border)] ant-px-11px focus:ant-[border-color:var(--ant-color-primary)]',
|
|
86
|
-
props.class,
|
|
87
|
-
)}
|
|
88
|
-
tabIndex="0"
|
|
89
|
-
onClick={e => {
|
|
90
|
-
setOpen(true)
|
|
91
|
-
setWidth(e.currentTarget.offsetWidth)
|
|
92
|
-
e.currentTarget.focus()
|
|
93
|
-
}}
|
|
94
|
-
onMouseEnter={() => setHover(true)}
|
|
95
|
-
onMouseLeave={() => setHover(false)}
|
|
96
|
-
style={{
|
|
97
|
-
'--ant-arrow-color': 'rgba(146, 146, 146, 1)',
|
|
98
|
-
'--ant-clear-color': 'rgba(146, 146, 146, 1)',
|
|
99
|
-
'--ant-clear-color-hover': 'rgba(194, 194, 194, 1)',
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
<div class="ant-relative ant-h-full">
|
|
103
|
-
<Show
|
|
104
|
-
when={!isNil(value())}
|
|
105
|
-
fallback={
|
|
106
|
-
<input
|
|
107
|
-
class="ant-h-full ant-w-full ant-float-left ant-[outline:none]"
|
|
108
|
-
readOnly
|
|
109
|
-
placeholder={props.placeholder}
|
|
110
|
-
/>
|
|
111
|
-
}
|
|
112
|
-
>
|
|
113
|
-
<div>{selectedOption()!.label ?? value()}</div>
|
|
114
|
-
</Show>
|
|
115
|
-
|
|
116
|
-
<div class="ant-absolute ant-top-0 ant-bottom-0 ant-right-0">
|
|
117
|
-
<Show
|
|
118
|
-
when={showClearBtn()}
|
|
119
|
-
fallback={
|
|
120
|
-
<span class="i-ant-design:down-outlined ant-text-[var(--ant-allow-color)]" />
|
|
121
|
-
}
|
|
122
|
-
>
|
|
123
|
-
<span
|
|
124
|
-
class="i-ant-design:close-circle-filled ant-cursor-pointer ant-text-[var(--ant-clear-color)] hover:ant-text-[var(--ant-clear-color-hover)]"
|
|
125
|
-
onClick={e => {
|
|
126
|
-
e.stopPropagation()
|
|
127
|
-
setValue(undefined)
|
|
128
|
-
}}
|
|
129
|
-
/>
|
|
130
|
-
</Show>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
</Tooltip>
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export default Select
|
package/src/Skeleton.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Skeleton as SkeletonAntd } from 'antd'
|
|
2
|
-
import { reactToSolidComponent, replaceClassName } from './utils/component'
|
|
3
|
-
|
|
4
|
-
const _Skeleton = replaceClassName(reactToSolidComponent(SkeletonAntd))
|
|
5
|
-
|
|
6
|
-
const Image = replaceClassName(reactToSolidComponent(SkeletonAntd.Image))
|
|
7
|
-
|
|
8
|
-
const Skeleton = _Skeleton as typeof _Skeleton & {
|
|
9
|
-
Image: typeof Image
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
Skeleton.Image = Image
|
|
13
|
-
|
|
14
|
-
export default Skeleton
|
package/src/Spin.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Show, type Component, type ParentProps, mergeProps } from 'solid-js'
|
|
2
|
-
|
|
3
|
-
interface SpinProps extends ParentProps {
|
|
4
|
-
/**
|
|
5
|
-
* 是否为加载中状态
|
|
6
|
-
*/
|
|
7
|
-
spinning?: boolean
|
|
8
|
-
size?: number
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const Spin: Component<SpinProps> = _props => {
|
|
12
|
-
const props = mergeProps(
|
|
13
|
-
{
|
|
14
|
-
size: 20,
|
|
15
|
-
},
|
|
16
|
-
_props,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div>
|
|
21
|
-
{props.children}
|
|
22
|
-
<Show when={props.spinning}>
|
|
23
|
-
<div class="ant-flex ant-items-center ant-justify-center ant-bg-[rgba(255,255,255,.5)]">
|
|
24
|
-
<span
|
|
25
|
-
class="i-ant-design:loading keyframes-spin ant-[animation:spin_1s_linear_infinite] ant-text-[var(--ant-color-primary)]"
|
|
26
|
-
style={{ 'font-size': `${props.size}px` }}
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
</Show>
|
|
30
|
-
</div>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default Spin
|
package/src/Switch.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type Component } from 'solid-js'
|
|
2
|
-
import createControllableValue from './hooks/createControllableValue'
|
|
3
|
-
import cs from 'classnames'
|
|
4
|
-
|
|
5
|
-
export interface SwitchProps {
|
|
6
|
-
defaultChecked?: boolean
|
|
7
|
-
checked?: boolean
|
|
8
|
-
onChange?: (checked: boolean) => void
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const Switch: Component<SwitchProps> = props => {
|
|
12
|
-
const [checked, setChecked] = createControllableValue<boolean>(props, {
|
|
13
|
-
defaultValuePropName: 'defaultChecked',
|
|
14
|
-
valuePropName: 'checked',
|
|
15
|
-
})
|
|
16
|
-
return (
|
|
17
|
-
<button
|
|
18
|
-
class={cs(
|
|
19
|
-
'ant-w-44px ant-h-22px ant-rounded-100px ant-relative',
|
|
20
|
-
checked() ? 'ant-bg-[var(--ant-color-primary)]' : 'ant-bg-[rgba(0,0,0,0.45)]',
|
|
21
|
-
)}
|
|
22
|
-
onClick={() => setChecked(c => !c)}
|
|
23
|
-
>
|
|
24
|
-
<div
|
|
25
|
-
class={cs(
|
|
26
|
-
'ant-w-18px ant-h-18px ant-rounded-50% ant-bg-white ant-absolute ant-top-1/2 -ant-translate-y-1/2 ant-transition-left',
|
|
27
|
-
checked() ? 'ant-left-[calc(100%-20px)]' : 'ant-left-2px',
|
|
28
|
-
)}
|
|
29
|
-
/>
|
|
30
|
-
</button>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default Switch
|
package/src/Table.tsx
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import Empty from './Empty'
|
|
2
|
-
import { type JSXElement, For, Show } from 'solid-js'
|
|
3
|
-
|
|
4
|
-
export interface TableColumn<R extends {}> {
|
|
5
|
-
title: JSXElement
|
|
6
|
-
render: (row: R) => JSXElement
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface TableProps<R extends {}> {
|
|
10
|
-
columns: Array<TableColumn<R>>
|
|
11
|
-
dataSource: R[]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const Table = <R extends {}>(props: TableProps<R>) => {
|
|
15
|
-
return (
|
|
16
|
-
<div>
|
|
17
|
-
<table class="ant-w-full">
|
|
18
|
-
<thead>
|
|
19
|
-
<tr>
|
|
20
|
-
<For each={props.columns}>
|
|
21
|
-
{item => (
|
|
22
|
-
<th class="ant-p-16px ant-bg-[var(--light-bg-color)] ant-font-bold ant-[border-bottom:1px_solid_var(--secondary-border-color)] ant-text-left">
|
|
23
|
-
{item.title}
|
|
24
|
-
</th>
|
|
25
|
-
)}
|
|
26
|
-
</For>
|
|
27
|
-
</tr>
|
|
28
|
-
</thead>
|
|
29
|
-
<tbody>
|
|
30
|
-
<For each={props.dataSource}>
|
|
31
|
-
{row => (
|
|
32
|
-
<tr class="hover:ant-bg-[var(--light-bg-color)]">
|
|
33
|
-
<For each={props.columns}>
|
|
34
|
-
{item => (
|
|
35
|
-
<td class="ant-p-16px ant-[border-bottom:1px_solid_var(--secondary-border-color)]">
|
|
36
|
-
{item.render(row)}
|
|
37
|
-
</td>
|
|
38
|
-
)}
|
|
39
|
-
</For>
|
|
40
|
-
</tr>
|
|
41
|
-
)}
|
|
42
|
-
</For>
|
|
43
|
-
</tbody>
|
|
44
|
-
</table>
|
|
45
|
-
|
|
46
|
-
<Show when={!props.dataSource.length}>
|
|
47
|
-
<Empty.PRESENTED_IMAGE_SIMPLE />
|
|
48
|
-
</Show>
|
|
49
|
-
</div>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default Table
|