awing-library 2.1.16-beta → 2.1.18-beta
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/README.md +4 -19
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/AdList.js +50 -6
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/AdRow.d.ts +5 -0
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/AdRow.js +6 -18
- package/lib/ACM-AXN/DomainPreview/PreviewButton.d.ts +15 -0
- package/lib/ACM-AXN/DomainPreview/PreviewButton.js +165 -0
- package/lib/ACM-AXN/DomainPreview/index.d.ts +7 -2
- package/lib/ACM-AXN/DomainPreview/index.js +6 -3
- package/lib/ACM-AXN/Page/Container.js +66 -72
- package/lib/ACM-AXN/Page/CreateOrEdit/DrawerAction.js +22 -5
- package/lib/ACM-AXN/Page/CreateOrEdit/Tabview/ViewInfo.js +1 -1
- package/lib/ACM-AXN/Page/Types.d.ts +8 -0
- package/lib/AWING/DataGrid/index.js +4 -1
- package/lib/AWING/DataGrid/interface.d.ts +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,32 +35,17 @@ yarn build
|
|
|
35
35
|
- Step 2: Tạo link thư viện
|
|
36
36
|
|
|
37
37
|
```shell
|
|
38
|
+
yarn build
|
|
38
39
|
yarn link
|
|
39
|
-
```
|
|
40
|
-
- Tạo Link react
|
|
41
|
-
|
|
42
|
-
```shell
|
|
43
40
|
cd node_modules/react
|
|
44
41
|
yarn link
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- Tạo Link react-dom
|
|
48
|
-
|
|
49
|
-
```shell
|
|
42
|
+
cd ../..
|
|
50
43
|
cd node_modules/react-dom
|
|
51
44
|
yarn link
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- Tạo Link @mui/material
|
|
55
|
-
|
|
56
|
-
```shell
|
|
45
|
+
cd ../..
|
|
57
46
|
cd node_modules/@mui/material
|
|
58
47
|
yarn link
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- Tạo Link @mui/styles
|
|
62
|
-
|
|
63
|
-
```shell
|
|
48
|
+
cd ../../..
|
|
64
49
|
cd node_modules/@mui/styles
|
|
65
50
|
yarn link
|
|
66
51
|
```
|
|
@@ -60,6 +60,9 @@ var Utils_1 = require("../../Utils");
|
|
|
60
60
|
var Helpers_1 = require("../../../../Utils/Helpers");
|
|
61
61
|
var Context_1 = require("../../../../Context");
|
|
62
62
|
var Recoils_1 = require("../Recoils");
|
|
63
|
+
var DomainPreview_1 = __importDefault(require("../../../../ACM-AXN/DomainPreview"));
|
|
64
|
+
var Constant_1 = require("../../../../ACM-AXN/Campaign/Constant");
|
|
65
|
+
var PreviewButton_1 = __importDefault(require("../../../../ACM-AXN/DomainPreview/PreviewButton"));
|
|
63
66
|
function AdList(props) {
|
|
64
67
|
var onCreate = props.onCreate, onChange = props.onChange, onDelete = props.onDelete, onAdsValidChange = props.onAdsValidChange;
|
|
65
68
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
@@ -70,11 +73,18 @@ function AdList(props) {
|
|
|
70
73
|
var _c = (0, recoil_1.useRecoilState)(atoms_1.adOpenState), adOpen = _c[0], setAdOpen = _c[1];
|
|
71
74
|
var copiedAd = (0, recoil_1.useRecoilValue)(atoms_1.copiedAdState);
|
|
72
75
|
var hasClassC = (0, recoil_1.useRecoilValue)((0, atoms_1.checkGroupsClassCState)(adSelected.map(function (x) { return x.subCampaignId; })));
|
|
76
|
+
var _d = (0, react_1.useState)({
|
|
77
|
+
welcomeId: '',
|
|
78
|
+
loginId: '',
|
|
79
|
+
domainIds: [],
|
|
80
|
+
}), previewId = _d[0], setPreviewId = _d[1];
|
|
81
|
+
var _e = react_1.default.useState(), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
82
|
+
var open = Boolean(anchorEl);
|
|
73
83
|
// valid theo cấu trúc { [campaignGroupId]: { [adId]: boolean } }
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
var
|
|
84
|
+
var _f = (0, react_1.useState)({}), adsValid = _f[0], setAdsValid = _f[1];
|
|
85
|
+
var _g = (0, react_1.useState)(false), isAdvancedDrawerOpen = _g[0], setIsAdvancedDrawerOpen = _g[1];
|
|
86
|
+
var _h = (0, recoil_1.useRecoilState)(Recoils_1.weightState), weightProps = _h[0], setWeightState = _h[1];
|
|
87
|
+
var _j = (0, react_1.useState)(false), isMultiEditDrawerOpen = _j[0], setIsMultiEditDrawerOpen = _j[1];
|
|
78
88
|
(0, react_1.useEffect)(function () {
|
|
79
89
|
var newAdValid = {};
|
|
80
90
|
ads.forEach(function (ad) {
|
|
@@ -219,6 +229,33 @@ function AdList(props) {
|
|
|
219
229
|
advanced: t('Campaign.Advanced'),
|
|
220
230
|
delete: t('Common.Delete'),
|
|
221
231
|
};
|
|
232
|
+
/**
|
|
233
|
+
* Hàm khi xem preview
|
|
234
|
+
*/
|
|
235
|
+
var handlePreview = function (e, ad, doaminId) {
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
var url = "".concat(Constant_1.Constants.CAPTIVE_DOMAIN, "/").concat(Constant_1.Constants.PAGE_LOGIN_PREVIEW, "?loginId=").concat(ad.loginId, "&isNetworkCampaign=false");
|
|
238
|
+
if (ad.welcomeId.length)
|
|
239
|
+
url += "&welcomeId=".concat(ad.welcomeId);
|
|
240
|
+
if (doaminId)
|
|
241
|
+
url += "&doaminId=".concat(doaminId);
|
|
242
|
+
window.open(url, '_blank');
|
|
243
|
+
};
|
|
244
|
+
var handlePreviewPage = function (e, ad) {
|
|
245
|
+
var _a, _b;
|
|
246
|
+
e.stopPropagation();
|
|
247
|
+
setPreviewId({
|
|
248
|
+
welcomeId: ad.welcomeId,
|
|
249
|
+
loginId: ad.loginId,
|
|
250
|
+
domainIds: (_b = (_a = ad.places) === null || _a === void 0 ? void 0 : _a.map(function (x) { return x.domainId; })) !== null && _b !== void 0 ? _b : [],
|
|
251
|
+
});
|
|
252
|
+
setAnchorEl(e.currentTarget);
|
|
253
|
+
};
|
|
254
|
+
var handlePreviewClose = function (event) {
|
|
255
|
+
event.stopPropagation();
|
|
256
|
+
setPreviewId({});
|
|
257
|
+
setAnchorEl(null);
|
|
258
|
+
};
|
|
222
259
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [weightProps.isOpen && ((0, jsx_runtime_1.jsx)(Weight_1.default, {})), (0, jsx_runtime_1.jsxs)(material_1.TableContainer, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h4", sx: {
|
|
223
260
|
padding: function (theme) { return theme.spacing(2); },
|
|
224
261
|
fontSize: '16px!important',
|
|
@@ -261,6 +298,7 @@ function AdList(props) {
|
|
|
261
298
|
}, onChange: handleMultiUpdate })), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: translationText.delete, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: function () {
|
|
262
299
|
return handleMultiDelete(adSelected);
|
|
263
300
|
}, "aria-label": "delete", children: (0, jsx_runtime_1.jsx)(Delete_1.default, { fontSize: "small" }) }) })] })), (0, jsx_runtime_1.jsx)(material_1.TableCell, { align: "right", children: onCreate && ((0, jsx_runtime_1.jsxs)(material_1.ButtonGroup, { variant: "outlined", color: "error", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { startIcon: (0, jsx_runtime_1.jsx)(Add_1.default, {}), onClick: function () { return handleAddAd(); }, children: t('Common.Create') }), copiedAd !== undefined && ((0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", "aria-label": "paste", onClick: function () { return handleAddAd(true); }, children: (0, jsx_runtime_1.jsx)(Assignment_1.default, {}) }))] })) })] }) }), (0, jsx_runtime_1.jsx)(material_1.TableBody, { children: ads.map(function (ad, idx) {
|
|
301
|
+
var _a;
|
|
264
302
|
var isOpen = adOpen !== undefined &&
|
|
265
303
|
adOpen.adId === ad.id &&
|
|
266
304
|
adOpen.subCampaignId === ad.campaignGroupId;
|
|
@@ -270,7 +308,9 @@ function AdList(props) {
|
|
|
270
308
|
};
|
|
271
309
|
return ((0, jsx_runtime_1.jsx)(AdRow_1.default, { ad: ad, onChange: function (adSetStateAction) {
|
|
272
310
|
return onChange([adDefine], adSetStateAction);
|
|
273
|
-
},
|
|
311
|
+
}, previewButton: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": "preview", onClick: function (e) {
|
|
312
|
+
handlePreview(e, ad);
|
|
313
|
+
}, disabled: !((_a = ad.loginId) === null || _a === void 0 ? void 0 : _a.length), sx: { borderRadius: '15%' }, children: (0, jsx_runtime_1.jsx)(DomainPreview_1.default, { handlePreviewPage: function (e) { return handlePreviewPage(e, ad); }, isSelectDomain: Boolean(service.domainsGetAll) }) }) }), onChangeStatus: function (status) {
|
|
274
314
|
return handleChangeAdStatus(ad, status);
|
|
275
315
|
}, onDelete: function () {
|
|
276
316
|
return handleMultiDelete([adDefine]);
|
|
@@ -302,6 +342,10 @@ function AdList(props) {
|
|
|
302
342
|
]);
|
|
303
343
|
});
|
|
304
344
|
} }, idx));
|
|
305
|
-
}) })] })] })
|
|
345
|
+
}) })] })] }), open &&
|
|
346
|
+
(0, jsx_runtime_1.jsx)(PreviewButton_1.default, { anchorEl: anchorEl, open: open, domainIds: previewId.domainIds, handlePreviewClose: handlePreviewClose, handlePreviewDomain: function (event, domainId) {
|
|
347
|
+
handlePreview(event, ads.find(function (x) { return x.loginId === previewId.loginId; }), domainId);
|
|
348
|
+
// handlePreview(previewId, domainId)
|
|
349
|
+
}, service: service })] }));
|
|
306
350
|
}
|
|
307
351
|
exports.default = AdList;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { AdDetailProps } from './AdDetail';
|
|
2
3
|
type AdRowProps = AdDetailProps & {
|
|
3
4
|
/**
|
|
@@ -24,6 +25,10 @@ type AdRowProps = AdDetailProps & {
|
|
|
24
25
|
* Trạng thái lỗi hay không của quảng cáo
|
|
25
26
|
*/
|
|
26
27
|
error?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Preview Button
|
|
30
|
+
*/
|
|
31
|
+
previewButton: React.ReactNode;
|
|
27
32
|
};
|
|
28
33
|
export default function AdRow(props: AdRowProps): import("react/jsx-runtime").JSX.Element;
|
|
29
34
|
export {};
|
|
@@ -62,7 +62,6 @@ var react_1 = __importStar(require("react"));
|
|
|
62
62
|
var react_i18next_1 = require("react-i18next");
|
|
63
63
|
var recoil_1 = require("recoil");
|
|
64
64
|
var material_1 = require("@mui/material");
|
|
65
|
-
var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
66
65
|
var KeyboardArrowDown_1 = __importDefault(require("@mui/icons-material/KeyboardArrowDown"));
|
|
67
66
|
var KeyboardArrowUp_1 = __importDefault(require("@mui/icons-material/KeyboardArrowUp"));
|
|
68
67
|
var CheckCircle_1 = __importDefault(require("@mui/icons-material/CheckCircle"));
|
|
@@ -87,27 +86,16 @@ var AWING_1 = require("../../../../AWING");
|
|
|
87
86
|
var Constant_1 = require("../../Constant");
|
|
88
87
|
var Recoils_1 = require("../Recoils");
|
|
89
88
|
function AdRow(props) {
|
|
90
|
-
var _a, _b, _c, _d
|
|
89
|
+
var _a, _b, _c, _d;
|
|
91
90
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
92
|
-
var ad = props.ad, onChange = props.onChange, onDelete = props.onDelete, open = props.open, onToggle = props.onToggle, isSelected = props.isSelected, onCheck = props.onCheck, error = props.error, other = __rest(props, ["ad", "onChange", "onDelete", "open", "onToggle", "isSelected", "onCheck", "error"]);
|
|
91
|
+
var ad = props.ad, onChange = props.onChange, onDelete = props.onDelete, open = props.open, onToggle = props.onToggle, isSelected = props.isSelected, onCheck = props.onCheck, error = props.error, previewButton = props.previewButton, other = __rest(props, ["ad", "onChange", "onDelete", "open", "onToggle", "isSelected", "onCheck", "error", "previewButton"]);
|
|
93
92
|
var service = (0, Hooks_1.default)().service;
|
|
94
93
|
var setCopiedAd = (0, recoil_1.useSetRecoilState)(atoms_1.copiedAdState);
|
|
95
94
|
var setWeightState = (0, recoil_1.useSetRecoilState)(Recoils_1.weightState);
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
var
|
|
99
|
-
var _j = (0, react_1.useState)(false), isWeightDrawerOpen = _j[0], setIsWeightDrawerOpen = _j[1];
|
|
95
|
+
var _e = (0, react_1.useState)(false), openCopiedMessage = _e[0], setOpenCopiedMessage = _e[1];
|
|
96
|
+
var _f = (0, react_1.useState)(false), showTheSource = _f[0], setShowTheSource = _f[1];
|
|
97
|
+
var _g = (0, react_1.useState)(false), isAdvancedDrawerOpen = _g[0], setIsAdvancedDrawerOpen = _g[1];
|
|
100
98
|
var isClassC = (0, recoil_2.useRecoilValue)((0, atoms_2.checkGroupsClassCState)([ad.campaignGroupId]));
|
|
101
|
-
/**
|
|
102
|
-
* Hàm khi xem preview
|
|
103
|
-
*/
|
|
104
|
-
var handlePreview = function (e) {
|
|
105
|
-
e.stopPropagation();
|
|
106
|
-
var url = "".concat(Constant_1.Constants.CAPTIVE_DOMAIN, "/").concat(Constant_1.Constants.PAGE_LOGIN_PREVIEW, "?loginId=").concat(ad.loginId, "&isNetworkCampaign=false");
|
|
107
|
-
if (ad.welcomeId.length)
|
|
108
|
-
url += "&welcomeId=".concat(ad.welcomeId);
|
|
109
|
-
window.open(url, '_blank');
|
|
110
|
-
};
|
|
111
99
|
var translationText = {
|
|
112
100
|
preview: t('Common.Preview'),
|
|
113
101
|
copy: t('Common.Copy'),
|
|
@@ -147,7 +135,7 @@ function AdRow(props) {
|
|
|
147
135
|
Constant_1.Constants.CAMPAIGN_EDIT_PAGE,
|
|
148
136
|
Enum_1.PAGE_CODES.PageCodeWelcome,
|
|
149
137
|
ad.welcomeId,
|
|
150
|
-
].join('/'), children: (_d = ad.welcomePage) === null || _d === void 0 ? void 0 : _d.title }) })] }))] }), (0, jsx_runtime_1.jsxs)(material_1.TableCell, { sx: { padding: function (theme) { return theme.spacing(0, 2); } }, align: "right", children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: translationText.preview, children: (0, jsx_runtime_1.jsx)(
|
|
138
|
+
].join('/'), children: (_d = ad.welcomePage) === null || _d === void 0 ? void 0 : _d.title }) })] }))] }), (0, jsx_runtime_1.jsxs)(material_1.TableCell, { sx: { padding: function (theme) { return theme.spacing(0, 2); } }, align: "right", children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: translationText.preview, children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: previewButton }) }), (0, jsx_runtime_1.jsx)(AWING_1.Actions, { menus: __spreadArray([
|
|
151
139
|
{
|
|
152
140
|
icon: (0, jsx_runtime_1.jsx)(FileCopyOutlined_1.default, {}),
|
|
153
141
|
action: function () {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IDomain } from '../../ACM-AXN/Page/Types';
|
|
3
|
+
interface PreviewCampaignContainerProps {
|
|
4
|
+
domainIds: string[];
|
|
5
|
+
open: boolean;
|
|
6
|
+
anchorEl: HTMLElement | null;
|
|
7
|
+
handlePreviewClose: (event: React.MouseEvent<HTMLElement>) => void;
|
|
8
|
+
handlePreviewDomain: (event: React.MouseEvent<HTMLElement>, domainId: string) => void;
|
|
9
|
+
service: {
|
|
10
|
+
domainsGetAll: () => Promise<IDomain[]>;
|
|
11
|
+
domainsGetByIds: (body: string[]) => Promise<IDomain[]>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
declare const PreviewCampaignContainer: React.FC<PreviewCampaignContainerProps>;
|
|
15
|
+
export default PreviewCampaignContainer;
|
|
@@ -0,0 +1,165 @@
|
|
|
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 material_1 = require("@mui/material");
|
|
8
|
+
var icons_material_1 = require("@mui/icons-material");
|
|
9
|
+
var react_1 = __importDefault(require("react"));
|
|
10
|
+
var react_i18next_1 = require("react-i18next");
|
|
11
|
+
var styles_1 = require("@mui/styles");
|
|
12
|
+
var AWING_1 = require("../../AWING");
|
|
13
|
+
var useStylesContainer = (0, styles_1.makeStyles)(function () {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
var theme = (0, material_1.useTheme)();
|
|
16
|
+
return {
|
|
17
|
+
circularProgress: {
|
|
18
|
+
width: '10px !important',
|
|
19
|
+
height: '10px !important',
|
|
20
|
+
margin: '0px auto',
|
|
21
|
+
},
|
|
22
|
+
drawer: {
|
|
23
|
+
width: theme.spacing(60),
|
|
24
|
+
},
|
|
25
|
+
search: (_a = {
|
|
26
|
+
position: 'relative',
|
|
27
|
+
borderRadius: theme.shape.borderRadius,
|
|
28
|
+
backgroundColor: 'rgba(255, 255, 255, 0.15)',
|
|
29
|
+
'&:hover': {
|
|
30
|
+
backgroundColor: 'rgba(255, 255, 255, 0.25)',
|
|
31
|
+
},
|
|
32
|
+
marginRight: theme.spacing(2),
|
|
33
|
+
marginLeft: 0,
|
|
34
|
+
width: '100%'
|
|
35
|
+
},
|
|
36
|
+
_a[theme.breakpoints.up('sm')] = {
|
|
37
|
+
marginLeft: theme.spacing(3),
|
|
38
|
+
width: 'auto',
|
|
39
|
+
},
|
|
40
|
+
_a),
|
|
41
|
+
searchIcon: {
|
|
42
|
+
padding: theme.spacing(0, 2),
|
|
43
|
+
height: '100%',
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
pointerEvents: 'none',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
},
|
|
50
|
+
inputRoot: {
|
|
51
|
+
color: 'inherit',
|
|
52
|
+
},
|
|
53
|
+
inputInput: (_b = {
|
|
54
|
+
padding: theme.spacing(1, 1, 1, 0),
|
|
55
|
+
// vertical padding + font size from searchIcon
|
|
56
|
+
paddingLeft: "calc(1em + ".concat(theme.spacing(4), "px)"),
|
|
57
|
+
transition: theme.transitions.create('width'),
|
|
58
|
+
width: '100%'
|
|
59
|
+
},
|
|
60
|
+
_b[theme.breakpoints.up('md')] = {
|
|
61
|
+
width: '20ch',
|
|
62
|
+
},
|
|
63
|
+
_b),
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
var PreviewCampaignContainer = function (props) {
|
|
67
|
+
var domainIds = props.domainIds, open = props.open, anchorEl = props.anchorEl, handlePreviewClose = props.handlePreviewClose, handlePreviewDomain = props.handlePreviewDomain, service = props.service;
|
|
68
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
69
|
+
var _a = react_1.default.useState([]), domains = _a[0], setDomains = _a[1];
|
|
70
|
+
var _b = react_1.default.useState(false), loadingFlags = _b[0], setLoadingFlags = _b[1];
|
|
71
|
+
var classes = useStylesContainer();
|
|
72
|
+
react_1.default.useEffect(function () {
|
|
73
|
+
setLoadingFlags(true);
|
|
74
|
+
}, []);
|
|
75
|
+
react_1.default.useEffect(function () {
|
|
76
|
+
if (domainIds.length && open === true) {
|
|
77
|
+
service
|
|
78
|
+
.domainsGetByIds(domainIds)
|
|
79
|
+
.then(setDomains)
|
|
80
|
+
.finally(function () { return setLoadingFlags(false); });
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
setLoadingFlags(false);
|
|
84
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
|
+
}, [domainIds, open]);
|
|
86
|
+
react_1.default.useEffect(function () {
|
|
87
|
+
if (!domainIds.length) {
|
|
88
|
+
setOpenDrawer(true);
|
|
89
|
+
// handlePreviewClose({stopPropagation: () => {}} as any)
|
|
90
|
+
}
|
|
91
|
+
}, [domainIds]);
|
|
92
|
+
var _c = react_1.default.useState(false), openDrawer = _c[0], setOpenDrawer = _c[1];
|
|
93
|
+
var toggleDrawer = function (open) { return function (event) {
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
if (event &&
|
|
96
|
+
event.type === 'keydown' &&
|
|
97
|
+
(event.key === 'Tab' ||
|
|
98
|
+
event.key === 'Shift')) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
setOpenDrawer(open);
|
|
102
|
+
}; };
|
|
103
|
+
var _d = react_1.default.useState(''), searchDomainString = _d[0], setSearchDomainString = _d[1];
|
|
104
|
+
var _e = react_1.default.useState([]), allDomain = _e[0], setAllDomain = _e[1];
|
|
105
|
+
var _f = react_1.default.useState(true), isLoadingAllDomain = _f[0], setIsLoadingAllDomain = _f[1];
|
|
106
|
+
react_1.default.useEffect(function () {
|
|
107
|
+
if (openDrawer === true && allDomain.length <= 0) {
|
|
108
|
+
setIsLoadingAllDomain(true);
|
|
109
|
+
service
|
|
110
|
+
.domainsGetAll()
|
|
111
|
+
.then(setAllDomain)
|
|
112
|
+
.finally(function () { return setIsLoadingAllDomain(false); });
|
|
113
|
+
}
|
|
114
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
|
+
}, [openDrawer]);
|
|
116
|
+
var translationText = {
|
|
117
|
+
searchPlaceholder: t('Common.SearchPlaceholder'),
|
|
118
|
+
copyToClipboard: t('Common.Preview'),
|
|
119
|
+
other: t('Campaign.Type.Other'),
|
|
120
|
+
};
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Menu, { id: "long-menu", anchorEl: anchorEl, keepMounted: true, open: open, onClose: handlePreviewClose, PaperProps: {
|
|
122
|
+
style: {
|
|
123
|
+
maxHeight: 48 * 4.5,
|
|
124
|
+
width: '25ch',
|
|
125
|
+
},
|
|
126
|
+
}, children: [loadingFlags ? ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { children: (0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {}) })) : (domains &&
|
|
127
|
+
domains.map(function (domain) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { onClick: function (event) {
|
|
128
|
+
handlePreviewClose(event);
|
|
129
|
+
handlePreviewDomain(event, domain.domainId);
|
|
130
|
+
}, children: domain.name }, domain.domainId)); })), !loadingFlags && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { onClick: toggleDrawer(true), children: translationText.other })), (0, jsx_runtime_1.jsx)(material_1.Drawer, { anchor: 'right', open: openDrawer, onClose: function () {
|
|
131
|
+
toggleDrawer(false);
|
|
132
|
+
handlePreviewClose({ stopPropagation: function () { } });
|
|
133
|
+
}, onClick: function (e) { return e.stopPropagation(); }, sx: {
|
|
134
|
+
zIndex: function (theme) { return theme.zIndex.drawer * 10; },
|
|
135
|
+
}, children: isLoadingAllDomain ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
136
|
+
width: function (t) { return t.spacing(60); },
|
|
137
|
+
}, children: (0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {}) }) })) : ((0, jsx_runtime_1.jsxs)(material_1.List, { className: classes.drawer, children: [(0, jsx_runtime_1.jsx)(material_1.ListItem, { component: "div", children: (0, jsx_runtime_1.jsx)(material_1.TextField, { fullWidth: true, placeholder: translationText.searchPlaceholder, size: 'small', sx: {
|
|
138
|
+
'& fieldset': {
|
|
139
|
+
border: 'none!important'
|
|
140
|
+
}
|
|
141
|
+
}, inputProps: { 'aria-label': 'search' }, InputProps: {
|
|
142
|
+
startAdornment: (0, jsx_runtime_1.jsx)(icons_material_1.Search, {}),
|
|
143
|
+
}, onChange: function (e) {
|
|
144
|
+
return setSearchDomainString(e.target.value);
|
|
145
|
+
} }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), allDomain &&
|
|
146
|
+
allDomain
|
|
147
|
+
.filter(function (d) {
|
|
148
|
+
return d.name
|
|
149
|
+
.toLowerCase()
|
|
150
|
+
.includes(searchDomainString.toLowerCase());
|
|
151
|
+
})
|
|
152
|
+
.sort(function (a, b) {
|
|
153
|
+
return a.name !== b.name
|
|
154
|
+
? a.name < b.name
|
|
155
|
+
? -1
|
|
156
|
+
: 1
|
|
157
|
+
: 0;
|
|
158
|
+
})
|
|
159
|
+
.map(function (domain) { return ((0, jsx_runtime_1.jsxs)(material_1.ListItem, { button: true, onClick: function (e) {
|
|
160
|
+
return handlePreviewDomain(e, domain.domainId);
|
|
161
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: domain.name }), (0, jsx_runtime_1.jsx)(material_1.ListItemSecondaryAction, { children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: translationText.copyToClipboard, placement: "left", arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { edge: "end", onClick: function (e) {
|
|
162
|
+
return handlePreviewDomain(e, domain.domainId);
|
|
163
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOutlined, { fontSize: "small" }) }) }) })] }, domain.domainId)); })] })) })] }));
|
|
164
|
+
};
|
|
165
|
+
exports.default = PreviewCampaignContainer;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DomainPreviewProps {
|
|
3
|
+
handlePreviewPage: (e: React.MouseEvent<HTMLSpanElement, any>) => void;
|
|
4
|
+
isSelectDomain?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const DomainPreview: React.FC<DomainPreviewProps>;
|
|
7
|
+
export default DomainPreview;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
var
|
|
5
|
-
|
|
4
|
+
var icons_material_1 = require("@mui/icons-material");
|
|
5
|
+
var material_1 = require("@mui/material");
|
|
6
|
+
var DomainPreview = function (_a) {
|
|
7
|
+
var handlePreviewPage = _a.handlePreviewPage, isSelectDomain = _a.isSelectDomain;
|
|
8
|
+
return isSelectDomain ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, { component: 'p', sx: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOutlined, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, { component: 'span', "aria-label": "more", "aria-controls": "long-menu", "aria-haspopup": "true", onClick: handlePreviewPage, sx: { height: '20px' }, children: (0, jsx_runtime_1.jsx)(icons_material_1.ArrowDropDown, { fontSize: "small" }) })] })) : ((0, jsx_runtime_1.jsx)(icons_material_1.VisibilityOutlined, {}));
|
|
6
9
|
};
|
|
7
|
-
exports.default =
|
|
10
|
+
exports.default = DomainPreview;
|
|
@@ -29,6 +29,8 @@ var Helpers_1 = require("../../Utils/Helpers");
|
|
|
29
29
|
var Constant_1 = require("./Constant");
|
|
30
30
|
var Context_2 = __importDefault(require("./Context"));
|
|
31
31
|
var enums_1 = require("./enums");
|
|
32
|
+
var DomainPreview_1 = __importDefault(require("../../ACM-AXN/DomainPreview"));
|
|
33
|
+
var PreviewButton_1 = __importDefault(require("../../ACM-AXN/DomainPreview/PreviewButton"));
|
|
32
34
|
var PageContainer = function () {
|
|
33
35
|
var _a;
|
|
34
36
|
var _b = (0, Context_2.default)(), pageCode = _b.pageCode, service = _b.service, domainId = _b.domainId, CONFIGS = _b.configs;
|
|
@@ -42,16 +44,18 @@ var PageContainer = function () {
|
|
|
42
44
|
var _g = (0, react_1.useState)(true), isLoadDirectory = _g[0], setLoadLoadDirectory = _g[1];
|
|
43
45
|
var _h = (0, react_1.useState)(true), tempLoading = _h[0], setTempLoading = _h[1];
|
|
44
46
|
var _j = (0, react_1.useState)(), anchorEl = _j[0], setAnchorEl = _j[1];
|
|
47
|
+
var _k = (0, react_1.useState)(''), previewId = _k[0], setPreviewId = _k[1];
|
|
45
48
|
var open = Boolean(anchorEl);
|
|
46
|
-
var handlePreviewPage = function (e) {
|
|
49
|
+
var handlePreviewPage = function (e, id) {
|
|
47
50
|
e.stopPropagation();
|
|
51
|
+
setPreviewId(id);
|
|
48
52
|
setAnchorEl(e.currentTarget);
|
|
49
53
|
};
|
|
50
54
|
var prevQuery = (0, react_1.useRef)({});
|
|
51
|
-
var
|
|
55
|
+
var _l = (0, react_1.useState)({
|
|
52
56
|
items: [],
|
|
53
57
|
totalItemCount: 0,
|
|
54
|
-
}), pageList =
|
|
58
|
+
}), pageList = _l[0], setPage = _l[1];
|
|
55
59
|
var columnDefinitions = (0, react_1.useMemo)(function () { return [
|
|
56
60
|
{
|
|
57
61
|
field: 'stt',
|
|
@@ -92,6 +96,10 @@ var PageContainer = function () {
|
|
|
92
96
|
},
|
|
93
97
|
},
|
|
94
98
|
]; }, [t]);
|
|
99
|
+
var handlePreviewClose = function (event) {
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
setAnchorEl(null);
|
|
102
|
+
};
|
|
95
103
|
(0, react_1.useLayoutEffect)(function () {
|
|
96
104
|
setDirectories([]);
|
|
97
105
|
setInit(true);
|
|
@@ -149,86 +157,72 @@ var PageContainer = function () {
|
|
|
149
157
|
((_a = (0, lodash_1.minBy)(directories, 'level')) === null || _a === void 0 ? void 0 : _a.directoryId));
|
|
150
158
|
prevQuery.current = (0, lodash_1.cloneDeep)(input);
|
|
151
159
|
}, [directories, handleFetchPaging]);
|
|
152
|
-
var handlePreview = function (id) {
|
|
160
|
+
var handlePreview = function (id, domainId) {
|
|
153
161
|
var url = "".concat(CONFIGS.CAPTIVE_DOMAIN, "/").concat(CONFIGS.PAGE_LOGIN_PREVIEW, "?loginId=").concat(id, "&domainId=").concat(domainId, "&isNetworkCampaign=false");
|
|
154
162
|
window.open(url, '_blank');
|
|
155
163
|
};
|
|
164
|
+
var handlePreviewClick = function (id) {
|
|
165
|
+
handlePreview(id, domainId || CONFIGS.DEFAULT_PREVIEW_DOMAIN_ID || '');
|
|
166
|
+
};
|
|
156
167
|
var handleExport = function (id) {
|
|
157
168
|
service.pagesExport(id).then(function (res) {
|
|
158
169
|
(0, Helpers_1.downloadZipFile)(res, "Page_".concat(pageCode === enums_1.PageCode.Lgn ? 'lgn' : 'wlc', "_"));
|
|
159
170
|
});
|
|
160
171
|
};
|
|
161
|
-
return ((0, jsx_runtime_1.
|
|
172
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
162
173
|
'& th:last-of-type': {
|
|
163
174
|
width: '250px!important',
|
|
164
175
|
},
|
|
165
|
-
}, children: tempLoading || isLoadDirectory ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.PageManagement, { title: t([
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
},
|
|
179
|
-
], columns: columnDefinitions, rows: pageList.items, onChangeQueryInput: getPagePaging, getRowId: function (obj) { return obj.pageId; }, loading: loading, totalOfRows: pageList.totalItemCount, onCreateButtonClick: function () {
|
|
180
|
-
navigate(Constant_1.pageConstants.CREATE_PAGE);
|
|
181
|
-
}, onCreateFolderButtonClick: function () {
|
|
182
|
-
var _a;
|
|
183
|
-
navigate([
|
|
184
|
-
Constant_1.pageConstants.PAGE_CREATE_DIRECTORY,
|
|
185
|
-
(_a = (0, lodash_1.minBy)(directories, 'level')) === null || _a === void 0 ? void 0 : _a.directoryId,
|
|
186
|
-
].join('/'));
|
|
187
|
-
}, rowActions: [
|
|
188
|
-
{
|
|
189
|
-
icon: (0, jsx_runtime_1.jsx)(icons_material_1.Visibility, {}),
|
|
190
|
-
// icon: (() => {
|
|
191
|
-
// return (
|
|
192
|
-
// <Typography
|
|
193
|
-
// component={'p'}
|
|
194
|
-
// // onClick={(e) => handlePreview(e)}
|
|
195
|
-
// title={t('Campaign.Preview')}
|
|
196
|
-
// >
|
|
197
|
-
// <VisibilityOutlined fontSize="small" />
|
|
198
|
-
// <span
|
|
199
|
-
// aria-label="more"
|
|
200
|
-
// aria-controls="long-menu"
|
|
201
|
-
// aria-haspopup="true"
|
|
202
|
-
// onClick={handlePreviewPage}
|
|
203
|
-
// >
|
|
204
|
-
// <ArrowDropDown fontSize="small" />
|
|
205
|
-
// </span>
|
|
206
|
-
// </Typography>
|
|
207
|
-
// )
|
|
208
|
-
// })(),
|
|
209
|
-
tooltipTitle: t('Common.Preview'),
|
|
210
|
-
action: handlePreview,
|
|
211
|
-
// action: () => {},
|
|
212
|
-
sx: {
|
|
213
|
-
display: pageCode === enums_1.PageCode.Wlc
|
|
214
|
-
? 'none'
|
|
215
|
-
: 'unset',
|
|
176
|
+
}, children: [tempLoading || isLoadDirectory ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(AWING_1.PageManagement, { title: t([
|
|
177
|
+
'Page',
|
|
178
|
+
pageCode === enums_1.PageCode.Lgn
|
|
179
|
+
? 'LoginTitle'
|
|
180
|
+
: 'WelcomeTitle',
|
|
181
|
+
].join('.')), advancedSearchFields: [
|
|
182
|
+
{
|
|
183
|
+
fieldName: 'directoryId',
|
|
184
|
+
label: t('Common.Directory'),
|
|
185
|
+
type: 'directory',
|
|
186
|
+
icon: (0, jsx_runtime_1.jsx)(icons_material_1.FolderOpen, { fontSize: "small" }),
|
|
187
|
+
rootId: (_a = (0, lodash_1.minBy)(directories, 'level')) === null || _a === void 0 ? void 0 : _a.directoryId,
|
|
188
|
+
options: directories.map(function (directory) { return (__assign(__assign({}, directory), { text: directory.name, value: directory.directoryId })); }),
|
|
216
189
|
},
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
190
|
+
], columns: columnDefinitions, rows: pageList.items, onChangeQueryInput: getPagePaging, getRowId: function (obj) { return obj.pageId; }, loading: loading, totalOfRows: pageList.totalItemCount, onCreateButtonClick: function () {
|
|
191
|
+
navigate(Constant_1.pageConstants.CREATE_PAGE);
|
|
192
|
+
}, onCreateFolderButtonClick: function () {
|
|
193
|
+
var _a;
|
|
194
|
+
navigate([
|
|
195
|
+
Constant_1.pageConstants.PAGE_CREATE_DIRECTORY,
|
|
196
|
+
(_a = (0, lodash_1.minBy)(directories, 'level')) === null || _a === void 0 ? void 0 : _a.directoryId,
|
|
197
|
+
].join('/'));
|
|
198
|
+
}, rowActions: [
|
|
199
|
+
{
|
|
200
|
+
icon: function (props) { return (0, jsx_runtime_1.jsx)(DomainPreview_1.default, { handlePreviewPage: function (e) { return handlePreviewPage(e, props.id); }, isSelectDomain: Boolean(service.domainsGetAll) }); },
|
|
201
|
+
tooltipTitle: t('Common.Preview'),
|
|
202
|
+
action: handlePreviewClick,
|
|
203
|
+
sx: {
|
|
204
|
+
display: pageCode === enums_1.PageCode.Wlc
|
|
205
|
+
? 'none'
|
|
206
|
+
: 'unset',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
icon: (0, jsx_runtime_1.jsx)(icons_material_1.GetApp, {}),
|
|
211
|
+
tooltipTitle: t('Common.Export'),
|
|
212
|
+
action: handleExport,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
icon: (0, jsx_runtime_1.jsx)(icons_material_1.FileCopyOutlined, {}),
|
|
216
|
+
tooltipTitle: t('Common.Duplicate'),
|
|
217
|
+
action: handleClone,
|
|
218
|
+
},
|
|
219
|
+
], onRowClick: handleRowClick, onDelete: service.pagesDelete, showNotificationSuccess: function () { return snackbar('success'); }, confirmDelete: confirm, customActions: (0, jsx_runtime_1.jsx)(material_1.Button, { sx: {
|
|
220
|
+
marginLeft: function (theme) { return theme.spacing(1); },
|
|
221
|
+
}, color: "inherit", variant: "outlined", onClick: function () {
|
|
222
|
+
navigate(Constant_1.pageConstants.IMPORT_PAGE);
|
|
223
|
+
}, children: t('Common.Import') }) })), open &&
|
|
224
|
+
(0, jsx_runtime_1.jsx)(PreviewButton_1.default, { anchorEl: anchorEl, open: open, domainIds: [], handlePreviewClose: handlePreviewClose, handlePreviewDomain: function (event, domainId) {
|
|
225
|
+
handlePreview(previewId, domainId);
|
|
226
|
+
}, service: service })] }));
|
|
233
227
|
};
|
|
234
228
|
exports.default = PageContainer;
|
|
@@ -12,11 +12,15 @@ var Helpers_1 = require("../../../Utils/Helpers");
|
|
|
12
12
|
var Context_1 = __importDefault(require("../Context"));
|
|
13
13
|
var enums_1 = require("../enums");
|
|
14
14
|
var react_i18next_1 = require("react-i18next");
|
|
15
|
+
var DomainPreview_1 = __importDefault(require("../../../ACM-AXN/DomainPreview"));
|
|
16
|
+
var PreviewButton_1 = __importDefault(require("../../../ACM-AXN/DomainPreview/PreviewButton"));
|
|
15
17
|
var DrawerAction = function (_a) {
|
|
16
18
|
var type = _a.type;
|
|
17
19
|
var pageId = (0, react_router_dom_1.useParams)().pageId;
|
|
18
20
|
var _b = (0, Context_1.default)(), pageCode = _b.pageCode, CONFIGS = _b.configs, domainId = _b.domainId, service = _b.service;
|
|
19
21
|
var _c = react_1.default.useState(false), loadingExport = _c[0], setLoadingExport = _c[1];
|
|
22
|
+
var _d = react_1.default.useState(), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
23
|
+
var open = Boolean(anchorEl);
|
|
20
24
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
21
25
|
var handleExport = function () {
|
|
22
26
|
setLoadingExport(true);
|
|
@@ -27,10 +31,23 @@ var DrawerAction = function (_a) {
|
|
|
27
31
|
})
|
|
28
32
|
.finally(function () { return setLoadingExport(false); });
|
|
29
33
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
var handlePreviewClose = function (event) {
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
setAnchorEl(null);
|
|
37
|
+
};
|
|
38
|
+
var handlePreview = function (domainId) {
|
|
39
|
+
var url = "".concat(CONFIGS.CAPTIVE_DOMAIN, "/").concat(CONFIGS.PAGE_LOGIN_PREVIEW, "?loginId=").concat(pageId, "&domainId=").concat(domainId, "&isNetworkCampaign=false");
|
|
40
|
+
window.open(url, '_blank');
|
|
41
|
+
};
|
|
42
|
+
var handlePreviewPage = function (e) {
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
setAnchorEl(e.currentTarget);
|
|
45
|
+
};
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [pageCode === enums_1.PageCode.Lgn && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('Campaign.Preview'), children: (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", color: "secondary", onClick: function (e) {
|
|
47
|
+
handlePreview(domainId || CONFIGS.DEFAULT_PREVIEW_DOMAIN_ID);
|
|
48
|
+
}, children: (0, jsx_runtime_1.jsx)(DomainPreview_1.default, { handlePreviewPage: handlePreviewPage, isSelectDomain: Boolean(service.domainsGetAll) }) }) })), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('Common.Export'), children: (0, jsx_runtime_1.jsx)(material_1.Button, { disabled: loadingExport, variant: "outlined", color: "secondary", style: { margin: '0px 16px' }, onClick: handleExport, children: (0, jsx_runtime_1.jsx)(icons_material_1.GetAppOutlined, {}) }) })] }), open &&
|
|
49
|
+
(0, jsx_runtime_1.jsx)(PreviewButton_1.default, { anchorEl: anchorEl, open: open, domainIds: [], handlePreviewClose: handlePreviewClose, handlePreviewDomain: function (event, domainId) {
|
|
50
|
+
handlePreview(domainId);
|
|
51
|
+
}, service: service })] }));
|
|
35
52
|
};
|
|
36
53
|
exports.default = DrawerAction;
|
|
@@ -60,7 +60,7 @@ var ViewInfo = function (_a) {
|
|
|
60
60
|
var _e = (0, Context_1.default)(), service = _e.service, pageCode = _e.pageCode, domainId = _e.domainId;
|
|
61
61
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
62
62
|
(0, react_1.useEffect)(function () {
|
|
63
|
-
var savedDirectoryId = JSON.parse(localStorage.getItem(Constant_1.PAGE_LOGIN_DIRECTORY_SELECTED) || '{
|
|
63
|
+
var savedDirectoryId = JSON.parse(localStorage.getItem(Constant_1.PAGE_LOGIN_DIRECTORY_SELECTED) || '{}')[Array.isArray(domainId) ? 'awingPge' : domainId];
|
|
64
64
|
if (savedDirectoryId && !pageId && !isMounted) {
|
|
65
65
|
setIsMounted(true);
|
|
66
66
|
handleChangeForm({ directoryId: savedDirectoryId }, true, 'directoryId');
|
|
@@ -110,6 +110,12 @@ export interface SystemPhysicalObject {
|
|
|
110
110
|
name: string;
|
|
111
111
|
path: string;
|
|
112
112
|
}
|
|
113
|
+
export interface IDomain {
|
|
114
|
+
domainId: string;
|
|
115
|
+
name: string | undefined;
|
|
116
|
+
rateSharing: number;
|
|
117
|
+
description: string | undefined;
|
|
118
|
+
}
|
|
113
119
|
export interface PageService {
|
|
114
120
|
directoriesGetByObjectTypeCode: (type: DirectoryRoot) => Promise<Directory[]>;
|
|
115
121
|
pagesPaging: (searchString?: string, pageSize?: number, pageIndex?: number, directoryId?: string) => Promise<PagesPaging>;
|
|
@@ -138,6 +144,8 @@ export interface PageService {
|
|
|
138
144
|
pagesPut: (id: string, body: PageModel) => Promise<void>;
|
|
139
145
|
pagesGet: (id: string) => Promise<PageModel>;
|
|
140
146
|
pagesClone: (id: string) => Promise<PageModel>;
|
|
147
|
+
domainsGetAll?: () => Promise<IDomain[]>;
|
|
148
|
+
domainsGetByIds?: (body: string[]) => Promise<IDomain[]>;
|
|
141
149
|
}
|
|
142
150
|
export interface PageProps {
|
|
143
151
|
service: PageService;
|
|
@@ -254,7 +254,10 @@ var DataGrid = function (props) {
|
|
|
254
254
|
opacity: isShouldHide
|
|
255
255
|
? 0
|
|
256
256
|
: 1,
|
|
257
|
-
}, sx: actionDef.sx,
|
|
257
|
+
}, sx: __assign(__assign({}, actionDef.sx), { borderRadius: '15%' }), children: typeof actionDef.icon ===
|
|
258
|
+
'function'
|
|
259
|
+
? actionDef.icon({ id: id, row: row, idx: idx, order: calcOrder(idx) })
|
|
260
|
+
: actionDef.icon }) }, "".concat(id, "-").concat(actIdx)));
|
|
258
261
|
}) }))] }), id));
|
|
259
262
|
}), spanningRowsPosition == 'bottom' && spanningRows] })] }), !rows.length && (0, jsx_runtime_1.jsx)(NoData_1.default, {})] }), onPageIndexChange && onPageSizeChange && ((0, jsx_runtime_1.jsx)(Pagination_1.default, { rowsPerPageOptions: rowsPerPageOptions, colSpan: 3, count: totalOfRows, rowsPerPage: pageSize, page: pageIndex, SelectProps: {
|
|
260
263
|
inputProps: { 'aria-label': 'rows per page' },
|
|
@@ -49,7 +49,12 @@ export interface RowActionDefinition {
|
|
|
49
49
|
/**
|
|
50
50
|
* Icon của button action
|
|
51
51
|
*/
|
|
52
|
-
icon: ReactNode
|
|
52
|
+
icon: ReactNode | React.FunctionComponent<{
|
|
53
|
+
id: string;
|
|
54
|
+
row: DataObject;
|
|
55
|
+
idx: number;
|
|
56
|
+
order: number;
|
|
57
|
+
}>;
|
|
53
58
|
/**
|
|
54
59
|
* Nội dung hiển thị trên tooltip
|
|
55
60
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "awing-library",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.18-beta",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"build-storybook": "storybook build",
|
|
79
79
|
"build": "npm run clean && tsc && tsc-alias && npm run copy",
|
|
80
80
|
"copy": "cp -r ./src/Assets/ ./lib/Assets",
|
|
81
|
-
"build:watch": "concurrently
|
|
81
|
+
"build:watch": "tsc && (concurrently \"tsc -w\" \"tsc-alias -w\")"
|
|
82
82
|
},
|
|
83
83
|
"prettier": {
|
|
84
84
|
"trailingComma": "es5",
|