revdev-components 0.155.0 → 0.157.0
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/build/fields/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { SizeType } from "antd/lib/config-provider/SizeContext";
|
|
|
3
3
|
import { RadioGroupProps } from "antd/lib";
|
|
4
4
|
import { ValueOption } from "src/interfaces";
|
|
5
5
|
export interface SwitchButtonControlProps extends Omit<RadioGroupProps, "onChange" | "value"> {
|
|
6
|
-
value?:
|
|
7
|
-
onChange?: (newValue?:
|
|
6
|
+
value?: any;
|
|
7
|
+
onChange?: (newValue?: any) => void;
|
|
8
8
|
options: ValueOption[];
|
|
9
9
|
size?: SizeType;
|
|
10
10
|
}
|
package/build/index.js
CHANGED
|
@@ -5043,6 +5043,25 @@ var AutoCompleteField = function (props) {
|
|
|
5043
5043
|
React.createElement(antd.AutoComplete, __assign({}, controlProps))));
|
|
5044
5044
|
};
|
|
5045
5045
|
|
|
5046
|
+
var SwitchButtonControl = function (_a) {
|
|
5047
|
+
var onChange = _a.onChange, value = _a.value, options = _a.options, rest = __rest(_a, ["onChange", "value", "options"]);
|
|
5048
|
+
var handleChange = React.useCallback(function (newValue) {
|
|
5049
|
+
if (value == newValue) {
|
|
5050
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
|
|
5051
|
+
}
|
|
5052
|
+
else {
|
|
5053
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
5054
|
+
}
|
|
5055
|
+
}, [onChange, value]);
|
|
5056
|
+
return (React.createElement(antd.Radio.Group, __assign({ value: value }, rest), options.map(function (option) { return (React.createElement(antd.Radio.Button, { key: option.value, value: option.value, onClick: function () { return handleChange(option.value); } }, option.label)); })));
|
|
5057
|
+
};
|
|
5058
|
+
|
|
5059
|
+
var SwitchButtonField = function (props) {
|
|
5060
|
+
var _a = useLineProps(props), lineProps = _a[0], _b = _a[1], _c = _b.buttonStyle, buttonStyle = _c === void 0 ? "solid" : _c, _d = _b.optionType, optionType = _d === void 0 ? "button" : _d, controlProps = __rest(_b, ["buttonStyle", "optionType"]);
|
|
5061
|
+
return (React.createElement(FormLine, __assign({}, lineProps),
|
|
5062
|
+
React.createElement(SwitchButtonControl, __assign({ buttonStyle: buttonStyle, optionType: optionType }, controlProps))));
|
|
5063
|
+
};
|
|
5064
|
+
|
|
5046
5065
|
var s$l = {"root":"index-module_root__9GQDU"};
|
|
5047
5066
|
|
|
5048
5067
|
var FormButton = function (_a) {
|
|
@@ -5623,6 +5642,7 @@ exports.SelectField = SelectField;
|
|
|
5623
5642
|
exports.SocialIcon = SocialIcon;
|
|
5624
5643
|
exports.SocialIconNameList = SocialIconNameList;
|
|
5625
5644
|
exports.SplitLine = SplitLine;
|
|
5645
|
+
exports.SwitchButtonField = SwitchButtonField;
|
|
5626
5646
|
exports.SwitchField = SwitchField;
|
|
5627
5647
|
exports.TextAreaField = TextAreaField;
|
|
5628
5648
|
exports.TextUtil = TextUtil;
|