ods-component-lib 1.18.210 → 1.18.211

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 (35) hide show
  1. package/dist/App.d.ts +3 -0
  2. package/dist/components/antd/currencyInput/CurrencySelect.d.ts +3 -0
  3. package/dist/components/antd/currencyInput/OdsCurrencyInput.d.ts +1 -21
  4. package/dist/components/antd/currencyInput/OdsCurrencyInput.stories.d.ts +10 -18
  5. package/dist/components/antd/currencyInput/types.d.ts +26 -0
  6. package/dist/components/antd/modal/OdsAdvanceModal.d.ts +7 -0
  7. package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/ContentHandlers.d.ts +14 -0
  8. package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/EditorPreparedHandlers.d.ts +7 -0
  9. package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/OnExportingHandlers.d.ts +19 -0
  10. package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/OptionHandlers.d.ts +7 -0
  11. package/dist/components/devextreme/OdsInlineEditDataGrid/handlers/SummaryHandlers.d.ts +21 -0
  12. package/dist/components/devextreme/OdsInlineEditDataGrid/partials/ActionCellRender.d.ts +15 -0
  13. package/dist/components/devextreme/OdsInlineEditDataGrid/partials/EditingPartial.d.ts +9 -0
  14. package/dist/components/devextreme/OdsInlineEditDataGrid/partials/PageTitle.d.ts +8 -0
  15. package/dist/components/devextreme/OdsInlineEditDataGrid/utils.d.ts +19 -0
  16. package/dist/components/devextreme/OdsTimeline/OdsTimeline.Constants.d.ts +4 -0
  17. package/dist/components/devextreme/OdsTimeline/OdsTimeline.Functions.d.ts +6 -0
  18. package/dist/components/devextreme/OdsTimeline/OdsTimeline.Types.d.ts +77 -0
  19. package/dist/components/devextreme/OdsTimeline/OdsTimeline.d.ts +5 -0
  20. package/dist/components/devextreme/OdsTimeline/OdsTimelineDateFilter.d.ts +3 -0
  21. package/dist/components/devextreme/OdsTimeline/OdsTimelineSelectionColumn.d.ts +2 -0
  22. package/dist/index.js +90 -68
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.modern.js +90 -68
  25. package/dist/index.modern.js.map +1 -1
  26. package/dist/index.umd.js +2 -0
  27. package/dist/index.umd.js.map +1 -0
  28. package/dist/stories/OdsAdvanceModal/OdsAdvanceModal.stories.d.ts +42 -0
  29. package/dist/stories/OdsAdvanceModal/Samples/BasicOdsAdvanceModal.sample.d.ts +8 -0
  30. package/dist/stories/OdsModal/Samples/OdsModal.Sample.d.ts +1 -0
  31. package/dist/stories/OdsTimePicker/Samples/TimeRangePicker.d.ts +2 -0
  32. package/dist/stories/OdsTimeline/OdsTimeline.Constants.d.ts +3 -0
  33. package/dist/stories/OdsTimeline/OdsTimeline.Functions.d.ts +6 -0
  34. package/dist/stories/OdsTimeline/OdsTimeline.MockData.d.ts +39 -0
  35. package/package.json +1 -1
package/dist/App.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { CurrencySelectProps } from "./types";
3
+ export declare const CurrencySelect: React.FC<CurrencySelectProps>;
@@ -1,27 +1,7 @@
1
1
  import React from "react";
2
- import { InputNumberProps } from "antd";
3
- declare type OdsCurrencyInputResultType = {
4
- value?: number;
5
- currencyId: number;
6
- currencyLabel: string;
7
- };
8
- declare type OdsCurrencyInputProps = InputNumberProps & Omit<CurrencySelectProps, 'onSelect'> & {
9
- onChange?: (result: OdsCurrencyInputResultType) => void;
10
- locale?: string;
11
- };
2
+ import { OdsCurrencyInputProps } from "./types";
12
3
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
13
4
  Wrapper: import("antd-style").SerializedStyles;
14
5
  }>;
15
6
  declare const OdsCurrencyInput: React.FC<OdsCurrencyInputProps>;
