@addev-be/ui 0.20.0 → 0.20.2
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/assets/icons/arrow-down-1-9.svg +1 -1
- package/assets/icons/arrow-down-a-z.svg +1 -1
- package/assets/icons/arrow-up-z-a.svg +1 -1
- package/assets/icons/check.svg +1 -1
- package/assets/icons/circle-check.svg +1 -1
- package/assets/icons/down.svg +1 -1
- package/assets/icons/filter-full.svg +1 -1
- package/assets/icons/filter.svg +1 -1
- package/assets/icons/hashtag.svg +1 -1
- package/assets/icons/image-slash.svg +1 -1
- package/assets/icons/left.svg +1 -1
- package/assets/icons/magnifier.svg +1 -1
- package/assets/icons/phone.svg +1 -1
- package/assets/icons/right.svg +1 -1
- package/assets/icons/sort-calendar-ascending.svg +5 -5
- package/assets/icons/spinner-third.svg +1 -1
- package/assets/icons/table-columns.svg +1 -1
- package/assets/icons/table-footer-slash.svg +4 -4
- package/assets/icons/table-footer.svg +3 -3
- package/assets/icons/table.svg +1 -1
- package/assets/icons/up.svg +1 -1
- package/assets/icons/user-tie.svg +1 -1
- package/assets/icons/x-bar.svg +3 -3
- package/dist/Icons.d.ts +3 -1
- package/dist/Icons.js +6 -1
- package/dist/components/data/DataGrid/DataGridEditableCell/NumberEditableCell.d.ts +2 -0
- package/dist/components/data/DataGrid/DataGridEditableCell/NumberEditableCell.js +4 -2
- package/dist/components/data/DataGrid/DataGridEditableCell/index.js +5 -5
- package/dist/components/data/DataGrid/DataGridHeader.js +19 -9
- package/dist/components/data/DataGrid/DataGridHeaderCell.js +1 -2
- package/dist/components/data/DataGrid/DataGridRowTemplate.js +2 -2
- package/dist/components/data/DataGrid/hooks/useDataGrid.js +6 -5
- package/dist/components/data/DataGrid/hooks/useDataGridChangedRows.d.ts +7 -7
- package/dist/components/data/DataGrid/hooks/useDataGridChangedRows.js +52 -32
- package/dist/components/data/DataGrid/hooks/useRefreshModal.d.ts +5 -0
- package/dist/components/data/DataGrid/hooks/useRefreshModal.js +25 -0
- package/dist/components/data/DataGrid/index.d.ts +2 -2
- package/dist/components/data/DataGrid/index.js +4 -3
- package/dist/components/data/DataGrid/styles.js +5 -5
- package/dist/components/data/DataGrid/types.d.ts +11 -7
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.js +6 -5
- package/dist/components/data/SqlRequestDataGrid/index.d.ts +2 -2
- package/dist/components/data/SqlRequestDataGrid/index.js +23 -13
- package/dist/components/data/SqlRequestGrid/index.js +1 -2
- package/dist/components/forms/AutoTextArea.js +2 -1
- package/dist/components/forms/Button.d.ts +3 -3
- package/dist/components/forms/Button.js +12 -12
- package/dist/components/forms/Form/Checkbox.d.ts +2 -2
- package/dist/components/forms/Form/Checkbox.js +2 -2
- package/dist/components/forms/Form/FormGroup.d.ts +2 -0
- package/dist/components/forms/Form/FormGroup.js +2 -2
- package/dist/components/forms/Form/Input.d.ts +2 -2
- package/dist/components/forms/Form/Input.js +3 -2
- package/dist/components/forms/Form/Row.d.ts +9 -0
- package/dist/components/forms/Form/Row.js +10 -0
- package/dist/components/forms/Form/Select.d.ts +1 -0
- package/dist/components/forms/Form/Select.js +9 -4
- package/dist/components/forms/Form/TextArea.d.ts +2 -2
- package/dist/components/forms/Form/TextArea.js +3 -2
- package/dist/components/forms/Form/index.d.ts +27 -12
- package/dist/components/forms/Form/index.js +13 -8
- package/dist/components/forms/Form/styles.d.ts +9 -4
- package/dist/components/forms/Form/styles.js +13 -11
- package/dist/components/forms/NumberInput.d.ts +9 -0
- package/dist/components/forms/NumberInput.js +40 -0
- package/dist/components/forms/index.d.ts +2 -1
- package/dist/components/forms/index.js +2 -1
- package/dist/components/forms/styles.d.ts +17 -3
- package/dist/components/forms/styles.js +8 -7
- package/dist/components/layout/Columns.d.ts +2 -1
- package/dist/components/layout/Columns.js +10 -6
- package/dist/components/layout/Flexbox.d.ts +11 -0
- package/dist/components/layout/Flexbox.js +26 -0
- package/dist/components/layout/Modal/styles.js +1 -1
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/search/HighlightedText.js +9 -7
- package/dist/components/search/QuickSearchBar.d.ts +6 -2
- package/dist/components/search/QuickSearchBar.js +7 -13
- package/dist/components/search/styles.js +1 -1
- package/dist/components/search/types.d.ts +3 -0
- package/dist/components/ui/Tab/index.d.ts +3 -0
- package/dist/components/ui/Tab/index.js +12 -0
- package/dist/components/ui/Tab/styles.d.ts +6 -0
- package/dist/components/ui/Tab/styles.js +41 -0
- package/dist/components/ui/Tab/types.d.ts +13 -0
- package/dist/components/ui/Tabs/index.d.ts +2 -0
- package/dist/components/ui/Tabs/index.js +10 -0
- package/dist/components/ui/Tabs/styles.d.ts +0 -0
- package/dist/components/ui/Tabs/styles.js +1 -0
- package/dist/components/ui/Tabs/types.d.ts +8 -0
- package/dist/components/ui/Tab/302/265/index.d.ts +2 -0
- package/dist/components/ui/Tab/302/265/index.js +10 -0
- package/dist/components/ui/Tab/302/265/styles.d.ts +0 -0
- package/dist/components/ui/Tab/302/265/styles.js +1 -0
- package/dist/components/ui/Tab/302/265/types.d.ts +8 -0
- package/dist/components/ui/ToastNotification.d.ts +14 -0
- package/dist/components/ui/ToastNotification.js +78 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/styled/index.d.ts +1 -0
- package/dist/{components/data/SmartQueryDataGrid/helpers → helpers/styled}/index.js +1 -2
- package/dist/helpers/styled/space.d.ts +23 -0
- package/dist/helpers/styled/space.js +56 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useMutableState.d.ts +2 -0
- package/dist/hooks/useMutableState.js +16 -0
- package/dist/poppins-700.woff2 +0 -0
- package/dist/providers/AuthenticationProvider/index.d.ts +1 -0
- package/dist/providers/AuthenticationProvider/index.js +54 -13
- package/dist/providers/ThemeProvider/helpers.d.ts +8 -3
- package/dist/providers/ThemeProvider/helpers.js +42 -2
- package/dist/services/WebSocketService.d.ts +8 -0
- package/dist/services/WebSocketService.js +34 -2
- package/dist/services/globalSearch.d.ts +5 -2
- package/dist/services/hooks.d.ts +10 -0
- package/dist/services/hooks.js +89 -2
- package/package.json +2 -2
- package/src/Icons.tsx +138 -138
- package/src/components/auth/LoginForm.tsx +84 -84
- package/src/components/auth/LoginPage.tsx +32 -32
- package/src/components/auth/PasswordRecoveryForm.tsx +52 -52
- package/src/components/auth/PasswordResetForm.tsx +112 -112
- package/src/components/auth/index.ts +4 -4
- package/src/components/auth/styles.ts +14 -14
- package/src/components/data/DataGrid/DataGridCell.tsx +77 -77
- package/src/components/data/DataGrid/DataGridColumnsModal/helpers.ts +9 -9
- package/src/components/data/DataGrid/DataGridColumnsModal/hooks.tsx +59 -59
- package/src/components/data/DataGrid/DataGridColumnsModal/index.tsx +182 -182
- package/src/components/data/DataGrid/DataGridColumnsModal/styles.ts +104 -104
- package/src/components/data/DataGrid/DataGridEditableCell/CheckboxEditableCell.tsx +38 -38
- package/src/components/data/DataGrid/DataGridEditableCell/DateEditableCell.tsx +39 -39
- package/src/components/data/DataGrid/DataGridEditableCell/NumberEditableCell.tsx +75 -75
- package/src/components/data/DataGrid/DataGridEditableCell/TextEditableCell.tsx +38 -38
- package/src/components/data/DataGrid/DataGridEditableCell/index.tsx +106 -106
- package/src/components/data/DataGrid/DataGridEditableCell/styles.ts +35 -35
- package/src/components/data/DataGrid/DataGridEditableCell/types.ts +19 -19
- package/src/components/data/DataGrid/DataGridFilterMenu/FilterValuesScroller.tsx +131 -131
- package/src/components/data/DataGrid/DataGridFilterMenu/hooks.tsx +81 -81
- package/src/components/data/DataGrid/DataGridFilterMenu/index.tsx +376 -376
- package/src/components/data/DataGrid/DataGridFilterMenu/styles.ts +97 -97
- package/src/components/data/DataGrid/DataGridFooter.tsx +45 -45
- package/src/components/data/DataGrid/DataGridHeader.tsx +185 -185
- package/src/components/data/DataGrid/DataGridHeaderCell.tsx +111 -111
- package/src/components/data/DataGrid/DataGridRowTemplate.tsx +82 -82
- package/src/components/data/DataGrid/FilterModalContent/index.tsx +136 -136
- package/src/components/data/DataGrid/FilterModalContent/styles.ts +22 -22
- package/src/components/data/DataGrid/constants.ts +6 -6
- package/src/components/data/DataGrid/helpers/columns.tsx +386 -386
- package/src/components/data/DataGrid/helpers/filters.ts +287 -287
- package/src/components/data/DataGrid/helpers/index.ts +2 -2
- package/src/components/data/DataGrid/hooks/index.ts +29 -29
- package/src/components/data/DataGrid/hooks/useDataGrid.tsx +380 -381
- package/src/components/data/DataGrid/hooks/useDataGridChangedRows.ts +97 -97
- package/src/components/data/DataGrid/hooks/useDataGridCopy.ts +174 -174
- package/src/components/data/DataGrid/hooks/useDataGridSettings.ts +48 -48
- package/src/components/data/DataGrid/hooks/useRefreshModal.tsx +48 -48
- package/src/components/data/DataGrid/index.tsx +112 -112
- package/src/components/data/DataGrid/styles.ts +380 -380
- package/src/components/data/DataGrid/types.ts +371 -371
- package/src/components/data/SqlRequestDataGrid/SqlRequestForeignListEditableCell.tsx +16 -16
- package/src/components/data/SqlRequestDataGrid/helpers/columns.tsx +484 -484
- package/src/components/data/SqlRequestDataGrid/helpers/index.ts +2 -2
- package/src/components/data/SqlRequestDataGrid/helpers/sqlRequests.ts +16 -16
- package/src/components/data/SqlRequestDataGrid/index.tsx +414 -414
- package/src/components/data/SqlRequestDataGrid/styles.ts +15 -15
- package/src/components/data/SqlRequestDataGrid/types.ts +74 -74
- package/src/components/data/SqlRequestForeignList/index.tsx +259 -259
- package/src/components/data/SqlRequestForeignList/styles.ts +43 -43
- package/src/components/data/SqlRequestForeignList/types.ts +34 -34
- package/src/components/data/SqlRequestGrid/filters/FiltersSidebar.tsx +110 -110
- package/src/components/data/SqlRequestGrid/filters/styles.ts +88 -88
- package/src/components/data/SqlRequestGrid/helpers/index.ts +1 -1
- package/src/components/data/SqlRequestGrid/helpers/sqlRequests.ts +16 -16
- package/src/components/data/SqlRequestGrid/index.tsx +315 -316
- package/src/components/data/SqlRequestGrid/styles.ts +20 -20
- package/src/components/data/SqlRequestGrid/types.ts +75 -75
- package/src/components/data/VirtualScroller/hooks.ts +71 -71
- package/src/components/data/VirtualScroller/index.tsx +91 -91
- package/src/components/data/VirtualScroller/styles.ts +58 -58
- package/src/components/data/VirtualScroller/types.ts +12 -12
- package/src/components/data/index.ts +16 -16
- package/src/components/forms/AutoTextArea.tsx +48 -48
- package/src/components/forms/Button.tsx +132 -132
- package/src/components/forms/Form/Checkbox.tsx +12 -12
- package/src/components/forms/Form/FormGroup.tsx +31 -31
- package/src/components/forms/Form/Input.tsx +16 -16
- package/src/components/forms/Form/Row.tsx +32 -32
- package/src/components/forms/Form/Select.tsx +87 -87
- package/src/components/forms/Form/TextArea.tsx +17 -17
- package/src/components/forms/Form/index.tsx +45 -45
- package/src/components/forms/Form/styles.ts +184 -184
- package/src/components/forms/IconButton.tsx +57 -57
- package/src/components/forms/IndeterminateCheckbox.tsx +46 -46
- package/src/components/forms/NumberInput.tsx +53 -53
- package/src/components/forms/Select.tsx +35 -35
- package/src/components/forms/VerticalLabel.tsx +20 -20
- package/src/components/forms/index.ts +9 -9
- package/src/components/forms/styles.ts +41 -41
- package/src/components/index.ts +6 -6
- package/src/components/layout/Columns.ts +28 -28
- package/src/components/layout/Dropdown/index.tsx +113 -113
- package/src/components/layout/Dropdown/styles.ts +45 -45
- package/src/components/layout/Flexbox.ts +21 -21
- package/src/components/layout/Grid/index.tsx +8 -8
- package/src/components/layout/Grid/styles.ts +34 -34
- package/src/components/layout/Loading/index.tsx +29 -29
- package/src/components/layout/Loading/styles.ts +29 -29
- package/src/components/layout/Masonry/index.tsx +29 -29
- package/src/components/layout/Masonry/styles.ts +20 -20
- package/src/components/layout/Modal/index.tsx +51 -51
- package/src/components/layout/Modal/styles.ts +125 -125
- package/src/components/layout/index.ts +7 -7
- package/src/components/search/HighlightedText.tsx +41 -41
- package/src/components/search/QuickSearchBar.tsx +100 -100
- package/src/components/search/QuickSearchResults.tsx +86 -86
- package/src/components/search/index.ts +9 -9
- package/src/components/search/styles.ts +96 -96
- package/src/components/search/types.ts +29 -29
- package/src/components/ui/Avatar/index.tsx +54 -54
- package/src/components/ui/Avatar/styles.ts +61 -61
- package/src/components/ui/Card/index.tsx +14 -14
- package/src/components/ui/Card/styles.ts +37 -37
- package/src/components/ui/ContextMenu/index.tsx +79 -79
- package/src/components/ui/ContextMenu/styles.ts +119 -119
- package/src/components/ui/Ellipsis.tsx +34 -34
- package/src/components/ui/Message/index.tsx +57 -57
- package/src/components/ui/Message/styles.ts +40 -40
- package/src/components/ui/Tab/index.tsx +33 -0
- package/src/components/ui/Tab/styles.ts +61 -0
- package/src/components/ui/Tab/types.ts +16 -0
- package/src/components/ui/index.ts +7 -6
- package/src/config/index.ts +14 -14
- package/src/helpers/dates.ts +17 -17
- package/src/helpers/getScrollbarSize.ts +14 -14
- package/src/helpers/index.ts +5 -5
- package/src/helpers/numbers.ts +63 -63
- package/src/helpers/responsive.ts +83 -83
- package/src/helpers/styled/index.ts +1 -1
- package/src/helpers/styled/space.ts +55 -55
- package/src/helpers/text.ts +13 -13
- package/src/hooks/index.ts +7 -7
- package/src/hooks/useContainerMediaQuery.ts +7 -7
- package/src/hooks/useElementSize.ts +24 -24
- package/src/hooks/useMediaQuery.ts +9 -9
- package/src/hooks/useMediaQueryForWidth.ts +35 -35
- package/src/hooks/useMutableState.ts +19 -19
- package/src/hooks/useShowArchived.ts +28 -28
- package/src/hooks/useWindowSize.ts +20 -20
- package/src/index.ts +9 -9
- package/src/providers/AuthenticationProvider/helpers.ts +3 -3
- package/src/providers/AuthenticationProvider/index.tsx +303 -303
- package/src/providers/LoadingProvider/index.tsx +47 -47
- package/src/providers/PortalsProvider/index.tsx +54 -54
- package/src/providers/PortalsProvider/styles.ts +31 -31
- package/src/providers/SettingsProvider/index.tsx +70 -70
- package/src/providers/ThemeProvider/ThemeProvider.ts +63 -63
- package/src/providers/ThemeProvider/defaultTheme.ts +457 -457
- package/src/providers/ThemeProvider/helpers.ts +69 -69
- package/src/providers/ThemeProvider/index.ts +4 -4
- package/src/providers/ThemeProvider/types.ts +131 -131
- package/src/providers/TrackingProvider/hooks.ts +14 -14
- package/src/providers/TrackingProvider/index.tsx +71 -71
- package/src/providers/UiProviders/index.tsx +68 -68
- package/src/providers/UiProviders/styles.ts +10 -10
- package/src/providers/hooks.ts +12 -12
- package/src/providers/index.ts +8 -8
- package/src/services/HttpService.ts +92 -92
- package/src/services/WebSocketService.ts +155 -155
- package/src/services/advancedRequests.ts +102 -102
- package/src/services/base.ts +23 -23
- package/src/services/globalSearch.ts +32 -32
- package/src/services/hooks.ts +92 -92
- package/src/services/index.ts +21 -21
- package/src/services/requests/auth.ts +44 -44
- package/src/services/requests/generic.ts +62 -62
- package/src/services/requests/tracking.ts +12 -12
- package/src/services/requests/userProfiles.ts +35 -35
- package/src/services/requests/users.ts +28 -28
- package/src/services/smartQueries.ts +122 -122
- package/src/services/sqlRequests.ts +111 -111
- package/src/services/types/auth.ts +131 -131
- package/src/services/types/base.ts +10 -10
- package/src/services/types/generic.ts +96 -96
- package/src/services/types/tracking.ts +39 -39
- package/src/services/types/userProfiles.ts +107 -107
- package/src/services/types/users.ts +106 -106
- package/src/services/updateSqlRequests.ts +34 -34
- package/src/styles/animations.scss +30 -30
- package/src/styles/index.scss +42 -42
- package/src/typings.d.ts +19 -19
- package/tsconfig.json +18 -18
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.d.ts +0 -14
- package/dist/components/data/AdvancedRequestDataGrid/helpers/advancedRequests.js +0 -77
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.d.ts +0 -22
- package/dist/components/data/AdvancedRequestDataGrid/helpers/columns.js +0 -105
- package/dist/components/data/AdvancedRequestDataGrid/helpers/index.d.ts +0 -2
- package/dist/components/data/AdvancedRequestDataGrid/helpers/index.js +0 -18
- package/dist/components/data/AdvancedRequestDataGrid/index.d.ts +0 -2
- package/dist/components/data/AdvancedRequestDataGrid/index.js +0 -215
- package/dist/components/data/AdvancedRequestDataGrid/types.d.ts +0 -21
- package/dist/components/data/DataGrid/AdvancedRequestDataGrid.d.ts +0 -10
- package/dist/components/data/DataGrid/AdvancedRequestDataGrid.js +0 -173
- package/dist/components/data/DataGrid/DataGridEditableCell.d.ts +0 -2
- package/dist/components/data/DataGrid/DataGridEditableCell.js +0 -27
- package/dist/components/data/DataGrid/FilterValuesScroller.d.ts +0 -13
- package/dist/components/data/DataGrid/FilterValuesScroller.js +0 -73
- package/dist/components/data/DataGrid/VirtualScroller.d.ts +0 -11
- package/dist/components/data/DataGrid/VirtualScroller.js +0 -41
- package/dist/components/data/DataGrid/helpers/advancedRequests.d.ts +0 -12
- package/dist/components/data/DataGrid/helpers/advancedRequests.js +0 -53
- package/dist/components/data/DataGrid/helpers.d.ts +0 -28
- package/dist/components/data/DataGrid/helpers.js +0 -436
- package/dist/components/data/SmartQueryDataGrid/helpers/columns.d.ts +0 -20
- package/dist/components/data/SmartQueryDataGrid/helpers/columns.js +0 -160
- package/dist/components/data/SmartQueryDataGrid/helpers/hooks.d.ts +0 -5
- package/dist/components/data/SmartQueryDataGrid/helpers/hooks.js +0 -41
- package/dist/components/data/SmartQueryDataGrid/helpers/index.d.ts +0 -2
- package/dist/components/data/SmartQueryDataGrid/helpers/smartQueries.d.ts +0 -3
- package/dist/components/data/SmartQueryDataGrid/helpers/smartQueries.js +0 -15
- package/dist/components/data/SmartQueryDataGrid/hooks.d.ts +0 -9
- package/dist/components/data/SmartQueryDataGrid/hooks.js +0 -63
- package/dist/components/data/SmartQueryDataGrid/index.d.ts +0 -12
- package/dist/components/data/SmartQueryDataGrid/index.js +0 -242
- package/dist/components/data/SmartQueryDataGrid/types.d.ts +0 -22
- package/dist/components/forms/Form/InputWithLabel.d.ts +0 -2
- package/dist/components/forms/Form/InputWithLabel.js +0 -10
- package/dist/components/forms/Form/types.d.ts +0 -7
- package/dist/config/types.d.ts +0 -11
- package/dist/config/types.js +0 -2
- package/dist/services/requests/userPermissions.d.ts +0 -4
- package/dist/services/requests/userPermissions.js +0 -20
- /package/dist/components/{data/AdvancedRequestDataGrid → ui/Tab}/types.js +0 -0
- /package/dist/components/{data/SmartQueryDataGrid → ui/Tabs}/types.js +0 -0
- /package/dist/components/{forms/Form/types.js → ui/Tab/302/265/types.js"} +0 -0
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebSocketService = void 0;
|
|
18
|
+
exports.WebSocketService = exports.WebSocketError = void 0;
|
|
4
19
|
var rxjs_1 = require("rxjs");
|
|
5
20
|
var uuid_1 = require("uuid");
|
|
21
|
+
var WebSocketError = /** @class */ (function (_super) {
|
|
22
|
+
__extends(WebSocketError, _super);
|
|
23
|
+
function WebSocketError(status, message) {
|
|
24
|
+
var _this = _super.call(this, message) || this;
|
|
25
|
+
_this.status = status;
|
|
26
|
+
_this.name = 'WebSocketError';
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
return WebSocketError;
|
|
30
|
+
}(Error));
|
|
31
|
+
exports.WebSocketError = WebSocketError;
|
|
6
32
|
var WebSocketService = /** @class */ (function () {
|
|
7
33
|
function WebSocketService(config) {
|
|
8
34
|
this.socket = null;
|
|
9
35
|
this.status = undefined;
|
|
10
36
|
this.status$ = new rxjs_1.Subject();
|
|
37
|
+
this.error$ = new rxjs_1.Subject();
|
|
11
38
|
this.queue = [];
|
|
12
39
|
this.promises = {};
|
|
13
40
|
this.onOpen = function () { };
|
|
@@ -84,6 +111,7 @@ var WebSocketService = /** @class */ (function () {
|
|
|
84
111
|
var request = { id: id, name: name, data: data };
|
|
85
112
|
_this.promises[id] = { resolve: resolve, reject: reject };
|
|
86
113
|
if (!_this.socket || !_this.status) {
|
|
114
|
+
console.log('[WS] Queuing request:', request);
|
|
87
115
|
_this.queue.push(request);
|
|
88
116
|
return;
|
|
89
117
|
}
|
|
@@ -103,7 +131,11 @@ var WebSocketService = /** @class */ (function () {
|
|
|
103
131
|
console.log('[WS] Received response:', response);
|
|
104
132
|
if (typeof ((_a = response.data) === null || _a === void 0 ? void 0 : _a.status) === 'number' &&
|
|
105
133
|
response.data.status < 0) {
|
|
106
|
-
this.promises[response.id].reject(new
|
|
134
|
+
this.promises[response.id].reject(new WebSocketError(response.data.status, response.data.message));
|
|
135
|
+
this.error$.next({
|
|
136
|
+
status: response.data.status,
|
|
137
|
+
message: response.data.message || 'Unknown error',
|
|
138
|
+
});
|
|
107
139
|
}
|
|
108
140
|
else {
|
|
109
141
|
this.promises[response.id].resolve(response.data);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ConditionDTO, SqlRequestRow } from './sqlRequests';
|
|
2
|
+
import { OrderByDTO } from './sqlRequests';
|
|
2
3
|
export type GlobalSearchRequestDTO = {
|
|
3
|
-
types: string
|
|
4
|
+
types: Record<string, {
|
|
5
|
+
conditions?: ConditionDTO[];
|
|
6
|
+
orderBy?: OrderByDTO[];
|
|
7
|
+
}>;
|
|
4
8
|
searchTerm: string;
|
|
5
9
|
limit?: number;
|
|
6
|
-
conditions?: ConditionDTO[];
|
|
7
10
|
};
|
|
8
11
|
export type GlobalSearchResponseDTO<T = any> = {
|
|
9
12
|
data: Record<string, SqlRequestRow<T>[]>;
|
package/dist/services/hooks.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export declare const useLoadingRequestHandler: <TReq, TRes>(name: string) => ((data: TReq) => Promise<TRes>);
|
|
2
2
|
export declare const useWebSocketRequestHandler: <TReq, TRes>(name: string) => ((data: TReq) => Promise<TRes>);
|
|
3
3
|
export declare const useHttpRequestHandler: <TReq, TRes>(name: string) => ((data: TReq, files?: Record<string, File>) => Promise<TRes>);
|
|
4
|
+
export declare const useRequestState: <TReq, TRes>(name: string, loading?: boolean) => {
|
|
5
|
+
status: number | undefined;
|
|
6
|
+
isInitial: boolean;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
isSuccess: boolean;
|
|
9
|
+
isError: boolean;
|
|
10
|
+
response: TRes | null;
|
|
11
|
+
sendRequest: (data: TReq) => Promise<TRes | undefined>;
|
|
12
|
+
reset: () => void;
|
|
13
|
+
};
|
package/dist/services/hooks.js
CHANGED
|
@@ -1,9 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
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);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useHttpRequestHandler = exports.useWebSocketRequestHandler = exports.useLoadingRequestHandler = void 0;
|
|
4
|
-
var HttpService_1 = require("./HttpService");
|
|
39
|
+
exports.useRequestState = exports.useHttpRequestHandler = exports.useWebSocketRequestHandler = exports.useLoadingRequestHandler = void 0;
|
|
5
40
|
var WebSocketService_1 = require("./WebSocketService");
|
|
6
41
|
var react_1 = require("react");
|
|
42
|
+
var HttpService_1 = require("./HttpService");
|
|
7
43
|
var providers_1 = require("../providers");
|
|
8
44
|
var useLoadingRequestHandler = function (name) {
|
|
9
45
|
var _a = (0, providers_1.useLoading)(), startLoading = _a.startLoading, stopLoading = _a.stopLoading;
|
|
@@ -27,3 +63,54 @@ var useHttpRequestHandler = function (name) {
|
|
|
27
63
|
}, [name]);
|
|
28
64
|
};
|
|
29
65
|
exports.useHttpRequestHandler = useHttpRequestHandler;
|
|
66
|
+
var useRequestState = function (name, loading) {
|
|
67
|
+
if (loading === void 0) { loading = false; }
|
|
68
|
+
var _a = (0, react_1.useState)('initial'), state = _a[0], setState = _a[1];
|
|
69
|
+
var _b = (0, react_1.useState)(undefined), status = _b[0], setStatus = _b[1];
|
|
70
|
+
var _c = (0, react_1.useState)(null), response = _c[0], setResponse = _c[1];
|
|
71
|
+
var handleSendRequest = (0, exports.useWebSocketRequestHandler)(name);
|
|
72
|
+
var handleSendLoadingRequest = (0, exports.useLoadingRequestHandler)(name);
|
|
73
|
+
var sendRequest = (0, react_1.useCallback)(function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var res, error_1;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
setState('loading');
|
|
79
|
+
_a.label = 1;
|
|
80
|
+
case 1:
|
|
81
|
+
_a.trys.push([1, 3, , 4]);
|
|
82
|
+
return [4 /*yield*/, (loading
|
|
83
|
+
? handleSendLoadingRequest
|
|
84
|
+
: handleSendRequest)(data)];
|
|
85
|
+
case 2:
|
|
86
|
+
res = _a.sent();
|
|
87
|
+
setStatus(0);
|
|
88
|
+
setResponse(res);
|
|
89
|
+
setState('success');
|
|
90
|
+
return [2 /*return*/, res];
|
|
91
|
+
case 3:
|
|
92
|
+
error_1 = _a.sent();
|
|
93
|
+
setStatus(error_1 instanceof WebSocketService_1.WebSocketError ? error_1.status : -1);
|
|
94
|
+
setState('error');
|
|
95
|
+
return [3 /*break*/, 4];
|
|
96
|
+
case 4: return [2 /*return*/];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}); }, [handleSendLoadingRequest, handleSendRequest, loading]);
|
|
100
|
+
var reset = (0, react_1.useCallback)(function () {
|
|
101
|
+
setState('initial');
|
|
102
|
+
setStatus(undefined);
|
|
103
|
+
setResponse(null);
|
|
104
|
+
}, []);
|
|
105
|
+
return {
|
|
106
|
+
status: status,
|
|
107
|
+
isInitial: state === 'initial',
|
|
108
|
+
isLoading: state === 'loading',
|
|
109
|
+
isSuccess: state === 'success',
|
|
110
|
+
isError: state === 'error',
|
|
111
|
+
response: response,
|
|
112
|
+
sendRequest: sendRequest,
|
|
113
|
+
reset: reset,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
exports.useRequestState = useRequestState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@addev-be/ui",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"watch": "tsc -b --watch",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"update-version": "../../node/update-version.mjs"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@addev-be/framework-utils": "^0.20.
|
|
23
|
+
"@addev-be/framework-utils": "^0.20.2",
|
|
24
24
|
"@types/lodash": "^4",
|
|
25
25
|
"@types/react": "^18.3.3",
|
|
26
26
|
"@types/react-dom": "^18.3.0",
|
package/src/Icons.tsx
CHANGED
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
import { FC, SVGProps, useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import AngleLeftIcon from '../assets/icons/angle-left.svg?react';
|
|
4
|
-
import AngleRightIcon from '../assets/icons/angle-right.svg?react';
|
|
5
|
-
import ArrowDown19Icon from '../assets/icons/arrow-down-1-9.svg?react';
|
|
6
|
-
import ArrowDownAZIcon from '../assets/icons/arrow-down-a-z.svg?react';
|
|
7
|
-
import ArrowDownBigSmallIcon from '../assets/icons/arrow-down-big-small.svg?react';
|
|
8
|
-
import ArrowUp91Icon from '../assets/icons/arrow-up-9-1.svg?react';
|
|
9
|
-
import ArrowUpBigSmallIcon from '../assets/icons/arrow-up-big-small.svg?react';
|
|
10
|
-
import ArrowUpZAIcon from '../assets/icons/arrow-up-z-a.svg?react';
|
|
11
|
-
import ArrowsRotateIcon from '../assets/icons/arrows-rotate.svg?react';
|
|
12
|
-
import ArrowsUpDownIcon from '../assets/icons/arrows-up-down.svg?react';
|
|
13
|
-
import BarsIcon from '../assets/icons/bars.svg?react';
|
|
14
|
-
import CheckIcon from '../assets/icons/check.svg?react';
|
|
15
|
-
import ChevronDownIcon from '../assets/icons/chevron-down.svg?react';
|
|
16
|
-
import ChevronLeftIcon from '../assets/icons/chevron-left.svg?react';
|
|
17
|
-
import ChevronRightIcon from '../assets/icons/chevron-right.svg?react';
|
|
18
|
-
import CircleCheckIcon from '../assets/icons/circle-check.svg?react';
|
|
19
|
-
import CircleInfoIcon from '../assets/icons/circle-info.svg?react';
|
|
20
|
-
import CircleXMarkIcon from '../assets/icons/circle-xmark.svg?react';
|
|
21
|
-
import CopyIcon from '../assets/icons/copy.svg?react';
|
|
22
|
-
import DownIcon from '../assets/icons/down.svg?react';
|
|
23
|
-
import EllipsisIcon from '../assets/icons/ellipsis.svg?react';
|
|
24
|
-
import FilterFullIcon from '../assets/icons/filter-full.svg?react';
|
|
25
|
-
import FilterIcon from '../assets/icons/filter.svg?react';
|
|
26
|
-
import FilterSlashIcon from '../assets/icons/filter-slash.svg?react';
|
|
27
|
-
import FloppyDiskIcon from '../assets/icons/floppy-disk.svg?react';
|
|
28
|
-
import HashtagIcon from '../assets/icons/hashtag.svg?react';
|
|
29
|
-
import ImageSlashIcon from '../assets/icons/image-slash.svg?react';
|
|
30
|
-
import LeftIcon from '../assets/icons/left.svg?react';
|
|
31
|
-
import MagnifierIcon from '../assets/icons/magnifier.svg?react';
|
|
32
|
-
import PhoneIcon from '../assets/icons/phone.svg?react';
|
|
33
|
-
import PlusIcon from '../assets/icons/plus.svg?react';
|
|
34
|
-
import RightIcon from '../assets/icons/right.svg?react';
|
|
35
|
-
import SigmaIcon from '../assets/icons/sigma.svg?react';
|
|
36
|
-
import SortCalendarAscendingIcon from '../assets/icons/sort-calendar-ascending.svg?react';
|
|
37
|
-
import SortCalendarDescendingIcon from '../assets/icons/sort-calendar-descending.svg?react';
|
|
38
|
-
import SpinnerIcon from '../assets/icons/spinner-third.svg?react';
|
|
39
|
-
import TableColumnsIcon from '../assets/icons/table-columns.svg?react';
|
|
40
|
-
import TableFooterIcon from '../assets/icons/table-footer.svg?react';
|
|
41
|
-
import TableFooterSlashIcon from '../assets/icons/table-footer-slash.svg?react';
|
|
42
|
-
import TableIcon from '../assets/icons/table.svg?react';
|
|
43
|
-
import TallyIcon from '../assets/icons/tally.svg?react';
|
|
44
|
-
import TrashCanIcon from '../assets/icons/trash-can.svg?react';
|
|
45
|
-
import TriangleExclamationIcon from '../assets/icons/triangle-exclamation.svg?react';
|
|
46
|
-
import UpIcon from '../assets/icons/up.svg?react';
|
|
47
|
-
import UserTieIcon from '../assets/icons/user-tie.svg?react';
|
|
48
|
-
import XBarIcon from '../assets/icons/x-bar.svg?react';
|
|
49
|
-
import XMarkIcon from '../assets/icons/xmark.svg?react';
|
|
50
|
-
import XMarkLargeIcon from '../assets/icons/xmark-large.svg?react';
|
|
51
|
-
|
|
52
|
-
type IconFCProps = SVGProps<SVGSVGElement>;
|
|
53
|
-
export type IconFC = FC<IconFCProps>;
|
|
54
|
-
|
|
55
|
-
type AnimatedIconProps = {
|
|
56
|
-
icons: FC[];
|
|
57
|
-
speed?: number;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const AnimatedIcon: FC<AnimatedIconProps & IconFCProps> = ({
|
|
61
|
-
icons,
|
|
62
|
-
speed = 150,
|
|
63
|
-
...props
|
|
64
|
-
}) => {
|
|
65
|
-
const [currentIcon, setCurrentIcon] = useState(0);
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
const interval = setInterval(() => {
|
|
69
|
-
setCurrentIcon((currentIcon) => (currentIcon + 1) % icons.length);
|
|
70
|
-
}, speed);
|
|
71
|
-
|
|
72
|
-
return () => {
|
|
73
|
-
clearInterval(interval);
|
|
74
|
-
};
|
|
75
|
-
}, [icons.length, speed]);
|
|
76
|
-
|
|
77
|
-
const Icon = icons[currentIcon];
|
|
78
|
-
return <Icon {...props} />;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const LoadingIcon: FC<IconFCProps> = ({ className, ...props }) => (
|
|
82
|
-
<SpinnerIcon className={`animate-spin ${className}`} {...props} />
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
export const BlankIcon: FC<IconFCProps> = (props) => (
|
|
86
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props} />
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
export {
|
|
90
|
-
AngleLeftIcon,
|
|
91
|
-
AngleRightIcon,
|
|
92
|
-
ArrowDown19Icon,
|
|
93
|
-
ArrowDownAZIcon,
|
|
94
|
-
ArrowDownBigSmallIcon,
|
|
95
|
-
ArrowsRotateIcon,
|
|
96
|
-
ArrowsUpDownIcon,
|
|
97
|
-
ArrowUp91Icon,
|
|
98
|
-
ArrowUpBigSmallIcon,
|
|
99
|
-
ArrowUpZAIcon,
|
|
100
|
-
BarsIcon,
|
|
101
|
-
CheckIcon,
|
|
102
|
-
ChevronDownIcon,
|
|
103
|
-
ChevronLeftIcon,
|
|
104
|
-
ChevronRightIcon,
|
|
105
|
-
CircleCheckIcon,
|
|
106
|
-
CircleInfoIcon,
|
|
107
|
-
CircleXMarkIcon,
|
|
108
|
-
CopyIcon,
|
|
109
|
-
DownIcon,
|
|
110
|
-
EllipsisIcon,
|
|
111
|
-
FilterFullIcon,
|
|
112
|
-
FilterIcon,
|
|
113
|
-
FilterSlashIcon,
|
|
114
|
-
FloppyDiskIcon,
|
|
115
|
-
HashtagIcon,
|
|
116
|
-
ImageSlashIcon,
|
|
117
|
-
LeftIcon,
|
|
118
|
-
MagnifierIcon,
|
|
119
|
-
PhoneIcon,
|
|
120
|
-
PlusIcon,
|
|
121
|
-
RightIcon,
|
|
122
|
-
SigmaIcon,
|
|
123
|
-
SortCalendarAscendingIcon,
|
|
124
|
-
SortCalendarDescendingIcon,
|
|
125
|
-
SpinnerIcon,
|
|
126
|
-
TableColumnsIcon,
|
|
127
|
-
TableFooterIcon,
|
|
128
|
-
TableFooterSlashIcon,
|
|
129
|
-
TableIcon,
|
|
130
|
-
TallyIcon,
|
|
131
|
-
TrashCanIcon,
|
|
132
|
-
TriangleExclamationIcon,
|
|
133
|
-
UpIcon,
|
|
134
|
-
UserTieIcon,
|
|
135
|
-
XBarIcon,
|
|
136
|
-
XMarkIcon,
|
|
137
|
-
XMarkLargeIcon,
|
|
138
|
-
};
|
|
1
|
+
import { FC, SVGProps, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import AngleLeftIcon from '../assets/icons/angle-left.svg?react';
|
|
4
|
+
import AngleRightIcon from '../assets/icons/angle-right.svg?react';
|
|
5
|
+
import ArrowDown19Icon from '../assets/icons/arrow-down-1-9.svg?react';
|
|
6
|
+
import ArrowDownAZIcon from '../assets/icons/arrow-down-a-z.svg?react';
|
|
7
|
+
import ArrowDownBigSmallIcon from '../assets/icons/arrow-down-big-small.svg?react';
|
|
8
|
+
import ArrowUp91Icon from '../assets/icons/arrow-up-9-1.svg?react';
|
|
9
|
+
import ArrowUpBigSmallIcon from '../assets/icons/arrow-up-big-small.svg?react';
|
|
10
|
+
import ArrowUpZAIcon from '../assets/icons/arrow-up-z-a.svg?react';
|
|
11
|
+
import ArrowsRotateIcon from '../assets/icons/arrows-rotate.svg?react';
|
|
12
|
+
import ArrowsUpDownIcon from '../assets/icons/arrows-up-down.svg?react';
|
|
13
|
+
import BarsIcon from '../assets/icons/bars.svg?react';
|
|
14
|
+
import CheckIcon from '../assets/icons/check.svg?react';
|
|
15
|
+
import ChevronDownIcon from '../assets/icons/chevron-down.svg?react';
|
|
16
|
+
import ChevronLeftIcon from '../assets/icons/chevron-left.svg?react';
|
|
17
|
+
import ChevronRightIcon from '../assets/icons/chevron-right.svg?react';
|
|
18
|
+
import CircleCheckIcon from '../assets/icons/circle-check.svg?react';
|
|
19
|
+
import CircleInfoIcon from '../assets/icons/circle-info.svg?react';
|
|
20
|
+
import CircleXMarkIcon from '../assets/icons/circle-xmark.svg?react';
|
|
21
|
+
import CopyIcon from '../assets/icons/copy.svg?react';
|
|
22
|
+
import DownIcon from '../assets/icons/down.svg?react';
|
|
23
|
+
import EllipsisIcon from '../assets/icons/ellipsis.svg?react';
|
|
24
|
+
import FilterFullIcon from '../assets/icons/filter-full.svg?react';
|
|
25
|
+
import FilterIcon from '../assets/icons/filter.svg?react';
|
|
26
|
+
import FilterSlashIcon from '../assets/icons/filter-slash.svg?react';
|
|
27
|
+
import FloppyDiskIcon from '../assets/icons/floppy-disk.svg?react';
|
|
28
|
+
import HashtagIcon from '../assets/icons/hashtag.svg?react';
|
|
29
|
+
import ImageSlashIcon from '../assets/icons/image-slash.svg?react';
|
|
30
|
+
import LeftIcon from '../assets/icons/left.svg?react';
|
|
31
|
+
import MagnifierIcon from '../assets/icons/magnifier.svg?react';
|
|
32
|
+
import PhoneIcon from '../assets/icons/phone.svg?react';
|
|
33
|
+
import PlusIcon from '../assets/icons/plus.svg?react';
|
|
34
|
+
import RightIcon from '../assets/icons/right.svg?react';
|
|
35
|
+
import SigmaIcon from '../assets/icons/sigma.svg?react';
|
|
36
|
+
import SortCalendarAscendingIcon from '../assets/icons/sort-calendar-ascending.svg?react';
|
|
37
|
+
import SortCalendarDescendingIcon from '../assets/icons/sort-calendar-descending.svg?react';
|
|
38
|
+
import SpinnerIcon from '../assets/icons/spinner-third.svg?react';
|
|
39
|
+
import TableColumnsIcon from '../assets/icons/table-columns.svg?react';
|
|
40
|
+
import TableFooterIcon from '../assets/icons/table-footer.svg?react';
|
|
41
|
+
import TableFooterSlashIcon from '../assets/icons/table-footer-slash.svg?react';
|
|
42
|
+
import TableIcon from '../assets/icons/table.svg?react';
|
|
43
|
+
import TallyIcon from '../assets/icons/tally.svg?react';
|
|
44
|
+
import TrashCanIcon from '../assets/icons/trash-can.svg?react';
|
|
45
|
+
import TriangleExclamationIcon from '../assets/icons/triangle-exclamation.svg?react';
|
|
46
|
+
import UpIcon from '../assets/icons/up.svg?react';
|
|
47
|
+
import UserTieIcon from '../assets/icons/user-tie.svg?react';
|
|
48
|
+
import XBarIcon from '../assets/icons/x-bar.svg?react';
|
|
49
|
+
import XMarkIcon from '../assets/icons/xmark.svg?react';
|
|
50
|
+
import XMarkLargeIcon from '../assets/icons/xmark-large.svg?react';
|
|
51
|
+
|
|
52
|
+
type IconFCProps = SVGProps<SVGSVGElement>;
|
|
53
|
+
export type IconFC = FC<IconFCProps>;
|
|
54
|
+
|
|
55
|
+
type AnimatedIconProps = {
|
|
56
|
+
icons: FC[];
|
|
57
|
+
speed?: number;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const AnimatedIcon: FC<AnimatedIconProps & IconFCProps> = ({
|
|
61
|
+
icons,
|
|
62
|
+
speed = 150,
|
|
63
|
+
...props
|
|
64
|
+
}) => {
|
|
65
|
+
const [currentIcon, setCurrentIcon] = useState(0);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const interval = setInterval(() => {
|
|
69
|
+
setCurrentIcon((currentIcon) => (currentIcon + 1) % icons.length);
|
|
70
|
+
}, speed);
|
|
71
|
+
|
|
72
|
+
return () => {
|
|
73
|
+
clearInterval(interval);
|
|
74
|
+
};
|
|
75
|
+
}, [icons.length, speed]);
|
|
76
|
+
|
|
77
|
+
const Icon = icons[currentIcon];
|
|
78
|
+
return <Icon {...props} />;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const LoadingIcon: FC<IconFCProps> = ({ className, ...props }) => (
|
|
82
|
+
<SpinnerIcon className={`animate-spin ${className}`} {...props} />
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
export const BlankIcon: FC<IconFCProps> = (props) => (
|
|
86
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" {...props} />
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
AngleLeftIcon,
|
|
91
|
+
AngleRightIcon,
|
|
92
|
+
ArrowDown19Icon,
|
|
93
|
+
ArrowDownAZIcon,
|
|
94
|
+
ArrowDownBigSmallIcon,
|
|
95
|
+
ArrowsRotateIcon,
|
|
96
|
+
ArrowsUpDownIcon,
|
|
97
|
+
ArrowUp91Icon,
|
|
98
|
+
ArrowUpBigSmallIcon,
|
|
99
|
+
ArrowUpZAIcon,
|
|
100
|
+
BarsIcon,
|
|
101
|
+
CheckIcon,
|
|
102
|
+
ChevronDownIcon,
|
|
103
|
+
ChevronLeftIcon,
|
|
104
|
+
ChevronRightIcon,
|
|
105
|
+
CircleCheckIcon,
|
|
106
|
+
CircleInfoIcon,
|
|
107
|
+
CircleXMarkIcon,
|
|
108
|
+
CopyIcon,
|
|
109
|
+
DownIcon,
|
|
110
|
+
EllipsisIcon,
|
|
111
|
+
FilterFullIcon,
|
|
112
|
+
FilterIcon,
|
|
113
|
+
FilterSlashIcon,
|
|
114
|
+
FloppyDiskIcon,
|
|
115
|
+
HashtagIcon,
|
|
116
|
+
ImageSlashIcon,
|
|
117
|
+
LeftIcon,
|
|
118
|
+
MagnifierIcon,
|
|
119
|
+
PhoneIcon,
|
|
120
|
+
PlusIcon,
|
|
121
|
+
RightIcon,
|
|
122
|
+
SigmaIcon,
|
|
123
|
+
SortCalendarAscendingIcon,
|
|
124
|
+
SortCalendarDescendingIcon,
|
|
125
|
+
SpinnerIcon,
|
|
126
|
+
TableColumnsIcon,
|
|
127
|
+
TableFooterIcon,
|
|
128
|
+
TableFooterSlashIcon,
|
|
129
|
+
TableIcon,
|
|
130
|
+
TallyIcon,
|
|
131
|
+
TrashCanIcon,
|
|
132
|
+
TriangleExclamationIcon,
|
|
133
|
+
UpIcon,
|
|
134
|
+
UserTieIcon,
|
|
135
|
+
XBarIcon,
|
|
136
|
+
XMarkIcon,
|
|
137
|
+
XMarkLargeIcon,
|
|
138
|
+
};
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { Button, Input } from '../forms';
|
|
2
|
-
import { Card, Message } from '../ui';
|
|
3
|
-
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { Link, redirect } from 'react-router-dom';
|
|
5
|
-
|
|
6
|
-
import { FormContainer } from './styles';
|
|
7
|
-
import { StackedLabel } from '../forms/VerticalLabel';
|
|
8
|
-
import { useAuthentication } from '../../providers';
|
|
9
|
-
|
|
10
|
-
export const LoginForm: FC = () => {
|
|
11
|
-
const [username, setUsername] = useState(
|
|
12
|
-
localStorage.getItem('username') || ''
|
|
13
|
-
);
|
|
14
|
-
const [password, setPassword] = useState('');
|
|
15
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
16
|
-
const [error, setError] = useState('');
|
|
17
|
-
const usernameInputRef = useRef<HTMLInputElement>(null);
|
|
18
|
-
const passwordInputRef = useRef<HTMLInputElement>(null);
|
|
19
|
-
|
|
20
|
-
const { login } = useAuthentication();
|
|
21
|
-
|
|
22
|
-
const onLoginClicked = useCallback(() => {
|
|
23
|
-
setError('');
|
|
24
|
-
setIsLoading(true);
|
|
25
|
-
login(username, password).then((success) => {
|
|
26
|
-
setIsLoading(false);
|
|
27
|
-
if (success) {
|
|
28
|
-
localStorage.setItem('username', username);
|
|
29
|
-
redirect('/');
|
|
30
|
-
} else {
|
|
31
|
-
setError('Identifiants invalides');
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}, [login, password, username]);
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (usernameInputRef.current && passwordInputRef.current) {
|
|
38
|
-
const input = !username
|
|
39
|
-
? usernameInputRef.current
|
|
40
|
-
: passwordInputRef.current;
|
|
41
|
-
input.select();
|
|
42
|
-
input.focus();
|
|
43
|
-
}
|
|
44
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
-
}, []);
|
|
46
|
-
|
|
47
|
-
if (isLoading) return <div>Chargement...</div>;
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Card>
|
|
51
|
-
<FormContainer>
|
|
52
|
-
<StackedLabel label="Adresse e-mail / Nom d'utilisateur">
|
|
53
|
-
<Input
|
|
54
|
-
ref={usernameInputRef}
|
|
55
|
-
type="email"
|
|
56
|
-
autoComplete="email"
|
|
57
|
-
required
|
|
58
|
-
value={username}
|
|
59
|
-
onChange={(e) => setUsername(e.target.value)}
|
|
60
|
-
/>
|
|
61
|
-
</StackedLabel>
|
|
62
|
-
|
|
63
|
-
<StackedLabel label="Mot de passe">
|
|
64
|
-
<Input
|
|
65
|
-
ref={passwordInputRef}
|
|
66
|
-
type="password"
|
|
67
|
-
autoComplete="current-password"
|
|
68
|
-
required
|
|
69
|
-
value={password}
|
|
70
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
71
|
-
/>
|
|
72
|
-
</StackedLabel>
|
|
73
|
-
|
|
74
|
-
{error && <Message type="error">{error}</Message>}
|
|
75
|
-
|
|
76
|
-
<Button $color="primary" onClick={onLoginClicked}>
|
|
77
|
-
Se connecter
|
|
78
|
-
</Button>
|
|
79
|
-
|
|
80
|
-
<Link to="/recover">Mot de passe oublié ?</Link>
|
|
81
|
-
</FormContainer>
|
|
82
|
-
</Card>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
1
|
+
import { Button, Input } from '../forms';
|
|
2
|
+
import { Card, Message } from '../ui';
|
|
3
|
+
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Link, redirect } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
import { FormContainer } from './styles';
|
|
7
|
+
import { StackedLabel } from '../forms/VerticalLabel';
|
|
8
|
+
import { useAuthentication } from '../../providers';
|
|
9
|
+
|
|
10
|
+
export const LoginForm: FC = () => {
|
|
11
|
+
const [username, setUsername] = useState(
|
|
12
|
+
localStorage.getItem('username') || ''
|
|
13
|
+
);
|
|
14
|
+
const [password, setPassword] = useState('');
|
|
15
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
16
|
+
const [error, setError] = useState('');
|
|
17
|
+
const usernameInputRef = useRef<HTMLInputElement>(null);
|
|
18
|
+
const passwordInputRef = useRef<HTMLInputElement>(null);
|
|
19
|
+
|
|
20
|
+
const { login } = useAuthentication();
|
|
21
|
+
|
|
22
|
+
const onLoginClicked = useCallback(() => {
|
|
23
|
+
setError('');
|
|
24
|
+
setIsLoading(true);
|
|
25
|
+
login(username, password).then((success) => {
|
|
26
|
+
setIsLoading(false);
|
|
27
|
+
if (success) {
|
|
28
|
+
localStorage.setItem('username', username);
|
|
29
|
+
redirect('/');
|
|
30
|
+
} else {
|
|
31
|
+
setError('Identifiants invalides');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}, [login, password, username]);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (usernameInputRef.current && passwordInputRef.current) {
|
|
38
|
+
const input = !username
|
|
39
|
+
? usernameInputRef.current
|
|
40
|
+
: passwordInputRef.current;
|
|
41
|
+
input.select();
|
|
42
|
+
input.focus();
|
|
43
|
+
}
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
if (isLoading) return <div>Chargement...</div>;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Card>
|
|
51
|
+
<FormContainer>
|
|
52
|
+
<StackedLabel label="Adresse e-mail / Nom d'utilisateur">
|
|
53
|
+
<Input
|
|
54
|
+
ref={usernameInputRef}
|
|
55
|
+
type="email"
|
|
56
|
+
autoComplete="email"
|
|
57
|
+
required
|
|
58
|
+
value={username}
|
|
59
|
+
onChange={(e) => setUsername(e.target.value)}
|
|
60
|
+
/>
|
|
61
|
+
</StackedLabel>
|
|
62
|
+
|
|
63
|
+
<StackedLabel label="Mot de passe">
|
|
64
|
+
<Input
|
|
65
|
+
ref={passwordInputRef}
|
|
66
|
+
type="password"
|
|
67
|
+
autoComplete="current-password"
|
|
68
|
+
required
|
|
69
|
+
value={password}
|
|
70
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
71
|
+
/>
|
|
72
|
+
</StackedLabel>
|
|
73
|
+
|
|
74
|
+
{error && <Message type="error">{error}</Message>}
|
|
75
|
+
|
|
76
|
+
<Button $color="primary" onClick={onLoginClicked}>
|
|
77
|
+
Se connecter
|
|
78
|
+
</Button>
|
|
79
|
+
|
|
80
|
+
<Link to="/recover">Mot de passe oublié ?</Link>
|
|
81
|
+
</FormContainer>
|
|
82
|
+
</Card>
|
|
83
|
+
);
|
|
84
|
+
};
|