@reltio/components 1.4.2219 → 1.4.2221
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/ExportDialog/ExportDialog.d.ts +15 -0
- package/ExportDialog/ExportDialog.js +144 -0
- package/ExportDialog/ExportDialog.module.css.js +9 -0
- package/ExportDialog/ExportDialog.test.d.ts +1 -0
- package/ExportDialog/ExportDialog.test.js +285 -0
- package/ExportDialog/index.d.ts +1 -0
- package/ExportDialog/index.js +1 -0
- package/SimpleAttributeEditor/SimpleAttributeEditor.js +4 -1
- package/SimpleAttributeEditor/SimpleAttributeEditor.test.js +40 -3
- package/cjs/ExportDialog/ExportDialog.d.ts +15 -0
- package/cjs/ExportDialog/ExportDialog.js +174 -0
- package/cjs/ExportDialog/ExportDialog.module.css.js +9 -0
- package/cjs/ExportDialog/ExportDialog.test.d.ts +1 -0
- package/cjs/ExportDialog/ExportDialog.test.js +290 -0
- package/cjs/ExportDialog/index.d.ts +1 -0
- package/cjs/ExportDialog/index.js +5 -0
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.js +4 -1
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.test.js +40 -3
- package/cjs/contexts/AuthoringPerspectiveViewContext/index.d.ts +2 -0
- package/cjs/contexts/AuthoringPerspectiveViewContext/index.js +9 -0
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/cjs/contexts/MdmModuleContext/hooks.js +3 -1
- package/cjs/contexts/SnackbarContext/index.d.ts +9 -2
- package/cjs/features/workflow/ReassignButton/components/ReassignDialog/styles.d.ts +1 -1
- package/cjs/hooks/useExportController/index.d.ts +1 -0
- package/cjs/hooks/useExportController/index.js +5 -0
- package/cjs/hooks/useExportController/useExportController.d.ts +11 -0
- package/cjs/hooks/useExportController/useExportController.js +20 -0
- package/cjs/hooks/useInternalExport/index.d.ts +1 -0
- package/cjs/hooks/useInternalExport/index.js +5 -0
- package/cjs/hooks/useInternalExport/useInternalExport.d.ts +35 -0
- package/cjs/hooks/useInternalExport/useInternalExport.js +205 -0
- package/cjs/hooks/useSnackbar/useSnackbar.d.ts +2 -1
- package/cjs/hooks/useSnackbar/useSnackbar.js +23 -4
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +8 -4
- package/contexts/AuthoringPerspectiveViewContext/index.d.ts +2 -0
- package/contexts/AuthoringPerspectiveViewContext/index.js +3 -0
- package/contexts/MdmModuleContext/context.d.ts +2 -0
- package/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/contexts/MdmModuleContext/hooks.js +1 -0
- package/contexts/SnackbarContext/index.d.ts +9 -2
- package/features/workflow/ReassignButton/components/ReassignDialog/styles.d.ts +1 -1
- package/hooks/useExportController/index.d.ts +1 -0
- package/hooks/useExportController/index.js +1 -0
- package/hooks/useExportController/useExportController.d.ts +11 -0
- package/hooks/useExportController/useExportController.js +16 -0
- package/hooks/useInternalExport/index.d.ts +1 -0
- package/hooks/useInternalExport/index.js +1 -0
- package/hooks/useInternalExport/useInternalExport.d.ts +35 -0
- package/hooks/useInternalExport/useInternalExport.js +198 -0
- package/hooks/useSnackbar/useSnackbar.d.ts +2 -1
- package/hooks/useSnackbar/useSnackbar.js +24 -5
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,174 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
36
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.ExportDialog = void 0;
|
|
66
|
+
var react_1 = __importStar(require("react"));
|
|
67
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
68
|
+
var Dialog_1 = __importDefault(require("@mui/material/Dialog"));
|
|
69
|
+
var DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
|
|
70
|
+
var DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
|
|
71
|
+
var Button_1 = __importDefault(require("@mui/material/Button"));
|
|
72
|
+
var DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
|
|
73
|
+
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
74
|
+
var TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
75
|
+
var DropDownSelector_1 = require("../DropDownSelector");
|
|
76
|
+
var useInternalExport_1 = require("../hooks/useInternalExport");
|
|
77
|
+
var SnackbarContext_1 = require("../contexts/SnackbarContext");
|
|
78
|
+
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
79
|
+
var errors_1 = require("../helpers/errors");
|
|
80
|
+
var ErrorWrapper_1 = require("../ErrorWrapper");
|
|
81
|
+
var ExportDialog_module_css_1 = __importDefault(require("./ExportDialog.module.css"));
|
|
82
|
+
var ExportDialog = function (_a) {
|
|
83
|
+
var open = _a.open, onClose = _a.onClose, columnsByEntityType = _a.columnsByEntityType, profilesCount = _a.profilesCount, onExternalExport = _a.onExternalExport, onLoadingChange = _a.onLoadingChange, _b = _a.filter, filter = _b === void 0 ? '' : _b, activityFilter = _a.activityFilter, isSearchByOv = _a.isSearchByOv;
|
|
84
|
+
var showSnackbarMessage = (0, react_1.useContext)(SnackbarContext_1.SnackbarContext);
|
|
85
|
+
var openConsoleApp = (0, MdmModuleContext_1.useMdmAction)('openConsoleApp');
|
|
86
|
+
var isExportingRef = (0, react_1.useRef)(false);
|
|
87
|
+
var _c = (0, useInternalExport_1.useInternalExport)({
|
|
88
|
+
columnsByEntityType: columnsByEntityType,
|
|
89
|
+
dialogOpen: open,
|
|
90
|
+
filter: filter,
|
|
91
|
+
activityFilter: activityFilter,
|
|
92
|
+
isSearchByOv: isSearchByOv
|
|
93
|
+
}), exportName = _c.exportName, onChangeExportName = _c.onChangeExportName, fileFormat = _c.fileFormat, onChangeFileFormat = _c.onChangeFileFormat, formatOptions = _c.formatOptions, onExport = _c.onExport, entityTypesDetails = _c.entityTypesDetails;
|
|
94
|
+
var handleConfirm = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
var result, failedCount, successfulCount, failedJobsString, errorMessage, error;
|
|
96
|
+
var _a, _b;
|
|
97
|
+
return __generator(this, function (_c) {
|
|
98
|
+
switch (_c.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
if (isExportingRef.current)
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
isExportingRef.current = true;
|
|
103
|
+
onLoadingChange === null || onLoadingChange === void 0 ? void 0 : onLoadingChange(true);
|
|
104
|
+
onClose();
|
|
105
|
+
_c.label = 1;
|
|
106
|
+
case 1:
|
|
107
|
+
_c.trys.push([1, , 3, 4]);
|
|
108
|
+
return [4 /*yield*/, onExport()];
|
|
109
|
+
case 2:
|
|
110
|
+
result = _c.sent();
|
|
111
|
+
if (result) {
|
|
112
|
+
failedCount = ((_a = result.failedJobs) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
113
|
+
successfulCount = result.total - failedCount;
|
|
114
|
+
if (successfulCount > 0) {
|
|
115
|
+
showSnackbarMessage({
|
|
116
|
+
message: ui_i18n_1.default.text("Your export job is underway. We'll send an email with the download link once it's complete."),
|
|
117
|
+
action: {
|
|
118
|
+
label: ui_i18n_1.default.text('View progress'),
|
|
119
|
+
onClick: function () {
|
|
120
|
+
openConsoleApp('Export');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (failedCount > 0) {
|
|
126
|
+
failedJobsString = (_b = result.failedJobs) === null || _b === void 0 ? void 0 : _b.join(', ');
|
|
127
|
+
errorMessage = ui_i18n_1.default.text('Failed to export ${failedJobsString}.', { failedJobsString: failedJobsString });
|
|
128
|
+
error = new Error(errorMessage);
|
|
129
|
+
(0, errors_1.showErrorMessage)(error, {
|
|
130
|
+
message: errorMessage
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return [3 /*break*/, 4];
|
|
135
|
+
case 3:
|
|
136
|
+
isExportingRef.current = false;
|
|
137
|
+
onLoadingChange === null || onLoadingChange === void 0 ? void 0 : onLoadingChange(false);
|
|
138
|
+
return [7 /*endfinally*/];
|
|
139
|
+
case 4: return [2 /*return*/];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}); }, [onClose, onExport, showSnackbarMessage, openConsoleApp, onLoadingChange]);
|
|
143
|
+
var handleExternalExport = (0, react_1.useCallback)(function () {
|
|
144
|
+
onClose();
|
|
145
|
+
onExternalExport();
|
|
146
|
+
}, [onExternalExport, onClose]);
|
|
147
|
+
var renderDetails = (0, react_1.useMemo)(function () { return (react_1.default.createElement(react_1.default.Fragment, null, Object.values(entityTypesDetails).map(function (data, index) { return (react_1.default.createElement("span", { key: index },
|
|
148
|
+
react_1.default.createElement("span", { className: ExportDialog_module_css_1.default.attributesCount }, data.label),
|
|
149
|
+
ui_i18n_1.default.text('(${selected}/${total} attributes)', {
|
|
150
|
+
selected: data.selectedAttributesCount,
|
|
151
|
+
total: data.totalAttributesCount
|
|
152
|
+
}),
|
|
153
|
+
index < Object.values(entityTypesDetails).length - 1 && ', ')); }))); }, [entityTypesDetails]);
|
|
154
|
+
return (react_1.default.createElement(Dialog_1.default, { open: open, onClose: onClose, fullWidth: true, classes: { paper: ExportDialog_module_css_1.default.dialog } },
|
|
155
|
+
react_1.default.createElement(DialogTitle_1.default, { classes: { root: ExportDialog_module_css_1.default.dialogTitle } }, ui_i18n_1.default.text('Export')),
|
|
156
|
+
react_1.default.createElement(DialogContent_1.default, { classes: { root: ExportDialog_module_css_1.default.dialogContent } },
|
|
157
|
+
react_1.default.createElement(ErrorWrapper_1.ErrorWrapper, { errorMessage: exportName ? '' : ui_i18n_1.default.text('This field is required') },
|
|
158
|
+
react_1.default.createElement(TextField_1.default, { label: ui_i18n_1.default.text('Name your export'), value: exportName, onChange: onChangeExportName, variant: 'filled', fullWidth: true, size: 'small', required: true })),
|
|
159
|
+
react_1.default.createElement(Typography_1.default, { variant: "subtitle2", className: ExportDialog_module_css_1.default.subtitle }, ui_i18n_1.default.text('Data selected')),
|
|
160
|
+
react_1.default.createElement("div", { className: ExportDialog_module_css_1.default.summary },
|
|
161
|
+
react_1.default.createElement(Typography_1.default, { className: ExportDialog_module_css_1.default.totalCaption, color: "textSecondary" },
|
|
162
|
+
react_1.default.createElement("span", { className: ExportDialog_module_css_1.default.totalNumber }, ui_i18n_1.default.number(profilesCount, '0,0')),
|
|
163
|
+
profilesCount === 1 ? ui_i18n_1.default.text('Profile') : ui_i18n_1.default.text('Profiles')),
|
|
164
|
+
react_1.default.createElement(Typography_1.default, { variant: "body2", color: "textSecondary" }, renderDetails)),
|
|
165
|
+
react_1.default.createElement(Typography_1.default, { variant: "subtitle2", className: ExportDialog_module_css_1.default.subtitle }, ui_i18n_1.default.text('Export options')),
|
|
166
|
+
react_1.default.createElement(DropDownSelector_1.DropDownSelector, { height: 44, value: fileFormat, onChange: onChangeFileFormat, label: ui_i18n_1.default.text('File format'), options: formatOptions }),
|
|
167
|
+
react_1.default.createElement("div", { className: ExportDialog_module_css_1.default.externalExportWrapper },
|
|
168
|
+
react_1.default.createElement(Typography_1.default, { component: "span", variant: "body2" }, ui_i18n_1.default.text('Want more export options?')),
|
|
169
|
+
react_1.default.createElement(Button_1.default, { onClick: handleExternalExport, color: "primary" }, ui_i18n_1.default.text('Go to export application')))),
|
|
170
|
+
react_1.default.createElement(DialogActions_1.default, { classes: { root: ExportDialog_module_css_1.default.dialogActions } },
|
|
171
|
+
react_1.default.createElement(Button_1.default, { onClick: onClose }, ui_i18n_1.default.text('Cancel')),
|
|
172
|
+
react_1.default.createElement(Button_1.default, { onClick: handleConfirm, color: "primary", disabled: !exportName }, ui_i18n_1.default.text('Export')))));
|
|
173
|
+
};
|
|
174
|
+
exports.ExportDialog = ExportDialog;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"dialog":"ExportDialog-dialog--lQGKH","dialogTitle":"ExportDialog-dialogTitle--xpDLc","dialogContent":"ExportDialog-dialogContent--r--OS","dialogActions":"ExportDialog-dialogActions--jfCax","subtitle":"ExportDialog-subtitle--rwHDK","summary":"ExportDialog-summary--TlOEd","externalExportWrapper":"ExportDialog-externalExportWrapper--vaAXD","totalCaption":"ExportDialog-totalCaption--DpfR-","totalNumber":"ExportDialog-totalNumber--emHu3","attributesCount":"ExportDialog-attributesCount--NRt8X"};
|
|
2
|
+
if (typeof document !== 'undefined') {
|
|
3
|
+
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
|
+
const style = document.createElement('style');
|
|
5
|
+
style.type = 'text/css'
|
|
6
|
+
style.innerHTML = `.ExportDialog-dialog--lQGKH{width:600px}.ExportDialog-dialogTitle--xpDLc{padding:16px 16px 4px}.ExportDialog-dialogContent--r--OS{padding:20px 16px}.ExportDialog-dialogActions--jfCax{padding:8px}.ExportDialog-subtitle--rwHDK{margin:24px 0 6px}.ExportDialog-summary--TlOEd{background-color:#fafafa;border-radius:4px;padding:12px 16px}.ExportDialog-externalExportWrapper--vaAXD{padding:16px 0}.ExportDialog-totalCaption--DpfR-{font-size:18px;padding-bottom:8px}.ExportDialog-totalNumber--emHu3{font-size:20px;font-weight:500}.ExportDialog-attributesCount--NRt8X,.ExportDialog-totalNumber--emHu3{color:rgba(0,0,0,.87);margin-right:5px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
module.exports = styles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var react_1 = __importDefault(require("react"));
|
|
54
|
+
var react_2 = require("@testing-library/react");
|
|
55
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
|
+
var styles_1 = require("@mui/material/styles");
|
|
57
|
+
var styles_2 = require("@mui/styles");
|
|
58
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
59
|
+
var SnackbarContext_1 = require("../contexts/SnackbarContext");
|
|
60
|
+
var ExportDialog_1 = require("../ExportDialog");
|
|
61
|
+
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
62
|
+
var ErrorPopup_1 = require("../ErrorPopup");
|
|
63
|
+
var constants_1 = require("../constants");
|
|
64
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { exportData: jest.fn() })); });
|
|
65
|
+
var metadata = {
|
|
66
|
+
entityTypes: [
|
|
67
|
+
{
|
|
68
|
+
uri: 'configuration/entityTypes/HCP',
|
|
69
|
+
label: 'HCP',
|
|
70
|
+
attributes: [
|
|
71
|
+
{
|
|
72
|
+
uri: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
73
|
+
type: 'String',
|
|
74
|
+
name: 'FirstName',
|
|
75
|
+
label: 'First Name',
|
|
76
|
+
access: ['READ', 'CREATE', 'UPDATE', 'INITIATE_CHANGE_REQUEST']
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
uri: 'configuration/entityTypes/HCP/attributes/LastName',
|
|
80
|
+
type: 'String',
|
|
81
|
+
name: 'LastName',
|
|
82
|
+
label: 'Last Name',
|
|
83
|
+
access: ['READ', 'CREATE', 'UPDATE', 'INITIATE_CHANGE_REQUEST']
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
uri: 'configuration/entityTypes/HCP/attributes/Phone',
|
|
87
|
+
type: 'String',
|
|
88
|
+
name: 'Phone',
|
|
89
|
+
label: 'Phone',
|
|
90
|
+
access: ['READ', 'CREATE', 'UPDATE', 'INITIATE_CHANGE_REQUEST']
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
uri: 'configuration/entityTypes/HCO',
|
|
96
|
+
label: 'HCO',
|
|
97
|
+
attributes: [
|
|
98
|
+
{
|
|
99
|
+
label: 'Name',
|
|
100
|
+
name: 'Name',
|
|
101
|
+
type: 'String',
|
|
102
|
+
uri: 'configuration/entityTypes/HCO/attributes/Name'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
label: 'Status',
|
|
106
|
+
name: 'Status',
|
|
107
|
+
type: 'String',
|
|
108
|
+
uri: 'configuration/entityTypes/HCO/attributes/Status'
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
};
|
|
114
|
+
var mdmValues = {
|
|
115
|
+
metadata: metadata,
|
|
116
|
+
exportPath: '/nui/export',
|
|
117
|
+
tenant: {
|
|
118
|
+
id: 't1',
|
|
119
|
+
name: 't1'
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var mdmActions = { openConsoleApp: jest.fn() };
|
|
123
|
+
var defaultProps = {
|
|
124
|
+
open: true,
|
|
125
|
+
onClose: jest.fn(),
|
|
126
|
+
columnsByEntityType: {
|
|
127
|
+
'configuration/entityTypes/HCP': ['attributes.FirstName', 'attributes.LastName'],
|
|
128
|
+
'configuration/entityTypes/HCO': []
|
|
129
|
+
},
|
|
130
|
+
profilesCount: 15,
|
|
131
|
+
onExternalExport: jest.fn(),
|
|
132
|
+
onLoadingChange: jest.fn(),
|
|
133
|
+
filter: "(equals(type,'configuration/entityTypes/HCP') or equals(type,'configuration/entityTypes/HCO'))",
|
|
134
|
+
activityFilter: mdm_sdk_1.ActivityFilter.ALL,
|
|
135
|
+
isSearchByOv: true
|
|
136
|
+
};
|
|
137
|
+
var showSnackbarMessage = jest.fn();
|
|
138
|
+
var setUp = function (props) {
|
|
139
|
+
if (props === void 0) { props = defaultProps; }
|
|
140
|
+
var user = user_event_1.default.setup();
|
|
141
|
+
var Providers = function (_a) {
|
|
142
|
+
var children = _a.children;
|
|
143
|
+
return (react_1.default.createElement(styles_2.ThemeProvider, { theme: (0, styles_1.createTheme)(constants_1.theme) },
|
|
144
|
+
react_1.default.createElement(SnackbarContext_1.SnackbarContext.Provider, { value: showSnackbarMessage },
|
|
145
|
+
react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues, actions: mdmActions },
|
|
146
|
+
react_1.default.createElement(ErrorPopup_1.ErrorPopup, null),
|
|
147
|
+
children))));
|
|
148
|
+
};
|
|
149
|
+
return __assign(__assign({}, (0, react_2.render)(react_1.default.createElement(ExportDialog_1.ExportDialog, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
150
|
+
};
|
|
151
|
+
describe('ExportDialog tests', function () {
|
|
152
|
+
beforeEach(function () {
|
|
153
|
+
mdm_sdk_1.exportData.mockResolvedValue({ status: 'scheduled' });
|
|
154
|
+
});
|
|
155
|
+
afterEach(function () {
|
|
156
|
+
jest.clearAllMocks();
|
|
157
|
+
});
|
|
158
|
+
it('should render dialog correctly', function () {
|
|
159
|
+
jest.useFakeTimers();
|
|
160
|
+
jest.setSystemTime(new Date(2025, 10, 25, 9, 10, 0));
|
|
161
|
+
setUp();
|
|
162
|
+
expect(react_2.screen.getByRole('dialog')).toBeInTheDocument();
|
|
163
|
+
expect(react_2.screen.getByLabelText('Export')).toBeInTheDocument();
|
|
164
|
+
expect(react_2.screen.getByText('Name your export')).toBeInTheDocument();
|
|
165
|
+
expect(react_2.screen.getByDisplayValue('Untitled Export Job 11252025_09:10')).toBeInTheDocument();
|
|
166
|
+
expect(react_2.screen.getByText('Data selected')).toBeInTheDocument();
|
|
167
|
+
expect(react_2.screen.getByText('15')).toBeInTheDocument();
|
|
168
|
+
expect(react_2.screen.getByText('Profiles')).toBeInTheDocument();
|
|
169
|
+
expect(react_2.screen.getByText('HCP')).toBeInTheDocument();
|
|
170
|
+
expect(react_2.screen.getByText('(2/13 attributes),')).toBeInTheDocument();
|
|
171
|
+
expect(react_2.screen.getByText('HCO')).toBeInTheDocument();
|
|
172
|
+
expect(react_2.screen.getByText('(12/12 attributes)')).toBeInTheDocument();
|
|
173
|
+
expect(react_2.screen.getByText('Export options')).toBeInTheDocument();
|
|
174
|
+
expect(react_2.screen.getByText('File format')).toBeInTheDocument();
|
|
175
|
+
expect(react_2.screen.getByText('CSV Flattened')).toBeInTheDocument();
|
|
176
|
+
expect(react_2.screen.getByText('Want more export options?')).toBeInTheDocument();
|
|
177
|
+
expect(react_2.screen.getByRole('button', { name: 'Go to export application' })).toBeInTheDocument();
|
|
178
|
+
expect(react_2.screen.getByRole('button', { name: 'Cancel' })).toBeInTheDocument();
|
|
179
|
+
expect(react_2.screen.getByRole('button', { name: 'Export' })).toBeInTheDocument();
|
|
180
|
+
jest.useRealTimers();
|
|
181
|
+
});
|
|
182
|
+
it('should call onClose when Cancel button is clicked', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
183
|
+
var user;
|
|
184
|
+
return __generator(this, function (_a) {
|
|
185
|
+
switch (_a.label) {
|
|
186
|
+
case 0:
|
|
187
|
+
user = setUp().user;
|
|
188
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Cancel' }))];
|
|
189
|
+
case 1:
|
|
190
|
+
_a.sent();
|
|
191
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
192
|
+
return [2 /*return*/];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}); });
|
|
196
|
+
it('should call onExternalExport when Go to export application button is clicked', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
197
|
+
var user;
|
|
198
|
+
return __generator(this, function (_a) {
|
|
199
|
+
switch (_a.label) {
|
|
200
|
+
case 0:
|
|
201
|
+
user = setUp().user;
|
|
202
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Go to export application' }))];
|
|
203
|
+
case 1:
|
|
204
|
+
_a.sent();
|
|
205
|
+
expect(defaultProps.onExternalExport).toHaveBeenCalled();
|
|
206
|
+
return [2 /*return*/];
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}); });
|
|
210
|
+
it('should call onExport once and shows snackbar action on success', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
211
|
+
var user;
|
|
212
|
+
return __generator(this, function (_a) {
|
|
213
|
+
switch (_a.label) {
|
|
214
|
+
case 0:
|
|
215
|
+
jest.useFakeTimers();
|
|
216
|
+
jest.setSystemTime(new Date(2025, 10, 25, 9, 10, 0));
|
|
217
|
+
user = setUp().user;
|
|
218
|
+
jest.useRealTimers();
|
|
219
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Export' }))];
|
|
220
|
+
case 1:
|
|
221
|
+
_a.sent();
|
|
222
|
+
expect(defaultProps.onLoadingChange).toHaveBeenCalledWith(true);
|
|
223
|
+
expect(mdm_sdk_1.exportData).toHaveBeenCalledTimes(2);
|
|
224
|
+
expect(mdm_sdk_1.exportData).toHaveBeenCalledWith(expect.objectContaining({
|
|
225
|
+
exportPath: '/nui/export',
|
|
226
|
+
tenant: 't1',
|
|
227
|
+
options: {
|
|
228
|
+
fileFormat: mdm_sdk_1.ExportDataFormat.CSV,
|
|
229
|
+
dateFormat: 'readable',
|
|
230
|
+
filter: defaultProps.filter,
|
|
231
|
+
activeness: mdm_sdk_1.ActivityFilter.ALL,
|
|
232
|
+
options: 'parallelExecution,searchByOv',
|
|
233
|
+
name: 'Untitled Export Job 11252025_09:10_HCP',
|
|
234
|
+
select: 'attributes.FirstName,attributes.LastName'
|
|
235
|
+
},
|
|
236
|
+
includeType: ['configuration/entityTypes/HCP'],
|
|
237
|
+
headerOrder: mdm_sdk_1.ExportHeaderOrder.Select
|
|
238
|
+
}));
|
|
239
|
+
expect(mdm_sdk_1.exportData).toHaveBeenCalledWith(expect.objectContaining({
|
|
240
|
+
exportPath: '/nui/export',
|
|
241
|
+
tenant: 't1',
|
|
242
|
+
options: {
|
|
243
|
+
fileFormat: mdm_sdk_1.ExportDataFormat.CSV,
|
|
244
|
+
dateFormat: 'readable',
|
|
245
|
+
filter: defaultProps.filter,
|
|
246
|
+
activeness: mdm_sdk_1.ActivityFilter.ALL,
|
|
247
|
+
options: 'parallelExecution,searchByOv',
|
|
248
|
+
name: 'Untitled Export Job 11252025_09:10_entities',
|
|
249
|
+
sendHidden: false
|
|
250
|
+
},
|
|
251
|
+
includeType: ['configuration/entityTypes/HCO'],
|
|
252
|
+
headerOrder: mdm_sdk_1.ExportHeaderOrder.Default
|
|
253
|
+
}));
|
|
254
|
+
expect(defaultProps.onLoadingChange).toHaveBeenCalledWith(false);
|
|
255
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
256
|
+
expect(showSnackbarMessage).toHaveBeenCalledWith({
|
|
257
|
+
message: "Your export job is underway. We'll send an email with the download link once it's complete.",
|
|
258
|
+
action: {
|
|
259
|
+
label: 'View progress',
|
|
260
|
+
onClick: expect.any(Function)
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return [2 /*return*/];
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}); });
|
|
267
|
+
it('should show error message when some export jobs failed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
+
var user, errorMessage;
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0:
|
|
272
|
+
mdm_sdk_1.exportData.mockRejectedValueOnce(new Error('Failed to export configuration/entityTypes/HCP'));
|
|
273
|
+
mdm_sdk_1.exportData.mockResolvedValueOnce({ status: 'scheduled' });
|
|
274
|
+
user = setUp().user;
|
|
275
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Export' }))];
|
|
276
|
+
case 1:
|
|
277
|
+
_a.sent();
|
|
278
|
+
expect(defaultProps.onLoadingChange).toHaveBeenCalledWith(true);
|
|
279
|
+
expect(mdm_sdk_1.exportData).toHaveBeenCalledTimes(2);
|
|
280
|
+
expect(defaultProps.onLoadingChange).toHaveBeenCalledWith(false);
|
|
281
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
282
|
+
return [4 /*yield*/, react_2.screen.findByTestId('error-message')];
|
|
283
|
+
case 2:
|
|
284
|
+
errorMessage = _a.sent();
|
|
285
|
+
expect(errorMessage).toHaveTextContent('Failed to export configuration/entityTypes/HCP.');
|
|
286
|
+
return [2 /*return*/];
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}); });
|
|
290
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExportDialog } from './ExportDialog';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportDialog = void 0;
|
|
4
|
+
var ExportDialog_1 = require("./ExportDialog");
|
|
5
|
+
Object.defineProperty(exports, "ExportDialog", { enumerable: true, get: function () { return ExportDialog_1.ExportDialog; } });
|
|
@@ -75,6 +75,7 @@ var DependentLookupAutopopulationContext_1 = require("../contexts/DependentLooku
|
|
|
75
75
|
var styles_1 = require("./styles");
|
|
76
76
|
var AutoCompleteContext_1 = require("../contexts/AutoCompleteContext");
|
|
77
77
|
var AttributeValueContext_1 = require("../contexts/AttributeValueContext");
|
|
78
|
+
var AuthoringPerspectiveViewContext_1 = require("../contexts/AuthoringPerspectiveViewContext");
|
|
78
79
|
var AsyncMountPlaceholder = function () {
|
|
79
80
|
var styles = (0, styles_1.useStyles)();
|
|
80
81
|
return react_1.default.createElement("div", { className: styles.placeholder });
|
|
@@ -140,8 +141,10 @@ var SimpleAttributeEditor = function (_a) {
|
|
|
140
141
|
var hasError = !!errorMessage;
|
|
141
142
|
var deletedProps = deleted ? { disabled: true, isCrossedOut: true } : {};
|
|
142
143
|
var isProfilePerspectiveView = (0, react_1.useContext)(ProfilePerspectiveViewContext_1.ProfilePerspectiveViewContext);
|
|
144
|
+
var isAuthoringPerspectiveView = (0, react_1.useContext)(AuthoringPerspectiveViewContext_1.AuthoringPerspectiveViewContext);
|
|
145
|
+
var isEntityPerspectiveView = isProfilePerspectiveView || isAuthoringPerspectiveView;
|
|
143
146
|
var autopopulationContextValue = (0, useAutopopulationContextValue_1.useAutopopulationContextValue)({
|
|
144
|
-
enabled:
|
|
147
|
+
enabled: isEntityPerspectiveView && (0, mdm_sdk_1.isDependentLookupAttrType)(attributeType),
|
|
145
148
|
attributeTypeUri: attributeType === null || attributeType === void 0 ? void 0 : attributeType.uri,
|
|
146
149
|
valueUri: attributeValue.uri
|
|
147
150
|
}).autopopulationContextValue;
|
|
@@ -59,6 +59,7 @@ var ProfilePerspectiveViewContext_1 = require("../contexts/ProfilePerspectiveVie
|
|
|
59
59
|
var ScrollToElementContext_1 = require("../contexts/ScrollToElementContext");
|
|
60
60
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
61
61
|
var AlwaysVisibleAttributesContext_1 = require("../contexts/AlwaysVisibleAttributesContext");
|
|
62
|
+
var AuthoringPerspectiveViewContext_1 = require("../contexts/AuthoringPerspectiveViewContext");
|
|
62
63
|
var useAutopopulationContextValue_1 = require("./useAutopopulationContextValue");
|
|
63
64
|
var useScrollToAttributeError_1 = require("../hooks/useScrollToAttributeError");
|
|
64
65
|
var useAsyncMount_1 = require("../hooks/useAsyncMount");
|
|
@@ -110,7 +111,7 @@ describe('SimpleAttributeEditor', function () {
|
|
|
110
111
|
onDeactivateError: jest.fn()
|
|
111
112
|
};
|
|
112
113
|
var setUp = function (_a) {
|
|
113
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? {} : _c, _d = _b.error, error = _d === void 0 ? null : _d, _e = _b.isProfilePerspective, isProfilePerspective = _e === void 0 ? false : _e, _f = _b.alwaysVisibleAttributes, alwaysVisibleAttributes =
|
|
114
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? {} : _c, _d = _b.error, error = _d === void 0 ? null : _d, _e = _b.isProfilePerspective, isProfilePerspective = _e === void 0 ? false : _e, _f = _b.isAuthoringPerspective, isAuthoringPerspective = _f === void 0 ? false : _f, _g = _b.alwaysVisibleAttributes, alwaysVisibleAttributes = _g === void 0 ? [] : _g;
|
|
114
115
|
var user = user_event_1.default.setup();
|
|
115
116
|
var scrollToElementContextValue = getScrollToElementContextValue(error);
|
|
116
117
|
var Providers = function (_a) {
|
|
@@ -118,7 +119,8 @@ describe('SimpleAttributeEditor', function () {
|
|
|
118
119
|
return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues },
|
|
119
120
|
react_1.default.createElement(AlwaysVisibleAttributesContext_1.AlwaysVisibleAttributesContext.Provider, { value: alwaysVisibleAttributes },
|
|
120
121
|
react_1.default.createElement(ProfilePerspectiveViewContext_1.ProfilePerspectiveViewContext.Provider, { value: isProfilePerspective },
|
|
121
|
-
react_1.default.createElement(
|
|
122
|
+
react_1.default.createElement(AuthoringPerspectiveViewContext_1.AuthoringPerspectiveViewContext.Provider, { value: isAuthoringPerspective },
|
|
123
|
+
react_1.default.createElement(ScrollToElementContext_1.ScrollToElementContext.Provider, { value: scrollToElementContextValue }, children))))));
|
|
122
124
|
};
|
|
123
125
|
return __assign({ user: user, scrollToElementContextValue: scrollToElementContextValue }, (0, react_2.render)(react_1.default.createElement(SimpleAttributeEditor_1.default, __assign({}, defaultProps, props)), { wrapper: Providers }));
|
|
124
126
|
};
|
|
@@ -353,7 +355,7 @@ describe('SimpleAttributeEditor', function () {
|
|
|
353
355
|
uri: 'configuration/entityTypes/HCA/attributes/InternalCustomer',
|
|
354
356
|
dependentLookupCode: 'Code'
|
|
355
357
|
};
|
|
356
|
-
it('should call getDependentLookupEditorContext selector with correct arguments', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
358
|
+
it('should call getDependentLookupEditorContext selector with correct arguments for profile perspective', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
357
359
|
return __generator(this, function (_a) {
|
|
358
360
|
switch (_a.label) {
|
|
359
361
|
case 0:
|
|
@@ -371,6 +373,24 @@ describe('SimpleAttributeEditor', function () {
|
|
|
371
373
|
}
|
|
372
374
|
});
|
|
373
375
|
}); });
|
|
376
|
+
it('should call getDependentLookupEditorContext selector with correct arguments for authoring perspective', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
377
|
+
return __generator(this, function (_a) {
|
|
378
|
+
switch (_a.label) {
|
|
379
|
+
case 0:
|
|
380
|
+
setUp({ props: { attributeType: attributeType }, isAuthoringPerspective: true });
|
|
381
|
+
return [4 /*yield*/, (0, react_2.act)(function () { return Promise.resolve(); })];
|
|
382
|
+
case 1:
|
|
383
|
+
_a.sent();
|
|
384
|
+
expect(MdmModuleContext_1.useMdmDependentLookupEditorContext).toHaveBeenCalledWith(defaultProps.attributeValue, attributeType);
|
|
385
|
+
expect(useAutopopulationContextValue_1.useAutopopulationContextValue).toHaveBeenCalledWith({
|
|
386
|
+
enabled: true,
|
|
387
|
+
attributeTypeUri: attributeType.uri,
|
|
388
|
+
valueUri: defaultProps.attributeValue.uri
|
|
389
|
+
});
|
|
390
|
+
return [2 /*return*/];
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}); });
|
|
374
394
|
it('should call useAutopopulationContextValue with enabled: false if component is outside of Profile perspective', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
375
395
|
return __generator(this, function (_a) {
|
|
376
396
|
switch (_a.label) {
|
|
@@ -388,6 +408,23 @@ describe('SimpleAttributeEditor', function () {
|
|
|
388
408
|
}
|
|
389
409
|
});
|
|
390
410
|
}); });
|
|
411
|
+
it('should call useAutopopulationContextValue with enabled: false if component is outside of authoring perspective', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
412
|
+
return __generator(this, function (_a) {
|
|
413
|
+
switch (_a.label) {
|
|
414
|
+
case 0:
|
|
415
|
+
setUp({ props: { attributeType: attributeType }, isAuthoringPerspective: false });
|
|
416
|
+
return [4 /*yield*/, (0, react_2.act)(function () { return Promise.resolve(); })];
|
|
417
|
+
case 1:
|
|
418
|
+
_a.sent();
|
|
419
|
+
expect(useAutopopulationContextValue_1.useAutopopulationContextValue).toHaveBeenCalledWith({
|
|
420
|
+
enabled: false,
|
|
421
|
+
attributeTypeUri: attributeType.uri,
|
|
422
|
+
valueUri: defaultProps.attributeValue.uri
|
|
423
|
+
});
|
|
424
|
+
return [2 /*return*/];
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}); });
|
|
391
428
|
it('should render dependent lookup editor with applied result of getDependentLookupEditorContext', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
392
429
|
var dlEditorContext, input;
|
|
393
430
|
return __generator(this, function (_a) {
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
exports.AuthoringPerspectiveViewContext = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
exports.AuthoringPerspectiveViewContext = react_1.default.createContext(false);
|
|
9
|
+
exports.AuthoringPerspectiveViewContext.displayName = 'AuthoringPerspectiveViewContext';
|
|
@@ -59,6 +59,7 @@ export type MdmModuleValuesContextProps = Partial<{
|
|
|
59
59
|
showMasking: boolean;
|
|
60
60
|
reviewDCREnabled: boolean;
|
|
61
61
|
dcrReviewValidation: boolean;
|
|
62
|
+
canUserMakeExport: boolean;
|
|
62
63
|
}>;
|
|
63
64
|
export type MdmModuleActionsContextProps = Partial<{
|
|
64
65
|
openSearch: (payload: SearchState) => void;
|
|
@@ -274,6 +275,7 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
274
275
|
showMasking: boolean;
|
|
275
276
|
reviewDCREnabled: boolean;
|
|
276
277
|
dcrReviewValidation: boolean;
|
|
278
|
+
canUserMakeExport: boolean;
|
|
277
279
|
}>>;
|
|
278
280
|
export declare const MdmModuleListenersContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
279
281
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
@@ -158,3 +158,4 @@ export declare const useMdmControlAttributes: () => string[];
|
|
|
158
158
|
export declare const useMdmShowMasking: () => boolean;
|
|
159
159
|
export declare const useMdmReviewDCREnabled: () => boolean;
|
|
160
160
|
export declare const useMdmDcrReviewValidation: () => boolean;
|
|
161
|
+
export declare const useMdmCanUserMakeExport: () => boolean;
|