16
7
  export default OdsCurrencyInput;
17
- declare type CurrencySelectProps = {
18
- currencyOptions: {
19
- value: number;
20
- label: string;
21
- }[];
22
- onSelect: (currencyId: number, selectedObject?: {
23
- value: number;
24
- label: string;
25
- }) => void;
26
- defaultCurrencyId: number;
27
- };
@@ -1,24 +1,8 @@
1
1
  import React from 'react';
2
+ import { OdsCurrencyInputProps } from './types';
2
3
  declare const _default: {
3
4
  title: string;
4
- component: React.FC<import("antd").InputNumberProps<React.ReactText> & Pick<{
5
- currencyOptions: {
6
- value: number;
7
- label: string;
8
- }[];
9
- onSelect: (currencyId: number, selectedObject?: {
10
- value: number;
11
- label: string;
12
- }) => void;
13
- defaultCurrencyId: number;
14
- }, "currencyOptions" | "defaultCurrencyId"> & {
15
- onChange?: (result: {
16
- value?: number;
17
- currencyId: number;
18
- currencyLabel: string;
19
- }) => void;
20
- locale?: string;
21
- }>;
5
+ component: React.FC<OdsCurrencyInputProps>;
22
6
  argTypes: {
23
7
  placeholder: {
24
8
  control: string;
@@ -27,4 +11,12 @@ declare const _default: {
27
11
  };
28
12
  export default _default;
29
13
  export declare const Default: any;
14
+ export declare const DefaultByCode: any;
30
15
  export declare const EnLocale: any;
16
+ export declare const FixedCurrencyWithDefaultCurrencyId: any;
17
+ export declare const FixedCurrencyDefaultCurrencyCode: any;
18
+ export declare const DontFormatValue: any;
19
+ export declare const DefaultValue: any;
20
+ export declare const DisableNegative: any;
21
+ export declare const DisableZero: any;
22
+ export declare const StyleCurrencySelect: any;
@@ -0,0 +1,26 @@
1
+ import { InputNumberProps, SelectProps } from "antd";
2
+ export declare type OdsCurrencyInputProps = InputNumberProps & {
3
+ onChange?: (result: OdsCurrencyInputResultType) => void;
4
+ locale?: string;
5
+ dontFormatValue?: boolean;
6
+ disableNegative?: boolean;
7
+ defaultValue?: number;
8
+ currencySelectProps: Omit<CurrencySelectProps, 'onSelect'>;
9
+ };
10
+ export declare type OdsCurrencyInputResultType = {
11
+ value?: number | string;
12
+ currency: CurrencyOptionType;
13
+ };
14
+ export declare type CurrencyOptionType = {
15
+ id: number;
16
+ symbol: string;
17
+ name: string;
18
+ code: string;
19
+ };
20
+ export declare type CurrencySelectProps = SelectProps & {
21
+ currencyOptions: CurrencyOptionType[];
22
+ onSelect: (selectedObject?: CurrencyOptionType) => void;
23
+ defaultCurrencyId?: number;
24
+ defaultCurrencyCode?: string;
25
+ fixedCurrency?: boolean;
26
+ };
@@ -0,0 +1,7 @@
1
+ import { ModalProps } from "antd";
2
+ import React from "react";
3
+ export interface ICustomModalProps extends ModalProps {
4
+ content: React.ReactNode;
5
+ }
6
+ declare const OdsAdvanceModal: React.FC<ICustomModalProps>;
7
+ export default OdsAdvanceModal;
@@ -0,0 +1,14 @@
1
+ import { ContentReadyEvent } from "devextreme/ui/data_grid";
2
+ import { IColumnConfig } from "../types";
3
+ /**
4
+ * Custom hook to handle content ready events for the data grid.
5
+ * @param {React.MutableRefObject<any>} lastPageIndexRef - Reference to the last page index.
6
+ * @param {boolean} contentReady - Boolean indicating if the content is ready.
7
+ * @param {Function} setRowCount - Function to set the row count state
8
+ * @param {Function} setContentReady - Function to set the content ready state.
9
+ * @param {Function} setCurrentPage - Function to set the current page state.
10
+ * @param {Function} setCurrentPageSize - Function to set the current page size state.
11
+ * @param {Function} [callback] - Optional callback function.
12
+ * @returns {(e: ContentReadyEvent<any, any>) => void} handleContentReady - Handler for content ready event.
13
+ */
14
+ export declare const useContentHandlers: (lastPageIndexRef: React.MutableRefObject<any>, contentReady: boolean, columns: IColumnConfig[], setRowCount: Function, setContentReady: Function, setCurrentPage: Function, setCurrentPageSize: Function, setHeaderFilterData: Function, callback?: Function) => (e: ContentReadyEvent<any, any>) => void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Custom hook that returns a callback function to handle the "editorPrepared" event of a DevExtreme component.
3
+ * This callback function is responsible for customizing the editor's behavior based on specific conditions.
4
+ *
5
+ * @returns {Function} The callback function to handle the "editorPrepared" event.
6
+ */
7
+ export declare const useEditorPreparedHandlers: () => (e: any) => void;
@@ -0,0 +1,19 @@
1
+ interface IOnExportingProps {
2
+ gridComponent: any;
3
+ baseFileName?: string;
4
+ selectedText?: string;
5
+ getSummary: () => string;
6
+ selectedRowsOnly: boolean;
7
+ }
8
+ /**
9
+ * Handles the exporting of data from the grid component.
10
+ *
11
+ * @param {IOnExportingProps} params - The parameters for exporting the data.
12
+ * @param {React.RefObject<Grid>} params.gridComponent - The reference to the grid component.
13
+ * @param {string} params.baseFileName - The base file name for the exported file.
14
+ * @param {string} params.selectedText - The text to be displayed for selected rows.
15
+ * @param {Function} params.getSummary - The function to get the summary of the exported data.
16
+ * @param {boolean} params.selectedRowsOnly - Indicates whether to export only selected rows.
17
+ */
18
+ export declare const onExporting: ({ gridComponent, baseFileName, selectedText, getSummary, selectedRowsOnly, }: IOnExportingProps) => void;
19
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Custom hook to handle option change events for the data grid.
3
+ * @param {Object} dataGridRef - The dataGridRef property passed to the hook.
4
+ * @param {Function} setFilterApplied - Function to set the filter applied state.
5
+ * @returns {Function} - Handler function for option changed event.
6
+ */
7
+ export declare const useOptionHandlers: (dataGridRef: any, setFilterApplied: any) => (e: any) => void;
@@ -0,0 +1,21 @@
1
+ import type { ISummaryRowOptions } from "../types";
2
+ interface IUseSummaryHandlersProps {
3
+ customSummary?: ISummaryRowOptions;
4
+ totalRecordCount: number;
5
+ currentPageSize: number;
6
+ currentPage: number;
7
+ filterApplied: boolean;
8
+ rowCount: number;
9
+ filteredRowCount: number;
10
+ isServerSide?: boolean;
11
+ }
12
+ /**
13
+ * Custom hook that provides summary handlers for a data grid.
14
+ *
15
+ * @param {IUseSummaryHandlersProps} props - The props object containing necessary parameters.
16
+ * @returns {Object} - An object containing the renderTotal function.
17
+ */
18
+ export declare const useSummaryHandlers: ({ customSummary, totalRecordCount, currentPageSize, currentPage, filterApplied, rowCount, filteredRowCount, }: IUseSummaryHandlersProps) => {
19
+ renderTotal: () => string | null;
20
+ };
21
+ export {};
@@ -0,0 +1,15 @@
1
+ import { FC } from "react";
2
+ import { IVirtualDataGridProps } from "../types";
3
+ interface ActionCellRenderProps {
4
+ cellData: any;
5
+ actionButtons: IVirtualDataGridProps["actionButtonGroup"];
6
+ edit?: IVirtualDataGridProps["edit"];
7
+ actionButtonGroup?: IVirtualDataGridProps["actionButtonGroup"];
8
+ }
9
+ /**
10
+ * Renders the action buttons for a cell in the OdsInlineEditDataGrid component.
11
+ * @param {ActionCellRenderProps} props - The props for the ActionCellRender component.
12
+ * @returns {ReactNode} - The rendered action buttons.
13
+ */
14
+ declare const ActionCellRender: FC<ActionCellRenderProps>;
15
+ export default ActionCellRender;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { IEditingOptions } from "../types";
3
+ /**
4
+ * Component that handles editing functionalities within the data grid.
5
+ * @param {IEditingOptions} props - The properties passed to the component.
6
+ * @returns {JSX.Element} - The JSX element representing the editing handlers.
7
+ */
8
+ declare const EditingPartial: React.FC<IEditingOptions>;
9
+ export default EditingPartial;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { IToolbarButton } from "../types";
3
+ interface PageTitleAndToolbarProps {
4
+ pageTitle?: string;
5
+ toolbarButtonGroup?: IToolbarButton[];
6
+ }
7
+ declare const MemoizedPageTitleAndToolbar: React.NamedExoticComponent<PageTitleAndToolbarProps>;
8
+ export default MemoizedPageTitleAndToolbar;
@@ -0,0 +1,19 @@
1
+ interface IConcatFilteredLabelProps {
2
+ result: string;
3
+ totalLoaded: number;
4
+ filteredRowCount: number;
5
+ filterApplied: boolean;
6
+ summaryFilteredDataLabel: string;
7
+ }
8
+ /**
9
+ * Concatenates the filtered label with the result string.
10
+ *
11
+ * @param {IConcatFilteredLabelProps} props - The object containing the necessary properties.
12
+ * @returns {string} - The concatenated result string.
13
+ */
14
+ export declare const concatFilteredLabel: ({ result, totalLoaded, filteredRowCount, filterApplied, summaryFilteredDataLabel, }: IConcatFilteredLabelProps) => string;
15
+ export {};
16
+ /**
17
+ * This file contains utility functions related to the OdsInlineEditDataGrid component.
18
+ * These utility functions are used for handling filtering and data manipulation.
19
+ */
@@ -0,0 +1,4 @@
1
+ export declare const Constants: {
2
+ timelineDefaultStartDate: Date;
3
+ timelineDefaultEndDate: Date;
4
+ };
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export declare const checkboxCellComponent: (props: any) => React.JSX.Element;
3
+ export declare const statusCellComponent: (props: any) => React.JSX.Element;
4
+ export declare const minimalHeaderCellComponent: (data: any, __el: any) => React.JSX.Element;
5
+ export declare const mapCustomTask: (item: any) => any;
6
+ export declare const setSelectedKeys: (datasource: any[], key?: string, selectedKeys?: number[] | string[]) => any[];
@@ -0,0 +1,77 @@
1
+ /// <reference types="react" />
2
+ import { IColumnProps, IGanttOptions, IItemProps } from "devextreme-react/gantt";
3
+ export interface IMenuLinkItem {
4
+ text: string;
5
+ url: string;
6
+ queryParamNames?: string[];
7
+ }
8
+ export interface ICustomSelectionChange {
9
+ data: any;
10
+ isSelected: boolean;
11
+ }
12
+ export interface IDateRangeChange {
13
+ startDate: Date;
14
+ endDate: Date;
15
+ }
16
+ export interface IStatusColumnChange {
17
+ data: any;
18
+ status: boolean;
19
+ dataField: string;
20
+ }
21
+ export interface ICheckboxColumnChange {
22
+ data: any;
23
+ isChecked: boolean;
24
+ dataField: string;
25
+ }
26
+ export interface IOdsTimelineProps extends React.PropsWithChildren<IGanttOptions> {
27
+ /**
28
+ * Set columns for listview.
29
+ */
30
+ customColumns?: IOdsTimelineColumnProps[];
31
+ /**
32
+ * Set task list. It is used for list view and timeline view.
33
+ */
34
+ customTasks: any[];
35
+ /**
36
+ * Set data field name from task list. This is used for selection.
37
+ */
38
+ customTaskKey?: string;
39
+ /**
40
+ * Set key values to be selected. "multiSelectionEnabled" must be true.
41
+ */
42
+ customSelectedKeys?: string[] | number[];
43
+ /**
44
+ * Set true if you want multi selection in list view.
45
+ */
46
+ multiSelectionEnabled?: boolean;
47
+ /**
48
+ * This is a selection event that fired when selection is changed.
49
+ */
50
+ onCustomSelectionChanged(e: ICustomSelectionChange): void;
51
+ /**
52
+ * This is a date range event that fired when date range is changed.
53
+ */
54
+ onDateRangeChange(e: IDateRangeChange): void;
55
+ }
56
+ export interface IOdsTimelineColumnProps extends IColumnProps {
57
+ isMinimized?: boolean;
58
+ isStatusColumn?: boolean;
59
+ isCheckboxColumn?: boolean;
60
+ }
61
+ export interface IOdsTimelineStatusColumnProps extends IOdsTimelineColumnProps {
62
+ onStatusColumnChange(e: IStatusColumnChange): void;
63
+ }
64
+ export interface IOdsTimelineCheckboxColumnProps extends IOdsTimelineColumnProps {
65
+ onCheckboxColumnChange(e: ICheckboxColumnChange): void;
66
+ }
67
+ export interface IOdsTimelineDateFilter extends IItemProps {
68
+ defaultStartDate?: Date;
69
+ defaultEndDate?: Date;
70
+ backText?: string;
71
+ nextText?: string;
72
+ onFilterRangeChange(e: IDateRangeChange): void;
73
+ }
74
+ export declare const enum DateDirection {
75
+ prevMonth = "previousMonth",
76
+ nextMonth = "nextMonth"
77
+ }
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import "./OdsTimeline.css";
3
+ import { IOdsTimelineProps } from "./OdsTimeline.Types";
4
+ declare const OdsTimeline: (props: IOdsTimelineProps) => React.JSX.Element;
5
+ export default OdsTimeline;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { IOdsTimelineDateFilter } from "./OdsTimeline.Types";
3
+ export declare const OdsTimelineDateFilter: (props: IOdsTimelineDateFilter | Readonly<IOdsTimelineDateFilter>) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { ICustomSelectionChange, IOdsTimelineColumnProps } from "./OdsTimeline.Types";
2
+ export declare const OdsTimelineSelectionColumn: (selectionEvent: (e: ICustomSelectionChange) => void) => IOdsTimelineColumnProps;
package/dist/index.js CHANGED
@@ -35955,7 +35955,36 @@ function OdsTreeSelect(props) {
35955
35955
  }, props)))));
