ods-component-lib 1.20.11 → 1.20.12
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CurrencySelectProps } from "./types";
|
|
3
|
-
|
|
3
|
+
declare function CurrencySelect({ currencyOptions, onSelect, defaultValue, disabled, showSymbolForCodes, showSearch, ...props }: CurrencySelectProps): React.JSX.Element;
|
|
4
|
+
export default CurrencySelect;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { InputNumberProps, SelectProps } from "antd";
|
|
2
2
|
export declare type OdsCurrencyInputProps = InputNumberProps & {
|
|
3
|
-
onChange?: (result: number) => void;
|
|
4
3
|
locale?: string;
|
|
5
4
|
dontFormatValue?: boolean;
|
|
6
5
|
disableNegative?: boolean;
|
|
7
|
-
defaultValue?: number;
|
|
6
|
+
defaultValue?: string | number;
|
|
8
7
|
asPercentage?: boolean;
|
|
9
8
|
isOnRight?: boolean;
|
|
10
9
|
fractionDigits?: number;
|
|
11
10
|
currencySelectProps: CurrencySelectProps;
|
|
11
|
+
onChange?: (result: number) => void;
|
|
12
12
|
};
|
|
13
13
|
export declare type CurrencyOptionType = {
|
|
14
14
|
id: number;
|
|
@@ -18,9 +18,11 @@ export declare type CurrencyOptionType = {
|
|
|
18
18
|
};
|
|
19
19
|
export declare type CurrencySelectProps = SelectProps & {
|
|
20
20
|
currencyOptions: CurrencyOptionType[];
|
|
21
|
-
onSelect?: (selectedId: number | null | undefined) => void;
|
|
22
21
|
value?: number;
|
|
23
22
|
defaultCurrencyId?: number;
|
|
24
23
|
defaultCurrencyCode?: string;
|
|
25
24
|
fixedCurrency?: boolean;
|
|
25
|
+
onSelect?: (selectedId: number | null | undefined) => void;
|
|
26
|
+
showSymbolForCodes?: string[];
|
|
27
|
+
showSearch?: boolean;
|
|
26
28
|
};
|
package/dist/index.js
CHANGED
|
@@ -849,22 +849,31 @@ function OdsCollapse(props) {
|
|
|
849
849
|
}
|
|
850
850
|
OdsCollapse.Panel = StyledCollapse.Panel;
|
|
851
851
|
|
|
852
|
-
var _excluded = ["currencyOptions", "onSelect", "defaultValue", "disabled"];
|
|
853
|
-
|
|
852
|
+
var _excluded = ["currencyOptions", "onSelect", "defaultValue", "disabled", "showSymbolForCodes", "showSearch"];
|
|
853
|
+
function CurrencySelect(_ref) {
|
|
854
854
|
var currencyOptions = _ref.currencyOptions,
|
|
855
855
|
_onSelect = _ref.onSelect,
|
|
856
|
+
defaultValue = _ref.defaultValue,
|
|
856
857
|
disabled = _ref.disabled,
|
|
858
|
+
_ref$showSymbolForCod = _ref.showSymbolForCodes,
|
|
859
|
+
showSymbolForCodes = _ref$showSymbolForCod === void 0 ? [] : _ref$showSymbolForCod,
|
|
860
|
+
_ref$showSearch = _ref.showSearch,
|
|
861
|
+
showSearch = _ref$showSearch === void 0 ? false : _ref$showSearch,
|
|
857
862
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
858
|
-
if (!currencyOptions || currencyOptions.length === 0) return
|
|
863
|
+
if (!currencyOptions || currencyOptions.length === 0) return null;
|
|
859
864
|
return React__default.createElement(antd.Select, Object.assign({
|
|
860
865
|
disabled: disabled,
|
|
861
866
|
onSelect: function onSelect(value) {
|
|
862
|
-
return _onSelect(value);
|
|
863
|
-
}
|
|
867
|
+
return _onSelect === null || _onSelect === void 0 ? void 0 : _onSelect(value);
|
|
868
|
+
},
|
|
869
|
+
defaultValue: defaultValue,
|
|
870
|
+
showSearch: showSearch,
|
|
871
|
+
optionFilterProp: "data-code"
|
|
864
872
|
}, props), currencyOptions.map(function (option) {
|
|
865
873
|
return React__default.createElement(antd.Select.Option, {
|
|
866
|
-
key:
|
|
867
|
-
value: option.id
|
|
874
|
+
key: option.code,
|
|
875
|
+
value: option.id,
|
|
876
|
+
"data-code": option.code
|
|
868
877
|
}, React__default.createElement(antd.Tooltip, {
|
|
869
878
|
placement: "right",
|
|
870
879
|
title: option.name
|
|
@@ -872,9 +881,9 @@ var CurrencySelect = function CurrencySelect(_ref) {
|
|
|
872
881
|
style: {
|
|
873
882
|
fontSize: "12px"
|
|
874
883
|
}
|
|
875
|
-
}, option.code)));
|
|
884
|
+
}, showSymbolForCodes.includes(option.code) ? option.symbol : option.code)));
|
|
876
885
|
}));
|
|
877
|
-
}
|
|
886
|
+
}
|
|
878
887
|
|
|
879
888
|
var _excluded$1 = ["currencySelectProps", "defaultValue", "locale", "dontFormatValue", "min", "asPercentage", "isOnRight", "fractionDigits"];
|
|
880
889
|
var _templateObject$d;
|