antd-solid 0.0.2 → 0.0.3

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.
Files changed (105) hide show
  1. package/.eslintignore +2 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.vscode/settings.json +1 -1
  4. package/docs/.vitepress/components/Code.vue +127 -11
  5. package/docs/.vitepress/config.ts +39 -1
  6. package/docs/.vitepress/theme/index.css +4 -0
  7. package/docs/.vitepress/theme/index.ts +0 -1
  8. package/docs/components/{Button.tsx → button/Base.tsx} +1 -0
  9. package/docs/components/button/Danger.tsx +21 -0
  10. package/docs/components/button.md +19 -7
  11. package/docs/components/collapse/Base.tsx +25 -0
  12. package/docs/components/collapse.md +26 -0
  13. package/docs/components/color-picker/Base.tsx +14 -0
  14. package/docs/components/color-picker.md +26 -0
  15. package/docs/components/compact/Base.tsx +27 -0
  16. package/docs/components/compact.md +26 -0
  17. package/docs/components/date-picker/Base.tsx +15 -0
  18. package/docs/components/date-picker.md +26 -0
  19. package/docs/components/empty/Base.tsx +8 -0
  20. package/docs/components/empty/PRESENTED_IMAGE_SIMPLE.tsx +8 -0
  21. package/docs/components/empty.md +32 -0
  22. package/docs/components/form/Base.tsx +63 -0
  23. package/docs/components/form.md +27 -0
  24. package/docs/components/image/Base.tsx +13 -0
  25. package/docs/components/image.md +26 -0
  26. package/docs/components/input/AddonBeforeAndAfter.tsx +14 -0
  27. package/docs/components/input/Base.tsx +15 -0
  28. package/docs/components/input/Disabled.tsx +19 -0
  29. package/docs/components/input/PrefixAndSuffix.tsx +14 -0
  30. package/docs/components/input/Status.tsx +25 -0
  31. package/docs/components/input/TextArea.tsx +14 -0
  32. package/docs/components/input-number/Base.tsx +15 -0
  33. package/docs/components/input-number/MinMax.tsx +17 -0
  34. package/docs/components/input-number.md +34 -0
  35. package/docs/components/input.md +57 -0
  36. package/docs/components/modal/Base.tsx +35 -0
  37. package/docs/components/modal.md +26 -0
  38. package/docs/components/popconfirm/Base.tsx +25 -0
  39. package/docs/components/popconfirm.md +26 -0
  40. package/docs/components/popover/Base.tsx +19 -0
  41. package/docs/components/popover.md +26 -0
  42. package/docs/components/progress/Base.tsx +16 -0
  43. package/docs/components/progress.md +26 -0
  44. package/docs/components/radio/Base.tsx +10 -0
  45. package/docs/components/radio.md +26 -0
  46. package/docs/components/segmented/Base.tsx +10 -0
  47. package/docs/components/segmented/Block.tsx +10 -0
  48. package/docs/components/segmented/Disabled.tsx +28 -0
  49. package/docs/components/segmented.md +38 -0
  50. package/docs/components/select/AllowClear.tsx +18 -0
  51. package/docs/components/select/Base.tsx +17 -0
  52. package/docs/components/select.md +35 -0
  53. package/docs/components/switch/Base.tsx +14 -0
  54. package/docs/components/switch.md +26 -0
  55. package/docs/components/{Table.tsx → table/Base.tsx} +2 -2
  56. package/docs/components/table.md +12 -6
  57. package/docs/components/tabs/Base.tsx +25 -0
  58. package/docs/components/tabs/Segment.tsx +25 -0
  59. package/docs/components/tabs.md +33 -0
  60. package/docs/components/tooltip/Base.tsx +12 -0
  61. package/docs/components/tooltip/Placement.tsx +90 -0
  62. package/docs/components/tooltip.md +32 -0
  63. package/docs/components/tree/Base.tsx +45 -0
  64. package/docs/components/tree.md +26 -0
  65. package/global.d.ts +9 -0
  66. package/package.json +29 -14
  67. package/patches/vitepress@1.0.0-rc.4.patch +60 -0
  68. package/rollup.config.js +60 -20
  69. package/scripts/annotationNonProductionCode.js +30 -0
  70. package/scripts/cancelAnnotationNonProductionCode.js +30 -0
  71. package/src/Button.tsx +51 -12
  72. package/src/Collapse/index.tsx +86 -0
  73. package/src/ColorPicker.tsx +6 -61
  74. package/src/Compact.tsx +15 -0
  75. package/src/Empty/PRESENTED_IMAGE_SIMPLE.tsx +15 -0
  76. package/src/Empty/assets/EmptySvg.tsx +43 -0
  77. package/src/Empty/assets/SimpleEmptySvg.tsx +16 -0
  78. package/src/Empty/index.tsx +20 -0
  79. package/src/Input.tsx +154 -62
  80. package/src/InputNumber.tsx +68 -62
  81. package/src/Modal.tsx +90 -62
  82. package/src/Popconfirm.tsx +5 -3
  83. package/src/Segmented/index.tsx +95 -0
  84. package/src/Select.tsx +125 -3
  85. package/src/Switch.tsx +1 -1
  86. package/src/Table.tsx +36 -29
  87. package/src/Tabs.tsx +88 -45
  88. package/src/Tooltip.tsx +233 -87
  89. package/src/Tree.tsx +4 -4
  90. package/src/form/Form.tsx +94 -0
  91. package/src/form/FormItem.tsx +139 -0
  92. package/src/form/context.ts +16 -0
  93. package/src/form/index.ts +13 -0
  94. package/src/hooks/createControllableValue.ts +9 -6
  95. package/src/index.ts +12 -5
  96. package/src/types/index.ts +5 -0
  97. package/src/utils/EventEmitter.ts +15 -0
  98. package/src/utils/component.tsx +1 -1
  99. package/src/utils/solid.ts +8 -3
  100. package/src/utils/zh_CN.ts +236 -0
  101. package/tsconfig.json +6 -4
  102. package/unocss.config.ts +90 -6
  103. package/src/Button.css +0 -14
  104. package/src/Form.tsx +0 -98
  105. package/src/index.css +0 -21
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ **/*.cjs
2
+ **/*.d.ts
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx tsc --noEmit && npx lint-staged
@@ -8,6 +8,6 @@
8
8
  },
