@hw-component/form 1.9.85 → 1.9.87

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 (70) hide show
  1. package/.eslintcache +1 -1
  2. package/es/DialogForm/hooks.d.ts +1 -1
  3. package/es/Form/config.d.ts +2 -1
  4. package/es/Form/config.js +3 -1
  5. package/es/Form/hooks/useHForm.js +10 -0
  6. package/es/Form/modal.d.ts +1 -0
  7. package/es/Select/TagSelect/Content.d.ts +7 -0
  8. package/es/Select/TagSelect/Content.js +90 -0
  9. package/es/Select/TagSelect/hooks.d.ts +10 -0
  10. package/es/Select/TagSelect/hooks.js +97 -0
  11. package/es/Select/TagSelect/index.d.ts +3 -0
  12. package/es/Select/TagSelect/index.js +100 -0
  13. package/es/Select/index.js +0 -1
  14. package/es/Select/modal.d.ts +7 -1
  15. package/es/index.css +15 -0
  16. package/es/index.d.ts +2 -1
  17. package/es/index.js +2 -1
  18. package/lib/DialogForm/hooks.d.ts +1 -1
  19. package/lib/Form/config.d.ts +2 -1
  20. package/lib/Form/config.js +3 -1
  21. package/lib/Form/hooks/useHForm.js +10 -0
  22. package/lib/Form/modal.d.ts +1 -0
  23. package/lib/Select/TagSelect/Content.d.ts +7 -0
  24. package/lib/Select/TagSelect/Content.js +93 -0
  25. package/lib/Select/TagSelect/hooks.d.ts +10 -0
  26. package/lib/Select/TagSelect/hooks.js +99 -0
  27. package/lib/Select/TagSelect/index.d.ts +3 -0
  28. package/lib/Select/TagSelect/index.js +103 -0
  29. package/lib/Select/index.js +0 -1
  30. package/lib/Select/modal.d.ts +7 -1
  31. package/lib/index.css +15 -0
  32. package/lib/index.d.ts +2 -1
  33. package/lib/index.js +2 -0
  34. package/package.json +1 -1
  35. package/src/components/Btn.tsx +36 -36
  36. package/src/components/CheckboxGroup/index.tsx +4 -3
  37. package/src/components/DialogForm/DrawerForm/index.tsx +13 -13
  38. package/src/components/DialogForm/ModalForm.tsx +16 -16
  39. package/src/components/DialogForm/hooks.tsx +3 -3
  40. package/src/components/DialogForm/modal.ts +8 -2
  41. package/src/components/Form/HFormConnect.tsx +8 -3
  42. package/src/components/Form/InitSet.tsx +4 -4
  43. package/src/components/Form/config.ts +2 -1
  44. package/src/components/Form/hooks/index.ts +1 -3
  45. package/src/components/Form/hooks/useAddFormat.tsx +34 -36
  46. package/src/components/Form/hooks/useHForm.ts +14 -2
  47. package/src/components/Form/index.less +6 -0
  48. package/src/components/Form/modal.ts +3 -2
  49. package/src/components/RichEditor/hooks.ts +36 -34
  50. package/src/components/RichEditor/index.tsx +31 -23
  51. package/src/components/RichEditor/modal.ts +2 -2
  52. package/src/components/Select/TagSelect/Content.tsx +50 -0
  53. package/src/components/Select/TagSelect/hooks.ts +83 -0
  54. package/src/components/Select/TagSelect/index.tsx +63 -0
  55. package/src/components/Select/index.less +13 -0
  56. package/src/components/Select/index.tsx +0 -1
  57. package/src/components/Select/modal.ts +7 -1
  58. package/src/components/TDPicker/TimePicker.tsx +1 -1
  59. package/src/components/TDPicker/hooks.ts +1 -1
  60. package/src/components/TextArea/index.tsx +2 -2
  61. package/src/components/Upload/Btn.tsx +13 -9
  62. package/src/components/Upload/hooks/customRequest.ts +1 -1
  63. package/src/components/Upload/index.tsx +8 -8
  64. package/src/components/Upload/modal.ts +5 -4
  65. package/src/components/index.tsx +2 -0
  66. package/src/pages/DrawerForm/index.tsx +17 -15
  67. package/src/pages/Form/index.tsx +161 -144
  68. package/src/pages/ModalForm/index.tsx +12 -8
  69. package/src/pages/Select/index.tsx +25 -4
  70. package/src/pages/Upload/index.tsx +2 -2
