@pisell/private-materials 3.4.16 → 3.4.18
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 +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- 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/info2/service/addTimeModal/index.js +0 -1
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/eventBooking/index.js +8 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +3 -3
- package/es/hooks/useWindowSize.js +8 -1
- package/es/index.d.ts +3 -0
- package/es/index.js +4 -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 +253 -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 +12 -0
- package/es/plus/productSelect/components/pisellPriceText/index.js +44 -0
- package/es/plus/productSelect/components/pisellPriceText/index.less +4 -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/plus/saasCreateOrganization/components/Header.d.ts +3 -0
- package/es/plus/saasCreateOrganization/components/Header.js +62 -0
- package/es/plus/saasCreateOrganization/index.d.ts +4 -0
- package/es/plus/saasCreateOrganization/index.js +15 -0
- package/es/plus/saasCreateOrganization/index.less +55 -0
- package/es/plus/saasCreateOrganization/locales.d.ts +15 -0
- package/es/plus/saasCreateOrganization/locales.js +14 -0
- package/es/plus/saasCreateOrganization/types.d.ts +69 -0
- package/es/plus/saasCreateOrganization/types.js +1 -0
- package/es/plus/saasLogin/index.d.ts +5 -0
- package/es/plus/saasLogin/index.js +165 -0
- package/es/plus/saasLogin/index.less +136 -0
- package/es/plus/saasLogin/locales.d.ts +51 -0
- package/es/plus/saasLogin/locales.js +50 -0
- package/es/plus/saasLogin/types.d.ts +62 -0
- package/es/plus/saasLogin/types.js +1 -0
- package/es/plus/saasLogin/utils.d.ts +35 -0
- package/es/plus/saasLogin/utils.js +31 -0
- package/es/plus/saasRegister/components/EntryEmail.d.ts +9 -0
- package/es/plus/saasRegister/components/EntryEmail.js +92 -0
- package/es/plus/saasRegister/components/EntryInfo.d.ts +9 -0
- package/es/plus/saasRegister/components/EntryInfo.js +145 -0
- package/es/plus/saasRegister/components/GoLogin.d.ts +4 -0
- package/es/plus/saasRegister/components/GoLogin.js +27 -0
- package/es/plus/saasRegister/components/Header.d.ts +3 -0
- package/es/plus/saasRegister/components/Header.js +62 -0
- package/es/plus/saasRegister/components/VerifyError.d.ts +8 -0
- package/es/plus/saasRegister/components/VerifyError.js +68 -0
- package/es/plus/saasRegister/components/VerifyingLink.d.ts +5 -0
- package/es/plus/saasRegister/components/VerifyingLink.js +16 -0
- package/es/plus/saasRegister/components/VertifyEmail.d.ts +7 -0
- package/es/plus/saasRegister/components/VertifyEmail.js +121 -0
- package/es/plus/saasRegister/index.d.ts +5 -0
- package/es/plus/saasRegister/index.js +246 -0
- package/es/plus/saasRegister/index.less +218 -0
- package/es/plus/saasRegister/locales.d.ts +117 -0
- package/es/plus/saasRegister/locales.js +116 -0
- package/es/plus/saasRegister/types.d.ts +114 -0
- package/es/plus/saasRegister/types.js +24 -0
- 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/info2/service/addTimeModal/index.js +0 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/eventBooking/index.js +6 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +3 -3
- package/lib/hooks/useWindowSize.js +6 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +9 -0
- 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 +253 -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 +12 -0
- package/lib/plus/productSelect/components/pisellPriceText/index.js +73 -0
- package/lib/plus/productSelect/components/pisellPriceText/index.less +4 -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/plus/saasCreateOrganization/components/Header.d.ts +3 -0
- package/lib/plus/saasCreateOrganization/components/Header.js +99 -0
- package/lib/plus/saasCreateOrganization/index.d.ts +4 -0
- package/lib/plus/saasCreateOrganization/index.js +47 -0
- package/lib/plus/saasCreateOrganization/index.less +55 -0
- package/lib/plus/saasCreateOrganization/locales.d.ts +15 -0
- package/lib/plus/saasCreateOrganization/locales.js +38 -0
- package/lib/plus/saasCreateOrganization/types.d.ts +69 -0
- package/lib/plus/saasCreateOrganization/types.js +17 -0
- package/lib/plus/saasLogin/index.d.ts +5 -0
- package/lib/plus/saasLogin/index.js +171 -0
- package/lib/plus/saasLogin/index.less +136 -0
- package/lib/plus/saasLogin/locales.d.ts +51 -0
- package/lib/plus/saasLogin/locales.js +74 -0
- package/lib/plus/saasLogin/types.d.ts +62 -0
- package/lib/plus/saasLogin/types.js +17 -0
- package/lib/plus/saasLogin/utils.d.ts +35 -0
- package/lib/plus/saasLogin/utils.js +50 -0
- package/lib/plus/saasRegister/components/EntryEmail.d.ts +9 -0
- package/lib/plus/saasRegister/components/EntryEmail.js +92 -0
- package/lib/plus/saasRegister/components/EntryInfo.d.ts +9 -0
- package/lib/plus/saasRegister/components/EntryInfo.js +128 -0
- package/lib/plus/saasRegister/components/GoLogin.d.ts +4 -0
- package/lib/plus/saasRegister/components/GoLogin.js +58 -0
- package/lib/plus/saasRegister/components/Header.d.ts +3 -0
- package/lib/plus/saasRegister/components/Header.js +99 -0
- package/lib/plus/saasRegister/components/VerifyError.d.ts +8 -0
- package/lib/plus/saasRegister/components/VerifyError.js +123 -0
- package/lib/plus/saasRegister/components/VerifyingLink.d.ts +5 -0
- package/lib/plus/saasRegister/components/VerifyingLink.js +44 -0
- package/lib/plus/saasRegister/components/VertifyEmail.d.ts +7 -0
- package/lib/plus/saasRegister/components/VertifyEmail.js +110 -0
- package/lib/plus/saasRegister/index.d.ts +5 -0
- package/lib/plus/saasRegister/index.js +205 -0
- package/lib/plus/saasRegister/index.less +218 -0
- package/lib/plus/saasRegister/locales.d.ts +117 -0
- package/lib/plus/saasRegister/locales.js +140 -0
- package/lib/plus/saasRegister/types.d.ts +114 -0
- package/lib/plus/saasRegister/types.js +54 -0
- package/lowcode/saas-create-organization/meta.ts +214 -0
- package/lowcode/saas-create-organization/snippets.ts +25 -0
- package/lowcode/saas-login/meta.ts +370 -0
- package/lowcode/saas-login/snippets.ts +38 -0
- package/lowcode/saas-register/meta.ts +386 -0
- package/lowcode/saas-register/snippets.ts +31 -0
- package/package.json +2 -2
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
interface Product {
|
|
2
|
+
id: number;
|
|
3
|
+
title: string;
|
|
4
|
+
sort?: number;
|
|
5
|
+
category: Array<{
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
sort: number;
|
|
11
|
+
}>;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
interface CategoryItem {
|
|
15
|
+
__typename: 'category';
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
sort: number;
|
|
21
|
+
}
|
|
22
|
+
interface ProductItem extends Product {
|
|
23
|
+
__typename?: 'product';
|
|
24
|
+
}
|
|
25
|
+
declare type ListItem = CategoryItem | ProductItem;
|
|
26
|
+
/**
|
|
27
|
+
* 按目录对商品进行分组,产出平级的数据结构用于虚拟列表渲染
|
|
28
|
+
* @param products 商品列表
|
|
29
|
+
* @returns 包含目录项和商品项的平级数组
|
|
30
|
+
*/
|
|
31
|
+
export declare function groupProductsByCategory(products: Product[]): ListItem[];
|
|
32
|
+
/**
|
|
33
|
+
* 根据传入的元素标识符获取DOM元素
|
|
34
|
+
* @param elementIdentifier 元素标识符,可以是HTMLElement、带'#'的id、带'.'的类名或CSS选择器
|
|
35
|
+
* @returns 找到的DOM元素或null
|
|
36
|
+
*/
|
|
37
|
+
export declare function getElementByIdentifier(elementIdentifier: HTMLElement | string | null | undefined): HTMLElement | null;
|
|
38
|
+
export declare const getOffsetTopRelativeToScrollContainer: (targetElement: HTMLElement, scrollContainer: HTMLElement) => number;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
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/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
getElementByIdentifier: () => getElementByIdentifier,
|
|
23
|
+
getOffsetTopRelativeToScrollContainer: () => getOffsetTopRelativeToScrollContainer,
|
|
24
|
+
groupProductsByCategory: () => groupProductsByCategory
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
var import_utils = require("@pisell/utils");
|
|
28
|
+
function groupProductsByCategory(products) {
|
|
29
|
+
if (!products || products.length === 0) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
33
|
+
const categoryProductsMap = /* @__PURE__ */ new Map();
|
|
34
|
+
const uncategorizedProducts = [];
|
|
35
|
+
products.forEach((product) => {
|
|
36
|
+
if (product.category && Array.isArray(product.category) && product.category.length > 0) {
|
|
37
|
+
product.category.forEach((cat) => {
|
|
38
|
+
if (!categoryMap.has(cat.id)) {
|
|
39
|
+
categoryMap.set(cat.id, {
|
|
40
|
+
__typename: "category",
|
|
41
|
+
id: cat.id,
|
|
42
|
+
name: cat.name,
|
|
43
|
+
icon: cat.icon,
|
|
44
|
+
slug: cat.slug,
|
|
45
|
+
sort: cat.sort
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!categoryProductsMap.has(cat.id)) {
|
|
49
|
+
categoryProductsMap.set(cat.id, []);
|
|
50
|
+
}
|
|
51
|
+
categoryProductsMap.get(cat.id).push({
|
|
52
|
+
...product,
|
|
53
|
+
__typename: "product",
|
|
54
|
+
__categoryId: cat.id
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
uncategorizedProducts.push({
|
|
59
|
+
...product,
|
|
60
|
+
__typename: "product",
|
|
61
|
+
__categoryId: 0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const sortedCategories = Array.from(categoryMap.values()).sort(
|
|
66
|
+
(a, b) => b.sort - a.sort
|
|
67
|
+
);
|
|
68
|
+
const result = [];
|
|
69
|
+
sortedCategories.forEach((category) => {
|
|
70
|
+
result.push(category);
|
|
71
|
+
const categoryProducts = categoryProductsMap.get(category.id) || [];
|
|
72
|
+
const sortedProducts = categoryProducts.sort((a, b) => {
|
|
73
|
+
const sortA = a.sort || 0;
|
|
74
|
+
const sortB = b.sort || 0;
|
|
75
|
+
return sortB - sortA;
|
|
76
|
+
});
|
|
77
|
+
result.push(...sortedProducts);
|
|
78
|
+
});
|
|
79
|
+
if (uncategorizedProducts.length > 0) {
|
|
80
|
+
const otherCategory = {
|
|
81
|
+
__typename: "category",
|
|
82
|
+
id: 0,
|
|
83
|
+
name: import_utils.locales.getText("pisell2.text.other"),
|
|
84
|
+
icon: "",
|
|
85
|
+
slug: "other",
|
|
86
|
+
sort: 99999999
|
|
87
|
+
// 确保other分组排在最后
|
|
88
|
+
};
|
|
89
|
+
result.push(otherCategory);
|
|
90
|
+
const sortedUncategorizedProducts = uncategorizedProducts.sort((a, b) => {
|
|
91
|
+
const sortA = a.sort || 0;
|
|
92
|
+
const sortB = b.sort || 0;
|
|
93
|
+
return sortB - sortA;
|
|
94
|
+
});
|
|
95
|
+
result.push(...sortedUncategorizedProducts);
|
|
96
|
+
}
|
|
97
|
+
console.log("xxxxxx", result);
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
function getElementByIdentifier(elementIdentifier) {
|
|
101
|
+
if (!elementIdentifier) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
if (elementIdentifier instanceof HTMLElement) {
|
|
105
|
+
return elementIdentifier;
|
|
106
|
+
}
|
|
107
|
+
if (typeof elementIdentifier === "string") {
|
|
108
|
+
if (elementIdentifier.startsWith("#")) {
|
|
109
|
+
return document.getElementById(elementIdentifier.slice(1));
|
|
110
|
+
}
|
|
111
|
+
if (elementIdentifier.startsWith(".")) {
|
|
112
|
+
return document.querySelector(elementIdentifier);
|
|
113
|
+
}
|
|
114
|
+
return document.querySelector(elementIdentifier);
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
var getOffsetTopRelativeToScrollContainer = (targetElement, scrollContainer) => {
|
|
119
|
+
if (!targetElement || !scrollContainer) return 0;
|
|
120
|
+
if (targetElement === scrollContainer) {
|
|
121
|
+
return 0;
|
|
122
|
+
}
|
|
123
|
+
const bodyTransform = getComputedStyle(document.body).transform;
|
|
124
|
+
let scaleY = 1;
|
|
125
|
+
if (bodyTransform !== "none") {
|
|
126
|
+
const matrix = new DOMMatrix(bodyTransform);
|
|
127
|
+
scaleY = matrix.d;
|
|
128
|
+
}
|
|
129
|
+
const targetRect = targetElement.getBoundingClientRect();
|
|
130
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
131
|
+
return targetRect.top / scaleY - containerRect.top / scaleY + scrollContainer.scrollTop;
|
|
132
|
+
};
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
getElementByIdentifier,
|
|
136
|
+
getOffsetTopRelativeToScrollContainer,
|
|
137
|
+
groupProductsByCategory
|
|
138
|
+
});
|