awing-library 2.1.20 → 2.1.21

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 (92) hide show
  1. package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/AddOrEditRule/RuleForm/RetargetMacAddress/component.js +2 -1
  2. package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/Filter.d.ts +1 -1
  3. package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/Filter.js +2 -2
  4. package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/index.d.ts +1 -1
  5. package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/index.js +2 -2
  6. package/lib/ACM-AXN/CampaignSchedule/Components/RowAdvance/component.js +6 -2
  7. package/lib/ACM-AXN/CampaignSchedule/Components/RowAdvance/container.js +42 -41
  8. package/lib/ACM-AXN/CampaignSchedule/component.js +30 -4
  9. package/lib/ACM-AXN/CampaignSchedule/container.d.ts +1 -1
  10. package/lib/ACM-AXN/CampaignSchedule/container.js +2 -2
  11. package/lib/ACM-AXN/CampaignSchedule/interface.d.ts +3 -0
  12. package/lib/ACM-AXN/GroupUser/User/UserComponent.js +1 -1
  13. package/lib/ACM-AXN/Page/CreateOrEdit/Components/useListPageView.js +9 -4
  14. package/lib/ACM-AXN/Page/CreateOrEdit/Recoil.d.ts +2 -1
  15. package/lib/ACM-AXN/Page/CreateOrEdit/Recoil.js +14 -1
  16. package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/FileUtils.d.ts +3 -1
  17. package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/FileUtils.js +1 -6
  18. package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.d.ts +7 -0
  19. package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.js +13 -15
  20. package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/ViewContent.js +23 -2
  21. package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/ViewInfo.d.ts +3 -2
  22. package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/index.test.js +2 -1
  23. package/lib/ACM-AXN/Page/CreateOrEdit/Utils.d.ts +4 -3
  24. package/lib/ACM-AXN/Page/CreateOrEdit/Utils.js +4 -2
  25. package/lib/ACM-AXN/Page/Types.d.ts +10 -37
  26. package/lib/ACM-AXN/Page/enums.d.ts +6 -0
  27. package/lib/ACM-AXN/Page/enums.js +8 -1
  28. package/lib/ACM-AXN/PlaceFilter/DataTable/container.js +1 -2
  29. package/lib/ACM-AXN/PlaceFilter/Input/container.js +12 -2
  30. package/lib/ACM-AXN/PlaceFilter/common.d.ts +1 -0
  31. package/lib/ACM-AXN/PlaceFilter/common.js +27 -1
  32. package/lib/ACM-AXN/Statistics/ControlPanel.js +4 -4
  33. package/lib/ACM-AXN/Template/Constants.d.ts +0 -0
  34. package/lib/ACM-AXN/Template/Constants.js +1 -0
  35. package/lib/ACM-AXN/Template/Container.d.ts +2 -0
  36. package/lib/ACM-AXN/Template/Container.js +74 -0
  37. package/lib/ACM-AXN/Template/Container.test.d.ts +1 -0
  38. package/lib/ACM-AXN/Template/Container.test.js +259 -0
  39. package/lib/ACM-AXN/Template/CreateOrEdit/CreateOrEdit.test.d.ts +1 -0
  40. package/lib/ACM-AXN/Template/CreateOrEdit/CreateOrEdit.test.js +370 -0
  41. package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.d.ts +9 -0
  42. package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.js +78 -0
  43. package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.test.d.ts +1 -0
  44. package/lib/ACM-AXN/Template/CreateOrEdit/Infomation.test.js +150 -0
  45. package/lib/ACM-AXN/Template/CreateOrEdit/Recoils.d.ts +6 -0
  46. package/lib/ACM-AXN/Template/CreateOrEdit/Recoils.js +79 -0
  47. package/lib/ACM-AXN/Template/CreateOrEdit/Script.d.ts +3 -0
  48. package/lib/ACM-AXN/Template/CreateOrEdit/Script.js +58 -0
  49. package/lib/ACM-AXN/Template/CreateOrEdit/Script.test.d.ts +1 -0
  50. package/lib/ACM-AXN/Template/CreateOrEdit/Script.test.js +162 -0
  51. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Events.d.ts +5 -0
  52. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Events.js +41 -0
  53. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.d.ts +20 -0
  54. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.js +283 -0
  55. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.test.d.ts +1 -0
  56. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Parameter.test.js +220 -0
  57. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Utils.d.ts +25 -0
  58. package/lib/ACM-AXN/Template/CreateOrEdit/Template/Utils.js +138 -0
  59. package/lib/ACM-AXN/Template/CreateOrEdit/Template/index.d.ts +3 -0
  60. package/lib/ACM-AXN/Template/CreateOrEdit/Template/index.js +46 -0
  61. package/lib/ACM-AXN/Template/CreateOrEdit/index.d.ts +3 -0
  62. package/lib/ACM-AXN/Template/CreateOrEdit/index.js +215 -0
  63. package/lib/ACM-AXN/Template/Hooks.d.ts +5 -0
  64. package/lib/ACM-AXN/Template/Hooks.js +13 -0
  65. package/lib/ACM-AXN/Template/Import.d.ts +2 -0
  66. package/lib/ACM-AXN/Template/Import.js +123 -0
  67. package/lib/ACM-AXN/Template/Import.test.d.ts +1 -0
  68. package/lib/ACM-AXN/Template/Import.test.js +188 -0
  69. package/lib/ACM-AXN/Template/Types.d.ts +84 -0
  70. package/lib/ACM-AXN/Template/Types.js +2 -0
  71. package/lib/ACM-AXN/Template/UploadButton.d.ts +2 -0
  72. package/lib/ACM-AXN/Template/UploadButton.js +14 -0
  73. package/lib/ACM-AXN/Template/index.d.ts +5 -0
  74. package/lib/ACM-AXN/Template/index.js +44 -0
  75. package/lib/ACM-AXN/TransactionLog/Container.js +1 -1
  76. package/lib/ACM-AXN/ViewTemplate/index.d.ts +2 -1
  77. package/lib/ACM-AXN/ViewTemplate/interface.d.ts +6 -1
  78. package/lib/AWING/ButtonSelect/index.js +2 -2
  79. package/lib/AWING/DateRangePicker/component.js +101 -132
  80. package/lib/AWING/DateRangePicker/configDate.d.ts +8 -0
  81. package/lib/AWING/DateRangePicker/configDate.js +71 -0
  82. package/lib/AWING/DateRangePicker/interface.d.ts +1 -0
  83. package/lib/AWING/HOC/Wrapper.d.ts +6 -0
  84. package/lib/AWING/HOC/Wrapper.js +10 -0
  85. package/lib/AWING/LogicExpression/script.js +0 -1
  86. package/lib/AWING/PageManagement/PageManagement.js +2 -2
  87. package/lib/AWING/PageManagement/interface.d.ts +1 -2
  88. package/lib/translate/en/translation.json +32 -2
  89. package/lib/translate/vi/translation.json +32 -2
  90. package/package.json +1 -1
  91. package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.test.d.ts +0 -1
  92. package/lib/ACM-AXN/Page/CreateOrEdit/TabFile/index.test.js +0 -326
