lu-lowcode-package-form 0.9.44 → 0.9.45
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/package.json
CHANGED
@@ -30,7 +30,7 @@ export const BaseWrapper = function BaseWrapper({
|
|
30
30
|
const ignoreReadonly = ["UploadImage","UploadFile","Table"]
|
31
31
|
if (ignoreReadonly.includes(children?.type?.displayName) && readonly) readonly = false
|
32
32
|
const formWarpper = (
|
33
|
-
<div className={`frelative`}>
|
33
|
+
<div className={`frelative fw-full`}>
|
34
34
|
{label && <>
|
35
35
|
{!higLabel && <div className={`fh-8 ftext-gray-500 ftext-sm fflex fitems-center ${higLabel ? " ftext-xl fmy-2 ftext-black" : ""}`}>{label}{isRequired && <span className="ftext-red-500 ffont-bold">*</span>}</div>}
|
36
36
|
{higLabel && <div className="fh-11 fflex fitems-center ftext-lg ffont-medium "><span className="fborder-l-4 fborder-slate-300 fpl-2 ">{label}</span>{isRequired && <span className="ftext-red-500 ffont-bold">*</span>}</div>}
|
@@ -6,7 +6,7 @@ import { BaseWrapper } from "../base"
|
|
6
6
|
import { debounce } from 'lodash';
|
7
7
|
|
8
8
|
|
9
|
-
const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode="single", sub_option_value = "id", ...props }) => {
|
9
|
+
const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode = "single", sub_option_value = "id", rightIcon, rightIconClick, ...props }) => {
|
10
10
|
const [nOptions, setNOptions] = React.useState([])
|
11
11
|
const [fetching, setFetching] = useState(false);
|
12
12
|
useEffect(() => {
|
@@ -51,18 +51,18 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
51
51
|
if (Array.isArray(list)) {
|
52
52
|
for (let index = 0; index < list.length; index++) {
|
53
53
|
const item = list[index];
|
54
|
-
if (
|
54
|
+
if (typeof subRequest == "function") {
|
55
55
|
let subList = []
|
56
|
-
const {data } = await subRequest(item)
|
57
|
-
if(data?.list && Array.isArray(data.list)) {
|
58
|
-
subList = data.list.map(subItem => ({label
|
56
|
+
const { data } = await subRequest(item)
|
57
|
+
if (data?.list && Array.isArray(data.list)) {
|
58
|
+
subList = data.list.map(subItem => ({ label: `${item[option_label]}-${subItem[sub_option_label]}`, value: `${item[option_value]}-${subItem[sub_option_value]}` }))
|
59
59
|
}
|
60
|
-
list[index] = { ...item, label
|
60
|
+
list[index] = { ...item, label: item[option_label], title: item[option_label], options: subList }
|
61
61
|
}
|
62
62
|
list[index] = { ...item, label: item[option_label], value: item[option_value] }
|
63
|
-
|
63
|
+
|
64
64
|
}
|
65
|
-
|
65
|
+
|
66
66
|
setNOptions(list)
|
67
67
|
}
|
68
68
|
|
@@ -80,14 +80,32 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
80
80
|
if (Array.isArray(value)) {
|
81
81
|
onChange(value.map(item => nOptions.find(option => option.value === item)))
|
82
82
|
}
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
else {
|
84
|
+
onChange(nOptions.find(item => item.value === value))
|
85
|
+
}
|
86
86
|
}
|
87
87
|
|
88
88
|
|
89
89
|
return addWrapper ? (
|
90
90
|
<BaseWrapper {...props}>
|
91
|
+
<OriginalSelect
|
92
|
+
|
93
|
+
notFoundContent={fetching ? <Spin size="small" /> : null}
|
94
|
+
value={value}
|
95
|
+
{...props}
|
96
|
+
disabled={false}
|
97
|
+
filterOption={false}
|
98
|
+
showSearch={request && option_search ? true : false}
|
99
|
+
onSearch={request && option_search ? handleSearch : null}
|
100
|
+
onChange={handleChange}
|
101
|
+
style={{ width: '100%', flex: 1 }}
|
102
|
+
options={nOptions}
|
103
|
+
mode={mode} >
|
104
|
+
|
105
|
+
</OriginalSelect>
|
106
|
+
{rightIcon}
|
107
|
+
</BaseWrapper>
|
108
|
+
) : (<>
|
91
109
|
<OriginalSelect
|
92
110
|
notFoundContent={fetching ? <Spin size="small" /> : null}
|
93
111
|
value={value}
|
@@ -99,25 +117,12 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
99
117
|
onChange={handleChange}
|
100
118
|
style={{ width: '100%' }}
|
101
119
|
options={nOptions}
|
102
|
-
mode={mode}
|
103
|
-
|
120
|
+
mode={mode} >
|
121
|
+
|
104
122
|
</OriginalSelect>
|
105
|
-
|
106
|
-
)
|
107
|
-
notFoundContent={fetching ? <Spin size="small" /> : null}
|
108
|
-
value={value}
|
109
|
-
{...props}
|
110
|
-
disabled={false}
|
111
|
-
filterOption={false}
|
112
|
-
showSearch={request && option_search ? true : false}
|
113
|
-
onSearch={request && option_search ? handleSearch : null}
|
114
|
-
onChange={handleChange}
|
115
|
-
style={{ width: '100%' }}
|
116
|
-
options={nOptions}
|
117
|
-
mode={mode} >
|
118
|
-
|
119
|
-
</OriginalSelect>
|
123
|
+
{rightIcon}</>
|
124
|
+
)
|
120
125
|
|
121
126
|
}
|
122
127
|
|
123
|
-
export {SearchSelect}
|
128
|
+
export { SearchSelect }
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import { Select as OriginalSelect, Tree, Input } from "antd";
|
1
|
+
import { Select as OriginalSelect, Tree, Input, Button } from "antd";
|
2
2
|
|
3
3
|
import { BaseWrapper } from "../base"
|
4
4
|
import {SearchSelect} from "./search-select"
|
5
5
|
import React, { useEffect, useState } from 'react';
|
6
6
|
import TreeSelect from './tree-select'
|
7
|
+
import { EditOutlined } from '@ant-design/icons';
|
7
8
|
|
8
9
|
const Select = ({ request, option_label = "label", option_value = "id",disabledValue, callError, options, addWrapper = true, ...props }) => {
|
9
10
|
// const [firstLoad, setFirstLoad] = React.useState(false)
|
@@ -85,7 +86,8 @@ const WithSingleSelect = ({ onChange, value, ...props }) => {
|
|
85
86
|
}, [value])
|
86
87
|
|
87
88
|
return (
|
88
|
-
|
89
|
+
<SearchSelect {...props} onChange={onChange} value={value} mode="single" className=" fflex-1" />
|
90
|
+
|
89
91
|
)
|
90
92
|
}
|
91
93
|
|
@@ -109,7 +111,7 @@ const WithMultipleSelect = ({ onChange, value, ...props }) => {
|
|
109
111
|
}, [value])
|
110
112
|
|
111
113
|
return (
|
112
|
-
<SearchSelect {...props} onChange={onChange} value={value} mode="multiple"
|
114
|
+
<SearchSelect {...props} onChange={onChange} value={value} mode="multiple" />
|
113
115
|
)
|
114
116
|
}
|
115
117
|
|