@pisell/private-materials 6.3.25 → 6.3.26
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/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/appointmentBooking/components/Services/index.js +22 -8
- package/es/plus/productSelect/ProductCard/index.d.ts +3 -1
- package/es/plus/productSelect/ProductCard/index.js +14 -5
- package/es/plus/productSelect/index.d.ts +3 -2
- package/es/plus/productSelect/index.js +33 -8
- package/es/plus/productSelect/index.less +4 -0
- package/lib/components/appointmentBooking/components/Services/index.js +8 -3
- package/lib/plus/productSelect/ProductCard/index.d.ts +3 -1
- package/lib/plus/productSelect/ProductCard/index.js +18 -4
- package/lib/plus/productSelect/index.d.ts +3 -2
- package/lib/plus/productSelect/index.js +20 -6
- package/lib/plus/productSelect/index.less +4 -0
- package/package.json +4 -4
|
@@ -69,8 +69,19 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
69
|
setProductLoading(false);
|
|
70
70
|
});
|
|
71
71
|
}, [isDateSelectedFirst]);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @description: 是否显示商品详情页面的步进器
|
|
75
|
+
* @param {*} useMemo
|
|
76
|
+
* @return {*}
|
|
77
|
+
*/
|
|
78
|
+
var isShowProductDetailStepper = useMemo(function () {
|
|
79
|
+
var _ref3 = (appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams) || {},
|
|
80
|
+
productModuleParams = _ref3.productModuleParams;
|
|
81
|
+
return productModuleParams === null || productModuleParams === void 0 ? void 0 : productModuleParams.isShowProductDetailStepper;
|
|
82
|
+
}, [appointmentBooking === null || appointmentBooking === void 0 ? void 0 : appointmentBooking.otherParams]);
|
|
72
83
|
var handleSelectProduct = /*#__PURE__*/function () {
|
|
73
|
-
var
|
|
84
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item, clickType) {
|
|
74
85
|
var type;
|
|
75
86
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
76
87
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -94,7 +105,9 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
94
105
|
open_deposit: 1
|
|
95
106
|
}),
|
|
96
107
|
setting: {
|
|
97
|
-
can_input: true
|
|
108
|
+
can_input: true,
|
|
109
|
+
item_max_length: isShowProductDetailStepper,
|
|
110
|
+
is_detail_open: clickType === 'cover'
|
|
98
111
|
}
|
|
99
112
|
},
|
|
100
113
|
callback: function () {
|
|
@@ -223,7 +236,7 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
223
236
|
}
|
|
224
237
|
}, _callee);
|
|
225
238
|
}));
|
|
226
|
-
function callback(
|
|
239
|
+
function callback(_x3) {
|
|
227
240
|
return _callback.apply(this, arguments);
|
|
228
241
|
}
|
|
229
242
|
return callback;
|
|
@@ -235,14 +248,14 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
235
248
|
}
|
|
236
249
|
}, _callee2);
|
|
237
250
|
}));
|
|
238
|
-
return function handleSelectProduct(_x) {
|
|
239
|
-
return
|
|
251
|
+
return function handleSelectProduct(_x, _x2) {
|
|
252
|
+
return _ref4.apply(this, arguments);
|
|
240
253
|
};
|
|
241
254
|
}();
|
|
242
255
|
var productListSetting = useMemo(function () {
|
|
243
256
|
var _context$engine, _productListBlock;
|
|
244
|
-
var
|
|
245
|
-
customPageData =
|
|
257
|
+
var _ref5 = ((_context$engine = context.engine) === null || _context$engine === void 0 ? void 0 : _context$engine.props) || {},
|
|
258
|
+
customPageData = _ref5.customPageData;
|
|
246
259
|
var productListBlock;
|
|
247
260
|
if (Array.isArray(customPageData === null || customPageData === void 0 ? void 0 : customPageData.block)) {
|
|
248
261
|
productListBlock = customPageData.block.find(function (b) {
|
|
@@ -274,7 +287,8 @@ var Services = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
274
287
|
cardSelectedBg: 'var(--theme-color)'
|
|
275
288
|
},
|
|
276
289
|
productListSetting: productListSetting,
|
|
277
|
-
selectedItems: carts
|
|
290
|
+
selectedItems: carts,
|
|
291
|
+
hideCategoryWhenOne: true
|
|
278
292
|
}));
|
|
279
293
|
});
|
|
280
294
|
export default Services;
|
|
@@ -29,10 +29,12 @@ export interface ProductCardProps {
|
|
|
29
29
|
onSelectProduct?: (item: any) => void;
|
|
30
30
|
currentProductId?: number;
|
|
31
31
|
onSelect?: (item: any) => void;
|
|
32
|
+
onSelectCover?: (item: any) => void;
|
|
33
|
+
onSelectInfo?: (item: any) => void;
|
|
32
34
|
isSelected?: boolean;
|
|
33
35
|
decorateConfig?: ProductCardConfig;
|
|
34
36
|
}
|
|
35
|
-
export declare const ProductCard: React.MemoExoticComponent<({ item, index, context, onSelect, isSelected, className, decorateConfig, }: ProductCardProps) => JSX.Element>;
|
|
37
|
+
export declare const ProductCard: React.MemoExoticComponent<({ item, index, context, onSelect, onSelectCover, onSelectInfo, isSelected, className, decorateConfig, }: ProductCardProps) => JSX.Element>;
|
|
36
38
|
export declare const DefaultItemContent: React.MemoExoticComponent<(props: {
|
|
37
39
|
item: any;
|
|
38
40
|
index: number;
|
|
@@ -42,6 +42,8 @@ export var ProductCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
42
42
|
index = _ref.index,
|
|
43
43
|
context = _ref.context,
|
|
44
44
|
onSelect = _ref.onSelect,
|
|
45
|
+
onSelectCover = _ref.onSelectCover,
|
|
46
|
+
onSelectInfo = _ref.onSelectInfo,
|
|
45
47
|
isSelected = _ref.isSelected,
|
|
46
48
|
className = _ref.className,
|
|
47
49
|
_ref$decorateConfig = _ref.decorateConfig,
|
|
@@ -116,10 +118,11 @@ export var ProductCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
116
118
|
var cardContent = /*#__PURE__*/React.createElement("div", {
|
|
117
119
|
className: classNames("".concat(PREFIX, "__product-card"), className, {
|
|
118
120
|
selected: isSelected
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
121
|
+
})
|
|
122
|
+
// onClick={() => {
|
|
123
|
+
// onSelect?.(item);
|
|
124
|
+
// }}
|
|
125
|
+
,
|
|
123
126
|
"data-index": index,
|
|
124
127
|
"data-item-index": index
|
|
125
128
|
}, isProductCover ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -127,6 +130,9 @@ export var ProductCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
127
130
|
style: {
|
|
128
131
|
width: imgWidth || 'auto',
|
|
129
132
|
height: imgHeight || 'auto'
|
|
133
|
+
},
|
|
134
|
+
onClick: function onClick() {
|
|
135
|
+
onSelectCover === null || onSelectCover === void 0 || onSelectCover(item);
|
|
130
136
|
}
|
|
131
137
|
}, item.cover ? /*#__PURE__*/React.createElement("img", {
|
|
132
138
|
loading: "lazy",
|
|
@@ -141,7 +147,10 @@ export var ProductCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
141
147
|
borderRadius: radius
|
|
142
148
|
}
|
|
143
149
|
}, getTextCover(item.title))) : null, /*#__PURE__*/React.createElement("div", {
|
|
144
|
-
className: "card-right"
|
|
150
|
+
className: "card-right",
|
|
151
|
+
onClick: function onClick() {
|
|
152
|
+
onSelectInfo === null || onSelectInfo === void 0 || onSelectInfo(item);
|
|
153
|
+
}
|
|
145
154
|
}, !!isTitle ? /*#__PURE__*/React.createElement("div", {
|
|
146
155
|
className: "title"
|
|
147
156
|
}, item.title) : null, !!isSubtitle && item.subtitle ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -8,7 +8,7 @@ interface ProductSelectProps {
|
|
|
8
8
|
grid: boolean;
|
|
9
9
|
config: string;
|
|
10
10
|
};
|
|
11
|
-
onChange: (value: any) => void;
|
|
11
|
+
onChange: (value: any, type?: string) => void;
|
|
12
12
|
value?: number;
|
|
13
13
|
loading?: boolean;
|
|
14
14
|
style?: React.CSSProperties;
|
|
@@ -25,7 +25,8 @@ interface ProductSelectProps {
|
|
|
25
25
|
productListSetting?: Partial<any>;
|
|
26
26
|
/** 兼容scrollDom */
|
|
27
27
|
customScrollParent?: HTMLElement | string;
|
|
28
|
+
hideCategoryWhenOne?: boolean;
|
|
28
29
|
}
|
|
29
30
|
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
|
+
declare const index: ({ dataSource, emptyDescription, showSearch, scrollDom, offsetDom, style, token: customToken, onChange, value, selectedItems, productListSetting, customScrollParent, loading, layout, hideCategoryWhenOne, ...rest }: ProductSelectProps) => JSX.Element;
|
|
31
32
|
export default index;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["dataSource", "emptyDescription", "showSearch", "scrollDom", "offsetDom", "style", "token", "onChange", "value", "selectedItems", "productListSetting", "customScrollParent", "loading", "layout"];
|
|
2
|
+
var _excluded = ["dataSource", "emptyDescription", "showSearch", "scrollDom", "offsetDom", "style", "token", "onChange", "value", "selectedItems", "productListSetting", "customScrollParent", "loading", "layout", "hideCategoryWhenOne"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -67,6 +67,8 @@ var index = function index(_ref) {
|
|
|
67
67
|
_ref$loading = _ref.loading,
|
|
68
68
|
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
69
69
|
layout = _ref.layout,
|
|
70
|
+
_ref$hideCategoryWhen = _ref.hideCategoryWhenOne,
|
|
71
|
+
hideCategoryWhenOne = _ref$hideCategoryWhen === void 0 ? false : _ref$hideCategoryWhen,
|
|
70
72
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
71
73
|
var searchRef = useRef(null);
|
|
72
74
|
var _useState = useState(''),
|
|
@@ -113,6 +115,22 @@ var index = function index(_ref) {
|
|
|
113
115
|
});
|
|
114
116
|
});
|
|
115
117
|
}, [_groupedList]);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @title: 是否隐藏分类
|
|
121
|
+
* @description:
|
|
122
|
+
* @param {*} useMemo
|
|
123
|
+
* @return {*}
|
|
124
|
+
* @Author: WangHan
|
|
125
|
+
* @Date: 2025-10-09 15:13
|
|
126
|
+
*/
|
|
127
|
+
var isHideCategory = useMemo(function () {
|
|
128
|
+
if (hideCategoryWhenOne) {
|
|
129
|
+
// 只有一个分类或者没有分类
|
|
130
|
+
return (_categories === null || _categories === void 0 ? void 0 : _categories.length) === 1 || !(_categories !== null && _categories !== void 0 && _categories.length);
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}, [_categories, hideCategoryWhenOne]);
|
|
116
134
|
useEffect(function () {
|
|
117
135
|
if (!(_categories !== null && _categories !== void 0 && _categories.length)) {
|
|
118
136
|
setActiveKey('');
|
|
@@ -151,9 +169,9 @@ var index = function index(_ref) {
|
|
|
151
169
|
var disabled = useMemo(function () {
|
|
152
170
|
return !!(productListSetting !== null && productListSetting !== void 0 && productListSetting.list_max_length) && Array.isArray(selectedItems) && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0;
|
|
153
171
|
}, [productListSetting, selectedItems]);
|
|
154
|
-
var _onChange = useCallback(function (value) {
|
|
172
|
+
var _onChange = useCallback(function (value, type) {
|
|
155
173
|
if (disabled) return;
|
|
156
|
-
onChange === null || onChange === void 0 || onChange(value);
|
|
174
|
+
onChange === null || onChange === void 0 || onChange(value, type);
|
|
157
175
|
}, [disabled, onChange]);
|
|
158
176
|
var debounceIndicator = useCallback(function (delay) {
|
|
159
177
|
isIndicatorVisibleRef.current = true;
|
|
@@ -228,19 +246,19 @@ var index = function index(_ref) {
|
|
|
228
246
|
// switchCategory('');
|
|
229
247
|
setKeyword(e.target.value);
|
|
230
248
|
}
|
|
231
|
-
})) : null, /*#__PURE__*/React.createElement(CategoryTabs, {
|
|
249
|
+
})) : null, !isHideCategory ? /*#__PURE__*/React.createElement(CategoryTabs, {
|
|
232
250
|
activeKey: activeKey,
|
|
233
251
|
items: _categories,
|
|
234
252
|
onChange: switchCategory,
|
|
235
253
|
loading: loading,
|
|
236
254
|
skeleton: /*#__PURE__*/React.createElement(CategorySkeleton, null)
|
|
237
|
-
}), !loading && !(_groupedList !== null && _groupedList !== void 0 && _groupedList.length) ? /*#__PURE__*/React.createElement(PisellEmpty, {
|
|
255
|
+
}) : null, !loading && !(_groupedList !== null && _groupedList !== void 0 && _groupedList.length) ? /*#__PURE__*/React.createElement(PisellEmpty, {
|
|
238
256
|
description: emptyDescription || locales.getText('pisell2.product-select.empty')
|
|
239
257
|
}) : /*#__PURE__*/React.createElement(IntersectionObserverProvider, {
|
|
240
258
|
rootMargin: "-270px 0px -270px 0px",
|
|
241
259
|
priorityMode: "top"
|
|
242
260
|
}, /*#__PURE__*/React.createElement(ProductList, {
|
|
243
|
-
className: "".concat(PREFIX, "__product-list"),
|
|
261
|
+
className: classNames("".concat(PREFIX, "__product-list"), _defineProperty({}, "".concat(PREFIX, "__product-list_hide_category"), isHideCategory)),
|
|
244
262
|
loading: loading,
|
|
245
263
|
data: loading ? MOCK_DATA : _groupedList,
|
|
246
264
|
context: {
|
|
@@ -259,8 +277,15 @@ var index = function index(_ref) {
|
|
|
259
277
|
return /*#__PURE__*/React.createElement(ProductCard, {
|
|
260
278
|
index: index,
|
|
261
279
|
item: item,
|
|
262
|
-
context: context
|
|
263
|
-
onSelect
|
|
280
|
+
context: context
|
|
281
|
+
// onSelect={_onChange}
|
|
282
|
+
,
|
|
283
|
+
onSelectCover: function onSelectCover(e) {
|
|
284
|
+
_onChange(e, 'cover');
|
|
285
|
+
},
|
|
286
|
+
onSelectInfo: function onSelectInfo(e) {
|
|
287
|
+
_onChange(e, 'info');
|
|
288
|
+
},
|
|
264
289
|
isSelected: item.id === value,
|
|
265
290
|
decorateConfig: productListSetting
|
|
266
291
|
});
|
|
@@ -70,7 +70,11 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
70
70
|
setProductLoading(false);
|
|
71
71
|
});
|
|
72
72
|
}, [isDateSelectedFirst]);
|
|
73
|
-
const
|
|
73
|
+
const isShowProductDetailStepper = (0, import_react.useMemo)(() => {
|
|
74
|
+
const { productModuleParams } = (appointmentBooking == null ? void 0 : appointmentBooking.otherParams) || {};
|
|
75
|
+
return productModuleParams == null ? void 0 : productModuleParams.isShowProductDetailStepper;
|
|
76
|
+
}, [appointmentBooking == null ? void 0 : appointmentBooking.otherParams]);
|
|
77
|
+
const handleSelectProduct = async (item, clickType) => {
|
|
74
78
|
let type = "";
|
|
75
79
|
if (!isRetailTemplate) {
|
|
76
80
|
type = await checkProductType(item == null ? void 0 : item.id);
|
|
@@ -80,7 +84,7 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
80
84
|
type: "pisell1.productDetail",
|
|
81
85
|
data: {
|
|
82
86
|
detail: { ...item, open_deposit: 1 },
|
|
83
|
-
setting: { can_input: true }
|
|
87
|
+
setting: { can_input: true, item_max_length: isShowProductDetailStepper, is_detail_open: clickType === "cover" }
|
|
84
88
|
},
|
|
85
89
|
callback: async (data) => {
|
|
86
90
|
var _a, _b;
|
|
@@ -201,7 +205,8 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
201
205
|
cardSelectedBg: "var(--theme-color)"
|
|
202
206
|
},
|
|
203
207
|
productListSetting,
|
|
204
|
-
selectedItems: carts
|
|
208
|
+
selectedItems: carts,
|
|
209
|
+
hideCategoryWhenOne: true
|
|
205
210
|
}
|
|
206
211
|
));
|
|
207
212
|
});
|
|
@@ -29,10 +29,12 @@ export interface ProductCardProps {
|
|
|
29
29
|
onSelectProduct?: (item: any) => void;
|
|
30
30
|
currentProductId?: number;
|
|
31
31
|
onSelect?: (item: any) => void;
|
|
32
|
+
onSelectCover?: (item: any) => void;
|
|
33
|
+
onSelectInfo?: (item: any) => void;
|
|
32
34
|
isSelected?: boolean;
|
|
33
35
|
decorateConfig?: ProductCardConfig;
|
|
34
36
|
}
|
|
35
|
-
export declare const ProductCard: React.MemoExoticComponent<({ item, index, context, onSelect, isSelected, className, decorateConfig, }: ProductCardProps) => JSX.Element>;
|
|
37
|
+
export declare const ProductCard: React.MemoExoticComponent<({ item, index, context, onSelect, onSelectCover, onSelectInfo, isSelected, className, decorateConfig, }: ProductCardProps) => JSX.Element>;
|
|
36
38
|
export declare const DefaultItemContent: React.MemoExoticComponent<(props: {
|
|
37
39
|
item: any;
|
|
38
40
|
index: number;
|
|
@@ -66,6 +66,8 @@ var ProductCard = (0, import_react.memo)(
|
|
|
66
66
|
index,
|
|
67
67
|
context,
|
|
68
68
|
onSelect,
|
|
69
|
+
onSelectCover,
|
|
70
|
+
onSelectInfo,
|
|
69
71
|
isSelected,
|
|
70
72
|
className,
|
|
71
73
|
decorateConfig = {}
|
|
@@ -129,9 +131,6 @@ var ProductCard = (0, import_react.memo)(
|
|
|
129
131
|
className: (0, import_classnames.default)(`${import__.PREFIX}__product-card`, className, {
|
|
130
132
|
selected: isSelected
|
|
131
133
|
}),
|
|
132
|
-
onClick: () => {
|
|
133
|
-
onSelect == null ? void 0 : onSelect(item);
|
|
134
|
-
},
|
|
135
134
|
"data-index": index,
|
|
136
135
|
"data-item-index": index
|
|
137
136
|
},
|
|
@@ -142,6 +141,9 @@ var ProductCard = (0, import_react.memo)(
|
|
|
142
141
|
style: {
|
|
143
142
|
width: imgWidth || "auto",
|
|
144
143
|
height: imgHeight || "auto"
|
|
144
|
+
},
|
|
145
|
+
onClick: () => {
|
|
146
|
+
onSelectCover == null ? void 0 : onSelectCover(item);
|
|
145
147
|
}
|
|
146
148
|
},
|
|
147
149
|
item.cover ? /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -154,7 +156,19 @@ var ProductCard = (0, import_react.memo)(
|
|
|
154
156
|
}
|
|
155
157
|
) : /* @__PURE__ */ import_react.default.createElement("div", { className: "text-cover", style: { borderRadius: radius } }, getTextCover(item.title))
|
|
156
158
|
) : null,
|
|
157
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
159
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
className: "card-right",
|
|
163
|
+
onClick: () => {
|
|
164
|
+
onSelectInfo == null ? void 0 : onSelectInfo(item);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
!!isTitle ? /* @__PURE__ */ import_react.default.createElement("div", { className: "title" }, item.title) : null,
|
|
168
|
+
!!isSubtitle && item.subtitle ? /* @__PURE__ */ import_react.default.createElement("div", { className: "subtitle" }, item.subtitle) : null,
|
|
169
|
+
!!isStock && !!item.is_track ? /* @__PURE__ */ import_react.default.createElement("div", { className: "stock" }, getStockText(item)) : null,
|
|
170
|
+
renderPrice(item)
|
|
171
|
+
)
|
|
158
172
|
);
|
|
159
173
|
if (context) {
|
|
160
174
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -8,7 +8,7 @@ interface ProductSelectProps {
|
|
|
8
8
|
grid: boolean;
|
|
9
9
|
config: string;
|
|
10
10
|
};
|
|
11
|
-
onChange: (value: any) => void;
|
|
11
|
+
onChange: (value: any, type?: string) => void;
|
|
12
12
|
value?: number;
|
|
13
13
|
loading?: boolean;
|
|
14
14
|
style?: React.CSSProperties;
|
|
@@ -25,7 +25,8 @@ interface ProductSelectProps {
|
|
|
25
25
|
productListSetting?: Partial<any>;
|
|
26
26
|
/** 兼容scrollDom */
|
|
27
27
|
customScrollParent?: HTMLElement | string;
|
|
28
|
+
hideCategoryWhenOne?: boolean;
|
|
28
29
|
}
|
|
29
30
|
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
|
+
declare const index: ({ dataSource, emptyDescription, showSearch, scrollDom, offsetDom, style, token: customToken, onChange, value, selectedItems, productListSetting, customScrollParent, loading, layout, hideCategoryWhenOne, ...rest }: ProductSelectProps) => JSX.Element;
|
|
31
32
|
export default index;
|
|
@@ -79,6 +79,7 @@ var index = ({
|
|
|
79
79
|
customScrollParent,
|
|
80
80
|
loading = false,
|
|
81
81
|
layout,
|
|
82
|
+
hideCategoryWhenOne = false,
|
|
82
83
|
...rest
|
|
83
84
|
}) => {
|
|
84
85
|
const searchRef = (0, import_react.useRef)(null);
|
|
@@ -119,6 +120,12 @@ var index = ({
|
|
|
119
120
|
};
|
|
120
121
|
});
|
|
121
122
|
}, [_groupedList]);
|
|
123
|
+
const isHideCategory = (0, import_react.useMemo)(() => {
|
|
124
|
+
if (hideCategoryWhenOne) {
|
|
125
|
+
return (_categories == null ? void 0 : _categories.length) === 1 || !(_categories == null ? void 0 : _categories.length);
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}, [_categories, hideCategoryWhenOne]);
|
|
122
129
|
(0, import_react.useEffect)(() => {
|
|
123
130
|
if (!(_categories == null ? void 0 : _categories.length)) {
|
|
124
131
|
setActiveKey("");
|
|
@@ -158,9 +165,9 @@ var index = ({
|
|
|
158
165
|
return !!(productListSetting == null ? void 0 : productListSetting.list_max_length) && Array.isArray(selectedItems) && (selectedItems == null ? void 0 : selectedItems.length) > 0;
|
|
159
166
|
}, [productListSetting, selectedItems]);
|
|
160
167
|
const _onChange = (0, import_react.useCallback)(
|
|
161
|
-
(value2) => {
|
|
168
|
+
(value2, type) => {
|
|
162
169
|
if (disabled) return;
|
|
163
|
-
onChange == null ? void 0 : onChange(value2);
|
|
170
|
+
onChange == null ? void 0 : onChange(value2, type);
|
|
164
171
|
},
|
|
165
172
|
[disabled, onChange]
|
|
166
173
|
);
|
|
@@ -237,7 +244,7 @@ var index = ({
|
|
|
237
244
|
}
|
|
238
245
|
}
|
|
239
246
|
)) : null,
|
|
240
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
247
|
+
!isHideCategory ? /* @__PURE__ */ import_react.default.createElement(
|
|
241
248
|
import_CategoryTabs.default,
|
|
242
249
|
{
|
|
243
250
|
activeKey,
|
|
@@ -246,7 +253,7 @@ var index = ({
|
|
|
246
253
|
loading,
|
|
247
254
|
skeleton: /* @__PURE__ */ import_react.default.createElement(import_CategoryTabs.CategorySkeleton, null)
|
|
248
255
|
}
|
|
249
|
-
),
|
|
256
|
+
) : null,
|
|
250
257
|
!loading && !(_groupedList == null ? void 0 : _groupedList.length) ? /* @__PURE__ */ import_react.default.createElement(
|
|
251
258
|
import_materials2.PisellEmpty,
|
|
252
259
|
{
|
|
@@ -261,7 +268,9 @@ var index = ({
|
|
|
261
268
|
/* @__PURE__ */ import_react.default.createElement(
|
|
262
269
|
import_ProductList.default,
|
|
263
270
|
{
|
|
264
|
-
className: `${PREFIX}__product-list`,
|
|
271
|
+
className: (0, import_classnames.default)(`${PREFIX}__product-list`, {
|
|
272
|
+
[`${PREFIX}__product-list_hide_category`]: isHideCategory
|
|
273
|
+
}),
|
|
265
274
|
loading,
|
|
266
275
|
data: loading ? MOCK_DATA : _groupedList,
|
|
267
276
|
context: {
|
|
@@ -281,7 +290,12 @@ var index = ({
|
|
|
281
290
|
index: index2,
|
|
282
291
|
item,
|
|
283
292
|
context: context2,
|
|
284
|
-
|
|
293
|
+
onSelectCover: (e) => {
|
|
294
|
+
_onChange(e, "cover");
|
|
295
|
+
},
|
|
296
|
+
onSelectInfo: (e) => {
|
|
297
|
+
_onChange(e, "info");
|
|
298
|
+
},
|
|
285
299
|
isSelected: item.id === value,
|
|
286
300
|
decorateConfig: productListSetting
|
|
287
301
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.26",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"react-infinite-scroll-component": "^6.1.0",
|
|
60
60
|
"rc-virtual-list": "^3.11.3",
|
|
61
61
|
"decimal.js": "^10.4.3",
|
|
62
|
-
"@pisell/
|
|
63
|
-
"@pisell/materials": "6.3.7",
|
|
62
|
+
"@pisell/date-picker": "3.0.4",
|
|
64
63
|
"@pisell/icon": "0.0.11",
|
|
65
|
-
"@pisell/
|
|
64
|
+
"@pisell/utils": "3.0.1",
|
|
65
|
+
"@pisell/materials": "6.3.7"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"react": "^18.0.0",
|