@etsoo/materialui 1.4.73 → 1.4.75
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/__tests__/ResponsePage.tsx +34 -31
- package/lib/cjs/AddresSelector.js +4 -2
- package/lib/cjs/AuditDisplay.js +11 -11
- package/lib/cjs/BridgeCloseButton.js +3 -1
- package/lib/cjs/ComboBox.js +3 -1
- package/lib/cjs/ComboBoxMultiple.js +3 -1
- package/lib/cjs/ComboBoxPro.js +4 -2
- package/lib/cjs/CultureDataTable.js +3 -1
- package/lib/cjs/DataSteps.js +3 -6
- package/lib/cjs/DataTable.js +3 -1
- package/lib/cjs/InputField.d.ts +3 -3
- package/lib/cjs/InputTipField.js +15 -8
- package/lib/cjs/ListMoreDisplay.js +3 -1
- package/lib/cjs/OptionBool.js +3 -1
- package/lib/cjs/QuickList.js +4 -2
- package/lib/cjs/SelectBool.js +4 -2
- package/lib/cjs/ShowDataComparison.js +2 -5
- package/lib/cjs/SwitchAnt.js +3 -1
- package/lib/cjs/TagList.js +3 -1
- package/lib/cjs/TagListPro.js +4 -2
- package/lib/cjs/TextFieldEx.d.ts +3 -3
- package/lib/cjs/TextFieldEx.js +3 -1
- package/lib/cjs/Tiplist.js +5 -3
- package/lib/cjs/TiplistPro.js +3 -1
- package/lib/cjs/UserAvatar.js +3 -1
- package/lib/cjs/app/CommonApp.d.ts +1 -2
- package/lib/cjs/app/IServiceApp.d.ts +1 -6
- package/lib/cjs/app/IServiceApp.js +0 -9
- package/lib/cjs/app/ReactApp.d.ts +18 -74
- package/lib/cjs/app/ReactApp.js +40 -82
- package/lib/cjs/app/ServiceApp.d.ts +1 -2
- package/lib/cjs/custom/CustomFieldWindow.js +3 -6
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/pages/CommonPage.js +3 -1
- package/lib/cjs/pages/LeftDrawer.js +4 -2
- package/lib/cjs/pages/ViewPage.js +12 -12
- package/lib/mjs/AddresSelector.js +4 -2
- package/lib/mjs/AuditDisplay.js +11 -11
- package/lib/mjs/BridgeCloseButton.js +4 -2
- package/lib/mjs/ComboBox.js +4 -2
- package/lib/mjs/ComboBoxMultiple.js +4 -2
- package/lib/mjs/ComboBoxPro.js +4 -2
- package/lib/mjs/CultureDataTable.js +4 -2
- package/lib/mjs/DataSteps.js +3 -6
- package/lib/mjs/DataTable.js +4 -2
- package/lib/mjs/InputField.d.ts +3 -3
- package/lib/mjs/InputTipField.js +15 -8
- package/lib/mjs/ListMoreDisplay.js +4 -2
- package/lib/mjs/OptionBool.js +4 -2
- package/lib/mjs/QuickList.js +4 -2
- package/lib/mjs/SelectBool.js +4 -2
- package/lib/mjs/ShowDataComparison.js +3 -6
- package/lib/mjs/SwitchAnt.js +4 -2
- package/lib/mjs/TagList.js +4 -2
- package/lib/mjs/TagListPro.js +4 -2
- package/lib/mjs/TextFieldEx.d.ts +3 -3
- package/lib/mjs/TextFieldEx.js +4 -2
- package/lib/mjs/Tiplist.js +5 -3
- package/lib/mjs/TiplistPro.js +4 -2
- package/lib/mjs/UserAvatar.js +4 -2
- package/lib/mjs/app/CommonApp.d.ts +1 -2
- package/lib/mjs/app/IServiceApp.d.ts +1 -6
- package/lib/mjs/app/IServiceApp.js +1 -5
- package/lib/mjs/app/ReactApp.d.ts +18 -74
- package/lib/mjs/app/ReactApp.js +36 -83
- package/lib/mjs/app/ServiceApp.d.ts +1 -2
- package/lib/mjs/custom/CustomFieldWindow.js +3 -6
- package/lib/mjs/index.d.ts +0 -1
- package/lib/mjs/index.js +0 -1
- package/lib/mjs/pages/CommonPage.js +4 -2
- package/lib/mjs/pages/LeftDrawer.js +5 -3
- package/lib/mjs/pages/ViewPage.js +13 -13
- package/package.json +4 -4
- package/src/AddresSelector.tsx +5 -2
- package/src/AuditDisplay.tsx +14 -12
- package/src/BridgeCloseButton.tsx +5 -2
- package/src/ComboBox.tsx +5 -2
- package/src/ComboBoxMultiple.tsx +5 -2
- package/src/ComboBoxPro.tsx +5 -2
- package/src/CultureDataTable.tsx +6 -3
- package/src/DataSteps.tsx +3 -6
- package/src/DataTable.tsx +5 -2
- package/src/InputTipField.tsx +26 -17
- package/src/ListMoreDisplay.tsx +5 -3
- package/src/OptionBool.tsx +5 -3
- package/src/QuickList.tsx +5 -2
- package/src/SelectBool.tsx +5 -3
- package/src/ShowDataComparison.tsx +3 -6
- package/src/SwitchAnt.tsx +5 -2
- package/src/TagList.tsx +5 -2
- package/src/TagListPro.tsx +5 -2
- package/src/TextFieldEx.tsx +5 -3
- package/src/Tiplist.tsx +7 -4
- package/src/TiplistPro.tsx +5 -2
- package/src/UserAvatar.tsx +5 -3
- package/src/app/CommonApp.ts +2 -3
- package/src/app/IServiceApp.ts +1 -8
- package/src/app/ReactApp.ts +52 -151
- package/src/app/ServiceApp.ts +1 -3
- package/src/custom/CustomFieldWindow.tsx +3 -6
- package/src/index.ts +0 -1
- package/src/pages/CommonPage.tsx +5 -4
- package/src/pages/LeftDrawer.tsx +6 -3
- package/src/pages/ViewPage.tsx +17 -12
- package/lib/cjs/app/IServicePage.d.ts +0 -6
- package/lib/cjs/app/IServicePage.js +0 -2
- package/lib/mjs/app/IServicePage.d.ts +0 -6
- package/lib/mjs/app/IServicePage.js +0 -1
- package/src/app/IServicePage.ts +0 -6
|
@@ -2,7 +2,7 @@ import { BridgeUtils, IBridgeHost } from "@etsoo/appscript";
|
|
|
2
2
|
import CloseIcon from "@mui/icons-material/Close";
|
|
3
3
|
import { Box, BoxProps, IconButton, IconButtonProps } from "@mui/material";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { useAppContext } from "./app/ReactApp";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Bridge close button props
|
|
@@ -26,11 +26,14 @@ export interface BridgeCloseButtonProps extends IconButtonProps {
|
|
|
26
26
|
* @returns Component
|
|
27
27
|
*/
|
|
28
28
|
export function BridgeCloseButton(props: BridgeCloseButtonProps) {
|
|
29
|
+
// Global app
|
|
30
|
+
const app = useAppContext();
|
|
31
|
+
|
|
29
32
|
// Destruct
|
|
30
33
|
const {
|
|
31
34
|
boxProps,
|
|
32
35
|
onClick,
|
|
33
|
-
title =
|
|
36
|
+
title = app?.get("close") ?? "Close",
|
|
34
37
|
validate,
|
|
35
38
|
...rest
|
|
36
39
|
} = props;
|
package/src/ComboBox.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import AddIcon from "@mui/icons-material/Add";
|
|
|
18
18
|
import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
|
|
19
19
|
import { SearchField } from "./SearchField";
|
|
20
20
|
import { InputField } from "./InputField";
|
|
21
|
-
import {
|
|
21
|
+
import { useAppContext } from "./app/ReactApp";
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* ComboBox props
|
|
@@ -79,8 +79,11 @@ export function ComboBox<
|
|
|
79
79
|
D extends DataTypes.Keys<T> = IdDefaultType<T>,
|
|
80
80
|
L extends DataTypes.Keys<T, string> = LabelDefaultType<T>
|
|
81
81
|
>(props: ComboBoxProps<T, D, L>) {
|
|
82
|
+
// Global app
|
|
83
|
+
const app = useAppContext();
|
|
84
|
+
|
|
82
85
|
// Labels
|
|
83
|
-
const labels =
|
|
86
|
+
const labels = app?.getLabels("noOptions", "loading", "open", "add");
|
|
84
87
|
|
|
85
88
|
// Destruct
|
|
86
89
|
const {
|
package/src/ComboBoxMultiple.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
|
19
19
|
import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
|
|
20
20
|
import { SearchField } from "./SearchField";
|
|
21
21
|
import { InputField } from "./InputField";
|
|
22
|
-
import {
|
|
22
|
+
import { useAppContext } from "./app/ReactApp";
|
|
23
23
|
|
|
24
24
|
const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
|
|
25
25
|
const checkedIcon = <CheckBoxIcon fontSize="small" />;
|
|
@@ -78,8 +78,11 @@ export function ComboBoxMultiple<
|
|
|
78
78
|
D extends DataTypes.Keys<T> = IdDefaultType<T>,
|
|
79
79
|
L extends DataTypes.Keys<T, string> = LabelDefaultType<T>
|
|
80
80
|
>(props: ComboBoxMultipleProps<T, D, L>) {
|
|
81
|
+
// Global app
|
|
82
|
+
const app = useAppContext();
|
|
83
|
+
|
|
81
84
|
// Labels
|
|
82
|
-
const labels =
|
|
85
|
+
const labels = app?.getLabels("noOptions", "loading");
|
|
83
86
|
|
|
84
87
|
// Destruct
|
|
85
88
|
const {
|
package/src/ComboBoxPro.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Autocomplete, AutocompleteProps } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { globalApp } from "./app/ReactApp";
|
|
4
3
|
import { InputField, InputFieldProps } from "./InputField";
|
|
5
4
|
import { DataTypes, ListType2 } from "@etsoo/shared";
|
|
5
|
+
import { useAppContext } from "./app/ReactApp";
|
|
6
6
|
|
|
7
7
|
export type ComboBoxProProps<D extends ListType2 = ListType2> = Omit<
|
|
8
8
|
AutocompleteProps<D, false, false, true>,
|
|
@@ -43,12 +43,15 @@ export type ComboBoxProProps<D extends ListType2 = ListType2> = Omit<
|
|
|
43
43
|
export function ComboBoxPro<D extends ListType2 = ListType2>(
|
|
44
44
|
props: ComboBoxProProps<D>
|
|
45
45
|
) {
|
|
46
|
+
// Global app
|
|
47
|
+
const app = useAppContext();
|
|
48
|
+
|
|
46
49
|
// Labels
|
|
47
50
|
const {
|
|
48
51
|
noOptions,
|
|
49
52
|
loading: loadingLabel,
|
|
50
53
|
open: openDefault
|
|
51
|
-
} =
|
|
54
|
+
} = app?.getLabels("noOptions", "loading", "open") ?? {};
|
|
52
55
|
|
|
53
56
|
// Destruct
|
|
54
57
|
const {
|
package/src/CultureDataTable.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataTable, DataTableProps } from "./DataTable";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { globalApp } from "./app/ReactApp";
|
|
4
3
|
import { ListType1 } from "@etsoo/shared";
|
|
5
4
|
import { GridRenderCellParams } from "@mui/x-data-grid";
|
|
5
|
+
import { useAppContext } from "./app/ReactApp";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Culture table props
|
|
@@ -22,14 +22,17 @@ export type CultureDataTableProps = Omit<DataTableProps, "columns"> & {
|
|
|
22
22
|
* @returns Component
|
|
23
23
|
*/
|
|
24
24
|
export function CultureDataTable(props: CultureDataTableProps) {
|
|
25
|
+
// Global app
|
|
26
|
+
const app = useAppContext();
|
|
27
|
+
|
|
25
28
|
// Destruct
|
|
26
29
|
const {
|
|
27
30
|
cultures,
|
|
28
|
-
cultureLabel =
|
|
31
|
+
cultureLabel = app?.get("culture"),
|
|
29
32
|
editable = true,
|
|
30
33
|
titleLabel,
|
|
31
34
|
hasDescription = false,
|
|
32
|
-
descriptionLabel =
|
|
35
|
+
descriptionLabel = app?.get("description"),
|
|
33
36
|
...rest
|
|
34
37
|
} = props;
|
|
35
38
|
|
package/src/DataSteps.tsx
CHANGED
|
@@ -13,8 +13,8 @@ import StartIcon from "@mui/icons-material/Start";
|
|
|
13
13
|
import { InputDialogProps } from "@etsoo/react";
|
|
14
14
|
import React from "react";
|
|
15
15
|
import { HBox } from "./FlexBox";
|
|
16
|
-
import { globalApp } from "./app/ReactApp";
|
|
17
16
|
import { MUGlobal } from "./MUGlobal";
|
|
17
|
+
import { useRequiredAppContext } from "./app/ReactApp";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Data step
|
|
@@ -60,11 +60,8 @@ export type DataStepsProps<T extends object> = Omit<
|
|
|
60
60
|
* @returns Component
|
|
61
61
|
*/
|
|
62
62
|
export function DataSteps<T extends object>(props: DataStepsProps<T>) {
|
|
63
|
-
//
|
|
64
|
-
const app =
|
|
65
|
-
if (app == null) {
|
|
66
|
-
throw new Error("No globalApp");
|
|
67
|
-
}
|
|
63
|
+
// Global app
|
|
64
|
+
const app = useRequiredAppContext();
|
|
68
65
|
|
|
69
66
|
// Labels
|
|
70
67
|
const labels = app.getLabels("close", "nextStep", "previousStep", "submit");
|
package/src/DataTable.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "@mui/x-data-grid";
|
|
7
7
|
import { DataGridProps } from "@mui/x-data-grid/models/props/DataGridProps";
|
|
8
8
|
import React from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { useAppContext } from "./app/ReactApp";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Data table selected cell params
|
|
@@ -40,6 +40,9 @@ export type DataTableProps<R extends GridValidRowModel = any> = Omit<
|
|
|
40
40
|
export function DataTable<R extends GridValidRowModel = any>(
|
|
41
41
|
props: DataTableProps<R>
|
|
42
42
|
) {
|
|
43
|
+
// Global app
|
|
44
|
+
const app = useAppContext();
|
|
45
|
+
|
|
43
46
|
// Destructor
|
|
44
47
|
const {
|
|
45
48
|
localeText = {},
|
|
@@ -51,7 +54,7 @@ export function DataTable<R extends GridValidRowModel = any>(
|
|
|
51
54
|
} = props;
|
|
52
55
|
|
|
53
56
|
// Labels
|
|
54
|
-
const
|
|
57
|
+
const noRows = app?.get("noRows");
|
|
55
58
|
if (noRows && !localeText.noRowsLabel) localeText.noRowsLabel = noRows;
|
|
56
59
|
|
|
57
60
|
const [cellModesModel, setCellModesModel] =
|
package/src/InputTipField.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import { DataTypes } from "@etsoo/shared";
|
|
|
2
2
|
import { InputAdornment, List, ListItem, Popover } from "@mui/material";
|
|
3
3
|
import Typography, { TypographyProps } from "@mui/material/Typography";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { globalApp } from "./app/ReactApp";
|
|
6
5
|
import { InputField, InputFieldProps } from "./InputField";
|
|
6
|
+
import { useAppContext } from "./app/ReactApp";
|
|
7
7
|
|
|
8
8
|
type ItemType = DataTypes.IdLabelItem<string | number>;
|
|
9
9
|
|
|
@@ -46,6 +46,9 @@ export type InputTipFieldProps<T extends ItemType = ItemType> =
|
|
|
46
46
|
export function InputTipField<T extends ItemType = ItemType>(
|
|
47
47
|
props: InputTipFieldProps<T>
|
|
48
48
|
) {
|
|
49
|
+
// Global app
|
|
50
|
+
const app = useAppContext();
|
|
51
|
+
|
|
49
52
|
// State
|
|
50
53
|
const [title, setTitle] = React.useState<string>();
|
|
51
54
|
const [anchorEl, setAnchorEl] = React.useState<HTMLElement>();
|
|
@@ -54,31 +57,20 @@ export function InputTipField<T extends ItemType = ItemType>(
|
|
|
54
57
|
// Destruct
|
|
55
58
|
const {
|
|
56
59
|
labelProps = {
|
|
57
|
-
title:
|
|
60
|
+
title: app?.get("clickForDetails"),
|
|
58
61
|
sx: { color: (theme) => theme.palette.error.main, cursor: "pointer" }
|
|
59
62
|
},
|
|
60
|
-
InputProps = {
|
|
61
|
-
endAdornment: title ? (
|
|
62
|
-
<InputAdornment position="end">
|
|
63
|
-
<Typography
|
|
64
|
-
onClick={(event) => {
|
|
65
|
-
setAnchorEl(event.currentTarget);
|
|
66
|
-
}}
|
|
67
|
-
{...labelProps}
|
|
68
|
-
>
|
|
69
|
-
{title}
|
|
70
|
-
</Typography>
|
|
71
|
-
</InputAdornment>
|
|
72
|
-
) : undefined
|
|
73
|
-
},
|
|
74
63
|
changeDelay = 480,
|
|
75
64
|
onChangeDelay,
|
|
76
65
|
loadData,
|
|
77
66
|
itemLabel = (item) => item.label,
|
|
78
67
|
renderItem = (item) => <ListItem key={item.id}>{itemLabel(item)}</ListItem>,
|
|
68
|
+
slotProps = {},
|
|
79
69
|
...rest
|
|
80
70
|
} = props;
|
|
81
71
|
|
|
72
|
+
const { input, ...slotRests } = slotProps;
|
|
73
|
+
|
|
82
74
|
const load = (value: string) => {
|
|
83
75
|
if (value.length < 2) {
|
|
84
76
|
setTitle(undefined);
|
|
@@ -110,7 +102,24 @@ export function InputTipField<T extends ItemType = ItemType>(
|
|
|
110
102
|
load(event.target.value);
|
|
111
103
|
if (onChangeDelay) onChangeDelay(event);
|
|
112
104
|
}}
|
|
113
|
-
|
|
105
|
+
slotProps={{
|
|
106
|
+
input: {
|
|
107
|
+
endAdornment: title ? (
|
|
108
|
+
<InputAdornment position="end">
|
|
109
|
+
<Typography
|
|
110
|
+
onClick={(event) => {
|
|
111
|
+
setAnchorEl(event.currentTarget);
|
|
112
|
+
}}
|
|
113
|
+
{...labelProps}
|
|
114
|
+
>
|
|
115
|
+
{title}
|
|
116
|
+
</Typography>
|
|
117
|
+
</InputAdornment>
|
|
118
|
+
) : undefined,
|
|
119
|
+
...input
|
|
120
|
+
},
|
|
121
|
+
...slotRests
|
|
122
|
+
}}
|
|
114
123
|
{...rest}
|
|
115
124
|
/>
|
|
116
125
|
</React.Fragment>
|
package/src/ListMoreDisplay.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataTypes } from "@etsoo/shared";
|
|
2
1
|
import {
|
|
3
2
|
Card,
|
|
4
3
|
CardActions,
|
|
@@ -16,7 +15,7 @@ import {
|
|
|
16
15
|
GridLoaderStates
|
|
17
16
|
} from "@etsoo/react";
|
|
18
17
|
import { LoadingButton } from "./LoadingButton";
|
|
19
|
-
import {
|
|
18
|
+
import { useAppContext } from "./app/ReactApp";
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* ListMoreDisplay props
|
|
@@ -68,6 +67,9 @@ type states<T> = {
|
|
|
68
67
|
export function ListMoreDisplay<T extends object>(
|
|
69
68
|
props: ListMoreDisplayProps<T>
|
|
70
69
|
) {
|
|
70
|
+
// Global app
|
|
71
|
+
const app = useAppContext();
|
|
72
|
+
|
|
71
73
|
// Destruct
|
|
72
74
|
const {
|
|
73
75
|
batchSize = 6,
|
|
@@ -78,7 +80,7 @@ export function ListMoreDisplay<T extends object>(
|
|
|
78
80
|
headerTitle,
|
|
79
81
|
loadBatchSize,
|
|
80
82
|
loadData,
|
|
81
|
-
moreLabel =
|
|
83
|
+
moreLabel = app?.get("more1"),
|
|
82
84
|
fieldTemplate,
|
|
83
85
|
threshold,
|
|
84
86
|
...rest
|
package/src/OptionBool.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ListType1 } from "@etsoo/shared";
|
|
2
|
-
import
|
|
3
|
-
import { globalApp } from "./app/ReactApp";
|
|
2
|
+
import { useAppContext } from "./app/ReactApp";
|
|
4
3
|
import { OptionGroup, OptionGroupProps } from "./OptionGroup";
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -17,8 +16,11 @@ export type OptionBoolProps = Omit<
|
|
|
17
16
|
* @returns Component
|
|
18
17
|
*/
|
|
19
18
|
export function OptionBool(props: OptionBoolProps) {
|
|
19
|
+
// Global app
|
|
20
|
+
const app = useAppContext();
|
|
21
|
+
|
|
20
22
|
// Options
|
|
21
|
-
const options =
|
|
23
|
+
const options = app?.getBools() ?? [];
|
|
22
24
|
|
|
23
25
|
// Layout
|
|
24
26
|
return (
|
package/src/QuickList.tsx
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
} from "@mui/material";
|
|
12
12
|
import React from "react";
|
|
13
13
|
import { InputField, InputFieldProps } from "./InputField";
|
|
14
|
-
import { globalApp } from "./app/ReactApp";
|
|
15
14
|
import { VBox } from "./FlexBox";
|
|
15
|
+
import { useAppContext } from "./app/ReactApp";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Quick list props
|
|
@@ -77,6 +77,9 @@ export type QuickListProps<T extends ListType2 = ListType2> = StackProps & {
|
|
|
77
77
|
export function QuickList<T extends ListType2 = ListType2>(
|
|
78
78
|
props: QuickListProps<T>
|
|
79
79
|
) {
|
|
80
|
+
// Global app
|
|
81
|
+
const app = useAppContext();
|
|
82
|
+
|
|
80
83
|
// Destruct
|
|
81
84
|
const {
|
|
82
85
|
buttonProps = {},
|
|
@@ -86,7 +89,7 @@ export function QuickList<T extends ListType2 = ListType2>(
|
|
|
86
89
|
itemRenderer = (item: T) => itemLabel(item),
|
|
87
90
|
itemProps,
|
|
88
91
|
loadData,
|
|
89
|
-
noMatchesLabel =
|
|
92
|
+
noMatchesLabel = app?.get("noMatches"),
|
|
90
93
|
gap = 1,
|
|
91
94
|
height = "480px",
|
|
92
95
|
onItemClick,
|
package/src/SelectBool.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ListType1, Utils } from "@etsoo/shared";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { globalApp } from "./app/ReactApp";
|
|
4
2
|
import { SelectEx, SelectExProps } from "./SelectEx";
|
|
3
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* SelectBool props
|
|
@@ -17,11 +16,14 @@ export type SelectBoolProps = Omit<
|
|
|
17
16
|
* @returns Component
|
|
18
17
|
*/
|
|
19
18
|
export function SelectBool(props: SelectBoolProps) {
|
|
19
|
+
// Global app
|
|
20
|
+
const app = useAppContext();
|
|
21
|
+
|
|
20
22
|
// Destruct
|
|
21
23
|
const { search = true, autoAddBlankItem = search, ...rest } = props;
|
|
22
24
|
|
|
23
25
|
// Options
|
|
24
|
-
const options =
|
|
26
|
+
const options = app?.getBools() ?? [];
|
|
25
27
|
|
|
26
28
|
if (autoAddBlankItem) Utils.addBlankItem(options);
|
|
27
29
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TableHead,
|
|
9
9
|
TableRow
|
|
10
10
|
} from "@mui/material";
|
|
11
|
-
import {
|
|
11
|
+
import { useRequiredAppContext } from "./app/ReactApp";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Check obj is instance of AuditLineChangesDto
|
|
@@ -45,11 +45,8 @@ export const ShowDataComparison = (
|
|
|
45
45
|
getLabel?: (field: string) => string,
|
|
46
46
|
equalCheck: boolean = true
|
|
47
47
|
) => {
|
|
48
|
-
//
|
|
49
|
-
const app =
|
|
50
|
-
if (app == null) {
|
|
51
|
-
throw new Error("No globalApp");
|
|
52
|
-
}
|
|
48
|
+
// Global app
|
|
49
|
+
const app = useRequiredAppContext();
|
|
53
50
|
|
|
54
51
|
// Labels
|
|
55
52
|
const { dataComparison, field, newValue, oldValue } = app.getLabels(
|
package/src/SwitchAnt.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Stack, Typography } from "@mui/material";
|
|
2
2
|
import Switch, { SwitchProps } from "@mui/material/Switch";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Ant style switch props
|
|
@@ -29,8 +29,11 @@ export interface SwitchAntProps extends SwitchProps {
|
|
|
29
29
|
* @returns Component
|
|
30
30
|
*/
|
|
31
31
|
export function SwitchAnt(props: SwitchAntProps) {
|
|
32
|
+
// Global app
|
|
33
|
+
const app = useAppContext();
|
|
34
|
+
|
|
32
35
|
// Labels
|
|
33
|
-
const { yes = "Yes", no = "No" } =
|
|
36
|
+
const { yes = "Yes", no = "No" } = app?.getLabels("yes", "no") ?? {};
|
|
34
37
|
|
|
35
38
|
// Destruct
|
|
36
39
|
const {
|
package/src/TagList.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
|
3
3
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { InputField, InputFieldProps } from "./InputField";
|
|
6
|
-
import {
|
|
6
|
+
import { useAppContext } from "./app/ReactApp";
|
|
7
7
|
|
|
8
8
|
export type TagListProps = Omit<
|
|
9
9
|
AutocompleteProps<string, true, false, true>,
|
|
@@ -34,13 +34,16 @@ export type TagListProps = Omit<
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export function TagList(props: TagListProps) {
|
|
37
|
+
// Global app
|
|
38
|
+
const app = useAppContext();
|
|
39
|
+
|
|
37
40
|
// Labels
|
|
38
41
|
const {
|
|
39
42
|
noOptions,
|
|
40
43
|
loading: loadingLabel,
|
|
41
44
|
more = "More",
|
|
42
45
|
open: openDefault
|
|
43
|
-
} =
|
|
46
|
+
} = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
44
47
|
|
|
45
48
|
const moreLabel = more + "...";
|
|
46
49
|
|
package/src/TagListPro.tsx
CHANGED
|
@@ -3,8 +3,8 @@ import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
|
3
3
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { InputField, InputFieldProps } from "./InputField";
|
|
6
|
-
import { globalApp } from "./app/ReactApp";
|
|
7
6
|
import { DataTypes, ListType2 } from "@etsoo/shared";
|
|
7
|
+
import { useAppContext } from "./app/ReactApp";
|
|
8
8
|
|
|
9
9
|
export type TagListProProps<D extends ListType2 = ListType2> = Omit<
|
|
10
10
|
AutocompleteProps<D, true, false, false>,
|
|
@@ -37,13 +37,16 @@ export type TagListProProps<D extends ListType2 = ListType2> = Omit<
|
|
|
37
37
|
export function TagListPro<D extends ListType2 = ListType2>(
|
|
38
38
|
props: TagListProProps<D>
|
|
39
39
|
) {
|
|
40
|
+
// Global app
|
|
41
|
+
const app = useAppContext();
|
|
42
|
+
|
|
40
43
|
// Labels
|
|
41
44
|
const {
|
|
42
45
|
noOptions,
|
|
43
46
|
loading: loadingLabel,
|
|
44
47
|
more = "More",
|
|
45
48
|
open: openDefault
|
|
46
|
-
} =
|
|
49
|
+
} = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
47
50
|
|
|
48
51
|
const moreLabel = more + "...";
|
|
49
52
|
|
package/src/TextFieldEx.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import { MUGlobal } from "./MUGlobal";
|
|
|
9
9
|
import { Clear, Visibility } from "@mui/icons-material";
|
|
10
10
|
import { Keyboard } from "@etsoo/shared";
|
|
11
11
|
import { ReactUtils, useCombinedRefs, useDelayedExecutor } from "@etsoo/react";
|
|
12
|
-
import {
|
|
12
|
+
import { useAppContext } from "./app/ReactApp";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Extended text field props
|
|
@@ -73,9 +73,11 @@ export const TextFieldEx = React.forwardRef<
|
|
|
73
73
|
TextFieldExMethods,
|
|
74
74
|
TextFieldExProps
|
|
75
75
|
>((props, ref) => {
|
|
76
|
+
// Global app
|
|
77
|
+
const app = useAppContext();
|
|
78
|
+
|
|
76
79
|
// Labels
|
|
77
|
-
const { showIt, clearInput } =
|
|
78
|
-
globalApp?.getLabels("showIt", "clearInput") ?? {};
|
|
80
|
+
const { showIt, clearInput } = app?.getLabels("showIt", "clearInput") ?? {};
|
|
79
81
|
|
|
80
82
|
// Destructure
|
|
81
83
|
const {
|
package/src/Tiplist.tsx
CHANGED
|
@@ -3,9 +3,9 @@ import { DataTypes, IdDefaultType, ListType2 } from "@etsoo/shared";
|
|
|
3
3
|
import { Autocomplete, AutocompleteRenderInputParams } from "@mui/material";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import type { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
|
|
6
|
-
import { globalApp } from "./app/ReactApp";
|
|
7
6
|
import { SearchField } from "./SearchField";
|
|
8
7
|
import { InputField } from "./InputField";
|
|
8
|
+
import { useAppContext } from "./app/ReactApp";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Tiplist props
|
|
@@ -56,13 +56,16 @@ export function Tiplist<
|
|
|
56
56
|
T extends object = ListType2,
|
|
57
57
|
D extends DataTypes.Keys<T> = IdDefaultType<T>
|
|
58
58
|
>(props: TiplistProps<T, D>) {
|
|
59
|
+
// Global app
|
|
60
|
+
const app = useAppContext();
|
|
61
|
+
|
|
59
62
|
// Labels
|
|
60
63
|
const {
|
|
61
64
|
noOptions,
|
|
62
65
|
loading,
|
|
63
|
-
|
|
66
|
+
more1 = "More",
|
|
64
67
|
open: openDefault
|
|
65
|
-
} =
|
|
68
|
+
} = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
|
|
66
69
|
|
|
67
70
|
// Destruct
|
|
68
71
|
const {
|
|
@@ -378,7 +381,7 @@ export function Tiplist<
|
|
|
378
381
|
}}
|
|
379
382
|
getOptionLabel={(item) => {
|
|
380
383
|
if (typeof item !== "object") return `${item}`;
|
|
381
|
-
if (item[idField] === "n/a") return
|
|
384
|
+
if (item[idField] === "n/a") return more1;
|
|
382
385
|
return getOptionLabel
|
|
383
386
|
? getOptionLabel(item)
|
|
384
387
|
: DataTypes.getObjectItemLabel(item);
|
package/src/TiplistPro.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { DataTypes, ListType2 } from "@etsoo/shared";
|
|
|
3
3
|
import { Autocomplete, AutocompleteProps } from "@mui/material";
|
|
4
4
|
import React, { ChangeEventHandler } from "react";
|
|
5
5
|
import { InputField, InputFieldProps } from "./InputField";
|
|
6
|
-
import {
|
|
6
|
+
import { useAppContext } from "./app/ReactApp";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* TiplistPro props
|
|
@@ -89,13 +89,16 @@ interface States<T extends object> {
|
|
|
89
89
|
export function TiplistPro<T extends ListType2 = ListType2>(
|
|
90
90
|
props: TiplistProProps<T>
|
|
91
91
|
) {
|
|
92
|
+
// Global app
|
|
93
|
+
const app = useAppContext();
|
|
94
|
+
|
|
92
95
|
// Labels
|
|
93
96
|
const {
|
|
94
97
|
noOptions,
|
|
95
98
|
loading,
|
|
96
99
|
more,
|
|
97
100
|
open: openDefault
|
|
98
|
-
} =
|
|
101
|
+
} = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
99
102
|
|
|
100
103
|
// Destruct
|
|
101
104
|
const {
|
package/src/UserAvatar.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Avatar } from "@mui/material";
|
|
3
2
|
import { BusinessUtils } from "@etsoo/appscript";
|
|
4
|
-
import {
|
|
3
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* User avatar props
|
|
@@ -29,6 +28,9 @@ export interface UserAvatarProps {
|
|
|
29
28
|
* @returns Component
|
|
30
29
|
*/
|
|
31
30
|
export function UserAvatar(props: UserAvatarProps) {
|
|
31
|
+
// Global app
|
|
32
|
+
const app = useAppContext();
|
|
33
|
+
|
|
32
34
|
// Destruct
|
|
33
35
|
const {
|
|
34
36
|
src,
|
|
@@ -37,7 +39,7 @@ export function UserAvatar(props: UserAvatarProps) {
|
|
|
37
39
|
return BusinessUtils.formatAvatarTitle(
|
|
38
40
|
title,
|
|
39
41
|
3,
|
|
40
|
-
|
|
42
|
+
app?.get<string>("me") ?? "ME"
|
|
41
43
|
);
|
|
42
44
|
}
|
|
43
45
|
} = props;
|
package/src/app/CommonApp.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAppSettings, IUser } from "@etsoo/appscript";
|
|
2
|
-
import { CoreConstants
|
|
2
|
+
import { CoreConstants } from "@etsoo/react";
|
|
3
3
|
import { ReactApp } from "./ReactApp";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -8,9 +8,8 @@ import { ReactApp } from "./ReactApp";
|
|
|
8
8
|
*/
|
|
9
9
|
export abstract class CommonApp<
|
|
10
10
|
U extends IUser = IUser,
|
|
11
|
-
P extends IPageData = IPageData,
|
|
12
11
|
S extends IAppSettings = IAppSettings
|
|
13
|
-
> extends ReactApp<S, U
|
|
12
|
+
> extends ReactApp<S, U> {
|
|
14
13
|
/**
|
|
15
14
|
* Constructor
|
|
16
15
|
* @param settings Settings
|
package/src/app/IServiceApp.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { ApiRefreshTokenDto, IApi, IApiPayload } from "@etsoo/appscript";
|
|
2
|
-
import {
|
|
2
|
+
import { ReactAppType } from "./ReactApp";
|
|
3
3
|
import { IServiceUser, ServiceUserToken } from "./IServiceUser";
|
|
4
4
|
import { IActionResult } from "@etsoo/shared";
|
|
5
|
-
import React from "react";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Service application context
|
|
9
|
-
*/
|
|
10
|
-
export const ServiceAppContext =
|
|
11
|
-
React.createContext<ReactAppData<IServiceApp> | null>(null);
|
|
12
5
|
|
|
13
6
|
/**
|
|
14
7
|
* Service application interface
|