@wzyjs/uis 0.3.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.
Files changed (55) hide show
  1. package/package.json +49 -0
  2. package/src/antd/form/CheckboxButton/index.module.scss +24 -0
  3. package/src/antd/form/CheckboxButton/index.tsx +31 -0
  4. package/src/antd/form/RadioButton/index.tsx +30 -0
  5. package/src/antd/form/Upload/index.tsx +65 -0
  6. package/src/antd/form/UploadImage/index.tsx +338 -0
  7. package/src/antd/form/index.ts +5 -0
  8. package/src/antd/index.ts +43 -0
  9. package/src/antd/pro/Alert/index.tsx +24 -0
  10. package/src/antd/pro/Button/components/Confirm.tsx +24 -0
  11. package/src/antd/pro/Button/components/Copy.tsx +46 -0
  12. package/src/antd/pro/Button/components/Drawer.tsx +37 -0
  13. package/src/antd/pro/Button/components/Group.tsx +26 -0
  14. package/src/antd/pro/Button/index.tsx +11 -0
  15. package/src/antd/pro/Card/index.tsx +92 -0
  16. package/src/antd/pro/Collapse/components/Item.tsx +30 -0
  17. package/src/antd/pro/Collapse/index.tsx +27 -0
  18. package/src/antd/pro/Image/index.tsx +17 -0
  19. package/src/antd/pro/Input/components/Range.tsx +46 -0
  20. package/src/antd/pro/Input/index.tsx +61 -0
  21. package/src/antd/pro/Popconfirm/index.tsx +16 -0
  22. package/src/antd/pro/Radio/components/Cancel.tsx +30 -0
  23. package/src/antd/pro/Radio/index.tsx +7 -0
  24. package/src/antd/pro/Space/index.tsx +15 -0
  25. package/src/antd/pro/Typography/components/String.tsx +72 -0
  26. package/src/antd/pro/Typography/index.tsx +9 -0
  27. package/src/antd/pro/index.ts +10 -0
  28. package/src/components/BottomBar/index.tsx +28 -0
  29. package/src/components/CodeView/index.tsx +85 -0
  30. package/src/components/Collapse/index.tsx +26 -0
  31. package/src/components/Com2Canvas/index.tsx +60 -0
  32. package/src/components/CompileHtml/index.tsx +26 -0
  33. package/src/components/DateSwitcher/index.module.scss +10 -0
  34. package/src/components/DateSwitcher/index.tsx +75 -0
  35. package/src/components/DownloadLink/index.tsx +36 -0
  36. package/src/components/DragSort/index.tsx +77 -0
  37. package/src/components/DynamicSelect/index.tsx +77 -0
  38. package/src/components/DynamicSelect/utils.ts +47 -0
  39. package/src/components/EnumTag/index.tsx +24 -0
  40. package/src/components/FetchSelect/index.tsx +57 -0
  41. package/src/components/Fold/index.tsx +52 -0
  42. package/src/components/FormPro/index.tsx +28 -0
  43. package/src/components/GroupLayout/index.tsx +45 -0
  44. package/src/components/HtmlPro/index.tsx +18 -0
  45. package/src/components/IframePro/index.tsx +52 -0
  46. package/src/components/JsonRenderer/index.tsx +115 -0
  47. package/src/components/JsonView/index.tsx +21 -0
  48. package/src/components/Markdown/index.tsx +152 -0
  49. package/src/components/Markdown/style.ts +106 -0
  50. package/src/components/MultiImageDisplay/index.tsx +63 -0
  51. package/src/components/SectorButton/index.tsx +247 -0
  52. package/src/components/TextInput/index.tsx +61 -0
  53. package/src/components/Video/index.tsx +37 -0
  54. package/src/components/index.ts +22 -0
  55. package/src/web.ts +2 -0
@@ -0,0 +1,61 @@
1
+ 'use client'
2
+
3
+ import React, { useState } from 'react'
4
+
5
+ import { Input } from 'antd'
6
+ import { useBoolean } from '@wzyjs/hooks/web'
7
+
8
+ interface TextInputProps {
9
+ value: string
10
+ onChange?: (value: string) => void
11
+ }
12
+
13
+ export const TextInput = (props: TextInputProps) => {
14
+ const { value, onChange } = props
15
+
16
+ const [text, setText] = useState(value)
17
+
18
+ const [isEditing, { setTrue, setFalse }] = useBoolean(false)
19
+
20
+ const onSubmit = () => {
21
+ if (!text.trim()) {
22
+ return
23
+ }
24
+
25
+ if (text === value) {
26
+ setFalse()
27
+ return
28
+ }
29
+
30
+ onChange?.(text.trim())
31
+ setFalse()
32
+ }
33
+
34
+ const onBlur = () => {
35
+ onSubmit()
36
+ }
37
+
38
+ const onKeyDown = (e: React.KeyboardEvent) => {
39
+ if (e.key === 'Enter') {
40
+ onSubmit()
41
+ }
42
+ }
43
+
44
+ return (
45
+ <div onDoubleClick={setTrue}>
46
+ {!isEditing ? (
47
+ <span>{text}</span>
48
+ ) : (
49
+ <Input
50
+ value={text}
51
+ onChange={ev => setText(ev.target.value)}
52
+ onBlur={onBlur}
53
+ onKeyDown={onKeyDown}
54
+ autoFocus
55
+ size='small'
56
+ style={{ width: 200 }}
57
+ />
58
+ )}
59
+ </div>
60
+ )
61
+ }
@@ -0,0 +1,37 @@
1
+ 'use client'
2
+
3
+ import React, { CSSProperties, useRef } from 'react'
4
+
5
+ interface VideoProps {
6
+ url: string,
7
+ width?: number,
8
+ height?: number,
9
+ style?: CSSProperties
10
+ }
11
+
12
+ export const Video = (props: VideoProps) => {
13
+ const { url, width = 175, height = 310, style } = props
14
+
15
+ const videoRef = useRef<HTMLVideoElement>(null)
16
+
17
+ if (!url) {
18
+ return null
19
+ }
20
+
21
+ return (
22
+ <video
23
+ ref={videoRef}
24
+ width={width}
25
+ height={height}
26
+ style={style}
27
+ onMouseEnter={() => {
28
+ videoRef.current?.play()
29
+ }}
30
+ onMouseLeave={() => {
31
+ videoRef.current?.pause()
32
+ }}
33
+ >
34
+ <source src={url} type='video/mp4' />
35
+ </video>
36
+ )
37
+ }
@@ -0,0 +1,22 @@
1
+ export * from './CodeView'
2
+ export * from './HtmlPro'
3
+ export * from './IframePro'
4
+ export * from './FormPro'
5
+ export * from './Com2Canvas'
6
+ export * from './Video'
7
+ export * from './MultiImageDisplay'
8
+ export * from './DownloadLink'
9
+ export * from './Fold'
10
+ export * from './DragSort'
11
+ export * from './DateSwitcher'
12
+ export * from './GroupLayout'
13
+ export * from './TextInput'
14
+ export * from './SectorButton'
15
+ export * from './Markdown'
16
+ export * from './DynamicSelect'
17
+ export * from './JsonRenderer'
18
+ export * from './EnumTag'
19
+
20
+ // export * from './JsonView'
21
+
22
+ export { default as ReactEchart } from 'echarts-for-react'
package/src/web.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './antd'
2
+ export * from './components'