@@ -0,0 +1,84 @@
1
+ import { DirectoryRoot } from '../../ACM-AXN/Campaign/Enum';
2
+ import { Directory } from '../../ACM-AXN/Campaign/Types';
3
+ import { IDirectory } from '../../ACM-AXN/Directory/interface';
4
+ import { FileParameter, PhysicalFolder, Template } from '../../ACM-AXN/Page/Types';
5
+ import { PageCode } from '../../ACM-AXN/Page/enums';
6
+ import { FileResponse } from '../../Commons/Types';
7
+ export interface ITemplateType {
8
+ id?: number;
9
+ name?: string;
10
+ templateTypeCode?: string;
11
+ }
12
+ export interface ITemplateParameter {
13
+ id?: string;
14
+ templateId?: string;
15
+ fieldName?: string;
16
+ fieldType?: string;
17
+ defaultValue?: string;
18
+ labelName?: string;
19
+ isRequired?: boolean;
20
+ childrens?: ITemplateParameter[];
21
+ isAdvanced?: boolean;
22
+ }
23
+ export interface ITemplateEvent {
24
+ id?: number;
25
+ templateId?: string;
26
+ event?: string;
27
+ }
28
+ export interface ITemplateModel {
29
+ template: ITemplate;
30
+ templateParameters: ITemplateParameter[];
31
+ templateEvents: ITemplateEvent[];
32
+ }
33
+ export interface ITemplate {
34
+ id?: string;
35
+ directoryId?: string;
36
+ directoryPath?: string;
37
+ name?: string;
38
+ templateHtml?: string;
39
+ layoutId?: string;
40
+ pageCode?: string;
41
+ description?: string;
42
+ templateTypeId?: number;
43
+ validation?: string;
44
+ autoField?: string;
45
+ isDeprecated?: boolean;
46
+ }
47
+ export interface ITemplatesPaging {
48
+ templates?: ITemplate[];
49
+ total?: number;
50
+ }
51
+ export interface ITemplateFileService {
52
+ templatesGetDirectories: () => Promise<Directory[]>;
53
+ templateTypesGet: () => Promise<ITemplateType[]>;
54
+ templatesGetByDirectoryId: (directoryId: string) => Promise<Template[]>;
55
+ templatesGet: ITemplateService['templatesGet'];
56
+ pageFilesCreateCreateUpload: (parentDirectoryId: string, code: PageCode, objectId: string, path: string, files: FileParameter[]) => Promise<void>;
57
+ pageFilesUpdateUpload: (code: PageCode, objectId: string, path: string, files: FileParameter[]) => Promise<void>;
58
+ pagesGenerateId: () => Promise<string>;
59
+ pageFilesUpdateGetTreeFolder: (code: PageCode, objectId: string) => Promise<PhysicalFolder>;
60
+ pageFilesCreateGetTreeFolder: (parentDirectoryId: string, code: PageCode, objectId: string) => Promise<PhysicalFolder>;
61
+ pageFilesCreateDownload: (parentDirectoryId: string, code: PageCode, objectId: string, pathFile: string) => Promise<FileResponse>;
62
+ pageFilesUpdateDownload: (code: PageCode, objectId: string, pathFile: string) => Promise<FileResponse>;
63
+ pageFilesUpdateDownloadFolder: (code: PageCode, objectId: string, path: string) => Promise<FileResponse>;
64
+ pageFilesCreateDownloadFolder: (parentDirectoryId: string, code: PageCode, objectId: string, path: string) => Promise<FileResponse>;
65
+ pageFilesCreateCreateFolder: (parentDirectoryId: string, code: PageCode, objectId: string, path: string, name: string) => Promise<void>;
66
+ pageFilesUpdateCreateFolder: (code: PageCode, objectId: string, path: string, name: string) => Promise<void>;
67
+ pageFilesCreateDelete: (parentDirectoryId: string, code: PageCode, objectId: string, path: string) => Promise<void>;
68
+ pageFilesUpdateDelete: (code: PageCode, objectId: string, path: string) => Promise<void>;
69
+ }
70
+ export interface ITemplateService extends ITemplateFileService {
71
+ templatesPaging: (searchString: string | undefined, pageSize: number | undefined, pageIndexc: number | undefined) => Promise<ITemplatesPaging>;
72
+ templatesExport(id: string | undefined): Promise<FileResponse>;
73
+ templatesDelete(id: string): Promise<void>;
74
+ directoriesGetByObjectTypeCode(objectTypeCode: DirectoryRoot): Promise<IDirectory[]>;
75
+ templatesImport(newDirectoryId: string | undefined, id: string | undefined, name: string | undefined, file: FileParameter | undefined): Promise<void>;
76
+ templateTypesGet(): Promise<ITemplateType[]>;
77
+ templatesGet(id: string): Promise<ITemplateModel>;
78
+ directoriesGenerateId(): Promise<string>;
79
+ templatesPut(id: string, body: ITemplateModel): Promise<void>;
80
+ templatesPost(body: ITemplateModel): Promise<void>;
81
+ }
82
+ export interface TemplateProps {
83
+ service: ITemplateService;
84
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ declare const UploadButton: () => import("react/jsx-runtime").JSX.Element;
2
+ export default UploadButton;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var jsx_runtime_1 = require("react/jsx-runtime");
7
+ var CloudUpload_1 = __importDefault(require("@mui/icons-material/CloudUpload"));
8
+ var material_1 = require("@mui/material");
9
+ var react_i18next_1 = require("react-i18next");
10
+ var UploadButton = function () {
11
+ var t = (0, react_i18next_1.useTranslation)().t;
12
+ return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('Common.Upload'), children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", style: { marginTop: '16px' }, children: (0, jsx_runtime_1.jsx)(CloudUpload_1.default, {}) }) }));
13
+ };
14
+ exports.default = UploadButton;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { TemplateProps } from './Types';
3
+ export declare const TemplateFeature: React.FC<TemplateProps>;
4
+ export * from './Types';
5
+ export default TemplateFeature;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.TemplateFeature = void 0;
21
+ var jsx_runtime_1 = require("react/jsx-runtime");
22
+ var Container_1 = __importDefault(require("./Container"));
23
+ var Router_1 = require("../../AWING/Router");
24
+ var react_1 = require("react");
25
+ var Import_1 = __importDefault(require("./Import"));
26
+ var CreateOrEdit_1 = __importDefault(require("./CreateOrEdit"));
27
+ var Constants_1 = require("../../ACM-AXN/GroupUser/Constants");
28
+ var Hooks_1 = require("./Hooks");
29
+ var react_i18next_1 = require("react-i18next");
30
+ var i18n_1 = __importDefault(require("../../i18n"));
31
+ var TemplateFeature = function (props) {
32
+ var paths = [
33
+ { param: Constants_1.IMPORT_PATH, element: Import_1.default },
34
+ { param: Constants_1.CREATE_PATH, element: CreateOrEdit_1.default },
35
+ {
36
+ param: Constants_1.EDIT_PATH + '/:templateId',
37
+ element: CreateOrEdit_1.default,
38
+ },
39
+ ];
40
+ return ((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, { i18n: i18n_1.default, children: (0, jsx_runtime_1.jsxs)(Hooks_1.templatePropsContext.Provider, { value: props, children: [(0, jsx_runtime_1.jsx)(Container_1.default, {}), (0, jsx_runtime_1.jsx)(Router_1.Routes, { children: paths.map(function (p) { return ((0, jsx_runtime_1.jsx)(Router_1.Route, { path: p.param, element: (0, react_1.createElement)(p.element) }, p.param)); }) })] }) }));
41
+ };
42
+ exports.TemplateFeature = TemplateFeature;
43
+ __exportStar(require("./Types"), exports);
44
+ exports.default = exports.TemplateFeature;
@@ -33,7 +33,7 @@ function Container() {
33
33
  var t = (0, react_i18next_1.useTranslation)().t;
34
34
  var service = (0, Hooks_1.default)().service;
35
35
  var transactionType = (0, Context_1.useAwing)().transactionType;
36
- var _a = (0, react_1.useState)(false), loading = _a[0], setLoading = _a[1];
36
+ var _a = (0, react_1.useState)(true), loading = _a[0], setLoading = _a[1];
37
37
  var _b = (0, react_1.useState)(), transactionLog = _b[0], setTransactionLog = _b[1];
38
38
  var _c = (0, react_1.useState)(), users = _c[0], setUsers = _c[1];
39
39
  (0, react_1.useEffect)(function () {
@@ -1,2 +1,3 @@
1
- export declare function ViewTemplate(props: any): import("react/jsx-runtime").JSX.Element;
1
+ import { ViewTemplateProps } from "./interface";
2
+ export declare function ViewTemplate(props: ViewTemplateProps): import("react/jsx-runtime").JSX.Element;
2
3
  export default ViewTemplate;
@@ -1,3 +1,4 @@
1
+ import { PageViewEvent } from "../../ACM-AXN/Page/Types";
1
2
  export interface Configs {
2
3
  TEMPLATE_FILE_PATH?: string;
3
4
  FILE_TEMP_PATH?: string;
@@ -48,6 +49,9 @@ export interface FieldProps {
48
49
  onNotifyError: (errorMessage: string) => void;
49
50
  onUploadFile: (files: any[]) => Promise<string>;
50
51
  }
52
+ export interface ViewTemplateEvents extends Omit<PageViewEvent, 'viewNumber'> {
53
+ protected?: boolean;
54
+ }
51
55
  export interface ViewTemplateProps {
52
56
  templateDatas: FieldInfo[];
53
57
  /**
@@ -90,5 +94,6 @@ export interface ViewTemplateProps {
90
94
  * Hiển thị thông báo lỗi
91
95
  */
92
96
  onNotifyError?: (errorMessage: string) => void;
93
- onUploadFile: (files: any[]) => Promise<string>;
97
+ onUploadFile: (files: any[]) => Promise<any>;
98
+ viewEvents?: ViewTemplateEvents[];
94
99
  }
@@ -59,9 +59,9 @@ var ButtonSelect = function (props) {
59
59
  var handleClose = function () {
60
60
  setAnchorEl(null);
61
61
  };
62
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Button, __assign({ id: "".concat(elementId, "-button-select"), "aria-controls": "".concat(elementId, "-menu"), "aria-haspopup": "true", "aria-expanded": open ? "true" : undefined, onClick: handleClick, endIcon: (0, jsx_runtime_1.jsx)(KeyboardArrowDown_1.default, {}), style: {
62
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, __assign({ id: "".concat(elementId, "-button-select"), "aria-controls": "".concat(elementId, "-menu"), "aria-haspopup": "true", "aria-expanded": open ? "true" : undefined, onClick: handleClick, endIcon: (0, jsx_runtime_1.jsx)(KeyboardArrowDown_1.default, {}), sx: {
63
63
  textTransform: "none",
64
- color: "white",
64
+ color: function (theme) { return theme.palette.text.primary; },
65
65
  fontWeight: "normal",
66
66
  } }, other)), (0, jsx_runtime_1.jsx)(material_1.Menu, { id: "".concat(elementId, "-menu"), anchorEl: anchorEl, open: open, onClose: handleClose, MenuListProps: {
67
67
  "aria-labelledby": "".concat(elementId, "-button-select"),
@@ -49,62 +49,63 @@ var material_1 = require("@mui/material");
49
49
  var icons_material_1 = require("@mui/icons-material");
50
50
  var react_input_mask_1 = __importDefault(require("react-input-mask"));
51
51
  var styles_1 = require("@mui/styles");
52
- var moment = require("moment");
53
- require("moment/locale/vi");
54
- var omit = require("lodash/omit");
52
+ var configDate_1 = __importDefault(require("./configDate"));
53
+ var moment = require('moment');
54
+ require('moment/locale/vi');
55
+ var omit = require('lodash/omit');
55
56
  var useStyles = (0, styles_1.makeStyles)({
56
57
  CustomDateRangePicker_panel: {
57
58
  // width: 250px;
58
- display: "flex",
59
- boxSizing: "border-box",
60
- flexDirection: "column",
61
- padding: "0 8px 11px 22px",
62
- marginTop: "18px",
59
+ display: 'flex',
60
+ boxSizing: 'border-box',
61
+ flexDirection: 'column',
62
+ padding: '0 8px 11px 22px',
63
+ marginTop: '18px',
63
64
  },
64
65
  CustomDateRangePicker_button: {
65
- border: "1px solid",
66
- cursor: "pointer",
67
- userSelect: "none",
68
- backgroundColor: "rgb(255, 255, 255)",
69
- color: "rgb(117, 117, 117)",
70
- borderWidth: "1px",
71
- borderStyle: "solid",
72
- borderColor: "rgb(228, 231, 231)",
73
- borderImage: "initial",
74
- borderRadius: "3px",
75
- padding: "6px",
76
- marginBottom: "13px",
77
- "&:active": {
78
- outline: "none",
79
- borderColor: "#ed1d25",
66
+ border: '1px solid',
67
+ cursor: 'pointer',
68
+ userSelect: 'none',
69
+ backgroundColor: 'rgb(255, 255, 255)',
70
+ color: 'rgb(117, 117, 117)',
71
+ borderWidth: '1px',
72
+ borderStyle: 'solid',
73
+ borderColor: 'rgb(228, 231, 231)',
74
+ borderImage: 'initial',
75
+ borderRadius: '3px',
76
+ padding: '6px',
77
+ marginBottom: '13px',
78
+ '&:active': {
79
+ outline: 'none',
80
+ borderColor: '#ed1d25',
80
81
  },
81
- "&:focus": {
82
- outline: "0",
82
+ '&:focus': {
83
+ outline: '0',
83
84
  },
84
85
  },
85
86
  CustomDateRangePicker_button__selected: {
86
- color: "rgb(255, 255, 255)",
87
- background: "#ed1d25",
87
+ color: 'rgb(255, 255, 255)',
88
+ background: '#ed1d25',
88
89
  },
89
90
  CustomPickerSelected: {
90
- "& .CalendarDay__selected_span": {
91
- background: "rgb(240, 74, 80) !important",
92
- border: "1px double rgb(240, 74, 80) !important",
93
- color: "rgb(255, 255, 255) !important",
91
+ '& .CalendarDay__selected_span': {
92
+ background: 'rgb(240, 74, 80) !important',
93
+ border: '1px double rgb(240, 74, 80) !important',
94
+ color: 'rgb(255, 255, 255) !important',
94
95
  },
95
- "& .CalendarDay__selected": {
96
- background: "rgb(237, 29, 37) !important",
97
- border: "1px double rgb(237, 29, 37) !important",
98
- color: "rgb(255, 255, 255)!important",
96
+ '& .CalendarDay__selected': {
97
+ background: 'rgb(237, 29, 37) !important',
98
+ border: '1px double rgb(237, 29, 37) !important',
99
+ color: 'rgb(255, 255, 255)!important',
99
100
  },
100
- "& .CalendarDay__selected:hover": {
101
- background: "rgb(237, 29, 37) !important",
102
- color: "#ffffff",
101
+ '& .CalendarDay__selected:hover': {
102
+ background: 'rgb(237, 29, 37) !important',
103
+ color: '#ffffff',
103
104
  },
104
- "& .CalendarDay__hovered_span:hover,.CalendarDay__hovered_span": {
105
- background: "rgb(240, 74, 80) !important",
106
- border: "1px double rgb(240, 74, 80) !important",
107
- color: "#ffffff",
105
+ '& .CalendarDay__hovered_span:hover,.CalendarDay__hovered_span': {
106
+ background: 'rgb(240, 74, 80) !important',
107
+ border: '1px double rgb(240, 74, 80) !important',
108
+ color: '#ffffff',
108
109
  },
109
110
  },
110
111
  });
@@ -135,7 +136,7 @@ var defaultProps = {
135
136
  isOutsideRange: function (day) { return false; },
136
137
  isDayHighlighted: function () { return false; },
137
138
  // internationalization
138
- monthFormat: "MMMM YYYY",
139
+ monthFormat: 'MMMM YYYY',
139
140
  label: null,
140
141
  isShowCalendarInfo: false,
141
142
  handleValid: function () { },
@@ -143,7 +144,7 @@ var defaultProps = {
143
144
  };
144
145
  var DateRangePickerWrapper = function (props) {
145
146
  var classes = useStyles();
146
- var value = props.value, error = props.error, helperText = props.helperText, _a = props.autoFocus, autoFocus = _a === void 0 ? false : _a, _b = props.autoFocusEndDate, autoFocusEndDate = _b === void 0 ? false : _b, _c = props.initialStartDate, initialStartDate = _c === void 0 ? null : _c, _d = props.initialEndDate, initialEndDate = _d === void 0 ? null : _d, _e = props.callback, callback = _e === void 0 ? function () { } : _e, _f = props.label, label = _f === void 0 ? null : _f, _g = props.isShowCalendarInfo, isShowCalendarInfo = _g === void 0 ? false : _g, variant = props.variant, openDirection = props.openDirection, _h = props.isDayBlocked, isDayBlocked = _h === void 0 ? function (day) { return false; } : _h, _j = props.handleValid, handleValid = _j === void 0 ? function () { } : _j, _k = props.handleDateRangePopover, handleDateRangePopover = _k === void 0 ? function () { } : _k, disableHelperText = props.disableHelperText;
147
+ var value = props.value, error = props.error, helperText = props.helperText, _a = props.autoFocus, autoFocus = _a === void 0 ? false : _a, _b = props.autoFocusEndDate, autoFocusEndDate = _b === void 0 ? false : _b, _c = props.initialStartDate, initialStartDate = _c === void 0 ? null : _c, _d = props.initialEndDate, initialEndDate = _d === void 0 ? null : _d, _e = props.callback, callback = _e === void 0 ? function () { } : _e, _f = props.label, label = _f === void 0 ? null : _f, _g = props.isShowCalendarInfo, isShowCalendarInfo = _g === void 0 ? false : _g, variant = props.variant, openDirection = props.openDirection, _h = props.isDayBlocked, isDayBlocked = _h === void 0 ? function (day) { return false; } : _h, _j = props.handleValid, handleValid = _j === void 0 ? function () { } : _j, _k = props.handleDateRangePopover, handleDateRangePopover = _k === void 0 ? function () { } : _k, disableHelperText = props.disableHelperText, _l = props.isFutureDate, isFutureDate = _l === void 0 ? false : _l;
147
148
  var initialFocusedInput = null;
148
149
  if (autoFocus) {
149
150
  initialFocusedInput = constants_1.START_DATE;
@@ -151,20 +152,20 @@ var DateRangePickerWrapper = function (props) {
151
152
  else if (autoFocusEndDate) {
152
153
  initialFocusedInput = constants_1.END_DATE;
153
154
  }
154
- var _l = (0, react_1.useState)(initialFocusedInput), focusedInput = _l[0], setFocusedInput = _l[1];
155
- var _m = (0, react_1.useState)(initialStartDate), startDate = _m[0], setStartDate = _m[1];
156
- var _o = (0, react_1.useState)(initialEndDate), endDate = _o[0], setEndDate = _o[1];
157
- var _p = (0, react_1.useState)(true), isValid = _p[0], setIsValid = _p[1];
158
- var _q = (0, react_1.useState)("".concat(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).format("DD/MM/YYYY"), " - ").concat(moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate).format("DD/MM/YYYY"))), inputValue = _q[0], setInputValue = _q[1];
159
- var _r = (0, react_i18next_1.useTranslation)(), i18n = _r.i18n, t = _r.t;
160
- var momentLanguage = (0, react_1.useMemo)(function () { var _a, _b; return ((_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.language) === null || _a === void 0 ? void 0 : _a.split("-")) === null || _b === void 0 ? void 0 : _b[0]) || "en"; }, [i18n.language]);
155
+ var _m = (0, react_1.useState)(initialFocusedInput), focusedInput = _m[0], setFocusedInput = _m[1];
156
+ var _o = (0, react_1.useState)(initialStartDate), startDate = _o[0], setStartDate = _o[1];
157
+ var _p = (0, react_1.useState)(initialEndDate), endDate = _p[0], setEndDate = _p[1];
158
+ var _q = (0, react_1.useState)(true), isValid = _q[0], setIsValid = _q[1];
159
+ var _r = (0, react_1.useState)("".concat(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).format('DD/MM/YYYY'), " - ").concat(moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate).format('DD/MM/YYYY'))), inputValue = _r[0], setInputValue = _r[1];
160
+ var _s = (0, react_i18next_1.useTranslation)(), i18n = _s.i18n, t = _s.t;
161
+ var momentLanguage = (0, react_1.useMemo)(function () { var _a, _b; return ((_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.language) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[0]) || 'en'; }, [i18n.language]);
161
162
  (0, react_1.useEffect)(function () {
162
163
  if (value !== undefined) {
163
- var inputUpdate = "".concat(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).format("DD/MM/YYYY"), " - ").concat(moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate).format("DD/MM/YYYY"));
164
+ var inputUpdate = "".concat(moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate).format('DD/MM/YYYY'), " - ").concat(moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate).format('DD/MM/YYYY'));
164
165
  if (inputUpdate != inputValue) {
165
166
  setInputValue(inputUpdate);
166
- var momentStartDate = moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate, "DD/MM/YYYY", true);
167
- var momentEndDate = moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate, "DD/MM/YYYY", true);
167
+ var momentStartDate = moment(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate, 'DD/MM/YYYY', true);
168
+ var momentEndDate = moment(value ? value === null || value === void 0 ? void 0 : value.endDate : endDate, 'DD/MM/YYYY', true);
168
169
  if (momentStartDate.isValid() &&
169
170
  momentEndDate.isValid() &&
170
171
  momentEndDate.diff(momentStartDate) >= 0) {
@@ -176,7 +177,7 @@ var DateRangePickerWrapper = function (props) {
176
177
  }
177
178
  }, [value]);
178
179
  (0, react_1.useEffect)(function () {
179
- if (momentLanguage !== "en") {
180
+ if (momentLanguage !== 'en') {
180
181
  try {
181
182
  Promise.resolve("".concat("moment/locale/".concat(momentLanguage))).then(function (s) { return __importStar(require(s)); }).then(function () {
182
183
  moment.locale(momentLanguage);
@@ -186,7 +187,7 @@ var DateRangePickerWrapper = function (props) {
186
187
  });
187
188
  }
188
189
  catch (error) {
189
- moment.locale("en");
190
+ moment.locale('en');
190
191
  }
191
192
  }
192
193
  else {
@@ -216,8 +217,8 @@ var DateRangePickerWrapper = function (props) {
216
217
  startDate: startDate,
217
218
  endDate: endDate,
218
219
  });
219
- var momentStartDate = moment(startDate, "DD/MM/YYYY", true);
220
- var momentEndDate = moment(endDate, "DD/MM/YYYY", true);
220
+ var momentStartDate = moment(startDate, 'DD/MM/YYYY', true);
221
+ var momentEndDate = moment(endDate, 'DD/MM/YYYY', true);
221
222
  if (momentStartDate.isValid() &&
222
223
  momentEndDate.isValid() &&
223
224
  momentEndDate.diff(momentStartDate) >= 0) {
@@ -225,7 +226,7 @@ var DateRangePickerWrapper = function (props) {
225
226
  }
226
227
  else
227
228
  setIsValid(false);
228
- setInputValue("".concat(moment(startDate).format("DD/MM/YYYY"), " - ").concat(moment(endDate).format("DD/MM/YYYY")));
229
+ setInputValue("".concat(moment(startDate).format('DD/MM/YYYY'), " - ").concat(moment(endDate).format('DD/MM/YYYY')));
229
230
  };
230
231
  var onFocusChange = function (focusedInput) {
231
232
  setFocusedInput(!focusedInput ? constants_1.START_DATE : focusedInput);
@@ -237,18 +238,18 @@ var DateRangePickerWrapper = function (props) {
237
238
  var handleChangeInput = function (e) {
238
239
  var fieldValue = e.target.value;
239
240
  setInputValue(fieldValue);
240
- var fieldValueArr = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(" - ")) || [];
241
- var year1900 = moment("1900-01-01");
242
- var momentStartDate = moment(fieldValueArr[0], "DD/MM/YYYY");
241
+ var fieldValueArr = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(' - ')) || [];
242
+ var year1900 = moment('1900-01-01');
243
+ var momentStartDate = moment(fieldValueArr[0], 'DD/MM/YYYY');
243
244
  if (momentStartDate.isValid() && momentStartDate.diff(year1900) >= 0) {
244
245
  setStartDate(momentStartDate);
245
246
  }
246
- var momentEndDate = moment(fieldValueArr[1], "DD/MM/YYYY");
247
+ var momentEndDate = moment(fieldValueArr[1], 'DD/MM/YYYY');
247
248
  if (momentEndDate.isValid() && momentEndDate.diff(year1900) >= 0) {
248
249
  setEndDate(momentEndDate);
249
250
  }
250
- if (moment(fieldValueArr[0], "DD/MM/YYYY", true).isValid() &&
251
- moment(fieldValueArr[1], "DD/MM/YYYY", true).isValid() &&
251
+ if (moment(fieldValueArr[0], 'DD/MM/YYYY', true).isValid() &&
252
+ moment(fieldValueArr[1], 'DD/MM/YYYY', true).isValid() &&
252
253
  momentEndDate.diff(momentStartDate) >= 0) {
253
254
  momentStartDate.set({
254
255
  hour: 0,
@@ -269,46 +270,14 @@ var DateRangePickerWrapper = function (props) {
269
270
  setIsValid(false);
270
271
  };
271
272
  var nextProps = __assign({}, props);
272
- var today = moment();
273
- var presets = [
274
- {
275
- text: t("DatePicker.ToDay"),
276
- start: today,
277
- end: today,
278
- },
279
- {
280
- text: t("DatePicker.Yesterday"),
281
- start: moment().subtract(1, "days"),
282
- end: moment().subtract(1, "days"),
283
- },
284
- {
285
- text: t("DatePicker.LastSevenDay"),
286
- start: moment().subtract(6, "days"),
287
- end: today,
288
- },
289
- {
290
- text: t("DatePicker.LastThirtyDay"),
291
- start: moment().subtract(29, "days"),
292
- end: today,
293
- },
294
- {
295
- text: t("DatePicker.ThisMonth"),
296
- start: moment().startOf("month"),
297
- end: moment().endOf("month"),
298
- },
299
- {
300
- text: t("DatePicker.LastMonth"),
301
- start: moment().subtract(1, "month").startOf("month"),
302
- end: moment().subtract(1, "month").endOf("month"),
303
- },
304
- ];
273
+ var presets = (0, configDate_1.default)(t, isFutureDate);
305
274
  var renderDatePresets = function () {
306
275
  return ((0, jsx_runtime_1.jsx)("div", { className: classes.CustomDateRangePicker_panel, children: presets.map(function (_a) {
307
276
  var text = _a.text, start = _a.start, end = _a.end;
308
277
  var isSelected = (0, react_dates_1.isSameDay)(start, value ? value === null || value === void 0 ? void 0 : value.startDate : startDate) && (0, react_dates_1.isSameDay)(end, value ? value === null || value === void 0 ? void 0 : value.endDate : endDate);
309
278
  return ((0, jsx_runtime_1.jsx)("button", { className: "".concat(classes.CustomDateRangePicker_button, " ").concat(isSelected
310
279
  ? classes.CustomDateRangePicker_button__selected
311
- : ""), type: "button", onClick: function () {
280
+ : ''), type: "button", onClick: function () {
312
281
  return controlButtonClick({
313
282
  startDate: start,
314
283
  endDate: end,
@@ -317,36 +286,36 @@ var DateRangePickerWrapper = function (props) {
317
286
  }) }));
318
287
  };
319
288
  nextProps = omit(nextProps, [
320
- "helperText",
321
- "disableHelperText",
322
- "value",
323
- "autoFocus",
324
- "autoFocusEndDate",
325
- "initialStartDate",
326
- "initialEndDate",
327
- "presets",
328
- "callback",
329
- "label",
330
- "error",
331
- "isShowCalendarInfo",
332
- "isValid",
333
- "variant",
334
- "textFieldProps",
335
- "startDatePlaceholderText",
336
- "endDatePlaceholderText",
337
- "openDirection",
338
- "startDateId",
339
- "endDateId",
340
- "anchorDirection",
341
- "verticalSpacing",
342
- "className",
343
- "isDayBlocked",
344
- "handleValid",
345
- "handleDateRangePopover",
289
+ 'helperText',
290
+ 'disableHelperText',
291
+ 'value',
292
+ 'autoFocus',
293
+ 'autoFocusEndDate',
294
+ 'initialStartDate',
295
+ 'initialEndDate',
296
+ 'presets',
297
+ 'callback',
298
+ 'label',
299
+ 'error',
300
+ 'isShowCalendarInfo',
301
+ 'isValid',
302
+ 'variant',
303
+ 'textFieldProps',
304
+ 'startDatePlaceholderText',
305
+ 'endDatePlaceholderText',
306
+ 'openDirection',
307
+ 'startDateId',
308
+ 'endDateId',
309
+ 'anchorDirection',
310
+ 'verticalSpacing',
311
+ 'className',
312
+ 'isDayBlocked',
313
+ 'handleValid',
314
+ 'handleDateRangePopover',
346
315
  ]);
347
- var _s = react_1.default.useState(null), anchorElPopover = _s[0], setAnchorElPopover = _s[1];
316
+ var _t = react_1.default.useState(null), anchorElPopover = _t[0], setAnchorElPopover = _t[1];
348
317
  var openPopper = Boolean(anchorElPopover);
349
- var id = openPopper ? "datePicker-popper" : undefined;
318
+ var id = openPopper ? 'datePicker-popper' : undefined;
350
319
  var popperRef = react_1.default.useRef();
351
320
  var inputRef = react_1.default.useRef();
352
321
  var handleClickInput = function (event) {
@@ -367,11 +336,11 @@ var DateRangePickerWrapper = function (props) {
367
336
  var _a;
368
337
  return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ "aria-describedby": id, variant: variant, label: label, error: !isValid || error, helperText: !disableHelperText
369
338
  ? error
370
- ? helperText || t("Common.InvalidData")
339
+ ? helperText || t('Common.InvalidData')
371
340
  : !isValid
372
- ? t("DatePicker.InvalidDateRange")
373
- : ""
374
- : "" }, omit(props.textFieldProps, ["readOnly"]), { inputProps: {
341
+ ? t('DatePicker.InvalidDateRange')
342
+ : ''
343
+ : '' }, omit(props.textFieldProps, ['readOnly']), { inputProps: {
375
344
  readOnly: (_a = props.textFieldProps) === null || _a === void 0 ? void 0 : _a.readOnly,
376
345
  }, disabled: props.disabled, onClick: function (e) {
377
346
  var _a;
@@ -380,7 +349,7 @@ var DateRangePickerWrapper = function (props) {
380
349
  }, inputRef: inputRef, InputProps: {
381
350
  endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(icons_material_1.CalendarTodaySharp, {}) }) })),
382
351
  } })));
383
- } }), (0, jsx_runtime_1.jsx)(material_1.Popper, { id: id, open: openPopper, anchorEl: anchorElPopover, onClose: handleClosePopover, style: { zIndex: 30000 }, placement: openDirection === "up" ? "top-start" : "bottom-start", popperRef: popperRef, children: (0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: handleClosePopover, children: (0, jsx_runtime_1.jsx)(material_1.Paper, { elevation: 8, className: classes.CustomPickerSelected, children: (0, jsx_runtime_1.jsx)(react_dates_1.DayPickerRangeController, __assign({}, nextProps, { calendarInfoPosition: "before", renderCalendarInfo: isShowCalendarInfo ? renderDatePresets : null, onDatesChange: onDatesChange, onFocusChange: onFocusChange, focusedInput: focusedInput, startDate: value ? value === null || value === void 0 ? void 0 : value.startDate : startDate, endDate: value ? value === null || value === void 0 ? void 0 : value.endDate : endDate, hideKeyboardShortcutsPanel: true, numberOfMonths: 2, daySize: 32, transitionDuration: 0, isDayBlocked: function (day) {
352
+ } }), (0, jsx_runtime_1.jsx)(material_1.Popper, { id: id, open: openPopper, anchorEl: anchorElPopover, onClose: handleClosePopover, style: { zIndex: 30000 }, placement: openDirection === 'up' ? 'top-start' : 'bottom-start', popperRef: popperRef, children: (0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: handleClosePopover, children: (0, jsx_runtime_1.jsx)(material_1.Paper, { elevation: 8, className: classes.CustomPickerSelected, children: (0, jsx_runtime_1.jsx)(react_dates_1.DayPickerRangeController, __assign({}, nextProps, { calendarInfoPosition: "before", renderCalendarInfo: isShowCalendarInfo ? renderDatePresets : null, onDatesChange: onDatesChange, onFocusChange: onFocusChange, focusedInput: focusedInput, startDate: value ? value === null || value === void 0 ? void 0 : value.startDate : startDate, endDate: value ? value === null || value === void 0 ? void 0 : value.endDate : endDate, hideKeyboardShortcutsPanel: true, numberOfMonths: 2, daySize: 32, transitionDuration: 0, isDayBlocked: function (day) {
384
353
  if (value ? value === null || value === void 0 ? void 0 : value.startDate : startDate) {
385
354
  if (isDayBlocked(value ? value === null || value === void 0 ? void 0 : value.startDate : startDate))
386
355
  setIsValid(false);
@@ -0,0 +1,8 @@
1
+ import { TFunction } from 'i18next';
2
+ import moment from 'moment';
3
+ declare const configInitialDate: (t: TFunction<'translation', undefined>, isFutureDate: boolean) => {
4
+ text: string;
5
+ start: moment.Moment;
6
+ end: moment.Moment;
7
+ }[];
8
+ export default configInitialDate;