@rh-support/components 2.0.4 → 2.0.7-beta.1
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/lib/cjs/AlertMessage/AlertMessage.js +5 -5
- package/lib/cjs/AlertMessage/index.d.ts +0 -1
- package/lib/cjs/AlertMessage/index.d.ts.map +1 -1
- package/lib/cjs/AlertMessage/index.js +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationContext.d.ts +0 -1
- package/lib/cjs/ConfirmationModal/ConfirmationContext.d.ts.map +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationContext.js +13 -41
- package/lib/cjs/ConfirmationModal/ConfirmationDialog.d.ts +4 -2
- package/lib/cjs/ConfirmationModal/ConfirmationDialog.d.ts.map +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationDialog.js +7 -6
- package/lib/cjs/ConfirmationModal/ConfirmationModal.stories.d.ts +0 -6
- package/lib/cjs/ConfirmationModal/ConfirmationModal.stories.d.ts.map +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationModal.stories.js +29 -69
- package/lib/cjs/CoverSpinner/CoverSpinner.d.ts +0 -1
- package/lib/cjs/CoverSpinner/CoverSpinner.d.ts.map +1 -1
- package/lib/cjs/CoverSpinner/CoverSpinner.js +1 -1
- package/lib/cjs/CustomContentLoader/CustomContentLoader.d.ts.map +1 -1
- package/lib/cjs/CustomContentLoader/CustomContentLoader.js +25 -25
- package/lib/cjs/CustomTextInput/CustomTextInput.d.ts +0 -1
- package/lib/cjs/CustomTextInput/CustomTextInput.d.ts.map +1 -1
- package/lib/cjs/CustomTextInput/CustomTextInput.js +10 -21
- package/lib/cjs/DropDownList/AsyncDropDownList.js +5 -5
- package/lib/cjs/DropDownList/DropDownList.d.ts +0 -1
- package/lib/cjs/DropDownList/DropDownList.d.ts.map +1 -1
- package/lib/cjs/DropDownList/DropDownList.js +45 -75
- package/lib/cjs/DropDownList/DropdownWrapper.js +7 -18
- package/lib/cjs/DropDownList/MultiSelectDropdownList.js +3 -3
- package/lib/cjs/DropDownList/SearchableList.d.ts +1 -0
- package/lib/cjs/DropDownList/SearchableList.d.ts.map +1 -1
- package/lib/cjs/DropDownList/SearchableList.js +45 -55
- package/lib/cjs/DropDownList/SelectList.js +15 -26
- package/lib/cjs/DropDownList/async.js +28 -38
- package/lib/cjs/DropDownList/dropdownList.css +1 -1
- package/lib/cjs/DropDownList/dropdownUtils.d.ts.map +1 -1
- package/lib/cjs/DropDownList/dropdownUtils.js +9 -19
- package/lib/cjs/DropDownList/types.d.ts +1 -0
- package/lib/cjs/DropDownList/types.d.ts.map +1 -1
- package/lib/cjs/DropDownList/withMulti.js +15 -26
- package/lib/cjs/ErrorBoundary/ErrorBoundary.js +18 -47
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts +0 -1
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts.map +1 -1
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.js +10 -10
- package/lib/cjs/ErrorPages/Generic403.d.ts +0 -1
- package/lib/cjs/ErrorPages/Generic403.d.ts.map +1 -1
- package/lib/cjs/ErrorPages/Generic403.js +2 -2
- package/lib/cjs/FeedbackForm/FeedbackForm.d.ts +0 -1
- package/lib/cjs/FeedbackForm/FeedbackForm.d.ts.map +1 -1
- package/lib/cjs/FeedbackForm/FeedbackForm.js +24 -52
- package/lib/cjs/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
- package/lib/cjs/Functional/CaseContactsSelectorExternal.js +81 -154
- package/lib/cjs/InlineEdit/InlineEdit.d.ts +1 -0
- package/lib/cjs/InlineEdit/InlineEdit.d.ts.map +1 -1
- package/lib/cjs/InlineEdit/InlineEdit.js +58 -144
- package/lib/cjs/InlineEdit/NewInlineEdit.d.ts +1 -0
- package/lib/cjs/InlineEdit/NewInlineEdit.d.ts.map +1 -1
- package/lib/cjs/InlineEdit/NewInlineEdit.js +62 -147
- package/lib/cjs/InlineEdit/inlineEdit.css +4 -0
- package/lib/cjs/InlineEdit/newInlineEdit.css +4 -0
- package/lib/cjs/LanguageSelector/LanguageSelector.d.ts +0 -1
- package/lib/cjs/LanguageSelector/LanguageSelector.d.ts.map +1 -1
- package/lib/cjs/LanguageSelector/LanguageSelector.js +10 -26
- package/lib/cjs/LoadingDots/LoadingDots.d.ts +0 -1
- package/lib/cjs/LoadingDots/LoadingDots.d.ts.map +1 -1
- package/lib/cjs/LoadingDots/LoadingDots.js +4 -4
- package/lib/cjs/LoadingDots/index.d.ts +0 -1
- package/lib/cjs/LoadingDots/index.d.ts.map +1 -1
- package/lib/cjs/LoadingDots/index.js +1 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.d.ts +0 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.d.ts.map +1 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.js +3 -3
- package/lib/cjs/LoginModal/LoginModal.d.ts +0 -1
- package/lib/cjs/LoginModal/LoginModal.d.ts.map +1 -1
- package/lib/cjs/LoginModal/LoginModal.js +3 -3
- package/lib/cjs/MarkdownEditor/MarkdownEditor.js +113 -165
- package/lib/cjs/MoreOrLess/MoreOrLess.js +20 -40
- package/lib/cjs/PaginatedList/PaginatedList.js +15 -31
- package/lib/cjs/PaginationCompact/PaginationCompact.d.ts +0 -1
- package/lib/cjs/PaginationCompact/PaginationCompact.d.ts.map +1 -1
- package/lib/cjs/PaginationCompact/PaginationCompact.js +14 -31
- package/lib/cjs/PhoneInput/CountryData.d.ts +3 -0
- package/lib/cjs/PhoneInput/CountryData.d.ts.map +1 -0
- package/lib/cjs/PhoneInput/CountryData.js +583 -0
- package/lib/cjs/PhoneInput/PhoneInput.d.ts +19 -0
- package/lib/cjs/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/lib/cjs/PhoneInput/PhoneInput.js +284 -0
- package/lib/cjs/PhoneInput/PhoneInput.scss +753 -0
- package/lib/cjs/PhoneInput/flags.png +0 -0
- package/lib/cjs/PhoneInput/index.d.ts +2 -0
- package/lib/cjs/PhoneInput/index.d.ts.map +1 -0
- package/lib/cjs/PhoneInput/index.js +13 -0
- package/lib/cjs/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts +0 -1
- package/lib/cjs/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts.map +1 -1
- package/lib/cjs/ProgressBar/CircularProgressBar/CircularProgressBar.js +14 -14
- package/lib/cjs/ProgressBar/CircularProgressBar/Path.js +20 -18
- package/lib/cjs/ProgressBar/ProgressBar.js +8 -19
- package/lib/cjs/PromisifyModal/PromisifyModal.js +19 -36
- package/lib/cjs/SubscriptionAbuse/SubscriptionAbuseModal.d.ts +0 -1
- package/lib/cjs/SubscriptionAbuse/SubscriptionAbuseModal.d.ts.map +1 -1
- package/lib/cjs/SubscriptionAbuse/SubscriptionAbuseModal.js +5 -5
- package/lib/cjs/SubscriptionAbuse/const.d.ts +0 -1
- package/lib/cjs/SubscriptionAbuse/const.d.ts.map +1 -1
- package/lib/cjs/SubscriptionAbuse/const.js +3 -3
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackForm.d.ts +0 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackForm.d.ts.map +1 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackForm.js +8 -24
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.d.ts +0 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.js +50 -120
- package/lib/cjs/Table/PFTable.js +52 -89
- package/lib/cjs/Table/Table.js +12 -29
- package/lib/cjs/Table/TableColumnSelector.d.ts +0 -1
- package/lib/cjs/Table/TableColumnSelector.d.ts.map +1 -1
- package/lib/cjs/Table/TableColumnSelector.js +14 -15
- package/lib/cjs/Table/TablePagination.d.ts +0 -1
- package/lib/cjs/Table/TablePagination.d.ts.map +1 -1
- package/lib/cjs/Table/TablePagination.js +8 -8
- package/lib/cjs/Table/TableProvider.js +6 -6
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.d.ts +0 -1
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.d.ts.map +1 -1
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.js +46 -100
- package/lib/cjs/TextAreaAutosize/TextAreaAutosize.js +35 -62
- package/lib/cjs/TextAreaResizable/TextAreaResizable.js +12 -25
- package/lib/cjs/ToastNotification/ToastNotification.js +35 -70
- package/lib/cjs/TopContentSearch/TopContentSearch.js +48 -113
- package/lib/cjs/ValueChangedIcon/ValueChangedIcon.js +13 -29
- package/lib/cjs/helperFunctions/errorMessage.d.ts +0 -1
- package/lib/cjs/helperFunctions/errorMessage.d.ts.map +1 -1
- package/lib/cjs/helperFunctions/errorMessage.js +13 -13
- package/lib/cjs/hooks/useBreakpoint.js +26 -43
- package/lib/cjs/hooks/useCopyToClipboard.js +8 -24
- package/lib/cjs/hooks/useDebounce.js +13 -38
- package/lib/cjs/hooks/useFetch.js +47 -123
- package/lib/cjs/hooks/useForceUpdate.js +2 -18
- package/lib/cjs/hooks/useForkRef.js +3 -3
- package/lib/cjs/hooks/useIsMounted.js +4 -4
- package/lib/cjs/hooks/useLRUCache.js +11 -11
- package/lib/cjs/hooks/useLocalStorage.js +7 -23
- package/lib/cjs/hooks/useOnScreen.js +5 -24
- package/lib/cjs/hooks/usePolling.js +8 -30
- package/lib/cjs/hooks/usePrevious.js +3 -3
- package/lib/cjs/hooks/useTitle.js +4 -4
- package/lib/cjs/hooks/useUndo.js +49 -72
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/esm/AlertMessage/AlertMessage.js +2 -2
- package/lib/esm/AlertMessage/index.d.ts +0 -1
- package/lib/esm/AlertMessage/index.d.ts.map +1 -1
- package/lib/esm/AlertMessage/index.js +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationContext.d.ts +0 -1
- package/lib/esm/ConfirmationModal/ConfirmationContext.d.ts.map +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationDialog.d.ts +4 -2
- package/lib/esm/ConfirmationModal/ConfirmationDialog.d.ts.map +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationDialog.js +3 -2
- package/lib/esm/ConfirmationModal/ConfirmationModal.stories.d.ts +0 -6
- package/lib/esm/ConfirmationModal/ConfirmationModal.stories.d.ts.map +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationModal.stories.js +19 -18
- package/lib/esm/CoverSpinner/CoverSpinner.d.ts +0 -1
- package/lib/esm/CoverSpinner/CoverSpinner.d.ts.map +1 -1
- package/lib/esm/CustomContentLoader/CustomContentLoader.d.ts.map +1 -1
- package/lib/esm/CustomContentLoader/CustomContentLoader.js +23 -23
- package/lib/esm/CustomTextInput/CustomTextInput.d.ts +0 -1
- package/lib/esm/CustomTextInput/CustomTextInput.d.ts.map +1 -1
- package/lib/esm/CustomTextInput/CustomTextInput.js +1 -1
- package/lib/esm/DropDownList/DropDownList.d.ts +0 -1
- package/lib/esm/DropDownList/DropDownList.d.ts.map +1 -1
- package/lib/esm/DropDownList/SearchableList.d.ts +1 -0
- package/lib/esm/DropDownList/SearchableList.d.ts.map +1 -1
- package/lib/esm/DropDownList/SearchableList.js +6 -2
- package/lib/esm/DropDownList/dropdownList.css +1 -1
- package/lib/esm/DropDownList/dropdownUtils.d.ts.map +1 -1
- package/lib/esm/DropDownList/dropdownUtils.js +1 -0
- package/lib/esm/DropDownList/types.d.ts +1 -0
- package/lib/esm/DropDownList/types.d.ts.map +1 -1
- package/lib/esm/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts +0 -1
- package/lib/esm/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts.map +1 -1
- package/lib/esm/ErrorPages/Generic403.d.ts +0 -1
- package/lib/esm/ErrorPages/Generic403.d.ts.map +1 -1
- package/lib/esm/FeedbackForm/FeedbackForm.d.ts +0 -1
- package/lib/esm/FeedbackForm/FeedbackForm.d.ts.map +1 -1
- package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
- package/lib/esm/Functional/CaseContactsSelectorExternal.js +2 -2
- package/lib/esm/InlineEdit/InlineEdit.d.ts +1 -0
- package/lib/esm/InlineEdit/InlineEdit.d.ts.map +1 -1
- package/lib/esm/InlineEdit/InlineEdit.js +3 -3
- package/lib/esm/InlineEdit/NewInlineEdit.d.ts +1 -0
- package/lib/esm/InlineEdit/NewInlineEdit.d.ts.map +1 -1
- package/lib/esm/InlineEdit/NewInlineEdit.js +3 -3
- package/lib/esm/InlineEdit/inlineEdit.css +4 -0
- package/lib/esm/InlineEdit/newInlineEdit.css +4 -0
- package/lib/esm/LanguageSelector/LanguageSelector.d.ts +0 -1
- package/lib/esm/LanguageSelector/LanguageSelector.d.ts.map +1 -1
- package/lib/esm/LoadingDots/LoadingDots.d.ts +0 -1
- package/lib/esm/LoadingDots/LoadingDots.d.ts.map +1 -1
- package/lib/esm/LoadingDots/LoadingDots.js +1 -1
- package/lib/esm/LoadingDots/index.d.ts +0 -1
- package/lib/esm/LoadingDots/index.d.ts.map +1 -1
- package/lib/esm/LoadingDots/index.js +1 -1
- package/lib/esm/LoadingIndicator/LoadingIndicator.d.ts +0 -1
- package/lib/esm/LoadingIndicator/LoadingIndicator.d.ts.map +1 -1
- package/lib/esm/LoginModal/LoginModal.d.ts +0 -1
- package/lib/esm/LoginModal/LoginModal.d.ts.map +1 -1
- package/lib/esm/PaginationCompact/PaginationCompact.d.ts +0 -1
- package/lib/esm/PaginationCompact/PaginationCompact.d.ts.map +1 -1
- package/lib/esm/PhoneInput/CountryData.d.ts +3 -0
- package/lib/esm/PhoneInput/CountryData.d.ts.map +1 -0
- package/lib/esm/PhoneInput/CountryData.js +580 -0
- package/lib/esm/PhoneInput/PhoneInput.d.ts +19 -0
- package/lib/esm/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/lib/esm/PhoneInput/PhoneInput.js +257 -0
- package/lib/esm/PhoneInput/PhoneInput.scss +753 -0
- package/lib/esm/PhoneInput/flags.png +0 -0
- package/lib/esm/PhoneInput/index.d.ts +2 -0
- package/lib/esm/PhoneInput/index.d.ts.map +1 -0
- package/lib/esm/PhoneInput/index.js +1 -0
- package/lib/esm/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts +0 -1
- package/lib/esm/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts.map +1 -1
- package/lib/esm/SubscriptionAbuse/SubscriptionAbuseModal.d.ts +0 -1
- package/lib/esm/SubscriptionAbuse/SubscriptionAbuseModal.d.ts.map +1 -1
- package/lib/esm/SubscriptionAbuse/const.d.ts +0 -1
- package/lib/esm/SubscriptionAbuse/const.d.ts.map +1 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackForm.d.ts +0 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackForm.d.ts.map +1 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts +0 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
- package/lib/esm/Table/TableColumnSelector.d.ts +0 -1
- package/lib/esm/Table/TableColumnSelector.d.ts.map +1 -1
- package/lib/esm/Table/TablePagination.d.ts +0 -1
- package/lib/esm/Table/TablePagination.d.ts.map +1 -1
- package/lib/esm/TermsAndConditions/AcceptTermsModal.d.ts +0 -1
- package/lib/esm/TermsAndConditions/AcceptTermsModal.d.ts.map +1 -1
- package/lib/esm/TextAreaResizable/TextAreaResizable.js +1 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts +0 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts.map +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/package.json +16 -30
- package/lib/cjs/AlertMessage/AlertMessage.stories.d.ts +0 -12
- package/lib/cjs/AlertMessage/AlertMessage.stories.d.ts.map +0 -1
- package/lib/cjs/AlertMessage/AlertMessage.stories.js +0 -29
- package/lib/cjs/DropDownList/Dropdownlist.stories.d.ts +0 -17
- package/lib/cjs/DropDownList/Dropdownlist.stories.d.ts.map +0 -1
- package/lib/cjs/DropDownList/Dropdownlist.stories.js +0 -253
- package/lib/cjs/LoadingDots/LoadingDots.stories.d.ts +0 -10
- package/lib/cjs/LoadingDots/LoadingDots.stories.d.ts.map +0 -1
- package/lib/cjs/LoadingDots/LoadingDots.stories.js +0 -16
- package/lib/cjs/LoadingIndicator/LoadingIndicator.stories.d.ts +0 -11
- package/lib/cjs/LoadingIndicator/LoadingIndicator.stories.d.ts.map +0 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.stories.js +0 -18
- package/lib/cjs/Table/PFTable.stories.d.ts +0 -20
- package/lib/cjs/Table/PFTable.stories.d.ts.map +0 -1
- package/lib/cjs/Table/PFTable.stories.js +0 -81
- package/lib/cjs/demo/Demo.css +0 -3
- package/lib/cjs/demo/Demo.d.ts +0 -13
- package/lib/cjs/demo/Demo.d.ts.map +0 -1
- package/lib/cjs/demo/Demo.js +0 -42
- package/lib/cjs/demo/Demo.md +0 -0
- package/lib/cjs/demo/Demo.scss +0 -3
- package/lib/cjs/demo/index.d.ts +0 -3
- package/lib/cjs/demo/index.d.ts.map +0 -1
- package/lib/cjs/demo/index.js +0 -23
- package/lib/esm/AlertMessage/AlertMessage.stories.d.ts +0 -12
- package/lib/esm/AlertMessage/AlertMessage.stories.d.ts.map +0 -1
- package/lib/esm/AlertMessage/AlertMessage.stories.js +0 -20
- package/lib/esm/DropDownList/Dropdownlist.stories.d.ts +0 -17
- package/lib/esm/DropDownList/Dropdownlist.stories.d.ts.map +0 -1
- package/lib/esm/DropDownList/Dropdownlist.stories.js +0 -156
- package/lib/esm/LoadingDots/LoadingDots.stories.d.ts +0 -10
- package/lib/esm/LoadingDots/LoadingDots.stories.d.ts.map +0 -1
- package/lib/esm/LoadingDots/LoadingDots.stories.js +0 -8
- package/lib/esm/LoadingIndicator/LoadingIndicator.stories.d.ts +0 -11
- package/lib/esm/LoadingIndicator/LoadingIndicator.stories.d.ts.map +0 -1
- package/lib/esm/LoadingIndicator/LoadingIndicator.stories.js +0 -9
- package/lib/esm/Table/PFTable.stories.d.ts +0 -20
- package/lib/esm/Table/PFTable.stories.d.ts.map +0 -1
- package/lib/esm/Table/PFTable.stories.js +0 -73
- package/lib/esm/demo/Demo.css +0 -3
- package/lib/esm/demo/Demo.d.ts +0 -13
- package/lib/esm/demo/Demo.d.ts.map +0 -1
- package/lib/esm/demo/Demo.js +0 -26
- package/lib/esm/demo/Demo.md +0 -0
- package/lib/esm/demo/Demo.scss +0 -3
- package/lib/esm/demo/index.d.ts +0 -3
- package/lib/esm/demo/index.d.ts.map +0 -1
- package/lib/esm/demo/index.js +0 -2
|
@@ -1,15 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -38,33 +27,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
28
|
});
|
|
40
29
|
};
|
|
41
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
-
function step(op) {
|
|
46
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
-
while (_) try {
|
|
48
|
-
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;
|
|
49
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
-
switch (op[0]) {
|
|
51
|
-
case 0: case 1: t = op; break;
|
|
52
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
-
default:
|
|
56
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
-
if (t[2]) _.ops.pop();
|
|
61
|
-
_.trys.pop(); continue;
|
|
62
|
-
}
|
|
63
|
-
op = body.call(thisArg, _);
|
|
64
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
30
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
69
31
|
var t = {};
|
|
70
32
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -76,154 +38,119 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
76
38
|
}
|
|
77
39
|
return t;
|
|
78
40
|
};
|
|
79
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
80
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
81
|
-
if (!m) return o;
|
|
82
|
-
var i = m.call(o), r, ar = [], e;
|
|
83
|
-
try {
|
|
84
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
85
|
-
}
|
|
86
|
-
catch (error) { e = { error: error }; }
|
|
87
|
-
finally {
|
|
88
|
-
try {
|
|
89
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
90
|
-
}
|
|
91
|
-
finally { if (e) throw e.error; }
|
|
92
|
-
}
|
|
93
|
-
return ar;
|
|
94
|
-
};
|
|
95
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
96
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
97
|
-
to[j] = from[i];
|
|
98
|
-
return to;
|
|
99
|
-
};
|
|
100
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
101
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
102
43
|
};
|
|
103
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
104
45
|
exports.getHydraContactLabel = exports.renderMenuItemChildren = exports.CaseContactsSelectorExternal = void 0;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
46
|
+
const hydrajs_1 = require("@cee-eng/hydrajs");
|
|
47
|
+
const utils_1 = require("@rh-support/utils");
|
|
48
|
+
const differenceBy_1 = __importDefault(require("lodash/differenceBy"));
|
|
49
|
+
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
50
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
51
|
+
const sortBy_1 = __importDefault(require("lodash/sortBy"));
|
|
52
|
+
const react_1 = __importStar(require("react"));
|
|
53
|
+
const react_bootstrap_typeahead_1 = require("react-bootstrap-typeahead");
|
|
54
|
+
const react_i18next_1 = require("react-i18next");
|
|
55
|
+
const usePrevious_1 = require("../hooks/usePrevious");
|
|
56
|
+
const renderMenuItemChildren = (option, p) => (react_1.default.createElement(react_bootstrap_typeahead_1.Highlighter, { key: getKey(option), search: p.text }, getHydraContactLabel(option)));
|
|
116
57
|
exports.renderMenuItemChildren = renderMenuItemChildren;
|
|
117
|
-
|
|
58
|
+
const isCustomEmailAddress = (user) => {
|
|
118
59
|
var _a;
|
|
119
60
|
return !!((_a = user) === null || _a === void 0 ? void 0 : _a.emailAddress);
|
|
120
61
|
};
|
|
121
|
-
|
|
62
|
+
const isContact = (user) => {
|
|
122
63
|
var _a, _b;
|
|
123
64
|
return !!((_a = user) === null || _a === void 0 ? void 0 : _a.ssoUsername) && !((_b = user) === null || _b === void 0 ? void 0 : _b.emailAddress);
|
|
124
65
|
};
|
|
125
|
-
|
|
66
|
+
const getKey = (option) => {
|
|
126
67
|
if (isCustomEmailAddress(option))
|
|
127
68
|
return option.emailAddress;
|
|
128
69
|
if (isContact(option))
|
|
129
70
|
return option.ssoUsername;
|
|
130
71
|
};
|
|
131
|
-
|
|
72
|
+
const getHydraContactLabel = (user) => {
|
|
132
73
|
if (isEmpty_1.default(user) || typeof user !== 'object')
|
|
133
74
|
return '';
|
|
134
|
-
|
|
75
|
+
let label = '';
|
|
135
76
|
if (isCustomEmailAddress(user)) {
|
|
136
77
|
label = user.emailAddress;
|
|
137
78
|
}
|
|
138
79
|
else if (isContact(user)) {
|
|
139
|
-
|
|
140
|
-
?
|
|
141
|
-
: user.firstName
|
|
142
|
-
label = fullname
|
|
80
|
+
const fullname = !isEmpty_1.default(user.fullNameCustom)
|
|
81
|
+
? `${user.fullNameCustom}`
|
|
82
|
+
: `${user.firstName} ${user.lastName}`;
|
|
83
|
+
label = `${fullname} (${user.ssoUsername})`;
|
|
143
84
|
}
|
|
144
85
|
return label ? label : '';
|
|
145
86
|
};
|
|
146
87
|
exports.getHydraContactLabel = getHydraContactLabel;
|
|
147
88
|
function CaseContactsSelectorExternal(props) {
|
|
148
|
-
|
|
149
|
-
var previousSelectedAccountNumber = usePrevious_1.usePrevious(props.selectedAccountNumber);
|
|
89
|
+
const previousSelectedAccountNumber = usePrevious_1.usePrevious(props.selectedAccountNumber);
|
|
150
90
|
/**
|
|
151
91
|
* External owner selector related
|
|
152
92
|
*/
|
|
153
93
|
/** Getting user list for selected account when logged in user is a external */
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
react_1.useEffect(
|
|
94
|
+
const [contactList, setContactList] = react_1.useState(utils_1.getApiResourceObject([]));
|
|
95
|
+
const controllerRef1 = react_1.useRef(new AbortController());
|
|
96
|
+
const controllerRef2 = react_1.useRef(new AbortController());
|
|
97
|
+
react_1.useEffect(() => {
|
|
158
98
|
if (props.isExportingPDF)
|
|
159
99
|
return;
|
|
160
100
|
// when component is unmonted and error happens after apis responses are ready, we use this variable to prevent state update.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (!props.loggedInUserRights.isNonOrgAdmin()) return [3 /*break*/, 3];
|
|
183
|
-
extraLoggedInContacts = props.loggedInUserRights.getHydraContactFromLoggedInUser();
|
|
184
|
-
return [4 /*yield*/, hydrajs_1.accounts.getAccountContacts(props.selectedAccountNumber, controllerRef1.current.signal)];
|
|
185
|
-
case 2:
|
|
186
|
-
contacts = _a.sent();
|
|
101
|
+
let isSubscribed = true;
|
|
102
|
+
const fetchStrataAccountUsers = () => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
if (controllerRef1.current) {
|
|
104
|
+
controllerRef1.current.abort();
|
|
105
|
+
}
|
|
106
|
+
controllerRef1.current = new AbortController();
|
|
107
|
+
if (controllerRef2.current) {
|
|
108
|
+
controllerRef2.current.abort();
|
|
109
|
+
}
|
|
110
|
+
controllerRef2.current = new AbortController();
|
|
111
|
+
try {
|
|
112
|
+
setContactList(utils_1.getApiResourceObject([], true));
|
|
113
|
+
let contactListTemp = [];
|
|
114
|
+
if (props.loggedInUserRights.isPartner() &&
|
|
115
|
+
props.loggedInUserRights.isAccountDifferentFromLoggedInAccount(props.selectedAccountNumber)) {
|
|
116
|
+
/** Show Partner contacts even when customer account is selected
|
|
117
|
+
- Non Org-Admin partners => Only logged in contact + All Customer contacts
|
|
118
|
+
- Org-Admin partners => All partner contacts + All Customer contacts */
|
|
119
|
+
if (props.loggedInUserRights.isNonOrgAdmin()) {
|
|
120
|
+
const extraLoggedInContacts = props.loggedInUserRights.getHydraContactFromLoggedInUser();
|
|
121
|
+
const contacts = yield hydrajs_1.accounts.getAccountContacts(props.selectedAccountNumber, controllerRef1.current.signal);
|
|
187
122
|
contactListTemp = contacts.concat(extraLoggedInContacts);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
promiseArray = [
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
let promiseArray = [
|
|
191
126
|
hydrajs_1.accounts.getAccountContacts(props.selectedAccountNumber, controllerRef1.current.signal),
|
|
192
127
|
hydrajs_1.accounts.getAccountContacts(props.loggedInUserRights.getAccountNumber(), controllerRef2.current.signal),
|
|
193
128
|
];
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
case 6: return [4 /*yield*/, hydrajs_1.accounts.getAccountContacts(props.selectedAccountNumber, controllerRef1.current.signal)];
|
|
203
|
-
case 7:
|
|
204
|
-
contactListTemp = _a.sent();
|
|
205
|
-
_a.label = 8;
|
|
206
|
-
case 8:
|
|
207
|
-
if (props.contactsToExclude && props.contactsToExclude.length > 0) {
|
|
208
|
-
contactListTemp = differenceBy_1.default(contactListTemp, props.contactsToExclude, 'ssoUsername');
|
|
209
|
-
}
|
|
210
|
-
setContactList(utils_1.getApiResourceObject(utils_1.sortHydraContacts(contactListTemp)));
|
|
211
|
-
return [3 /*break*/, 10];
|
|
212
|
-
case 9:
|
|
213
|
-
e_1 = _a.sent();
|
|
214
|
-
isSubscribed && setContactList(utils_1.getApiResourceObject([], false, true, e_1.message));
|
|
215
|
-
return [3 /*break*/, 10];
|
|
216
|
-
case 10: return [2 /*return*/];
|
|
129
|
+
const loggedInContactsResponse = yield Promise.all(promiseArray);
|
|
130
|
+
const selectedAccountsContacts = loggedInContactsResponse[0];
|
|
131
|
+
const currentAccountsContacts = loggedInContactsResponse[1];
|
|
132
|
+
contactListTemp = [...selectedAccountsContacts, ...currentAccountsContacts];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
contactListTemp = yield hydrajs_1.accounts.getAccountContacts(props.selectedAccountNumber, controllerRef1.current.signal);
|
|
217
137
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
138
|
+
if (props.contactsToExclude && props.contactsToExclude.length > 0) {
|
|
139
|
+
contactListTemp = differenceBy_1.default(contactListTemp, props.contactsToExclude, 'ssoUsername');
|
|
140
|
+
}
|
|
141
|
+
setContactList(utils_1.getApiResourceObject(utils_1.sortHydraContacts(contactListTemp)));
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
isSubscribed && setContactList(utils_1.getApiResourceObject([], false, true, e.message));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const isOldAccountNumber = props.selectedAccountNumber && props.selectedAccountNumber === previousSelectedAccountNumber;
|
|
221
148
|
if (isOldAccountNumber ||
|
|
222
149
|
(props.loggedInUserRights.isExternal() &&
|
|
223
150
|
props.loggedInUserRights.isNonOrgAdminWithSameAccount(props.selectedAccountNumber)))
|
|
224
151
|
return;
|
|
225
152
|
fetchStrataAccountUsers();
|
|
226
|
-
return
|
|
153
|
+
return () => {
|
|
227
154
|
isSubscribed = false;
|
|
228
155
|
};
|
|
229
156
|
}, [
|
|
@@ -233,10 +160,10 @@ function CaseContactsSelectorExternal(props) {
|
|
|
233
160
|
props.selectedAccountNumber,
|
|
234
161
|
props.isExportingPDF,
|
|
235
162
|
]);
|
|
236
|
-
|
|
163
|
+
const onCustomerContactSelect = (contacts) => {
|
|
237
164
|
if (!isArray_1.default(contacts))
|
|
238
165
|
return;
|
|
239
|
-
|
|
166
|
+
const customerContacts = contacts.length === 0 || !isEmpty_1.default(contacts[0])
|
|
240
167
|
? contacts
|
|
241
168
|
: [
|
|
242
169
|
{
|
|
@@ -249,15 +176,15 @@ function CaseContactsSelectorExternal(props) {
|
|
|
249
176
|
];
|
|
250
177
|
props.onChange && props.onChange(customerContacts);
|
|
251
178
|
};
|
|
252
|
-
|
|
179
|
+
const onCustomerContactSelectBlur = (event) => {
|
|
253
180
|
props.onChange && props.onChange(props.selected);
|
|
254
181
|
};
|
|
255
|
-
|
|
182
|
+
const isDisabled = (props.loggedInUserRights.isExternal() &&
|
|
256
183
|
props.loggedInUserRights.isNonOrgAdminWithSameAccount(props.selectedAccountNumber)) ||
|
|
257
184
|
props.isUpdating ||
|
|
258
185
|
contactList.isFetching;
|
|
259
|
-
|
|
260
|
-
|
|
186
|
+
const renderMenu = (results, menuProps, state) => {
|
|
187
|
+
const contacts = results.map((item, index) => {
|
|
261
188
|
if (item.customOption) {
|
|
262
189
|
return (react_1.default.createElement(react_bootstrap_typeahead_1.MenuItem, { className: "rbt-menu-custom-option", key: index, option: item, position: index },
|
|
263
190
|
menuProps.newSelectionPrefix,
|
|
@@ -282,15 +209,15 @@ function CaseContactsSelectorExternal(props) {
|
|
|
282
209
|
react_1.default.createElement(react_bootstrap_typeahead_1.MenuItem, { key: index, option: item, position: index }, renderMenuItemChildren(item, state))));
|
|
283
210
|
}
|
|
284
211
|
});
|
|
285
|
-
return react_1.default.createElement(react_bootstrap_typeahead_1.Menu,
|
|
212
|
+
return react_1.default.createElement(react_bootstrap_typeahead_1.Menu, Object.assign({}, menuProps), contacts);
|
|
286
213
|
};
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return
|
|
214
|
+
const { customEmails } = props, restProps = __rest(props, ["customEmails"]);
|
|
215
|
+
const conditionalProps = Object.assign(Object.assign({}, (props.renderToken ? { renderToken: props.renderToken } : undefined)), ((customEmails || []).length > 0 ? { renderMenu } : undefined));
|
|
216
|
+
const getCustomEmails = () => {
|
|
217
|
+
return sortBy_1.default((customEmails || []).map((item) => (Object.assign(Object.assign({}, item), { ssoUsername: item.emailAddress, firstName: item.emailAddress, lastName: item.emailAddress }))), 'emailAddress');
|
|
291
218
|
};
|
|
292
|
-
return (react_1.default.createElement(react_bootstrap_typeahead_1.Typeahead,
|
|
219
|
+
return (react_1.default.createElement(react_bootstrap_typeahead_1.Typeahead, Object.assign({}, restProps, { id: props.id || '',
|
|
293
220
|
// @ts-expect-error
|
|
294
|
-
className: props.className || '', filterBy: ['firstName', 'lastName', 'ssoUsername'], clearButton: !!props.clearButton, multiple: !!props.multiple, isLoading: contactList.isFetching || props.isUpdating, options:
|
|
221
|
+
className: props.className || '', filterBy: ['firstName', 'lastName', 'ssoUsername'], clearButton: !!props.clearButton, multiple: !!props.multiple, isLoading: contactList.isFetching || props.isUpdating, options: [...contactList.data, ...getCustomEmails()], selected: !isEmpty_1.default(props.selected) ? props.selected : [], onChange: onCustomerContactSelect, labelKey: props.multiple ? 'ssoUsername' : getHydraContactLabel, placeholder: props.placeholder || 'Search by name or username', renderMenuItemChildren: renderMenuItemChildren, onBlur: onCustomerContactSelectBlur, minLength: props.minLength || 0, disabled: isDisabled }, conditionalProps, { "data-tracking-id": "external-case-contact-selector" })));
|
|
295
222
|
}
|
|
296
223
|
exports.CaseContactsSelectorExternal = CaseContactsSelectorExternal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineEdit.d.ts","sourceRoot":"","sources":["../../../src/InlineEdit/InlineEdit.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAI1B,OAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAGnD,UAAU,MAAM;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACtC,UAAU,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACxC,YAAY,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC1C,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC5C,gBAAgB,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC/B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAClC,SAAS,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAChC,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,GAAG,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IAGzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,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U,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAsBD,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,eAwKhC;kBAxKQ,UAAU;;;AA2KnB,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -38,60 +27,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
28
|
});
|
|
40
29
|
};
|
|
41
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
-
function step(op) {
|
|
46
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
-
while (_) try {
|
|
48
|
-
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;
|
|
49
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
-
switch (op[0]) {
|
|
51
|
-
case 0: case 1: t = op; break;
|
|
52
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
-
default:
|
|
56
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
-
if (t[2]) _.ops.pop();
|
|
61
|
-
_.trys.pop(); continue;
|
|
62
|
-
}
|
|
63
|
-
op = body.call(thisArg, _);
|
|
64
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
69
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
70
|
-
if (!m) return o;
|
|
71
|
-
var i = m.call(o), r, ar = [], e;
|
|
72
|
-
try {
|
|
73
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
74
|
-
}
|
|
75
|
-
catch (error) { e = { error: error }; }
|
|
76
|
-
finally {
|
|
77
|
-
try {
|
|
78
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
79
|
-
}
|
|
80
|
-
finally { if (e) throw e.error; }
|
|
81
|
-
}
|
|
82
|
-
return ar;
|
|
83
|
-
};
|
|
84
30
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
85
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
86
32
|
};
|
|
87
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
34
|
exports.InlineEdit = void 0;
|
|
89
35
|
require("./inlineEdit.css");
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
36
|
+
const pencil_alt_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/pencil-alt-icon"));
|
|
37
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const react_i18next_1 = require("react-i18next");
|
|
40
|
+
const defaultProps = {
|
|
95
41
|
allowInlineEdit: false,
|
|
96
42
|
formClassName: '',
|
|
97
43
|
formId: '',
|
|
@@ -111,112 +57,80 @@ var defaultProps = {
|
|
|
111
57
|
isSpaceAllowed: true,
|
|
112
58
|
};
|
|
113
59
|
function InlineEdit(props) {
|
|
114
|
-
var _this = this;
|
|
115
60
|
var _a;
|
|
116
|
-
|
|
61
|
+
const [isEditing, setIsEditing] = react_1.useState(props.initialIsEditing);
|
|
117
62
|
// editingTrueOnStart is a state to track if inlineEdit component is open on start, we don't want to focus
|
|
118
63
|
// on input/textareat in this situation as we may have other form elements on page that we want to focus
|
|
119
|
-
|
|
120
|
-
|
|
64
|
+
const [canAutoSetFocus, setCanAutoSfocus] = react_1.useState(!props.initialIsEditing);
|
|
65
|
+
const onEditClicked = (e) => {
|
|
121
66
|
setCanAutoSfocus(true);
|
|
122
67
|
e.preventDefault();
|
|
123
68
|
props.cancelOnToggle && isEditing && props.onCancel && props.onCancel();
|
|
124
69
|
setIsEditing(!isEditing);
|
|
125
70
|
};
|
|
126
71
|
// To Render edit button
|
|
127
|
-
|
|
72
|
+
const renderEditButton = () => {
|
|
128
73
|
if (!props.allowInlineEdit) {
|
|
129
74
|
return null;
|
|
130
75
|
}
|
|
131
|
-
return (react_1.default.createElement("button", { className:
|
|
76
|
+
return (react_1.default.createElement("button", { className: `btn btn-link btn-app btn-edit ${props.isExportingPDF ? 'hide-in-pdf' : ''}`, "aria-label": "Edit", onClick: onEditClicked },
|
|
132
77
|
react_1.default.createElement(pencil_alt_icon_1.default, null)));
|
|
133
78
|
};
|
|
134
|
-
|
|
79
|
+
const onBlurChild = () => {
|
|
135
80
|
props.collapseOnBlur && setIsEditing(!isEditing);
|
|
136
81
|
props.saveOnBlur && !props.saveDisabled && props.onSave && props.onSave();
|
|
137
82
|
props.cancelOnBlur && props.onCancel && props.onCancel();
|
|
138
83
|
};
|
|
139
|
-
|
|
84
|
+
const onCancelClicked = () => {
|
|
140
85
|
props.onCancel && props.onCancel();
|
|
141
86
|
setIsEditing(false);
|
|
142
87
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
setIsEditing(false);
|
|
158
|
-
return [3 /*break*/, 4];
|
|
159
|
-
case 3:
|
|
160
|
-
e_1 = _b.sent();
|
|
161
|
-
return [3 /*break*/, 4];
|
|
162
|
-
case 4: return [2 /*return*/];
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}); };
|
|
166
|
-
var onSaveClicked = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
167
|
-
return __generator(this, function (_a) {
|
|
168
|
-
switch (_a.label) {
|
|
169
|
-
case 0:
|
|
170
|
-
if (props.saveDisabled)
|
|
171
|
-
return [2 /*return*/];
|
|
172
|
-
return [4 /*yield*/, onSave()];
|
|
173
|
-
case 1:
|
|
174
|
-
_a.sent();
|
|
175
|
-
return [2 /*return*/];
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}); };
|
|
88
|
+
const onSave = () => __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
try {
|
|
90
|
+
props.onSave && (yield props.onSave());
|
|
91
|
+
setIsEditing(false);
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
// we will keep the user in the editing state. so nothing to do here
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const onSaveClicked = () => __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
if (props.saveDisabled)
|
|
99
|
+
return;
|
|
100
|
+
yield onSave();
|
|
101
|
+
});
|
|
179
102
|
// Disables button if isSpaceAllowed is False and Input has Spaces
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
case 1:
|
|
190
|
-
if (!(!props.hideSaveCancel &&
|
|
191
|
-
props.allowInlineEdit &&
|
|
192
|
-
isEditing &&
|
|
193
|
-
!diabledCheckForSpaceAllowed &&
|
|
194
|
-
!props.saveDisabled &&
|
|
195
|
-
e.keyCode === 13)) return [3 /*break*/, 3];
|
|
196
|
-
return [4 /*yield*/, onSave()];
|
|
197
|
-
case 2:
|
|
198
|
-
_a.sent();
|
|
199
|
-
_a.label = 3;
|
|
200
|
-
case 3: return [2 /*return*/];
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}); };
|
|
204
|
-
var renderSaveCancel = function () {
|
|
205
|
-
return !props.hideSaveCancel &&
|
|
103
|
+
const diabledCheckForSpaceAllowed = !props.isSpaceAllowed && isEmpty_1.default((_a = props.inputValue) === null || _a === void 0 ? void 0 : _a.trim());
|
|
104
|
+
const handleKeyDown = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
// Cancel on pressing esc
|
|
106
|
+
if (props.allowInlineEdit && isEditing && e.keyCode === 27) {
|
|
107
|
+
props.onCancel && props.onCancel();
|
|
108
|
+
setIsEditing(false);
|
|
109
|
+
}
|
|
110
|
+
// Save on pressing enter
|
|
111
|
+
else if (!props.hideSaveCancel &&
|
|
206
112
|
props.allowInlineEdit &&
|
|
207
|
-
isEditing &&
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
|
|
113
|
+
isEditing &&
|
|
114
|
+
!diabledCheckForSpaceAllowed &&
|
|
115
|
+
!props.saveDisabled &&
|
|
116
|
+
e.keyCode === 13) {
|
|
117
|
+
yield onSave();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
const renderSaveCancel = () => !props.hideSaveCancel &&
|
|
121
|
+
props.allowInlineEdit &&
|
|
122
|
+
isEditing && (react_1.default.createElement("span", { className: "edit-actions" },
|
|
123
|
+
props.loadingIndicator && react_1.default.createElement("span", null, props.loadingIndicator),
|
|
124
|
+
react_1.default.createElement("button", { "data-tracking-id": props.dataTrackingId ? `${props.dataTrackingId}-inline-edit-save` : null, className: "btn btn-app btn-link", type: "button", onClick: onSaveClicked, disabled: diabledCheckForSpaceAllowed || props.saveDisabled },
|
|
125
|
+
react_1.default.createElement(react_i18next_1.Trans, null, props.saveLabel)),
|
|
126
|
+
react_1.default.createElement("button", { type: "button", "data-tracking-id": props.dataTrackingId ? `${props.dataTrackingId}-inline-edit-cancel` : null, className: "btn btn-app btn-link", onClick: onCancelClicked },
|
|
127
|
+
react_1.default.createElement(react_i18next_1.Trans, null, props.cancelLabel))));
|
|
128
|
+
const canShowContent = !isEditing && props.allowInlineEdit && props.content;
|
|
129
|
+
return (react_1.default.createElement("div", { className: `form-group edit-question ${props.formClassName}`, id: props.formId },
|
|
216
130
|
!props.hideLabel && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
217
|
-
react_1.default.createElement("label",
|
|
131
|
+
react_1.default.createElement("label", Object.assign({}, props.labelProps),
|
|
218
132
|
react_1.default.createElement("span", { className: "label-edit" }, props.labelContent),
|
|
219
|
-
props.helperContent,
|
|
133
|
+
react_1.default.createElement("span", { className: `${props.isExportingPDF ? 'hide-in-pdf' : ''}` }, props.helperContent),
|
|
220
134
|
renderEditButton()))),
|
|
221
135
|
renderSaveCancel(),
|
|
222
136
|
canShowContent && !props.usePreformattedTag && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -232,15 +146,15 @@ function InlineEdit(props) {
|
|
|
232
146
|
!props.allowInlineEdit && props.children,
|
|
233
147
|
props.allowInlineEdit &&
|
|
234
148
|
isEditing &&
|
|
235
|
-
react_1.default.Children.map(props.children,
|
|
149
|
+
react_1.default.Children.map(props.children, (child) => {
|
|
236
150
|
if (!child)
|
|
237
151
|
return;
|
|
238
|
-
|
|
152
|
+
const canFocusChild = (child.type === 'input' || child.type === 'textarea') && canAutoSetFocus;
|
|
239
153
|
// if input/textarea had autoFocus but focus was lost in the wrapper component
|
|
240
|
-
|
|
154
|
+
const needsReFocus = !canAutoSetFocus && child.props.autoFocus;
|
|
241
155
|
if (canFocusChild || needsReFocus) {
|
|
242
156
|
return react_1.default.cloneElement(child, {
|
|
243
|
-
ref:
|
|
157
|
+
ref: (node) => {
|
|
244
158
|
node && node.focus();
|
|
245
159
|
setCanAutoSfocus(false);
|
|
246
160
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewInlineEdit.d.ts","sourceRoot":"","sources":["../../../src/InlineEdit/NewInlineEdit.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAI7B,OAAc,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAG9D,UAAU,MAAM;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,GAAG,CAAC,OAAO,GAA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