@@ -1,44 +1,42 @@
1
- import {addFormatItemModal, HFormItemProps} from "../modal";
2
- import {useFormContext} from "@/components/Form/Context";
3
- import {useEffect} from "react";
1
+ import { addFormatItemModal, HFormItemProps } from "../modal";
2
+ import { useFormContext } from "@/components/Form/Context";
3
+ import { useEffect } from "react";
4
4
 
5
5
  interface ResultModal {
6
- inputValue?: (value: Record<string, any>) => Record<string, any>;
7
- outputValue?: (value: Record<string, any>) => Record<string, any>;
6
+ inputValue?: (value: Record<string, any>) => Record<string, any>;
7
+ outputValue?: (value: Record<string, any>) => Record<string, any>;
8
8
  }
9
9
 
10
10
  export const formatMaker = (
11
- itemProps: HFormItemProps,
12
- formats?: addFormatItemModal
11
+ itemProps: HFormItemProps,
12
+ formats?: addFormatItemModal
13
13
  ) => {
14
- const { inputValue, outputValue } = formats || {};
15
- const { initValueProvider = inputValue, subProvider = outputValue } =
16
- itemProps;
17
- const resultObj: ResultModal = {};
18
- if (initValueProvider) {
19
- resultObj.inputValue = (value) => {
20
- return initValueProvider(itemProps, value);
21
- };
22
- }
23
- if (subProvider) {
24
- resultObj.outputValue = (value) => {
25
- return subProvider(itemProps, value);
26
- };
27
- }
28
- const keysLen = Object.keys(resultObj).length;
29
- return keysLen === 0 ? undefined : resultObj;
14
+ const { inputValue, outputValue } = formats || {};
15
+ const { initValueProvider = inputValue, subProvider = outputValue } =
16
+ itemProps;
17
+ const resultObj: ResultModal = {};
18
+ if (initValueProvider) {
19
+ resultObj.inputValue = (value) => {
20
+ return initValueProvider(itemProps, value);
21
+ };
22
+ }
23
+ if (subProvider) {
24
+ resultObj.outputValue = (value) => {
25
+ return subProvider(itemProps, value);
26
+ };
27
+ }
28
+ const keysLen = Object.keys(resultObj).length;
29
+ return keysLen === 0 ? undefined : resultObj;
30
30
  };
31
31
 
32
-
33
-
34
- export default (props:HFormItemProps)=>{
35
- const {name,itemProps}=props;
36
- const { form, valueType = "float" } = useFormContext();
37
- const relName = Array.isArray(name) ? name.join(".") : name;
38
- useEffect(() => {
39
- if (!relName||!itemProps) {
40
- return;
41
- }
42
- form?.addFormat(relName, formatMaker((itemProps as HFormItemProps)));
43
- }, [valueType, props]);
44
- }
32
+ export default (props: HFormItemProps) => {
33
+ const { name, itemProps } = props;
34
+ const { form, valueType = "float" } = useFormContext();
35
+ const relName = Array.isArray(name) ? name.join(".") : name;
36
+ useEffect(() => {
37
+ if (!relName || !itemProps) {
38
+ return;
39
+ }
40
+ form?.addFormat(relName, formatMaker(itemProps as HFormItemProps));
41
+ }, [valueType, props]);
42
+ };
@@ -186,14 +186,26 @@ export default () => {
186
186
  ...values,
187
187
  });
188
188
  },
189
+ resetFieldsValues: (values = {}) => {
190
+ const oldValue = form.getFieldsValue(true);
191
+ const keys = Object.keys(oldValue);
192
+ const newVale = {};
193
+ keys.forEach((key) => {
194
+ newVale[key] = undefined;
195
+ });
196
+ form.setFieldsValue({
197
+ ...newVale,
198
+ ...values,
199
+ });
200
+ },
189
201
  clear: () => {
190
202
  form.resetFields();
191
203
  isLoading = false;
192
204
  },
193
- resetFormStatus:()=>{
205
+ resetFormStatus: () => {
194
206
  isLoading = false;
195
207
  },
196
- inited:false
208
+ inited: false,
197
209
  };
198
210
  }, []);
199
211
  };
@@ -102,3 +102,9 @@
102
102
  display: flex;
103
103
  }
104
104
  }
