lu-lowcode-package-form 0.8.4 → 0.8.6

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: }.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))}
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}.fmb-5{margin-bottom:1.25rem}.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}.fborder-l-4{border-left-width:4px}.fborder-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.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}.fpl-2{padding-left:.5rem}.ftext-lg{font-size:1.125rem;line-height:1.75rem}.ftext-sm{font-size:.875rem;line-height:1.25rem}.ftext-xs{font-size:.75rem;line-height:1rem}.ffont-medium{font-weight:500}.ftext-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@testing-library/jest-dom": "^5.17.0",
package/src/App.jsx CHANGED
@@ -30,6 +30,7 @@ function App() {
30
30
  }
31
31
  const setFormFields = () => {
32
32
  formRef?.current?.formRef?.setFieldsValue({
33
+ CheckboxGroup:"[\"1\",\"2\"]",
33
34
  select1:"1",
34
35
  select2:"[\"1\",\"2\"]",
35
36
  switch:"1",
@@ -58,7 +58,12 @@ const CheckboxTree = ({ request, value, onChange,callError,disabledValue, addRoo
58
58
  useEffect(() => {
59
59
  console.log("CheckboxTree value ", value)
60
60
  if ( typeof value == 'string') {
61
- value = JSON.parse(value)
61
+ try {
62
+ value = JSON.parse(value)
63
+ onChange(value)
64
+ } catch (error) {
65
+
66
+ }
62
67
  }
63
68
 
64
69
  if(Array.isArray(value))
@@ -1,23 +1,37 @@
1
1
  import { Checkbox as OriginalCheckbox } from 'antd';
2
- import {BaseWrapper } from "../base.jsx"
3
- import React from 'react';
2
+ import { BaseWrapper } from "../base.jsx"
3
+ import React, { useEffect , useState} from 'react';
4
4
 
5
5
 
6
- export const Checkbox = (props) =>{
7
- return (
8
- <BaseWrapper {...props}>
9
- <OriginalCheckbox {...props} />
10
- </BaseWrapper>
11
- );
6
+ export const Checkbox = (props) => {
7
+ return (
8
+ <BaseWrapper {...props}>
9
+ <OriginalCheckbox {...props} />
10
+ </BaseWrapper>
11
+ );
12
12
  }
13
13
 
14
- export const CheckboxGroup = (props) => {
15
- return (
16
- <BaseWrapper {...props}>
17
- <OriginalCheckbox.Group {...props} />
18
- </BaseWrapper>
19
- );
14
+ export const CheckboxGroup = ({value, onChange,...props}) => {
15
+ const [nValue, setNValue] = useState([])
16
+
17
+ useEffect(() => {
18
+ if (typeof value === "string") {
19
+ try {
20
+ value = JSON.parse(value)
21
+ onChange(value)
22
+ } catch (error) {
23
+
24
+ }
25
+ }
26
+
27
+ setNValue(value)
28
+ }, [value])
29
+ return (
30
+ <BaseWrapper {...props}>
31
+ <OriginalCheckbox.Group {...props} value={nValue} />
32
+ </BaseWrapper>
33
+ );
20
34
  }
21
35
 
22
36
 
23
- export {default as CheckboxTree } from './checkbox-tree.jsx';
37
+ export { default as CheckboxTree } from './checkbox-tree.jsx';
@@ -2,6 +2,9 @@ import React, { useEffect, useState } from 'react';
2
2
  import { DatePicker as OriginalDatePicker, Button } from 'antd';
3
3
  import { BaseWrapper } from "../base.jsx"
4
4
  import dayjs from 'dayjs';
5
+ import 'dayjs/locale/zh-cn';
6
+ dayjs.locale('zh-cn');
7
+
5
8
  const DatePicker = ({ datetype, value, onChange, ...props }) => {
6
9
  datetype = datetype || "date"
7
10
  const [picker, setPicker] = useState(props?.picker)
@@ -71,19 +71,20 @@ const WithSingleSelect = ({ onChange, value, ...props }) => {
71
71
  const [nValue, setNValue] = React.useState("")
72
72
 
73
73
  React.useEffect(() => {
74
- if(value) {
74
+ if (value && typeof value === "string") {
75
75
  try {
76
76
  value = JSON.parse(value)
77
- setNValue(value.label)
77
+ onChange(value)
78
78
  } catch (error) {
79
79
 
80
80
  }
81
81
  }
82
+ if(value) setNValue(value)
82
83
  }, [value])
83
84
 
84
85
 
85
86
  const onWithSelectChange = (_value, _option) => {
86
- onChange && typeof onChange == "function" && onChange(JSON.stringify(_option))
87
+ onChange && typeof onChange == "function" && onChange(_option)
87
88
  setNValue(_option.label)
88
89
  }
89
90
  return (
@@ -101,18 +102,20 @@ const WithMultipleSelect = ({ onChange, value, ...props }) => {
101
102
 
102
103
 
103
104
  React.useEffect(() => {
104
- if (value) {
105
+ if (value && typeof value === "string") {
105
106
  try {
106
107
  value = JSON.parse(value)
107
- if (Array.isArray(value)) setNValue(value)
108
+ onChange(value)
108
109
  } catch (error) {
109
110
 
110
111
  }
111
112
  }
113
+
114
+ if (Array.isArray(value)) setNValue(value)
112
115
  }, [value])
113
116
 
114
117
  const onWithSelectChange = (_value, _option) => {
115
- onChange && typeof onChange == "function" && onChange(JSON.stringify(_option))
118
+ onChange && typeof onChange == "function" && onChange(_option)
116
119
  const selectLabels = _option.map(item => item.label);
117
120
  setNValue(_option)
118
121
  }
@@ -4,28 +4,34 @@ import { BaseWrapper } from "../base.jsx"
4
4
  import { UploadOutlined } from "@ant-design/icons";
5
5
  import React, { useEffect, useState } from "react";
6
6
 
7
- const UploadFile = ({value, maxLen,onChange,...props}) => {
7
+ const UploadFile = ({ value, maxCount, onChange, ...props }) => {
8
8
  useEffect(() => {
9
9
  if (value) setFileList(value)
10
10
  }, [value]);
11
- maxLen = maxLen || 9;
11
+ maxCount = maxCount || 9;
12
12
  const [fileList, setFileList] = React.useState([]);
13
13
  const handleChange = ({ fileList: newFileList }) => {
14
- console.log(newFileList)
15
- setFileList(newFileList);
16
- onChange(fileList.map((file) => {
14
+ newFileList = newFileList.map((file) => {
15
+ if (file.status == "done" && file.response) {
16
+ file.url = file.response;
17
+ }
18
+ return file;
19
+ })
20
+ onChange(newFileList.map((file) => {
17
21
  return {
18
22
  uid: file.uid,
19
23
  name: file.name,
20
24
  status: file.status,
21
- url: file.url || ""
25
+ url: file.url || file.response || ""
22
26
  }
23
27
  }))
28
+ setFileList(newFileList);
24
29
  }
25
30
  return (
26
31
  <BaseWrapper {...props}>
27
- <OriginalUpload {...props}
32
+ <OriginalUpload {...props}
28
33
  listType="text"
34
+ maxCount={maxCount}
29
35
  onChange={handleChange}
30
36
  defaultFileList={fileList}>
31
37
  <Button icon={<UploadOutlined />}>点击上传文件</Button>
@@ -4,11 +4,11 @@ import { BaseWrapper } from "../base.jsx"
4
4
  import { PlusOutlined } from "@ant-design/icons";
5
5
  import React,{ useEffect, useState} from "react";
6
6
 
7
- const UploadImage = ({ maxLen, value, onChange, ...props }) => {
7
+ const UploadImage = ({ maxCount, value, onChange, ...props }) => {
8
8
  useEffect(() => {
9
9
  if (value) setFileList(value)
10
10
  }, [value]);
11
- maxLen = maxLen || 9;
11
+ maxCount = maxCount || 9;
12
12
  const [fileList, setFileList] = React.useState([]);
13
13
  const [previewImage, setPreviewImage] = useState('');
14
14
  const [previewOpen, setPreviewOpen] = useState(false);
@@ -27,26 +27,33 @@ const UploadImage = ({ maxLen, value, onChange, ...props }) => {
27
27
  </button>
28
28
  );
29
29
  const handleChange= ({ fileList: newFileList }) => {
30
- setFileList(newFileList);
31
- onChange(fileList.map((file) => {
30
+ newFileList = newFileList.map((file) => {
31
+ if (file.status == "done" && file.response) {
32
+ file.url = file.response;
33
+ }
34
+ return file;
35
+ })
36
+ onChange(newFileList.map((file) => {
32
37
  return {
33
- uid:file.uid,
34
- name:file.name,
35
- status:file.status,
36
- url:file.url||""
38
+ uid: file.uid,
39
+ name: file.name,
40
+ status: file.status,
41
+ url: file.url || file.response || ""
37
42
  }
38
43
  }))
44
+ setFileList(newFileList);
39
45
  }
40
46
  return (
41
47
  <BaseWrapper {...props}>
42
48
  <OriginalUpload
43
49
  {...props}
50
+ maxCount={maxCount}
44
51
  listType="picture-card"
45
52
  fileList={fileList}
46
53
  onPreview={handlePreview}
47
54
  onChange={handleChange}
48
55
  >
49
- {fileList.length >= 8 ? null : uploadButton}
56
+ {fileList.length >= maxCount ? null : uploadButton}
50
57
  </OriginalUpload>
51
58
  {previewImage && (
52
59
  <Image
@@ -1,5 +1,5 @@
1
1
  const FormGroupTitle = ({ title }) => {
2
- return (title? <div className="fh-11 border-b fflex fitems-center text-lg font-medium mb-5 ">{title}</div>: null )
2
+ return (title? <div className="fh-11 fflex fitems-center ftext-lg ffont-medium fmb-5 "><span className="fborder-l-4 fborder-slate-300 fpl-2 ">{title}</span></div>: null )
3
3
  };
4
4
 
5
5
  export default FormGroupTitle;