@etsoo/smarterp-core 1.1.10 → 1.1.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.
- package/lib/cjs/components/index.d.ts +1 -0
- package/lib/cjs/components/index.js +1 -0
- package/lib/cjs/components/public/AddressTiplist.js +1 -1
- package/lib/cjs/components/public/ProductBaseUnits.d.ts +21 -0
- package/lib/cjs/components/public/ProductBaseUnits.js +18 -0
- package/lib/cjs/i18n/en.json +1 -0
- package/lib/cjs/i18n/zh-Hans.json +1 -0
- package/lib/cjs/i18n/zh-Hant.json +1 -0
- package/lib/mjs/components/index.d.ts +1 -0
- package/lib/mjs/components/index.js +1 -0
- package/lib/mjs/components/public/AddressTiplist.js +1 -1
- package/lib/mjs/components/public/ProductBaseUnits.d.ts +21 -0
- package/lib/mjs/components/public/ProductBaseUnits.js +15 -0
- package/lib/mjs/i18n/en.json +1 -0
- package/lib/mjs/i18n/zh-Hans.json +1 -0
- package/lib/mjs/i18n/zh-Hant.json +1 -0
- package/package.json +3 -3
- package/src/components/index.ts +1 -0
- package/src/components/public/AddressTiplist.tsx +1 -0
- package/src/components/public/ProductBaseUnits.tsx +46 -0
- package/src/i18n/en.json +1 -0
- package/src/i18n/zh-Hans.json +1 -0
- package/src/i18n/zh-Hant.json +1 -0
|
@@ -35,5 +35,6 @@ __exportStar(require("./public/ButtonCurrencies"), exports);
|
|
|
35
35
|
__exportStar(require("./public/ButtonRadioRegions"), exports);
|
|
36
36
|
__exportStar(require("./public/ButtonRegions"), exports);
|
|
37
37
|
__exportStar(require("./public/CultureList"), exports);
|
|
38
|
+
__exportStar(require("./public/ProductBaseUnits"), exports);
|
|
38
39
|
// user
|
|
39
40
|
__exportStar(require("./user/UserTiplist"), exports);
|
|
@@ -21,7 +21,7 @@ function AddressTiplist(props) {
|
|
|
21
21
|
const { fullWidth = true, getOptionLabel = (option) => `${option.name} - ${option.formattedAddress}${option.postalCode ? ` (${option.postalCode})` : ""}`, name = "address", label = app.get("address") ?? "Address", maxItems = 10, onValueChange, ...rest } = props;
|
|
22
22
|
// Provider
|
|
23
23
|
const providerRef = react_1.default.useRef(appscript_1.MapApiProvider.Google);
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { fullWidth: fullWidth, getOptionLabel: getOptionLabel, idField: "placeId", label: label, loadData: async (keyword, _, maxItems) => {
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { fullWidth: fullWidth, getOptionLabel: getOptionLabel, idField: "placeId", idIsString: true, label: label, loadData: async (keyword, _, maxItems) => {
|
|
25
25
|
if (keyword && keyword.length > 2) {
|
|
26
26
|
const [provider, results] = await app.core.publicApi.queryPlace({
|
|
27
27
|
language: app.culture,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComboBoxProps } from "@etsoo/materialui";
|
|
2
|
+
import { ListType } from "@etsoo/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Product base units component props
|
|
5
|
+
*/
|
|
6
|
+
export type ProductBaseUnitsProps = Omit<ComboBoxProps<ListType>, "options"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Is joined
|
|
9
|
+
*/
|
|
10
|
+
isJoined?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Custom options
|
|
13
|
+
*/
|
|
14
|
+
options?: string[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Product base units component
|
|
18
|
+
* @param props Props
|
|
19
|
+
* @returns Component
|
|
20
|
+
*/
|
|
21
|
+
export declare function ProductBaseUnits(props: ProductBaseUnitsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductBaseUnits = ProductBaseUnits;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const materialui_1 = require("@etsoo/materialui");
|
|
6
|
+
const ICoreServiceApp_1 = require("../../ICoreServiceApp");
|
|
7
|
+
/**
|
|
8
|
+
* Product base units component
|
|
9
|
+
* @param props Props
|
|
10
|
+
* @returns Component
|
|
11
|
+
*/
|
|
12
|
+
function ProductBaseUnits(props) {
|
|
13
|
+
// App
|
|
14
|
+
const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
|
|
15
|
+
// Destruct
|
|
16
|
+
const { isJoined, label = app.get("baseUnit") ?? "Base unit", name = "baseUnit", options, ...rest } = props;
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(materialui_1.ComboBox, { name: name, label: label, options: app.core.publicApi.units(options, isJoined), ...rest }));
|
|
18
|
+
}
|
package/lib/cjs/i18n/en.json
CHANGED
|
@@ -19,5 +19,6 @@ export * from "./public/ButtonCurrencies";
|
|
|
19
19
|
export * from "./public/ButtonRadioRegions";
|
|
20
20
|
export * from "./public/ButtonRegions";
|
|
21
21
|
export * from "./public/CultureList";
|
|
22
|
+
export * from "./public/ProductBaseUnits";
|
|
22
23
|
// user
|
|
23
24
|
export * from "./user/UserTiplist";
|
|
@@ -15,7 +15,7 @@ export function AddressTiplist(props) {
|
|
|
15
15
|
const { fullWidth = true, getOptionLabel = (option) => `${option.name} - ${option.formattedAddress}${option.postalCode ? ` (${option.postalCode})` : ""}`, name = "address", label = app.get("address") ?? "Address", maxItems = 10, onValueChange, ...rest } = props;
|
|
16
16
|
// Provider
|
|
17
17
|
const providerRef = React.useRef(MapApiProvider.Google);
|
|
18
|
-
return (_jsx(Tiplist, { fullWidth: fullWidth, getOptionLabel: getOptionLabel, idField: "placeId", label: label, loadData: async (keyword, _, maxItems) => {
|
|
18
|
+
return (_jsx(Tiplist, { fullWidth: fullWidth, getOptionLabel: getOptionLabel, idField: "placeId", idIsString: true, label: label, loadData: async (keyword, _, maxItems) => {
|
|
19
19
|
if (keyword && keyword.length > 2) {
|
|
20
20
|
const [provider, results] = await app.core.publicApi.queryPlace({
|
|
21
21
|
language: app.culture,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComboBoxProps } from "@etsoo/materialui";
|
|
2
|
+
import { ListType } from "@etsoo/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Product base units component props
|
|
5
|
+
*/
|
|
6
|
+
export type ProductBaseUnitsProps = Omit<ComboBoxProps<ListType>, "options"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Is joined
|
|
9
|
+
*/
|
|
10
|
+
isJoined?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Custom options
|
|
13
|
+
*/
|
|
14
|
+
options?: string[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Product base units component
|
|
18
|
+
* @param props Props
|
|
19
|
+
* @returns Component
|
|
20
|
+
*/
|
|
21
|
+
export declare function ProductBaseUnits(props: ProductBaseUnitsProps): 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
|
+
* Product base units component
|
|
6
|
+
* @param props Props
|
|
7
|
+
* @returns Component
|
|
8
|
+
*/
|
|
9
|
+
export function ProductBaseUnits(props) {
|
|
10
|
+
// App
|
|
11
|
+
const app = useRequiredAppContext();
|
|
12
|
+
// Destruct
|
|
13
|
+
const { isJoined, label = app.get("baseUnit") ?? "Base unit", name = "baseUnit", options, ...rest } = props;
|
|
14
|
+
return (_jsx(ComboBox, { name: name, label: label, options: app.core.publicApi.units(options, isJoined), ...rest }));
|
|
15
|
+
}
|
package/lib/mjs/i18n/en.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/smarterp-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "TypeScript APIs for SmartERP Core",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@etsoo/appscript": "^1.6.51",
|
|
61
|
-
"@etsoo/materialui": "^1.5.
|
|
62
|
-
"@etsoo/react": "^1.8.
|
|
61
|
+
"@etsoo/materialui": "^1.5.99",
|
|
62
|
+
"@etsoo/react": "^1.8.68",
|
|
63
63
|
"@etsoo/shared": "^1.2.80",
|
|
64
64
|
"@etsoo/toolpad": "^1.0.44",
|
|
65
65
|
"@mui/material": "^7.3.6",
|
package/src/components/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from "./public/ButtonCurrencies";
|
|
|
22
22
|
export * from "./public/ButtonRadioRegions";
|
|
23
23
|
export * from "./public/ButtonRegions";
|
|
24
24
|
export * from "./public/CultureList";
|
|
25
|
+
export * from "./public/ProductBaseUnits";
|
|
25
26
|
|
|
26
27
|
// user
|
|
27
28
|
export * from "./user/UserTiplist";
|
|
@@ -54,6 +54,7 @@ export function AddressTiplist(props: AddressTiplistProps) {
|
|
|
54
54
|
fullWidth={fullWidth}
|
|
55
55
|
getOptionLabel={getOptionLabel}
|
|
56
56
|
idField="placeId"
|
|
57
|
+
idIsString={true}
|
|
57
58
|
label={label}
|
|
58
59
|
loadData={async (keyword, _, maxItems) => {
|
|
59
60
|
if (keyword && keyword.length > 2) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComboBox, ComboBoxProps } from "@etsoo/materialui";
|
|
2
|
+
import { ListType } from "@etsoo/shared";
|
|
3
|
+
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Product base units component props
|
|
7
|
+
*/
|
|
8
|
+
export type ProductBaseUnitsProps = Omit<ComboBoxProps<ListType>, "options"> & {
|
|
9
|
+
/**
|
|
10
|
+
* Is joined
|
|
11
|
+
*/
|
|
12
|
+
isJoined?: boolean;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Custom options
|
|
16
|
+
*/
|
|
17
|
+
options?: string[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Product base units component
|
|
22
|
+
* @param props Props
|
|
23
|
+
* @returns Component
|
|
24
|
+
*/
|
|
25
|
+
export function ProductBaseUnits(props: ProductBaseUnitsProps) {
|
|
26
|
+
// App
|
|
27
|
+
const app = useRequiredAppContext();
|
|
28
|
+
|
|
29
|
+
// Destruct
|
|
30
|
+
const {
|
|
31
|
+
isJoined,
|
|
32
|
+
label = app.get("baseUnit") ?? "Base unit",
|
|
33
|
+
name = "baseUnit",
|
|
34
|
+
options,
|
|
35
|
+
...rest
|
|
36
|
+
} = props;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<ComboBox<ListType>
|
|
40
|
+
name={name}
|
|
41
|
+
label={label}
|
|
42
|
+
options={app.core.publicApi.units(options, isJoined)}
|
|
43
|
+
{...rest}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
package/src/i18n/en.json
CHANGED
package/src/i18n/zh-Hans.json
CHANGED