ods-component-lib 1.18.213 → 1.18.214

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.
@@ -12,6 +12,7 @@ declare const _default: {
12
12
  export default _default;
13
13
  export declare const Default: any;
14
14
  export declare const DefaultByCode: any;
15
+ export declare const DefaultByCurrencyId: any;
15
16
  export declare const EnLocale: any;
16
17
  export declare const FixedCurrencyWithDefaultCurrencyId: any;
17
18
  export declare const FixedCurrencyDefaultCurrencyCode: any;
@@ -1,15 +1,11 @@
1
1
  import { InputNumberProps, SelectProps } from "antd";
2
2
  export declare type OdsCurrencyInputProps = InputNumberProps & {
3
- onChange?: (result: OdsCurrencyInputResultType) => void;
3
+ onChange?: (result: number) => void;
4
4
  locale?: string;
5
5
  dontFormatValue?: boolean;
6
6
  disableNegative?: boolean;
7
7
  defaultValue?: number;
8
- currencySelectProps: Omit<CurrencySelectProps, 'onSelect'>;
9
- };
10
- export declare type OdsCurrencyInputResultType = {
11
- value?: number | string;
12
- currency: CurrencyOptionType;
8
+ currencySelectProps: CurrencySelectProps;
13
9
  };
14
10
  export declare type CurrencyOptionType = {
15
11
  id: number;
@@ -19,7 +15,8 @@ export declare type CurrencyOptionType = {
19
15
  };
20
16
  export declare type CurrencySelectProps = SelectProps & {
21
17
  currencyOptions: CurrencyOptionType[];
22
- onSelect: (selectedObject?: CurrencyOptionType) => void;
18
+ onSelect?: (selectedId: number | null | undefined) => void;
19
+ value?: number;
23
20
  defaultCurrencyId?: number;
24
21
  defaultCurrencyCode?: string;
25
22
  fixedCurrency?: boolean;
@@ -0,0 +1,52 @@
1
+ import type { UploadProps } from "antd";
2
+ import React from "react";
3
+ declare enum FileType {
4
+ Images = 1,
5
+ Icons = 2,
6
+ Docs = 3
7
+ }
8
+ declare enum ModuleType {
9
+ Accounting = 1,
10
+ Agency = 2,
11
+ ExtraService = 3,
12
+ Flight = 4,
13
+ HandlingFee = 5,
14
+ Insurance = 6,
15
+ MasterData = 7,
16
+ Tour = 8,
17
+ Visa = 9,
18
+ Transfer = 10
19
+ }
20
+ interface IValidationMessageOptions {
21
+ sizeValidationFailMessage?: string;
22
+ typeValidationFailMessage?: string;
23
+ }
24
+ interface IUploadRequestModel {
25
+ uid: string;
26
+ file: any;
27
+ fileName: string;
28
+ fileType: FileType;
29
+ moduleType: ModuleType;
30
+ operatorId: number;
31
+ }
32
+ declare type FileUploadProps = {
33
+ image: any | null;
34
+ title: string;
35
+ uploadTitle?: string;
36
+ defaultFileList?: UploadProps["defaultFileList"];
37
+ showUploadList?: UploadProps["showUploadList"];
38
+ allowDocumentUpload?: boolean;
39
+ isMultipleDoc?: boolean;
40
+ removeFile?: (file: any) => void;
41
+ customValidationMessages: IValidationMessageOptions;
42
+ removeTitle?: string;
43
+ removeOkText?: string;
44
+ removeCancelText?: string;
45
+ skipSizeValidation?: boolean;
46
+ maxFileSizeMB?: number;
47
+ moduleType?: number;
48
+ operatorId?: number;
49
+ uploadFile?: (request: IUploadRequestModel) => void;
50
+ };
51
+ declare function OdsFileUploadv2(props: FileUploadProps): React.JSX.Element;
52
+ export default OdsFileUploadv2;
@@ -15,7 +15,7 @@ interface IPagerProps {
15
15
  visible?: boolean;
16
16
  showPageSizeSelector?: boolean;
17
17
  showInfo?: boolean;
18
- displayMode?: 'full' | 'compact';
18
+ displayMode?: "full" | "compact";
19
19
  infoText?: string;
20
20
  }
21
21
  interface IExportProps {
@@ -62,13 +62,17 @@ export interface ISummaryRowOptions {
62
62
  summaryCountLabel?: string;
63
63
  }
64
64
  export declare type IActionButtonsTooltipType = "raw" | "styled";
65
+ export interface IActionButtonGroup extends Partial<IButtonGroup> {
66
+ elementType?: "button" | "element";
67
+ element?: JSX.Element;
68
+ }
65
69
  export interface IVirtualDataGridProps extends IDataGridOptions {
66
70
  columns: IColumnConfig[];
67
71
  sortingProps?: any;
68
72
  pagerProps?: IPagerProps;
69
73
  exportProps?: IExportProps;
70
74
  customSummary?: ISummaryRowOptions;
71
- actionButtonGroup?: IButtonGroup[];
75
+ actionButtonGroup?: IActionButtonGroup[];
72
76
  actionColumnEnable?: boolean;
73
77
  pageTitle?: string;
74
78
  language?: string;
@@ -79,7 +83,7 @@ export interface IVirtualDataGridProps extends IDataGridOptions {
79
83
  columnChooserPositionDisabled?: boolean;
80
84
  dataGridPageName?: string;
81
85
  totalRecordCount: number;
82
- columnResizingMode?: 'nextColumn' | 'widget';
86
+ columnResizingMode?: "nextColumn" | "widget";
83
87
  dataGridRef: any;
84
88
  applyCellRenderToHeaderFilter?: boolean;
85
89
  actionButtonsTooltipType?: IActionButtonsTooltipType;
package/dist/index.d.ts CHANGED
@@ -57,6 +57,7 @@ import OdsInlineEditDataGrid from "./components/devextreme/OdsInlineEditDataGrid
57
57
  import OdsMasterDetailDataGrid from "./components/devextreme/OdsMasterDetailDataGrid/OdsMasterDetailDataGrid";
58
58
  import OdsChange from "./components/antd/change/OdsChange";
59
59
  import OdsProgress from "./components/antd/progress/OdsProgress";
60
+ import OdsFileUploadv2 from "./components/antd/fileUpload/OdsFileUploadv2";
60
61
  export { default as OdsTreeSelect } from "./components/antd/treeSelect/OdsTreeSelect";
61
62
  export { default as OdsCurrencyInput } from "./components/antd/currencyInput/OdsCurrencyInput";
62
63
  export { OdsButton };
@@ -119,3 +120,4 @@ export { OdsChange };
119
120
  export { OdsServerSideDatagrid };
120
121
  export { OdsInlineEditDataGrid };
121
122
  export { OdsProgress };
123
+ export { OdsFileUploadv2 };
package/dist/index.js CHANGED
@@ -35010,29 +35010,33 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35010
35010
  component: cellData.component,
35011
35011
  row: cellData.row
35012
35012
  }) : buttonItem.visible;
35013
- buttonElements.push(React__default.createElement(OdsDataGrdiRowButton, Object.assign({
35014
- key: "action-button-" + index,
35015
- hint: buttonItem.hint,
35016
- visible: isVisible,
35017
- size: "small",
35018
- type: "text",
35019
- disabled: buttonItem.actionPermission === undefined ? false : !buttonItem.actionPermission,
35020
- icon: buttonItem.icon
35021
- }, props.actionButtonsTooltipType === "styled" && {
35022
- tooltip: buttonItem.hint
35023
- }, {
35024
- onClick: function onClick(event) {
35025
- var customEvent = {
35026
- column: cellData.column,
35027
- component: cellData.component,
35028
- element: cellData.element,
35029
- event: event,
35030
- model: cellData.data,
35031
- row: cellData.row
35032
- };
35033
- buttonItem.onClick(customEvent);
35034
- }
35035
- })));
35013
+ if (buttonItem.elementType === "element" && buttonItem.element) {
35014
+ buttonElements.push(buttonItem.element);
35015
+ } else {
35016
+ buttonElements.push(React__default.createElement(OdsDataGrdiRowButton, Object.assign({
35017
+ key: "action-button-" + index,
35018
+ hint: buttonItem.hint,
35019
+ visible: isVisible,
35020
+ size: "small",
35021
+ type: "text",
35022
+ disabled: buttonItem.actionPermission === undefined ? false : !buttonItem.actionPermission,
35023
+ icon: buttonItem.icon
35024
+ }, props.actionButtonsTooltipType === "styled" && {
35025
+ tooltip: buttonItem.hint
35026
+ }, {
35027
+ onClick: function onClick(event) {
35028
+ var customEvent = {
35029
+ column: cellData.column,
35030
+ component: cellData.component,
35031
+ element: cellData.element,
35032
+ event: event,
35033
+ model: cellData.data,
35034
+ row: cellData.row
35035
+ };
35036
+ buttonItem.onClick(customEvent);
35037
+ }
35038
+ })));
35039
+ }
35036
35040
  });
35037
35041
  }
35038
35042
  {
@@ -35932,6 +35936,357 @@ function OdsProgress(props) {
35932
35936
  }, React__default.createElement(StyledProgress, Object.assign({}, props))));
