@etsoo/smarterp-core 1.0.29 → 1.0.31

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.
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AppSwitchPopover = AppSwitchPopover;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = __importDefault(require("react"));
9
- const material_1 = require("@mui/material");
10
9
  const react_router_dom_1 = require("react-router-dom");
11
10
  const materialui_1 = require("@etsoo/materialui");
12
11
  const ICoreServiceApp_1 = require("../../ICoreServiceApp");
13
12
  const appscript_1 = require("@etsoo/appscript");
13
+ const Typography_1 = __importDefault(require("@mui/material/Typography"));
14
+ const Stack_1 = __importDefault(require("@mui/material/Stack"));
15
+ const Button_1 = __importDefault(require("@mui/material/Button"));
14
16
  function AppSwitchPopover(props) {
15
17
  // Destruct
16
18
  const { appName } = props;
@@ -25,7 +27,7 @@ function AppSwitchPopover(props) {
25
27
  // Current app
26
28
  const currentApp = app.settings.appId;
27
29
  // Layout
28
- return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopover, { button: (callback) => ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", sx: {
30
+ return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopover, { button: (callback) => ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "h6", sx: {
29
31
  color: (theme) => theme.palette.primary.main,
30
32
  fontWeight: "700",
31
33
  ml: 0.5,
@@ -38,7 +40,7 @@ function AppSwitchPopover(props) {
38
40
  const index = data.findIndex((a) => a.id === currentApp);
39
41
  if (index >= 0)
40
42
  data.splice(index, 1);
41
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "column", margin: 2, children: [data.map((appData) => ((0, jsx_runtime_1.jsx)(material_1.Button, { onClick: async () => {
43
+ return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "column", margin: 2, children: [data.map((appData) => ((0, jsx_runtime_1.jsx)(Button_1.default, { onClick: async () => {
42
44
  /*
43
45
  // Method 1, get the login URL and redirect
44
46
  const tasks = appData.urls.map((u) =>
@@ -73,6 +75,6 @@ function AppSwitchPopover(props) {
73
75
  }
74
76
  }
75
77
  app.notifier.alert(app.get("networkFailure"));
76
- }, children: app.core.getAppName(appData) }, appData.id))), (data.length === 0 || data.length === maxItems) && ((0, jsx_runtime_1.jsxs)(material_1.Button, { onClick: () => navigate("./app/my"), children: [labels.more, "..."] }))] }));
78
+ }, children: app.core.getAppName(appData) }, appData.id))), (data.length === 0 || data.length === maxItems) && ((0, jsx_runtime_1.jsxs)(Button_1.default, { onClick: () => navigate("./app/my"), children: [labels.more, "..."] }))] }));
77
79
  } }));
78
80
  }
@@ -0,0 +1,8 @@
1
+ import { SelectExProps } from "@etsoo/materialui";
2
+ import { ListType } from "@etsoo/shared";
3
+ /**
4
+ * Identity type list component
5
+ * @param props Props
6
+ * @returns Component
7
+ */
8
+ export declare function IdentityTypeList(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdentityType = IdentityType;
3
+ exports.IdentityTypeList = IdentityTypeList;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const materialui_1 = require("@etsoo/materialui");
6
6
  const ICoreServiceApp_1 = require("../../ICoreServiceApp");
7
7
  /**
8
- * Identity type component
8
+ * Identity type list component
9
9
  * @param props Props
10
10
  * @returns Component
11
11
  */
12
- function IdentityType(props) {
12
+ function IdentityTypeList(props) {
13
13
  // App
14
14
  const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
15
15
  // Identities
@@ -0,0 +1,7 @@
1
+ import { ComboBoxProps } from "@etsoo/materialui";
2
+ /**
3
+ * User role list component
4
+ * @param props Props
5
+ * @returns Component
6
+ */
7
+ export declare function UserRoleList(props: Omit<ComboBoxProps, "options">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserRoleList = UserRoleList;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const materialui_1 = require("@etsoo/materialui");
6
+ const ICoreServiceApp_1 = require("../../ICoreServiceApp");
7
+ /**
8
+ * User role list component
9
+ * @param props Props
10
+ * @returns Component
11
+ */
12
+ function UserRoleList(props) {
13
+ // App
14
+ const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
15
+ // Destruct
16
+ const { name = "userRole", label = app.get("role"), ...rest } = props;
17
+ return ((0, jsx_runtime_1.jsx)(materialui_1.ComboBox, { name: name, label: label, options: app.getRoles(), ...rest }));
18
+ }
@@ -1,7 +1,8 @@
1
1
  export * from "./DefaultUI";
2
2
  export * from "./app/AppSwitchPopover";
3
- export * from "./app/IdentityType";
3
+ export * from "./app/IdentityTypeList";
4
4
  export * from "./app/SearchDays";
5
+ export * from "./app/UserRoleList";
5
6
  export * from "./org/OrgSwitchPopover";
6
7
  export * from "./org/OrgTiplist";
7
8
  export * from "./user/UserTiplist";
@@ -18,8 +18,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  __exportStar(require("./DefaultUI"), exports);
19
19
  // app
20
20
  __exportStar(require("./app/AppSwitchPopover"), exports);
21
- __exportStar(require("./app/IdentityType"), exports);
21
+ __exportStar(require("./app/IdentityTypeList"), exports);
22
22
  __exportStar(require("./app/SearchDays"), exports);
23
+ __exportStar(require("./app/UserRoleList"), exports);
23
24
  // org
24
25
  __exportStar(require("./org/OrgSwitchPopover"), exports);
25
26
  __exportStar(require("./org/OrgTiplist"), exports);
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.OrgSwitchPopover = OrgSwitchPopover;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = __importDefault(require("react"));
9
- const material_1 = require("@mui/material");
10
9
  const AccountTree_1 = __importDefault(require("@mui/icons-material/AccountTree"));
11
10
  const react_router_dom_1 = require("react-router-dom");
12
11
  const materialui_1 = require("@etsoo/materialui");
13
12
  const ICoreServiceApp_1 = require("../../ICoreServiceApp");
13
+ const ButtonGroup_1 = __importDefault(require("@mui/material/ButtonGroup"));
14
+ const Button_1 = __importDefault(require("@mui/material/Button"));
15
+ const Stack_1 = __importDefault(require("@mui/material/Stack"));
14
16
  function OrgSwitchPopover(props) {
15
17
  // Destruct
16
18
  const { organizationName } = props;
@@ -27,7 +29,7 @@ function OrgSwitchPopover(props) {
27
29
  // Current organization
28
30
  const currentOrg = app.userData?.organization;
29
31
  // Layout
30
- return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopover, { button: (callback) => ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(material_1.ButtonGroup, { variant: "text", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { sx: { display: { xs: "none", md: "block" } }, title: labels.currentOrg, onClick: () => callback(anchorRef.current), children: organizationName ?? labels.switchOrg }), (0, jsx_runtime_1.jsx)(material_1.Button, { title: labels.switchOrg, onClick: (e) => callback(e.currentTarget), ref: anchorRef, children: (0, jsx_runtime_1.jsx)(AccountTree_1.default, {}) })] }) })), loadData: () => app.core.orgApi.getMy({ maxItems }, { showLoading: false }), children: (data) => {
32
+ return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopover, { button: (callback) => ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(ButtonGroup_1.default, { variant: "text", children: [(0, jsx_runtime_1.jsx)(Button_1.default, { sx: { display: { xs: "none", md: "block" } }, title: labels.currentOrg, onClick: () => callback(anchorRef.current), children: organizationName ?? labels.switchOrg }), (0, jsx_runtime_1.jsx)(Button_1.default, { title: labels.switchOrg, onClick: (e) => callback(e.currentTarget), ref: anchorRef, children: (0, jsx_runtime_1.jsx)(AccountTree_1.default, {}) })] }) })), loadData: () => app.core.orgApi.getMy({ maxItems }, { showLoading: false }), children: (data) => {
31
33
  if (data == null)
32
34
  return (0, jsx_runtime_1.jsx)(react_1.default.Fragment, {});
33
35
  // Remove the current organization
@@ -36,7 +38,7 @@ function OrgSwitchPopover(props) {
36
38
  if (index >= 0)
37
39
  data.splice(index, 1);
38
40
  }
39
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "column", margin: 2, children: [data.map((org) => ((0, jsx_runtime_1.jsx)(material_1.Button, { onClick: async () => {
41
+ return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "column", margin: 2, children: [data.map((org) => ((0, jsx_runtime_1.jsx)(Button_1.default, { onClick: async () => {
40
42
  const result = await app.switchOrg(org.id);
41
43
  if (result == null)
42
44
  return;
@@ -44,6 +46,6 @@ function OrgSwitchPopover(props) {
44
46
  app.alertResult(result);
45
47
  return;
46
48
  }
47
- }, children: org.name }, org.id))), (data.length === 0 || data.length === maxItems) && ((0, jsx_runtime_1.jsxs)(material_1.Button, { onClick: () => navigate("./org/my"), children: [labels.more, "..."] }))] }));
49
+ }, children: org.name }, org.id))), (data.length === 0 || data.length === maxItems) && ((0, jsx_runtime_1.jsxs)(Button_1.default, { onClick: () => navigate("./org/my"), children: [labels.more, "..."] }))] }));
48
50
  } }));
49
51
  }
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { Button, Stack, Typography } from "@mui/material";
4
3
  import { useNavigate } from "react-router-dom";
5
4
  import { ButtonPopover } from "@etsoo/materialui";
6
5
  import { useRequiredAppContext } from "../../ICoreServiceApp";
7
6
  import { IdentityType } from "@etsoo/appscript";
7
+ import Typography from "@mui/material/Typography";
8
+ import Stack from "@mui/material/Stack";
9
+ import Button from "@mui/material/Button";
8
10
  export function AppSwitchPopover(props) {
9
11
  // Destruct
10
12
  const { appName } = props;
@@ -0,0 +1,8 @@
1
+ import { SelectExProps } from "@etsoo/materialui";
2
+ import { ListType } from "@etsoo/shared";
3
+ /**
4
+ * Identity type list component
5
+ * @param props Props
6
+ * @returns Component
7
+ */
8
+ export declare function IdentityTypeList(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;
@@ -2,11 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SelectEx } from "@etsoo/materialui";
3
3
  import { useRequiredAppContext } from "../../ICoreServiceApp";
4
4
  /**
5
- * Identity type component
5
+ * Identity type list component
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
- export function IdentityType(props) {
9
+ export function IdentityTypeList(props) {
10
10
  // App
11
11
  const app = useRequiredAppContext();
12
12
  // Identities
@@ -0,0 +1,7 @@
1
+ import { ComboBoxProps } from "@etsoo/materialui";
2
+ /**
3
+ * User role list component
4
+ * @param props Props
5
+ * @returns Component
6
+ */
7
+ export declare function UserRoleList(props: Omit<ComboBoxProps, "options">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ComboBox } from "@etsoo/materialui";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+ /**
5
+ * User role list component
6
+ * @param props Props
7
+ * @returns Component
8
+ */
9
+ export function UserRoleList(props) {
10
+ // App
11
+ const app = useRequiredAppContext();
12
+ // Destruct
13
+ const { name = "userRole", label = app.get("role"), ...rest } = props;
14
+ return (_jsx(ComboBox, { name: name, label: label, options: app.getRoles(), ...rest }));
15
+ }
@@ -1,7 +1,8 @@
1
1
  export * from "./DefaultUI";
2
2
  export * from "./app/AppSwitchPopover";
3
- export * from "./app/IdentityType";
3
+ export * from "./app/IdentityTypeList";
4
4
  export * from "./app/SearchDays";
5
+ export * from "./app/UserRoleList";
5
6
  export * from "./org/OrgSwitchPopover";
6
7
  export * from "./org/OrgTiplist";
7
8
  export * from "./user/UserTiplist";
@@ -2,8 +2,9 @@
2
2
  export * from "./DefaultUI";
3
3
  // app
4
4
  export * from "./app/AppSwitchPopover";
5
- export * from "./app/IdentityType";
5
+ export * from "./app/IdentityTypeList";
6
6
  export * from "./app/SearchDays";
7
+ export * from "./app/UserRoleList";
7
8
  // org
8
9
  export * from "./org/OrgSwitchPopover";
9
10
  export * from "./org/OrgTiplist";
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { Button, ButtonGroup, Stack } from "@mui/material";
4
3
  import AccountTreeIcon from "@mui/icons-material/AccountTree";
5
4
  import { useNavigate } from "react-router-dom";
6
5
  import { ButtonPopover } from "@etsoo/materialui";
7
6
  import { useRequiredAppContext } from "../../ICoreServiceApp";
7
+ import ButtonGroup from "@mui/material/ButtonGroup";
8
+ import Button from "@mui/material/Button";
9
+ import Stack from "@mui/material/Stack";
8
10
  export function OrgSwitchPopover(props) {
9
11
  // Destruct
10
12
  const { organizationName } = props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -40,12 +40,12 @@
40
40
  "license": "MIT",
41
41
  "homepage": "https://github.com/ETSOO/etsoo-smarterp-core#readme",
42
42
  "devDependencies": {
43
- "@babel/cli": "^7.26.4",
43
+ "@babel/cli": "^7.27.0",
44
44
  "@babel/core": "^7.26.10",
45
45
  "@babel/plugin-transform-runtime": "^7.26.10",
46
46
  "@babel/preset-env": "^7.26.9",
47
- "@babel/runtime-corejs3": "^7.26.10",
48
- "@types/react": "^18.3.19",
47
+ "@babel/runtime-corejs3": "^7.27.0",
48
+ "@types/react": "^18.3.20",
49
49
  "@types/react-dom": "^18.3.1",
50
50
  "@vitejs/plugin-react": "^4.3.4",
51
51
  "jsdom": "^26.0.0",
@@ -53,12 +53,12 @@
53
53
  "vitest": "^3.0.9"
54
54
  },
55
55
  "dependencies": {
56
- "@etsoo/appscript": "^1.6.19",
57
- "@etsoo/materialui": "^1.5.2",
58
- "@etsoo/react": "^1.8.33",
56
+ "@etsoo/appscript": "^1.6.20",
57
+ "@etsoo/materialui": "^1.5.4",
58
+ "@etsoo/react": "^1.8.34",
59
59
  "@etsoo/shared": "^1.2.63",
60
- "@etsoo/toolpad": "^1.0.22",
61
- "@mui/material": "^6.4.8",
60
+ "@etsoo/toolpad": "^1.0.24",
61
+ "@mui/material": "^7.0.1",
62
62
  "react": "^18.3.1",
63
63
  "react-dom": "^18.3.1"
64
64
  }
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
- import { Button, Stack, Typography } from "@mui/material";
3
2
  import { useNavigate } from "react-router-dom";
4
3
  import { ButtonPopover } from "@etsoo/materialui";
5
4
  import { useRequiredAppContext } from "../../ICoreServiceApp";
6
5
  import { AppData } from "../../dto/app/AppData";
7
6
  import { AuthRequest, IdentityType } from "@etsoo/appscript";
7
+ import Typography from "@mui/material/Typography";
8
+ import Stack from "@mui/material/Stack";
9
+ import Button from "@mui/material/Button";
8
10
 
9
11
  export type AppSwitchPopoverProps = {
10
12
  appName: string;
@@ -3,11 +3,13 @@ import { useRequiredAppContext } from "../../ICoreServiceApp";
3
3
  import { ListType } from "@etsoo/shared";
4
4
 
5
5
  /**
6
- * Identity type component
6
+ * Identity type list component
7
7
  * @param props Props
8
8
  * @returns Component
9
9
  */
10
- export function IdentityType(props: Omit<SelectExProps<ListType>, "options">) {
10
+ export function IdentityTypeList(
11
+ props: Omit<SelectExProps<ListType>, "options">
12
+ ) {
11
13
  // App
12
14
  const app = useRequiredAppContext();
13
15
 
@@ -0,0 +1,19 @@
1
+ import { ComboBox, ComboBoxProps } from "@etsoo/materialui";
2
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
3
+
4
+ /**
5
+ * User role list component
6
+ * @param props Props
7
+ * @returns Component
8
+ */
9
+ export function UserRoleList(props: Omit<ComboBoxProps, "options">) {
10
+ // App
11
+ const app = useRequiredAppContext();
12
+
13
+ // Destruct
14
+ const { name = "userRole", label = app.get("role")!, ...rest } = props;
15
+
16
+ return (
17
+ <ComboBox name={name} label={label} options={app.getRoles()} {...rest} />
18
+ );
19
+ }
@@ -3,8 +3,9 @@ export * from "./DefaultUI";
3
3
 
4
4
  // app
5
5
  export * from "./app/AppSwitchPopover";
6
- export * from "./app/IdentityType";
6
+ export * from "./app/IdentityTypeList";
7
7
  export * from "./app/SearchDays";
8
+ export * from "./app/UserRoleList";
8
9
 
9
10
  // org
10
11
  export * from "./org/OrgSwitchPopover";
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
- import { Button, ButtonGroup, Stack } from "@mui/material";
3
2
  import AccountTreeIcon from "@mui/icons-material/AccountTree";
4
3
  import { useNavigate } from "react-router-dom";
5
4
  import { ButtonPopover } from "@etsoo/materialui";
6
5
  import { OrgGetMyData } from "../../dto/org/OrgGetMyData";
7
6
  import { useRequiredAppContext } from "../../ICoreServiceApp";
7
+ import ButtonGroup from "@mui/material/ButtonGroup";
8
+ import Button from "@mui/material/Button";
9
+ import Stack from "@mui/material/Stack";
8
10
 
9
11
  export type OrgSwitchPopoverProps = {
10
12
  organizationName?: string;
@@ -1,8 +0,0 @@
1
- import { SelectExProps } from "@etsoo/materialui";
2
- import { ListType } from "@etsoo/shared";
3
- /**
4
- * Identity type component
5
- * @param props Props
6
- * @returns Component
7
- */
8
- export declare function IdentityType(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- import { SelectExProps } from "@etsoo/materialui";
2
- import { ListType } from "@etsoo/shared";
3
- /**
4
- * Identity type component
5
- * @param props Props
6
- * @returns Component
7
- */
8
- export declare function IdentityType(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;