@kne/react-filter 0.1.21 → 0.1.22
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/README.md +39 -1
- package/dist/index.js +11 -5678
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +9 -5677
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -38,7 +38,6 @@ const {default: antdMessage} = message;
|
|
|
38
38
|
|
|
39
39
|
const {City, List, Range, Text, Selector, Check, DateTime} = Filter.type;
|
|
40
40
|
|
|
41
|
-
console.log(Text.Number);
|
|
42
41
|
const {isNumber} = _;
|
|
43
42
|
|
|
44
43
|
const BaseExample = () => {
|
|
@@ -196,6 +195,45 @@ render(<Example/>);
|
|
|
196
195
|
|
|
197
196
|
```
|
|
198
197
|
|
|
198
|
+
- 扩展示例
|
|
199
|
+
- 展示扩展筛选项,自定义筛选项
|
|
200
|
+
- reactFilter(@kne/react-filter),modal(antd/lib/modal),input(antd/lib/input),_(lodash),(@kne/react-filter/dist/index.css)
|
|
201
|
+
|
|
202
|
+
```jsx
|
|
203
|
+
const {default: ReactFilter, useFilterContext, FilterItem} = reactFilter;
|
|
204
|
+
const {default: Modal} = modal;
|
|
205
|
+
const {default: Input} = input;
|
|
206
|
+
const {useRef, useState} = React;
|
|
207
|
+
const {get} = _;
|
|
208
|
+
|
|
209
|
+
const MyFilter = (props) => {
|
|
210
|
+
const ref = useRef();
|
|
211
|
+
const {value, onChange} = useFilterContext();
|
|
212
|
+
return <FilterItem {...props} onClick={() => {
|
|
213
|
+
Modal.confirm({
|
|
214
|
+
icon: null,
|
|
215
|
+
content: <Input ref={ref} defaultValue={get(value[props.name], 'value')}/>,
|
|
216
|
+
onOk: () => {
|
|
217
|
+
const value = ref.current.input.value;
|
|
218
|
+
onChange(props.name, {
|
|
219
|
+
label: value,
|
|
220
|
+
value
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
console.log(value);
|
|
225
|
+
}}/>;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const Example = () => {
|
|
229
|
+
const [value, setValue] = useState({});
|
|
230
|
+
return <ReactFilter value={value} onChange={setValue} more={[<MyFilter name="test1" label="测试"/>]}/>
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
render(<Example/>);
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
|
|
199
237
|
|
|
200
238
|
### API
|
|
201
239
|
|