antd-solid 0.0.11 → 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 -73
- package/dist/index.esm.js +7802 -2378
- 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 +32 -0
- package/es/Button/index.js +123 -0
- package/es/Button/index.scss.js +6 -0
- 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 +14 -0
- package/es/Compact/index.js +32 -0
- 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 -112
- 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 +9 -3
- package/es/Empty/index.js +24 -9
- 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 +6 -4
- package/es/Progress/index.js +75 -60
- 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/index.d.ts +64 -0
- 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 +53 -23
- 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/Button.d.ts +0 -19
- package/es/Button.js +0 -73
- package/es/ColorPicker.d.ts +0 -8
- package/es/ColorPicker.js +0 -6
- package/es/Compact.d.ts +0 -12
- package/es/Compact.js +0 -17
- 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 -48
- package/es/Modal.js +0 -209
- 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 -9
- package/es/Spin.js +0 -22
- 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.d.ts +0 -11
- package/es/Upload.js +0 -6
- 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.tsx +0 -128
- package/src/Collapse/index.tsx +0 -86
- package/src/ColorPicker.tsx +0 -11
- package/src/Compact.tsx +0 -15
- package/src/DatePicker.tsx +0 -30
- package/src/Drawer/index.scss +0 -53
- package/src/Drawer/index.tsx +0 -212
- 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 -20
- 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 -125
- package/src/Modal.tsx +0 -220
- package/src/Popconfirm.tsx +0 -75
- package/src/Popover.tsx +0 -30
- package/src/Progress/index.tsx +0 -73
- package/src/Radio.tsx +0 -142
- package/src/Result.tsx +0 -38
- package/src/Segmented/index.tsx +0 -95
- package/src/Select.tsx +0 -128
- package/src/Skeleton.tsx +0 -14
- package/src/Spin.tsx +0 -23
- 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 -246
- package/src/Upload.tsx +0 -10
- 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/Menu/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createComponent, mergeProps as mergeProps$1 } from 'solid-js/web';
|
|
2
|
+
import { mergeProps, createMemo } from 'solid-js';
|
|
3
|
+
import Element from '../Element/index.js';
|
|
4
|
+
import InternalMenu from './InternalMenu.js';
|
|
5
|
+
import createControllableValue from '../hooks/createControllableValue.js';
|
|
6
|
+
|
|
7
|
+
function Menu(_props) {
|
|
8
|
+
const props = mergeProps({
|
|
9
|
+
mode: 'vertical',
|
|
10
|
+
selectable: true
|
|
11
|
+
}, _props);
|
|
12
|
+
const [_selectedKeys, setSelectedKeys] = createControllableValue(props, {
|
|
13
|
+
defaultValuePropName: 'defaultSelectedKeys',
|
|
14
|
+
valuePropName: 'selectedKeys',
|
|
15
|
+
trigger: null
|
|
16
|
+
});
|
|
17
|
+
const selectedKeys = createMemo(() => _selectedKeys() ?? []);
|
|
18
|
+
const [_expandedKeys, setExpandedKeys] = createControllableValue(props, {
|
|
19
|
+
defaultValuePropName: 'defaultExpandedKeys',
|
|
20
|
+
valuePropName: 'expandedKeys',
|
|
21
|
+
trigger: 'onExpandedKeysChange'
|
|
22
|
+
});
|
|
23
|
+
const expandedKeys = createMemo(() => _expandedKeys() ?? []);
|
|
24
|
+
const style = createMemo(() => ({
|
|
25
|
+
'--ant-menu-item-margin': 'var(--ant-margin-xxs)',
|
|
26
|
+
'--ant-menu-item-height': '40px',
|
|
27
|
+
...props.style
|
|
28
|
+
}));
|
|
29
|
+
return createComponent(Element, {
|
|
30
|
+
get ["class"]() {
|
|
31
|
+
return props.class;
|
|
32
|
+
},
|
|
33
|
+
get style() {
|
|
34
|
+
return style();
|
|
35
|
+
},
|
|
36
|
+
get children() {
|
|
37
|
+
return createComponent(InternalMenu, mergeProps$1(props, {
|
|
38
|
+
get ["class"]() {
|
|
39
|
+
return props.class;
|
|
40
|
+
},
|
|
41
|
+
get style() {
|
|
42
|
+
return style();
|
|
43
|
+
},
|
|
44
|
+
get selectedKeys() {
|
|
45
|
+
return selectedKeys();
|
|
46
|
+
},
|
|
47
|
+
onSelect: info => {
|
|
48
|
+
props.onSelect?.(info);
|
|
49
|
+
setSelectedKeys(info.selectedKeys);
|
|
50
|
+
},
|
|
51
|
+
onDeselect: info => {
|
|
52
|
+
props.onDeselect?.(info);
|
|
53
|
+
setSelectedKeys(info.selectedKeys);
|
|
54
|
+
},
|
|
55
|
+
get expandedKeys() {
|
|
56
|
+
return expandedKeys();
|
|
57
|
+
},
|
|
58
|
+
onExpandedKeysChange: setExpandedKeys
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { Menu as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Component, type JSXElement } from 'solid-js';
|
|
2
|
+
export interface MessageProps {
|
|
3
|
+
type: 'info' | 'success' | 'error' | 'warning';
|
|
4
|
+
content: JSXElement;
|
|
5
|
+
duration?: number;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const Message: Component<MessageProps>;
|
|
9
|
+
export default Message;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createComponent, memo, insert, template } from 'solid-js/web';
|
|
2
|
+
import { onMount } from 'solid-js';
|
|
3
|
+
import Element from '../Element/index.js';
|
|
4
|
+
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/template(`<div>`),
|
|
6
|
+
_tmpl$2 = /*#__PURE__*/template(`<span class="i-ant-design:info-circle-filled text-[--ant-color-primary] text-18px">`),
|
|
7
|
+
_tmpl$3 = /*#__PURE__*/template(`<span class="i-ant-design:check-circle-filled text-[--ant-color-success] text-18px">`),
|
|
8
|
+
_tmpl$4 = /*#__PURE__*/template(`<span class="i-ant-design:close-circle-filled text-[--ant-color-error] text-18px">`),
|
|
9
|
+
_tmpl$5 = /*#__PURE__*/template(`<span class="i-ant-design:exclamation-circle-filled text-[--ant-color-warning] text-18px">`);
|
|
10
|
+
const Message = props => {
|
|
11
|
+
onMount(() => {
|
|
12
|
+
const duration = props.duration ?? 3;
|
|
13
|
+
if (duration > 0) {
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
props.onClose?.();
|
|
16
|
+
}, duration * 1000);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return createComponent(Element, {
|
|
20
|
+
"class": "ant-message-fade [box-shadow:var(--ant-box-shadow)] p-[--ant-message-content-padding] rounded-[--ant-border-radius-lg] bg-[--ant-color-bg-elevated] flex gap-[--ant-margin-xs] items-center [font-size:var(--ant-font-size)] text-[--ant-color-text] leading-[--ant-line-height]",
|
|
21
|
+
style: {
|
|
22
|
+
'--ant-message-content-padding': '9px 12px'
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
return [memo(() => memo(() => props.type === 'info')() && _tmpl$2()), memo(() => memo(() => props.type === 'success')() && _tmpl$3()), memo(() => memo(() => props.type === 'error')() && _tmpl$4()), memo(() => memo(() => props.type === 'warning')() && _tmpl$5()), (() => {
|
|
26
|
+
var _el$ = _tmpl$();
|
|
27
|
+
insert(_el$, () => props.content);
|
|
28
|
+
return _el$;
|
|
29
|
+
})()];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { Message as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type JSXElement } from 'solid-js';
|
|
2
|
+
import useMessage from './useMessage';
|
|
3
|
+
import './index.scss';
|
|
4
|
+
declare const message: {
|
|
5
|
+
readonly info: (content: JSXElement, duration?: number) => void;
|
|
6
|
+
readonly success: (content: JSXElement, duration?: number) => void;
|
|
7
|
+
readonly error: (content: JSXElement, duration?: number) => void;
|
|
8
|
+
readonly warning: (content: JSXElement, duration?: number) => void;
|
|
9
|
+
readonly useMessage: typeof useMessage;
|
|
10
|
+
};
|
|
11
|
+
export type { MessageApi } from './useMessage';
|
|
12
|
+
export default message;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { render, createComponent, mergeProps } from 'solid-js/web';
|
|
2
|
+
import { createSignal, For } from 'solid-js';
|
|
3
|
+
import { TransitionGroup } from 'solid-transition-group';
|
|
4
|
+
import { isEmpty } from 'lodash-es';
|
|
5
|
+
import Message from './Message.js';
|
|
6
|
+
import useMessage from './useMessage.js';
|
|
7
|
+
import Element from '../Element/index.js';
|
|
8
|
+
import './index.scss.js';
|
|
9
|
+
|
|
10
|
+
let setMsgConfigList;
|
|
11
|
+
/**
|
|
12
|
+
* message 静态方法工厂
|
|
13
|
+
* @param type 类型
|
|
14
|
+
* @param content 提示内容
|
|
15
|
+
* @param duration 自动关闭的延时,单位秒。设为 0 时不自动关闭
|
|
16
|
+
*/
|
|
17
|
+
const createStaticFactory = type => {
|
|
18
|
+
return (content, duration) => {
|
|
19
|
+
const config = {
|
|
20
|
+
type,
|
|
21
|
+
content,
|
|
22
|
+
duration
|
|
23
|
+
};
|
|
24
|
+
if (setMsgConfigList) {
|
|
25
|
+
setMsgConfigList(prev => [...prev, {
|
|
26
|
+
type,
|
|
27
|
+
content,
|
|
28
|
+
duration
|
|
29
|
+
}]);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const div = document.createElement('div');
|
|
33
|
+
document.body.appendChild(div);
|
|
34
|
+
const dispose = render(() => {
|
|
35
|
+
const [msgConfigList, _setMsgConfigList] = createSignal([config]);
|
|
36
|
+
setMsgConfigList = _setMsgConfigList;
|
|
37
|
+
return createComponent(Element, {
|
|
38
|
+
"class": "fixed top-16px left-0 right-0 z-2010 flex items-center flex-col gap-[--ant-margin-sm]",
|
|
39
|
+
get children() {
|
|
40
|
+
return createComponent(TransitionGroup, {
|
|
41
|
+
name: "ant-message-fade",
|
|
42
|
+
appear: true,
|
|
43
|
+
onAfterExit: () => {
|
|
44
|
+
if (isEmpty(msgConfigList())) {
|
|
45
|
+
setMsgConfigList = undefined;
|
|
46
|
+
dispose();
|
|
47
|
+
document.body.removeChild(div);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
get children() {
|
|
51
|
+
return createComponent(For, {
|
|
52
|
+
get each() {
|
|
53
|
+
return msgConfigList();
|
|
54
|
+
},
|
|
55
|
+
children: _config => createComponent(Message, mergeProps(_config, {
|
|
56
|
+
onClose: () => {
|
|
57
|
+
_setMsgConfigList(prev => prev.filter(item => item !== _config));
|
|
58
|
+
}
|
|
59
|
+
}))
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}, div);
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const info = createStaticFactory('info');
|
|
69
|
+
const success = createStaticFactory('success');
|
|
70
|
+
const error = createStaticFactory('error');
|
|
71
|
+
const warning = createStaticFactory('warning');
|
|
72
|
+
const message = {
|
|
73
|
+
info,
|
|
74
|
+
success,
|
|
75
|
+
error,
|
|
76
|
+
warning,
|
|
77
|
+
useMessage
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { message as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".ant-message-fade {\n transition: all 0.5s;\n}\n\n.ant-message-fade-enter,\n.ant-message-fade-exit-to {\n opacity: 0;\n transform: translateY(-100%);\n}\n\n.ant-message-fade-enter-to,\n.ant-message-fade-exit {\n opacity: 1;\n transform: none;\n}";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createComponent, Portal, mergeProps } from 'solid-js/web';
|
|
2
|
+
import { createSignal, For } from 'solid-js';
|
|
3
|
+
import { TransitionGroup } from 'solid-transition-group';
|
|
4
|
+
import Message from './Message.js';
|
|
5
|
+
import Element from '../Element/index.js';
|
|
6
|
+
import DelayShow from '../DelayShow/index.js';
|
|
7
|
+
|
|
8
|
+
function useMessage() {
|
|
9
|
+
const [msgConfigList, setMsgConfigList] = createSignal([]);
|
|
10
|
+
const messageApi = {
|
|
11
|
+
open: config => {
|
|
12
|
+
setMsgConfigList(prev => [...prev, config]);
|
|
13
|
+
const destroy = () => {
|
|
14
|
+
setMsgConfigList(prev => prev.filter(item => item !== config));
|
|
15
|
+
};
|
|
16
|
+
return destroy;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const getContextHolder = () => createComponent(DelayShow, {
|
|
20
|
+
get when() {
|
|
21
|
+
return msgConfigList().length > 0;
|
|
22
|
+
},
|
|
23
|
+
get children() {
|
|
24
|
+
return createComponent(Portal, {
|
|
25
|
+
get children() {
|
|
26
|
+
return createComponent(Element, {
|
|
27
|
+
"class": "fixed top-16px left-1/2 translate-x--1/2 z-2010 flex items-center flex-col gap-[--ant-margin-sm]",
|
|
28
|
+
get children() {
|
|
29
|
+
return createComponent(TransitionGroup, {
|
|
30
|
+
name: "ant-message-fade",
|
|
31
|
+
appear: true,
|
|
32
|
+
get children() {
|
|
33
|
+
return createComponent(For, {
|
|
34
|
+
get each() {
|
|
35
|
+
return msgConfigList();
|
|
36
|
+
},
|
|
37
|
+
children: config => createComponent(Message, mergeProps(config, {
|
|
38
|
+
onClose: () => {
|
|
39
|
+
setMsgConfigList(prev => prev.filter(item => item !== config));
|
|
40
|
+
}
|
|
41
|
+
}))
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return [messageApi, getContextHolder];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { useMessage as default };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type JSXElement, type Component } from 'solid-js';
|
|
2
|
+
import { type ButtonProps } from '../Button';
|
|
3
|
+
import './index.scss';
|
|
4
|
+
import useModal from './useModal';
|
|
5
|
+
import warning from './warning';
|
|
6
|
+
export interface ModalProps {
|
|
7
|
+
title?: JSXElement;
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
width?: string;
|
|
11
|
+
height?: string;
|
|
12
|
+
children?: JSXElement;
|
|
13
|
+
/**
|
|
14
|
+
* 垂直居中展示 Modal
|
|
15
|
+
*/
|
|
16
|
+
centered?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 是否展示遮罩
|
|
19
|
+
* 默认 true
|
|
20
|
+
*/
|
|
21
|
+
mask?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 点击蒙层是否允许关闭
|
|
24
|
+
* 默认 true
|
|
25
|
+
*/
|
|
26
|
+
maskClosable?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 设置为 false 时隐藏关闭按钮
|
|
29
|
+
* 默认 true
|
|
30
|
+
*/
|
|
31
|
+
closeIcon?: boolean;
|
|
32
|
+
footer?: boolean | (() => JSXElement);
|
|
33
|
+
/**
|
|
34
|
+
* 关闭时销毁 Modal 里的子元素
|
|
35
|
+
* 默认 false
|
|
36
|
+
*/
|
|
37
|
+
destroyOnClose?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 是否在摁下 Esc 键的时候关闭 Modal
|
|
40
|
+
* 默认 true
|
|
41
|
+
*/
|
|
42
|
+
closeOnEsc?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* ok 按钮 props
|
|
45
|
+
*/
|
|
46
|
+
okButtonProps?: Partial<ButtonProps>;
|
|
47
|
+
/**
|
|
48
|
+
* cancel 按钮 props
|
|
49
|
+
*/
|
|
50
|
+
cancelButtonProps?: Partial<ButtonProps>;
|
|
51
|
+
/**
|
|
52
|
+
* 返回 true,会自动关闭 modal
|
|
53
|
+
*/
|
|
54
|
+
onOk?: () => Promise<unknown> | void;
|
|
55
|
+
onCancel?: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* Modal 打开动画结束事件
|
|
58
|
+
*/
|
|
59
|
+
onAfterEnter?: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Modal 关闭动画结束事件
|
|
62
|
+
*/
|
|
63
|
+
onAfterExit?: () => void;
|
|
64
|
+
}
|
|
65
|
+
export interface ModalLocale {
|
|
66
|
+
okText: string;
|
|
67
|
+
cancelText: string;
|
|
68
|
+
}
|
|
69
|
+
declare const Modal: Component<ModalProps> & {
|
|
70
|
+
warning: typeof warning;
|
|
71
|
+
useModal: typeof useModal;
|
|
72
|
+
};
|
|
73
|
+
export default Modal;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { delegateEvents, createComponent, Portal, Dynamic, effect, className, insert, memo, mergeProps as mergeProps$1, template } from 'solid-js/web';
|
|
2
|
+
import { mergeProps, createEffect, onCleanup, createSignal, createRenderEffect, on, Show } from 'solid-js';
|
|
3
|
+
import cs from 'classnames';
|
|
4
|
+
import { Transition } from 'solid-transition-group';
|
|
5
|
+
import Button from '../Button/index.js';
|
|
6
|
+
import createControllableValue from '../hooks/createControllableValue.js';
|
|
7
|
+
import DelayShow from '../DelayShow/index.js';
|
|
8
|
+
import './index.scss.js';
|
|
9
|
+
import createTransition from '../hooks/createTransition.js';
|
|
10
|
+
import Element from '../Element/index.js';
|
|
11
|
+
import useModal from './useModal.js';
|
|
12
|
+
import warning from './warning.js';
|
|
13
|
+
import useLocale from '../hooks/useLocale.js';
|
|
14
|
+
|
|
15
|
+
var _tmpl$ = /*#__PURE__*/template(`<div aria-label=mask>`),
|
|
16
|
+
_tmpl$2 = /*#__PURE__*/template(`<span class=i-ant-design:close-outlined>`),
|
|
17
|
+
_tmpl$3 = /*#__PURE__*/template(`<div class="inline-flex gap-8px">`),
|
|
18
|
+
_tmpl$4 = /*#__PURE__*/template(`<div class="mt-12px text-right">`),
|
|
19
|
+
_tmpl$5 = /*#__PURE__*/template(`<div class="ant-modal-wrap z-1000 fixed inset-0 overflow-auto pointer-events-none"><div><div class="text-[var(--ant-modal-title-color)] text-16px font-600 mb-8px"></div><div class=grow>`);
|
|
20
|
+
// 单位 s
|
|
21
|
+
const transitionDuration = 0.3;
|
|
22
|
+
const Modal = _props => {
|
|
23
|
+
const props = mergeProps({
|
|
24
|
+
width: '520px',
|
|
25
|
+
footer: true,
|
|
26
|
+
mask: true,
|
|
27
|
+
maskClosable: true,
|
|
28
|
+
closeIcon: true,
|
|
29
|
+
destroyOnClose: false,
|
|
30
|
+
closeOnEsc: true
|
|
31
|
+
}, _props);
|
|
32
|
+
const [open] = createControllableValue(props, {
|
|
33
|
+
valuePropName: 'open',
|
|
34
|
+
defaultValuePropName: 'defaultOpen',
|
|
35
|
+
trigger: null
|
|
36
|
+
});
|
|
37
|
+
createEffect(() => {
|
|
38
|
+
if (!open()) return;
|
|
39
|
+
const originOverflow = document.body.style.overflow;
|
|
40
|
+
document.body.style.overflow = 'hidden';
|
|
41
|
+
if (!props.closeOnEsc) return;
|
|
42
|
+
const onKeyup = e => {
|
|
43
|
+
if (e.key === 'Escape') {
|
|
44
|
+
props.onCancel?.();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
document.addEventListener('keyup', onKeyup);
|
|
48
|
+
onCleanup(() => {
|
|
49
|
+
document.body.style.overflow = originOverflow;
|
|
50
|
+
document.removeEventListener('keyup', onKeyup);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
const [activeElementCenter, setActiveElementCenter] = createSignal({
|
|
54
|
+
x: 0,
|
|
55
|
+
y: 0
|
|
56
|
+
});
|
|
57
|
+
createRenderEffect(on(open, input => {
|
|
58
|
+
if (input) {
|
|
59
|
+
const rect = document.activeElement?.getBoundingClientRect();
|
|
60
|
+
setActiveElementCenter({
|
|
61
|
+
x: rect ? rect.x + rect.width / 2 : 0,
|
|
62
|
+
y: rect ? rect.y + rect.height / 2 : 0
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
let modalRootRef;
|
|
67
|
+
createTransition(() => modalRootRef, open, {
|
|
68
|
+
name: 'ant-modal-fade',
|
|
69
|
+
onAfterEnter: () => {
|
|
70
|
+
props.onAfterEnter?.();
|
|
71
|
+
},
|
|
72
|
+
onAfterExit: () => {
|
|
73
|
+
props.onAfterExit?.();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const locale = useLocale();
|
|
77
|
+
return createComponent(DelayShow, {
|
|
78
|
+
get when() {
|
|
79
|
+
return open();
|
|
80
|
+
},
|
|
81
|
+
get children() {
|
|
82
|
+
return createComponent(Portal, {
|
|
83
|
+
get children() {
|
|
84
|
+
return createComponent(Transition, {
|
|
85
|
+
name: "ant-modal-fade",
|
|
86
|
+
onEnter: (el, done) => {
|
|
87
|
+
el.animate([], {
|
|
88
|
+
duration: transitionDuration * 1000
|
|
89
|
+
}).finished.finally(done);
|
|
90
|
+
},
|
|
91
|
+
get onAfterExit() {
|
|
92
|
+
return props.onAfterExit;
|
|
93
|
+
},
|
|
94
|
+
onExit: (el, done) => {
|
|
95
|
+
el.animate([], {
|
|
96
|
+
duration: transitionDuration * 1000
|
|
97
|
+
}).finished.finally(done);
|
|
98
|
+
},
|
|
99
|
+
get children() {
|
|
100
|
+
return createComponent(Dynamic, {
|
|
101
|
+
get component() {
|
|
102
|
+
return props.destroyOnClose ? Show : DelayShow;
|
|
103
|
+
},
|
|
104
|
+
get when() {
|
|
105
|
+
return open();
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return createComponent(Element, {
|
|
109
|
+
ref(r$) {
|
|
110
|
+
var _ref$ = modalRootRef;
|
|
111
|
+
typeof _ref$ === "function" ? _ref$(r$) : modalRootRef = r$;
|
|
112
|
+
},
|
|
113
|
+
"class": "[font-size:var(--ant-font-size)] text-[var(--ant-color-text)] leading-[var(--ant-line-height)]",
|
|
114
|
+
style: {
|
|
115
|
+
'--transition-duration': `${transitionDuration}s`
|
|
116
|
+
},
|
|
117
|
+
get children() {
|
|
118
|
+
return [createComponent(Show, {
|
|
119
|
+
get when() {
|
|
120
|
+
return props.mask;
|
|
121
|
+
},
|
|
122
|
+
get children() {
|
|
123
|
+
var _el$ = _tmpl$();
|
|
124
|
+
_el$.$$click = () => {
|
|
125
|
+
if (props.maskClosable) {
|
|
126
|
+
props.onCancel?.();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
effect(() => className(_el$, cs('ant-modal-mask', 'fixed inset-0 bg-[var(--ant-color-bg-mask)] z-1000')));
|
|
130
|
+
return _el$;
|
|
131
|
+
}
|
|
132
|
+
}), (() => {
|
|
133
|
+
var _el$2 = _tmpl$5(),
|
|
134
|
+
_el$3 = _el$2.firstChild,
|
|
135
|
+
_el$5 = _el$3.firstChild,
|
|
136
|
+
_el$6 = _el$5.nextSibling;
|
|
137
|
+
_el$3.$$click = e => {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
};
|
|
140
|
+
insert(_el$3, createComponent(Show, {
|
|
141
|
+
get when() {
|
|
142
|
+
return props.closeIcon;
|
|
143
|
+
},
|
|
144
|
+
get children() {
|
|
145
|
+
return createComponent(Button, {
|
|
146
|
+
type: "text",
|
|
147
|
+
get ["class"]() {
|
|
148
|
+
return cs('!w-22px !h-22px !flex !justify-center !items-center text-center text-18px !absolute !top-16px !right-16px z-1000 !text-[var(--ant-color-icon)] hover:!text-[var(--ant-color-icon-hover)]');
|
|
149
|
+
},
|
|
150
|
+
onClick: () => {
|
|
151
|
+
props.onCancel?.();
|
|
152
|
+
},
|
|
153
|
+
get children() {
|
|
154
|
+
return _tmpl$2();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}), _el$5);
|
|
159
|
+
insert(_el$5, () => props.title);
|
|
160
|
+
insert(_el$6, () => props.children);
|
|
161
|
+
insert(_el$3, createComponent(Show, {
|
|
162
|
+
get when() {
|
|
163
|
+
return props.footer;
|
|
164
|
+
},
|
|
165
|
+
get children() {
|
|
166
|
+
var _el$7 = _tmpl$4();
|
|
167
|
+
insert(_el$7, createComponent(Show, {
|
|
168
|
+
get when() {
|
|
169
|
+
return typeof props.footer !== 'function';
|
|
170
|
+
},
|
|
171
|
+
get fallback() {
|
|
172
|
+
return memo(() => typeof props.footer === 'function')() && props.footer();
|
|
173
|
+
},
|
|
174
|
+
get children() {
|
|
175
|
+
var _el$8 = _tmpl$3();
|
|
176
|
+
insert(_el$8, createComponent(Button, mergeProps$1({
|
|
177
|
+
onClick: () => {
|
|
178
|
+
props.onCancel?.();
|
|
179
|
+
},
|
|
180
|
+
get children() {
|
|
181
|
+
return locale().Modal?.cancelText;
|
|
182
|
+
}
|
|
183
|
+
}, () => props.cancelButtonProps)), null);
|
|
184
|
+
insert(_el$8, createComponent(Button, mergeProps$1({
|
|
185
|
+
type: "primary",
|
|
186
|
+
loading: "auto",
|
|
187
|
+
onClick: async () => await props.onOk?.(),
|
|
188
|
+
get children() {
|
|
189
|
+
return locale().Modal?.okText;
|
|
190
|
+
}
|
|
191
|
+
}, () => props.okButtonProps)), null);
|
|
192
|
+
return _el$8;
|
|
193
|
+
}
|
|
194
|
+
}));
|
|
195
|
+
return _el$7;
|
|
196
|
+
}
|
|
197
|
+
}), null);
|
|
198
|
+
effect(_p$ => {
|
|
199
|
+
var _v$ = cs('ant-modal', 'px-24px py-20px rounded-8px overflow-hidden bg-[--ant-color-bg-container-secondary] flex flex-col max-w-[calc(100vw-calc(var(--ant-margin)*2))] transform-origin-center pointer-events-initial'),
|
|
200
|
+
_v$2 = props.centered ? 'max(calc(50vh - 50%), 0px)' : '100px',
|
|
201
|
+
_v$3 = `${activeElementCenter().x}px`,
|
|
202
|
+
_v$4 = `${activeElementCenter().y}px`,
|
|
203
|
+
_v$5 = props.width,
|
|
204
|
+
_v$6 = props.height;
|
|
205
|
+
_v$ !== _p$.e && className(_el$3, _p$.e = _v$);
|
|
206
|
+
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$3.style.setProperty("--translate-y", _v$2) : _el$3.style.removeProperty("--translate-y"));
|
|
207
|
+
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$3.style.setProperty("--active-element-center-x", _v$3) : _el$3.style.removeProperty("--active-element-center-x"));
|
|
208
|
+
_v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$3.style.setProperty("--active-element-center-y", _v$4) : _el$3.style.removeProperty("--active-element-center-y"));
|
|
209
|
+
_v$5 !== _p$.i && ((_p$.i = _v$5) != null ? _el$3.style.setProperty("width", _v$5) : _el$3.style.removeProperty("width"));
|
|
210
|
+
_v$6 !== _p$.n && ((_p$.n = _v$6) != null ? _el$3.style.setProperty("height", _v$6) : _el$3.style.removeProperty("height"));
|
|
211
|
+
return _p$;
|
|
212
|
+
}, {
|
|
213
|
+
e: undefined,
|
|
214
|
+
t: undefined,
|
|
215
|
+
a: undefined,
|
|
216
|
+
o: undefined,
|
|
217
|
+
i: undefined,
|
|
218
|
+
n: undefined
|
|
219
|
+
});
|
|
220
|
+
return _el$2;
|
|
221
|
+
})()];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
Modal.warning = warning;
|
|
234
|
+
Modal.useModal = useModal;
|
|
235
|
+
delegateEvents(["click"]);
|
|
236
|
+
|
|
237
|
+
export { Modal as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".ant-modal {\n --scale: 1;\n --translate-x: calc(50vw - 50%);\n transform: translate(var(--translate-x), var(--translate-y)) scale(var(--scale));\n}\n\n.ant-modal-fade-enter-active .ant-modal-mask,\n.ant-modal-fade-exit-active .ant-modal-mask {\n transition: opacity var(--transition-duration);\n}\n.ant-modal-fade-enter-active .ant-modal,\n.ant-modal-fade-exit-active .ant-modal {\n transition: transform var(--transition-duration);\n}\n\n.ant-modal-fade-enter .ant-modal-mask,\n.ant-modal-fade-exit-to .ant-modal-mask {\n opacity: 0;\n}\n.ant-modal-fade-enter .ant-modal,\n.ant-modal-fade-exit-to .ant-modal {\n --scale: 0;\n --translate-x: calc(var(--active-element-center-x) - 50%) !important;\n --translate-y: calc(var(--active-element-center-y) - 50%) !important;\n}";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createComponent, mergeProps, insert, template } from 'solid-js/web';
|
|
2
|
+
import { createSignal } from 'solid-js';
|
|
3
|
+
import Modal from './index.js';
|
|
4
|
+
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/template(`<div class="flex items-center gap-12px"><span class="i-ant-design:exclamation-circle text-22px text-[var(--ant-color-warning)]">`),
|
|
6
|
+
_tmpl$2 = /*#__PURE__*/template(`<div class=ml-34px>`);
|
|
7
|
+
function useModal() {
|
|
8
|
+
const [open, setOpen] = createSignal(false);
|
|
9
|
+
const [modalProps, setModalProps] = createSignal({});
|
|
10
|
+
const modal = {
|
|
11
|
+
warning: props => {
|
|
12
|
+
setModalProps(props);
|
|
13
|
+
setOpen(true);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const getContextHolder = () => createComponent(Modal, mergeProps({
|
|
17
|
+
width: "416px",
|
|
18
|
+
maskClosable: false,
|
|
19
|
+
closeIcon: false
|
|
20
|
+
}, modalProps, {
|
|
21
|
+
get title() {
|
|
22
|
+
return (() => {
|
|
23
|
+
var _el$ = _tmpl$();
|
|
24
|
+
_el$.firstChild;
|
|
25
|
+
insert(_el$, () => modalProps().title, null);
|
|
26
|
+
return _el$;
|
|
27
|
+
})();
|
|
28
|
+
},
|
|
29
|
+
get children() {
|
|
30
|
+
return (() => {
|
|
31
|
+
var _el$3 = _tmpl$2();
|
|
32
|
+
insert(_el$3, () => modalProps().children);
|
|
33
|
+
return _el$3;
|
|
34
|
+
})();
|
|
35
|
+
},
|
|
36
|
+
get open() {
|
|
37
|
+
return open();
|
|
38
|
+
},
|
|
39
|
+
onOk: () => {
|
|
40
|
+
setOpen(false);
|
|
41
|
+
modalProps().onOk?.();
|
|
42
|
+
},
|
|
43
|
+
onCancel: () => {
|
|
44
|
+
setOpen(false);
|
|
45
|
+
modalProps().onCancel?.();
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
48
|
+
return [modal, getContextHolder];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { useModal as default };
|