@etsoo/smarterp-core 1.0.11 → 1.0.12

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.
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IdentityType = IdentityType;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const materialui_1 = require("@etsoo/materialui");
6
+ const ICoreServiceApp_1 = require("../../ICoreServiceApp");
7
+ /**
8
+ * Identity type component
9
+ * @param props Props
10
+ * @returns Component
11
+ */
12
+ function IdentityType(props) {
13
+ // App
14
+ const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
15
+ // Identities
16
+ const identities = app.core.getIdentities();
17
+ // Destruct
18
+ const { label = app.get("identityType"), name = "identityType", ...rest } = props;
19
+ // Layout
20
+ return (0, jsx_runtime_1.jsx)(materialui_1.SelectEx, { label: label, name: name, options: identities, ...rest });
21
+ }
@@ -0,0 +1,8 @@
1
+ import { SelectExProps } from "@etsoo/materialui";
2
+ import { ListType } from "@etsoo/shared";
3
+ /**
4
+ * Days search component
5
+ * @param props Props
6
+ * @returns Component
7
+ */
8
+ export declare function SearchDays(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchDays = SearchDays;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const materialui_1 = require("@etsoo/materialui");
6
+ const ICoreServiceApp_1 = require("../../ICoreServiceApp");
7
+ const options = [
8
+ { id: "", label: "---" },
9
+ { id: 3, label: "3" },
10
+ { id: 7, label: "7" },
11
+ { id: 15, label: "15" },
12
+ { id: 30, label: "30" },
13
+ { id: 60, label: "60" },
14
+ { id: 90, label: "90" },
15
+ { id: 180, label: "180" }
16
+ ];
17
+ /**
18
+ * Days search component
19
+ * @param props Props
20
+ * @returns Component
21
+ */
22
+ function SearchDays(props) {
23
+ // App
24
+ const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
25
+ // Destruct
26
+ const { label = app.get("days"), search = true, ...rest } = props;
27
+ // Layout
28
+ return (0, jsx_runtime_1.jsx)(materialui_1.SelectEx, { label: label, search: search, options: options, ...rest });
29
+ }
@@ -1,4 +1,7 @@
1
1
  export * from "./DefaultUI";
2
2
  export * from "./app/AppSwitchPopover";
3
+ export * from "./app/IdentityType";
4
+ export * from "./app/SearchDays";
3
5
  export * from "./org/OrgSwitchPopover";
4
6
  export * from "./org/OrgTiplist";
7
+ export * from "./user/UserTiplist";
@@ -18,6 +18,10 @@ 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);
22
+ __exportStar(require("./app/SearchDays"), exports);
21
23
  // org
22
24
  __exportStar(require("./org/OrgSwitchPopover"), exports);
23
25
  __exportStar(require("./org/OrgTiplist"), exports);