35933
35937
  }
35934
35938
 
35939
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
35940
+ // require the crypto API and do not support built-in fallback to lower quality random number
35941
+ // generators (like Math.random()).
35942
+ var getRandomValues;
35943
+ var rnds8 = new Uint8Array(16);
35944
+ function rng() {
35945
+ // lazy load so that environments that need to polyfill have a chance to do so
35946
+ if (!getRandomValues) {
35947
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
35948
+ // find the complete implementation of crypto (msCrypto) on IE11.
35949
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
35950
+
35951
+ if (!getRandomValues) {
35952
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
35953
+ }
35954
+ }
35955
+
35956
+ return getRandomValues(rnds8);
35957
+ }
35958
+
35959
+ var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
35960
+
35961
+ function validate(uuid) {
35962
+ return typeof uuid === 'string' && REGEX.test(uuid);
35963
+ }
35964
+
35965
+ /**
35966
+ * Convert array of 16 byte values to UUID string format of the form:
35967
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
35968
+ */
35969
+
35970
+ var byteToHex = [];
35971
+
35972
+ for (var i = 0; i < 256; ++i) {
35973
+ byteToHex.push((i + 0x100).toString(16).substr(1));
35974
+ }
35975
+
35976
+ function stringify$1(arr) {
35977
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
35978
+ // Note: Be careful editing this code! It's been tuned for performance
35979
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
35980
+ var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
35981
+ // of the following:
35982
+ // - One or more input array values don't map to a hex octet (leading to
35983
+ // "undefined" in the uuid)
35984
+ // - Invalid input values for the RFC `version` or `variant` fields
35985
+
35986
+ if (!validate(uuid)) {
35987
+ throw TypeError('Stringified UUID is invalid');
35988
+ }
35989
+
35990
+ return uuid;
35991
+ }
35992
+
35993
+ function v4(options, buf, offset) {
35994
+ options = options || {};
35995
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
35996
+
35997
+ rnds[6] = rnds[6] & 0x0f | 0x40;
35998
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
35999
+
36000
+ if (buf) {
36001
+ offset = offset || 0;
36002
+
36003
+ for (var i = 0; i < 16; ++i) {
36004
+ buf[offset + i] = rnds[i];
36005
+ }
36006
+
36007
+ return buf;
36008
+ }
36009
+
36010
+ return stringify$1(rnds);
36011
+ }
36012
+
36013
+ var FileType;
36014
+ (function (FileType) {
36015
+ FileType[FileType["Images"] = 1] = "Images";
36016
+ FileType[FileType["Icons"] = 2] = "Icons";
36017
+ FileType[FileType["Docs"] = 3] = "Docs";
36018
+ })(FileType || (FileType = {}));
36019
+ var ModuleType;
36020
+ (function (ModuleType) {
36021
+ ModuleType[ModuleType["Accounting"] = 1] = "Accounting";
36022
+ ModuleType[ModuleType["Agency"] = 2] = "Agency";
36023
+ ModuleType[ModuleType["ExtraService"] = 3] = "ExtraService";
36024
+ ModuleType[ModuleType["Flight"] = 4] = "Flight";
36025
+ ModuleType[ModuleType["HandlingFee"] = 5] = "HandlingFee";
36026
+ ModuleType[ModuleType["Insurance"] = 6] = "Insurance";
36027
+ ModuleType[ModuleType["MasterData"] = 7] = "MasterData";
36028
+ ModuleType[ModuleType["Tour"] = 8] = "Tour";
36029
+ ModuleType[ModuleType["Visa"] = 9] = "Visa";
36030
+ ModuleType[ModuleType["Transfer"] = 10] = "Transfer";
36031
+ })(ModuleType || (ModuleType = {}));
36032
+ var Text$2 = antd.Typography.Text;
36033
+ function OdsFileUploadv2(props) {
36034
+ var image = props.image,
36035
+ removeFile = props.removeFile,
36036
+ title = props.title,
36037
+ uploadTitle = props.uploadTitle,
36038
+ _props$allowDocumentU = props.allowDocumentUpload,
36039
+ allowDocumentUpload = _props$allowDocumentU === void 0 ? false : _props$allowDocumentU,
36040
+ _props$isMultipleDoc = props.isMultipleDoc,
36041
+ isMultipleDoc = _props$isMultipleDoc === void 0 ? false : _props$isMultipleDoc,
36042
+ customValidationMessages = props.customValidationMessages,
36043
+ removeTitle = props.removeTitle,
36044
+ removeOkText = props.removeOkText,
36045
+ removeCancelText = props.removeCancelText,
36046
+ _props$skipSizeValida = props.skipSizeValidation,
36047
+ skipSizeValidation = _props$skipSizeValida === void 0 ? false : _props$skipSizeValida,
36048
+ _props$maxFileSizeMB = props.maxFileSizeMB,
36049
+ maxFileSizeMB = _props$maxFileSizeMB === void 0 ? 10 : _props$maxFileSizeMB,
36050
+ moduleType = props.moduleType,
36051
+ operatorId = props.operatorId,
36052
+ uploadFile = props.uploadFile;
36053
+ var confirm = antd.Modal.confirm;
36054
+ var _useState = React.useState(false),
36055
+ previewOpen = _useState[0],
36056
+ setPreviewOpen = _useState[1];
36057
+ var _useState2 = React.useState(null),
36058
+ previewImage = _useState2[0],
36059
+ setPreviewImage = _useState2[1];
36060
+ var _useState3 = React.useState([]),
36061
+ fileList = _useState3[0],
36062
+ setFileList = _useState3[1];
36063
+ var _useState4 = React.useState(""),
36064
+ previewFileName = _useState4[0],
36065
+ setPreviewFileName = _useState4[1];
36066
+ React.useEffect(function () {
36067
+ var _props$defaultFileLis;
36068
+ if (((_props$defaultFileLis = props.defaultFileList) === null || _props$defaultFileLis === void 0 ? void 0 : _props$defaultFileLis.length) > 0) {
36069
+ setFileList(function (prev) {
36070
+ return [].concat(props.defaultFileList, prev);
36071
+ });
36072
+ }
36073
+ }, [props.defaultFileList, setFileList]);
36074
+ var uploadProps = {
36075
+ name: "file",
36076
+ accept: allowDocumentUpload ? "image/png,image/jpg,image/jpeg,image/svg+xml,application/pdf,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document" : "image/png,image/jpg,image/jpeg,image/svg+xml",
36077
+ multiple: isMultipleDoc,
36078
+ maxCount: isMultipleDoc ? 10 : 1,
36079
+ listType: "picture-card",
36080
+ type: "select",
36081
+ onPreview: function onPreview(file) {
36082
+ if (isMultipleDoc) {
36083
+ var fileExtension = file.name != "" ? file.name.split(".").pop().toLowerCase() : file.url.split(".").pop().toLowerCase();
36084
+ if (fileExtension === "docx" || fileExtension === "xlsx") {
36085
+ downloadFile(file.url, file.thumbUrl, file.name);
36086
+ setPreviewOpen(false);
36087
+ return;
36088
+ }
36089
+ setPreviewFileName(file.name);
36090
+ }
36091
+ setPreviewImage(file.url || file.thumbUrl || "");
36092
+ handlePreview();
36093
+ },
36094
+ showUploadList: props.showUploadList || {
36095
+ showRemoveIcon: true,
36096
+ showDownloadIcon: true,
36097
+ showPreviewIcon: true
36098
+ },
36099
+ beforeUpload: function (file) {
36100
+ try {
36101
+ var fileType = allowDocumentUpload ? ["image/png", "image/jpg", "image/jpeg", "image/svg+xml", "application/pdf", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] : ["image/png", "image/jpg", "image/jpeg", "image/svg+xml"];
36102
+ var isFileSizeOk = skipSizeValidation ? true : file.size / (1024 * 1024) <= maxFileSizeMB;
36103
+ var checkType = fileType.includes(file.type);
36104
+ if (!checkType) {
36105
+ OdsNotification({
36106
+ title: "",
36107
+ content: customValidationMessages.typeValidationFailMessage,
36108
+ type: "warning",
36109
+ placement: "bottom"
36110
+ });
36111
+ return Promise.resolve(antd.Upload.LIST_IGNORE);
36112
+ }
36113
+ if (!isFileSizeOk) {
36114
+ OdsNotification({
36115
+ title: "",
36116
+ content: customValidationMessages.sizeValidationFailMessage,
36117
+ type: "warning",
36118
+ placement: "bottom"
36119
+ });
36120
+ return Promise.resolve(antd.Upload.LIST_IGNORE);
36121
+ }
36122
+ return Promise.resolve(false);
36123
+ } catch (e) {
36124
+ return Promise.reject(e);
36125
+ }
36126
+ },
36127
+ onChange: function onChange(info) {
36128
+ if (info.fileList) {
36129
+ var updatedFileList = info.fileList.map(function (file) {
36130
+ if (file.originFileObj) {
36131
+ if (!fileList.includes(file.uid)) {
36132
+ uploadFile({
36133
+ uid: file.uid,
36134
+ file: file.originFileObj,
36135
+ fileName: file.name,
36136
+ fileType: getFileType(file.name),
36137
+ moduleType: moduleType,
36138
+ operatorId: operatorId
36139
+ });
36140
+ }
36141
+ }
36142
+ return file;
36143
+ });
36144
+ setFileList(updatedFileList);
36145
+ }
36146
+ },
36147
+ onRemove: function onRemove(file) {
36148
+ confirm({
36149
+ title: removeTitle ? removeTitle : "The image will be deleted, do you confirm?",
36150
+ okText: removeOkText ? removeOkText : "Ok",
36151
+ cancelText: removeCancelText ? removeCancelText : "Cancel",
36152
+ onOk: function onOk() {
36153
+ if (!isMultipleDoc) {
36154
+ setFileList([]);
36155
+ return;
36156
+ }
36157
+ var updatedFileList = fileList.filter(function (item) {
36158
+ return item.uid !== file.uid;
36159
+ });
36160
+ setFileList(updatedFileList);
36161
+ removeFile && removeFile({
36162
+ uid: file.uid,
36163
+ file: file.originFileObj,
36164
+ fileName: file.name,
36165
+ fileType: getFileType(file.name),
36166
+ moduleType: moduleType,
36167
+ operatorId: operatorId
36168
+ });
36169
+ },
36170
+ onCancel: function onCancel() {}
36171
+ });
36172
+ return false;
36173
+ },
36174
+ onDownload: function onDownload(file) {
36175
+ downloadFile(file.url, file.thumbUrl, file.name);
36176
+ },
36177
+ fileList: fileList
36178
+ };
36179
+ var handleCancel = function handleCancel() {
36180
+ return setPreviewOpen(false);
36181
+ };
36182
+ var handlePreview = function handlePreview() {
36183
+ setPreviewOpen(true);
36184
+ };
36185
+ React.useEffect(function () {
36186
+ if (image) {
36187
+ var formattedFiles = isMultipleDoc ? image.map(function (file) {
36188
+ return {
36189
+ uid: file.uid,
36190
+ name: file.filename,
36191
+ status: "done",
36192
+ url: file.url
36193
+ };
36194
+ }) : [{
36195
+ uid: v4(),
36196
+ name: "file",
36197
+ status: "done",
36198
+ url: image
36199
+ }];
36200
+ setFileList(formattedFiles);
36201
+ }
36202
+ }, [image]);
36203
+ var renderPreviewContent = function renderPreviewContent(fileName, previewSrc) {
36204
+ if (previewSrc === null) {
36205
+ return "";
36206
+ }
36207
+ if (!isMultipleDoc) {
36208
+ return React__default.createElement("img", {
36209
+ alt: fileName == "" ? "file" : fileName,
36210
+ style: {
36211
+ width: "100%"
36212
+ },
36213
+ src: previewSrc
36214
+ });
36215
+ } else {
36216
+ var _fileName$split$pop, _previewSrc$split$pop;
36217
+ var fileExtension = fileName !== "" ? (_fileName$split$pop = fileName.split(".").pop()) === null || _fileName$split$pop === void 0 ? void 0 : _fileName$split$pop.toLowerCase() : (_previewSrc$split$pop = previewSrc.split(".").pop()) === null || _previewSrc$split$pop === void 0 ? void 0 : _previewSrc$split$pop.toLowerCase();
36218
+ if (fileExtension === "png" || fileExtension === "jpg" || fileExtension === "jpeg" || fileExtension === "svg") {
36219
+ return React__default.createElement("img", {
36220
+ alt: fileName == "" ? "file" : fileName,
36221
+ style: {
36222
+ width: "100%"
36223
+ },
36224
+ src: previewSrc
36225
+ });
36226
+ } else if (fileExtension === "pdf") {
36227
+ return React__default.createElement("embed", {
36228
+ src: previewSrc,
36229
+ type: "application/pdf",
36230
+ width: "100%",
36231
+ height: "800px"
36232
+ });
36233
+ } else {
36234
+ setPreviewOpen(false);
36235
+ return "";
36236
+ }
36237
+ }
36238
+ };
36239
+ function downloadFile(url, thumbUrl, name) {
36240
+ var base64 = url || thumbUrl;
36241
+ var extension = name ? name.split(".").pop() : url.split(".").pop();
36242
+ var fileName = name || "download." + extension;
36243
+ fetch(base64).then(function (res) {
36244
+ return res.blob();
36245
+ }).then(function (blob) {
36246
+ var blobURL = window.URL.createObjectURL(blob);
36247
+ var link = document.createElement("a");
36248
+ link.href = blobURL;
36249
+ link.setAttribute("download", fileName);
36250
+ document.body.appendChild(link);
36251
+ link.click();
36252
+ document.body.removeChild(link);
36253
+ window.URL.revokeObjectURL(blobURL);
36254
+ })["catch"](function (err) {
36255
+ return console.error("Failed to download file:", err);
36256
+ });
36257
+ }
36258
+ var getFileType = function getFileType(fileName) {
36259
+ var _fileName$split$pop2;
36260
+ var fileExtension = (_fileName$split$pop2 = fileName.split(".").pop()) === null || _fileName$split$pop2 === void 0 ? void 0 : _fileName$split$pop2.toLowerCase();
36261
+ if (fileExtension === "png" || fileExtension === "jpg" || fileExtension === "jpeg") {
36262
+ return FileType.Images;
36263
+ } else if (fileExtension === "svg") {
36264
+ return FileType.Icons;
36265
+ } else {
36266
+ return FileType.Docs;
36267
+ }
36268
+ };
36269
+ return React__default.createElement("div", null, React__default.createElement(Text$2, {
36270
+ style: {
36271
+ lineHeight: 3
36272
+ }
36273
+ }, title), React__default.createElement(antd.Upload, Object.assign({}, uploadProps), (fileList === null || fileList === void 0 ? void 0 : fileList.length) < 10 && React__default.createElement("div", null, React__default.createElement(icons.PlusOutlined, null), React__default.createElement("div", {
36274
+ style: {
36275
+ marginTop: 8
36276
+ }
36277
+ }, uploadTitle ? uploadTitle : "Upload"))), React__default.createElement(antd.Modal, {
36278
+ open: previewOpen,
36279
+ title: null,
36280
+ footer: null,
36281
+ onCancel: handleCancel,
36282
+ width: "100%"
36283
+ }, React__default.createElement("div", {
36284
+ style: {
36285
+ padding: "25px"
36286
+ }
36287
+ }, renderPreviewContent(previewFileName, previewImage))));
36288
+ }
36289
+
35935
36290
  var _templateObject$v;
