component-shared 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/Charts/AreaChart.d.ts +19 -0
- package/Components/Charts/AreaChart.js +59 -0
- package/Components/Charts/AreaChart.js.map +1 -0
- package/Components/Charts/BarChart.d.ts +20 -0
- package/Components/Charts/BarChart.js +81 -0
- package/Components/Charts/BarChart.js.map +1 -0
- package/Components/Charts/DoughnutChart.d.ts +12 -0
- package/Components/Charts/DoughnutChart.js +81 -0
- package/Components/Charts/DoughnutChart.js.map +1 -0
- package/Components/Charts/HorizontalBarChart.d.ts +38 -0
- package/Components/Charts/HorizontalBarChart.js +83 -0
- package/Components/Charts/HorizontalBarChart.js.map +1 -0
- package/Components/Charts/LineChart.d.ts +21 -0
- package/Components/Charts/LineChart.js +133 -0
- package/Components/Charts/LineChart.js.map +1 -0
- package/Components/Charts/PieChart.d.ts +20 -0
- package/Components/Charts/PieChart.js +123 -0
- package/Components/Charts/PieChart.js.map +1 -0
- package/Components/Charts/index.d.ts +5 -0
- package/Components/Charts/index.js +6 -0
- package/Components/Charts/index.js.map +1 -0
- package/Components/Charts/type.d.ts +6 -0
- package/Components/Charts/type.js +2 -0
- package/Components/Charts/type.js.map +1 -0
- package/Components/CopyToClipboard/index.d.ts +23 -0
- package/Components/CopyToClipboard/index.js +54 -0
- package/Components/CopyToClipboard/index.js.map +1 -0
- package/Components/CopyToClipboard/indexv2.d.ts +30 -0
- package/Components/CopyToClipboard/indexv2.js +63 -0
- package/Components/CopyToClipboard/indexv2.js.map +1 -0
- package/Components/DropZone/components/DropzoneArea.d.ts +31 -0
- package/Components/DropZone/components/DropzoneArea.js +221 -0
- package/Components/DropZone/components/DropzoneArea.js.map +1 -0
- package/Components/DropZone/components/DropzoneAreaBase.d.ts +4 -0
- package/Components/DropZone/components/DropzoneAreaBase.js +555 -0
- package/Components/DropZone/components/DropzoneAreaBase.js.map +1 -0
- package/Components/DropZone/components/DropzoneDialog.d.ts +33 -0
- package/Components/DropZone/components/DropzoneDialog.js +222 -0
- package/Components/DropZone/components/DropzoneDialog.js.map +1 -0
- package/Components/DropZone/components/DropzoneDialogBase.d.ts +27 -0
- package/Components/DropZone/components/DropzoneDialogBase.js +152 -0
- package/Components/DropZone/components/DropzoneDialogBase.js.map +1 -0
- package/Components/DropZone/components/PreviewList.d.ts +3 -0
- package/Components/DropZone/components/PreviewList.js +132 -0
- package/Components/DropZone/components/PreviewList.js.map +1 -0
- package/Components/DropZone/components/SnackbarContentWrapper.d.ts +3 -0
- package/Components/DropZone/components/SnackbarContentWrapper.js +94 -0
- package/Components/DropZone/components/SnackbarContentWrapper.js.map +1 -0
- package/Components/DropZone/helpers.d.ts +5 -0
- package/Components/DropZone/helpers.js +64 -0
- package/Components/DropZone/helpers.js.map +1 -0
- package/Components/DropZone/index.d.ts +120 -0
- package/Components/EditAvatar/index.d.ts +26 -0
- package/Components/EditAvatar/index.js +137 -0
- package/Components/EditAvatar/index.js.map +1 -0
- package/Components/FlexInfiniteScroll/index.d.ts +26 -0
- package/Components/FlexInfiniteScroll/index.js +82 -0
- package/Components/FlexInfiniteScroll/index.js.map +1 -0
- package/Components/Helper/LazySpinner.d.ts +5 -0
- package/Components/Helper/LazySpinner.js +33 -0
- package/Components/Helper/LazySpinner.js.map +1 -0
- package/Components/Helper/RoleKey.d.ts +9 -0
- package/Components/Helper/RoleKey.js +15 -0
- package/Components/Helper/RoleKey.js.map +1 -0
- package/Components/Helper/index.d.ts +41 -0
- package/Components/Helper/index.js +247 -0
- package/Components/Helper/index.js.map +1 -0
- package/Components/HocLazyView/index.d.ts +51 -0
- package/Components/HocLazyView/index.js +123 -0
- package/Components/HocLazyView/index.js.map +1 -0
- package/Components/HtmlTooltip/index.d.ts +3 -0
- package/Components/HtmlTooltip/index.js +28 -0
- package/Components/HtmlTooltip/index.js.map +1 -0
- package/Components/Icons/index.d.ts +6 -0
- package/Components/Icons/index.js +52 -0
- package/Components/Icons/index.js.map +1 -0
- package/Components/LazySpinner.css +6 -0
- package/Components/MapLayout/index.d.ts +33 -0
- package/Components/MapLayout/index.js +80 -0
- package/Components/MapLayout/index.js.map +1 -0
- package/Components/MessageBox/index.d.ts +28 -0
- package/Components/MessageBox/index.js +93 -0
- package/Components/MessageBox/index.js.map +1 -0
- package/Components/Models/index.d.ts +641 -0
- package/Components/Models/index.js +87 -0
- package/Components/Models/index.js.map +1 -0
- package/Components/Redux/core/CRUDSlice.d.ts +20 -0
- package/Components/Redux/core/CRUDSlice.js +62 -0
- package/Components/Redux/core/CRUDSlice.js.map +1 -0
- package/Components/Redux/core/type.d.ts +11 -0
- package/Components/Redux/core/type.js +9 -0
- package/Components/Redux/core/type.js.map +1 -0
- package/Components/SkeletonLazyView/index.d.ts +9 -0
- package/Components/SkeletonLazyView/index.js +38 -0
- package/Components/SkeletonLazyView/index.js.map +1 -0
- package/Components/SkeletonService/index.d.ts +15 -0
- package/Components/SkeletonService/index.js +57 -0
- package/Components/SkeletonService/index.js.map +1 -0
- package/Components/SubComponent/index.d.ts +151 -0
- package/Components/SubComponent/index.js +883 -0
- package/Components/SubComponent/index.js.map +1 -0
- package/Components/SubComponent/v2/index.d.ts +20 -0
- package/Components/SubComponent/v2/index.js +58 -0
- package/Components/SubComponent/v2/index.js.map +1 -0
- package/Components/SubUserInputModels/ContactInfoForm/index.d.ts +11 -0
- package/Components/SubUserInputModels/ContactInfoForm/index.js +130 -0
- package/Components/SubUserInputModels/ContactInfoForm/index.js.map +1 -0
- package/Components/SubUserInputModels/index.d.ts +59 -0
- package/Components/SubUserInputModels/index.js +928 -0
- package/Components/SubUserInputModels/index.js.map +1 -0
- package/Components/SwitchComponent/index.d.ts +21 -0
- package/Components/SwitchComponent/index.js +71 -0
- package/Components/SwitchComponent/index.js.map +1 -0
- package/Components/TemplateModal/index.d.ts +29 -0
- package/Components/TemplateModal/index.js +94 -0
- package/Components/TemplateModal/index.js.map +1 -0
- package/Components/TemplateTable/FormTest/index.d.ts +4 -0
- package/Components/TemplateTable/FormTest/index.js +22 -0
- package/Components/TemplateTable/FormTest/index.js.map +1 -0
- package/Components/TemplateTable/InputFormBase/index.d.ts +23 -0
- package/Components/TemplateTable/InputFormBase/index.js +111 -0
- package/Components/TemplateTable/InputFormBase/index.js.map +1 -0
- package/Components/TemplateTable/InputFormModal/index.d.ts +22 -0
- package/Components/TemplateTable/InputFormModal/index.js +103 -0
- package/Components/TemplateTable/InputFormModal/index.js.map +1 -0
- package/Components/TemplateTable/ItemRowMenu/index.d.ts +13 -0
- package/Components/TemplateTable/ItemRowMenu/index.js +49 -0
- package/Components/TemplateTable/ItemRowMenu/index.js.map +1 -0
- package/Components/TemplateTable/PanelAction/index.d.ts +11 -0
- package/Components/TemplateTable/PanelAction/index.js +51 -0
- package/Components/TemplateTable/PanelAction/index.js.map +1 -0
- package/Components/TemplateTable/TableContext/index.d.ts +1 -0
- package/Components/TemplateTable/TableContext/index.js +2 -0
- package/Components/TemplateTable/TableContext/index.js.map +1 -0
- package/Components/TemplateTable/helper.d.ts +3 -0
- package/Components/TemplateTable/helper.js +20 -0
- package/Components/TemplateTable/helper.js.map +1 -0
- package/Components/TemplateTable/index.d.ts +49 -0
- package/Components/TemplateTable/index.js +208 -0
- package/Components/TemplateTable/index.js.map +1 -0
- package/Components/UploadLayout/ProgressItem.d.ts +27 -0
- package/Components/UploadLayout/ProgressItem.js +210 -0
- package/Components/UploadLayout/ProgressItem.js.map +1 -0
- package/Components/UploadLayout/UploadArea.d.ts +9 -0
- package/Components/UploadLayout/UploadArea.js +58 -0
- package/Components/UploadLayout/UploadArea.js.map +1 -0
- package/Components/UploadLayout/UploadMonitor.d.ts +42 -0
- package/Components/UploadLayout/UploadMonitor.js +259 -0
- package/Components/UploadLayout/UploadMonitor.js.map +1 -0
- package/Components/UploadLayout/UploadPannel.d.ts +4 -0
- package/Components/UploadLayout/UploadPannel.js +20 -0
- package/Components/UploadLayout/UploadPannel.js.map +1 -0
- package/Components/UploadLayout/UploadStatus.d.ts +21 -0
- package/Components/UploadLayout/UploadStatus.js +184 -0
- package/Components/UploadLayout/UploadStatus.js.map +1 -0
- package/Components/UploadLayout/index.d.ts +69 -0
- package/Components/UploadLayout/index.js +265 -0
- package/Components/UploadLayout/index.js.map +1 -0
- package/Components/UploadLayout/types.d.ts +10 -0
- package/Components/UploadLayout/types.js +2 -0
- package/Components/UploadLayout/types.js.map +1 -0
- package/Components/Views/Billing/BillingForm/index.d.ts +16 -0
- package/Components/Views/Billing/BillingForm/index.js +49 -0
- package/Components/Views/Billing/BillingForm/index.js.map +1 -0
- package/Components/Views/Billing/ItemBillingRowMenu/index.d.ts +23 -0
- package/Components/Views/Billing/ItemBillingRowMenu/index.js +153 -0
- package/Components/Views/Billing/ItemBillingRowMenu/index.js.map +1 -0
- package/Components/Views/Billing/MenuMore/index.d.ts +6 -0
- package/Components/Views/Billing/MenuMore/index.js +89 -0
- package/Components/Views/Billing/MenuMore/index.js.map +1 -0
- package/Components/Views/Billing/SubBillingFormComponent/index.d.ts +14 -0
- package/Components/Views/Billing/SubBillingFormComponent/index.js +306 -0
- package/Components/Views/Billing/SubBillingFormComponent/index.js.map +1 -0
- package/Components/Views/BillingDetail/BillingDetailForm/index.d.ts +16 -0
- package/Components/Views/BillingDetail/BillingDetailForm/index.js +49 -0
- package/Components/Views/BillingDetail/BillingDetailForm/index.js.map +1 -0
- package/Components/Views/BillingDetail/SubComponent/index.d.ts +10 -0
- package/Components/Views/BillingDetail/SubComponent/index.js +152 -0
- package/Components/Views/BillingDetail/SubComponent/index.js.map +1 -0
- package/Components/Views/DashBoard/Common/index.d.ts +18 -0
- package/Components/Views/DashBoard/Common/index.js +55 -0
- package/Components/Views/DashBoard/Common/index.js.map +1 -0
- package/Components/Views/DashBoard/DeliveryInfo/index.d.ts +17 -0
- package/Components/Views/DashBoard/DeliveryInfo/index.js +92 -0
- package/Components/Views/DashBoard/DeliveryInfo/index.js.map +1 -0
- package/Components/Views/DashBoard/OverViewInfo/index.d.ts +29 -0
- package/Components/Views/DashBoard/OverViewInfo/index.js +237 -0
- package/Components/Views/DashBoard/OverViewInfo/index.js.map +1 -0
- package/Components/Views/DashBoard/PanelIntro/index.d.ts +4 -0
- package/Components/Views/DashBoard/PanelIntro/index.js +76 -0
- package/Components/Views/DashBoard/PanelIntro/index.js.map +1 -0
- package/Components/Views/DashBoard/SummaryPanel/index.d.ts +20 -0
- package/Components/Views/DashBoard/SummaryPanel/index.js +229 -0
- package/Components/Views/DashBoard/SummaryPanel/index.js.map +1 -0
- package/Components/Views/DashBoard/TopChannel/index.d.ts +13 -0
- package/Components/Views/DashBoard/TopChannel/index.js +89 -0
- package/Components/Views/DashBoard/TopChannel/index.js.map +1 -0
- package/Components/Views/DashBoard/TopViewTable/index.d.ts +12 -0
- package/Components/Views/DashBoard/TopViewTable/index.js +79 -0
- package/Components/Views/DashBoard/TopViewTable/index.js.map +1 -0
- package/Components/Views/DashBoard/type.d.ts +9 -0
- package/Components/Views/DashBoard/type.js +2 -0
- package/Components/Views/DashBoard/type.js.map +1 -0
- package/Components/Views/Helper/index.d.ts +2 -0
- package/Components/Views/Helper/index.js +10 -0
- package/Components/Views/Helper/index.js.map +1 -0
- package/Components/YoutubeImage/index.d.ts +45 -0
- package/Components/YoutubeImage/index.js +52 -0
- package/Components/YoutubeImage/index.js.map +1 -0
- package/Components/excel-icon-disabled.svg +16 -0
- package/Components/excel-icon.svg +9 -0
- package/Components/index.css +0 -0
- package/Components/index.d.ts +120 -0
- package/ComponentsV2/GlobalModal/index.d.ts +37 -0
- package/ComponentsV2/GlobalModal/index.js +100 -0
- package/ComponentsV2/GlobalModal/index.js.map +1 -0
- package/ComponentsV2/HeightEqualWidth/index.d.ts +8 -0
- package/ComponentsV2/HeightEqualWidth/index.js +41 -0
- package/ComponentsV2/HeightEqualWidth/index.js.map +1 -0
- package/ComponentsV2/LazyView/index.d.ts +6 -0
- package/ComponentsV2/LazyView/index.js +30 -0
- package/ComponentsV2/LazyView/index.js.map +1 -0
- package/ComponentsV2/LoadingAnimation/LoadingSquare.d.ts +3 -0
- package/ComponentsV2/LoadingAnimation/LoadingSquare.js +203 -0
- package/ComponentsV2/LoadingAnimation/LoadingSquare.js.map +1 -0
- package/ComponentsV2/LoadingAnimation/index.d.ts +9 -0
- package/ComponentsV2/LoadingAnimation/index.js +25 -0
- package/ComponentsV2/LoadingAnimation/index.js.map +1 -0
- package/ComponentsV2/TableTemplate/CRUDPannel.d.ts +22 -0
- package/ComponentsV2/TableTemplate/CRUDPannel.js +199 -0
- package/ComponentsV2/TableTemplate/CRUDPannel.js.map +1 -0
- package/ComponentsV2/TableTemplate/CreateTableTemplate.d.ts +60 -0
- package/ComponentsV2/TableTemplate/CreateTableTemplate.js +330 -0
- package/ComponentsV2/TableTemplate/CreateTableTemplate.js.map +1 -0
- package/ComponentsV2/TableTemplate/CustomGridFilterPanel.d.ts +6 -0
- package/ComponentsV2/TableTemplate/CustomGridFilterPanel.js +71 -0
- package/ComponentsV2/TableTemplate/CustomGridFilterPanel.js.map +1 -0
- package/ComponentsV2/TableTemplate/CustomerGridToolbar.d.ts +2 -0
- package/ComponentsV2/TableTemplate/CustomerGridToolbar.js +45 -0
- package/ComponentsV2/TableTemplate/CustomerGridToolbar.js.map +1 -0
- package/ComponentsV2/TableTemplate/ItemRowMenu/index.d.ts +14 -0
- package/ComponentsV2/TableTemplate/ItemRowMenu/index.js +49 -0
- package/ComponentsV2/TableTemplate/ItemRowMenu/index.js.map +1 -0
- package/ComponentsV2/TableTemplate/MapOperators.d.ts +5 -0
- package/ComponentsV2/TableTemplate/MapOperators.js +49 -0
- package/ComponentsV2/TableTemplate/MapOperators.js.map +1 -0
- package/ComponentsV2/TableTemplate/NoRowsOverlay.d.ts +5 -0
- package/ComponentsV2/TableTemplate/NoRowsOverlay.js +39 -0
- package/ComponentsV2/TableTemplate/NoRowsOverlay.js.map +1 -0
- package/ComponentsV2/TableTemplate/TableConverter.d.ts +33 -0
- package/ComponentsV2/TableTemplate/TableConverter.js +112 -0
- package/ComponentsV2/TableTemplate/TableConverter.js.map +1 -0
- package/ComponentsV2/TableTemplate/TableFormatter.d.ts +10 -0
- package/ComponentsV2/TableTemplate/TableFormatter.js +122 -0
- package/ComponentsV2/TableTemplate/TableFormatter.js.map +1 -0
- package/ComponentsV2/TableTemplate/TableTemplateContext.d.ts +16 -0
- package/ComponentsV2/TableTemplate/TableTemplateContext.js +6 -0
- package/ComponentsV2/TableTemplate/TableTemplateContext.js.map +1 -0
- package/ComponentsV2/TableTemplate/index.d.ts +14 -0
- package/ComponentsV2/TableTemplate/index.js +9 -0
- package/ComponentsV2/TableTemplate/index.js.map +1 -0
- package/ComponentsV2/TableTemplate/type.d.ts +59 -0
- package/ComponentsV2/TableTemplate/type.js +14 -0
- package/ComponentsV2/TableTemplate/type.js.map +1 -0
- package/ComponentsV2/index.css +4 -0
- package/ComponentsV2/index.d.ts +4 -0
- package/ComponentsV2/index.js +6 -0
- package/ComponentsV2/index.js.map +1 -0
- package/Services/Getway/RequestHelper.d.ts +2 -0
- package/Services/Getway/RequestHelper.js +51 -0
- package/Services/Getway/RequestHelper.js.map +1 -0
- package/Services/Getway/index.d.ts +3 -0
- package/Services/Getway/index.js +14 -0
- package/Services/Getway/index.js.map +1 -0
- package/Services/ServiceBase.d.ts +32 -0
- package/Services/ServiceBase.js +523 -0
- package/Services/ServiceBase.js.map +1 -0
- package/_virtual/_rollupPluginBabelHelpers.js +393 -0
- package/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/index.css +2 -0
- package/index.css.map +1 -0
- package/package.json +118 -0
- package/types/clipboard-copy.d.ts +6 -0
|
@@ -0,0 +1,883 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray, objectWithoutProperties as _objectWithoutProperties, asyncToGenerator as _asyncToGenerator, regenerator as _regenerator, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useCallback, useRef, useState, useEffect } from 'react';
|
|
4
|
+
import { Box, Typography, Chip, TextField, LinearProgress, InputBase, IconButton, FormControl, InputLabel, Select, Autocomplete, Popper, MenuItem } from '@mui/material';
|
|
5
|
+
import { getErrorMessage } from '../Helper/index.js';
|
|
6
|
+
import * as SubLocal from 'partner-local-lib/SubComponents';
|
|
7
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
8
|
+
import { DatePicker } from '@mui/x-date-pickers';
|
|
9
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
10
|
+
import SearchIcon from '@mui/icons-material/Search';
|
|
11
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
12
|
+
import { KeyExtractor } from 'partner-local-lib/helper';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["title"];
|
|
15
|
+
var ErrorAll = function ErrorAll(props) {
|
|
16
|
+
return jsx(SubLocal.ErrorBox, _objectSpread2(_objectSpread2({
|
|
17
|
+
position: 'Top'
|
|
18
|
+
}, getErrorMessage(props.MessageError, 'All')), {}, {
|
|
19
|
+
children: props.children
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
var BoxInfo = function BoxInfo(props) {
|
|
23
|
+
return jsx(Box, {
|
|
24
|
+
sx: _objectSpread2({
|
|
25
|
+
flex: 1,
|
|
26
|
+
padding: '12px',
|
|
27
|
+
marginBottom: props.mb === false ? '0' : '20px',
|
|
28
|
+
border: 'none!important'
|
|
29
|
+
}, props.sx || {}),
|
|
30
|
+
className: props.IsBorder === false ? '' : 'card',
|
|
31
|
+
children: jsxs(ErrorAll, {
|
|
32
|
+
MessageError: props.MessageError,
|
|
33
|
+
children: [jsxs(Box, {
|
|
34
|
+
sx: _objectSpread2({
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'center'
|
|
37
|
+
}, props.sxTitle || {}),
|
|
38
|
+
children: [jsx(Box, {
|
|
39
|
+
sx: {
|
|
40
|
+
marginRight: '8px'
|
|
41
|
+
},
|
|
42
|
+
children: props.icon
|
|
43
|
+
}), jsx(Typography, {
|
|
44
|
+
variant: props.variant || 'h5',
|
|
45
|
+
component: 'div',
|
|
46
|
+
children: props.title
|
|
47
|
+
}), props.TitleExtends]
|
|
48
|
+
}), props.children]
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
var BoxGroup = function BoxGroup(props) {
|
|
53
|
+
return jsxs(Box, {
|
|
54
|
+
sx: _objectSpread2({
|
|
55
|
+
flex: 1,
|
|
56
|
+
padding: '10px',
|
|
57
|
+
marginBottom: props.mb === false ? '0' : '20px'
|
|
58
|
+
}, props.sx || {}),
|
|
59
|
+
className: props.IsBorder === true ? 'card' : '',
|
|
60
|
+
children: [jsxs(Box, {
|
|
61
|
+
sx: _objectSpread2({
|
|
62
|
+
display: 'flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
gap: '6px'
|
|
65
|
+
}, props.sxTitle || {}),
|
|
66
|
+
children: [jsx(Box, {
|
|
67
|
+
sx: {
|
|
68
|
+
margin: 0
|
|
69
|
+
},
|
|
70
|
+
children: props.icon
|
|
71
|
+
}), jsx(Typography, {
|
|
72
|
+
variant: props.variant || 'h6',
|
|
73
|
+
component: 'div',
|
|
74
|
+
children: props.title
|
|
75
|
+
}), props.TitleExtends]
|
|
76
|
+
}), props.children]
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
var WrapFrom = function WrapFrom(props) {
|
|
80
|
+
return props.IsForm === false ? jsx(Fragment, {
|
|
81
|
+
children: props.children
|
|
82
|
+
}) : jsx("form", {
|
|
83
|
+
id: props.Id,
|
|
84
|
+
onSubmit: props.onSubmit,
|
|
85
|
+
children: props.children
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
var CreateSelect2 = function CreateSelect2() {
|
|
89
|
+
var Select2 = function Select2(props) {
|
|
90
|
+
var abortController = React__default.useRef({
|
|
91
|
+
signalController: new AbortController()
|
|
92
|
+
});
|
|
93
|
+
var _React$useState = React__default.useState(true),
|
|
94
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
95
|
+
isInitial = _React$useState2[0],
|
|
96
|
+
setIsInitial = _React$useState2[1];
|
|
97
|
+
var _React$useState3 = React__default.useState([]),
|
|
98
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
99
|
+
data = _React$useState4[0],
|
|
100
|
+
setData = _React$useState4[1];
|
|
101
|
+
var _React$useState5 = React__default.useState('no items'),
|
|
102
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
103
|
+
statusText = _React$useState6[0],
|
|
104
|
+
setStatusText = _React$useState6[1];
|
|
105
|
+
var selectedItem = React__default.useRef(props.selectedItem);
|
|
106
|
+
var refInput = useRef(null);
|
|
107
|
+
var timer = React__default.useRef({
|
|
108
|
+
_timer: 0,
|
|
109
|
+
_second: 500,
|
|
110
|
+
// _isMount: true,
|
|
111
|
+
// executed: function (action: any) {
|
|
112
|
+
// if (this._isMount) {
|
|
113
|
+
// action()
|
|
114
|
+
// }
|
|
115
|
+
// },
|
|
116
|
+
callback: function () {
|
|
117
|
+
var _callback = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(value) {
|
|
118
|
+
var _abortController$curr, dataTmp, _t;
|
|
119
|
+
return _regenerator().w(function (_context) {
|
|
120
|
+
while (1) switch (_context.n) {
|
|
121
|
+
case 0:
|
|
122
|
+
_context.p = 0;
|
|
123
|
+
if (abortController.current) {
|
|
124
|
+
abortController.current.signalController = new AbortController();
|
|
125
|
+
}
|
|
126
|
+
_context.n = 1;
|
|
127
|
+
return props.fetchData(value, (_abortController$curr = abortController.current) === null || _abortController$curr === void 0 ? void 0 : _abortController$curr.signalController.signal);
|
|
128
|
+
case 1:
|
|
129
|
+
dataTmp = _context.v;
|
|
130
|
+
setData(dataTmp);
|
|
131
|
+
_context.n = 3;
|
|
132
|
+
break;
|
|
133
|
+
case 2:
|
|
134
|
+
_context.p = 2;
|
|
135
|
+
_t = _context.v;
|
|
136
|
+
console.log(_t);
|
|
137
|
+
case 3:
|
|
138
|
+
_context.p = 3;
|
|
139
|
+
setStatusText('no items');
|
|
140
|
+
return _context.f(3);
|
|
141
|
+
case 4:
|
|
142
|
+
return _context.a(2);
|
|
143
|
+
}
|
|
144
|
+
}, _callee, null, [[0, 2, 3, 4]]);
|
|
145
|
+
}));
|
|
146
|
+
function callback(_x) {
|
|
147
|
+
return _callback.apply(this, arguments);
|
|
148
|
+
}
|
|
149
|
+
return callback;
|
|
150
|
+
}(),
|
|
151
|
+
start: function start(text) {
|
|
152
|
+
this._timer = window.setTimeout(this.callback, this._second, text);
|
|
153
|
+
},
|
|
154
|
+
clear: function clear() {
|
|
155
|
+
var _abortController$curr2;
|
|
156
|
+
(_abortController$curr2 = abortController.current) === null || _abortController$curr2 === void 0 || _abortController$curr2.signalController.abort();
|
|
157
|
+
clearTimeout(this._timer);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
var Onchange = React__default.useCallback(function (event) {
|
|
161
|
+
var _timer$current, _timer$current2;
|
|
162
|
+
setStatusText('Loading...');
|
|
163
|
+
(_timer$current = timer.current) === null || _timer$current === void 0 || _timer$current.clear();
|
|
164
|
+
(_timer$current2 = timer.current) === null || _timer$current2 === void 0 || _timer$current2.start(event.target.value);
|
|
165
|
+
}, []);
|
|
166
|
+
var OnChangeValue = React__default.useCallback(function (event, option) {
|
|
167
|
+
if (refInput.current) {
|
|
168
|
+
refInput.current.value = option ? props.SelectValue(option) : null;
|
|
169
|
+
if (!option) {
|
|
170
|
+
var _timer$current3, _timer$current4;
|
|
171
|
+
(_timer$current3 = timer.current) === null || _timer$current3 === void 0 || _timer$current3.clear();
|
|
172
|
+
(_timer$current4 = timer.current) === null || _timer$current4 === void 0 || _timer$current4.start('');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
props.Onchange && props.Onchange(option);
|
|
176
|
+
}, [props]);
|
|
177
|
+
React__default.useEffect(function () {
|
|
178
|
+
var mounted = true;
|
|
179
|
+
var fetchInitial = /*#__PURE__*/function () {
|
|
180
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
181
|
+
var _abortController$curr3, _data, search, Tmp, _t2;
|
|
182
|
+
return _regenerator().w(function (_context2) {
|
|
183
|
+
while (1) switch (_context2.n) {
|
|
184
|
+
case 0:
|
|
185
|
+
_context2.p = 0;
|
|
186
|
+
_context2.n = 1;
|
|
187
|
+
return props.fetchData(props.defaultValue, (_abortController$curr3 = abortController.current) === null || _abortController$curr3 === void 0 ? void 0 : _abortController$curr3.signalController.signal);
|
|
188
|
+
case 1:
|
|
189
|
+
_data = _context2.v;
|
|
190
|
+
if (!(!Array.isArray(_data) || !mounted)) {
|
|
191
|
+
_context2.n = 2;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
return _context2.a(2);
|
|
195
|
+
case 2:
|
|
196
|
+
setData(_data);
|
|
197
|
+
search = props.searchInitial ? props.searchInitial : function (x) {
|
|
198
|
+
return props.SelectValue(x) === props.defaultValue;
|
|
199
|
+
};
|
|
200
|
+
Tmp = _data.find(search);
|
|
201
|
+
if (Tmp) {
|
|
202
|
+
Object.assign(selectedItem.current, Tmp);
|
|
203
|
+
}
|
|
204
|
+
props.onReady && props.onReady(Tmp);
|
|
205
|
+
_context2.n = 4;
|
|
206
|
+
break;
|
|
207
|
+
case 3:
|
|
208
|
+
_context2.p = 3;
|
|
209
|
+
_t2 = _context2.v;
|
|
210
|
+
console.log(_t2);
|
|
211
|
+
case 4:
|
|
212
|
+
_context2.p = 4;
|
|
213
|
+
if (mounted) {
|
|
214
|
+
_context2.n = 5;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
return _context2.a(2);
|
|
218
|
+
case 5:
|
|
219
|
+
setStatusText('no items');
|
|
220
|
+
setIsInitial(false);
|
|
221
|
+
return _context2.f(4);
|
|
222
|
+
case 6:
|
|
223
|
+
return _context2.a(2);
|
|
224
|
+
}
|
|
225
|
+
}, _callee2, null, [[0, 3, 4, 6]]);
|
|
226
|
+
}));
|
|
227
|
+
return function fetchInitial() {
|
|
228
|
+
return _ref.apply(this, arguments);
|
|
229
|
+
};
|
|
230
|
+
}();
|
|
231
|
+
if (isInitial) {
|
|
232
|
+
fetchInitial();
|
|
233
|
+
}
|
|
234
|
+
return function () {
|
|
235
|
+
mounted = false;
|
|
236
|
+
};
|
|
237
|
+
}, [isInitial, props]);
|
|
238
|
+
return jsxs(Fragment, {
|
|
239
|
+
children: [jsx(Autocomplete, {
|
|
240
|
+
fullWidth: props.fullWidth,
|
|
241
|
+
options: data,
|
|
242
|
+
autoHighlight: true,
|
|
243
|
+
disabled: isInitial || props.disabled,
|
|
244
|
+
getOptionLabel: props.GenerateLabel,
|
|
245
|
+
isOptionEqualToValue: props.isOptionEqualToValue,
|
|
246
|
+
defaultValue: selectedItem.current,
|
|
247
|
+
onChange: OnChangeValue,
|
|
248
|
+
noOptionsText: statusText,
|
|
249
|
+
PopperComponent: function PopperComponent(p) {
|
|
250
|
+
return jsx(Popper, _objectSpread2(_objectSpread2({}, p), {}, {
|
|
251
|
+
style: _objectSpread2(_objectSpread2({}, p.style || {}), props.PopperStyle || {})
|
|
252
|
+
}));
|
|
253
|
+
},
|
|
254
|
+
renderInput: function renderInput(params) {
|
|
255
|
+
return jsx(TextField, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
256
|
+
label: props.title || 'title',
|
|
257
|
+
onChange: Onchange,
|
|
258
|
+
onBlur: props.onBlur,
|
|
259
|
+
error: props.error,
|
|
260
|
+
helperText: props.message,
|
|
261
|
+
autoComplete: 'off',
|
|
262
|
+
size: props.size,
|
|
263
|
+
inputProps: _objectSpread2(_objectSpread2({}, params.inputProps), {}, {
|
|
264
|
+
autoComplete: 'off' // disable autocomplete and autofill,
|
|
265
|
+
})
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
}), jsx("input", {
|
|
269
|
+
ref: refInput,
|
|
270
|
+
defaultValue: props.defaultValue,
|
|
271
|
+
hidden: true,
|
|
272
|
+
name: props.name
|
|
273
|
+
})]
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
return Select2;
|
|
277
|
+
};
|
|
278
|
+
var CreateMultipleSelect = function CreateMultipleSelect() {
|
|
279
|
+
var Select2 = function Select2(props) {
|
|
280
|
+
var cancelToken = React__default.useRef({
|
|
281
|
+
Token: new AbortController()
|
|
282
|
+
});
|
|
283
|
+
var _React$useState7 = React__default.useState(true),
|
|
284
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
285
|
+
isInitial = _React$useState8[0],
|
|
286
|
+
setIsInitial = _React$useState8[1];
|
|
287
|
+
var _React$useState9 = React__default.useState([]),
|
|
288
|
+
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
289
|
+
data = _React$useState0[0],
|
|
290
|
+
setData = _React$useState0[1];
|
|
291
|
+
var _React$useState1 = React__default.useState('no items'),
|
|
292
|
+
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
293
|
+
statusText = _React$useState10[0],
|
|
294
|
+
setStatusText = _React$useState10[1];
|
|
295
|
+
var selectedItem = React__default.useRef(props.selectedItem);
|
|
296
|
+
var refInput = useRef(null);
|
|
297
|
+
var timer = React__default.useRef({
|
|
298
|
+
_timer: 0,
|
|
299
|
+
_second: 500,
|
|
300
|
+
// _isMount: true,
|
|
301
|
+
// executed: function (action: any) {
|
|
302
|
+
// if (this._isMount) {
|
|
303
|
+
// action()
|
|
304
|
+
// }
|
|
305
|
+
// },
|
|
306
|
+
callback: function () {
|
|
307
|
+
var _callback2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(value) {
|
|
308
|
+
var _cancelToken$current, dataTmp, _t3;
|
|
309
|
+
return _regenerator().w(function (_context3) {
|
|
310
|
+
while (1) switch (_context3.n) {
|
|
311
|
+
case 0:
|
|
312
|
+
_context3.p = 0;
|
|
313
|
+
if (cancelToken.current) {
|
|
314
|
+
cancelToken.current.Token = new AbortController();
|
|
315
|
+
}
|
|
316
|
+
_context3.n = 1;
|
|
317
|
+
return props.fetchData(value, (_cancelToken$current = cancelToken.current) === null || _cancelToken$current === void 0 || (_cancelToken$current = _cancelToken$current.Token) === null || _cancelToken$current === void 0 ? void 0 : _cancelToken$current.signal);
|
|
318
|
+
case 1:
|
|
319
|
+
dataTmp = _context3.v;
|
|
320
|
+
setData(dataTmp);
|
|
321
|
+
_context3.n = 3;
|
|
322
|
+
break;
|
|
323
|
+
case 2:
|
|
324
|
+
_context3.p = 2;
|
|
325
|
+
_t3 = _context3.v;
|
|
326
|
+
console.log(_t3);
|
|
327
|
+
case 3:
|
|
328
|
+
_context3.p = 3;
|
|
329
|
+
setStatusText('no items');
|
|
330
|
+
return _context3.f(3);
|
|
331
|
+
case 4:
|
|
332
|
+
return _context3.a(2);
|
|
333
|
+
}
|
|
334
|
+
}, _callee3, null, [[0, 2, 3, 4]]);
|
|
335
|
+
}));
|
|
336
|
+
function callback(_x2) {
|
|
337
|
+
return _callback2.apply(this, arguments);
|
|
338
|
+
}
|
|
339
|
+
return callback;
|
|
340
|
+
}(),
|
|
341
|
+
start: function start(text) {
|
|
342
|
+
this._timer = window.setTimeout(this.callback, this._second, text);
|
|
343
|
+
},
|
|
344
|
+
clear: function clear() {
|
|
345
|
+
var _cancelToken$current2;
|
|
346
|
+
(_cancelToken$current2 = cancelToken.current) === null || _cancelToken$current2 === void 0 || _cancelToken$current2.Token.abort();
|
|
347
|
+
clearTimeout(this._timer);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
var Onchange = React__default.useCallback(function (event) {
|
|
351
|
+
var _timer$current5, _timer$current6;
|
|
352
|
+
setStatusText('Loading...');
|
|
353
|
+
(_timer$current5 = timer.current) === null || _timer$current5 === void 0 || _timer$current5.clear();
|
|
354
|
+
(_timer$current6 = timer.current) === null || _timer$current6 === void 0 || _timer$current6.start(event.target.value);
|
|
355
|
+
}, []);
|
|
356
|
+
var OnChangeValue = React__default.useCallback(function (event, option) {
|
|
357
|
+
if (refInput.current) {
|
|
358
|
+
refInput.current.value = option !== null && option !== void 0 && option.length ? JSON.stringify(option.map(props.SelectValue)) : '';
|
|
359
|
+
if (!option) {
|
|
360
|
+
var _timer$current7, _timer$current8;
|
|
361
|
+
(_timer$current7 = timer.current) === null || _timer$current7 === void 0 || _timer$current7.clear();
|
|
362
|
+
(_timer$current8 = timer.current) === null || _timer$current8 === void 0 || _timer$current8.start('');
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
props.Onchange && props.Onchange(option);
|
|
366
|
+
}, [props]);
|
|
367
|
+
React__default.useEffect(function () {
|
|
368
|
+
var mounted = true;
|
|
369
|
+
var fetchInitial = /*#__PURE__*/function () {
|
|
370
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
371
|
+
var _cancelToken$current3, _data2, search, Tmp, _selectedItem$current, _t4;
|
|
372
|
+
return _regenerator().w(function (_context4) {
|
|
373
|
+
while (1) switch (_context4.n) {
|
|
374
|
+
case 0:
|
|
375
|
+
_context4.p = 0;
|
|
376
|
+
_context4.n = 1;
|
|
377
|
+
return props.fetchData('', (_cancelToken$current3 = cancelToken.current) === null || _cancelToken$current3 === void 0 || (_cancelToken$current3 = _cancelToken$current3.Token) === null || _cancelToken$current3 === void 0 ? void 0 : _cancelToken$current3.signal);
|
|
378
|
+
case 1:
|
|
379
|
+
_data2 = _context4.v;
|
|
380
|
+
if (!(!Array.isArray(_data2) || !mounted)) {
|
|
381
|
+
_context4.n = 2;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
return _context4.a(2);
|
|
385
|
+
case 2:
|
|
386
|
+
setData(_data2);
|
|
387
|
+
search = props.searchInitial ? props.searchInitial : function (x) {
|
|
388
|
+
var _props$defaultValue;
|
|
389
|
+
return (_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.some(function (y) {
|
|
390
|
+
return y === props.SelectValue(x);
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
Tmp = _data2.filter(search);
|
|
394
|
+
if (Tmp) {
|
|
395
|
+
(_selectedItem$current = selectedItem.current).push.apply(_selectedItem$current, _toConsumableArray(Tmp));
|
|
396
|
+
// Object.assign(selectedItem.current, Tmp)
|
|
397
|
+
}
|
|
398
|
+
props.onReady && props.onReady(Tmp);
|
|
399
|
+
_context4.n = 4;
|
|
400
|
+
break;
|
|
401
|
+
case 3:
|
|
402
|
+
_context4.p = 3;
|
|
403
|
+
_t4 = _context4.v;
|
|
404
|
+
console.log(_t4);
|
|
405
|
+
case 4:
|
|
406
|
+
_context4.p = 4;
|
|
407
|
+
if (mounted) {
|
|
408
|
+
_context4.n = 5;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
return _context4.a(2);
|
|
412
|
+
case 5:
|
|
413
|
+
setStatusText('no items');
|
|
414
|
+
setIsInitial(false);
|
|
415
|
+
return _context4.f(4);
|
|
416
|
+
case 6:
|
|
417
|
+
return _context4.a(2);
|
|
418
|
+
}
|
|
419
|
+
}, _callee4, null, [[0, 3, 4, 6]]);
|
|
420
|
+
}));
|
|
421
|
+
return function fetchInitial() {
|
|
422
|
+
return _ref2.apply(this, arguments);
|
|
423
|
+
};
|
|
424
|
+
}();
|
|
425
|
+
if (isInitial) {
|
|
426
|
+
fetchInitial();
|
|
427
|
+
}
|
|
428
|
+
return function () {
|
|
429
|
+
mounted = false;
|
|
430
|
+
};
|
|
431
|
+
}, [isInitial, props]);
|
|
432
|
+
return jsxs(Fragment, {
|
|
433
|
+
children: [jsx(Autocomplete, {
|
|
434
|
+
options: data,
|
|
435
|
+
autoHighlight: true,
|
|
436
|
+
disabled: isInitial,
|
|
437
|
+
multiple: true,
|
|
438
|
+
limitTags: props.limitTags,
|
|
439
|
+
getOptionLabel: props.GenerateLabel,
|
|
440
|
+
isOptionEqualToValue: props.isOptionEqualToValue,
|
|
441
|
+
defaultValue: selectedItem.current,
|
|
442
|
+
onChange: OnChangeValue,
|
|
443
|
+
noOptionsText: statusText,
|
|
444
|
+
PopperComponent: function PopperComponent(p) {
|
|
445
|
+
return jsx(Popper, _objectSpread2(_objectSpread2({}, p), {}, {
|
|
446
|
+
style: _objectSpread2(_objectSpread2({}, p.style || {}), props.PopperStyle || {})
|
|
447
|
+
}));
|
|
448
|
+
},
|
|
449
|
+
renderInput: function renderInput(params) {
|
|
450
|
+
return jsx(TextField, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
451
|
+
label: props.title || 'title',
|
|
452
|
+
onChange: Onchange,
|
|
453
|
+
onBlur: props.onBlur,
|
|
454
|
+
error: props.error,
|
|
455
|
+
helperText: props.message,
|
|
456
|
+
inputProps: _objectSpread2(_objectSpread2({}, params.inputProps), {}, {
|
|
457
|
+
autoComplete: 'off' // disable autocomplete and autofill,
|
|
458
|
+
})
|
|
459
|
+
}));
|
|
460
|
+
}
|
|
461
|
+
}), jsx("input", {
|
|
462
|
+
ref: refInput,
|
|
463
|
+
defaultValue: JSON.stringify(props.defaultValue),
|
|
464
|
+
hidden: true,
|
|
465
|
+
name: props.name
|
|
466
|
+
})]
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
return Select2;
|
|
470
|
+
};
|
|
471
|
+
var colors = ['#880e4f', '#b388ff', '#800000', '#3f51b5', '#006064', '#5d4037', '#4a148c', '#ff5722'];
|
|
472
|
+
// const colors = [
|
|
473
|
+
// 'linear-gradient(to right,#880e4f,#cb76a3)',
|
|
474
|
+
// 'linear-gradient(to right,#b388ff,#ab9dc3)',
|
|
475
|
+
// 'linear-gradient(to right,#800000,#b15e5e)',
|
|
476
|
+
// 'linear-gradient(to right,#3f51b5,#777fad)',
|
|
477
|
+
// 'linear-gradient(to right,#006064,#72d3d7)',
|
|
478
|
+
// 'linear-gradient(to right,#5d4037,#cd927f)',
|
|
479
|
+
// 'linear-gradient(to right,#4a148c,#ad92cf)',
|
|
480
|
+
// 'linear-gradient(to right,#ff5722,#ebae9b)',
|
|
481
|
+
// ]
|
|
482
|
+
var hashCode = function hashCode(s) {
|
|
483
|
+
return s.split('').reduce(function (a, b) {
|
|
484
|
+
a = (a << 5) - a + b.charCodeAt(0);
|
|
485
|
+
return a & a;
|
|
486
|
+
}, 0);
|
|
487
|
+
};
|
|
488
|
+
var getColor = function getColor(index) {
|
|
489
|
+
return colors[Math.abs(index) % colors.length];
|
|
490
|
+
};
|
|
491
|
+
var Chips = function Chips(_ref3) {
|
|
492
|
+
var _data$map;
|
|
493
|
+
var data = _ref3.data;
|
|
494
|
+
return jsx(Box, {
|
|
495
|
+
sx: {
|
|
496
|
+
flexWrap: 'wrap',
|
|
497
|
+
display: 'flex',
|
|
498
|
+
justifyContent: 'center',
|
|
499
|
+
flex: 1
|
|
500
|
+
},
|
|
501
|
+
children: (_data$map = data === null || data === void 0 ? void 0 : data.map(function (option, index) {
|
|
502
|
+
return jsx(Chip, {
|
|
503
|
+
size: 'small',
|
|
504
|
+
sx: {
|
|
505
|
+
background: getColor(hashCode(option)),
|
|
506
|
+
color: 'white',
|
|
507
|
+
// borderColor: colors[index % colors.length],
|
|
508
|
+
// color: colors[index % colors.length],
|
|
509
|
+
fontWeight: 'bold',
|
|
510
|
+
fontSize: 10,
|
|
511
|
+
height: '18px',
|
|
512
|
+
marginRight: '2px',
|
|
513
|
+
boxSizing: 'border-box'
|
|
514
|
+
},
|
|
515
|
+
variant: 'filled',
|
|
516
|
+
label: option
|
|
517
|
+
}, KeyExtractor(option, index));
|
|
518
|
+
})) !== null && _data$map !== void 0 ? _data$map : ''
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
var CreateMultipleTags = function CreateMultipleTags() {
|
|
522
|
+
var Select2 = function Select2(props) {
|
|
523
|
+
var _props$data;
|
|
524
|
+
var refInput = useRef(null);
|
|
525
|
+
var OnChangeValue = React__default.useCallback(function (event, option) {
|
|
526
|
+
if (refInput.current) {
|
|
527
|
+
refInput.current.value = option !== null && option !== void 0 && option.length ? JSON.stringify(option) : '';
|
|
528
|
+
}
|
|
529
|
+
props.Onchange && props.Onchange(option);
|
|
530
|
+
}, [props]);
|
|
531
|
+
return jsxs(Fragment, {
|
|
532
|
+
children: [jsx(Autocomplete, {
|
|
533
|
+
options: (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [],
|
|
534
|
+
multiple: true,
|
|
535
|
+
onChange: OnChangeValue,
|
|
536
|
+
PopperComponent: function PopperComponent(p) {
|
|
537
|
+
return jsx(Popper, _objectSpread2(_objectSpread2({}, p), {}, {
|
|
538
|
+
style: _objectSpread2(_objectSpread2({}, p.style || {}), props.PopperStyle || {})
|
|
539
|
+
}));
|
|
540
|
+
},
|
|
541
|
+
freeSolo: true,
|
|
542
|
+
defaultValue: props.defaultValue,
|
|
543
|
+
renderTags: function renderTags(value, getTagProps) {
|
|
544
|
+
return value.map(function (option, index) {
|
|
545
|
+
var color = getColor(hashCode(option));
|
|
546
|
+
return jsx(Chip, _objectSpread2({
|
|
547
|
+
sx: {
|
|
548
|
+
borderColor: color,
|
|
549
|
+
color: color,
|
|
550
|
+
fontWeight: 'bold'
|
|
551
|
+
},
|
|
552
|
+
variant: 'outlined',
|
|
553
|
+
label: option
|
|
554
|
+
}, getTagProps({
|
|
555
|
+
index: index
|
|
556
|
+
})));
|
|
557
|
+
});
|
|
558
|
+
},
|
|
559
|
+
renderInput: function renderInput(params) {
|
|
560
|
+
return jsx(TextField, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
561
|
+
label: props.title || 'title',
|
|
562
|
+
onBlur: props.onBlur,
|
|
563
|
+
error: props.error,
|
|
564
|
+
placeholder: 'Enter tags',
|
|
565
|
+
helperText: props.message,
|
|
566
|
+
inputProps: _objectSpread2(_objectSpread2({}, params.inputProps), {}, {
|
|
567
|
+
autoComplete: 'off' // disable autocomplete and autofill,
|
|
568
|
+
})
|
|
569
|
+
}));
|
|
570
|
+
}
|
|
571
|
+
}), jsx("input", {
|
|
572
|
+
ref: refInput,
|
|
573
|
+
defaultValue: props.defaultValue ? JSON.stringify(props.defaultValue) : '',
|
|
574
|
+
hidden: true,
|
|
575
|
+
name: props.name
|
|
576
|
+
})]
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
return Select2;
|
|
580
|
+
};
|
|
581
|
+
var DatePickers = function DatePickers(props) {
|
|
582
|
+
var _React$useState11 = React__default.useState(props.defaultValue || new Date()),
|
|
583
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
584
|
+
value = _React$useState12[0],
|
|
585
|
+
setValue = _React$useState12[1];
|
|
586
|
+
var handleChange = useCallback(function (newValue) {
|
|
587
|
+
setValue(newValue);
|
|
588
|
+
if (refInput.current) {
|
|
589
|
+
refInput.current.value = newValue && !isNaN(newValue.getTime()) ? newValue.toISOString() : '';
|
|
590
|
+
}
|
|
591
|
+
props.Onchange && props.Onchange(newValue);
|
|
592
|
+
}, [props]);
|
|
593
|
+
var refInput = useRef(null);
|
|
594
|
+
return jsxs(LocalizationProvider, {
|
|
595
|
+
dateAdapter: AdapterDateFns,
|
|
596
|
+
children: [jsx(DatePicker, {
|
|
597
|
+
label: props.Title || 'Title',
|
|
598
|
+
inputFormat: props.inputFormat || 'MM/dd/yyyy',
|
|
599
|
+
views: ['day', 'month', 'year'],
|
|
600
|
+
value: value,
|
|
601
|
+
onChange: handleChange,
|
|
602
|
+
disabled: props.disable,
|
|
603
|
+
renderInput: function renderInput(params) {
|
|
604
|
+
return jsx(TextField, _objectSpread2(_objectSpread2({
|
|
605
|
+
onBlur: props.onBlur,
|
|
606
|
+
fullWidth: true
|
|
607
|
+
}, params), {}, {
|
|
608
|
+
error: props.error,
|
|
609
|
+
helperText: props.message
|
|
610
|
+
}));
|
|
611
|
+
}
|
|
612
|
+
}), jsx("input", {
|
|
613
|
+
ref: refInput,
|
|
614
|
+
defaultValue: (props.defaultValue || new Date()).toISOString(),
|
|
615
|
+
hidden: true,
|
|
616
|
+
name: props.name
|
|
617
|
+
})]
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
var LazyView = function LazyView(props) {
|
|
621
|
+
return jsxs(Box, {
|
|
622
|
+
sx: _objectSpread2({
|
|
623
|
+
position: 'relative'
|
|
624
|
+
}, props.sx || {}),
|
|
625
|
+
children: [props.children, props.IsLazy ? jsx(Box, {
|
|
626
|
+
sx: {
|
|
627
|
+
flex: 1,
|
|
628
|
+
top: 0,
|
|
629
|
+
left: 0,
|
|
630
|
+
bottom: 0,
|
|
631
|
+
right: 0,
|
|
632
|
+
position: 'absolute',
|
|
633
|
+
opacity: 0.8,
|
|
634
|
+
background: 'rgb(0 0 0 / 0.3)'
|
|
635
|
+
},
|
|
636
|
+
children: props.IsLazy && props.showProgress !== false ? jsx(LinearProgress, {}) : ''
|
|
637
|
+
}) : '']
|
|
638
|
+
});
|
|
639
|
+
};
|
|
640
|
+
var OverlayView = function OverlayView(props) {
|
|
641
|
+
var _useState = useState(props.open || false),
|
|
642
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
643
|
+
IsOpen = _useState2[0],
|
|
644
|
+
setIsOpen = _useState2[1];
|
|
645
|
+
var configShow = {
|
|
646
|
+
top: 0,
|
|
647
|
+
left: 0,
|
|
648
|
+
right: 0,
|
|
649
|
+
bottom: 0
|
|
650
|
+
};
|
|
651
|
+
var getConfig = useCallback(function () {
|
|
652
|
+
return IsOpen ? configShow : {
|
|
653
|
+
display: 'none'
|
|
654
|
+
};
|
|
655
|
+
}, [IsOpen, configShow]);
|
|
656
|
+
useEffect(function () {
|
|
657
|
+
setIsOpen(props.open || false);
|
|
658
|
+
}, [props.open]);
|
|
659
|
+
return jsx(Box, {
|
|
660
|
+
sx: _objectSpread2(_objectSpread2({
|
|
661
|
+
position: 'absolute',
|
|
662
|
+
flex: 1
|
|
663
|
+
}, getConfig()), {}, {
|
|
664
|
+
background: 'white'
|
|
665
|
+
}),
|
|
666
|
+
children: props.children
|
|
667
|
+
});
|
|
668
|
+
};
|
|
669
|
+
var InputSearch = function InputSearch(props) {
|
|
670
|
+
var _props$placeholder, _props$placeholder2;
|
|
671
|
+
var _useState3 = useState(''),
|
|
672
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
673
|
+
TextSearch = _useState4[0],
|
|
674
|
+
setTextSearch = _useState4[1];
|
|
675
|
+
var _onSearch = useCallback(function (text, signal) {
|
|
676
|
+
props.onSearch && props.onSearch(text, signal);
|
|
677
|
+
}, [props]);
|
|
678
|
+
var timer = React__default.useRef({
|
|
679
|
+
_timer: 0,
|
|
680
|
+
_second: 500,
|
|
681
|
+
_controller: new AbortController(),
|
|
682
|
+
callback: function callback(value) {
|
|
683
|
+
try {
|
|
684
|
+
this._controller = new AbortController();
|
|
685
|
+
_onSearch(value, this._controller);
|
|
686
|
+
} catch (error) {
|
|
687
|
+
console.log(error);
|
|
688
|
+
} finally {
|
|
689
|
+
props.onEnd && props.onEnd();
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
start: function start(text) {
|
|
693
|
+
props.onStart && props.onStart();
|
|
694
|
+
this._timer = window.setTimeout(this.callback, this._second, text);
|
|
695
|
+
},
|
|
696
|
+
clear: function clear() {
|
|
697
|
+
this._controller.abort();
|
|
698
|
+
clearTimeout(this._timer);
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
useEffect(function () {
|
|
702
|
+
var _timer = timer.current;
|
|
703
|
+
return function () {
|
|
704
|
+
_timer.clear();
|
|
705
|
+
};
|
|
706
|
+
}, []);
|
|
707
|
+
var _onChange = useCallback(function (event) {
|
|
708
|
+
var _timer$current9, _timer$current0;
|
|
709
|
+
setTextSearch(event.target.value);
|
|
710
|
+
(_timer$current9 = timer.current) === null || _timer$current9 === void 0 || _timer$current9.clear();
|
|
711
|
+
(_timer$current0 = timer.current) === null || _timer$current0 === void 0 || _timer$current0.start(event.target.value);
|
|
712
|
+
}, []);
|
|
713
|
+
var _onAction = useCallback(function () {
|
|
714
|
+
var _timer$current1;
|
|
715
|
+
(_timer$current1 = timer.current) === null || _timer$current1 === void 0 || _timer$current1.clear();
|
|
716
|
+
if (TextSearch) {
|
|
717
|
+
setTextSearch('');
|
|
718
|
+
timer.current.callback('');
|
|
719
|
+
} else {
|
|
720
|
+
timer.current.callback(TextSearch);
|
|
721
|
+
}
|
|
722
|
+
}, [TextSearch]);
|
|
723
|
+
return jsxs(Box, {
|
|
724
|
+
sx: _objectSpread2({
|
|
725
|
+
p: '2px 4px',
|
|
726
|
+
display: 'flex',
|
|
727
|
+
alignItems: 'center',
|
|
728
|
+
width: 300
|
|
729
|
+
}, props.PaperSx || {}),
|
|
730
|
+
children: [jsx(InputBase, {
|
|
731
|
+
sx: {
|
|
732
|
+
ml: 1,
|
|
733
|
+
flex: 1
|
|
734
|
+
},
|
|
735
|
+
placeholder: (_props$placeholder = props.placeholder) !== null && _props$placeholder !== void 0 ? _props$placeholder : 'Search...',
|
|
736
|
+
inputProps: {
|
|
737
|
+
'aria-label': (_props$placeholder2 = props.placeholder) !== null && _props$placeholder2 !== void 0 ? _props$placeholder2 : 'Search...'
|
|
738
|
+
},
|
|
739
|
+
value: TextSearch,
|
|
740
|
+
onChange: _onChange
|
|
741
|
+
}), jsx(IconButton, {
|
|
742
|
+
onClick: _onAction,
|
|
743
|
+
type: 'submit',
|
|
744
|
+
sx: {
|
|
745
|
+
p: '10px'
|
|
746
|
+
},
|
|
747
|
+
"aria-label": 'search',
|
|
748
|
+
children: TextSearch ? jsx(CloseIcon, {}) : jsx(SearchIcon, {})
|
|
749
|
+
})]
|
|
750
|
+
});
|
|
751
|
+
};
|
|
752
|
+
var PageRoute = function PageRoute(props) {
|
|
753
|
+
useEffect(function () {
|
|
754
|
+
document.title = (props.prefix || '') + (props.title || '');
|
|
755
|
+
}, [props.prefix, props.title]);
|
|
756
|
+
return jsx(Fragment, {
|
|
757
|
+
children: props.children
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
var WrapPageRoute = function WrapPageRoute(WrapComponent) {
|
|
761
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
762
|
+
return function (props) {
|
|
763
|
+
var _option$title;
|
|
764
|
+
var title = props.title,
|
|
765
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
766
|
+
return jsx(PageRoute, {
|
|
767
|
+
title: (_option$title = option.title) !== null && _option$title !== void 0 ? _option$title : title,
|
|
768
|
+
prefix: option.prefix,
|
|
769
|
+
children: jsx(WrapComponent, _objectSpread2({}, other))
|
|
770
|
+
});
|
|
771
|
+
};
|
|
772
|
+
};
|
|
773
|
+
var PageContent = function PageContent(props) {
|
|
774
|
+
var PanelAction = props.PanelAction;
|
|
775
|
+
return jsxs(Box, {
|
|
776
|
+
sx: {
|
|
777
|
+
display: 'flex',
|
|
778
|
+
flexDirection: 'column',
|
|
779
|
+
flex: 1
|
|
780
|
+
},
|
|
781
|
+
children: [jsxs(Box, {
|
|
782
|
+
sx: {
|
|
783
|
+
minHeight: 50,
|
|
784
|
+
display: 'flex',
|
|
785
|
+
justifyContent: 'flex-end',
|
|
786
|
+
margin: '5px'
|
|
787
|
+
},
|
|
788
|
+
children: [jsx(Box, {
|
|
789
|
+
sx: {
|
|
790
|
+
display: 'flex',
|
|
791
|
+
flex: 1,
|
|
792
|
+
alignItems: 'center'
|
|
793
|
+
},
|
|
794
|
+
children: jsx(Typography, {
|
|
795
|
+
variant: 'h5',
|
|
796
|
+
children: props.Title
|
|
797
|
+
})
|
|
798
|
+
}), jsx(Box, {
|
|
799
|
+
sx: {
|
|
800
|
+
display: 'flex',
|
|
801
|
+
justifyContent: 'flex-end',
|
|
802
|
+
flex: 1
|
|
803
|
+
},
|
|
804
|
+
children: PanelAction
|
|
805
|
+
})]
|
|
806
|
+
}), props.children]
|
|
807
|
+
});
|
|
808
|
+
};
|
|
809
|
+
var SmallSelect = function SmallSelect(props) {
|
|
810
|
+
var _useState5 = useState(Array.isArray(props.data) ? props.data : undefined),
|
|
811
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
812
|
+
data = _useState6[0],
|
|
813
|
+
setData = _useState6[1];
|
|
814
|
+
var _useState7 = useState(props.value || props.defaultValue || data && data[0].value || '-1'),
|
|
815
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
816
|
+
value = _useState8[0],
|
|
817
|
+
setValue = _useState8[1];
|
|
818
|
+
var handleChange = useCallback(function (event) {
|
|
819
|
+
setValue(event.target.value);
|
|
820
|
+
props.onChange && props.onChange(event.target.value);
|
|
821
|
+
}, [props]);
|
|
822
|
+
var renderItems = function renderItems() {
|
|
823
|
+
return data === null || data === void 0 ? void 0 : data.map(function (item, index) {
|
|
824
|
+
return jsx(MenuItem, {
|
|
825
|
+
value: item.value,
|
|
826
|
+
children: item.name
|
|
827
|
+
}, item.value);
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
useEffect(function () {
|
|
831
|
+
if (typeof props.data === 'function' && data === undefined) {
|
|
832
|
+
props.data().then(function (d) {
|
|
833
|
+
setValue(props.value || props.defaultValue || d && d[0].value);
|
|
834
|
+
setData(d);
|
|
835
|
+
})["catch"](function (er) {
|
|
836
|
+
return setData([]);
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
}, [data, props]);
|
|
840
|
+
return jsxs(FormControl, {
|
|
841
|
+
disabled: props.disabled,
|
|
842
|
+
sx: _objectSpread2({
|
|
843
|
+
minWidth: 120
|
|
844
|
+
}, props.sx || {}),
|
|
845
|
+
size: 'small',
|
|
846
|
+
children: [jsx(InputLabel, {
|
|
847
|
+
id: props.id,
|
|
848
|
+
children: props.title
|
|
849
|
+
}), jsx(Select, {
|
|
850
|
+
labelId: props.id,
|
|
851
|
+
id: props.id,
|
|
852
|
+
value: props.value || value,
|
|
853
|
+
label: props.title,
|
|
854
|
+
defaultValue: props.defaultValue,
|
|
855
|
+
onChange: handleChange,
|
|
856
|
+
disabled: data === undefined || props.disabled,
|
|
857
|
+
children: renderItems()
|
|
858
|
+
})]
|
|
859
|
+
});
|
|
860
|
+
};
|
|
861
|
+
var CenterBox = function CenterBox(props) {
|
|
862
|
+
return jsx(Box, {
|
|
863
|
+
sx: {
|
|
864
|
+
height: 0,
|
|
865
|
+
margin: '0 auto'
|
|
866
|
+
},
|
|
867
|
+
children: jsx(Box, {
|
|
868
|
+
sx: {
|
|
869
|
+
display: 'flex',
|
|
870
|
+
justifyContent: 'center',
|
|
871
|
+
maxWidth: '1200px',
|
|
872
|
+
flexDirection: 'column'
|
|
873
|
+
},
|
|
874
|
+
children: jsx(Box, {
|
|
875
|
+
sx: props.sx,
|
|
876
|
+
children: props.children
|
|
877
|
+
})
|
|
878
|
+
})
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
export { BoxGroup, BoxInfo, CenterBox, Chips, CreateMultipleSelect, CreateMultipleTags, CreateSelect2, DatePickers, ErrorAll, InputSearch, LazyView, OverlayView, PageContent, PageRoute, SmallSelect, WrapFrom, WrapPageRoute };
|
|
883
|
+
//# sourceMappingURL=index.js.map
|