lu-lowcode-package-form 0.8.1 → 0.8.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.
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.relative{position:relative}.mb-5{margin-bottom:1.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.mr-2{margin-right:.5rem}.box-border{box-sizing:border-box}.flex{display:flex}.h-11{height:2.75rem}.h-8{height:2rem}.h-full{height:100%}.min-h-5{min-height:1.25rem}.w-\[960px\]{width:960px}.w-full{width:100%}.flex-col{flex-direction:column}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.overflow-auto{overflow:auto}.rounded{border-radius:.25rem}.border-b{border-bottom-width:1px}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.p-6{padding:1.5rem}.pb-10{padding-bottom:2.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.text-\[\#1890ff\]{--tw-text-opacity: 1;color:rgb(24 144 255 / var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:text-\[\#1890ff\]:hover{--tw-text-opacity: 1;color:rgb(24 144 255 / var(--tw-text-opacity))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}
1
+ *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.frelative{position:relative}.fflex{display:flex}.fh-11{height:2.75rem}.fh-8{height:2rem}.fh-full{height:100%}.fmin-h-5{min-height:1.25rem}.fw-\[960px\]{width:960px}.fw-full{width:100%}.fflex-col{flex-direction:column}.fitems-center{align-items:center}.fitems-stretch{align-items:stretch}.fjustify-between{justify-content:space-between}.frounded{border-radius:.25rem}.fbg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.fp-4{padding:1rem}.fp-6{padding:1.5rem}.fpb-10{padding-bottom:2.5rem}.ftext-sm{font-size:.875rem;line-height:1.25rem}.ftext-xs{font-size:.75rem;line-height:1rem}.ftext-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@testing-library/jest-dom": "^5.17.0",
7
7
  "@testing-library/react": "^13.4.0",
8
8
  "@testing-library/user-event": "^13.5.0",
9
9
  "antd": "^5.13.2",
10
+ "dayjs": "^1.11.11",
11
+ "postcss-modules": "^6.0.0",
10
12
  "web-vitals": "^2.1.4"
11
13
  },
12
14
  "main": "dist/index.cjs.js",
@@ -50,6 +52,7 @@
50
52
  "autoprefixer": "^10.4.19",
51
53
  "babel-loader": "^9.1.3",
52
54
  "postcss": "^8.4.38",
55
+ "postcss-prefixer": "^3.0.0",
53
56
  "react": "^18.2.0",
54
57
  "react-dom": "^18.2.0",
55
58
  "react-scripts": "5.0.1",
package/postcss.config.js CHANGED
@@ -1,6 +1,8 @@
1
+ // postcss.config.js
1
2
  module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- }
6
- }
3
+ plugins: [
4
+ require('tailwindcss'),
5
+ require('autoprefixer'),
6
+ // 其他的 PostCSS 插件
7
+ ]
8
+ };
package/src/App.jsx CHANGED
@@ -1,22 +1,22 @@
1
- import { FormContainer, Field,FormContainerWrapper , Layout } from './components';
1
+ import { FormContainer, Field, FormContainerWrapper, Layout, Setter } from './components';
2
2
  import './App.css';
3
3
  import { Button } from 'antd';
4
4
  import React from 'react';
5
5
 
6
6
  const treeData = [
7
- {
8
- title: '0-1',
9
- key: '0-1',
10
- children: [
11
- { title: '0-1-0-0', key: '0-1-0-0' },
12
- { title: '0-1-0-1', key: '0-1-0-1' },
13
- { title: '0-1-0-2', key: '0-1-0-2' },
14
- ],
15
- },
16
- {
17
- title: '0-2',
18
- key: '0-2',
19
- },
7
+ {
8
+ title: '0-1',
9
+ key: '0-1',
10
+ children: [
11
+ { title: '0-1-0-0', key: '0-1-0-0' },
12
+ { title: '0-1-0-1', key: '0-1-0-1' },
13
+ { title: '0-1-0-2', key: '0-1-0-2' },
14
+ ],
15
+ },
16
+ {
17
+ title: '0-2',
18
+ key: '0-2',
19
+ },
20
20
  ];
21
21
 