35936
36291
  var useStyles$5 = antdStyle.createStyles(function (_ref) {
35937
36292
  var css = _ref.css;
@@ -35955,24 +36310,18 @@ function OdsTreeSelect(props) {
35955
36310
  }, props)))));
35956
36311
  }
35957
36312
 
35958
- var _excluded$6 = ["currencyOptions", "onSelect", "defaultCurrencyId", "disabled"];
36313
+ var _excluded$6 = ["currencyOptions", "onSelect", "defaultValue", "disabled"];
35959
36314
  var CurrencySelect = function CurrencySelect(_ref) {
35960
36315
  var currencyOptions = _ref.currencyOptions,
35961
- onSelect = _ref.onSelect,
35962
- defaultCurrencyId = _ref.defaultCurrencyId,
36316
+ _onSelect = _ref.onSelect,
35963
36317
  disabled = _ref.disabled,
35964
36318
  props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
35965
36319
  if (!currencyOptions || currencyOptions.length === 0) return undefined;
35966
- var onSelectHandler = function onSelectHandler(value) {
35967
- var selectedOption = currencyOptions === null || currencyOptions === void 0 ? void 0 : currencyOptions.find(function (option) {
35968
- return option.id === Number(value);
35969
- });
35970
- onSelect(selectedOption);
35971
- };
35972
36320
  return React__default.createElement(antd.Select, Object.assign({
35973
36321
  disabled: disabled,
35974
- defaultValue: defaultCurrencyId,
35975
- onSelect: onSelectHandler
36322
+ onSelect: function onSelect(value) {
36323
+ return _onSelect(value);
36324
+ }
35976
36325
  }, props), currencyOptions.map(function (option) {
35977
36326
  return React__default.createElement(antd.Select.Option, {
35978
36327
  key: "" + option.code,
@@ -35984,7 +36333,7 @@ var CurrencySelect = function CurrencySelect(_ref) {
35984
36333
  }));
35985
36334
  };
35986
36335
 
35987
- var _excluded$7 = ["currencySelectProps", "defaultValue", "locale", "onChange", "dontFormatValue", "min"];
36336
+ var _excluded$7 = ["currencySelectProps", "defaultValue", "locale", "dontFormatValue", "min"];
35988
36337
  var _templateObject$w;
35989
36338
  var useStyles$6 = antdStyle.createStyles(function (_ref) {
35990
36339
  var css = _ref.css;
@@ -35998,7 +36347,6 @@ var OdsCurrencyInput = function OdsCurrencyInput(_ref2) {
35998
36347
  defaultValue = _ref2$defaultValue === void 0 ? "" : _ref2$defaultValue,
35999
36348
  _ref2$locale = _ref2.locale,
36000
36349
  locale = _ref2$locale === void 0 ? 'tr-TR' : _ref2$locale,
36001
- onChange = _ref2.onChange,
36002
36350
  dontFormatValue = _ref2.dontFormatValue,
36003
36351
  _ref2$min = _ref2.min,
36004
36352
  min = _ref2$min === void 0 ? 0 : _ref2$min,
@@ -36011,23 +36359,6 @@ var OdsCurrencyInput = function OdsCurrencyInput(_ref2) {
36011
36359
  return option.id === (currencySelectProps === null || currencySelectProps === void 0 ? void 0 : currencySelectProps.defaultCurrencyId) || option.code === (currencySelectProps === null || currencySelectProps === void 0 ? void 0 : currencySelectProps.defaultCurrencyCode);
36012
36360
  });
36013
36361
  }, [currencySelectProps]);
36014
- var _useState = React.useState(defaultValue),
36015
- value = _useState[0],
36016
- setValue = _useState[1];
36017
- var _useState2 = React.useState(defaultCurrency),
36018
- currency = _useState2[0],
36019
- setCurrency = _useState2[1];
36020
- React.useEffect(function () {
36021
- onChange === null || onChange === void 0 ? void 0 : onChange({
36022
- value: value,
36023
- currency: currency
36024
- });
36025
- }, [currency, value]);
36026
- React.useEffect(function () {
36027
- if (currencySelectProps !== null && currencySelectProps !== void 0 && currencySelectProps.fixedCurrency && defaultCurrency && defaultCurrency.id !== (currency === null || currency === void 0 ? void 0 : currency.id)) {
36028
- setCurrency(defaultCurrency);
36029
- }
36030
- }, [defaultCurrency]);
36031
36362
  var currencySelector = React.useMemo(function () {
36032
36363
  if (!currencySelectProps || !currencySelectProps.currencyOptions || currencySelectProps.currencyOptions.length === 0) {
36033
36364
  return undefined;
@@ -36036,10 +36367,11 @@ var OdsCurrencyInput = function OdsCurrencyInput(_ref2) {
36036
36367
  }
36037
36368
  return React__default.createElement(CurrencySelect, Object.assign({
36038
36369
  currencyOptions: currencySelectProps.currencyOptions,
36039
- onSelect: function onSelect(selected) {
36040
- return setCurrency(selected);
36370
+ onSelect: function onSelect(selectedId) {
36371
+ return currencySelectProps === null || currencySelectProps === void 0 ? void 0 : currencySelectProps.onSelect(selectedId);
36041
36372
  },
36042
- defaultCurrencyId: defaultCurrency === null || defaultCurrency === void 0 ? void 0 : defaultCurrency.id
36373
+ value: currencySelectProps === null || currencySelectProps === void 0 ? void 0 : currencySelectProps.value,
36374
+ defaultValue: defaultCurrency === null || defaultCurrency === void 0 ? void 0 : defaultCurrency.id
36043
36375
  }, currencySelectProps));
36044
36376
  }, [currencySelectProps, defaultCurrency]);
36045
36377
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(styled.ThemeProvider, {
@@ -36048,10 +36380,10 @@ var OdsCurrencyInput = function OdsCurrencyInput(_ref2) {
36048
36380
  defaultValue: defaultValue,
36049
36381
  min: min,
36050
36382
  addonBefore: currencySelector,
36051
- value: value,
36383
+ value: props.value,
36052
36384
  className: styles.Wrapper,
36053
36385
  onChange: function onChange(value) {
36054
- return setValue(value);
36386
+ return props.onChange(value);
36055
36387
  },
36056
36388
  formatter: function formatter(value) {
36057
36389
  return dontFormatValue ? String(value) : formatValue(Number(value), locale);
@@ -37744,6 +38076,7 @@ exports.OdsDivider = OdsDivider;
37744
38076
  exports.OdsDropdown = OdsDropdown;
37745
38077
  exports.OdsDropdownButton = OdsDropdownButton;
37746
38078
  exports.OdsFileUpload = OdsFileUpload;
38079
+ exports.OdsFileUploadv2 = OdsFileUploadv2;
37747
38080
  exports.OdsFilter = OdsFilter;
37748
38081
  exports.OdsFilterTagView = OdsFilterTagView;
37749
38082
  exports.OdsImage = OdsImage;