@pisell/private-materials 6.2.35 → 6.2.37
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +13 -29
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +6 -6
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/appointmentBooking/components/Content/index.js +1 -1
- package/es/components/appointmentBooking/components/Content/index.less +3 -3
- package/es/components/appointmentBooking/components/Services/index.js +2 -2
- package/es/components/appointmentBooking/index.js +8 -2
- package/es/components/booking/components/voucher/index.js +5 -0
- package/es/components/booking/deposit/ClientItem/index.js +1 -1
- package/es/components/booking/deposit/DepositItem/index.js +1 -1
- package/es/components/booking/forms/single/RenderValueById.d.ts +1 -0
- package/es/components/booking/forms/single/RenderValueById.js +68 -17
- package/es/components/booking/forms/single/index.less +67 -1
- package/es/components/booking/hooks/useQuotation.js +1 -1
- package/es/components/booking/info/clientVariant/utils.d.ts +2 -0
- package/es/components/booking/info/clientVariant/utils.js +7 -0
- package/es/components/booking/info/clientVariant/vertical/index.js +3 -2
- package/es/components/booking/info2/service/addService/utils.js +2 -1
- package/es/components/booking/info2/service/addTimeModal/index.js +0 -1
- package/es/components/booking/info2/service/editService/index.js +37 -29
- package/es/components/booking/info2/utilsByBooking.js +4 -4
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +6 -3
- package/es/components/booking/materiels/duration/index.js +1 -1
- package/es/components/booking/materiels/startTime/index.d.ts +1 -0
- package/es/components/booking/materiels/startTime/index.js +1 -1
- package/es/components/booking/utils.js +3 -3
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/eventBooking/index.js +8 -1
- package/es/components/productSelect/components/TabProduct/index.js +7 -2
- package/es/components/schedules/utils.d.ts +1 -1
- package/es/components/shoppingCart/components/Cart/Product.js +2 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +172 -91
- package/es/components/ticketBooking/components/timeBar/index.js +3 -3
- package/es/components/ticketBooking/utils/index.d.ts +3 -1
- package/es/components/ticketBooking/utils/index.js +18 -2
- package/es/hooks/useWindowSize.js +8 -1
- package/es/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
- package/es/plus/productSelect/CategoryTabs/CategorySkeleton.js +29 -0
- package/es/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
- package/es/plus/productSelect/CategoryTabs/index.d.ts +18 -0
- package/es/plus/productSelect/CategoryTabs/index.js +171 -0
- package/es/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
- package/es/plus/productSelect/ProductCard/ProductCardSkeleton.js +37 -0
- package/es/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
- package/es/plus/productSelect/ProductCard/index.d.ts +45 -0
- package/es/plus/productSelect/ProductCard/index.js +170 -0
- package/es/plus/productSelect/ProductCard/index.less +270 -0
- package/es/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
- package/es/plus/productSelect/ProductList/gridComponents.js +149 -0
- package/es/plus/productSelect/ProductList/index.d.ts +22 -0
- package/es/plus/productSelect/ProductList/index.js +72 -0
- package/es/plus/productSelect/ProductList/index.less +0 -0
- package/es/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
- package/es/plus/productSelect/components/IntersectionObserver.js +276 -0
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.js +357 -0
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
- package/es/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
- package/es/plus/productSelect/components/TabsStructure/hooks.js +243 -0
- package/es/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
- package/es/plus/productSelect/components/TabsStructure/index.js +13 -0
- package/es/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
- package/es/plus/productSelect/components/TabsStructure/styles.js +87 -0
- package/es/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
- package/es/plus/productSelect/components/TabsStructure/types.js +1 -0
- package/es/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
- package/es/plus/productSelect/components/TabsStructure/utils.js +56 -0
- package/es/plus/productSelect/components/pisellPriceText/index.d.ts +11 -0
- package/es/plus/productSelect/components/pisellPriceText/index.js +43 -0
- package/es/plus/productSelect/hooks/useToken.d.ts +18 -0
- package/es/plus/productSelect/hooks/useToken.js +34 -0
- package/es/plus/productSelect/index.d.ts +31 -0
- package/es/plus/productSelect/index.js +270 -0
- package/es/plus/productSelect/index.less +56 -0
- package/es/plus/productSelect/locales.d.ts +18 -0
- package/es/plus/productSelect/locales.js +17 -0
- package/es/plus/productSelect/theme/token.d.ts +17 -0
- package/es/plus/productSelect/theme/token.js +19 -0
- package/es/plus/productSelect/utils.d.ts +39 -0
- package/es/plus/productSelect/utils.js +162 -0
- package/es/pro/pisellNumberSelector/index.js +3 -3
- package/es/pro/pisellPhoneKeyboard/index.js +1 -1
- package/es/utils/index.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Content/index.js +1 -1
- package/lib/components/appointmentBooking/components/Content/index.less +3 -3
- package/lib/components/appointmentBooking/components/Services/index.js +2 -2
- package/lib/components/appointmentBooking/index.js +6 -1
- package/lib/components/booking/components/voucher/index.js +5 -0
- package/lib/components/booking/deposit/ClientItem/index.js +1 -1
- package/lib/components/booking/deposit/DepositItem/index.js +1 -1
- package/lib/components/booking/forms/single/RenderValueById.d.ts +1 -0
- package/lib/components/booking/forms/single/RenderValueById.js +37 -9
- package/lib/components/booking/forms/single/index.less +67 -1
- package/lib/components/booking/hooks/useQuotation.js +1 -1
- package/lib/components/booking/info/clientVariant/utils.d.ts +2 -0
- package/lib/components/booking/info/clientVariant/utils.js +13 -2
- package/lib/components/booking/info/clientVariant/vertical/index.js +7 -6
- package/lib/components/booking/info2/service/addService/utils.js +3 -3
- package/lib/components/booking/info2/service/addTimeModal/index.js +0 -1
- package/lib/components/booking/info2/service/editService/index.js +22 -12
- package/lib/components/booking/info2/utilsByBooking.js +7 -8
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +6 -3
- package/lib/components/booking/materiels/duration/index.js +1 -1
- package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
- package/lib/components/booking/materiels/startTime/index.js +1 -1
- package/lib/components/booking/utils.js +3 -3
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/eventBooking/index.js +6 -1
- package/lib/components/productSelect/components/TabProduct/index.js +7 -1
- package/lib/components/schedules/utils.d.ts +1 -1
- package/lib/components/shoppingCart/components/Cart/Product.js +7 -4
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +87 -14
- package/lib/components/ticketBooking/components/timeBar/index.js +89 -70
- package/lib/components/ticketBooking/utils/index.d.ts +3 -1
- package/lib/components/ticketBooking/utils/index.js +21 -0
- package/lib/hooks/useWindowSize.js +6 -1
- package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
- package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.js +62 -0
- package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
- package/lib/plus/productSelect/CategoryTabs/index.d.ts +18 -0
- package/lib/plus/productSelect/CategoryTabs/index.js +183 -0
- package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
- package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.js +58 -0
- package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
- package/lib/plus/productSelect/ProductCard/index.d.ts +45 -0
- package/lib/plus/productSelect/ProductCard/index.js +184 -0
- package/lib/plus/productSelect/ProductCard/index.less +270 -0
- package/lib/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
- package/lib/plus/productSelect/ProductList/gridComponents.js +148 -0
- package/lib/plus/productSelect/ProductList/index.d.ts +22 -0
- package/lib/plus/productSelect/ProductList/index.js +86 -0
- package/lib/plus/productSelect/ProductList/index.less +0 -0
- package/lib/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
- package/lib/plus/productSelect/components/IntersectionObserver.js +269 -0
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.js +393 -0
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
- package/lib/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
- package/lib/plus/productSelect/components/TabsStructure/hooks.js +209 -0
- package/lib/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
- package/lib/plus/productSelect/components/TabsStructure/index.js +92 -0
- package/lib/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
- package/lib/plus/productSelect/components/TabsStructure/styles.js +122 -0
- package/lib/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
- package/lib/plus/productSelect/components/TabsStructure/types.js +17 -0
- package/lib/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
- package/lib/plus/productSelect/components/TabsStructure/utils.js +72 -0
- package/lib/plus/productSelect/components/pisellPriceText/index.d.ts +11 -0
- package/lib/plus/productSelect/components/pisellPriceText/index.js +72 -0
- package/lib/plus/productSelect/hooks/useToken.d.ts +18 -0
- package/lib/plus/productSelect/hooks/useToken.js +50 -0
- package/lib/plus/productSelect/index.d.ts +31 -0
- package/lib/plus/productSelect/index.js +299 -0
- package/lib/plus/productSelect/index.less +56 -0
- package/lib/plus/productSelect/locales.d.ts +18 -0
- package/lib/plus/productSelect/locales.js +41 -0
- package/lib/plus/productSelect/theme/token.d.ts +17 -0
- package/lib/plus/productSelect/theme/token.js +47 -0
- package/lib/plus/productSelect/utils.d.ts +39 -0
- package/lib/plus/productSelect/utils.js +138 -0
- package/lib/pro/pisellNumberSelector/index.js +3 -3
- package/lib/pro/pisellPhoneKeyboard/index.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/package.json +4 -4
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface IProps {
|
3
|
+
value: string | number;
|
4
|
+
isMini?: boolean;
|
5
|
+
className?: string;
|
6
|
+
style?: React.CSSProperties;
|
7
|
+
prefix?: React.ReactElement;
|
8
|
+
suffix?: React.ReactElement;
|
9
|
+
}
|
10
|
+
declare const index: (props: IProps) => JSX.Element;
|
11
|
+
export default index;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
|
29
|
+
// src/plus/productSelect/components/pisellPriceText/index.tsx
|
30
|
+
var pisellPriceText_exports = {};
|
31
|
+
__export(pisellPriceText_exports, {
|
32
|
+
default: () => pisellPriceText_default
|
33
|
+
});
|
34
|
+
module.exports = __toCommonJS(pisellPriceText_exports);
|
35
|
+
var import_react = __toESM(require("react"));
|
36
|
+
var import_materials = require("@pisell/materials");
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
38
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
39
|
+
var index = (props) => {
|
40
|
+
var _a, _b;
|
41
|
+
const context = (0, import_useEngineContext.default)();
|
42
|
+
const { value } = props;
|
43
|
+
const locale = ((_b = (_a = context.appHelper.utils) == null ? void 0 : _a.storage) == null ? void 0 : _b.get("umi_locale")) || "en";
|
44
|
+
const [_prefix, _suffix] = (0, import_react.useMemo)(() => {
|
45
|
+
if (!props.isMini) return ["", ""];
|
46
|
+
if (!locale) return ["From", ""];
|
47
|
+
if (locale.toLowerCase().includes("zh")) return ["", "起"];
|
48
|
+
return ["From", ""];
|
49
|
+
}, [locale, props.isMini]);
|
50
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-price-text", props.className) }, props.prefix, _prefix ? /* @__PURE__ */ import_react.default.createElement(
|
51
|
+
"span",
|
52
|
+
{
|
53
|
+
className: "pisell-price-text-prefix-text",
|
54
|
+
style: {
|
55
|
+
fontSize: "0.65em",
|
56
|
+
marginRight: 4
|
57
|
+
}
|
58
|
+
},
|
59
|
+
_prefix
|
60
|
+
) : null, /* @__PURE__ */ import_react.default.createElement(import_materials.PisellText.Amount, { value }), _suffix ? /* @__PURE__ */ import_react.default.createElement(
|
61
|
+
"span",
|
62
|
+
{
|
63
|
+
style: {
|
64
|
+
fontSize: "0.65em",
|
65
|
+
marginLeft: 4
|
66
|
+
},
|
67
|
+
className: "pisell-price-text-suffix-text"
|
68
|
+
},
|
69
|
+
_suffix
|
70
|
+
) : null, props.suffix);
|
71
|
+
};
|
72
|
+
var pisellPriceText_default = index;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ProductSelectToken } from '../theme/token';
|
2
|
+
export declare function useToken(customToken?: Partial<ProductSelectToken>): {
|
3
|
+
colorPrimary: string;
|
4
|
+
colorText: string;
|
5
|
+
colorTextSecondary: string;
|
6
|
+
searchInputColor: string;
|
7
|
+
containerBg: string;
|
8
|
+
tabItemBg: string;
|
9
|
+
tabItemHoverBg: string;
|
10
|
+
tabItemActiveBg: string;
|
11
|
+
categoryTextColor: string;
|
12
|
+
cardBg: string;
|
13
|
+
cardHoverBg: string;
|
14
|
+
cardSelectedBg: string;
|
15
|
+
cardSelectedTextColor: string;
|
16
|
+
cardSelectedSecondaryTextColor: string;
|
17
|
+
};
|
18
|
+
export declare function genCSSVars(token: ProductSelectToken): Record<string, string>;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
|
19
|
+
// src/plus/productSelect/hooks/useToken.ts
|
20
|
+
var useToken_exports = {};
|
21
|
+
__export(useToken_exports, {
|
22
|
+
genCSSVars: () => genCSSVars,
|
23
|
+
useToken: () => useToken
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(useToken_exports);
|
26
|
+
var import_react = require("react");
|
27
|
+
var import_token = require("../theme/token");
|
28
|
+
function useToken(customToken) {
|
29
|
+
return (0, import_react.useMemo)(() => {
|
30
|
+
let contextToken = null;
|
31
|
+
return {
|
32
|
+
...import_token.defaultToken,
|
33
|
+
...contextToken || {},
|
34
|
+
...customToken || {}
|
35
|
+
};
|
36
|
+
}, [customToken]);
|
37
|
+
}
|
38
|
+
function genCSSVars(token) {
|
39
|
+
const cssVars = {};
|
40
|
+
Object.entries(token).forEach(([key, value]) => {
|
41
|
+
const cssKey = `--ps-${key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}`;
|
42
|
+
cssVars[cssKey] = value;
|
43
|
+
});
|
44
|
+
return cssVars;
|
45
|
+
}
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
47
|
+
0 && (module.exports = {
|
48
|
+
genCSSVars,
|
49
|
+
useToken
|
50
|
+
});
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './index.less';
|
3
|
+
interface ProductSelectProps {
|
4
|
+
dataSource: any[];
|
5
|
+
showSearch?: boolean;
|
6
|
+
showTab?: boolean;
|
7
|
+
layout?: {
|
8
|
+
grid: boolean;
|
9
|
+
config: string;
|
10
|
+
};
|
11
|
+
onChange: (value: any) => void;
|
12
|
+
value?: number;
|
13
|
+
loading?: boolean;
|
14
|
+
style?: React.CSSProperties;
|
15
|
+
emptyDescription?: string;
|
16
|
+
/** 当前滚动元素 */
|
17
|
+
scrollDom?: string;
|
18
|
+
/** 商品列表上方的其它组件 */
|
19
|
+
offsetDom?: any;
|
20
|
+
/** 样式变量 */
|
21
|
+
token?: Partial<any>;
|
22
|
+
/** 后台装修单选模式下的已选中项 */
|
23
|
+
selectedItems?: Array<any>;
|
24
|
+
/** 后台装修配置 */
|
25
|
+
productListSetting?: Partial<any>;
|
26
|
+
/** 兼容scrollDom */
|
27
|
+
customScrollParent?: HTMLElement | string;
|
28
|
+
}
|
29
|
+
export declare const PREFIX = "pisell-product-select";
|
30
|
+
declare const index: ({ dataSource, emptyDescription, showSearch, scrollDom, offsetDom, style, token: customToken, onChange, value, selectedItems, productListSetting, customScrollParent, loading, layout, ...rest }: ProductSelectProps) => JSX.Element;
|
31
|
+
export default index;
|
@@ -0,0 +1,299 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
|
29
|
+
// src/plus/productSelect/index.tsx
|
30
|
+
var productSelect_exports = {};
|
31
|
+
__export(productSelect_exports, {
|
32
|
+
PREFIX: () => PREFIX,
|
33
|
+
default: () => productSelect_default
|
34
|
+
});
|
35
|
+
module.exports = __toCommonJS(productSelect_exports);
|
36
|
+
var import_react = __toESM(require("react"));
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
38
|
+
var import_materials = require("@pisell/materials");
|
39
|
+
var import_utils = require("@pisell/utils");
|
40
|
+
var import_SearchLg = __toESM(require("@pisell/icon/es/SearchLg"));
|
41
|
+
var import_CategoryTabs = __toESM(require("./CategoryTabs"));
|
42
|
+
var import_ProductList = __toESM(require("./ProductList"));
|
43
|
+
var import_useToken = require("./hooks/useToken");
|
44
|
+
var import_utils2 = require("./utils");
|
45
|
+
var import_IntersectionObserver = __toESM(require("./components/IntersectionObserver"));
|
46
|
+
var import_ProductCard = __toESM(require("./ProductCard"));
|
47
|
+
var import_locales = __toESM(require("./locales"));
|
48
|
+
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
49
|
+
var import_materials2 = require("@pisell/materials");
|
50
|
+
var import_index = require("./index.less");
|
51
|
+
var MOCK_DATA = (() => {
|
52
|
+
const mockData = [];
|
53
|
+
mockData.push({
|
54
|
+
__typename: "category",
|
55
|
+
id: "_c1_1"
|
56
|
+
});
|
57
|
+
for (let productIndex = 0; productIndex < 4; productIndex++) {
|
58
|
+
mockData.push({
|
59
|
+
__typename: "product",
|
60
|
+
id: "_pi" + productIndex
|
61
|
+
});
|
62
|
+
}
|
63
|
+
return mockData;
|
64
|
+
})();
|
65
|
+
var PREFIX = "pisell-product-select";
|
66
|
+
var CONTAINER_CLASS = `${PREFIX}-wrapper`;
|
67
|
+
var index = ({
|
68
|
+
dataSource = [],
|
69
|
+
emptyDescription,
|
70
|
+
showSearch = true,
|
71
|
+
scrollDom,
|
72
|
+
offsetDom,
|
73
|
+
style = {},
|
74
|
+
token: customToken,
|
75
|
+
onChange,
|
76
|
+
value,
|
77
|
+
selectedItems,
|
78
|
+
productListSetting = {},
|
79
|
+
customScrollParent,
|
80
|
+
loading = false,
|
81
|
+
layout,
|
82
|
+
...rest
|
83
|
+
}) => {
|
84
|
+
const searchRef = (0, import_react.useRef)(null);
|
85
|
+
const [keyword, setKeyword] = (0, import_react.useState)("");
|
86
|
+
const [activeKey, setActiveKey] = (0, import_react.useState)("");
|
87
|
+
const [scrollParent, setScrollParent] = (0, import_react.useState)(null);
|
88
|
+
const isIndicatorVisibleRef = (0, import_react.useRef)(false);
|
89
|
+
const containerRef = (0, import_react.useRef)(null);
|
90
|
+
const _customScrollParent = customScrollParent || scrollDom;
|
91
|
+
const gridComponents = (0, import_react.useMemo)(() => {
|
92
|
+
return (0, import_ProductList.createGridComponents)(layout);
|
93
|
+
}, [layout]);
|
94
|
+
const context = (0, import_useEngineContext.default)();
|
95
|
+
(0, import_react.useEffect)(() => {
|
96
|
+
var _a, _b;
|
97
|
+
import_utils.locales.init(
|
98
|
+
import_locales.default,
|
99
|
+
((_b = (_a = context.appHelper.utils) == null ? void 0 : _a.storage) == null ? void 0 : _b.get("umi_locale")) || "en"
|
100
|
+
);
|
101
|
+
}, []);
|
102
|
+
const _filteredList = (0, import_react.useMemo)(() => {
|
103
|
+
if (!keyword) return dataSource;
|
104
|
+
return dataSource.filter((product) => {
|
105
|
+
if (typeof (product == null ? void 0 : product.title) !== "string") return false;
|
106
|
+
return product.title.toLowerCase().indexOf(keyword.toLowerCase()) !== -1;
|
107
|
+
});
|
108
|
+
}, [keyword, dataSource]);
|
109
|
+
const _groupedList = (0, import_react.useMemo)(() => {
|
110
|
+
let _list = _filteredList || [];
|
111
|
+
return (0, import_utils2.groupProductsByCategory)(_list);
|
112
|
+
}, [_filteredList]);
|
113
|
+
const _categories = (0, import_react.useMemo)(() => {
|
114
|
+
return _groupedList.filter((item) => item.__typename === "category").map((item) => {
|
115
|
+
return {
|
116
|
+
...item,
|
117
|
+
key: String(item.id),
|
118
|
+
label: item.name
|
119
|
+
};
|
120
|
+
});
|
121
|
+
}, [_groupedList]);
|
122
|
+
(0, import_react.useEffect)(() => {
|
123
|
+
if (!(_categories == null ? void 0 : _categories.length)) {
|
124
|
+
setActiveKey("");
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
if (!activeKey) {
|
128
|
+
switchCategory(_categories[0].key);
|
129
|
+
} else {
|
130
|
+
const found = _categories.find((category) => category.key === activeKey);
|
131
|
+
if (!found) switchCategory(_categories[0].key);
|
132
|
+
}
|
133
|
+
}, [_categories]);
|
134
|
+
(0, import_react.useLayoutEffect)(() => {
|
135
|
+
if (_customScrollParent) {
|
136
|
+
const sp = (0, import_utils2.getElementByIdentifier)(_customScrollParent);
|
137
|
+
setScrollParent(sp);
|
138
|
+
}
|
139
|
+
}, [_customScrollParent]);
|
140
|
+
const token = (0, import_useToken.useToken)(customToken);
|
141
|
+
const cssVars = (0, import_react.useMemo)(() => (0, import_useToken.genCSSVars)(token), [token]);
|
142
|
+
const mergedStyle = (0, import_react.useMemo)(() => {
|
143
|
+
const baseStyle = {
|
144
|
+
...cssVars,
|
145
|
+
...style
|
146
|
+
};
|
147
|
+
if (!scrollParent) return baseStyle;
|
148
|
+
if (scrollParent !== containerRef.current) {
|
149
|
+
return {
|
150
|
+
...baseStyle,
|
151
|
+
overflow: "unset",
|
152
|
+
height: "unset"
|
153
|
+
};
|
154
|
+
}
|
155
|
+
return baseStyle;
|
156
|
+
}, [cssVars, style, scrollParent]);
|
157
|
+
const disabled = (0, import_react.useMemo)(() => {
|
158
|
+
return !!(productListSetting == null ? void 0 : productListSetting.list_max_length) && Array.isArray(selectedItems) && (selectedItems == null ? void 0 : selectedItems.length) > 0;
|
159
|
+
}, [productListSetting, selectedItems]);
|
160
|
+
const _onChange = (0, import_react.useCallback)(
|
161
|
+
(value2) => {
|
162
|
+
if (disabled) return;
|
163
|
+
onChange == null ? void 0 : onChange(value2);
|
164
|
+
},
|
165
|
+
[disabled, onChange]
|
166
|
+
);
|
167
|
+
const debounceIndicator = (0, import_react.useCallback)((delay) => {
|
168
|
+
isIndicatorVisibleRef.current = true;
|
169
|
+
const timeoutId = setTimeout(() => {
|
170
|
+
isIndicatorVisibleRef.current = false;
|
171
|
+
}, delay);
|
172
|
+
return () => clearTimeout(timeoutId);
|
173
|
+
}, []);
|
174
|
+
const lastActiveKeyRef = (0, import_react.useRef)("");
|
175
|
+
const handleItemIntersectionIn = (0, import_react.useCallback)((item) => {
|
176
|
+
const _key = String(item.__categoryId);
|
177
|
+
if (!isIndicatorVisibleRef.current && _key && _key !== lastActiveKeyRef.current) {
|
178
|
+
setActiveKey(_key);
|
179
|
+
lastActiveKeyRef.current = _key;
|
180
|
+
}
|
181
|
+
}, []);
|
182
|
+
const switchCategory = (key) => {
|
183
|
+
setActiveKey(key);
|
184
|
+
lastActiveKeyRef.current = key;
|
185
|
+
debounceIndicator(300);
|
186
|
+
const categoryIndex = _groupedList.findIndex(
|
187
|
+
(item) => item.__typename === "category" && String(item.id) === key
|
188
|
+
);
|
189
|
+
const _scrollParent = scrollParent || containerRef.current;
|
190
|
+
if (!_scrollParent || !containerRef.current) return;
|
191
|
+
const target = document.getElementById(`ps_category_${key}`);
|
192
|
+
if (!target) return;
|
193
|
+
const productSelectWrapper = document.querySelector(
|
194
|
+
`.${PREFIX}-wrapper`
|
195
|
+
);
|
196
|
+
const tabsWrapper = document.querySelector(`.${PREFIX}__tabs-wrapper`);
|
197
|
+
const tabsHeight = (tabsWrapper == null ? void 0 : tabsWrapper.offsetHeight) || 0;
|
198
|
+
const offsetElement = (0, import_utils2.getElementByIdentifier)(offsetDom);
|
199
|
+
const extraOffset = offsetElement ? offsetElement.clientHeight : 0;
|
200
|
+
if (categoryIndex === 0) {
|
201
|
+
if (productSelectWrapper) {
|
202
|
+
const wrapperOffsetTop = (0, import_utils2.getOffsetTopRelativeToScrollContainer)(
|
203
|
+
productSelectWrapper,
|
204
|
+
_scrollParent
|
205
|
+
);
|
206
|
+
_scrollParent.scrollTop = wrapperOffsetTop - extraOffset;
|
207
|
+
}
|
208
|
+
return;
|
209
|
+
} else {
|
210
|
+
const listOffsetTop = (0, import_utils2.getOffsetTopRelativeToScrollContainer)(
|
211
|
+
target,
|
212
|
+
_scrollParent
|
213
|
+
);
|
214
|
+
_scrollParent.scrollTop = listOffsetTop - tabsHeight - extraOffset;
|
215
|
+
}
|
216
|
+
};
|
217
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
218
|
+
"div",
|
219
|
+
{
|
220
|
+
ref: containerRef,
|
221
|
+
className: (0, import_classnames.default)(PREFIX, CONTAINER_CLASS, {
|
222
|
+
disabled
|
223
|
+
}),
|
224
|
+
style: mergedStyle
|
225
|
+
},
|
226
|
+
showSearch ? /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__search-wrapper` }, /* @__PURE__ */ import_react.default.createElement(
|
227
|
+
import_materials.Input,
|
228
|
+
{
|
229
|
+
ref: searchRef,
|
230
|
+
prefix: /* @__PURE__ */ import_react.default.createElement(import_SearchLg.default, null),
|
231
|
+
style: { height: 44 },
|
232
|
+
placeholder: import_utils.locales.getText("pisell2.product-select.search"),
|
233
|
+
allowClear: true,
|
234
|
+
value: keyword,
|
235
|
+
onChange: (e) => {
|
236
|
+
setKeyword(e.target.value);
|
237
|
+
}
|
238
|
+
}
|
239
|
+
)) : null,
|
240
|
+
/* @__PURE__ */ import_react.default.createElement(
|
241
|
+
import_CategoryTabs.default,
|
242
|
+
{
|
243
|
+
activeKey,
|
244
|
+
items: _categories,
|
245
|
+
onChange: switchCategory,
|
246
|
+
loading,
|
247
|
+
skeleton: /* @__PURE__ */ import_react.default.createElement(import_CategoryTabs.CategorySkeleton, null)
|
248
|
+
}
|
249
|
+
),
|
250
|
+
!loading && !(_groupedList == null ? void 0 : _groupedList.length) ? /* @__PURE__ */ import_react.default.createElement(
|
251
|
+
import_materials2.PisellEmpty,
|
252
|
+
{
|
253
|
+
description: emptyDescription || import_utils.locales.getText("pisell2.product-select.empty")
|
254
|
+
}
|
255
|
+
) : /* @__PURE__ */ import_react.default.createElement(
|
256
|
+
import_IntersectionObserver.default,
|
257
|
+
{
|
258
|
+
rootMargin: "-270px 0px -270px 0px",
|
259
|
+
priorityMode: "top"
|
260
|
+
},
|
261
|
+
/* @__PURE__ */ import_react.default.createElement(
|
262
|
+
import_ProductList.default,
|
263
|
+
{
|
264
|
+
className: `${PREFIX}__product-list`,
|
265
|
+
loading,
|
266
|
+
data: loading ? MOCK_DATA : _groupedList,
|
267
|
+
context: {
|
268
|
+
onItemIntersectionIn: handleItemIntersectionIn,
|
269
|
+
onItemIntersectionOut: () => {
|
270
|
+
}
|
271
|
+
},
|
272
|
+
_customScrollParent: scrollParent,
|
273
|
+
components: gridComponents,
|
274
|
+
itemContent: (index2, item, context2) => {
|
275
|
+
if (loading) {
|
276
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ProductCard.ProductCardSkeleton, { index: index2, item });
|
277
|
+
}
|
278
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
279
|
+
import_ProductCard.default,
|
280
|
+
{
|
281
|
+
index: index2,
|
282
|
+
item,
|
283
|
+
context: context2,
|
284
|
+
onSelect: _onChange,
|
285
|
+
isSelected: item.id === value,
|
286
|
+
decorateConfig: productListSetting
|
287
|
+
}
|
288
|
+
);
|
289
|
+
}
|
290
|
+
}
|
291
|
+
)
|
292
|
+
)
|
293
|
+
);
|
294
|
+
};
|
295
|
+
var productSelect_default = index;
|
296
|
+
// Annotate the CommonJS export names for ESM import in node:
|
297
|
+
0 && (module.exports = {
|
298
|
+
PREFIX
|
299
|
+
});
|
@@ -0,0 +1,56 @@
|
|
1
|
+
.pisell-product-select {
|
2
|
+
&-wrapper {
|
3
|
+
height: 100%;
|
4
|
+
background: var(--ps-container-bg, #ffffff);
|
5
|
+
overflow-y: auto;
|
6
|
+
|
7
|
+
&::-webkit-scrollbar {
|
8
|
+
display: none !important;
|
9
|
+
}
|
10
|
+
|
11
|
+
&.disabled {
|
12
|
+
.pisell-product-select__product-card {
|
13
|
+
background: var(--ps-card-hover-bg, #eaecf0);
|
14
|
+
cursor: not-allowed;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
&__search-wrapper {
|
20
|
+
padding: 12px 12px 0px;
|
21
|
+
line-height: 0;
|
22
|
+
margin-top: 0 !important;
|
23
|
+
|
24
|
+
.pisell-lowcode-input-affix-wrapper {
|
25
|
+
&:hover,
|
26
|
+
&:focus,
|
27
|
+
&:focus-within {
|
28
|
+
border-color: var(--ps-color-primary, #8157d5) !important;
|
29
|
+
box-shadow: none !important;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
> span {
|
34
|
+
background: var(--ps-container-bg, #ffffff);
|
35
|
+
color: var(--ps-search-input-color, #98a2b3);
|
36
|
+
}
|
37
|
+
|
38
|
+
input {
|
39
|
+
background: transparent;
|
40
|
+
color: var(--ps-search-input-color, #98a2b3);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
&__product-list {
|
45
|
+
padding: 0px 12px 12px;
|
46
|
+
}
|
47
|
+
|
48
|
+
&__tabs-wrapper {
|
49
|
+
position: sticky;
|
50
|
+
top: 0;
|
51
|
+
z-index: 10;
|
52
|
+
// 基础样式采用原pill样式
|
53
|
+
padding: 16px 12px;
|
54
|
+
background: var(--ps-container-bg, #fff);
|
55
|
+
}
|
56
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
en: {
|
3
|
+
'pisell2.product-select.search': string;
|
4
|
+
'pisell2.product-select.stock': string;
|
5
|
+
'pisell2.product-select.empty': string;
|
6
|
+
};
|
7
|
+
'zh-CN': {
|
8
|
+
'pisell2.product-select.search': string;
|
9
|
+
'pisell2.product-select.stock': string;
|
10
|
+
'pisell2.product-select.empty': string;
|
11
|
+
};
|
12
|
+
'zh-HK': {
|
13
|
+
'pisell2.product-select.search': string;
|
14
|
+
'pisell2.product-select.stock': string;
|
15
|
+
'pisell2.product-select.empty': string;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export default _default;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
|
19
|
+
// src/plus/productSelect/locales.ts
|
20
|
+
var locales_exports = {};
|
21
|
+
__export(locales_exports, {
|
22
|
+
default: () => locales_default
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(locales_exports);
|
25
|
+
var locales_default = {
|
26
|
+
en: {
|
27
|
+
"pisell2.product-select.search": "Search",
|
28
|
+
"pisell2.product-select.stock": "Stock",
|
29
|
+
"pisell2.product-select.empty": "No Data"
|
30
|
+
},
|
31
|
+
"zh-CN": {
|
32
|
+
"pisell2.product-select.search": "搜索",
|
33
|
+
"pisell2.product-select.stock": "库存",
|
34
|
+
"pisell2.product-select.empty": "暂无数据"
|
35
|
+
},
|
36
|
+
"zh-HK": {
|
37
|
+
"pisell2.product-select.search": "搜索",
|
38
|
+
"pisell2.product-select.stock": "庫存",
|
39
|
+
"pisell2.product-select.empty": "暂无数据"
|
40
|
+
}
|
41
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export interface ProductSelectToken {
|
2
|
+
colorPrimary: string;
|
3
|
+
colorText: string;
|
4
|
+
colorTextSecondary: string;
|
5
|
+
searchInputColor: string;
|
6
|
+
containerBg: string;
|
7
|
+
tabItemBg: string;
|
8
|
+
tabItemHoverBg: string;
|
9
|
+
tabItemActiveBg: string;
|
10
|
+
categoryTextColor: string;
|
11
|
+
cardBg: string;
|
12
|
+
cardHoverBg: string;
|
13
|
+
cardSelectedBg: string;
|
14
|
+
cardSelectedTextColor: string;
|
15
|
+
cardSelectedSecondaryTextColor: string;
|
16
|
+
}
|
17
|
+
export declare const defaultToken: ProductSelectToken;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
|
19
|
+
// src/plus/productSelect/theme/token.ts
|
20
|
+
var token_exports = {};
|
21
|
+
__export(token_exports, {
|
22
|
+
defaultToken: () => defaultToken
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(token_exports);
|
25
|
+
var defaultToken = {
|
26
|
+
colorPrimary: "#8157D5",
|
27
|
+
colorText: "#1B1B1B",
|
28
|
+
colorTextSecondary: "#4E4E4E",
|
29
|
+
containerBg: "#4E4E4E",
|
30
|
+
// search
|
31
|
+
searchInputColor: "#98a2b3",
|
32
|
+
// tab
|
33
|
+
tabItemBg: "#FFFFFF",
|
34
|
+
tabItemHoverBg: "#FFFFFF",
|
35
|
+
tabItemActiveBg: "#8157D5",
|
36
|
+
// category
|
37
|
+
categoryTextColor: "#FFFFFF",
|
38
|
+
cardBg: "#FFFFFF",
|
39
|
+
cardHoverBg: "#eaecf0",
|
40
|
+
cardSelectedBg: "#8157D5",
|
41
|
+
cardSelectedTextColor: "#ffffff",
|
42
|
+
cardSelectedSecondaryTextColor: "rgba(255, 255, 255, 0.7)"
|
43
|
+
};
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
45
|
+
0 && (module.exports = {
|
46
|
+
defaultToken
|
47
|
+
});
|