105
+
106
+ .@{ant-prefix}-hw-tag-select{
107
+ .@{ant-prefix}-hw-tag-item{
108
+ cursor: pointer;
109
+ }
110
+ }
@@ -208,9 +208,10 @@ export interface HFormInstance extends FormInstance {
208
208
  reload: PromiseFnResult;
209
209
  clear: VoidFunction;
210
210
  resetFieldsInitValue: (values?: Record<string, any>) => void;
211
+ resetFieldsValues: (values?: Record<string, any>) => void;
211
212
  clearFormat: (name: string) => void;
212
- inited:boolean;
213
- resetFormStatus:VoidFunction
213
+ inited: boolean;
214
+ resetFormStatus: VoidFunction;
214
215
  }
215
216
 
216
217
  export interface ConnectConfigModal {
@@ -3,7 +3,7 @@ import { baseConfig } from "../config";
3
3
  import { IHRichEditorProps } from "src/components/RichEditor/modal";
4
4
  import { useClassName } from "../hooks";
5
5
  import { useEffect, useMemo, useRef, useState } from "react";
6
- import BraftEditor, {EditorState} from "braft-editor";
6
+ import BraftEditor, { EditorState } from "braft-editor";
7
7
 
8
8
  export const useProps = ({ fileRequest, valueType }: IHRichEditorProps) => {
9
9
  const {
@@ -46,38 +46,40 @@ export const useFocusClassname = ({
46
46
  };
47
47
  };
48
48
 
49
- export const useVC=({value,onChange,valueType}:IHRichEditorProps)=>{
50
- const richValue: EditorState | undefined = valueType === "html" ? BraftEditor.createEditorState(value) : (value as EditorState);
51
- const change = (editorState) => {
52
- const changeVal = valueType === "html" ? editorState.toHTML() : editorState;
53
- const isEmpty = !!richValue ? richValue.isEmpty() : true;
54
- if (isEmpty && editorState.isEmpty()) {
55
- return;
56
- }
57
- onChange?.(changeVal);
58
- };
59
- return {
60
- richValue,
61
- change
49
+ export const useVC = ({ value, onChange, valueType }: IHRichEditorProps) => {
50
+ const richValue: EditorState | undefined =
51
+ valueType === "html"
52
+ ? BraftEditor.createEditorState(value)
53
+ : (value as EditorState);
54
+ const change = (editorState) => {
55
+ const changeVal = valueType === "html" ? editorState.toHTML() : editorState;
56
+ const isEmpty = !!richValue ? richValue.isEmpty() : true;
57
+ if (isEmpty && editorState.isEmpty()) {
58
+ return;
62
59
  }
63
- }
64
-
60
+ onChange?.(changeVal);
61
+ };
62
+ return {
63
+ richValue,
64
+ change,
65
+ };
66
+ };
65
67
 
66
- export const useUploadFn=({fileRequest}:IHRichEditorProps)=>{
67
- return async (params)=>{
68
- const { file, id } = params;
69
- const { url } = await fileRequest?.(file, params);
70
- params.success({
71
- url,
72
- meta: {
73
- id,
74
- title: file.name,
75
- alt: "媒体资源",
76
- loop: false,
77
- autoPlay: false,
78
- controls: true,
79
- poster: url,
80
- },
81
- });
82
- }
83
- }
68
+ export const useUploadFn = ({ fileRequest }: IHRichEditorProps) => {
69
+ return async (params) => {
70
+ const { file, id } = params;
71
+ const { url } = await fileRequest?.(file, params);
72
+ params.success({
73
+ url,
74
+ meta: {
75
+ id,
76
+ title: file.name,
77
+ alt: "媒体资源",
78
+ loop: false,
79
+ autoPlay: false,
80
+ controls: true,
81
+ poster: url,
82
+ },
83
+ });
84
+ };
85
+ };
@@ -1,7 +1,7 @@
1
1
  import BraftEditor, { EditorState } from "braft-editor";
2
2
  import "braft-editor/dist/index.css";
3
3
  import { IHRichEditorProps } from "./modal";
4
- import {useFocusClassname, useProps, useUploadFn, useVC} from "./hooks";
4
+ import { useFocusClassname, useProps, useUploadFn, useVC } from "./hooks";
5
5
  import { useClassName } from "../hooks";
6
6
  import React from "react";
7
7
  import HFormConnect from "../Form/HFormConnect";
@@ -19,8 +19,8 @@ const Index: React.ForwardRefRenderFunction<any, IHRichEditorProps> = (
19
19
  media,
20
20
  contentStyle = defaultContentStyle,
21
21
  bordered = true,
22
- onBlur,
23
- onFocus,
22
+ onBlur,
23
+ onFocus,
24
24
  addFormat,
25
25
  ...props
26
26
  },
@@ -30,37 +30,45 @@ const Index: React.ForwardRefRenderFunction<any, IHRichEditorProps> = (
30
30
  fileRequest,
31
31
  valueType,
32
32
  });
33
- const { focusClassname, onFocus:selfFocus, onBlur:selfBlur } = useFocusClassname({
33
+ const {
34
+ focusClassname,
35
+ onFocus: selfFocus,
36
+ onBlur: selfBlur,
37
+ } = useFocusClassname({
34
38
  bordered,
35
39
  onBlur,
36
- onFocus
40
+ onFocus,
37
41
  });
38
- const {richValue,change}=useVC({value,onChange,valueType:vType});
39
- const uploadFn = useUploadFn({fileRequest:fileReq});
42
+ const { richValue, change } = useVC({ value, onChange, valueType: vType });
43
+ const uploadFn = useUploadFn({ fileRequest: fileReq });
40
44
  const bodyClassName = useClassName("hw-rich-editor");
41
45
  const borderClassName = useClassName("hw-rich-editor-border");
42
46
  addFormat?.({
43
- float:{
44
- inputValue:(item, initValue)=>{
47
+ float: {
48
+ inputValue: (item, initValue) => {
45
49
  const { name = "" } = item;
46
- const keyName=(name as string);
47
- const itemVal=initValue[keyName];
48
- const initVal=typeof itemVal==="string"?BraftEditor.createEditorState(itemVal):itemVal;
50
+ const keyName = name as string;
51
+ const itemVal = initValue[keyName];
52
+ const initVal =
53
+ typeof itemVal === "string"
54
+ ? BraftEditor.createEditorState(itemVal)
55
+ : itemVal;
49
56
  return {
50
- [keyName]:initVal
57
+ [keyName]: initVal,
51
58
  };
52
59
  },
53
- outputValue:(item, outputValue)=>{
60
+ outputValue: (item, outputValue) => {
54
61
  const { name = "" } = item;
55
- const keyName=(name as string);
56
- const itemVal=outputValue[keyName];
57
- const outputVal=typeof itemVal==="string"?itemVal:itemVal?.toHTML();
62
+ const keyName = name as string;
63
+ const itemVal = outputValue[keyName];
64
+ const outputVal =
65
+ typeof itemVal === "string" ? itemVal : itemVal?.toHTML();
58
66
  return {
59
- [keyName]:outputVal
60
- }
61
- }
62
- }
63
- })
67
+ [keyName]: outputVal,
68
+ };
69
+ },
70
+ },
71
+ });
64
72
  return (
65
73
  <div
66
74
  className={`${bodyClassName} ${
@@ -81,4 +89,4 @@ const Index: React.ForwardRefRenderFunction<any, IHRichEditorProps> = (
81
89
  );
82
90
  };
83
91
 
84
- export default HFormConnect((React.forwardRef(Index) as any));
92
+ export default HFormConnect(React.forwardRef(Index) as any);
@@ -2,7 +2,8 @@ import { BraftEditorProps, EditorState } from "braft-editor";
2
2
  import { PromiseFnResult } from "../modal";
3
3
  import { addFormatItemModal } from "../Form/modal";
4
4
 
5
- export interface IHRichEditorProps extends Omit<BraftEditorProps, "value"|"onChange"> {
5
+ export interface IHRichEditorProps
6
+ extends Omit<BraftEditorProps, "value" | "onChange"> {
6
7
  value?: string | EditorState;
7
8
  onChange?: (value: string | EditorState) => void;
8
9
  fileRequest?: PromiseFnResult;
@@ -10,4 +11,3 @@ export interface IHRichEditorProps extends Omit<BraftEditorProps, "value"|"onCha
10
11
  bordered?: boolean;
11
12
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
12
13
  }
13
-
@@ -0,0 +1,50 @@
1
+ import {HTagSelectProps} from "../modal";
2
+ import {useClassName} from "@/components/hooks";
3
+ import {Row, Skeleton, Space, Tag,Empty} from "antd";
4
+ import React from "react";
5
+ import {useChangeControl} from "./hooks";
6
+ import NotFoundContent from "../components/NotFoundContent";
7
+
8
+ const ItemOption=({options,value,onChange,fieldNames}:HTagSelectProps)=>{
9
+ const tagClassName = useClassName("hw-tag-item");
10
+ const {label:labelKey="label",value:valueKey="value"}=fieldNames||{};
11
+ const {change}=useChangeControl({options,value,onChange,fieldNames});
12
+ return <Row gutter={[0,8]}>
13
+ {options?.map((item)=>{
14
+ const {[labelKey]:label,[valueKey]:itemVal}=item;
15
+ const index=value?.indexOf(itemVal);
16
+ const checkedTag=index!==-1;
17
+ return <Tag color={checkedTag?"processing":undefined}
18
+ className={tagClassName}
19
+ key={itemVal}
20
+ onClick={()=>{
21
+ change(itemVal);
22
+ }}
23
+ >
24
+ {label}
25
+ </Tag>
26
+ })}
27
+ </Row>
28
+ }
29
+
30
+ interface IContentProps extends HTagSelectProps{
31
+ error?:Error;
32
+ reload:VoidFunction;
33
+ }
34
+
35
+ export default ({loading,value,options,onChange,fieldNames,error,reload}:IContentProps)=>{
36
+ const len=options?.length||0;
37
+ if (loading&&len===0){
38
+ return <Space direction={"vertical"} style={{width:"100%"}}>
39
+ <Skeleton.Button active size={"small"} block />
40
+ <Skeleton.Button active size={"small"} block />
41
+ </Space>
42
+ }
43
+ if (error && len === 0) {
44
+ return <NotFoundContent error={error} reload={reload}/>;
45
+ }
46
+ if (len===0){
47
+ return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
48
+ }
49
+ return <ItemOption options={options} value={value} onChange={onChange} fieldNames={fieldNames}/>
50
+ }
@@ -0,0 +1,83 @@
1
+ import {useMemo} from "react";
2
+ import {HTagSelectProps, OptionType} from "@/components/Select/modal";
3
+
4
+ export const useTagControl=({value,options,title}:HTagSelectProps)=>{
5
+ const {checked,indeterminate}=useMemo(()=>{
6
+ const len=value?.length;
7
+ const opLen=options?.length;
8
+ if (!opLen){
9
+ return {
10
+ checked:false
11
+ }
12
+ }
13
+ if (len===opLen){
14
+ return {
15
+ checked:true
16
+ }
17
+ }
18
+ return {
19
+ indeterminate:!!len
20
+ }
21
+ },[value,options]);
22
+ const labelNode=useMemo(()=>{
23
+ if (title){
24
+ return title;
25
+ }
26
+ if (checked){
27
+ return "取消"
28
+ }
29
+ return "全选"
30
+ },[title,checked,indeterminate]);
31
+ return {
32
+ labelNode,
33
+ checked,
34
+ indeterminate
35
+ }
36
+ }
37
+
38
+ export const useChangeControl=({options,value,onChange,fieldNames}:HTagSelectProps)=>{
39
+ const {value:valueKey="value"}=fieldNames||{};
40
+ const optsNk=(newVal)=>{
41
+ const newOpts:OptionType[]=[];
42
+ newVal?.forEach((itemVal)=>{
43
+ const index=options?.findIndex((item)=>{
44
+ return itemVal===item[valueKey];
45
+ });
46
+ if (typeof index!=="undefined"){
47
+ newOpts.push((options?.[index] as OptionType));
48
+ }
49
+ });
50
+ return newOpts;
51
+ }
52
+ const checkedVal=(val)=>{
53
+ const newVal=[...value];
54
+ newVal.push(val);
55
+ onChange?.(newVal,optsNk(newVal));
56
+ }
57
+ const removeVal=(index)=>{
58
+ const newVal=[...value];
59
+ newVal.splice(index,1);
60
+ onChange?.(newVal,optsNk(newVal));
61
+ }
62
+ const change=(val)=>{
63
+ const index=value?.indexOf(val);
64
+ const checked=index===-1;
65
+ if (checked){
66
+ return checkedVal(val);
67
+ }
68
+ return removeVal(index);
69
+ }
70
+ const allCheck=(e)=>{
71
+ if (!e.target.checked){
72
+ return onChange?.([],[]);
73
+ }
74
+ const newVal=options?.map((item)=>{
75
+ return item[valueKey];
76
+ });
77
+ return onChange?.(newVal,options);
78
+ }
79
+ return {
80
+ change,
81
+ allCheck
82
+ }
83
+ }
@@ -0,0 +1,63 @@
1
+ import {Collapse, Checkbox} from 'antd';
2
+ import {useClassName, useMatchConfigProps} from "../../hooks";
3
+ import React from "react";
4
+ import {useSelectReq} from "../hooks/norHooks";
5
+ import {HTagSelectProps} from "../modal";
6
+ import {CheckboxProps} from "antd/lib/checkbox/Checkbox";
7
+ import Content from './Content';
8
+ import {useChangeControl, useTagControl} from "@/components/Select/TagSelect/hooks";
9
+ import HFormConnect from "@/components/Form/HFormConnect";
10
+ const { Panel } = Collapse;
11
+
12
+ const ItemTitle:React.FC<CheckboxProps>=({children,...props})=>{
13
+ return <div onClick={(event)=>{
14
+ event.stopPropagation();
15
+ }}>
16
+ <Checkbox {...props}>
17
+ {children}
18
+ </Checkbox>
19
+ </div>
20
+ }
21
+ const Index:React.FC<HTagSelectProps>=({options,value=[],onChange,dispatch,fieldNames:propsFieldNames,request,title,manual,className="",collapseProps,addDispatchListener})=>{
22
+ const collapseClassName = useClassName("hw-tag-select");
23
+ const { fieldNames } = useMatchConfigProps({ fieldNames: propsFieldNames });
24
+ const {
25
+ loading,
26
+ data: resultData,
27
+ error,
28
+ reload,
29
+ } = useSelectReq({
30
+ options,
31
+ manual,
32
+ request,
33
+ dispatch,
34
+ }); //options
35
+ const {labelNode,checked,indeterminate}=useTagControl({value,options:resultData,title});
36
+ const {allCheck}=useChangeControl({
37
+ value,
38
+ options:resultData,
39
+ onChange,
40
+ fieldNames
41
+ });
42
+ addDispatchListener?.("reload", reload);
43
+ return <Collapse bordered={false}
44
+ ghost
45
+ {...collapseProps}
46
+ className={`${collapseClassName} ${className}`}
47
+ >
48
+ <Panel key="1" header={<ItemTitle indeterminate={indeterminate}
49
+ checked={checked}
50
+ onChange={allCheck}
51
+ >{labelNode}</ItemTitle>}>
52
+ <Content loading={loading}
53
+ options={resultData}
54
+ value={value}
55
+ error={error}
56
+ onChange={onChange}
57
+ reload={reload}
58
+ fieldNames={fieldNames}
59
+ />
60
+ </Panel>
61
+ </Collapse>
62
+ }
63
+ export default HFormConnect(Index);
@@ -55,3 +55,16 @@
55
55
  }
56
56
  }
57
57
  }
58
+ .@{ant-prefix}-hw-tag-select {
59
+ width: 100%;
60
+ .@{ant-prefix}-collapse-content-box {
61
+ padding: 0px 40px !important;
62
+ }
63
+ .@{ant-prefix}-hw-tag-select{
64
+ cursor: pointer;
65
+ }
66
+ .@{ant-prefix}-collapse-header{
67
+ padding: 5px 16px !important;
68
+ }
69
+ }
70
+
@@ -55,7 +55,6 @@ const Index: React.FC<HSelectProps> = ({
55
55
  } = useSelectReq({
56
56
  options,
57
57
  manual,
58
- fieldNames,
59
58
  request,
60
59
  serviceSearch,
61
60
  showSearch,
@@ -2,6 +2,7 @@ import type { SelectProps } from "antd";
2
2
  import type React from "react";
3
3
  import type { PromiseFnResult } from "../modal";
4
4
  import type { addFormatItemModal, argsFn, DispatchModal } from "../Form/modal";
5
+ import {CollapseProps} from "antd/lib/collapse/Collapse";
5
6
 
6
7
  export type OptionType = Record<string, any>;
7
8
  export type RenderFn = (data: OptionType) => React.ReactNode;
@@ -24,7 +25,7 @@ export interface OptionsPageResultModal {
24
25
  }
25
26
  export type OptionsDataType = OptionsListType | OptionsPageResultModal;
26
27
  export interface HSelectProps
27
- extends Omit<SelectProps, "options" | "placeholder"> {
28
+ extends Omit<SelectProps, "options" | "placeholder"|"onChange"> {
28
29
  style?: React.CSSProperties;
29
30
  request?: PromiseFnResult<any, OptionsDataType>;
30
31
  manual?: boolean;
@@ -41,9 +42,14 @@ export interface HSelectProps
41
42
  isList?: boolean;
42
43
  addonBefore?: React.ReactNode;
43
44
  addonAfter?: React.ReactNode;
45
+ onChange?:(value:any,opts?:OptionType[]|OptionType)=>void;
44
46
  }
45
47
  export interface FilterDataModal {
46
48
  value: any;
47
49
  index: number;
48
50
  }
51
+ export interface HTagSelectProps extends HSelectProps{
52
+ title?:React.ReactNode;
53
+ collapseProps?:CollapseProps
54
+ }
49
55
  export type PartialHSelectProps = Partial<HSelectProps>;
@@ -23,7 +23,7 @@ const Index = ({
23
23
  return !!disabledDate?.(currentDate, timeVal);
24
24
  }}
25
25
  style={{
26
- width:"100%"
26
+ width: "100%",
27
27
  }}
28
28
  {...props}
29
29
  />
@@ -88,7 +88,7 @@ export const useTimePickerValue = ({
88
88
  format,
89
89
  }: UseTimePickerValParams) => {
90
90
  return useMemo(() => {
91
- const valStr=value?.toString()
91
+ const valStr = value?.toString();
92
92
  if (!valStr || !format) {
93
93
  return value;
94
94
  }
@@ -9,7 +9,7 @@ export default ({
9
9
  autoSize = { minRows: 4, maxRows: 4 },
10
10
  bordered = true,
11
11
  className,
12
- style={},
12
+ style = {},
13
13
  ...props
14
14
  }: HTextAreaProps) => {
15
15
  const noBorderClassName = useClassName("hw-text-area-no-border");
@@ -17,7 +17,7 @@ export default ({
17
17
  return (
18
18
  <Input.TextArea
19
19
  autoSize={autoSize}
20
- style={{width:"100%",...style}}
20
+ style={{ width: "100%", ...style }}
21
21
  {...props}
22
22
  className={`${borderClassName} ${className}`}
23
23
  />
@@ -3,7 +3,7 @@ import type { IUpLoadProps } from "./modal";
3
3
  import React, { useMemo } from "react";
4
4
  import { Button } from "antd";
5
5
 
6
- export default ({ value, maxCount = 1, listType ,children}: IUpLoadProps) => {
6
+ export default ({ value, maxCount = 1, listType, children }: IUpLoadProps) => {
7
7
  const len = value?.length || 0;
8
8
  const text = useMemo(() => {
9
9
  if (len === maxCount) {
@@ -19,13 +19,17 @@ export default ({ value, maxCount = 1, listType ,children}: IUpLoadProps) => {
19
19
  </div>
20
20
  );
21
21
  }
22
- const loading=useMemo(()=>{
23
- return value?.some(({status})=>{
24
- return status==="uploading";
25
- })
26
- },[value]);
27
- if (children){
28
- return React.cloneElement<any>((children as any),{loading});
22
+ const loading = useMemo(() => {
23
+ return value?.some(({ status }) => {
24
+ return status === "uploading";
25
+ });
26
+ }, [value]);
27
+ if (children) {
28
+ return React.cloneElement<any>(children as any, { loading });
29
29
  }
30
- return <Button icon={<UploadOutlined />} loading={loading}>{text}</Button>;
30
+ return (
31
+ <Button icon={<UploadOutlined />} loading={loading}>
32
+ {text}
33
+ </Button>
34
+ );
31
35
  };
@@ -4,7 +4,7 @@ import type { RcFile } from "antd/lib/upload";
4
4
  import { useEffect, useMemo } from "react";
5
5
  import type { UploadFileStatus } from "antd/es/upload/interface";
6
6
  import { message } from "antd";
7
- import {useRequest} from "ahooks";
7
+ import { useRequest } from "ahooks";
8
8
 
9
9
  interface SubReqParamsModal {
10
10
  request?: IUpLoadProps["request"];