26
+ // user
27
+ __exportStar(require("./user/UserTiplist"), exports);
@@ -0,0 +1,23 @@
1
+ import { TiplistProps } from "@etsoo/materialui";
2
+ import { MemberListDto } from "../../dto/member/MemberListDto";
3
+ /**
4
+ * User tiplist properties
5
+ * 用户提示列表属性
6
+ */
7
+ export type UserTiplistProps = Omit<TiplistProps<MemberListDto, "id">, "loadData" | "label" | "name"> & {
8
+ /**
9
+ * Label
10
+ */
11
+ label?: string;
12
+ /**
13
+ * Name
14
+ */
15
+ name?: string;
16
+ };
17
+ /**
18
+ * User tiplist
19
+ * 用户提示列表
20
+ * @param props Properties
21
+ * @returns Component
22
+ */
23
+ export declare function UserTiplist(props: UserTiplistProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserTiplist = UserTiplist;
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 tiplist
9
+ * 用户提示列表
10
+ * @param props Properties
11
+ * @returns Component
12
+ */
13
+ function UserTiplist(props) {
14
+ // App
15
+ const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
16
+ // Destruct
17
+ const { fullWidth = true, label = app.get("user"), maxItems = 10, getOptionLabel = (data) => data.name, name = "userId", ...rest } = props;
18
+ // Layout
19
+ return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.memberApi.list({
20
+ enabled: true,
21
+ keyword,
22
+ id,
23
+ queryPaging: {
24
+ batchSize: maxItems
25
+ }
26
+ }, { showLoading: false, defaultValue: [] }), ...rest }));
27
+ }
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SelectEx } from "@etsoo/materialui";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+ /**
5
+ * Identity type component
6
+ * @param props Props
7
+ * @returns Component
8
+ */
9
+ export function IdentityType(props) {
10
+ // App
11
+ const app = useRequiredAppContext();
12
+ // Identities
13
+ const identities = app.core.getIdentities();
14
+ // Destruct
15
+ const { label = app.get("identityType"), name = "identityType", ...rest } = props;
16
+ // Layout
17
+ return _jsx(SelectEx, { label: label, name: name, options: identities, ...rest });
18
+ }
@@ -0,0 +1,8 @@
1
+ import { SelectExProps } from "@etsoo/materialui";
2
+ import { ListType } from "@etsoo/shared";
3
+ /**
4
+ * Days search component
5
+ * @param props Props
6
+ * @returns Component
7
+ */
8
+ export declare function SearchDays(props: Omit<SelectExProps<ListType>, "options">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SelectEx } from "@etsoo/materialui";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+ const options = [
5
+ { id: "", label: "---" },
6
+ { id: 3, label: "3" },
7
+ { id: 7, label: "7" },
8
+ { id: 15, label: "15" },
9
+ { id: 30, label: "30" },
10
+ { id: 60, label: "60" },
11
+ { id: 90, label: "90" },
12
+ { id: 180, label: "180" }
13
+ ];
14
+ /**
15
+ * Days search component
16
+ * @param props Props
17
+ * @returns Component
18
+ */
19
+ export function SearchDays(props) {
20
+ // App
21
+ const app = useRequiredAppContext();
22
+ // Destruct
23
+ const { label = app.get("days"), search = true, ...rest } = props;
24
+ // Layout
25
+ return _jsx(SelectEx, { label: label, search: search, options: options, ...rest });
26
+ }
@@ -1,4 +1,7 @@
1
1
  export * from "./DefaultUI";
2
2
  export * from "./app/AppSwitchPopover";
3
+ export * from "./app/IdentityType";
4
+ export * from "./app/SearchDays";
3
5
  export * from "./org/OrgSwitchPopover";
4
6
  export * from "./org/OrgTiplist";
7
+ export * from "./user/UserTiplist";
@@ -2,6 +2,10 @@
2
2
  export * from "./DefaultUI";
3
3
  // app
4
4
  export * from "./app/AppSwitchPopover";
5
+ export * from "./app/IdentityType";
6
+ export * from "./app/SearchDays";
5
7
  // org
6
8
  export * from "./org/OrgSwitchPopover";
7
9
  export * from "./org/OrgTiplist";
