@variocube/app-ui 1.15.0 → 1.16.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/esm/AppShell/AppShell.js +12 -12
- package/esm/AppShell/AppShell.js.map +1 -1
- package/esm/AppShell/index.js.map +1 -1
- package/esm/Input/ActionsMenu.js +1 -1
- package/esm/Input/ActionsMenu.js.map +1 -1
- package/esm/Input/EmailSenderField.js +3 -3
- package/esm/Input/EmailSenderField.js.map +1 -1
- package/esm/Input/Selector.js +2 -2
- package/esm/Input/Selector.js.map +1 -1
- package/esm/Paging/Paging.d.ts +1 -1
- package/esm/Paging/Paging.js +5 -5
- package/esm/Paging/Paging.js.map +1 -1
- package/esm/Paging/index.d.ts +2 -1
- package/esm/Paging/index.js.map +1 -1
- package/esm/VCThemeProvider/JetbrainsMonoFont.js +8 -8
- package/esm/VCThemeProvider/JetbrainsMonoFont.js.map +1 -1
- package/esm/VCThemeProvider/RobotoFont.js +8 -8
- package/esm/VCThemeProvider/RobotoFont.js.map +1 -1
- package/esm/VCThemeProvider/ThemeModeSwitcher.js +5 -5
- package/esm/VCThemeProvider/ThemeModeSwitcher.js.map +1 -1
- package/esm/VCThemeProvider/VCThemeProvider.d.ts +1 -1
- package/esm/VCThemeProvider/VCThemeProvider.js +21 -21
- package/esm/VCThemeProvider/VCThemeProvider.js.map +1 -1
- package/esm/audit/AuditChanges.js +9 -5
- package/esm/audit/AuditChanges.js.map +1 -1
- package/esm/audit/AuditTimeline.js +1 -1
- package/esm/audit/AuditTimeline.js.map +1 -1
- package/esm/audit/AuditTimelineItem.js +3 -3
- package/esm/audit/AuditTimelineItem.js.map +1 -1
- package/esm/audit/index.d.ts +1 -1
- package/esm/audit/index.js +1 -1
- package/esm/audit/index.js.map +1 -1
- package/esm/breadcrumbs.d.ts +2 -2
- package/esm/breadcrumbs.js +3 -3
- package/esm/breadcrumbs.js.map +1 -1
- package/esm/code/CodeBlock.d.ts +1 -1
- package/esm/code/CodeBlock.js +1 -1
- package/esm/code/CodeBlock.js.map +1 -1
- package/esm/confirm/ConfirmButton.js.map +1 -1
- package/esm/confirm/ConfirmDialog.js +1 -1
- package/esm/confirm/ConfirmDialog.js.map +1 -1
- package/esm/confirm/ConfirmMenuItem.js +1 -1
- package/esm/confirm/ConfirmMenuItem.js.map +1 -1
- package/esm/container/ContainerLayout.d.ts +1 -1
- package/esm/container/ContainerLayout.js +5 -5
- package/esm/container/ContainerLayout.js.map +1 -1
- package/esm/container/ContainerSettingsContext.d.ts +2 -2
- package/esm/container/ContainerSettingsContext.js +6 -6
- package/esm/container/ContainerSettingsContext.js.map +1 -1
- package/esm/container/ContainerWidthControl.js +2 -2
- package/esm/container/ContainerWidthControl.js.map +1 -1
- package/esm/container/index.d.ts +1 -1
- package/esm/container/index.js +1 -1
- package/esm/container/index.js.map +1 -1
- package/esm/content-table/ContentTable.d.ts +1 -1
- package/esm/content-table/ContentTable.js +26 -19
- package/esm/content-table/ContentTable.js.map +1 -1
- package/esm/content-table/UndrawEmpty.js.map +1 -1
- package/esm/content-table/index.js.map +1 -1
- package/esm/country/country-select.js.map +1 -1
- package/esm/country/index.d.ts +3 -3
- package/esm/country/index.js +3 -3
- package/esm/country/index.js.map +1 -1
- package/esm/country/locale-select.js +1 -1
- package/esm/country/locale-select.js.map +1 -1
- package/esm/country/locales.js +1 -1
- package/esm/country/locales.js.map +1 -1
- package/esm/country/phone-prefix-select.js +1 -1
- package/esm/country/phone-prefix-select.js.map +1 -1
- package/esm/cube/accessibility.js +2 -1
- package/esm/cube/accessibility.js.map +1 -1
- package/esm/data-table/DataTableColumnSettings.d.ts +1 -1
- package/esm/data-table/DataTableColumnSettings.js +2 -2
- package/esm/data-table/DataTableColumnSettings.js.map +1 -1
- package/esm/data-table/DataTableHeader.js +1 -1
- package/esm/data-table/DataTableHeader.js.map +1 -1
- package/esm/data-table/DataTableToolbar.js +1 -1
- package/esm/data-table/DataTableToolbar.js.map +1 -1
- package/esm/data-table/index.d.ts +4 -4
- package/esm/data-table/index.js +4 -4
- package/esm/data-table/index.js.map +1 -1
- package/esm/data-table/useDataTableColumnStorage.d.ts +9 -1
- package/esm/data-table/useDataTableColumnStorage.js +12 -5
- package/esm/data-table/useDataTableColumnStorage.js.map +1 -1
- package/esm/data-table/useDataTableStorage.d.ts +31 -6
- package/esm/data-table/useDataTableStorage.js +25 -5
- package/esm/data-table/useDataTableStorage.js.map +1 -1
- package/esm/date-pickers/PlainAdapterCommon.d.ts +1 -1
- package/esm/date-pickers/PlainAdapterCommon.js.map +1 -1
- package/esm/date-pickers/PlainDateAdapter.js.map +1 -1
- package/esm/date-pickers/PlainDatePicker.js +1 -1
- package/esm/date-pickers/PlainDatePicker.js.map +1 -1
- package/esm/date-pickers/PlainDatePicker.spec.js +2 -2
- package/esm/date-pickers/PlainDatePicker.spec.js.map +1 -1
- package/esm/date-pickers/PlainDateTimeAdapter.js.map +1 -1
- package/esm/date-pickers/PlainDateTimePicker.js +2 -2
- package/esm/date-pickers/PlainDateTimePicker.js.map +1 -1
- package/esm/date-pickers/PlainDateTimePicker.spec.js +2 -2
- package/esm/date-pickers/PlainDateTimePicker.spec.js.map +1 -1
- package/esm/date-pickers/PlainTimeAdapter.js.map +1 -1
- package/esm/date-pickers/PlainTimePicker.js +2 -2
- package/esm/date-pickers/PlainTimePicker.js.map +1 -1
- package/esm/date-pickers/PlainTimePicker.spec.js +2 -2
- package/esm/date-pickers/PlainTimePicker.spec.js.map +1 -1
- package/esm/date-pickers/TemporalAdapter.d.ts +1 -1
- package/esm/date-pickers/TemporalAdapter.js +1 -1
- package/esm/date-pickers/TemporalAdapter.js.map +1 -1
- package/esm/date-pickers/TimezoneSelect.js +348 -348
- package/esm/date-pickers/TimezoneSelect.js.map +1 -1
- package/esm/date-pickers/getFormatString.js.map +1 -1
- package/esm/date-pickers/index.d.ts +2 -1
- package/esm/date-pickers/index.js +1 -1
- package/esm/date-pickers/index.js.map +1 -1
- package/esm/date-pickers/parse.js.map +1 -1
- package/esm/date-pickers/timeframe-picker.js +7 -7
- package/esm/date-pickers/timeframe-picker.js.map +1 -1
- package/esm/date-pickers/useLocale.js.map +1 -1
- package/esm/date-pickers/useRenderInput.js +5 -3
- package/esm/date-pickers/useRenderInput.js.map +1 -1
- package/esm/formats/CompactFormat.js +1 -1
- package/esm/formats/CompactFormat.js.map +1 -1
- package/esm/formats/CompactFormat.spec.js +1 -1
- package/esm/formats/CompactFormat.spec.js.map +1 -1
- package/esm/formats/CurrencyFormat.js +1 -1
- package/esm/formats/CurrencyFormat.js.map +1 -1
- package/esm/formats/CurrencyFormat.spec.js +1 -1
- package/esm/formats/CurrencyFormat.spec.js.map +1 -1
- package/esm/formats/DecimalFormat.js +1 -1
- package/esm/formats/DecimalFormat.js.map +1 -1
- package/esm/formats/DecimalFormat.spec.js +1 -1
- package/esm/formats/DecimalFormat.spec.js.map +1 -1
- package/esm/formats/DurationFormat.js +2 -2
- package/esm/formats/DurationFormat.js.map +1 -1
- package/esm/formats/DurationFormat.spec.js +2 -2
- package/esm/formats/DurationFormat.spec.js.map +1 -1
- package/esm/formats/TemporalFormat.spec.js +2 -2
- package/esm/formats/TemporalFormat.spec.js.map +1 -1
- package/esm/formats/TemporalRangeFormat.js +1 -1
- package/esm/formats/TemporalRangeFormat.js.map +1 -1
- package/esm/formats/TemporalRangeFormat.spec.js +2 -2
- package/esm/formats/TemporalRangeFormat.spec.js.map +1 -1
- package/esm/formats/useDateTimeFormat.js +5 -2
- package/esm/formats/useDateTimeFormat.js.map +1 -1
- package/esm/formats/useNumberFormat.js +1 -1
- package/esm/formats/useNumberFormat.js.map +1 -1
- package/esm/formats/useRelativeTimeFormat.js +4 -2
- package/esm/formats/useRelativeTimeFormat.js.map +1 -1
- package/esm/forms/SearchForm.js +1 -1
- package/esm/forms/SearchForm.js.map +1 -1
- package/esm/getNavigatorLanguages.js.map +1 -1
- package/esm/getSupportedFormatLocale.js.map +1 -1
- package/esm/help/HelpDrawer.js +12 -8
- package/esm/help/HelpDrawer.js.map +1 -1
- package/esm/help/index.d.ts +1 -1
- package/esm/help/index.js +1 -1
- package/esm/help/index.js.map +1 -1
- package/esm/icons.d.ts +13 -13
- package/esm/icons.js +13 -13
- package/esm/icons.js.map +1 -1
- package/esm/layout/ErrorBoundary.js +36 -36
- package/esm/layout/ErrorBoundary.js.map +1 -1
- package/esm/layout/NotFound.js +6 -6
- package/esm/layout/NotFound.js.map +1 -1
- package/esm/layout/NotFoundSvg.js.map +1 -1
- package/esm/layout/UserNav.js +18 -18
- package/esm/layout/UserNav.js.map +1 -1
- package/esm/layout/index.d.ts +2 -2
- package/esm/layout/index.js +2 -2
- package/esm/layout/index.js.map +1 -1
- package/esm/logo/Logo.js +2 -2
- package/esm/logo/Logo.js.map +1 -1
- package/esm/logo/VCAppLogo.js +1 -1
- package/esm/logo/VCAppLogo.js.map +1 -1
- package/esm/logo/index.d.ts +3 -3
- package/esm/logo/index.js +3 -3
- package/esm/logo/index.js.map +1 -1
- package/esm/splash/index.js +2 -2
- package/esm/splash/index.js.map +1 -1
- package/esm/storage/MemoryStorage.d.ts +6 -4
- package/esm/storage/MemoryStorage.js +13 -4
- package/esm/storage/MemoryStorage.js.map +1 -1
- package/esm/storage/index.d.ts +2 -1
- package/esm/storage/index.js +1 -1
- package/esm/storage/index.js.map +1 -1
- package/esm/storage/storage.d.ts +6 -4
- package/esm/storage/storage.js +35 -15
- package/esm/storage/storage.js.map +1 -1
- package/esm/storage/types.d.ts +6 -0
- package/esm/storage/types.js +2 -0
- package/esm/storage/types.js.map +1 -0
- package/esm/storage/useStorage.d.ts +10 -1
- package/esm/storage/useStorage.js +30 -7
- package/esm/storage/useStorage.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +2 -2
- package/esm/tabs/Tabs.js +15 -15
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tabs/index.js.map +1 -1
- package/esm/temporal/index.d.ts +1 -1
- package/esm/temporal/index.js +1 -1
- package/esm/temporal/index.js.map +1 -1
- package/esm/temporal/parse.js.map +1 -1
- package/esm/temporal/polyfill.d.ts +1 -1
- package/esm/temporal/polyfill.js +3 -3
- package/esm/temporal/polyfill.js.map +1 -1
- package/esm/utils/defined.js.map +1 -1
- package/esm/utils/index.d.ts +1 -1
- package/esm/utils/index.js +1 -1
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/useFlag.js.map +1 -1
- package/esm/utils/useIsMounted.js.map +1 -1
- package/package.json +8 -9
- package/src/AppShell/AppShell.tsx +147 -140
- package/src/AppShell/index.tsx +1 -1
- package/src/Input/ActionsMenu.tsx +70 -73
- package/src/Input/EmailSenderField.tsx +59 -52
- package/src/Input/Selector.tsx +15 -15
- package/src/LanguageSwitcher/index.ts +1 -1
- package/src/Paging/Paging.ts +56 -57
- package/src/Paging/index.ts +2 -1
- package/src/VCThemeProvider/JetbrainsMonoFont.tsx +52 -42
- package/src/VCThemeProvider/RobotoFont.tsx +47 -39
- package/src/VCThemeProvider/ThemeModeSwitcher.tsx +17 -17
- package/src/VCThemeProvider/VCThemeProvider.tsx +149 -145
- package/src/audit/AuditChanges.tsx +18 -12
- package/src/audit/AuditTimeline.tsx +16 -17
- package/src/audit/AuditTimelineItem.tsx +58 -61
- package/src/audit/index.ts +2 -2
- package/src/audit/types.ts +27 -28
- package/src/breadcrumbs.tsx +11 -15
- package/src/code/CodeBlock.tsx +10 -10
- package/src/confirm/ConfirmButton.tsx +56 -56
- package/src/confirm/ConfirmDialog.tsx +54 -54
- package/src/confirm/ConfirmMenuItem.tsx +51 -53
- package/src/container/ContainerLayout.tsx +7 -8
- package/src/container/ContainerSettingsContext.tsx +49 -46
- package/src/container/ContainerWidthControl.tsx +11 -9
- package/src/container/index.ts +8 -3
- package/src/content-table/ContentTable.tsx +235 -197
- package/src/content-table/UndrawEmpty.tsx +281 -281
- package/src/content-table/index.ts +1 -1
- package/src/country/country-select.tsx +0 -1
- package/src/country/index.ts +3 -3
- package/src/country/locale-select.tsx +36 -36
- package/src/country/locales.ts +185 -187
- package/src/country/phone-prefix-select.tsx +4 -5
- package/src/cube/accessibility.tsx +2 -1
- package/src/data-table/DataTableColumnSettings.tsx +181 -181
- package/src/data-table/DataTableHeader.tsx +6 -6
- package/src/data-table/DataTableToolbar.tsx +6 -6
- package/src/data-table/index.tsx +4 -4
- package/src/data-table/useDataTableColumnStorage.ts +30 -19
- package/src/data-table/useDataTableStorage.spec.ts +108 -0
- package/src/data-table/useDataTableStorage.ts +91 -36
- package/src/date-pickers/PlainAdapterCommon.ts +118 -120
- package/src/date-pickers/PlainDateAdapter.spec.ts +44 -46
- package/src/date-pickers/PlainDateAdapter.ts +130 -132
- package/src/date-pickers/PlainDatePicker.spec.tsx +17 -18
- package/src/date-pickers/PlainDatePicker.tsx +33 -36
- package/src/date-pickers/PlainDateTimeAdapter.spec.ts +44 -46
- package/src/date-pickers/PlainDateTimeAdapter.ts +141 -134
- package/src/date-pickers/PlainDateTimePicker.spec.tsx +17 -18
- package/src/date-pickers/PlainDateTimePicker.tsx +35 -36
- package/src/date-pickers/PlainTimeAdapter.ts +219 -221
- package/src/date-pickers/PlainTimePicker.spec.tsx +17 -18
- package/src/date-pickers/PlainTimePicker.tsx +35 -34
- package/src/date-pickers/TemporalAdapter.ts +110 -111
- package/src/date-pickers/TimezoneSelect.tsx +375 -375
- package/src/date-pickers/getFormatString.ts +29 -29
- package/src/date-pickers/index.ts +6 -5
- package/src/date-pickers/parse.spec.ts +37 -40
- package/src/date-pickers/parse.ts +44 -47
- package/src/date-pickers/timeframe-picker.tsx +16 -17
- package/src/date-pickers/useLocale.ts +1 -1
- package/src/date-pickers/useRenderInput.tsx +24 -15
- package/src/formats/CompactFormat.spec.tsx +18 -20
- package/src/formats/CompactFormat.tsx +30 -30
- package/src/formats/CurrencyFormat.spec.tsx +18 -20
- package/src/formats/CurrencyFormat.tsx +52 -52
- package/src/formats/DecimalFormat.spec.tsx +18 -20
- package/src/formats/DecimalFormat.tsx +47 -47
- package/src/formats/DurationFormat.spec.tsx +48 -49
- package/src/formats/DurationFormat.tsx +51 -51
- package/src/formats/TemporalFormat.spec.tsx +93 -95
- package/src/formats/TemporalRangeFormat.spec.tsx +143 -144
- package/src/formats/TemporalRangeFormat.tsx +54 -54
- package/src/formats/types.ts +1 -3
- package/src/formats/useDateTimeFormat.ts +5 -2
- package/src/formats/useNumberFormat.ts +3 -3
- package/src/formats/useRelativeTimeFormat.ts +5 -3
- package/src/forms/SearchForm.tsx +37 -38
- package/src/getNavigatorLanguages.ts +4 -5
- package/src/getSupportedFormatLocale.ts +10 -10
- package/src/help/HelpDrawer.tsx +76 -55
- package/src/help/index.ts +3 -3
- package/src/icons.ts +21 -21
- package/src/layout/ErrorBoundary.tsx +226 -215
- package/src/layout/NotFound.tsx +36 -39
- package/src/layout/NotFoundSvg.tsx +193 -169
- package/src/layout/UserNav.tsx +98 -98
- package/src/layout/index.ts +3 -3
- package/src/logo/Logo.tsx +6 -7
- package/src/logo/VCAppLogo.tsx +22 -20
- package/src/logo/index.tsx +3 -3
- package/src/splash/index.tsx +25 -25
- package/src/storage/MemoryStorage.ts +22 -15
- package/src/storage/index.ts +2 -1
- package/src/storage/storage.spec.ts +184 -0
- package/src/storage/storage.ts +37 -15
- package/src/storage/types.ts +6 -0
- package/src/storage/useStorage.ts +32 -7
- package/src/tabs/Tabs.tsx +172 -170
- package/src/tabs/index.ts +1 -1
- package/src/temporal/index.ts +1 -1
- package/src/temporal/parse.ts +1 -2
- package/src/temporal/polyfill.ts +11 -11
- package/src/utils/defined.ts +2 -3
- package/src/utils/index.ts +1 -1
- package/src/utils/useFlag.ts +5 -5
- package/src/utils/useIsMounted.ts +9 -9
package/src/audit/types.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
1
|
export interface AppAuditLogEntry {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
created: string;
|
|
3
|
+
tenantId: string | null;
|
|
4
|
+
cubeId: string | null;
|
|
5
|
+
boxNumber: string | null;
|
|
6
|
+
occupancyId: string | null;
|
|
7
|
+
source: string | null;
|
|
8
|
+
level: string;
|
|
9
|
+
message: string;
|
|
10
|
+
referenceType: string | null;
|
|
11
|
+
referenceId: string | null;
|
|
12
|
+
type: string;
|
|
13
|
+
userId: string | null;
|
|
14
|
+
data?: any;
|
|
15
|
+
patch?: JsonPatch;
|
|
16
|
+
actor: string | null;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export type JsonPatch = Array<JsonPatchItem>;
|
|
@@ -22,25 +21,25 @@ export type JsonPatch = Array<JsonPatchItem>;
|
|
|
22
21
|
export type JsonPatchItem = AddPatch | RemovePatch | ReplacePatch | MovePatch | CopyPatch;
|
|
23
22
|
|
|
24
23
|
export interface Patch {
|
|
25
|
-
|
|
24
|
+
path: string;
|
|
26
25
|
}
|
|
27
26
|
export interface AddPatch extends Patch {
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
op: "add";
|
|
28
|
+
value: any;
|
|
30
29
|
}
|
|
31
30
|
export interface RemovePatch extends Patch {
|
|
32
|
-
|
|
31
|
+
op: "remove";
|
|
33
32
|
}
|
|
34
33
|
export interface ReplacePatch extends Patch {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
op: "replace";
|
|
35
|
+
value: any;
|
|
36
|
+
fromValue: any;
|
|
38
37
|
}
|
|
39
38
|
export interface MovePatch extends Patch {
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
op: "move";
|
|
40
|
+
from: string;
|
|
42
41
|
}
|
|
43
42
|
export interface CopyPatch extends Patch {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
43
|
+
op: "copy";
|
|
44
|
+
from: string;
|
|
45
|
+
}
|
package/src/breadcrumbs.tsx
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import React, {PropsWithChildren} from "react";
|
|
2
1
|
import {Breadcrumbs as MuiBreadcrumbs, Link, LinkProps, Typography} from "@mui/material";
|
|
3
|
-
import {ChevronRightIcon} from "./icons";
|
|
4
2
|
import {LinkTypeMap} from "@mui/material/Link/Link";
|
|
3
|
+
import React, {PropsWithChildren} from "react";
|
|
4
|
+
import {ChevronRightIcon} from "./icons";
|
|
5
5
|
|
|
6
6
|
export function Breadcrumbs({children}: PropsWithChildren<{}>) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
return (
|
|
8
|
+
<MuiBreadcrumbs separator={<ChevronRightIcon fontSize="small" />}>
|
|
9
|
+
{children}
|
|
10
|
+
</MuiBreadcrumbs>
|
|
11
|
+
);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function BreadcrumbLink<
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
D extends React.ElementType = LinkTypeMap["defaultComponent"],
|
|
16
|
+
P = {},
|
|
17
17
|
>(props: LinkProps<D, P>) {
|
|
18
|
-
|
|
19
|
-
<Link color="inherit" {...props}/>
|
|
20
|
-
)
|
|
18
|
+
return <Link color="inherit" {...props} />;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
export function BreadcrumbItem({children}: PropsWithChildren<{}>) {
|
|
24
|
-
|
|
25
|
-
<Typography color="textPrimary">{children}</Typography>
|
|
26
|
-
);
|
|
22
|
+
return <Typography color="textPrimary">{children}</Typography>;
|
|
27
23
|
}
|
package/src/code/CodeBlock.tsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {Code, CodeProps} from "./Code";
|
|
2
1
|
import React, {PropsWithChildren} from "react";
|
|
2
|
+
import {Code, CodeProps} from "./Code";
|
|
3
3
|
|
|
4
4
|
export type CodeBlockProps = PropsWithChildren<Omit<CodeProps, "block">>;
|
|
5
5
|
|
|
6
6
|
export function CodeBlock(props: CodeBlockProps) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
7
|
+
return (
|
|
8
|
+
<Code
|
|
9
|
+
display="block"
|
|
10
|
+
px="0.5em"
|
|
11
|
+
py="0.25em"
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -5,65 +5,65 @@ import {useFlag, useIsMounted} from "../utils";
|
|
|
5
5
|
import {ConfirmDialog} from "./ConfirmDialog";
|
|
6
6
|
|
|
7
7
|
interface ConfirmButtonProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
title: string;
|
|
9
|
+
confirmTitle?: string;
|
|
10
|
+
cancel: string;
|
|
11
|
+
onConfirm: () => Promise<any>;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
color?: ButtonProps["color"];
|
|
16
|
+
variant?: ButtonProps["variant"];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function ConfirmButton(props: PropsWithChildren<ConfirmButtonProps>) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
const {
|
|
21
|
+
fullWidth,
|
|
22
|
+
title,
|
|
23
|
+
confirmTitle,
|
|
24
|
+
cancel,
|
|
25
|
+
icon,
|
|
26
|
+
children,
|
|
27
|
+
onConfirm,
|
|
28
|
+
color,
|
|
29
|
+
variant,
|
|
30
|
+
disabled,
|
|
31
|
+
} = props;
|
|
32
|
+
const isMounted = useIsMounted();
|
|
33
|
+
const [dialogOpen, setDialogOpen, clearDialogOpen] = useFlag(false);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
const handleConfirm = useCallback(async () => {
|
|
36
|
+
await onConfirm();
|
|
37
|
+
if (isMounted) {
|
|
38
|
+
clearDialogOpen();
|
|
39
|
+
}
|
|
40
|
+
}, [onConfirm, isMounted]);
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
return (
|
|
43
|
+
<Fragment>
|
|
44
|
+
<Button
|
|
45
|
+
onClick={setDialogOpen}
|
|
46
|
+
color={color}
|
|
47
|
+
variant={variant}
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
startIcon={icon}
|
|
50
|
+
fullWidth={fullWidth}
|
|
51
|
+
>
|
|
52
|
+
{title}
|
|
53
|
+
</Button>
|
|
54
|
+
<ConfirmDialog
|
|
55
|
+
open={dialogOpen}
|
|
56
|
+
onClose={clearDialogOpen}
|
|
57
|
+
title={title}
|
|
58
|
+
confirmTitle={confirmTitle}
|
|
59
|
+
cancel={cancel}
|
|
60
|
+
onConfirm={handleConfirm}
|
|
61
|
+
color={color}
|
|
62
|
+
fullWidth={fullWidth}
|
|
63
|
+
icon={icon}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</ConfirmDialog>
|
|
67
|
+
</Fragment>
|
|
68
|
+
);
|
|
69
69
|
}
|
|
@@ -5,64 +5,64 @@ import {useAsyncCallback} from "react-async-hook";
|
|
|
5
5
|
import {ErrorAlert} from "../ErrorAlert";
|
|
6
6
|
|
|
7
7
|
interface ConfirmDialogProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
open: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
title: string;
|
|
11
|
+
confirmTitle?: string;
|
|
12
|
+
cancel: string;
|
|
13
|
+
onConfirm: () => Promise<any>;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
color?: ButtonProps["color"];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function ConfirmDialog(props: PropsWithChildren<ConfirmDialogProps>) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
const {
|
|
21
|
+
open,
|
|
22
|
+
onClose,
|
|
23
|
+
title,
|
|
24
|
+
confirmTitle = title,
|
|
25
|
+
cancel,
|
|
26
|
+
onConfirm,
|
|
27
|
+
fullWidth = true,
|
|
28
|
+
icon,
|
|
29
|
+
color = "primary",
|
|
30
|
+
children,
|
|
31
|
+
} = props;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const {loading, error, execute} = useAsyncCallback(onConfirm);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
if (e.currentTarget.reportValidity()) {
|
|
38
|
+
await execute();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
42
|
+
return (
|
|
43
|
+
<Dialog fullWidth={fullWidth} open={open} onClose={onClose}>
|
|
44
|
+
<DialogTitle>{title}</DialogTitle>
|
|
45
|
+
<form onSubmit={handleSubmit}>
|
|
46
|
+
<DialogContent>{children}</DialogContent>
|
|
47
|
+
{error && (
|
|
48
|
+
<DialogContent>
|
|
49
|
+
<ErrorAlert error={error} />
|
|
50
|
+
</DialogContent>
|
|
51
|
+
)}
|
|
52
|
+
<DialogActions>
|
|
53
|
+
<Button
|
|
54
|
+
type="submit"
|
|
55
|
+
color={color}
|
|
56
|
+
disabled={loading}
|
|
57
|
+
startIcon={loading ? <CircularProgress color={color} size={16} sx={{mx: 0.25}} /> : icon}
|
|
58
|
+
>
|
|
59
|
+
{confirmTitle}
|
|
60
|
+
</Button>
|
|
61
|
+
<Button onClick={onClose} color="inherit">
|
|
62
|
+
{cancel}
|
|
63
|
+
</Button>
|
|
64
|
+
</DialogActions>
|
|
65
|
+
</form>
|
|
66
|
+
</Dialog>
|
|
67
|
+
);
|
|
68
68
|
}
|
|
@@ -5,62 +5,60 @@ import {useFlag, useIsMounted} from "../utils";
|
|
|
5
5
|
import {ConfirmDialog} from "./ConfirmDialog";
|
|
6
6
|
|
|
7
7
|
interface ConfirmButtonProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
title: string;
|
|
9
|
+
confirmTitle?: string;
|
|
10
|
+
cancel: string;
|
|
11
|
+
onConfirm: () => Promise<any>;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
color?: ButtonProps["color"];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function ConfirmMenuItem(props: PropsWithChildren<ConfirmButtonProps>) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
const {
|
|
20
|
+
fullWidth,
|
|
21
|
+
title,
|
|
22
|
+
confirmTitle,
|
|
23
|
+
cancel,
|
|
24
|
+
icon,
|
|
25
|
+
children,
|
|
26
|
+
onConfirm,
|
|
27
|
+
color,
|
|
28
|
+
disabled,
|
|
29
|
+
} = props;
|
|
30
|
+
const isMounted = useIsMounted();
|
|
31
|
+
const [dialogOpen, setDialogOpen, clearDialogOpen] = useFlag(false);
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
const handleConfirm = useCallback(async () => {
|
|
34
|
+
await onConfirm();
|
|
35
|
+
if (isMounted) {
|
|
36
|
+
clearDialogOpen();
|
|
37
|
+
}
|
|
38
|
+
}, [onConfirm, isMounted]);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</Fragment>
|
|
65
|
-
);
|
|
40
|
+
return (
|
|
41
|
+
<Fragment>
|
|
42
|
+
<MenuItem
|
|
43
|
+
onClick={setDialogOpen}
|
|
44
|
+
disabled={disabled}
|
|
45
|
+
>
|
|
46
|
+
{icon && <ListItemIcon>{icon}</ListItemIcon>}
|
|
47
|
+
<ListItemText primary={title} />
|
|
48
|
+
</MenuItem>
|
|
49
|
+
<ConfirmDialog
|
|
50
|
+
open={dialogOpen}
|
|
51
|
+
onClose={clearDialogOpen}
|
|
52
|
+
title={title}
|
|
53
|
+
confirmTitle={confirmTitle}
|
|
54
|
+
cancel={cancel}
|
|
55
|
+
onConfirm={handleConfirm}
|
|
56
|
+
color={color}
|
|
57
|
+
fullWidth={fullWidth}
|
|
58
|
+
icon={icon}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</ConfirmDialog>
|
|
62
|
+
</Fragment>
|
|
63
|
+
);
|
|
66
64
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, {createElement, PropsWithChildren} from "react";
|
|
2
|
-
import {Breakpoint} from "@mui/system";
|
|
3
1
|
import {Box, Container} from "@mui/material";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import {Breakpoint} from "@mui/system";
|
|
3
|
+
import React, {createElement, PropsWithChildren} from "react";
|
|
6
4
|
import {HelpDrawer} from "../help/HelpDrawer";
|
|
5
|
+
import {useHelpSettingsContext} from "../help/HelpSettingsContext";
|
|
6
|
+
import {containerWidthToBreakPoint, useContainerSettingsContext} from "./ContainerSettingsContext";
|
|
7
7
|
|
|
8
8
|
interface ContainerLayoutProps extends PropsWithChildren<any> {
|
|
9
9
|
fixedWidth?: Breakpoint | false;
|
|
@@ -15,7 +15,7 @@ export function ContainerLayout({children, fixedWidth, margin, helpKey}: Contain
|
|
|
15
15
|
const {baseUrl} = useHelpSettingsContext();
|
|
16
16
|
|
|
17
17
|
let selectedWidth = fixedWidth;
|
|
18
|
-
if(!selectedWidth && width) {
|
|
18
|
+
if (!selectedWidth && width) {
|
|
19
19
|
selectedWidth = containerWidthToBreakPoint(width);
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -28,9 +28,8 @@ export function ContainerLayout({children, fixedWidth, margin, helpKey}: Contain
|
|
|
28
28
|
displayPrint="none"
|
|
29
29
|
>
|
|
30
30
|
{children}
|
|
31
|
-
{baseUrl
|
|
32
|
-
<HelpDrawer />
|
|
33
|
-
}
|
|
31
|
+
{baseUrl
|
|
32
|
+
&& <HelpDrawer />}
|
|
34
33
|
</Box>
|
|
35
34
|
<Box id="containerLayoutBoxPrint" display="none" displayPrint="block" style={{marginTop: "-32px"}}>
|
|
36
35
|
{children}
|
|
@@ -1,77 +1,80 @@
|
|
|
1
|
+
import {Breakpoint} from "@mui/system";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
createContext,
|
|
5
|
+
createElement,
|
|
6
|
+
PropsWithChildren,
|
|
7
|
+
useCallback,
|
|
8
|
+
useContext,
|
|
9
|
+
useEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useState,
|
|
11
12
|
} from "react";
|
|
12
|
-
import {Breakpoint} from "@mui/system";
|
|
13
13
|
|
|
14
|
-
type ContainerWidth = Breakpoint |
|
|
14
|
+
type ContainerWidth = Breakpoint | "max";
|
|
15
15
|
|
|
16
|
-
const availableWidths: ContainerWidth[] = [
|
|
16
|
+
const availableWidths: ContainerWidth[] = ["lg", "xl", "max"];
|
|
17
17
|
|
|
18
18
|
export function nextWidth(currentWidth: ContainerWidth): ContainerWidth {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const currentIndex = availableWidths.indexOf(currentWidth);
|
|
20
|
+
const nextIndex = currentIndex + 1;
|
|
21
|
+
return nextIndex >= availableWidths.length ? availableWidths[0] : availableWidths[nextIndex];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function containerWidthToBreakPoint(width: ContainerWidth): Breakpoint | false {
|
|
25
|
-
|
|
25
|
+
return width === "max" ? false : width;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const WIDTH_KEY = "variocube-container-width";
|
|
29
|
-
const DEFAULT_WIDTH: ContainerWidth =
|
|
29
|
+
const DEFAULT_WIDTH: ContainerWidth = "lg";
|
|
30
30
|
|
|
31
31
|
interface ContainerSettingsContextData {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
width: ContainerWidth;
|
|
33
|
+
setWidth: (width: ContainerWidth) => void;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const emptyContext: ContainerSettingsContextData = {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
width: DEFAULT_WIDTH,
|
|
38
|
+
setWidth: (width: ContainerWidth) =>
|
|
39
|
+
console.error(
|
|
40
|
+
`Empty context should not call setWidth(${width}), you most likely do not have <ContainerSettingsContextProvider/> in your component tree.`,
|
|
41
|
+
),
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
const ContainerSettingsContext = createContext(emptyContext);
|
|
42
45
|
|
|
43
46
|
export function ContainerSettingsContextProvider({children}: PropsWithChildren<any>) {
|
|
44
|
-
|
|
47
|
+
const [width, setWidth] = useState<ContainerWidth | undefined>(undefined);
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const handleSetWidth = useCallback((next: ContainerWidth) => {
|
|
50
|
+
console.log(`Setting container width to ${next}`);
|
|
51
|
+
localStorage.setItem(WIDTH_KEY, next);
|
|
52
|
+
setWidth(next);
|
|
53
|
+
}, []);
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const defaultContext = useMemo<ContainerSettingsContextData>(() => {
|
|
56
|
+
return {
|
|
57
|
+
width: width || DEFAULT_WIDTH,
|
|
58
|
+
setWidth: handleSetWidth,
|
|
59
|
+
};
|
|
60
|
+
}, [width, handleSetWidth]);
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
let configured = localStorage.getItem(WIDTH_KEY);
|
|
64
|
+
if (configured) {
|
|
65
|
+
setWidth(configured as ContainerWidth);
|
|
66
|
+
} else {
|
|
67
|
+
setWidth(DEFAULT_WIDTH);
|
|
68
|
+
}
|
|
69
|
+
}, []);
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
return (
|
|
72
|
+
<ContainerSettingsContext.Provider value={defaultContext}>
|
|
73
|
+
{children}
|
|
74
|
+
</ContainerSettingsContext.Provider>
|
|
75
|
+
);
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
export function useContainerSettingsContext(): ContainerSettingsContextData {
|
|
76
|
-
|
|
79
|
+
return useContext<ContainerSettingsContextData>(ContainerSettingsContext);
|
|
77
80
|
}
|