9
9
  "eslint.format.enable": true,
10
10
  "editor.codeActionsOnSave": {
11
- "source.fixAll.eslint": true
11
+ "source.fixAll.eslint": "explicit"
12
12
  }
13
13
  }
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="ant-[border:1px_solid_rgba(5,5,5,0.06)] ant-rounded-6px">
3
3
  <div class="ant-px-24px ant-py-36px">
4
- <div ref="demoContainer"></div>
4
+ <div ref="app" />
5
5
  </div>
6
6
  <!-- <div class="ant-[border-top:1px_solid_rgba(5,5,5,0.06)] ant-relative ant-px-24px ant-pt-18px ant-pb-12px">
7
7
  <div class="ant-font-bold ant-absolute -ant-translate-y-1/2 ant-left-16px ant-top-0 ant-bg-white ant-px-8px">{{
@@ -26,31 +26,147 @@
26
26
  </template>
27
27
 
28
28
  <script lang="ts" setup>
29
- import { type Component } from 'solid-js'
30
- import { render, createComponent } from 'solid-js/web'
31
29
  import { onMounted, ref } from 'vue'
32
30
  import Prism from 'prismjs'
31
+ // @ts-ignore
32
+ import antdCss from 'antd-solid-dist/index.css?raw'
33
+ // @ts-ignore
34
+ import antdRaw from 'antd-solid-dist/index.umd.js?raw'
33
35
  import 'prismjs/themes/prism.css'
34
36
  import 'prismjs/components/prism-typescript'
37
+ import { nanoid } from 'nanoid'
35
38
 
36
39
  interface Props {
37
- component: Component
38
- code: string
39
- // title?: string
40
- // description?: string
40
+ path: string
41
41
  }
42
42
  const props = defineProps<Props>()
43
43
 
44
- let demoContainer = ref<HTMLDivElement>()
45
-
46
44
  let expand = ref(false)
47
45
 
48
46
  let codeHtml = ref('')
47
+ let code = ref('')
48
+
49
+ let app = ref<HTMLDivElement>()
50
+
51
+ // @ts-ignore
52
+ const codeModules = import.meta.glob('../../components/*/**.tsx', { as: 'raw' })
49
53
 
50
54
  onMounted(() => {
51
- render(() => createComponent(props.component, {}), demoContainer.value!)
55
+ codeModules[`../../components/${props.path}.tsx`]().then(value => {
56
+ codeHtml.value = Prism.highlight(value, Prism.languages.typescript, 'typescript')
57
+ code.value = value
58
+
59
+ // 以下的代码在生产环境下会被注释掉
60
+ // Non-production code start
61
+ // @ts-ignore
62
+ if (import.meta.env.MODE !== 'production') {
63
+ // @ts-ignore
64
+ const modules = import.meta.glob('../../components/*/**.tsx')
65
+ modules[`../../components/${props.path}.tsx`]().then(module => {
66
+ const App = module.default
67
+ import('solid-js/web').then(({ render, createComponent }) => {
68
+ render(() => createComponent(App, {}), app.value!)
69
+ })
70
+ })
71
+ return
72
+ }
73
+ // Non-production code end
74
+
75
+ // @ts-ignore
76
+ if (!window.babelLoadPromise) {
77
+ // @ts-ignore
78
+ window.babelLoadPromise = new Promise(resolve => {
79
+ const style = document.createElement('style')
80
+ style.innerHTML = antdCss
81
+ document.head.append(style)
82
+
83
+ const script = document.createElement('script')
84
+ script.src = 'https://unpkg.com/@babel/standalone@7.21.2/babel.min.js'
85
+ document.head.append(script)
86
+ script.onload = () => {
87
+ const script = document.createElement('script')
88
+ script.type = 'module'
89
+ // @ts-ignore
90
+ window.__resolve__ = resolve
91
+ script.innerHTML = `
92
+ import babelPresetSolid from 'https://cdn.jsdelivr.net/npm/babel-preset-solid@1.8.4/+esm';
93
+ import * as SolidJs from "https://jspm.dev/solid-js";
94
+ import * as SolidJsWeb from "https://jspm.dev/solid-js/web";
95
+ import React from "https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";
96
+ import ReactDOM from "https://cdn.jsdelivr.net/npm/react-dom@18.2.0/+esm";
97
+ import * as Nanoid from "https://cdn.jsdelivr.net/npm/nanoid@5.0.2/+esm";
98
+ import * as Antd from "https://cdn.jsdelivr.net/npm/antd@5.10.2/+esm";
99
+ import Classnames from "https://cdn.jsdelivr.net/npm/classnames@2.3.2/+esm";
100
+ import Lodash from "https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm";
101
+ import * as Yup from "https://cdn.jsdelivr.net/npm/yup@1.3.2/+esm";
102
+
103
+ Babel.registerPreset("solid", babelPresetSolid());
104
+
105
+ window.SolidJs = SolidJs;
106
+ window.SolidJsWeb = SolidJsWeb;
107
+ window.React = React;
108
+ window.ReactDOM = ReactDOM;
109
+ window.Nanoid = Nanoid;
110
+ window.Antd = Antd;
111
+ window.Classnames = Classnames;
112
+ window.Lodash = Lodash;
113
+ window.Yup = Yup;
114
+
115
+ ${antdRaw}
116
+
117
+ // babel 转化后的代码依赖于 require
118
+ function require(name) {
119
+ const libMap = {
120
+ 'solid-js': SolidJs,
121
+ 'solid-js/web': SolidJsWeb,
122
+ 'antd-solid': AntdSolid,
123
+ yup: Yup,
124
+ lodash: Lodash,
125
+ nanoid: Nanoid,
126
+ classnames: Classnames,
127
+ react: React,
128
+ 'react-dom': ReactDOM,
129
+ }
130
+ return libMap[name]
131
+ }
132
+ window.require = require;
133
+
134
+ window.__resolve__();
135
+ delete window.__resolve__;
136
+ `
137
+ document.head.append(script)
138
+ }
139
+ })
140
+ }
141
+
142
+ // @ts-ignore
143
+ window.babelLoadPromise.then(() => {
144
+ const appRef = nanoid()
145
+ // @ts-ignore
146
+ window[appRef] = app.value
147
+
148
+ let _code = `
149
+ // import { render } from 'solid-js/web';
150
+ ${code.value}
151
+ const App = exports["default"];
152
+ window.SolidJsWeb.render(() => <App />, window['${appRef}']);
153
+ `
154
+
155
+ // @ts-ignore
156
+ _code = window.Babel.transform(_code, {
157
+ presets: [
158
+ ['typescript', { isTSX: true, allExtensions: true }],
159
+ 'env',
160
+ 'solid'
161
+ ],
162
+ filename: 'app.ts',
163
+ }).code;
52
164
 
53
- codeHtml.value = Prism.highlight(props.code, Prism.languages.typescript, 'typescript')
165
+ // @ts-ignore
166
+ window.exports = {}
167
+ eval(_code)
168
+ })
169
+ })
54
170
  })
55
171
 
56
172
  function onCopy(text: string) {
@@ -8,6 +8,7 @@ export default defineConfig({
8
8
  description: "UI 库",
9
9
  cleanUrls: true,
10
10
  head: [['link', { rel: 'shortcut icon', href: 'https://gw.alipayobjects.com/zos/rmsportal/rlpTLlbMzTNYuZGGCVYM.png' }]],
11
+ appearance: false,
11
12
  themeConfig: {
12
13
  logo: 'https://gw.alipayobjects.com/zos/rmsportal/rlpTLlbMzTNYuZGGCVYM.png',
13
14
  nav: [
@@ -16,15 +17,50 @@ export default defineConfig({
16
17
  ],
17
18
  sidebar: [
18
19
  {
19
- text: '通用组件',
20
+ text: '通用',
20
21
  items: [
21
22
  { text: 'Button 按钮', link: '/components/button' },
22
23
  ]
23
24
  },
25
+ {
26
+ text: '布局',
27
+ items: [
28
+ { text: 'Compact 压缩', link: '/components/compact' },
29
+ ]
30
+ },
31
+ {
32
+ text: '数据录入',
33
+ items: [
34
+ { text: 'ColorPicker 颜色选择器', link: '/components/color-picker' },
35
+ { text: 'DatePicker 日期选择框', link: '/components/date-picker' },
36
+ { text: 'Input 输入框', link: '/components/input' },
37
+ { text: 'InputNumber 数字输入框', link: '/components/input-number' },
38
+ { text: 'Radio 单选框', link: '/components/radio' },
39
+ { text: 'Form 表单', link: '/components/form' },
40
+ { text: 'Select 选择器', link: '/components/select' },
41
+ { text: 'Switch 开关', link: '/components/switch' },
42
+ ]
43
+ },
24
44
  {
25
45
  text: '数据展示',
26
46
  items: [
47
+ { text: 'Collapse 折叠面板', link: '/components/collapse' },
48
+ { text: 'Empty 空状态', link: '/components/empty' },
49
+ { text: 'Image 图片', link: '/components/image' },
50
+ { text: 'Popover 气泡卡片', link: '/components/popover' },
51
+ { text: 'Segmented 分段控制器', link: '/components/segmented' },
27
52
  { text: 'Table 表格', link: '/components/table' },
53
+ { text: 'Tabs 标签页', link: '/components/tabs' },
54
+ { text: 'Tooltip 文字提示', link: '/components/tooltip' },
55
+ { text: 'Tree 树形控件', link: '/components/tree' },
56
+ ]
57
+ },
58
+ {
59
+ text: '反馈',
60
+ items: [
61
+ { text: 'Modal 对话框', link: '/components/modal' },
62
+ { text: 'Popconfirm 气泡确认框', link: '/components/popconfirm' },
63
+ { text: 'Progress 进度条', link: '/components/progress' },
28
64
  ]
29
65
  },
30
66
  ],
@@ -38,7 +74,9 @@ export default defineConfig({
38
74
  vite: {
39
75
  resolve: {
40
76
  alias: {
77
+ '@': path.resolve(__dirname, '../../docs'),
41
78
  'antd-solid': path.resolve(__dirname, '../../src'),
79
+ 'antd-solid-dist': path.resolve(__dirname, '../../dist'),
42
80
  },
43
81
  },
44
82
  plugins: [
@@ -12,4 +12,8 @@
12
12
  #1184ff 60%
13
13
  );
14
14
  --vp-home-hero-image-filter: blur(40px);
15
+ }
16
+
17
+ body {
18
+ font-size: 14px;
15
19
  }
@@ -1,6 +1,5 @@
1
1
  import 'uno.css'
2
2
  import DefaultTheme from 'vitepress/theme'
3
- import 'antd-solid/index.css'
4
3
  import './index.css'
5
4
  import Code from '../components/Code.vue'
6
5
 
@@ -11,6 +11,7 @@ const Index: Component = () => {
11
11
  >
12
12
  <Button type="primary">Primary Button</Button>
13
13
  <Button>Default Button</Button>
14
+ <Button type="dashed">Dashed Button</Button>
14
15
  <Button type="text">Text Button</Button>
15
16
  <Button type="link">Link Button</Button>
16
17
  </div>
@@ -0,0 +1,21 @@
1
+ import { type Component } from 'solid-js'
2
+ import { Button } from 'antd-solid'
3
+
4
+ const Index: Component = () => {
5
+ return (
6
+ <div
7
+ style={{
8
+ display: 'flex',
9
+ gap: '8px',
10
+ }}
11
+ >
12
+ <Button type="primary" danger>Primary Button</Button>
13
+ <Button danger>Default Button</Button>
14
+ <Button type="dashed" danger>Dashed Button</Button>
15
+ <Button type="text" danger>Text Button</Button>
16
+ <Button type="link" danger>Link Button</Button>
17
+ </div>
18
+ )
19
+ }
20
+
21
+ export default Index
@@ -8,16 +8,28 @@ outline: deep
8
8
 
9
9
  ## 代码演示
10
10
 
11
-
12
11
  ### 按钮类型
13
12
 
14
13
  按钮有五种类型:主按钮、次按钮、虚线按钮、文本按钮和链接按钮。主按钮在同一个操作区域最多出现一次。
15
14
 
16
- <!-- The following frontmatter options are only applicable when using the default theme. -->
15
+ <Code path="button/Base" />
16
+
17
+ ### 危险按钮
18
+
19
+ 在 4.0 之后,危险成为一种按钮属性而不是按钮类型。
20
+
21
+ <Code path="button/Danger" />
22
+
23
+ ## API
24
+
25
+ ### Button
26
+
27
+ <div class="vp-table">
17
28
 
18
- <script lang="ts" setup>
19
- import component from './Button.tsx'
20
- import code from './Button.tsx?raw'
21
- </script>
29
+ | 参数 | 说明 | 类型 | 默认值
30
+ | ----------- | ----------- | ----------- | ----------- |
31
+ | allowClear | 支持清除 | boolean | false |
32
+ | options | 数据化配置选项内容,相比 jsx 定义会获得更好的渲染性能 | { label, value }[] | - |
33
+ | placeholder | 选择框默认文本 | string | - |
22
34
 
23
- <Code :component="component" :code="code" />
35
+ </div>
@@ -0,0 +1,25 @@
1
+ import { type Component } from 'solid-js'
2
+ import { Collapse } from 'antd-solid'
3
+
4
+ const Index: Component = () => {
5
+ const items = [
6
+ {
7
+ key: '1',
8
+ label: 'Tab 1',
9
+ children: 'Content of Tab Pane 1',
10
+ },
11
+ {
12
+ key: '2',
13
+ label: 'Tab 2',
14
+ children: 'Content of Tab Pane 2',
15
+ },
16
+ {
17
+ key: '3',
18
+ label: 'Tab 3',
19
+ children: 'Content of Tab Pane 3',
20
+ },
21
+ ]
22
+ return <Collapse items={items} />
23
+ }
24
+
25
+ export default Index
@@ -0,0 +1,26 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # Collapse 折叠面板 {#title}
6
+
7
+ 可以折叠/展开的内容区域。
8
+
9
+ ## 代码演示
10
+
11
+ ### 折叠面板
12
+
13
+ 可以同时展开多个面板,这个例子默认展开了第一个。
14
+
15
+ <Code path="collapse/Base" />
16
+
17
+ ## API
18
+
19
+ ### Collapse
20
+
21
+ <div class="vp-table">
22
+
23
+ | 参数 | 说明 | 类型 | 默认值
24
+ | ----------- | ----------- | ----------- | ----------- |
25
+
26
+ </div>
@@ -0,0 +1,14 @@
1
+ import { type Component } from 'solid-js'
2
+ import { ColorPicker } from 'antd-solid'
3
+
4
+ const Base: Component = () => {
5
+ return (
6
+ <ColorPicker
7
+ onChange={(value, hex) => {
8
+ console.log('onChange', value, hex)
9
+ }}
10
+ />
11
+ )
12
+ }
13
+
14
+ export default Base
@@ -0,0 +1,26 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # ColorPicker 颜色选择器 {#title}
6
+
7
+ 提供颜色选取的组件。
8
+
9
+ ## 代码演示
10
+
11
+ ### 基本用法
12
+
13
+ 最简单的使用方法。
14
+
15
+ <Code path="color-picker/Base" />
16
+
17
+ ## API
18
+
19
+ ### InputNumber
20
+
21
+ <div class="vp-table">
22
+
23
+ | 参数 | 说明 | 类型 | 默认值
24
+ | ----------- | ----------- | ----------- | ----------- |
25
+
26
+ </div>
@@ -0,0 +1,27 @@
1
+ import { type Component } from 'solid-js'
2
+ import { Compact, Input, InputNumber } from 'antd-solid'
3
+
4
+ const Index: Component = () => {
5
+ return (
6
+ <div style={{
7
+ display: 'grid',
8
+ gap: '8px',
9
+ }}>
10
+ <Compact>
11
+ <Input style={{ width: '20%' }} />
12
+ <InputNumber style={{ width: '30%' }} />
13
+ <Input style={{ width: '20%' }} />
14
+ </Compact>
15
+ <Compact>
16
+ <Input style={{ width: '50%' }} prefix="$" suffix=".00" />
17
+ <Input style={{ width: '50%' }} prefix="$" suffix=".00" />
18
+ </Compact>
19
+ <Compact>
20
+ <Input style={{ width: '50%' }} addonBefore="$" addonAfter=".00" />
21
+ <Input style={{ width: '50%' }} addonBefore="$" addonAfter=".00" />
22
+ </Compact>
23
+ </div>
24
+ )
25
+ }
26
+
27
+ export default Index
@@ -0,0 +1,26 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # Compact 压缩 {#title}
6
+
7
+ 需要表单组件之间紧凑连接且合并边框时,使用 Compact。
8
+
9
+ ## 代码演示
10
+
11
+ ### 基本
12
+
13
+ 使用 Compact 让表单组件之间紧凑连接且合并边框。
14
+
15
+ <Code path="compact/Base" />
16
+
17
+ ## API
18
+
19
+ ### Compact
20
+
21
+ <div class="vp-table">
22
+
23
+ | 参数 | 说明 | 类型 | 默认值
24
+ | ----------- | ----------- | ----------- | ----------- |
25
+
26
+ </div>
@@ -0,0 +1,15 @@
1
+ import { type Component } from 'solid-js'
2
+ import { DatePicker } from 'antd-solid'
3
+
4
+ const Index: Component = () => {
5
+ return (
6
+ <DatePicker
7
+ placeholder="请选择日期"
8
+ onChange={value => {
9
+ console.log('onChange', value)
10
+ }}
11
+ />
12
+ )
13
+ }
14
+
15
+ export default Index
@@ -0,0 +1,26 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # DatePicker 日期选择框 {#title}
6
+
7
+ 输入或选择日期的控件。
8
+
9
+ ## 代码演示
10
+
11
+ ### 基本
12
+
13
+ 最简单的用法,在浮层中可以选择或者输入日期。
14
+
15
+ <Code path="date-picker/Base" />
16
+
17
+ ## API
18
+
19
+ ### DatePicker
20
+
21
+ <div class="vp-table">
22
+
23
+ | 参数 | 说明 | 类型 | 默认值
24
+ | ----------- | ----------- | ----------- | ----------- |
25
+
26
+ </div>
@@ -0,0 +1,8 @@
1
+ import { type Component } from 'solid-js'
2
+ import { Empty } from 'antd-solid'
3
+
4
+ const App: Component = () => {
5
+ return <Empty />
6
+ }
7
+
8
+ export default App
@@ -0,0 +1,8 @@
1
+ import { type Component } from 'solid-js'
2
+ import { Empty } from 'antd-solid'
3
+
4
+ const App: Component = () => {
5
+ return <Empty.PRESENTED_IMAGE_SIMPLE />
6
+ }
7
+
8
+ export default App
@@ -0,0 +1,32 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # Empty 空状态 {#title}
6
+
7
+ 空状态时的展示占位图。
8
+
9
+ ## 代码演示
10
+
11
+ ### 基本
12
+
13
+ 简单的展示。
14
+
15
+ <Code path="empty/Base" />
16
+
17
+ ### 选择图片
18
+
19
+ 可以通过设置 `image` 为 `Empty.PRESENTED_IMAGE_SIMPLE` 选择另一种风格的图片。
20
+
21
+ <Code path="empty/PRESENTED_IMAGE_SIMPLE" />
22
+
23
+ ## API
24
+
25
+ ### Empty
26
+
27
+ <div class="vp-table">
28
+
29
+ | 参数 | 说明 | 类型 | 默认值
30
+ | ----------- | ----------- | ----------- | ----------- |
31
+
32
+ </div>
@@ -0,0 +1,63 @@
1
+ import { type Component } from 'solid-js'
2
+ import { Button, Form, type FormInstance, Input } from 'antd-solid'
3
+ import { string } from 'yup'
4
+
5
+ const Base: Component = () => {
6
+ let ref: FormInstance
7
+
8
+ return (
9
+ <Form ref={ref!}>
10
+ <Form.Item
11
+ label="Username"
12
+ name="username"
13
+ component={props => (
14
+ <Input
15
+ {...props}
16
+ onChange={e => {
17
+ props.onChange?.(e.target.value)
18
+ }}
19
+ />
20
+ )}
21
+ required
22
+ rules={[string().required('Please input your username!')]}
23
+ />
24
+ <Form.Item
25
+ label="Password"
26
+ name="password"
27
+ component={props => (
28
+ <Input
29
+ {...props}
30
+ type="password"
31
+ onChange={e => {
32
+ props.onChange?.(e.target.value)
33
+ }}
34
+ />
35
+ )}
36
+ required
37
+ rules={[string().required('Please input your password!')]}
38
+ />
39
+ <Form.Item
40
+ component={() => (
41
+ <Button
42
+ type="primary"
43
+ // eslint-disable-next-line solid/reactivity
44
+ onClick={() => {
45
+ ref
46
+ .validateFields()
47
+ .then(resp => {
48
+ console.log('resp', resp)
49
+ })
50
+ .catch(err => {
51
+ console.log('catch', err)
52
+ })
53
+ }}
54
+ >
55
+ 提交
56
+ </Button>
57
+ )}
58
+ />
59
+ </Form>
60
+ )
61
+ }
62
+
63
+ export default Base
@@ -0,0 +1,27 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # Form 表单 {#title}
6
+
7
+ 高性能表单控件,自带数据域管理。包含数据录入、校验以及对应样式。
8
+
9
+ ## 代码演示
10
+
11
+ ### 基本用法
12
+
13
+ 基本的表单数据域控制展示,包含布局、初始化、验证、提交。
14
+
15
+ <Code path="form/Base" />
16
+
17
+ ## API
18
+
19
+ ### Form
20
+
21
+ <div class="vp-table">
22
+
23
+ | 参数 | 说明 | 类型 | 默认值
24
+ | ----------- | ----------- | ----------- | ----------- |
25
+ | layout | 表单布局 | `horizontal` \| `vertical` \| `inline` | `horizontal` |
26
+
27
+ </div>