@etsoo/materialui 1.1.38 → 1.1.41

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.
@@ -1,11 +1,11 @@
1
- import { AuditLineDto } from '@etsoo/appscript';
2
- import { Theme } from '@mui/material';
3
- import React, { CSSProperties } from 'react';
4
- import { ListMoreDisplayProps } from './ListMoreDisplay';
1
+ import { AuditLineDto } from "@etsoo/appscript";
2
+ import { Theme } from "@mui/material";
3
+ import React, { CSSProperties } from "react";
4
+ import { ListMoreDisplayProps } from "./ListMoreDisplay";
5
5
  /**
6
6
  * Audit display props
7
7
  */
8
- export interface AuditDisplayProps extends Omit<ListMoreDisplayProps<AuditLineDto>, 'children'> {
8
+ export interface AuditDisplayProps extends Omit<ListMoreDisplayProps<AuditLineDto>, "children"> {
9
9
  /**
10
10
  * Get list item style callback
11
11
  */
@@ -1,19 +1,19 @@
1
- import { Utils } from '@etsoo/shared';
2
- import { Button, Divider, Typography, useTheme } from '@mui/material';
3
- import React from 'react';
4
- import { globalApp } from './app/ReactApp';
5
- import { ListMoreDisplay } from './ListMoreDisplay';
6
- import { ShowDataComparison } from './ShowDataComparison';
1
+ import { Utils } from "@etsoo/shared";
2
+ import { Button, Divider, Typography, useTheme } from "@mui/material";
3
+ import React from "react";
4
+ import { globalApp } from "./app/ReactApp";
5
+ import { ListMoreDisplay } from "./ListMoreDisplay";
6
+ import { ShowDataComparison } from "./ShowDataComparison";
7
7
  // Get label
8
8
  const getLabel = (key) => {
9
9
  var _a;
10
- return (_a = globalApp.get(Utils.formatInitial(key))) !== null && _a !== void 0 ? _a : key;
10
+ return (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get(Utils.formatInitial(key))) !== null && _a !== void 0 ? _a : key;
11
11
  };
12
12
  // Format date
13
13
  const formatDate = (date) => {
14
- if (typeof globalApp === 'undefined')
15
- return date.toUTCString();
16
- return globalApp.formatDate(date, 'ds');
14
+ if (globalApp)
15
+ return globalApp.formatDate(date, "ds");
16
+ return date.toUTCString();
17
17
  };
18
18
  /**
19
19
  * Audit display
@@ -24,28 +24,26 @@ export function AuditDisplay(props) {
24
24
  // Theme
25
25
  const theme = useTheme();
26
26
  // Title
27
- var title = getLabel('dataComparison');
27
+ var title = getLabel("dataComparison");
28
28
  // Destruct
29
29
  const { getItemStyle = (index, theme) => ({
30
- padding: [theme.spacing(1.5), theme.spacing(1)].join(' '),
31
- background: index % 2 === 0
32
- ? theme.palette.grey[100]
33
- : theme.palette.grey[50]
30
+ padding: [theme.spacing(1.5), theme.spacing(1)].join(" "),
31
+ background: index % 2 === 0 ? theme.palette.grey[100] : theme.palette.grey[50]
34
32
  }), getColumnLabel, equalCheck, itemRenderer = (data) => {
35
33
  const { newData, oldData, changes = { newData: newData !== null && newData !== void 0 ? newData : {}, oldData: oldData !== null && oldData !== void 0 ? oldData : {} } } = data;
36
34
  return (React.createElement(React.Fragment, null,
37
35
  changes != null && (React.createElement(Button, { variant: "outlined", size: "small", onClick: () => ShowDataComparison(changes, title, getColumnLabel, equalCheck), sx: {
38
36
  marginLeft: theme.spacing(1),
39
37
  marginTop: theme.spacing(-0.5),
40
- float: 'right'
38
+ float: "right"
41
39
  } }, title)),
42
40
  React.createElement(Typography, null, formatDate(data.creation) +
43
- ', [' +
41
+ ", [" +
44
42
  getLabel(data.action) +
45
- '], ' +
43
+ "], " +
46
44
  data.user)));
47
45
  }, headerTitle = (React.createElement(React.Fragment, null,
48
- React.createElement(Typography, null, getLabel('audits')),
46
+ React.createElement(Typography, null, getLabel("audits")),
49
47
  React.createElement(Divider, null))), ...rest } = props;
50
48
  // Layout
51
49
  return (React.createElement(ListMoreDisplay, { headerTitle: headerTitle, ...rest }, (data, index) => (React.createElement("div", { key: data.id, style: getItemStyle(index, theme) }, itemRenderer(data, index)))));
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { IBridgeHost } from '@etsoo/appscript';
3
- import { BoxProps, IconButtonProps } from '@mui/material';
2
+ import { IBridgeHost } from "@etsoo/appscript";
3
+ import { BoxProps, IconButtonProps } from "@mui/material";
4
4
  /**
5
5
  * Bridge close button props
6
6
  */
@@ -1,18 +1,17 @@
1
- import { BridgeUtils } from '@etsoo/appscript';
2
- import CloseIcon from '@mui/icons-material/Close';
3
- import { Box, IconButton } from '@mui/material';
4
- import React from 'react';
5
- import { globalApp } from './app/ReactApp';
1
+ import { BridgeUtils } from "@etsoo/appscript";
2
+ import CloseIcon from "@mui/icons-material/Close";
3
+ import { Box, IconButton } from "@mui/material";
4
+ import React from "react";
5
+ import { globalApp } from "./app/ReactApp";
6
6
  /**
7
7
  * Bridge close button
8
8
  * @param props Props
9
9
  * @returns Component
10
10
  */
11
11
  export function BridgeCloseButton(props) {
12
+ var _a;
12
13
  // Destruct
13
- const { boxProps, onClick, title = typeof globalApp === 'undefined'
14
- ? 'Close'
15
- : globalApp.get('close'), validate, ...rest } = props;
14
+ const { boxProps, onClick, title = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("close")) !== null && _a !== void 0 ? _a : "Close", validate, ...rest } = props;
16
15
  // Host
17
16
  const host = BridgeUtils.host;
18
17
  if (host == null ||
package/lib/ComboBox.d.ts CHANGED
@@ -4,7 +4,7 @@ import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
4
4
  /**
5
5
  * ComboBox props
6
6
  */
7
- export type ComboBoxProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> = AutocompleteExtendedProps<T, D> & {
7
+ export type ComboBoxProps<T extends object = ListType, D extends DataTypes.Keys<T> = IdDefaultType<T>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>> = AutocompleteExtendedProps<T, D> & {
8
8
  /**
9
9
  * Auto add blank item
10
10
  */
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { TextFieldProps } from '@mui/material';
3
- import { InputDialogProps } from '@etsoo/react';
2
+ import { TextFieldProps } from "@mui/material";
3
+ import { InputDialogProps } from "@etsoo/react";
4
4
  /**
5
5
  * Data step
6
6
  */
7
- export type DataStep = Omit<InputDialogProps, 'callback'> & {
7
+ export type DataStep = Omit<InputDialogProps, "callback"> & {
8
8
  /**
9
9
  * Callback
10
10
  */
@@ -13,7 +13,7 @@ export type DataStep = Omit<InputDialogProps, 'callback'> & {
13
13
  /**
14
14
  * Data collecting steps component props
15
15
  */
16
- export type DataStepsProps<T extends object> = Omit<TextFieldProps, 'InputProps' | 'onClick'> & {
16
+ export type DataStepsProps<T extends object> = Omit<TextFieldProps, "InputProps" | "onClick"> & {
17
17
  /**
18
18
  * JSON value
19
19
  */
package/lib/DataSteps.js CHANGED
@@ -1,13 +1,13 @@
1
- import { Button, IconButton, InputAdornment, TextField } from '@mui/material';
2
- import CloseIcon from '@mui/icons-material/Close';
3
- import NavigateNextIcon from '@mui/icons-material/NavigateNext';
4
- import NavigateBeforeIcon from '@mui/icons-material/NavigateBefore';
5
- import CheckIcon from '@mui/icons-material/Check';
6
- import StartIcon from '@mui/icons-material/Start';
7
- import React from 'react';
8
- import { HBox } from './FlexBox';
9
- import { globalApp } from './app/ReactApp';
10
- import { MUGlobal } from './MUGlobal';
1
+ import { Button, IconButton, InputAdornment, TextField } from "@mui/material";
2
+ import CloseIcon from "@mui/icons-material/Close";
3
+ import NavigateNextIcon from "@mui/icons-material/NavigateNext";
4
+ import NavigateBeforeIcon from "@mui/icons-material/NavigateBefore";
5
+ import CheckIcon from "@mui/icons-material/Check";
6
+ import StartIcon from "@mui/icons-material/Start";
7
+ import React from "react";
8
+ import { HBox } from "./FlexBox";
9
+ import { globalApp } from "./app/ReactApp";
10
+ import { MUGlobal } from "./MUGlobal";
11
11
  /**
12
12
  * Data collecting steps component
13
13
  * @param props Props
@@ -17,10 +17,13 @@ export function DataSteps(props) {
17
17
  var _a;
18
18
  // App
19
19
  const app = globalApp;
20
+ if (app == null) {
21
+ throw new Error("No globalApp");
22
+ }
20
23
  // Labels
21
- const labels = app.getLabels('close', 'nextStep', 'previousStep', 'submit');
24
+ const labels = app.getLabels("close", "nextStep", "previousStep", "submit");
22
25
  // Destruct
23
- const { InputLabelProps = {}, jsonValue, valueFormatter = (_data) => '...', onValueChange, steps, value = '', ...rest } = props;
26
+ const { InputLabelProps = {}, jsonValue, valueFormatter = (_data) => "...", onValueChange, steps, value = "", ...rest } = props;
24
27
  // Shrink
25
28
  (_a = InputLabelProps.shrink) !== null && _a !== void 0 ? _a : (InputLabelProps.shrink = MUGlobal.searchFieldShrink);
26
29
  // Current index
@@ -74,9 +77,9 @@ export function DataSteps(props) {
74
77
  React.useEffect(() => {
75
78
  setLocalValue(valueFormatter(jsonRef.current));
76
79
  }, [valueFormatter]);
77
- return (React.createElement(TextField, { autoComplete: "new-password", InputLabelProps: InputLabelProps, inputProps: { style: { cursor: 'pointer' } }, InputProps: {
80
+ return (React.createElement(TextField, { autoComplete: "new-password", InputLabelProps: InputLabelProps, inputProps: { style: { cursor: "pointer" } }, InputProps: {
78
81
  onKeyDown: (event) => {
79
- if (event.key === 'Tab')
82
+ if (event.key === "Tab")
80
83
  return;
81
84
  cancelInput(event);
82
85
  },
@@ -1,11 +1,11 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { CardProps } from '@mui/material';
3
- import React from 'react';
4
- import { GridData, GridLoader } from '@etsoo/react';
1
+ import { DataTypes } from "@etsoo/shared";
2
+ import { CardProps } from "@mui/material";
3
+ import React from "react";
4
+ import { GridData, GridLoader } from "@etsoo/react";
5
5
  /**
6
6
  * ListMoreDisplay props
7
7
  */
8
- export interface ListMoreDisplayProps<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate> extends Omit<CardProps, 'children'>, GridLoader<T> {
8
+ export interface ListMoreDisplayProps<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate> extends Omit<CardProps, "children">, GridLoader<T> {
9
9
  /**
10
10
  * Batch size to load
11
11
  */
@@ -1,8 +1,8 @@
1
- import { Card, CardActions, CardContent, CardHeader, CircularProgress } from '@mui/material';
2
- import React from 'react';
3
- import { GridDataGet } from '@etsoo/react';
4
- import { LoadingButton } from './LoadingButton';
5
- import { globalApp } from './app/ReactApp';
1
+ import { Card, CardActions, CardContent, CardHeader, CircularProgress } from "@mui/material";
2
+ import React from "react";
3
+ import { GridDataGet } from "@etsoo/react";
4
+ import { LoadingButton } from "./LoadingButton";
5
+ import { globalApp } from "./app/ReactApp";
6
6
  /**
7
7
  * ListMoreDisplay
8
8
  * @param props Props
@@ -10,9 +10,7 @@ import { globalApp } from './app/ReactApp';
10
10
  */
11
11
  export function ListMoreDisplay(props) {
12
12
  // Destruct
13
- const { batchSize = 6, children, defaultOrderBy, headerRenderer, autoLoad = headerRenderer == null, headerTitle, loadBatchSize, loadData, moreLabel = typeof globalApp === 'undefined'
14
- ? undefined
15
- : globalApp.get('more') + '...', fieldTemplate, threshold, ...rest } = props;
13
+ const { batchSize = 6, children, defaultOrderBy, headerRenderer, autoLoad = headerRenderer == null, headerTitle, loadBatchSize, loadData, moreLabel = globalApp ? globalApp.get("more") + "..." : undefined, fieldTemplate, threshold, ...rest } = props;
16
14
  // Refs
17
15
  const refs = React.useRef({
18
16
  autoLoad,
@@ -95,8 +93,8 @@ export function ListMoreDisplay(props) {
95
93
  React.createElement(CardHeader, { title: headerTitle }),
96
94
  React.createElement(CardContent, { sx: {
97
95
  paddingTop: 0,
98
- paddingBottom: states.completed ? 0 : 'inherit'
96
+ paddingBottom: states.completed ? 0 : "inherit"
99
97
  } }, states.items == null ? (React.createElement(CircularProgress, { size: 20 })) : (states.items.map((item, index) => children(item, index)))),
100
- !states.completed && (React.createElement(CardActions, { sx: { justifyContent: 'flex-end' } },
98
+ !states.completed && (React.createElement(CardActions, { sx: { justifyContent: "flex-end" } },
101
99
  React.createElement(LoadingButton, { onClick: async () => await loadDataLocal() }, moreLabel))))));
102
100
  }
package/lib/OptionBool.js CHANGED
@@ -7,8 +7,9 @@ import { OptionGroup } from "./OptionGroup";
7
7
  * @returns Component
8
8
  */
9
9
  export function OptionBool(props) {
10
+ var _a;
10
11
  // Options
11
- const options = globalApp.getBools();
12
+ const options = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getBools()) !== null && _a !== void 0 ? _a : [];
12
13
  // Layout
13
14
  return (React.createElement(OptionGroup, { options: options, row: true, multiple: false, ...props }));
14
15
  }
package/lib/SelectBool.js CHANGED
@@ -8,10 +8,11 @@ import { SelectEx } from "./SelectEx";
8
8
  * @returns Component
9
9
  */
10
10
  export function SelectBool(props) {
11
+ var _a;
11
12
  // Destruct
12
13
  const { search = true, autoAddBlankItem = search, ...rest } = props;
13
14
  // Options
14
- const options = globalApp.getBools();
15
+ const options = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getBools()) !== null && _a !== void 0 ? _a : [];
15
16
  if (autoAddBlankItem)
16
17
  Utils.addBlankItem(options);
17
18
  // Layout
@@ -1,4 +1,4 @@
1
- import { AuditLineChangesDto } from '@etsoo/appscript';
1
+ import { AuditLineChangesDto } from "@etsoo/appscript";
2
2
  /**
3
3
  * Check obj is instance of AuditLineChangesDto
4
4
  * @param obj Input
@@ -1,26 +1,26 @@
1
- import { NotificationMessageType } from '@etsoo/notificationbase';
2
- import { Utils } from '@etsoo/shared';
3
- import { Table, TableBody, TableCell, TableHead, TableRow } from '@mui/material';
4
- import React from 'react';
5
- import { globalApp } from './app/ReactApp';
1
+ import { NotificationMessageType } from "@etsoo/notificationbase";
2
+ import { Utils } from "@etsoo/shared";
3
+ import { Table, TableBody, TableCell, TableHead, TableRow } from "@mui/material";
4
+ import React from "react";
5
+ import { globalApp } from "./app/ReactApp";
6
6
  /**
7
7
  * Check obj is instance of AuditLineChangesDto
8
8
  * @param obj Input
9
9
  * @returns Result
10
10
  */
11
11
  export function IsAuditLineUpdateData(obj) {
12
- return (typeof obj === 'object' &&
13
- 'oldData' in obj &&
14
- typeof obj.oldData === 'object' &&
15
- 'newData' in obj &&
16
- typeof obj.newData === 'object');
12
+ return (typeof obj === "object" &&
13
+ "oldData" in obj &&
14
+ typeof obj.oldData === "object" &&
15
+ "newData" in obj &&
16
+ typeof obj.newData === "object");
17
17
  }
18
18
  // Format value
19
19
  const formatValue = (value, app) => {
20
20
  if (value == null)
21
- return '';
21
+ return "";
22
22
  if (value instanceof Date)
23
- return app.formatDate(value, 'ds');
23
+ return app.formatDate(value, "ds");
24
24
  return `${value}`;
25
25
  };
26
26
  /**
@@ -31,10 +31,17 @@ 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
- modelTitle !== null && modelTitle !== void 0 ? modelTitle : (modelTitle = globalApp.get('dataComparison'));
34
+ // Validate app
35
+ const app = globalApp;
36
+ if (app == null) {
37
+ throw new Error("No globalApp");
38
+ }
39
+ // Labels
40
+ const { dataComparison, field, newValue, oldValue } = app.getLabels("dataComparison", "field", "newValue", "oldValue");
41
+ modelTitle !== null && modelTitle !== void 0 ? modelTitle : (modelTitle = dataComparison);
35
42
  getLabel !== null && getLabel !== void 0 ? getLabel : (getLabel = (key) => {
36
43
  var _a;
37
- return (_a = globalApp.get(Utils.formatInitial(key))) !== null && _a !== void 0 ? _a : key;
44
+ return (_a = app.get(Utils.formatInitial(key))) !== null && _a !== void 0 ? _a : key;
38
45
  });
39
46
  const keys = new Set([
40
47
  ...Object.keys(data.oldData),
@@ -50,12 +57,12 @@ export const ShowDataComparison = (data, modelTitle, getLabel, equalCheck = true
50
57
  const inputs = (React.createElement(Table, null,
51
58
  React.createElement(TableHead, null,
52
59
  React.createElement(TableRow, null,
53
- React.createElement(TableCell, { width: "18%" }, globalApp.get('field')),
54
- React.createElement(TableCell, { width: "41%", align: "right" }, globalApp.get('oldValue')),
55
- React.createElement(TableCell, { width: "41%", align: "right" }, globalApp.get('newValue')))),
60
+ React.createElement(TableCell, { width: "18%" }, field),
61
+ React.createElement(TableCell, { width: "41%", align: "right" }, oldValue),
62
+ React.createElement(TableCell, { width: "41%", align: "right" }, newValue))),
56
63
  React.createElement(TableBody, null, rows.map((row) => (React.createElement(TableRow, { key: row.field },
57
64
  React.createElement(TableCell, null, getLabel(row.field)),
58
- React.createElement(TableCell, { align: "right" }, formatValue(row.oldValue, globalApp)),
59
- React.createElement(TableCell, { align: "right" }, formatValue(row.newValue, globalApp))))))));
60
- globalApp.notifier.alert([undefined, modelTitle], undefined, NotificationMessageType.Info, { fullScreen: globalApp.smDown, inputs });
65
+ React.createElement(TableCell, { align: "right" }, formatValue(row.oldValue, app)),
66
+ React.createElement(TableCell, { align: "right" }, formatValue(row.newValue, app))))))));
67
+ app.notifier.alert([undefined, modelTitle], undefined, NotificationMessageType.Info, { fullScreen: app.smDown, inputs });
61
68
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { SwitchProps } from '@mui/material/Switch';
2
+ import { SwitchProps } from "@mui/material/Switch";
3
3
  /**
4
4
  * Ant style switch props
5
5
  */
package/lib/SwitchAnt.js CHANGED
@@ -1,17 +1,20 @@
1
- import { Stack, Typography } from '@mui/material';
2
- import Switch from '@mui/material/Switch';
3
- import React from 'react';
1
+ import { Stack, Typography } from "@mui/material";
2
+ import Switch from "@mui/material/Switch";
3
+ import React from "react";
4
+ import { globalApp } from "./app/ReactApp";
4
5
  /**
5
6
  * Ant style switch
6
7
  * @param props Props
7
8
  * @returns Component
8
9
  */
9
10
  export function SwitchAnt(props) {
10
- var _a;
11
+ var _a, _b;
12
+ // Labels
13
+ const { yes = "Yes", no = "No" } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("yes", "no")) !== null && _a !== void 0 ? _a : {};
11
14
  // Destruct
12
- const { activeColor, checked, defaultChecked, defaultValue, endLabel, startLabel, onChange, value = 'true', ...rest } = props;
15
+ const { activeColor, checked, defaultChecked, defaultValue, endLabel = yes, startLabel = no, onChange, value = "true", ...rest } = props;
13
16
  // Checked state
14
- const [controlChecked, setControlChecked] = React.useState((_a = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _a !== void 0 ? _a : defaultValue == value);
17
+ const [controlChecked, setControlChecked] = React.useState((_b = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _b !== void 0 ? _b : defaultValue == value);
15
18
  // Ref
16
19
  const ref = React.useRef(null);
17
20
  React.useEffect(() => {
@@ -27,14 +30,14 @@ export function SwitchAnt(props) {
27
30
  // Layout
28
31
  return (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
29
32
  React.createElement(Typography, { onClick: () => { var _a; return controlChecked && ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.click()); }, sx: {
30
- cursor: 'pointer',
33
+ cursor: "pointer",
31
34
  color: controlChecked
32
35
  ? undefined
33
36
  : (theme) => activeColor !== null && activeColor !== void 0 ? activeColor : theme.palette.warning.main
34
37
  } }, startLabel),
35
38
  React.createElement(Switch, { checked: controlChecked, inputRef: ref, value: value, onChange: onChangeLocal, ...rest }),
36
39
  React.createElement(Typography, { onClick: () => { var _a; return !controlChecked && ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.click()); }, sx: {
37
- cursor: 'pointer',
40
+ cursor: "pointer",
38
41
  color: controlChecked
39
42
  ? (theme) => activeColor !== null && activeColor !== void 0 ? activeColor : theme.palette.warning.main
40
43
  : undefined
package/lib/Tiplist.js CHANGED
@@ -11,10 +11,11 @@ import { SearchField } from "./SearchField";
11
11
  * @returns Component
12
12
  */
13
13
  export function Tiplist(props) {
14
+ var _a;
14
15
  // Labels
15
- const labels = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more");
16
+ const { noOptions, loading, more } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more")) !== null && _a !== void 0 ? _a : {};
16
17
  // Destruct
17
- const { search = false, idField = "id", idValue, inputAutoComplete = "new-password", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, label, loadData, defaultValue, value, maxItems = 16, name, readOnly, onChange, openOnFocus = true, sx = { minWidth: "180px" }, noOptionsText = labels === null || labels === void 0 ? void 0 : labels.noOptions, loadingText = labels === null || labels === void 0 ? void 0 : labels.loading, getOptionLabel, getOptionDisabled, ...rest } = props;
18
+ const { search = false, idField = "id", idValue, inputAutoComplete = "new-password", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, label, loadData, defaultValue, value, maxItems = 16, name, readOnly, onChange, openOnFocus = true, sx = { minWidth: "180px" }, noOptionsText = noOptions, loadingText = loading, getOptionLabel, getOptionDisabled, ...rest } = props;
18
19
  // Value input ref
19
20
  const inputRef = React.createRef();
20
21
  // Local value
@@ -160,11 +161,10 @@ export function Tiplist(props) {
160
161
  return true;
161
162
  return getOptionDisabled ? getOptionDisabled(item) : false;
162
163
  }, getOptionLabel: (item) => {
163
- var _a;
164
164
  if (typeof item !== "object")
165
165
  return `${item}`;
166
166
  if (item[idField] === "n/a")
167
- return ((_a = labels.more) !== null && _a !== void 0 ? _a : "More") + "...";
167
+ return (more !== null && more !== void 0 ? more : "More") + "...";
168
168
  return getOptionLabel
169
169
  ? getOptionLabel(item)
170
170
  : "label" in item
package/lib/UserAvatar.js CHANGED
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import { Avatar } from '@mui/material';
3
- import { BusinessUtils } from '@etsoo/appscript';
4
- import { globalApp } from './app/ReactApp';
1
+ import React from "react";
2
+ import { Avatar } from "@mui/material";
3
+ import { BusinessUtils } from "@etsoo/appscript";
4
+ import { globalApp } from "./app/ReactApp";
5
5
  /**
6
6
  * User avatar
7
7
  * @param props Props
@@ -10,9 +10,8 @@ import { globalApp } from './app/ReactApp';
10
10
  export function UserAvatar(props) {
11
11
  // Destruct
12
12
  const { src, title, formatTitle = (title) => {
13
- return BusinessUtils.formatAvatarTitle(title, 3, typeof globalApp === 'undefined'
14
- ? 'ME'
15
- : globalApp.get('me'));
13
+ var _a;
14
+ return BusinessUtils.formatAvatarTitle(title, 3, (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("me")) !== null && _a !== void 0 ? _a : "ME");
16
15
  } } = props;
17
16
  // Format
18
17
  const fTitle = formatTitle(title);
@@ -20,6 +19,6 @@ export function UserAvatar(props) {
20
19
  return (React.createElement(Avatar, { title: title, src: src, sx: {
21
20
  width: 48,
22
21
  height: 32,
23
- fontSize: count <= 2 ? '15px' : '12px'
22
+ fontSize: count <= 2 ? "15px" : "12px"
24
23
  } }, fTitle));
25
24
  }
@@ -1,9 +1,9 @@
1
- import { CoreApp, IActionResult, IApp, IAppSettings, ICoreApp, IUser } from '@etsoo/appscript';
2
- import { INotifier, NotificationReturn } from '@etsoo/notificationbase';
3
- import { DataTypes } from '@etsoo/shared';
4
- import React from 'react';
5
- import { CultureAction, CultureState, INotificationReact, InputDialogProps, IPageData, IStateProps, NotificationReactCallProps, PageAction, PageState, UserAction, UserState } from '@etsoo/react';
6
- import { NavigateFunction, NavigateOptions } from 'react-router-dom';
1
+ import { CoreApp, IActionResult, IApp, IAppSettings, ICoreApp, IUser } from "@etsoo/appscript";
2
+ import { INotifier, NotificationReturn } from "@etsoo/notificationbase";
3
+ import { DataTypes } from "@etsoo/shared";
4
+ import React from "react";
5
+ import { CultureAction, CultureState, INotificationReact, InputDialogProps, IPageData, IStateProps, NotificationReactCallProps, PageAction, PageState, UserAction, UserState } from "@etsoo/react";
6
+ import { NavigateFunction, NavigateOptions } from "react-router-dom";
7
7
  /**
8
8
  * React Application Type
9
9
  */
@@ -11,7 +11,7 @@ export type ReactAppType = IApp & IReactAppBase;
11
11
  /**
12
12
  * Global application
13
13
  */
14
- export declare let globalApp: ReactAppType;
14
+ export declare let globalApp: ReactAppType | null;
15
15
  /**
16
16
  * React app state detector
17
17
  * Case 1: undefined, when refresh the whole page
@@ -1,11 +1,11 @@
1
- import { BridgeUtils, CoreApp, createClient } from '@etsoo/appscript';
2
- import { NotificationMessageType } from '@etsoo/notificationbase';
3
- import { WindowStorage } from '@etsoo/shared';
4
- import React from 'react';
5
- import { NotifierMU } from '../NotifierMU';
6
- import { ProgressCount } from '../ProgressCount';
7
- import { Labels } from './Labels';
8
- import { CultureState, PageActionType, PageState, UserActionType, UserState } from '@etsoo/react';
1
+ import { BridgeUtils, CoreApp, createClient } from "@etsoo/appscript";
2
+ import { NotificationMessageType } from "@etsoo/notificationbase";
3
+ import { WindowStorage } from "@etsoo/shared";
4
+ import React from "react";
5
+ import { NotifierMU } from "../NotifierMU";
6
+ import { ProgressCount } from "../ProgressCount";
7
+ import { Labels } from "./Labels";
8
+ import { CultureState, PageActionType, PageState, UserActionType, UserState } from "@etsoo/react";
9
9
  /**
10
10
  * Global application
11
11
  */
@@ -75,7 +75,7 @@ export class ReactApp extends CoreApp {
75
75
  this.userState = new UserState();
76
76
  if (BridgeUtils.host) {
77
77
  BridgeUtils.host.onUpdate((app, version) => {
78
- this.notifier.message(NotificationMessageType.Success, this.get('updateTip') + `(${[app, version].join(', ')})`, this.get('updateReady'));
78
+ this.notifier.message(NotificationMessageType.Success, this.get("updateTip") + `(${[app, version].join(", ")})`, this.get("updateReady"));
79
79
  });
80
80
  }
81
81
  this.cultureState = new CultureState(settings.currentCulture);
@@ -88,13 +88,13 @@ export class ReactApp extends CoreApp {
88
88
  * @param callback Callback
89
89
  */
90
90
  alertResult(result, callback) {
91
- const message = typeof result === 'string' ? result : this.formatResult(result);
92
- if (message.endsWith(')')) {
93
- const startPos = message.lastIndexOf('(');
91
+ const message = typeof result === "string" ? result : this.formatResult(result);
92
+ if (message.endsWith(")")) {
93
+ const startPos = message.lastIndexOf("(");
94
94
  if (startPos > 0) {
95
95
  const main = message.substring(0, startPos).trim();
96
96
  const tip = message.substring(startPos);
97
- const titleNode = React.createElement(React.Fragment, null, main, React.createElement('br'), React.createElement('span', { style: { fontSize: '9px' } }, tip));
97
+ const titleNode = React.createElement(React.Fragment, null, main, React.createElement("br"), React.createElement("span", { style: { fontSize: "9px" } }, tip));
98
98
  this.notifier.alert(titleNode, callback);
99
99
  return;
100
100
  }
@@ -112,19 +112,19 @@ export class ReactApp extends CoreApp {
112
112
  // Update component labels
113
113
  Labels.setLabels(culture.resources, {
114
114
  notificationMU: {
115
- alertTitle: 'warning',
116
- alertOK: 'ok',
117
- confirmTitle: 'confirm',
118
- confirmYes: 'ok',
119
- confirmNo: 'cancel',
120
- promptTitle: 'prompt',
121
- promptCancel: 'cancel',
122
- promptOK: 'ok'
115
+ alertTitle: "warning",
116
+ alertOK: "ok",
117
+ confirmTitle: "confirm",
118
+ confirmYes: "ok",
119
+ confirmNo: "cancel",
120
+ promptTitle: "prompt",
121
+ promptCancel: "cancel",
122
+ promptOK: "ok"
123
123
  }
124
124
  });
125
125
  // Document title
126
126
  // Default is servier name's label or appName label
127
- const title = (_b = (_a = this.get(this.name)) !== null && _a !== void 0 ? _a : this.get('appName')) !== null && _b !== void 0 ? _b : this.name;
127
+ const title = (_b = (_a = this.get(this.name)) !== null && _a !== void 0 ? _a : this.get("appName")) !== null && _b !== void 0 ? _b : this.name;
128
128
  const host = BridgeUtils.host;
129
129
  if (host) {
130
130
  // Notify host
@@ -170,11 +170,11 @@ export class ReactApp extends CoreApp {
170
170
  */
171
171
  freshCountdownUI(callback) {
172
172
  // Labels
173
- const labels = this.getLabels('cancel', 'tokenExpiry');
173
+ const labels = this.getLabels("cancel", "tokenExpiry");
174
174
  // Progress
175
175
  const progress = React.createElement(ProgressCount, {
176
176
  seconds: 30,
177
- valueUnit: 's',
177
+ valueUnit: "s",
178
178
  onComplete: () => {
179
179
  // Stop the progress
180
180
  return false;
@@ -228,7 +228,7 @@ export class ReactApp extends CoreApp {
228
228
  navigate(to, options) {
229
229
  if (this.navigateFunction == null)
230
230
  super.navigate(to, options);
231
- else if (typeof to === 'number')
231
+ else if (typeof to === "number")
232
232
  this.navigateFunction(to);
233
233
  else
234
234
  this.navigateFunction(to, options);
@@ -239,7 +239,7 @@ export class ReactApp extends CoreApp {
239
239
  */
240
240
  setPageKey(key) {
241
241
  var _a;
242
- this.setPageTitle((_a = this.get(key)) !== null && _a !== void 0 ? _a : '');
242
+ this.setPageTitle((_a = this.get(key)) !== null && _a !== void 0 ? _a : "");
243
243
  }
244
244
  /**
245
245
  * Show input dialog