35956
35956
  }
35957
35957
 
35958
- var _excluded$6 = ["currencyOptions", "defaultCurrencyId", "locale", "onChange"];
35958
+ var _excluded$6 = ["currencyOptions", "onSelect", "defaultCurrencyId", "disabled"];
35959
+ var CurrencySelect = function CurrencySelect(_ref) {
35960
+ var currencyOptions = _ref.currencyOptions,
35961
+ onSelect = _ref.onSelect,
35962
+ defaultCurrencyId = _ref.defaultCurrencyId,
35963
+ disabled = _ref.disabled,
35964
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
35965
+ var onSelectHandler = function onSelectHandler(value) {
35966
+ var selectedOption = currencyOptions.find(function (option) {
35967
+ return option.id === Number(value);
35968
+ });
35969
+ onSelect(selectedOption);
35970
+ };
35971
+ return React__default.createElement(antd.Select, Object.assign({
35972
+ disabled: disabled,
35973
+ defaultValue: defaultCurrencyId,
35974
+ onSelect: onSelectHandler
35975
+ }, props), currencyOptions.map(function (option) {
35976
+ return React__default.createElement(antd.Select.Option, {
35977
+ key: "" + option.code,
35978
+ value: option.id
35979
+ }, React__default.createElement(antd.Tooltip, {
35980
+ placement: 'right',
35981
+ title: option.name
35982
+ }, option.symbol));
35983
+ }));
35984
+ };
35985
+
35986
+ var _excluded$7 = ["currencyOptions", "defaultCurrencyId", "defaultCurrencyCode", "fixedCurrency"],
35987
+ _excluded2 = ["currencySelectProps", "defaultValue", "locale", "onChange", "dontFormatValue", "min"];
35959
35988
  var _templateObject$w;