22
22
  function App() {
@@ -24,14 +24,18 @@ function App() {
24
24
  const [cols, setCols] = React.useState(1);
25
25
 
26
26
  const getFormFields = () => {
27
- console.log("formRef?.current",formRef)
27
+ console.log("formRef?.current", formRef)
28
28
  const formData = formRef?.current?.formRef?.getFieldsValue();
29
- console.log("formData",formData);
29
+ console.log("formData", formData);
30
30
  }
31
31
  const setFormFields = () => {
32
32
  formRef?.current?.formRef?.setFieldsValue({
33
- remark11:"{\"label\": \"解决方案部1112\", \"value\": 11}",
34
- remark12:"[{\"label\": \"水电费\", \"value\": 2}]",
33
+ datetime: "2021-12-12",
34
+ datetime2: "2021-12-12",
35
+ datetime3: "2021-12-12",
36
+ datetime4: "2021-12-12",
37
+ remark11: "{\"label\": \"解决方案部1112\", \"value\": 11}",
38
+ remark12: "[{\"label\": \"水电费\", \"value\": 2}]",
35
39
  })
36
40
  }
37
41
  const handleCols = () => {
@@ -39,25 +43,44 @@ function App() {
39
43
  }
40
44
  return (
41
45
 
42
- <div className="App flex flex-col items-center">
43
- <div className='w-[960px] rounded bg-slate-100 flex flex-col items-center pb-10'>
46
+ <div className="App fflex fflex-col fitems-center">
47
+
48
+ <div className='fw-full fp-4'>
49
+ <Setter.OptionSetter />
50
+ </div>
51
+ <div className='fw-[960px] frounded fbg-slate-100 fflex fflex-col fitems-center fpb-10'>
44
52
  <FormContainerWrapper cols={cols} className="" ref={formRef} >
45
53
  <Field.Input label="分组名" __id="title" />
46
54
  <Field.TreeSelect label="分组名" __id="title11"></Field.TreeSelect>
55
+ <Field.Switch label="开关" __id="switch"></Field.Switch>
47
56
  <Field.CodeMachine label="角色编号" prompt="" __id="code" />
57
+ <Field.DatePicker label="日期时间" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
58
+ <Field.DatePicker label="日期时间" prompt="" datetype="date" value='2022-10-22' __id="datetime2" />
59
+ <Field.DatePicker label="日期时间" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
60
+ <Field.DatePicker label="年" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
48
61
  <Field.Input label="角色名称" __id="name" />
49
62
  <Layout.FormRow _componentName="Layout.FormRow" layout={'1,1,1'}>
50
63
  <Field.Input label="角色名称布局" __id="name1" />
51
64
  <Field.Input label="角色名称布局2" __id="name2" />
52
65
  <Field.Input label="角色名称布局3" __id="name3" />
53
- </Layout.FormRow>
66
+ </Layout.FormRow>
54
67
  <Field.CheckboxTree label="角色权限" __id="permissions" addRoot={false} treeData={treeData} />
55
- <Layout.FormGroupTitle _componentName="Layout.FormGroupTitle" title={"关联信息"}/>
68
+ <Layout.FormGroupTitle _componentName="Layout.FormGroupTitle" title={"关联信息"} />
56
69
  <Field.WithSingleSelect label="测试关联单选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark11" />
57
70
  <Field.WithMultipleSelect label="测试关联多选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark12" />
58
71
  <Layout.FormRow _componentName="Layout.FormRow"> <Field.TextArea label="备注" __id="remark" /></Layout.FormRow>
59
-
72
+
73
+ <Layout.FormRow _componentName="Layout.FormRow" layout={'1'}>
74
+ <Field.RadioGroup _componentName="Field.RadioGroup" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="单选框" __id="radio" ></Field.RadioGroup>
75
+ </Layout.FormRow>
76
+ <Layout.FormRow _componentName="Layout.FormRow" layout={'1'}>
77
+ <Field.CheckboxGroup _componentName="Field.CheckboxGroup" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="多选框" __id="CheckboxGroup" ></Field.CheckboxGroup>
78
+ </Layout.FormRow>
79
+ <Field.UploadFile _componentName="Field.UploadFile" label="上传文件" __id="UploadFile" ></Field.UploadFile>
80
+ <Field.UploadImage _componentName="Field.UploadImage" label="上传图片" __id="UploadImage" ></Field.UploadImage>
81
+
60
82
  </FormContainerWrapper>
83
+
61
84
  <Button type="primary" onClick={getFormFields}>GetValues</Button>
62
85
  <Button type="primary" onClick={setFormFields}>SetValues</Button>
63
86
  <Button type="primary" onClick={handleCols}>UpdateCol</Button>
@@ -69,4 +92,4 @@ function App() {
69
92
 
70
93
  export default App;
71
94
 
72
- export {FormContainer, Field ,FormContainerWrapper} from './components'
95
+ export { FormContainer, Field, FormContainerWrapper } from './components'
@@ -5,12 +5,12 @@ export const BaseWrapper = function BaseWrapper({
5
5
  ...otherProps
6
6
  }) {
7
7
  return (
8
- <div className="relative">
9
- {label && <div className='h-8 text-sm flex justify-between items-center'>{label}</div>}
10
- <div className="w-full flex items-stretch">
8
+ <div className="frelative">
9
+ {label && <div className='fh-8 ftext-sm fflex fjustify-between fitems-center'>{label}</div>}
10
+ <div className="fw-full fflex fitems-stretch">
11
11
  {children}
12
12
  </div>
13
- <div className="text-xs text-gray-500 min-h-5 flex items-center">{prompt}</div>
13
+ <div className="ftext-xs ftext-gray-500 fmin-h-5 fflex fitems-center">{prompt}</div>
14
14
  </div>
15
15
  );
16
16
  };
@@ -11,4 +11,13 @@ export const Checkbox = (props) =>{
11
11
  );
12
12
  }
13
13
 
14
+ export const CheckboxGroup = (props) => {
15
+ return (
16
+ <BaseWrapper {...props}>
17
+ <OriginalCheckbox.Group {...props} />
18
+ </BaseWrapper>
19
+ );
20
+ }
21
+
22
+
14
23
  export {default as CheckboxTree } from './checkbox-tree.jsx';
@@ -0,0 +1,64 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { DatePicker as OriginalDatePicker, Button } from 'antd';
3
+ import { BaseWrapper } from "../base.jsx"
4
+ import dayjs from 'dayjs';
5
+ const DatePicker = ({ datetype, value, onChange, ...props }) => {
6
+ datetype = datetype || "date"
7
+ const [picker, setPicker] = useState(props?.picker)
8
+ const [format, setFormat] = useState(props?.format)
9
+ const [nValue, setNValue] = useState(null)
10
+ const [showTime, setShowTime] = useState(false)
11
+ const [needConfirm, setNeedConfirm] = useState(false)
12
+ useEffect(() => {
13
+ if (value) {
14
+ const format_date = dayjs(value)
15
+ setNValue(format_date)
16
+ }
17
+ }, [value, format, picker])
18
+
19
+ const handleChange = (value, dateString) => {
20
+ onChange(dateString)
21
+ }
22
+
23
+ useEffect(() => {
24
+ setPicker("date")
25
+ setShowTime(false)
26
+ switch (datetype) {
27
+ case "date":
28
+ setPicker("date")
29
+ setFormat("YYYY-MM-DD")
30
+ setNeedConfirm(false)
31
+ break;
32
+ case "datetime":
33
+ setShowTime(true)
34
+ setPicker("datetime")
35
+ setFormat("YYYY-MM-DD HH:mm:ss")
36
+ setNeedConfirm(true)
37
+ break;
38
+ // case "week":
39
+ // setPicker("week")
40
+ // setNeedConfirm(false)
41
+ // break;
42
+ case "month":
43
+ setPicker("month")
44
+ setNeedConfirm(false)
45
+ break;
46
+ // case "quarter":
47
+ // setPicker("quarter")
48
+ // setNeedConfirm(false)
49
+ // break;
50
+ case "year":
51
+ setPicker("year")
52
+ setNeedConfirm(false)
53
+ break;
54
+ }
55
+ }, [datetype])
56
+ return (
57
+ <BaseWrapper {...props}>
58
+ <OriginalDatePicker {...props} picker={picker} format={format} style={{ width: '100%' }} onChange={handleChange} value={nValue} showTime={showTime} needConfirm={needConfirm} />
59
+ </BaseWrapper>
60
+ );
61
+ }
62
+
63
+ export default DatePicker
64
+
@@ -0,0 +1,18 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Switch as OriginalSwitch } from 'antd';
3
+ import { BaseWrapper } from "../base.jsx"
4
+ const Switch = ({defaultValue ,...props}) => {
5
+ defaultValue = defaultValue || false;
6
+ useEffect(() => {
7
+ props.onChange(defaultValue);
8
+
9
+ }, [defaultValue]);
10
+ return (
11
+ <BaseWrapper {...props}>
12
+ <OriginalSwitch {...props} />
13
+ </BaseWrapper>
14
+ );
15
+ }
16
+
17
+ export default Switch
18
+
@@ -0,0 +1,2 @@
1
+ export {default as UploadFile } from './upload-file'
2
+ export {default as UploadImage } from './upload-image'
@@ -0,0 +1,37 @@
1
+ import { Upload as OriginalUpload, Button } from "antd";
2
+
3
+ import { BaseWrapper } from "../base.jsx"
4
+ import { UploadOutlined } from "@ant-design/icons";
5
+ import React, { useEffect, useState } from "react";
6
+
7
+ const UploadFile = ({value, maxLen,onChange,...props}) => {
8
+ useEffect(() => {
9
+ if (value) setFileList(value)
10
+ }, [value]);
11
+ maxLen = maxLen || 9;
12
+ const [fileList, setFileList] = React.useState([]);
13
+ const handleChange = ({ fileList: newFileList }) => {
14
+ console.log(newFileList)
15
+ setFileList(newFileList);
16
+ onChange(fileList.map((file) => {
17
+ return {
18
+ uid: file.uid,
19
+ name: file.name,
20
+ status: file.status,
21
+ url: file.url || ""
22
+ }
23
+ }))
24
+ }
25
+ return (
26
+ <BaseWrapper {...props}>
27
+ <OriginalUpload {...props}
28
+ listType="text"
29
+ onChange={handleChange}
30
+ defaultFileList={fileList}>
31
+ <Button icon={<UploadOutlined />}>点击上传文件</Button>
32
+ </OriginalUpload>
33
+ </BaseWrapper>
34
+ );
35
+ }
36
+
37
+ export default UploadFile;
@@ -0,0 +1,66 @@
1
+ import { Upload as OriginalUpload, Button } from "antd";
2
+
3
+ import { BaseWrapper } from "../base.jsx"
4
+ import { PlusOutlined } from "@ant-design/icons";
5
+ import React,{ useEffect, useState} from "react";
6
+
7
+ const UploadImage = ({ maxLen, value, onChange, ...props }) => {
8
+ useEffect(() => {
9
+ if (value) setFileList(value)
10
+ }, [value]);
11
+ maxLen = maxLen || 9;
12
+ const [fileList, setFileList] = React.useState([]);
13
+ const [previewImage, setPreviewImage] = useState('');
14
+ const [previewOpen, setPreviewOpen] = useState(false);
15
+ const handlePreview = async (file) => {
16
+ if (!file.url && !file.preview) {
17
+ file.preview = await getBase64(file.originFileObj);
18
+ }
19
+
20
+ setPreviewImage(file.url || (file.preview));
21
+ setPreviewOpen(true);
22
+ };
23
+ const uploadButton = (
24
+ <button style={{ border: 0, background: 'none' }} type="button">
25
+ <PlusOutlined />
26
+ <div style={{ marginTop: 8 }}>点击上传</div>
27
+ </button>
28
+ );
29
+ const handleChange= ({ fileList: newFileList }) => {
30
+ setFileList(newFileList);
31
+ onChange(fileList.map((file) => {
32
+ return {
33
+ uid:file.uid,
34
+ name:file.name,
35
+ status:file.status,
36
+ url:file.url||""
37
+ }
38
+ }))
39
+ }
40
+ return (
41
+ <BaseWrapper {...props}>
42
+ <OriginalUpload
43
+ {...props}
44
+ listType="picture-card"
45
+ fileList={fileList}
46
+ onPreview={handlePreview}
47
+ onChange={handleChange}
48
+ >
49
+ {fileList.length >= 8 ? null : uploadButton}
50
+ </OriginalUpload>
51
+ {previewImage && (
52
+ <Image
53
+ wrapperStyle={{ display: 'none' }}
54
+ preview={{
55
+ visible: previewOpen,
56
+ onVisibleChange: (visible) => setPreviewOpen(visible),
57
+ afterOpenChange: (visible) => !visible && setPreviewImage(''),
58
+ }}
59
+ src={previewImage}
60
+ />
61
+ )}
62
+ </BaseWrapper>
63
+ );
64
+ }
65
+
66
+ export default UploadImage;
@@ -158,7 +158,7 @@ const FormContainer = forwardRef(({ cols = 1, children }, ref) => {
158
158
  };
159
159
 
160
160
  return (
161
- <Form form={form} className="form-container p-6 w-full h-full box-border overflow-auto" onFieldsChange={handleFieldsChange}>
161
+ <Form form={form} className="form-container fp-6 fw-full fh-full box-border overflow-auto" onFieldsChange={handleFieldsChange}>
162
162
  {formContent}
163
163
  </Form>
164
164
  );
@@ -1,5 +1,5 @@
1
1
  const FormGroupTitle = ({ title }) => {
2
- return (title? <div className="h-11 border-b flex items-center text-lg font-medium mb-5 ">{title}</div>: null )
2
+ return (title? <div className="fh-11 border-b fflex fitems-center text-lg font-medium mb-5 ">{title}</div>: null )
3
3
  };
4
4
 
5
5
  export default FormGroupTitle;
@@ -3,8 +3,11 @@ import '../App.css';
3
3
  import { TreeSelect, Select, WithSingleSelect,WithMultipleSelect } from './field/select/index.jsx'
4
4
  import Custom from './field/custom/index.jsx'
5
5
  import { FormContainer, FormContainerWrapper,LayoutFormRow,LayoutFormGroupTitle } from './form-container/index.jsx'
6
- import { Checkbox ,CheckboxTree } from './field/checkbox/index.jsx'
7
- import { default as RadioGrop } from './field/radio/index.jsx'
6
+ import { Checkbox ,CheckboxTree, CheckboxGroup } from './field/checkbox/index.jsx'
7
+ import { default as RadioGroup } from './field/radio/index.jsx'
8
+ import { UploadFile,UploadImage } from './field/upload'
9
+ import {default as Switch} from './field/switch'
10
+ import {default as DatePicker } from './field/date-picker'
8
11
  const Field = {
9
12
  Input,
10
13
  TextArea,
@@ -17,11 +20,21 @@ const Field = {
17
20
  CodeMachine,
18
21
  Checkbox,
19
22
  CheckboxTree,
20
- RadioGrop,
23
+ CheckboxGroup,
24
+ RadioGroup,
25
+ UploadFile,
26
+ UploadImage,
27
+ Switch,
28
+ DatePicker,
21
29
  Custom,
22
30
  }
23
31
  const Layout = {
24
32
  FormRow: LayoutFormRow,
25
33
  FormGroupTitle: LayoutFormGroupTitle
26
34
  }
27
- export { FormContainer, Field ,FormContainerWrapper,Layout }
35
+ export { FormContainer, Field ,FormContainerWrapper,Layout }
36
+ // import { default as OptionSetter} from './setter/optionsetter'
37
+ // const Setter = {
38
+ // OptionSetter
39
+ // }
40
+ // export { Setter }
@@ -0,0 +1,9 @@
1
+ import React, { useEffect } from 'react';
2
+
3
+ const OptionSetter = ({value, onChange, ...props}) => {
4
+ return (
5
+ <div>sdfsdfsdf</div>
6
+ )
7
+ }
8
+
9
+ export default OptionSetter
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ prefix: 'f',
2
3
  purge: [
3
4
  './src/**/*.html',
4
5
  './src/**/*.tsx',
package/vite.config.js CHANGED
@@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
2
2
  import react from '@vitejs/plugin-react';
3
3
  import tailwindcss from 'tailwindcss'
4
4
  import autoprefixer from 'autoprefixer'
5
+ import prefixer from 'postcss-prefixer'
5
6
  import babel from '@rollup/plugin-babel';
6
7
 
7
8
  export default defineConfig({