antd-solid 0.0.6 → 0.0.8
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/dist/index.esm.js +2356 -0
- package/dist/index.umd.js +1 -0
- package/es/Button.d.ts +19 -0
- package/es/Button.js +73 -0
- package/es/Collapse/index.d.ts +16 -0
- package/es/Collapse/index.js +87 -0
- package/es/ColorPicker.d.ts +8 -0
- package/es/ColorPicker.js +6 -0
- package/es/Compact.d.ts +12 -0
- package/es/Compact.js +17 -0
- package/es/DatePicker.d.ts +19 -0
- package/es/DatePicker.js +9 -0
- package/es/Empty/PRESENTED_IMAGE_SIMPLE.d.ts +3 -0
- package/es/Empty/PRESENTED_IMAGE_SIMPLE.js +14 -0
- package/es/Empty/assets/EmptySvg.d.ts +2 -0
- package/es/Empty/assets/EmptySvg.js +6 -0
- package/es/Empty/assets/SimpleEmptySvg.d.ts +2 -0
- package/es/Empty/assets/SimpleEmptySvg.js +6 -0
- package/es/Empty/index.d.ts +5 -0
- package/es/Empty/index.js +16 -0
- package/es/Image.d.ts +9 -0
- package/es/Image.js +22 -0
- package/es/Input.d.ts +29 -0
- package/es/Input.js +144 -0
- package/es/InputNumber.d.ts +11 -0
- package/es/InputNumber.js +92 -0
- package/es/InputNumber.test.d.ts +1 -0
- package/es/InputNumber.test.js +42 -0
- package/es/Modal.d.ts +47 -0
- package/es/Modal.js +195 -0
- package/es/Popconfirm.d.ts +21 -0
- package/es/Popconfirm.js +64 -0
- package/es/Popover.d.ts +7 -0
- package/es/Popover.js +36 -0
- package/es/Progress.d.ts +7 -0
- package/es/Progress.js +6 -0
- package/es/Radio.d.ts +27 -0
- package/es/Radio.js +89 -0
- package/es/Result.d.ts +10 -0
- package/es/Result.js +29 -0
- package/es/Segmented/index.d.ts +21 -0
- package/es/Segmented/index.js +72 -0
- package/es/Select.d.ts +16 -0
- package/es/Select.js +113 -0
- package/es/Skeleton.d.ts +9 -0
- package/es/Skeleton.js +9 -0
- package/es/Spin.d.ts +9 -0
- package/es/Spin.js +22 -0
- package/es/Switch.d.ts +8 -0
- package/es/Switch.js +30 -0
- package/es/Table.d.ts +11 -0
- package/es/Table.js +57 -0
- package/es/Tabs.d.ts +17 -0
- package/es/Tabs.js +117 -0
- package/es/Timeline.d.ts +13 -0
- package/es/Timeline.js +30 -0
- package/es/Tooltip.d.ts +34 -0
- package/es/Tooltip.js +302 -0
- package/es/Tree.d.ts +28 -0
- package/es/Tree.js +198 -0
- package/es/Upload.d.ts +11 -0
- package/es/Upload.js +6 -0
- package/es/form/Form.d.ts +18 -0
- package/es/form/Form.js +70 -0
- package/es/form/FormItem.d.ts +19 -0
- package/es/form/FormItem.js +141 -0
- package/es/form/context.d.ts +12 -0
- package/es/form/context.js +5 -0
- package/es/form/index.d.ts +8 -0
- package/es/form/index.js +7 -0
- package/es/hooks/createControllableValue.d.ts +16 -0
- package/es/hooks/createControllableValue.js +41 -0
- package/es/hooks/createUpdateEffect.d.ts +5 -0
- package/es/hooks/createUpdateEffect.js +12 -0
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/useClickAway.d.ts +2 -0
- package/es/hooks/useClickAway.js +17 -0
- package/es/hooks/useSize.d.ts +5 -0
- package/es/hooks/useSize.js +22 -0
- package/es/index.d.ts +42 -0
- package/es/index.js +29 -0
- package/es/types/index.d.ts +3 -0
- package/es/types/index.js +1 -0
- package/es/utils/EventEmitter.d.ts +7 -0
- package/es/utils/EventEmitter.js +13 -0
- package/es/utils/ReactToSolid.d.ts +8 -0
- package/es/utils/ReactToSolid.js +30 -0
- package/es/utils/SolidToReact.d.ts +8 -0
- package/es/utils/SolidToReact.js +23 -0
- package/es/utils/array.d.ts +15 -0
- package/es/utils/array.js +19 -0
- package/es/utils/component.d.ts +31 -0
- package/es/utils/component.js +68 -0
- package/es/utils/solid.d.ts +15 -0
- package/es/utils/solid.js +32 -0
- package/es/utils/zh_CN.d.ts +2 -0
- package/{src/utils/zh_CN.ts → es/utils/zh_CN.js} +34 -34
- package/package.json +7 -6
- package/src/Button.tsx +0 -125
- package/src/Collapse/index.tsx +0 -86
- package/src/ColorPicker.tsx +0 -11
- package/src/Compact.tsx +0 -15
- package/src/DatePicker.tsx +0 -22
- 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/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 -196
- package/src/Popconfirm.tsx +0 -75
- package/src/Popover.tsx +0 -30
- package/src/Progress.tsx +0 -4
- package/src/Radio.tsx +0 -132
- 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 -355
- package/src/Tree.tsx +0 -246
- package/src/Upload.tsx +0 -10
- package/src/form/Form.tsx +0 -94
- package/src/form/FormItem.tsx +0 -139
- package/src/form/context.ts +0 -16
- package/src/form/index.ts +0 -13
- package/src/hooks/createControllableValue.ts +0 -68
- 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 -44
- 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 -53
- /package/{dist → css}/index.css +0 -0
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { default as Button } from './Button';
|
|
2
|
+
export { default as Input } from './Input';
|
|
3
|
+
export type { InputProps } from './Input';
|
|
4
|
+
export { default as InputNumber } from './InputNumber';
|
|
5
|
+
export type { InputNumberProps } from './InputNumber';
|
|
6
|
+
export { default as Timeline } from './Timeline';
|
|
7
|
+
export { default as Modal } from './Modal';
|
|
8
|
+
export type { ModalInstance } from './Modal';
|
|
9
|
+
export { default as DatePicker } from './DatePicker';
|
|
10
|
+
export { default as Select } from './Select';
|
|
11
|
+
export { default as Tree } from './Tree';
|
|
12
|
+
export type { TreeProps } from './Tree';
|
|
13
|
+
export { default as Popover } from './Popover';
|
|
14
|
+
export { default as Tooltip } from './Tooltip';
|
|
15
|
+
export { default as ColorPicker } from './ColorPicker';
|
|
16
|
+
export type { ColorPickerProps } from './ColorPicker';
|
|
17
|
+
export { default as Result } from './Result';
|
|
18
|
+
export { default as Progress } from './Progress';
|
|
19
|
+
export { default as Tabs } from './Tabs';
|
|
20
|
+
export type { TabsProps, Tab } from './Tabs';
|
|
21
|
+
export { default as Popconfirm } from './Popconfirm';
|
|
22
|
+
export { default as Upload } from './Upload';
|
|
23
|
+
export type { UploadProps, UploadFile } from './Upload';
|
|
24
|
+
export { default as Radio } from './Radio';
|
|
25
|
+
export type { RadioProps, RadioGroupProps } from './Radio';
|
|
26
|
+
export { default as Form } from './form';
|
|
27
|
+
export type { FormInstance, FormProps, FormItemProps, FormItemComponentProps } from './form';
|
|
28
|
+
export { default as Switch } from './Switch';
|
|
29
|
+
export type { SwitchProps } from './Switch';
|
|
30
|
+
export { default as Skeleton } from './Skeleton';
|
|
31
|
+
export { default as Spin } from './Spin';
|
|
32
|
+
export { default as Image } from './Image';
|
|
33
|
+
export { default as Table } from './Table';
|
|
34
|
+
export type { TableProps, TableColumn } from './Table';
|
|
35
|
+
export { default as Compact } from './Compact';
|
|
36
|
+
export type { CollapseProps, CollapseItem } from './Collapse';
|
|
37
|
+
export { default as Collapse } from './Collapse';
|
|
38
|
+
export { default as Empty } from './Empty';
|
|
39
|
+
export type { SegmentedProps } from './Segmented';
|
|
40
|
+
export { default as Segmented } from './Segmented';
|
|
41
|
+
export { default as createControllableValue } from './hooks/createControllableValue';
|
|
42
|
+
export { message } from 'antd';
|
package/es/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { default as Button } from './Button.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';
|
|
6
|
+
export { default as DatePicker } from './DatePicker.js';
|
|
7
|
+
export { default as Select } from './Select.js';
|
|
8
|
+
export { default as Tree } from './Tree.js';
|
|
9
|
+
export { default as Popover } from './Popover.js';
|
|
10
|
+
export { default as Tooltip } from './Tooltip.js';
|
|
11
|
+
export { default as ColorPicker } from './ColorPicker.js';
|
|
12
|
+
export { default as Result } from './Result.js';
|
|
13
|
+
export { default as Progress } from './Progress.js';
|
|
14
|
+
export { default as Tabs } from './Tabs.js';
|
|
15
|
+
export { default as Popconfirm } from './Popconfirm.js';
|
|
16
|
+
export { default as Upload } from './Upload.js';
|
|
17
|
+
export { default as Radio } from './Radio.js';
|
|
18
|
+
export { default as Form } from './form/index.js';
|
|
19
|
+
export { default as Switch } from './Switch.js';
|
|
20
|
+
export { default as Skeleton } from './Skeleton.js';
|
|
21
|
+
export { default as Spin } from './Spin.js';
|
|
22
|
+
export { default as Image } from './Image.js';
|
|
23
|
+
export { default as Table } from './Table.js';
|
|
24
|
+
export { default as Compact } from './Compact.js';
|
|
25
|
+
export { default as Collapse } from './Collapse/index.js';
|
|
26
|
+
export { default as Empty } from './Empty/index.js';
|
|
27
|
+
export { default as Segmented } from './Segmented/index.js';
|
|
28
|
+
export { default as createControllableValue } from './hooks/createControllableValue.js';
|
|
29
|
+
export { message } from 'antd';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class EventEmitter {
|
|
2
|
+
subscriptions = new Set();
|
|
3
|
+
emit = val => {
|
|
4
|
+
for (const subscription of this.subscriptions) {
|
|
5
|
+
subscription(val);
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
subscription = callback => {
|
|
9
|
+
this.subscriptions.add(callback);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { EventEmitter as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ReactToSolidProps<P extends {} = {}> {
|
|
3
|
+
component: React.FunctionComponent<P> | React.ComponentClass<P>;
|
|
4
|
+
props: P;
|
|
5
|
+
container?: Element;
|
|
6
|
+
}
|
|
7
|
+
declare function ReactToSolid<P extends {} = {}>(props: ReactToSolidProps<P>): import("solid-js").JSX.Element;
|
|
8
|
+
export default ReactToSolid;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { template } from 'solid-js/web';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
|
+
import { createMemo, onMount, onCleanup, createEffect } from 'solid-js';
|
|
5
|
+
|
|
6
|
+
const _tmpl$ = /*#__PURE__*/template(`<div role="ReactToSolid">`);
|
|
7
|
+
function ReactToSolid(props) {
|
|
8
|
+
let root;
|
|
9
|
+
const rootEle = createMemo(() => props.container ?? _tmpl$());
|
|
10
|
+
onMount(() => {
|
|
11
|
+
root = createRoot(rootEle());
|
|
12
|
+
onCleanup(() => {
|
|
13
|
+
root.unmount();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
createEffect(() => {
|
|
17
|
+
root.render(React.createElement(props.component, {
|
|
18
|
+
...props.props
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
// if (import.meta.env.SSR) {
|
|
22
|
+
// // eslint-disable-next-line solid/reactivity
|
|
23
|
+
// const node = React.createElement(props.component, { ...props.props })
|
|
24
|
+
// // eslint-disable-next-line solid/components-return-once, solid/no-innerhtml
|
|
25
|
+
// return <div innerHTML={renderToString(node)} />
|
|
26
|
+
// }
|
|
27
|
+
return rootEle;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { ReactToSolid as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FunctionComponent, type ReactElement } from 'react';
|
|
2
|
+
import { type JSX } from 'solid-js';
|
|
3
|
+
export interface SolidToReactProps {
|
|
4
|
+
children?: JSX.Element;
|
|
5
|
+
container?: ReactElement;
|
|
6
|
+
}
|
|
7
|
+
declare const SolidToReact: FunctionComponent<SolidToReactProps>;
|
|
8
|
+
export default SolidToReact;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { render } from 'solid-js/web';
|
|
3
|
+
|
|
4
|
+
const SolidToReact = ({
|
|
5
|
+
children,
|
|
6
|
+
container
|
|
7
|
+
}) => {
|
|
8
|
+
const ref = useRef();
|
|
9
|
+
useEffect(() => render(() => children, ref.current), []);
|
|
10
|
+
// if (import.meta.env.SSR) {
|
|
11
|
+
// return React.createElement('div', {
|
|
12
|
+
// dangerouslySetInnerHTML: { __html: renderToString(() => children) },
|
|
13
|
+
// })
|
|
14
|
+
// }
|
|
15
|
+
return container ? React.cloneElement(container, {
|
|
16
|
+
ref
|
|
17
|
+
}) : React.createElement('div', {
|
|
18
|
+
ref,
|
|
19
|
+
role: 'SolidToReact'
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { SolidToReact as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 如果传入一个非数组字段,则将其转化为数组
|
|
3
|
+
* @param value
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare function toArray<T>(value: T | T[]): T[];
|
|
7
|
+
export interface StandardNode {
|
|
8
|
+
children?: this[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 将数组中每个对象的 children 拍扁后返回
|
|
12
|
+
* @param nodes
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function flatChildren<T extends StandardNode = StandardNode>(nodes: T[] | undefined): T[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 如果传入一个非数组字段,则将其转化为数组
|
|
3
|
+
* @param value
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
function toArray(value) {
|
|
7
|
+
return Array.isArray(value) ? value : [value];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 将数组中每个对象的 children 拍扁后返回
|
|
11
|
+
* @param nodes
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
function flatChildren(nodes) {
|
|
15
|
+
if (!nodes) return [];
|
|
16
|
+
return nodes.flatMap(node => [node, ...flatChildren(node.children)]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { flatChildren, toArray };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Component, type JSXElement } from 'solid-js';
|
|
3
|
+
import { type ConfigProviderProps } from 'antd/es/config-provider';
|
|
4
|
+
/**
|
|
5
|
+
* 将组件 props 中的 className 替换为 class
|
|
6
|
+
* @param C
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function replaceClassName<T extends {
|
|
10
|
+
className?: string;
|
|
11
|
+
}, Target extends Omit<T, 'className'> & {
|
|
12
|
+
class?: string;
|
|
13
|
+
}>(C: Component<T>): Component<Target>;
|
|
14
|
+
/**
|
|
15
|
+
* 将组件 props 中的 children 替换为 JSXElement
|
|
16
|
+
* @param C
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare function replaceChildren<T extends {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}, Target extends Omit<T, 'children'> & {
|
|
22
|
+
children?: JSXElement;
|
|
23
|
+
}>(C: Component<T>): Component<Target>;
|
|
24
|
+
export declare function reactToSolidComponent<P extends {} = {}>(component: React.FunctionComponent<P> | React.ComponentClass<P>, container?: Element | (() => Element)): (props: P) => import("solid-js").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* 返回被 ConfigProvider 包裹后的 component
|
|
27
|
+
* @param component
|
|
28
|
+
* @param configProviderProps
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export declare function configProvider<P extends {} = {}>(component: React.FunctionComponent<P> | React.ComponentClass<P>, configProviderProps?: ConfigProviderProps): (props: P) => React.FunctionComponentElement<ConfigProviderProps>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createComponent, mergeProps } from 'solid-js/web';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createMemo } from 'solid-js';
|
|
4
|
+
import { omit } from 'lodash-es';
|
|
5
|
+
import { solidToReact } from './solid.js';
|
|
6
|
+
import ReactToSolid from './ReactToSolid.js';
|
|
7
|
+
import { ConfigProvider } from 'antd';
|
|
8
|
+
import zhCN from './zh_CN.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 将组件 props 中的 className 替换为 class
|
|
12
|
+
* @param C
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
function replaceClassName(C) {
|
|
16
|
+
return function (_props) {
|
|
17
|
+
const props = createMemo(() => {
|
|
18
|
+
return {
|
|
19
|
+
...omit(_props, 'class'),
|
|
20
|
+
className: _props.class
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
return createComponent(C, mergeProps(props));
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 将组件 props 中的 children 替换为 JSXElement
|
|
28
|
+
* @param C
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
function replaceChildren(C) {
|
|
32
|
+
return function (_props) {
|
|
33
|
+
const props = createMemo(() => {
|
|
34
|
+
return {
|
|
35
|
+
..._props,
|
|
36
|
+
children: solidToReact(_props.children)
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
return createComponent(C, mergeProps(props));
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function reactToSolidComponent(component, container) {
|
|
43
|
+
return function (props) {
|
|
44
|
+
return createComponent(ReactToSolid, {
|
|
45
|
+
component: component,
|
|
46
|
+
props: props,
|
|
47
|
+
get container() {
|
|
48
|
+
return typeof container === 'function' ? container() : container;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 返回被 ConfigProvider 包裹后的 component
|
|
55
|
+
* @param component
|
|
56
|
+
* @param configProviderProps
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
function configProvider(component, configProviderProps) {
|
|
60
|
+
return function (props) {
|
|
61
|
+
return React.createElement(ConfigProvider, {
|
|
62
|
+
locale: zhCN,
|
|
63
|
+
...configProviderProps
|
|
64
|
+
}, React.createElement(component, props));
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { configProvider, reactToSolidComponent, replaceChildren, replaceClassName };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type JSXElement, type JSX } from 'solid-js';
|
|
3
|
+
import { type StringOrJSXElement } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* 判断 JSXElement 是否是基础类型
|
|
6
|
+
* @param value JSXElement
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function isBaseType(value: JSXElement): value is string | number | boolean | null | undefined;
|
|
10
|
+
export declare function solidToReact(children: JSXElement): number | boolean | (string & {}) | React.FunctionComponentElement<import("./SolidToReact").SolidToReactProps> | null | undefined;
|
|
11
|
+
export declare function dispatchEventHandlerUnion<T, E extends Event>(handler: JSX.EventHandlerUnion<T, E> | undefined, e: E & {
|
|
12
|
+
currentTarget: T;
|
|
13
|
+
target: Element;
|
|
14
|
+
}): void;
|
|
15
|
+
export declare function unwrapStringOrJSXElement(value: StringOrJSXElement): JSXElement;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isNil } from 'lodash-es';
|
|
3
|
+
import SolidToReact from './SolidToReact.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 判断 JSXElement 是否是基础类型
|
|
7
|
+
* @param value JSXElement
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
function isBaseType(value) {
|
|
11
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' || value === null || value === undefined;
|
|
12
|
+
}
|
|
13
|
+
function solidToReact(children) {
|
|
14
|
+
return isBaseType(children) ? children : React.createElement(SolidToReact, {
|
|
15
|
+
children
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function dispatchEventHandlerUnion(handler, e) {
|
|
19
|
+
if (isNil(handler)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (typeof handler === 'function') {
|
|
23
|
+
handler(e);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
handler[0](handler[1], e);
|
|
27
|
+
}
|
|
28
|
+
function unwrapStringOrJSXElement(value) {
|
|
29
|
+
return typeof value === 'function' ? value() : value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { dispatchEventHandlerUnion, isBaseType, solidToReact, unwrapStringOrJSXElement };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default {
|
|
1
|
+
var zhCN = {
|
|
4
2
|
locale: 'zh-cn',
|
|
5
3
|
Pagination: {
|
|
6
4
|
items_per_page: '条/页',
|
|
@@ -13,7 +11,7 @@ export default {
|
|
|
13
11
|
next_5: '向后 5 页',
|
|
14
12
|
prev_3: '向前 3 页',
|
|
15
13
|
next_3: '向后 3 页',
|
|
16
|
-
page_size: '页码'
|
|
14
|
+
page_size: '页码'
|
|
17
15
|
},
|
|
18
16
|
DatePicker: {
|
|
19
17
|
lang: {
|
|
@@ -52,16 +50,16 @@ export default {
|
|
|
52
50
|
previousDecade: '上一年代',
|
|
53
51
|
nextDecade: '下一年代',
|
|
54
52
|
previousCentury: '上一世纪',
|
|
55
|
-
nextCentury: '下一世纪'
|
|
53
|
+
nextCentury: '下一世纪'
|
|
56
54
|
},
|
|
57
55
|
timePickerLocale: {
|
|
58
56
|
placeholder: '请选择时间',
|
|
59
|
-
rangePlaceholder: ['开始时间', '结束时间']
|
|
60
|
-
}
|
|
57
|
+
rangePlaceholder: ['开始时间', '结束时间']
|
|
58
|
+
}
|
|
61
59
|
},
|
|
62
60
|
TimePicker: {
|
|
63
61
|
placeholder: '请选择时间',
|
|
64
|
-
rangePlaceholder: ['开始时间', '结束时间']
|
|
62
|
+
rangePlaceholder: ['开始时间', '结束时间']
|
|
65
63
|
},
|
|
66
64
|
Calendar: {
|
|
67
65
|
lang: {
|
|
@@ -100,15 +98,15 @@ export default {
|
|
|
100
98
|
previousDecade: '上一年代',
|
|
101
99
|
nextDecade: '下一年代',
|
|
102
100
|
previousCentury: '上一世纪',
|
|
103
|
-
nextCentury: '下一世纪'
|
|
101
|
+
nextCentury: '下一世纪'
|
|
104
102
|
},
|
|
105
103
|
timePickerLocale: {
|
|
106
104
|
placeholder: '请选择时间',
|
|
107
|
-
rangePlaceholder: ['开始时间', '结束时间']
|
|
108
|
-
}
|
|
105
|
+
rangePlaceholder: ['开始时间', '结束时间']
|
|
106
|
+
}
|
|
109
107
|
},
|
|
110
108
|
global: {
|
|
111
|
-
placeholder: '请选择'
|
|
109
|
+
placeholder: '请选择'
|
|
112
110
|
},
|
|
113
111
|
Table: {
|
|
114
112
|
filterTitle: '筛选',
|
|
@@ -126,21 +124,21 @@ export default {
|
|
|
126
124
|
collapse: '关闭行',
|
|
127
125
|
triggerDesc: '点击降序',
|
|
128
126
|
triggerAsc: '点击升序',
|
|
129
|
-
cancelSort: '取消排序'
|
|
127
|
+
cancelSort: '取消排序'
|
|
130
128
|
},
|
|
131
129
|
Modal: {
|
|
132
130
|
okText: '确定',
|
|
133
131
|
cancelText: '取消',
|
|
134
|
-
justOkText: '知道了'
|
|
132
|
+
justOkText: '知道了'
|
|
135
133
|
},
|
|
136
134
|
Tour: {
|
|
137
135
|
Next: '下一步',
|
|
138
136
|
Previous: '上一步',
|
|
139
|
-
Finish: '结束导览'
|
|
137
|
+
Finish: '结束导览'
|
|
140
138
|
},
|
|
141
139
|
Popconfirm: {
|
|
142
140
|
cancelText: '取消',
|
|
143
|
-
okText: '确定'
|
|
141
|
+
okText: '确定'
|
|
144
142
|
},
|
|
145
143
|
Transfer: {
|
|
146
144
|
titles: ['', ''],
|
|
@@ -152,29 +150,29 @@ export default {
|
|
|
152
150
|
removeCurrent: '删除当页',
|
|
153
151
|
selectAll: '全选所有',
|
|
154
152
|
removeAll: '删除全部',
|
|
155
|
-
selectInvert: '反选当页'
|
|
153
|
+
selectInvert: '反选当页'
|
|
156
154
|
},
|
|
157
155
|
Upload: {
|
|
158
156
|
uploading: '文件上传中',
|
|
159
157
|
removeFile: '删除文件',
|
|
160
158
|
uploadError: '上传错误',
|
|
161
159
|
previewFile: '预览文件',
|
|
162
|
-
downloadFile: '下载文件'
|
|
160
|
+
downloadFile: '下载文件'
|
|
163
161
|
},
|
|
164
162
|
Empty: {
|
|
165
|
-
description: '暂无数据'
|
|
163
|
+
description: '暂无数据'
|
|
166
164
|
},
|
|
167
165
|
Icon: {
|
|
168
|
-
icon: '图标'
|
|
166
|
+
icon: '图标'
|
|
169
167
|
},
|
|
170
168
|
Text: {
|
|
171
169
|
edit: '编辑',
|
|
172
170
|
copy: '复制',
|
|
173
171
|
copied: '复制成功',
|
|
174
|
-
expand: '展开'
|
|
172
|
+
expand: '展开'
|
|
175
173
|
},
|
|
176
174
|
PageHeader: {
|
|
177
|
-
back: '返回'
|
|
175
|
+
back: '返回'
|
|
178
176
|
},
|
|
179
177
|
Form: {
|
|
180
178
|
optional: '(可选)',
|
|
@@ -186,7 +184,7 @@ export default {
|
|
|
186
184
|
date: {
|
|
187
185
|
format: '${label}日期格式无效',
|
|
188
186
|
parse: '${label}不能转换为日期',
|
|
189
|
-
invalid: '${label}是一个无效日期'
|
|
187
|
+
invalid: '${label}是一个无效日期'
|
|
190
188
|
},
|
|
191
189
|
types: {
|
|
192
190
|
string: '${label}不是一个有效的${type}',
|
|
@@ -201,36 +199,38 @@ export default {
|
|
|
201
199
|
regexp: '${label}不是一个有效的${type}',
|
|
202
200
|
email: '${label}不是一个有效的${type}',
|
|
203
201
|
url: '${label}不是一个有效的${type}',
|
|
204
|
-
hex: '${label}不是一个有效的${type}'
|
|
202
|
+
hex: '${label}不是一个有效的${type}'
|
|
205
203
|
},
|
|
206
204
|
string: {
|
|
207
205
|
len: '${label}须为${len}个字符',
|
|
208
206
|
min: '${label}最少${min}个字符',
|
|
209
207
|
max: '${label}最多${max}个字符',
|
|
210
|
-
range: '${label}须在${min}-${max}字符之间'
|
|
208
|
+
range: '${label}须在${min}-${max}字符之间'
|
|
211
209
|
},
|
|
212
210
|
number: {
|
|
213
211
|
len: '${label}必须等于${len}',
|
|
214
212
|
min: '${label}最小值为${min}',
|
|
215
213
|
max: '${label}最大值为${max}',
|
|
216
|
-
range: '${label}须在${min}-${max}之间'
|
|
214
|
+
range: '${label}须在${min}-${max}之间'
|
|
217
215
|
},
|
|
218
216
|
array: {
|
|
219
217
|
len: '须为${len}个${label}',
|
|
220
218
|
min: '最少${min}个${label}',
|
|
221
219
|
max: '最多${max}个${label}',
|
|
222
|
-
range: '${label}数量须在${min}-${max}之间'
|
|
220
|
+
range: '${label}数量须在${min}-${max}之间'
|
|
223
221
|
},
|
|
224
222
|
pattern: {
|
|
225
|
-
mismatch: '${label}与模式不匹配${pattern}'
|
|
226
|
-
}
|
|
227
|
-
}
|
|
223
|
+
mismatch: '${label}与模式不匹配${pattern}'
|
|
224
|
+
}
|
|
225
|
+
}
|
|
228
226
|
},
|
|
229
227
|
Image: {
|
|
230
|
-
preview: '预览'
|
|
228
|
+
preview: '预览'
|
|
231
229
|
},
|
|
232
230
|
QRCode: {
|
|
233
231
|
expired: '二维码过期',
|
|
234
|
-
refresh: '点击刷新'
|
|
235
|
-
}
|
|
236
|
-
}
|
|
232
|
+
refresh: '点击刷新'
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export { zhCN as default };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "es/index.js",
|
|
6
|
+
"types": "es/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@iconify-json/ant-design": "^1.1.5",
|
|
@@ -67,14 +67,15 @@
|
|
|
67
67
|
},
|
|
68
68
|
"files": [
|
|
69
69
|
"dist",
|
|
70
|
-
"
|
|
70
|
+
"es",
|
|
71
|
+
"css"
|
|
71
72
|
],
|
|
72
73
|
"scripts": {
|
|
73
74
|
"docs:dev": "vitepress dev docs",
|
|
74
75
|
"docs:build": "node scripts/annotationNonProductionCode && vitepress build docs && node scripts/cancelAnnotationNonProductionCode",
|
|
75
76
|
"docs:preview": "vitepress preview docs",
|
|
76
|
-
"build": "rm -rf dist && NODE_ENV=production && npx rollup -c && npm run build:unocss",
|
|
77
|
-
"build:unocss": "npx unocss './src/**' -o
|
|
77
|
+
"build": "rm -rf dist && rm -rf es && rm -rf css && NODE_ENV=production && npx rollup -c && npm run build:unocss",
|
|
78
|
+
"build:unocss": "npx unocss './src/**' -o css/index.css -m",
|
|
78
79
|
"test": "vitest"
|
|
79
80
|
}
|
|
80
81
|
}
|