35960
35989
  var useStyles$6 = antdStyle.createStyles(function (_ref) {
35961
35990
  var css = _ref.css;
@@ -35964,91 +35993,84 @@ var useStyles$6 = antdStyle.createStyles(function (_ref) {
35964
35993
  };
35965
35994
  });
35966
35995
  var OdsCurrencyInput = function OdsCurrencyInput(_ref2) {
35967
- var _currencyOptions$find;
35968
- var currencyOptions = _ref2.currencyOptions,
35969
- defaultCurrencyId = _ref2.defaultCurrencyId,
35996
+ var _ref2$currencySelectP = _ref2.currencySelectProps,
35997
+ currencyOptions = _ref2$currencySelectP.currencyOptions,
35998
+ defaultCurrencyId = _ref2$currencySelectP.defaultCurrencyId,
35999
+ defaultCurrencyCode = _ref2$currencySelectP.defaultCurrencyCode,
36000
+ _ref2$currencySelectP2 = _ref2$currencySelectP.fixedCurrency,
36001
+ fixedCurrency = _ref2$currencySelectP2 === void 0 ? false : _ref2$currencySelectP2,
36002
+ currencySelectProps = _objectWithoutPropertiesLoose(_ref2$currencySelectP, _excluded$7),
36003
+ _ref2$defaultValue = _ref2.defaultValue,
36004
+ defaultValue = _ref2$defaultValue === void 0 ? "" : _ref2$defaultValue,
35970
36005
  _ref2$locale = _ref2.locale,
35971
36006
  locale = _ref2$locale === void 0 ? 'tr-TR' : _ref2$locale,
35972
36007
  onChange = _ref2.onChange,
35973
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$6);
36008
+ dontFormatValue = _ref2.dontFormatValue,
36009
+ _ref2$min = _ref2.min,
36010
+ min = _ref2$min === void 0 ? 0 : _ref2$min,
36011
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
35974
36012
  var _useStyles = useStyles$6(),
35975
36013
  styles = _useStyles.styles;
35976
- var _useState = React.useState({
35977
- value: undefined,
35978
- currencyId: defaultCurrencyId,
35979
- currencyLabel: ((_currencyOptions$find = currencyOptions.find(function (option) {
35980
- return option.value === defaultCurrencyId;
35981
- })) === null || _currencyOptions$find === void 0 ? void 0 : _currencyOptions$find.label) || ''
35982
- }),
35983
- result = _useState[0],
35984
- setResult = _useState[1];
36014
+ var defaultCurrency = React.useMemo(function () {
36015
+ return currencyOptions.find(function (option) {
36016
+ return option.id === defaultCurrencyId || option.code === defaultCurrencyCode;
36017
+ });
36018
+ }, [currencyOptions, defaultCurrencyId, defaultCurrencyCode]);
36019
+ var _useState = React.useState(defaultValue),
36020
+ value = _useState[0],
36021
+ setValue = _useState[1];
36022
+ var _useState2 = React.useState(defaultCurrency),
36023
+ currency = _useState2[0],
36024
+ setCurrency = _useState2[1];
35985
36025
  React.useEffect(function () {
35986
- if (result) {
35987
- onChange === null || onChange === void 0 ? void 0 : onChange(result);
36026
+ if (currency && value !== undefined) {
36027
+ onChange === null || onChange === void 0 ? void 0 : onChange({
36028
+ value: value,
36029
+ currency: currency
36030
+ });
35988
36031
  }
35989
- }, [result]);
35990
- var formatValue = function formatValue(value) {
35991
- if (value === undefined || value === null) return '';
35992
- return new Intl.NumberFormat(locale).format(Number(value));
35993
- };
35994
- var parseValue = function parseValue(stringNumber) {
35995
- var thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
35996
- var decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
35997
- return parseFloat(stringNumber.replace(new RegExp('\\' + thousandSeparator, 'g'), '').replace(new RegExp('\\' + decimalSeparator), '.'));
35998
- };
35999
- return React__default.createElement(React__default.Fragment, null, React__default.createElement(styled.ThemeProvider, {
36000
- theme: lightTheme
36001
- }, React__default.createElement(antd.ConfigProvider, {
36002
- theme: {
36003
- components: {}
36032
+ }, [currency, value]);
36033
+ var currencySelector = React.useMemo(function () {
36034
+ if (!currencyOptions || currencyOptions.length === 0) {
36035
+ return undefined;
36036
+ } else if (fixedCurrency) {
36037
+ return defaultCurrency === null || defaultCurrency === void 0 ? void 0 : defaultCurrency.symbol;
36004
36038
  }
36005
- }, React__default.createElement(antd.InputNumber, Object.assign({
36006
- addonAfter: React__default.createElement(CurrencySelect, {
36039
+ return React__default.createElement(CurrencySelect, Object.assign({
36007
36040
  currencyOptions: currencyOptions,
36008
- onSelect: function onSelect(value, selected) {
36009
- setResult(_extends({}, result, {
36010
- currencyId: value,
36011
- currencyLabel: selected.label
36012
- }));
36041
+ onSelect: function onSelect(selected) {
36042
+ return setCurrency(selected);
36013
36043
  },
36014
- defaultCurrencyId: defaultCurrencyId
36015
- }),
36016
- value: result.value,
36044
+ defaultCurrencyId: defaultCurrency === null || defaultCurrency === void 0 ? void 0 : defaultCurrency.id
36045
+ }, currencySelectProps));
36046
+ }, [fixedCurrency, currencyOptions, defaultCurrency]);
36047
+ return React__default.createElement(React__default.Fragment, null, React__default.createElement(styled.ThemeProvider, {
36048
+ theme: lightTheme
36049
+ }, React__default.createElement(antd.InputNumber, Object.assign({
36050
+ defaultValue: defaultValue,
36051
+ min: min,
36052
+ addonBefore: currencySelector,
36053
+ value: value,
36017
36054
  className: styles.Wrapper,
36018
36055
  onChange: function onChange(value) {
36019
- setResult(_extends({}, result, {
36020
- value: value
36021
- }));
36056
+ return setValue(value);
36022
36057
  },
36023
36058
  formatter: function formatter(value) {
36024
- return formatValue(Number(value));
36059
+ return dontFormatValue ? String(value) : formatValue(Number(value), locale);
36025
36060
  },
36026
36061
  parser: function parser(value) {
36027
- return parseValue(value);
36062
+ return dontFormatValue ? value : parseValue(value, locale);
36028
36063
  }
36029
- }, props)))));
36064
+ }, props))));
36030
36065
  };
36031
- var CurrencySelect = function CurrencySelect(_ref3) {
36032
- var currencyOptions = _ref3.currencyOptions,
36033
- _onSelect = _ref3.onSelect,
36034
- defaultCurrencyId = _ref3.defaultCurrencyId;
36035
- return React__default.createElement(antd.Select, {
36036
- defaultValue: defaultCurrencyId,
36037
- style: {
36038
- width: 80
36039
- },
36040
- onSelect: function onSelect(value, selected) {
36041
- _onSelect(Number(value), {
36042
- value: Number(selected.value),
36043
- label: selected.key
36044
- });
36045
- }
36046
- }, currencyOptions.map(function (option) {
36047
- return React__default.createElement(antd.Select.Option, {
36048
- key: option.label,
36049
- value: option.value
36050
- }, option.label);
36051
- }));
36066
+ var formatValue = function formatValue(value, locale) {
36067
+ if (value === undefined || value === null) return '';
36068
+ return new Intl.NumberFormat(locale).format(Number(value));
36069
+ };
36070
+ var parseValue = function parseValue(stringNumber, locale) {
36071
+ var thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
36072
+ var decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
36073
+ return parseFloat(stringNumber.replace(new RegExp('\\' + thousandSeparator, 'g'), '').replace(new RegExp('\\' + decimalSeparator), '.'));
36052
36074
  };
36053
36075
 
36054
36076
  /**