10
+ // user
11
+ export * from "./user/UserTiplist";
@@ -0,0 +1,23 @@
1
+ import { TiplistProps } from "@etsoo/materialui";
2
+ import { MemberListDto } from "../../dto/member/MemberListDto";
3
+ /**
4
+ * User tiplist properties
5
+ * 用户提示列表属性
6
+ */
7
+ export type UserTiplistProps = Omit<TiplistProps<MemberListDto, "id">, "loadData" | "label" | "name"> & {
8
+ /**
9
+ * Label
10
+ */
11
+ label?: string;
12
+ /**
13
+ * Name
14
+ */
15
+ name?: string;
16
+ };
17
+ /**
18
+ * User tiplist
19
+ * 用户提示列表
20
+ * @param props Properties
21
+ * @returns Component
22
+ */
23
+ export declare function UserTiplist(props: UserTiplistProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tiplist } from "@etsoo/materialui";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+ /**
5
+ * User tiplist
6
+ * 用户提示列表
7
+ * @param props Properties
8
+ * @returns Component
9
+ */
10
+ export function UserTiplist(props) {
11
+ // App
12
+ const app = useRequiredAppContext();
13
+ // Destruct
14
+ const { fullWidth = true, label = app.get("user"), maxItems = 10, getOptionLabel = (data) => data.name, name = "userId", ...rest } = props;
15
+ // Layout
16
+ return (_jsx(Tiplist, { label: label, getOptionLabel: getOptionLabel, name: name, fullWidth: fullWidth, maxItems: maxItems, loadData: (keyword, id, maxItems) => app.core.memberApi.list({
17
+ enabled: true,
18
+ keyword,
19
+ id,
20
+ queryPaging: {
21
+ batchSize: maxItems
22
+ }
23
+ }, { showLoading: false, defaultValue: [] }), ...rest }));
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -0,0 +1,26 @@
1
+ import { SelectEx, SelectExProps } from "@etsoo/materialui";
2
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
3
+ import { ListType } from "@etsoo/shared";
4
+
5
+ /**
6
+ * Identity type component
7
+ * @param props Props
8
+ * @returns Component
9
+ */
10
+ export function IdentityType(props: Omit<SelectExProps<ListType>, "options">) {
11
+ // App
12
+ const app = useRequiredAppContext();
13
+
14
+ // Identities
15
+ const identities = app.core.getIdentities();
16
+
17
+ // Destruct
18
+ const {
19
+ label = app.get("identityType"),
20
+ name = "identityType",
21
+ ...rest
22
+ } = props;
23
+
24
+ // Layout
25
+ return <SelectEx label={label} name={name} options={identities} {...rest} />;
26
+ }
@@ -0,0 +1,30 @@
1
+ import { SelectEx, SelectExProps } from "@etsoo/materialui";
2
+ import { ListType } from "@etsoo/shared";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+
5
+ const options: ListType[] = [
6
+ { id: "" as any, label: "---" },
7
+ { id: 3, label: "3" },
8
+ { id: 7, label: "7" },
9
+ { id: 15, label: "15" },
10
+ { id: 30, label: "30" },
11
+ { id: 60, label: "60" },
12
+ { id: 90, label: "90" },
13
+ { id: 180, label: "180" }
14
+ ];
15
+
16
+ /**
17
+ * Days search component
18
+ * @param props Props
19
+ * @returns Component
20
+ */
21
+ export function SearchDays(props: Omit<SelectExProps<ListType>, "options">) {
22
+ // App
23
+ const app = useRequiredAppContext();
24
+
25
+ // Destruct
26
+ const { label = app.get("days"), search = true, ...rest } = props;
27
+
28
+ // Layout
29
+ return <SelectEx label={label} search={search} options={options} {...rest} />;
30
+ }
@@ -3,7 +3,12 @@ export * from "./DefaultUI";
3
3
 
4
4
  // app
5
5
  export * from "./app/AppSwitchPopover";
6
+ export * from "./app/IdentityType";
7
+ export * from "./app/SearchDays";
6
8
 
7
9
  // org
8
10
  export * from "./org/OrgSwitchPopover";
9
11
  export * from "./org/OrgTiplist";
12
+
13
+ // user
14
+ export * from "./user/UserTiplist";
@@ -0,0 +1,68 @@
1
+ import { Tiplist, TiplistProps } from "@etsoo/materialui";
2
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
3
+ import { MemberListDto } from "../../dto/member/MemberListDto";
4
+
5
+ /**
6
+ * User tiplist properties
7
+ * 用户提示列表属性
8
+ */
9
+ export type UserTiplistProps = Omit<
10
+ TiplistProps<MemberListDto, "id">,
11
+ "loadData" | "label" | "name"
12
+ > & {
13
+ /**
14
+ * Label
15
+ */
16
+ label?: string;
17
+
18
+ /**
19
+ * Name
20
+ */
21
+ name?: string;
22
+ };
23
+
24
+ /**
25
+ * User tiplist
26
+ * 用户提示列表
27
+ * @param props Properties
28
+ * @returns Component
29
+ */
30
+ export function UserTiplist(props: UserTiplistProps) {
31
+ // App
32
+ const app = useRequiredAppContext();
33
+
34
+ // Destruct
35
+ const {
36
+ fullWidth = true,
37
+ label = app.get("user")!,
38
+ maxItems = 10,
39
+ getOptionLabel = (data) => data.name,
40
+ name = "userId",
41
+ ...rest
42
+ } = props;
43
+
44
+ // Layout
45
+ return (
46
+ <Tiplist<MemberListDto>
47
+ label={label}
48
+ getOptionLabel={getOptionLabel}
49
+ name={name}
50
+ fullWidth={fullWidth}
51
+ maxItems={maxItems}
52
+ loadData={(keyword, id, maxItems) =>
53
+ app.core.memberApi.list(
54
+ {
55
+ enabled: true,
56
+ keyword,
57
+ id,
58
+ queryPaging: {
59
+ batchSize: maxItems
60
+ }
61
+ },
62
+ { showLoading: false, defaultValue: [] }
63
+ )
64
+ }
65
+ {...rest}
66
+ />
67
+ );
68
+ }