@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
|
@@ -8,7 +8,7 @@ import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
|
8
8
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
9
9
|
import { SearchField } from "./SearchField";
|
|
10
10
|
import { InputField } from "./InputField";
|
|
11
|
-
import {
|
|
11
|
+
import { useAppContext } from "./app/ReactApp";
|
|
12
12
|
const icon = _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
13
13
|
const checkedIcon = _jsx(CheckBoxIcon, { fontSize: "small" });
|
|
14
14
|
/**
|
|
@@ -17,8 +17,10 @@ const checkedIcon = _jsx(CheckBoxIcon, { fontSize: "small" });
|
|
|
17
17
|
* @returns Component
|
|
18
18
|
*/
|
|
19
19
|
export function ComboBoxMultiple(props) {
|
|
20
|
+
// Global app
|
|
21
|
+
const app = useAppContext();
|
|
20
22
|
// Labels
|
|
21
|
-
const labels =
|
|
23
|
+
const labels = app?.getLabels("noOptions", "loading");
|
|
22
24
|
// Destruct
|
|
23
25
|
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
|
|
24
26
|
// Value input ref
|
package/lib/mjs/ComboBoxPro.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Autocomplete } from "@mui/material";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { globalApp } from "./app/ReactApp";
|
|
5
4
|
import { InputField } from "./InputField";
|
|
6
5
|
import { DataTypes } from "@etsoo/shared";
|
|
6
|
+
import { useAppContext } from "./app/ReactApp";
|
|
7
7
|
export function ComboBoxPro(props) {
|
|
8
|
+
// Global app
|
|
9
|
+
const app = useAppContext();
|
|
8
10
|
// Labels
|
|
9
|
-
const { noOptions, loading: loadingLabel, open: openDefault } =
|
|
11
|
+
const { noOptions, loading: loadingLabel, open: openDefault } = app?.getLabels("noOptions", "loading", "open") ?? {};
|
|
10
12
|
// Destruct
|
|
11
13
|
const { noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, options, openOnFocus = true, label, inputProps, name, value, idValue, onChange, onValueChange, ...rest } = props;
|
|
12
14
|
const [open, setOpen] = React.useState(false);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { DataTable } from "./DataTable";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
5
|
/**
|
|
6
6
|
* Culture DataTable
|
|
7
7
|
* @param props Props
|
|
8
8
|
* @returns Component
|
|
9
9
|
*/
|
|
10
10
|
export function CultureDataTable(props) {
|
|
11
|
+
// Global app
|
|
12
|
+
const app = useAppContext();
|
|
11
13
|
// Destruct
|
|
12
|
-
const { cultures, cultureLabel =
|
|
14
|
+
const { cultures, cultureLabel = app?.get("culture"), editable = true, titleLabel, hasDescription = false, descriptionLabel = app?.get("description"), ...rest } = props;
|
|
13
15
|
const getCultureLabel = React.useCallback((value) => cultures.find((c) => c.id == value.id)?.label ?? `${value.value}`, [cultures]);
|
|
14
16
|
return (_jsx(DataTable, { columns: [
|
|
15
17
|
{
|
package/lib/mjs/DataSteps.js
CHANGED
|
@@ -7,19 +7,16 @@ import CheckIcon from "@mui/icons-material/Check";
|
|
|
7
7
|
import StartIcon from "@mui/icons-material/Start";
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { HBox } from "./FlexBox";
|
|
10
|
-
import { globalApp } from "./app/ReactApp";
|
|
11
10
|
import { MUGlobal } from "./MUGlobal";
|
|
11
|
+
import { useRequiredAppContext } from "./app/ReactApp";
|
|
12
12
|
/**
|
|
13
13
|
* Data collecting steps component
|
|
14
14
|
* @param props Props
|
|
15
15
|
* @returns Component
|
|
16
16
|
*/
|
|
17
17
|
export function DataSteps(props) {
|
|
18
|
-
//
|
|
19
|
-
const app =
|
|
20
|
-
if (app == null) {
|
|
21
|
-
throw new Error("No globalApp");
|
|
22
|
-
}
|
|
18
|
+
// Global app
|
|
19
|
+
const app = useRequiredAppContext();
|
|
23
20
|
// Labels
|
|
24
21
|
const labels = app.getLabels("close", "nextStep", "previousStep", "submit");
|
|
25
22
|
// Destruct
|
package/lib/mjs/DataTable.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { DataGrid } from "@mui/x-data-grid";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
5
|
/**
|
|
6
6
|
* Data table
|
|
7
7
|
* @param props Props
|
|
8
8
|
* @returns Component
|
|
9
9
|
*/
|
|
10
10
|
export function DataTable(props) {
|
|
11
|
+
// Global app
|
|
12
|
+
const app = useAppContext();
|
|
11
13
|
// Destructor
|
|
12
14
|
const { localeText = {}, onCellSelection, onProcessRowUpdateError = (error) => console.log("onProcessRowUpdateError", error), slotProps, ...rest } = props;
|
|
13
15
|
// Labels
|
|
14
|
-
const
|
|
16
|
+
const noRows = app?.get("noRows");
|
|
15
17
|
if (noRows && !localeText.noRowsLabel)
|
|
16
18
|
localeText.noRowsLabel = noRows;
|
|
17
19
|
const [cellModesModel, setCellModesModel] = React.useState({});
|
package/lib/mjs/InputField.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type InputFieldProps = TextFieldProps & {
|
|
|
26
26
|
* @param props Props
|
|
27
27
|
* @returns Component
|
|
28
28
|
*/
|
|
29
|
-
export declare const InputField: React.ForwardRefExoticComponent<(Omit<import("@mui/material").
|
|
29
|
+
export declare const InputField: React.ForwardRefExoticComponent<(Omit<import("@mui/material").StandardTextFieldProps & {
|
|
30
30
|
/**
|
|
31
31
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
32
32
|
*/
|
|
@@ -43,7 +43,7 @@ export declare const InputField: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
43
43
|
* Minimum characters to trigger the change event
|
|
44
44
|
*/
|
|
45
45
|
minChars?: number;
|
|
46
|
-
}, "ref"> | Omit<import("@mui/material").
|
|
46
|
+
}, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & {
|
|
47
47
|
/**
|
|
48
48
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
49
49
|
*/
|
|
@@ -60,7 +60,7 @@ export declare const InputField: React.ForwardRefExoticComponent<(Omit<import("@
|
|
|
60
60
|
* Minimum characters to trigger the change event
|
|
61
61
|
*/
|
|
62
62
|
minChars?: number;
|
|
63
|
-
}, "ref"> | Omit<import("@mui/material").
|
|
63
|
+
}, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
|
|
64
64
|
/**
|
|
65
65
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
66
66
|
*/
|
package/lib/mjs/InputTipField.js
CHANGED
|
@@ -2,27 +2,26 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { InputAdornment, List, ListItem, Popover } from "@mui/material";
|
|
3
3
|
import Typography from "@mui/material/Typography";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { globalApp } from "./app/ReactApp";
|
|
6
5
|
import { InputField } from "./InputField";
|
|
6
|
+
import { useAppContext } from "./app/ReactApp";
|
|
7
7
|
/**
|
|
8
8
|
* InputField with tips
|
|
9
9
|
* @param props Props
|
|
10
10
|
* @returns Component
|
|
11
11
|
*/
|
|
12
12
|
export function InputTipField(props) {
|
|
13
|
+
// Global app
|
|
14
|
+
const app = useAppContext();
|
|
13
15
|
// State
|
|
14
16
|
const [title, setTitle] = React.useState();
|
|
15
17
|
const [anchorEl, setAnchorEl] = React.useState();
|
|
16
18
|
const [data, setData] = React.useState();
|
|
17
19
|
// Destruct
|
|
18
20
|
const { labelProps = {
|
|
19
|
-
title:
|
|
21
|
+
title: app?.get("clickForDetails"),
|
|
20
22
|
sx: { color: (theme) => theme.palette.error.main, cursor: "pointer" }
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
setAnchorEl(event.currentTarget);
|
|
24
|
-
}, ...labelProps, children: title }) })) : undefined
|
|
25
|
-
}, changeDelay = 480, onChangeDelay, loadData, itemLabel = (item) => item.label, renderItem = (item) => _jsx(ListItem, { children: itemLabel(item) }, item.id), ...rest } = props;
|
|
23
|
+
}, changeDelay = 480, onChangeDelay, loadData, itemLabel = (item) => item.label, renderItem = (item) => _jsx(ListItem, { children: itemLabel(item) }, item.id), slotProps = {}, ...rest } = props;
|
|
24
|
+
const { input, ...slotRests } = slotProps;
|
|
26
25
|
const load = (value) => {
|
|
27
26
|
if (value.length < 2) {
|
|
28
27
|
setTitle(undefined);
|
|
@@ -40,5 +39,13 @@ export function InputTipField(props) {
|
|
|
40
39
|
load(event.target.value);
|
|
41
40
|
if (onChangeDelay)
|
|
42
41
|
onChangeDelay(event);
|
|
43
|
-
},
|
|
42
|
+
}, slotProps: {
|
|
43
|
+
input: {
|
|
44
|
+
endAdornment: title ? (_jsx(InputAdornment, { position: "end", children: _jsx(Typography, { onClick: (event) => {
|
|
45
|
+
setAnchorEl(event.currentTarget);
|
|
46
|
+
}, ...labelProps, children: title }) })) : undefined,
|
|
47
|
+
...input
|
|
48
|
+
},
|
|
49
|
+
...slotRests
|
|
50
|
+
}, ...rest })] }));
|
|
44
51
|
}
|
|
@@ -3,15 +3,17 @@ import { Card, CardActions, CardContent, CardHeader, CircularProgress } from "@m
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { GridDataGet } from "@etsoo/react";
|
|
5
5
|
import { LoadingButton } from "./LoadingButton";
|
|
6
|
-
import {
|
|
6
|
+
import { useAppContext } from "./app/ReactApp";
|
|
7
7
|
/**
|
|
8
8
|
* ListMoreDisplay
|
|
9
9
|
* @param props Props
|
|
10
10
|
* @returns Component
|
|
11
11
|
*/
|
|
12
12
|
export function ListMoreDisplay(props) {
|
|
13
|
+
// Global app
|
|
14
|
+
const app = useAppContext();
|
|
13
15
|
// Destruct
|
|
14
|
-
const { batchSize = 6, children, defaultOrderBy, headerRenderer, autoLoad = headerRenderer == null, headerTitle, loadBatchSize, loadData, moreLabel =
|
|
16
|
+
const { batchSize = 6, children, defaultOrderBy, headerRenderer, autoLoad = headerRenderer == null, headerTitle, loadBatchSize, loadData, moreLabel = app?.get("more1"), fieldTemplate, threshold, ...rest } = props;
|
|
15
17
|
// Refs
|
|
16
18
|
const refs = React.useRef({
|
|
17
19
|
queryPaging: {
|
package/lib/mjs/OptionBool.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useAppContext } from "./app/ReactApp";
|
|
3
3
|
import { OptionGroup } from "./OptionGroup";
|
|
4
4
|
/**
|
|
5
5
|
* OptionBool (yes/no)
|
|
@@ -7,8 +7,10 @@ import { OptionGroup } from "./OptionGroup";
|
|
|
7
7
|
* @returns Component
|
|
8
8
|
*/
|
|
9
9
|
export function OptionBool(props) {
|
|
10
|
+
// Global app
|
|
11
|
+
const app = useAppContext();
|
|
10
12
|
// Options
|
|
11
|
-
const options =
|
|
13
|
+
const options = app?.getBools() ?? [];
|
|
12
14
|
// Layout
|
|
13
15
|
return (_jsx(OptionGroup, { options: options, row: true, multiple: false, ...props }));
|
|
14
16
|
}
|
package/lib/mjs/QuickList.js
CHANGED
|
@@ -3,16 +3,18 @@ import { DataTypes } from "@etsoo/shared";
|
|
|
3
3
|
import { LinearProgress, List, ListItem, ListItemButton, Typography } from "@mui/material";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { InputField } from "./InputField";
|
|
6
|
-
import { globalApp } from "./app/ReactApp";
|
|
7
6
|
import { VBox } from "./FlexBox";
|
|
7
|
+
import { useAppContext } from "./app/ReactApp";
|
|
8
8
|
/**
|
|
9
9
|
* Quick list
|
|
10
10
|
* @param props Props
|
|
11
11
|
* @returns Component
|
|
12
12
|
*/
|
|
13
13
|
export function QuickList(props) {
|
|
14
|
+
// Global app
|
|
15
|
+
const app = useAppContext();
|
|
14
16
|
// Destruct
|
|
15
|
-
const { buttonProps = {}, label, inputProps, itemLabel = DataTypes.getListItemLabel, itemRenderer = (item) => itemLabel(item), itemProps, loadData, noMatchesLabel =
|
|
17
|
+
const { buttonProps = {}, label, inputProps, itemLabel = DataTypes.getListItemLabel, itemRenderer = (item) => itemLabel(item), itemProps, loadData, noMatchesLabel = app?.get("noMatches"), gap = 1, height = "480px", onItemClick, ...rest } = props;
|
|
16
18
|
const { onClick, ...buttonRest } = buttonProps;
|
|
17
19
|
// States
|
|
18
20
|
const [loading, setLoading] = React.useState(false);
|
package/lib/mjs/SelectBool.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Utils } from "@etsoo/shared";
|
|
3
|
-
import { globalApp } from "./app/ReactApp";
|
|
4
3
|
import { SelectEx } from "./SelectEx";
|
|
4
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
5
|
/**
|
|
6
6
|
* SelectBool (yes/no)
|
|
7
7
|
* @param props Props
|
|
8
8
|
* @returns Component
|
|
9
9
|
*/
|
|
10
10
|
export function SelectBool(props) {
|
|
11
|
+
// Global app
|
|
12
|
+
const app = useAppContext();
|
|
11
13
|
// Destruct
|
|
12
14
|
const { search = true, autoAddBlankItem = search, ...rest } = props;
|
|
13
15
|
// Options
|
|
14
|
-
const options =
|
|
16
|
+
const options = app?.getBools() ?? [];
|
|
15
17
|
if (autoAddBlankItem)
|
|
16
18
|
Utils.addBlankItem(options);
|
|
17
19
|
// Layout
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { NotificationMessageType } from "@etsoo/notificationbase";
|
|
3
3
|
import { Utils } from "@etsoo/shared";
|
|
4
4
|
import { Table, TableBody, TableCell, TableHead, TableRow } from "@mui/material";
|
|
5
|
-
import {
|
|
5
|
+
import { useRequiredAppContext } from "./app/ReactApp";
|
|
6
6
|
/**
|
|
7
7
|
* Check obj is instance of AuditLineChangesDto
|
|
8
8
|
* @param obj Input
|
|
@@ -31,11 +31,8 @@ const formatValue = (value, app) => {
|
|
|
31
31
|
* @param equalCheck Equal check for properties
|
|
32
32
|
*/
|
|
33
33
|
export const ShowDataComparison = (data, modelTitle, getLabel, equalCheck = true) => {
|
|
34
|
-
//
|
|
35
|
-
const app =
|
|
36
|
-
if (app == null) {
|
|
37
|
-
throw new Error("No globalApp");
|
|
38
|
-
}
|
|
34
|
+
// Global app
|
|
35
|
+
const app = useRequiredAppContext();
|
|
39
36
|
// Labels
|
|
40
37
|
const { dataComparison, field, newValue, oldValue } = app.getLabels("dataComparison", "field", "newValue", "oldValue");
|
|
41
38
|
modelTitle ??= dataComparison;
|
package/lib/mjs/SwitchAnt.js
CHANGED
|
@@ -2,15 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Stack, Typography } from "@mui/material";
|
|
3
3
|
import Switch from "@mui/material/Switch";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { useAppContext } from "./app/ReactApp";
|
|
6
6
|
/**
|
|
7
7
|
* Ant style switch
|
|
8
8
|
* @param props Props
|
|
9
9
|
* @returns Component
|
|
10
10
|
*/
|
|
11
11
|
export function SwitchAnt(props) {
|
|
12
|
+
// Global app
|
|
13
|
+
const app = useAppContext();
|
|
12
14
|
// Labels
|
|
13
|
-
const { yes = "Yes", no = "No" } =
|
|
15
|
+
const { yes = "Yes", no = "No" } = app?.getLabels("yes", "no") ?? {};
|
|
14
16
|
// Destruct
|
|
15
17
|
const { activeColor, checked, defaultChecked, defaultValue, endLabel = yes, startLabel = no, onChange, value = "true", ...rest } = props;
|
|
16
18
|
// Checked state
|
package/lib/mjs/TagList.js
CHANGED
|
@@ -4,10 +4,12 @@ import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
|
4
4
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { InputField } from "./InputField";
|
|
7
|
-
import {
|
|
7
|
+
import { useAppContext } from "./app/ReactApp";
|
|
8
8
|
export function TagList(props) {
|
|
9
|
+
// Global app
|
|
10
|
+
const app = useAppContext();
|
|
9
11
|
// Labels
|
|
10
|
-
const { noOptions, loading: loadingLabel, more = "More", open: openDefault } =
|
|
12
|
+
const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
11
13
|
const moreLabel = more + "...";
|
|
12
14
|
// Destruct
|
|
13
15
|
const { renderOption = (props, option, { selected }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" }), checkedIcon: _jsx(CheckBoxIcon, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), option] })), renderTags = (value, getTagProps) => value.map((option, index) => (_jsx(Chip, { variant: "outlined", label: option, ...getTagProps({ index }) }))), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, onChange, value, ...rest } = props;
|
package/lib/mjs/TagListPro.js
CHANGED
|
@@ -4,11 +4,13 @@ import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
|
|
|
4
4
|
import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { InputField } from "./InputField";
|
|
7
|
-
import { globalApp } from "./app/ReactApp";
|
|
8
7
|
import { DataTypes } from "@etsoo/shared";
|
|
8
|
+
import { useAppContext } from "./app/ReactApp";
|
|
9
9
|
export function TagListPro(props) {
|
|
10
|
+
// Global app
|
|
11
|
+
const app = useAppContext();
|
|
10
12
|
// Labels
|
|
11
|
-
const { noOptions, loading: loadingLabel, more = "More", open: openDefault } =
|
|
13
|
+
const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
12
14
|
const moreLabel = more + "...";
|
|
13
15
|
const getLabel = (item) => DataTypes.getListItemLabel(item);
|
|
14
16
|
// Destruct
|
package/lib/mjs/TextFieldEx.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface TextFieldExMethods {
|
|
|
49
49
|
*/
|
|
50
50
|
setError(error: React.ReactNode): void;
|
|
51
51
|
}
|
|
52
|
-
export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("@mui/material").
|
|
52
|
+
export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("@mui/material").StandardTextFieldProps & {
|
|
53
53
|
/**
|
|
54
54
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
55
55
|
*/
|
|
@@ -84,7 +84,7 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
84
84
|
* Show password button
|
|
85
85
|
*/
|
|
86
86
|
showPassword?: boolean;
|
|
87
|
-
}, "ref"> | Omit<import("@mui/material").
|
|
87
|
+
}, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & {
|
|
88
88
|
/**
|
|
89
89
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
90
90
|
*/
|
|
@@ -119,7 +119,7 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
119
119
|
* Show password button
|
|
120
120
|
*/
|
|
121
121
|
showPassword?: boolean;
|
|
122
|
-
}, "ref"> | Omit<import("@mui/material").
|
|
122
|
+
}, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
|
|
123
123
|
/**
|
|
124
124
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
125
125
|
*/
|
package/lib/mjs/TextFieldEx.js
CHANGED
|
@@ -5,10 +5,12 @@ import { MUGlobal } from "./MUGlobal";
|
|
|
5
5
|
import { Clear, Visibility } from "@mui/icons-material";
|
|
6
6
|
import { Keyboard } from "@etsoo/shared";
|
|
7
7
|
import { ReactUtils, useCombinedRefs, useDelayedExecutor } from "@etsoo/react";
|
|
8
|
-
import {
|
|
8
|
+
import { useAppContext } from "./app/ReactApp";
|
|
9
9
|
export const TextFieldEx = React.forwardRef((props, ref) => {
|
|
10
|
+
// Global app
|
|
11
|
+
const app = useAppContext();
|
|
10
12
|
// Labels
|
|
11
|
-
const { showIt, clearInput } =
|
|
13
|
+
const { showIt, clearInput } = app?.getLabels("showIt", "clearInput") ?? {};
|
|
12
14
|
// Destructure
|
|
13
15
|
const { changeDelay, clearLabel = clearInput, error, fullWidth = true, helperText, InputLabelProps = {}, InputProps = {}, onChange, onClear, onKeyDown, onEnter, onVisibility, inputRef, readOnly, showClear, showPassword, type, variant = MUGlobal.textFieldVariant, ...rest } = props;
|
|
14
16
|
// Shrink
|
package/lib/mjs/Tiplist.js
CHANGED
|
@@ -3,17 +3,19 @@ import { ReactUtils, useDelayedExecutor } from "@etsoo/react";
|
|
|
3
3
|
import { DataTypes } from "@etsoo/shared";
|
|
4
4
|
import { Autocomplete } from "@mui/material";
|
|
5
5
|
import React from "react";
|
|
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
|
* Tiplist
|
|
11
11
|
* @param props Props
|
|
12
12
|
* @returns Component
|
|
13
13
|
*/
|
|
14
14
|
export function Tiplist(props) {
|
|
15
|
+
// Global app
|
|
16
|
+
const app = useAppContext();
|
|
15
17
|
// Labels
|
|
16
|
-
const { noOptions, loading,
|
|
18
|
+
const { noOptions, loading, more1 = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
|
|
17
19
|
// Destruct
|
|
18
20
|
const { search = false, idField = "id", idValue, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
|
|
19
21
|
if (width && sx)
|
|
@@ -197,7 +199,7 @@ export function Tiplist(props) {
|
|
|
197
199
|
if (typeof item !== "object")
|
|
198
200
|
return `${item}`;
|
|
199
201
|
if (item[idField] === "n/a")
|
|
200
|
-
return
|
|
202
|
+
return more1;
|
|
201
203
|
return getOptionLabel
|
|
202
204
|
? getOptionLabel(item)
|
|
203
205
|
: DataTypes.getObjectItemLabel(item);
|
package/lib/mjs/TiplistPro.js
CHANGED
|
@@ -4,15 +4,17 @@ import { DataTypes } from "@etsoo/shared";
|
|
|
4
4
|
import { Autocomplete } from "@mui/material";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { InputField } from "./InputField";
|
|
7
|
-
import {
|
|
7
|
+
import { useAppContext } from "./app/ReactApp";
|
|
8
8
|
/**
|
|
9
9
|
* TiplistPro
|
|
10
10
|
* @param props Props
|
|
11
11
|
* @returns Component
|
|
12
12
|
*/
|
|
13
13
|
export function TiplistPro(props) {
|
|
14
|
+
// Global app
|
|
15
|
+
const app = useAppContext();
|
|
14
16
|
// Labels
|
|
15
|
-
const { noOptions, loading, more, open: openDefault } =
|
|
17
|
+
const { noOptions, loading, more, open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
16
18
|
// Destruct
|
|
17
19
|
const { label, loadData, defaultValue, value, idValue, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, minChars, ...rest } = props;
|
|
18
20
|
if (width && sx)
|
package/lib/mjs/UserAvatar.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar } from "@mui/material";
|
|
3
3
|
import { BusinessUtils } from "@etsoo/appscript";
|
|
4
|
-
import {
|
|
4
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
5
|
/**
|
|
6
6
|
* User avatar
|
|
7
7
|
* @param props Props
|
|
8
8
|
* @returns Component
|
|
9
9
|
*/
|
|
10
10
|
export function UserAvatar(props) {
|
|
11
|
+
// Global app
|
|
12
|
+
const app = useAppContext();
|
|
11
13
|
// Destruct
|
|
12
14
|
const { src, title, formatTitle = (title) => {
|
|
13
|
-
return BusinessUtils.formatAvatarTitle(title, 3,
|
|
15
|
+
return BusinessUtils.formatAvatarTitle(title, 3, app?.get("me") ?? "ME");
|
|
14
16
|
} } = props;
|
|
15
17
|
// Format
|
|
16
18
|
const fTitle = formatTitle(title);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { IAppSettings, IUser } from "@etsoo/appscript";
|
|
2
|
-
import { IPageData } from "@etsoo/react";
|
|
3
2
|
import { ReactApp } from "./ReactApp";
|
|
4
3
|
/**
|
|
5
4
|
* Common independent application
|
|
6
5
|
* 通用独立程序
|
|
7
6
|
*/
|
|
8
|
-
export declare abstract class CommonApp<U extends IUser = IUser,
|
|
7
|
+
export declare abstract class CommonApp<U extends IUser = IUser, S extends IAppSettings = IAppSettings> extends ReactApp<S, U> {
|
|
9
8
|
/**
|
|
10
9
|
* Constructor
|
|
11
10
|
* @param settings Settings
|
|
@@ -1,12 +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
|
-
* Service application context
|
|
8
|
-
*/
|
|
9
|
-
export declare const ServiceAppContext: React.Context<ReactAppData<IServiceApp> | null>;
|
|
10
5
|
/**
|
|
11
6
|
* Service application interface
|
|
12
7
|
*/
|