sti-antd-package 0.0.40 → 0.0.42
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.
|
@@ -4,6 +4,9 @@ export interface ButtonGroupAddComponentProps {
|
|
|
4
4
|
formColLayout?: FormColLayout;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
loading?: boolean;
|
|
7
|
+
showTextbutton?: boolean;
|
|
8
|
+
textBack?: string;
|
|
9
|
+
textSave?: string;
|
|
7
10
|
onBack?: ButtonComponentProps['onClick'];
|
|
8
11
|
onSave?: ButtonComponentProps['onClick'];
|
|
9
12
|
classNames?: string[];
|
|
@@ -7,6 +7,11 @@ export interface ButtonGroupEditComponentProps {
|
|
|
7
7
|
allowEdit?: boolean;
|
|
8
8
|
editing?: boolean;
|
|
9
9
|
setEditing?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
+
showTextbutton?: boolean;
|
|
11
|
+
textBack?: string;
|
|
12
|
+
textCancel?: string;
|
|
13
|
+
textSave?: string;
|
|
14
|
+
textEdit?: string;
|
|
10
15
|
onBack?: ButtonComponentProps['onClick'];
|
|
11
16
|
onSave?: ButtonComponentProps['onClick'];
|
|
12
17
|
classNames?: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { formColLayout } from "../../constants";
|
|
2
2
|
import { ValidateStatus } from "antd/es/form/FormItem";
|
|
3
3
|
import { ShouldUpdate } from "rc-field-form/lib/Field";
|
|
4
|
-
import { NamePath, Rule
|
|
4
|
+
import { NamePath, Rule } from "rc-field-form/lib/interface";
|
|
5
5
|
import React from "react";
|
|
6
6
|
export interface SwitchComponentProps {
|
|
7
7
|
noItem?: boolean;
|
|
@@ -10,6 +10,7 @@ export interface SwitchComponentProps {
|
|
|
10
10
|
unCheckedChildren?: React.ReactNode;
|
|
11
11
|
loading?: boolean;
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
value?: boolean;
|
|
13
14
|
checked?: boolean;
|
|
14
15
|
defaultChecked?: boolean;
|
|
15
16
|
removeError?: (name?: NamePath) => void;
|
|
@@ -19,7 +20,6 @@ export interface SwitchComponentProps {
|
|
|
19
20
|
label?: React.ReactNode;
|
|
20
21
|
required?: boolean;
|
|
21
22
|
rules?: Rule[];
|
|
22
|
-
ruleType?: RuleObject['type'];
|
|
23
23
|
ruleMessage?: string;
|
|
24
24
|
validateStatus?: ValidateStatus;
|
|
25
25
|
shouldUpdate?: ShouldUpdate<string | string[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,9 @@ interface ButtonGroupAddComponentProps {
|
|
|
117
117
|
formColLayout?: FormColLayout;
|
|
118
118
|
disabled?: boolean;
|
|
119
119
|
loading?: boolean;
|
|
120
|
+
showTextbutton?: boolean;
|
|
121
|
+
textBack?: string;
|
|
122
|
+
textSave?: string;
|
|
120
123
|
onBack?: ButtonComponentProps['onClick'];
|
|
121
124
|
onSave?: ButtonComponentProps['onClick'];
|
|
122
125
|
classNames?: string[];
|
|
@@ -135,6 +138,11 @@ interface ButtonGroupEditComponentProps {
|
|
|
135
138
|
allowEdit?: boolean;
|
|
136
139
|
editing?: boolean;
|
|
137
140
|
setEditing?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
141
|
+
showTextbutton?: boolean;
|
|
142
|
+
textBack?: string;
|
|
143
|
+
textCancel?: string;
|
|
144
|
+
textSave?: string;
|
|
145
|
+
textEdit?: string;
|
|
138
146
|
onBack?: ButtonComponentProps['onClick'];
|
|
139
147
|
onSave?: ButtonComponentProps['onClick'];
|
|
140
148
|
classNames?: string[];
|
|
@@ -701,6 +709,7 @@ interface SwitchComponentProps {
|
|
|
701
709
|
unCheckedChildren?: React$1.ReactNode;
|
|
702
710
|
loading?: boolean;
|
|
703
711
|
disabled?: boolean;
|
|
712
|
+
value?: boolean;
|
|
704
713
|
checked?: boolean;
|
|
705
714
|
defaultChecked?: boolean;
|
|
706
715
|
removeError?: (name?: NamePath) => void;
|
|
@@ -710,7 +719,6 @@ interface SwitchComponentProps {
|
|
|
710
719
|
label?: React$1.ReactNode;
|
|
711
720
|
required?: boolean;
|
|
712
721
|
rules?: Rule$1[];
|
|
713
|
-
ruleType?: RuleObject$1['type'];
|
|
714
722
|
ruleMessage?: string;
|
|
715
723
|
validateStatus?: ValidateStatus;
|
|
716
724
|
shouldUpdate?: ShouldUpdate<string | string[]>;
|
package/dist/index.esm.js
CHANGED
|
@@ -3810,7 +3810,7 @@ function requireReactIs () {
|
|
|
3810
3810
|
|
|
3811
3811
|
var reactIsExports = requireReactIs();
|
|
3812
3812
|
|
|
3813
|
-
const ButtonGroupAddComponent = ({ formColLayout, disabled, loading, onBack, onSave, classNames, className, }) => {
|
|
3813
|
+
const ButtonGroupAddComponent = ({ formColLayout, disabled, loading, showTextbutton, textBack, textSave, onBack, onSave, classNames, className, }) => {
|
|
3814
3814
|
const saveMethod = onSave
|
|
3815
3815
|
? { onClick: onSave }
|
|
3816
3816
|
: { htmlType: 'submit' };
|
|
@@ -3831,12 +3831,12 @@ const ButtonGroupAddComponent = ({ formColLayout, disabled, loading, onBack, onS
|
|
|
3831
3831
|
(className === null || className === void 0 ? void 0 : className.buttonBack) && classButtonBackNames.push(...className.buttonBack);
|
|
3832
3832
|
return classButtonBackNames;
|
|
3833
3833
|
}, [styleButton, className, onBack]);
|
|
3834
|
-
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Back' }, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: { title: 'Save' }, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: className === null || className === void 0 ? void 0 : className.buttonSave, disabled: disabled, loading: loading }, saveMethod))] }));
|
|
3834
|
+
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textBack !== null && textBack !== void 0 ? textBack : 'Back' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack, children: showTextbutton ? (textBack !== null && textBack !== void 0 ? textBack : 'Back') : undefined }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: !showTextbutton ? { title: textSave !== null && textSave !== void 0 ? textSave : 'Save' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: className === null || className === void 0 ? void 0 : className.buttonSave, disabled: disabled, loading: loading, children: showTextbutton ? (textSave !== null && textSave !== void 0 ? textSave : 'Save') : undefined }, saveMethod))] }));
|
|
3835
3835
|
return col ? (jsxRuntimeExports.jsx(Row, { children: jsxRuntimeExports.jsx(Col, Object.assign({}, col, { children: buttonGroup })) })) : buttonGroup;
|
|
3836
3836
|
};
|
|
3837
3837
|
var Component$7 = React__default.memo(ButtonGroupAddComponent);
|
|
3838
3838
|
|
|
3839
|
-
const ButtonGroupEditComponent = ({ formColLayout, disabled, loading, allowEdit = true, editing, setEditing, onBack, onSave, classNames, className, }) => {
|
|
3839
|
+
const ButtonGroupEditComponent = ({ formColLayout, disabled, loading, allowEdit = true, editing, setEditing, showTextbutton, textBack, textCancel, textSave, textEdit, onBack, onSave, classNames, className, }) => {
|
|
3840
3840
|
const saveMethod = onSave
|
|
3841
3841
|
? { onClick: onSave }
|
|
3842
3842
|
: { htmlType: 'submit' };
|
|
@@ -3875,7 +3875,7 @@ const ButtonGroupEditComponent = ({ formColLayout, disabled, loading, allowEdit
|
|
|
3875
3875
|
(className === null || className === void 0 ? void 0 : className.buttonEdit) && classButtonEditNames.push(...className.buttonEdit);
|
|
3876
3876
|
return classButtonEditNames;
|
|
3877
3877
|
}, [styleButton, className, allowEdit, editing]);
|
|
3878
|
-
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Back' }, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack }), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Cancel' }, icon: jsxRuntimeExports.jsx(RefIcon$d, {}), classNames: classButtonCancel, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(false) }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: { title: 'Save' }, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: classButtonSave, disabled: disabled, loading: loading }, saveMethod)), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Edit' }, icon: jsxRuntimeExports.jsx(RefIcon$a, {}), classNames: classButtonEdit, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(true) })] }));
|
|
3878
|
+
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textBack !== null && textBack !== void 0 ? textBack : 'Back' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack, children: showTextbutton ? (textBack !== null && textBack !== void 0 ? textBack : 'Back') : undefined }), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textCancel !== null && textCancel !== void 0 ? textCancel : 'Cancel' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$d, {}), classNames: classButtonCancel, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(false), children: showTextbutton ? (textCancel !== null && textCancel !== void 0 ? textCancel : 'Cancel') : undefined }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: !showTextbutton ? { title: textSave !== null && textSave !== void 0 ? textSave : 'Save' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: classButtonSave, disabled: disabled, loading: loading, children: showTextbutton ? (textSave !== null && textSave !== void 0 ? textSave : 'Save') : undefined }, saveMethod)), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textEdit !== null && textEdit !== void 0 ? textEdit : 'Edit' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$a, {}), classNames: classButtonEdit, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(true), children: showTextbutton ? (textEdit !== null && textEdit !== void 0 ? textEdit : 'Edit') : undefined })] }));
|
|
3879
3879
|
return col ? (jsxRuntimeExports.jsx(Row, { children: jsxRuntimeExports.jsx(Col, Object.assign({}, col, { children: buttonGroup })) })) : buttonGroup;
|
|
3880
3880
|
};
|
|
3881
3881
|
var Component$6 = React__default.memo(ButtonGroupEditComponent);
|
|
@@ -8373,8 +8373,9 @@ const SelectAsyncComponent = (_a) => {
|
|
|
8373
8373
|
};
|
|
8374
8374
|
var SelectAsyncComponent$1 = React__default.memo(SelectAsyncComponent);
|
|
8375
8375
|
|
|
8376
|
-
const SwitchComponent = ({ noItem, icon, checkedChildren, unCheckedChildren, loading, disabled, checked, defaultChecked, removeError, onChange, formColLayout, name, label, required, rules,
|
|
8377
|
-
|
|
8376
|
+
const SwitchComponent = ({ noItem, icon, checkedChildren, unCheckedChildren, loading, disabled, value, checked, defaultChecked, removeError, onChange, formColLayout, name, label, required, rules, ruleMessage, validateStatus, help, shouldUpdate, }) => {
|
|
8377
|
+
var _a;
|
|
8378
|
+
const [checkedSwitch, setCheckedSwitch] = useState((_a = value !== null && value !== void 0 ? value : defaultChecked) !== null && _a !== void 0 ? _a : false);
|
|
8378
8379
|
const handleChange = (value, event) => {
|
|
8379
8380
|
setCheckedSwitch(value);
|
|
8380
8381
|
removeError === null || removeError === void 0 ? void 0 : removeError(name);
|
|
@@ -8388,7 +8389,7 @@ const SwitchComponent = ({ noItem, icon, checkedChildren, unCheckedChildren, loa
|
|
|
8388
8389
|
unCheckedChildren,
|
|
8389
8390
|
};
|
|
8390
8391
|
const switchComponent = !loading ? (jsxRuntimeExports.jsx(Switch, Object.assign({}, checkChildren, { onChange: handleChange, disabled: disabled, checked: checked !== null && checked !== void 0 ? checked : checkedSwitch, defaultChecked: checked !== null && checked !== void 0 ? checked : checkedSwitch }))) : jsxRuntimeExports.jsx(Skeleton.Input, { active: true });
|
|
8391
|
-
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent$1, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType:
|
|
8392
|
+
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent$1, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: "boolean", ruleMessage: ruleMessage, rules: rules, valuePropName: "checked", validateStatus: validateStatus, help: help, shouldUpdate: shouldUpdate, children: switchComponent })))
|
|
8392
8393
|
: switchComponent }));
|
|
8393
8394
|
};
|
|
8394
8395
|
var SwitchComponent$1 = React__default.memo(SwitchComponent);
|
package/dist/index.js
CHANGED
|
@@ -3829,7 +3829,7 @@ function requireReactIs () {
|
|
|
3829
3829
|
|
|
3830
3830
|
var reactIsExports = requireReactIs();
|
|
3831
3831
|
|
|
3832
|
-
const ButtonGroupAddComponent = ({ formColLayout, disabled, loading, onBack, onSave, classNames, className, }) => {
|
|
3832
|
+
const ButtonGroupAddComponent = ({ formColLayout, disabled, loading, showTextbutton, textBack, textSave, onBack, onSave, classNames, className, }) => {
|
|
3833
3833
|
const saveMethod = onSave
|
|
3834
3834
|
? { onClick: onSave }
|
|
3835
3835
|
: { htmlType: 'submit' };
|
|
@@ -3850,12 +3850,12 @@ const ButtonGroupAddComponent = ({ formColLayout, disabled, loading, onBack, onS
|
|
|
3850
3850
|
(className === null || className === void 0 ? void 0 : className.buttonBack) && classButtonBackNames.push(...className.buttonBack);
|
|
3851
3851
|
return classButtonBackNames;
|
|
3852
3852
|
}, [styleButton, className, onBack]);
|
|
3853
|
-
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Back' }, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: { title: 'Save' }, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: className === null || className === void 0 ? void 0 : className.buttonSave, disabled: disabled, loading: loading }, saveMethod))] }));
|
|
3853
|
+
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textBack !== null && textBack !== void 0 ? textBack : 'Back' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack, children: showTextbutton ? (textBack !== null && textBack !== void 0 ? textBack : 'Back') : undefined }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: !showTextbutton ? { title: textSave !== null && textSave !== void 0 ? textSave : 'Save' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: className === null || className === void 0 ? void 0 : className.buttonSave, disabled: disabled, loading: loading, children: showTextbutton ? (textSave !== null && textSave !== void 0 ? textSave : 'Save') : undefined }, saveMethod))] }));
|
|
3854
3854
|
return col ? (jsxRuntimeExports.jsx(antd.Row, { children: jsxRuntimeExports.jsx(antd.Col, Object.assign({}, col, { children: buttonGroup })) })) : buttonGroup;
|
|
3855
3855
|
};
|
|
3856
3856
|
var Component$7 = React.memo(ButtonGroupAddComponent);
|
|
3857
3857
|
|
|
3858
|
-
const ButtonGroupEditComponent = ({ formColLayout, disabled, loading, allowEdit = true, editing, setEditing, onBack, onSave, classNames, className, }) => {
|
|
3858
|
+
const ButtonGroupEditComponent = ({ formColLayout, disabled, loading, allowEdit = true, editing, setEditing, showTextbutton, textBack, textCancel, textSave, textEdit, onBack, onSave, classNames, className, }) => {
|
|
3859
3859
|
const saveMethod = onSave
|
|
3860
3860
|
? { onClick: onSave }
|
|
3861
3861
|
: { htmlType: 'submit' };
|
|
@@ -3894,7 +3894,7 @@ const ButtonGroupEditComponent = ({ formColLayout, disabled, loading, allowEdit
|
|
|
3894
3894
|
(className === null || className === void 0 ? void 0 : className.buttonEdit) && classButtonEditNames.push(...className.buttonEdit);
|
|
3895
3895
|
return classButtonEditNames;
|
|
3896
3896
|
}, [styleButton, className, allowEdit, editing]);
|
|
3897
|
-
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Back' }, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack }), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Cancel' }, icon: jsxRuntimeExports.jsx(RefIcon$d, {}), classNames: classButtonCancel, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(false) }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: { title: 'Save' }, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: classButtonSave, disabled: disabled, loading: loading }, saveMethod)), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: { title: 'Edit' }, icon: jsxRuntimeExports.jsx(RefIcon$a, {}), classNames: classButtonEdit, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(true) })] }));
|
|
3897
|
+
const buttonGroup = (jsxRuntimeExports.jsxs("div", { className: classButton.join(' '), children: [jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textBack !== null && textBack !== void 0 ? textBack : 'Back' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$h, {}), classNames: classButtonBack, disabled: disabled, onClick: onBack, children: showTextbutton ? (textBack !== null && textBack !== void 0 ? textBack : 'Back') : undefined }), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textCancel !== null && textCancel !== void 0 ? textCancel : 'Cancel' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$d, {}), classNames: classButtonCancel, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(false), children: showTextbutton ? (textCancel !== null && textCancel !== void 0 ? textCancel : 'Cancel') : undefined }), jsxRuntimeExports.jsx(ButtonComponent$1, Object.assign({ tooltip: !showTextbutton ? { title: textSave !== null && textSave !== void 0 ? textSave : 'Save' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$3, {}), type: "primary", classNames: classButtonSave, disabled: disabled, loading: loading, children: showTextbutton ? (textSave !== null && textSave !== void 0 ? textSave : 'Save') : undefined }, saveMethod)), jsxRuntimeExports.jsx(ButtonComponent$1, { tooltip: !showTextbutton ? { title: textEdit !== null && textEdit !== void 0 ? textEdit : 'Edit' } : undefined, icon: jsxRuntimeExports.jsx(RefIcon$a, {}), classNames: classButtonEdit, disabled: disabled, onClick: () => setEditing === null || setEditing === void 0 ? void 0 : setEditing(true), children: showTextbutton ? (textEdit !== null && textEdit !== void 0 ? textEdit : 'Edit') : undefined })] }));
|
|
3898
3898
|
return col ? (jsxRuntimeExports.jsx(antd.Row, { children: jsxRuntimeExports.jsx(antd.Col, Object.assign({}, col, { children: buttonGroup })) })) : buttonGroup;
|
|
3899
3899
|
};
|
|
3900
3900
|
var Component$6 = React.memo(ButtonGroupEditComponent);
|
|
@@ -8392,8 +8392,9 @@ const SelectAsyncComponent = (_a) => {
|
|
|
8392
8392
|
};
|
|
8393
8393
|
var SelectAsyncComponent$1 = React.memo(SelectAsyncComponent);
|
|
8394
8394
|
|
|
8395
|
-
const SwitchComponent = ({ noItem, icon, checkedChildren, unCheckedChildren, loading, disabled, checked, defaultChecked, removeError, onChange, formColLayout, name, label, required, rules,
|
|
8396
|
-
|
|
8395
|
+
const SwitchComponent = ({ noItem, icon, checkedChildren, unCheckedChildren, loading, disabled, value, checked, defaultChecked, removeError, onChange, formColLayout, name, label, required, rules, ruleMessage, validateStatus, help, shouldUpdate, }) => {
|
|
8396
|
+
var _a;
|
|
8397
|
+
const [checkedSwitch, setCheckedSwitch] = React.useState((_a = value !== null && value !== void 0 ? value : defaultChecked) !== null && _a !== void 0 ? _a : false);
|
|
8397
8398
|
const handleChange = (value, event) => {
|
|
8398
8399
|
setCheckedSwitch(value);
|
|
8399
8400
|
removeError === null || removeError === void 0 ? void 0 : removeError(name);
|
|
@@ -8407,7 +8408,7 @@ const SwitchComponent = ({ noItem, icon, checkedChildren, unCheckedChildren, loa
|
|
|
8407
8408
|
unCheckedChildren,
|
|
8408
8409
|
};
|
|
8409
8410
|
const switchComponent = !loading ? (jsxRuntimeExports.jsx(antd.Switch, Object.assign({}, checkChildren, { onChange: handleChange, disabled: disabled, checked: checked !== null && checked !== void 0 ? checked : checkedSwitch, defaultChecked: checked !== null && checked !== void 0 ? checked : checkedSwitch }))) : jsxRuntimeExports.jsx(antd.Skeleton.Input, { active: true });
|
|
8410
|
-
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent$1, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType:
|
|
8411
|
+
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !noItem ? (jsxRuntimeExports.jsx(FormItemComponent$1, Object.assign({}, formColLayout, { name: name, label: label, required: required, ruleType: "boolean", ruleMessage: ruleMessage, rules: rules, valuePropName: "checked", validateStatus: validateStatus, help: help, shouldUpdate: shouldUpdate, children: switchComponent })))
|
|
8411
8412
|
: switchComponent }));
|
|
8412
8413
|
};
|
|
8413
8414
|
var SwitchComponent$1 = React.memo(SwitchComponent);
|