@pisell/materials 6.11.97 → 6.11.98

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.
Files changed (42) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +6 -6
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/buttonGroupPreview/index.js +2 -1
  12. package/es/components/pisellFind/index.d.ts +34 -12
  13. package/es/components/pisellFind/index.js +114 -18
  14. package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.js +4 -2
  15. package/es/components/productCard/cartSkuCard/components/resources/index.less +4 -0
  16. package/es/components/productCard/lineItem/BookingLineItem.d.ts +2 -1
  17. package/es/components/productCard/lineItem/BookingLineItem.js +15 -6
  18. package/es/components/productCard/lineItem/components/Holders/index.d.ts +10 -0
  19. package/es/components/productCard/lineItem/components/Holders/index.js +74 -0
  20. package/es/components/productCard/lineItem/components/Holders/index.less +39 -0
  21. package/es/components/productCard/lineItem/index.d.ts +10 -8
  22. package/es/components/productCard/lineItem/index.js +61 -13
  23. package/es/components/productCard/lineItem/index.less +3 -3
  24. package/es/components/productCard/lineItem/types.d.ts +4 -0
  25. package/es/components/productCard/types.d.ts +1 -0
  26. package/lib/components/buttonGroupPreview/index.js +2 -1
  27. package/lib/components/pisellFind/index.d.ts +34 -12
  28. package/lib/components/pisellFind/index.js +80 -5
  29. package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.js +1 -1
  30. package/lib/components/productCard/cartSkuCard/components/resources/index.less +4 -0
  31. package/lib/components/productCard/lineItem/BookingLineItem.d.ts +2 -1
  32. package/lib/components/productCard/lineItem/BookingLineItem.js +14 -2
  33. package/lib/components/productCard/lineItem/components/Holders/index.d.ts +10 -0
  34. package/lib/components/productCard/lineItem/components/Holders/index.js +83 -0
  35. package/lib/components/productCard/lineItem/components/Holders/index.less +39 -0
  36. package/lib/components/productCard/lineItem/index.d.ts +10 -8
  37. package/lib/components/productCard/lineItem/index.js +51 -10
  38. package/lib/components/productCard/lineItem/index.less +3 -3
  39. package/lib/components/productCard/lineItem/types.d.ts +4 -0
  40. package/lib/components/productCard/types.d.ts +1 -0
  41. package/lowcode/pisell-find/meta.ts +19 -0
  42. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- var _excluded = ["dataSource", "itemType", "type", "rightActions", "escapeDom", "isShowImage", "isShowDelete", "isShowNote", "isShowAmountFooter", "disabledClick", "disabledEdit", "statusOptions", "statusLoading", "statusDisabled", "isShowRelatedProduct", "onBookingStatusChange", "onAction", "onDelete", "onNote", "onCard", "onPromotion", "onGift"];
1
+ var _excluded = ["dataSource", "itemType", "type", "rightActions", "escapeDom", "isShowImage", "isShowDelete", "isShowNote", "isShowAmountFooter", "disabledClick", "disabledEdit", "statusOptions", "statusLoading", "statusDisabled", "isShowRelatedProduct", "holderOptions", "onBookingStatusChange", "onAction", "onDelete", "onNote", "onCard", "onPromotion", "onGift"];
2
2
  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); }
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -27,6 +27,45 @@ var translateText = function translateText(text, translationOriginal) {
27
27
  if (!text) return '';
28
28
  return translationOriginal(text);
29
29
  };
30
+
31
+ /**
32
+ * 计算购物车行「单位主商品价」(不含 bundle composite,option 从 main_* 字段扣除)。
33
+ *
34
+ * @example
35
+ * resolveLineItemUnitPrices(orderProduct);
36
+ */
37
+ function resolveLineItemUnitPrices(product) {
38
+ var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
39
+ var promotion = metadata._promotion;
40
+ var optionSum = ((product === null || product === void 0 ? void 0 : product.product_option_item) || []).reduce(function (sum, option) {
41
+ var price = Number(option === null || option === void 0 ? void 0 : option.price) || 0;
42
+ var num = Number(option === null || option === void 0 ? void 0 : option.num) || 1;
43
+ return sum + price * num;
44
+ }, 0);
45
+ var unitOriginal = function (_ref, _product$original_pri) {
46
+ if (metadata.main_product_original_price != null && metadata.main_product_original_price !== '') {
47
+ return Number(metadata.main_product_original_price) - optionSum;
48
+ }
49
+ if ((promotion === null || promotion === void 0 ? void 0 : promotion.originalPrice) != null && promotion.originalPrice !== '') {
50
+ return Number(promotion.originalPrice);
51
+ }
52
+ return Number((_ref = (_product$original_pri = product === null || product === void 0 ? void 0 : product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product === null || product === void 0 ? void 0 : product.selling_price) !== null && _ref !== void 0 ? _ref : 0);
53
+ }();
54
+ var unitSelling = function (_ref2, _product$payment_pric) {
55
+ if (metadata.main_product_selling_price != null && metadata.main_product_selling_price !== '') {
56
+ return Number(metadata.main_product_selling_price) - optionSum;
57
+ }
58
+ // source_product_price 是券前 catalog 原价,不能当作折后售价
59
+ if (promotion !== null && promotion !== void 0 && promotion.inPromotion && promotion.finalPrice != null && promotion.finalPrice !== '') {
60
+ return Number(promotion.finalPrice);
61
+ }
62
+ return Number((_ref2 = (_product$payment_pric = product === null || product === void 0 ? void 0 : product.payment_price) !== null && _product$payment_pric !== void 0 ? _product$payment_pric : product === null || product === void 0 ? void 0 : product.selling_price) !== null && _ref2 !== void 0 ? _ref2 : unitOriginal);
63
+ }();
64
+ return {
65
+ unitSelling: Number.isFinite(unitSelling) ? unitSelling : 0,
66
+ unitOriginal: Number.isFinite(unitOriginal) ? unitOriginal : 0
67
+ };
68
+ }
30
69
  var convertBundleOption = function convertBundleOption(option, translationOriginal) {
31
70
  return _objectSpread(_objectSpread({}, option), {}, {
32
71
  id: option.option_group_item_id,
@@ -62,11 +101,14 @@ var convertBundle = function convertBundle(bundle, translationOriginal) {
62
101
  });
63
102
  };
64
103
  export var convertProductToLineItemProduct = function convertProductToLineItemProduct(product, translationOriginal, symbol) {
65
- var _product$metadata, _ref, _product$num, _ref2, _product$num2, _product$metadata$sou, _product$metadata2, _product$payment_pric, _product$metadata3, _product$product_sku, _ref3, _product$num3;
104
+ var _product$metadata, _ref3, _product$num, _ref4, _product$num2, _product$metadata2, _product$discount_lis, _product$discount_lis2, _product$metadata3, _product$metadata4, _product$product_sku, _ref5, _product$num3;
66
105
  var title = translateText(product.product_title || product.title, translationOriginal);
67
106
  var bundle = (product.product_bundle || []).map(function (bundleItem) {
68
107
  return convertBundle(bundleItem, translationOriginal);
69
108
  });
109
+ var _resolveLineItemUnitP = resolveLineItemUnitPrices(product),
110
+ unitSelling = _resolveLineItemUnitP.unitSelling,
111
+ unitOriginal = _resolveLineItemUnitP.unitOriginal;
70
112
  return {
71
113
  _id: ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.order_detail_id || product.product_id,
72
114
  id: product.product_id,
@@ -77,13 +119,13 @@ export var convertProductToLineItemProduct = function convertProductToLineItemPr
77
119
  name: title,
78
120
  cover: product.cover,
79
121
  image: product.cover,
80
- num: (_ref = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.product_quantity) !== null && _ref !== void 0 ? _ref : 1,
81
- quantity: (_ref2 = (_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : product.product_quantity) !== null && _ref2 !== void 0 ? _ref2 : 1,
82
- price: (_product$metadata$sou = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : product.selling_price,
83
- total: (_product$payment_pric = product.payment_price) !== null && _product$payment_pric !== void 0 ? _product$payment_pric : product.selling_price,
84
- origin_total: product.original_price,
85
- original_total: product.original_price,
86
- source_product_price: (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price,
122
+ num: (_ref3 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.product_quantity) !== null && _ref3 !== void 0 ? _ref3 : 1,
123
+ quantity: (_ref4 = (_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : product.product_quantity) !== null && _ref4 !== void 0 ? _ref4 : 1,
124
+ price: unitSelling,
125
+ total: unitSelling,
126
+ origin_total: unitOriginal,
127
+ original_total: unitOriginal,
128
+ source_product_price: (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.source_product_price,
87
129
  selling_price: product.selling_price,
88
130
  payment_price: product.payment_price,
89
131
  tax_fee: product.tax_fee,
@@ -95,7 +137,11 @@ export var convertProductToLineItemProduct = function convertProductToLineItemPr
95
137
  product_option_string: product.product_sku ? translateText(product.product_sku.subtitle, translationOriginal) : '',
96
138
  discount_list: product.discount_list,
97
139
  promotions: product.promotions,
98
- isGift: Boolean(product.gift_card),
140
+ discount_reason: (_product$discount_lis = (_product$discount_lis2 = product.discount_list) === null || _product$discount_lis2 === void 0 || (_product$discount_lis2 = _product$discount_lis2.find(function (d) {
141
+ return (d === null || d === void 0 ? void 0 : d.type) === 'product';
142
+ })) === null || _product$discount_lis2 === void 0 || (_product$discount_lis2 = _product$discount_lis2.discount) === null || _product$discount_lis2 === void 0 ? void 0 : _product$discount_lis2.message) !== null && _product$discount_lis !== void 0 ? _product$discount_lis : (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.product_discount_reason,
143
+ // 促销赠品走 metadata._giftInfo;礼品卡走 gift_card(对齐 legacy formatProducts isGift)
144
+ isGift: Boolean(product.gift_card || product.isGift || product._isGiftPromotion || ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4._giftInfo) || product._giftInfo),
99
145
  giftData: product.giftData,
100
146
  _origin: product,
101
147
  _extend: {
@@ -104,11 +150,11 @@ export var convertProductToLineItemProduct = function convertProductToLineItemPr
104
150
  option: (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option,
105
151
  bundle: product.product_bundle,
106
152
  product_variant_id: product.product_variant_id,
107
- quantity: (_ref3 = (_product$num3 = product.num) !== null && _product$num3 !== void 0 ? _product$num3 : product.product_quantity) !== null && _ref3 !== void 0 ? _ref3 : 1
153
+ quantity: (_ref5 = (_product$num3 = product.num) !== null && _product$num3 !== void 0 ? _product$num3 : product.product_quantity) !== null && _ref5 !== void 0 ? _ref5 : 1
108
154
  },
109
155
  note: product.note,
110
- total: product.payment_price,
111
- origin_total: product.original_price,
156
+ total: unitSelling,
157
+ origin_total: unitOriginal,
112
158
  payment_price: product.payment_price
113
159
  }
114
160
  };
@@ -143,6 +189,7 @@ var LineItem = function LineItem(props) {
143
189
  statusDisabled = _props$statusDisabled === void 0 ? false : _props$statusDisabled,
144
190
  _props$isShowRelatedP = props.isShowRelatedProduct,
145
191
  isShowRelatedProduct = _props$isShowRelatedP === void 0 ? true : _props$isShowRelatedP,
192
+ holderOptions = props.holderOptions,
146
193
  onBookingStatusChange = props.onBookingStatusChange,
147
194
  onAction = props.onAction,
148
195
  onDelete = props.onDelete,
@@ -203,6 +250,7 @@ var LineItem = function LineItem(props) {
203
250
  statusLoading: statusLoading,
204
251
  statusDisabled: statusDisabled,
205
252
  isShowRelatedProduct: isShowRelatedProduct,
253
+ holderOptions: holderOptions,
206
254
  onBookingStatusChange: onBookingStatusChange,
207
255
  onAction: onAction,
208
256
  onDelete: onDelete,
@@ -18,10 +18,10 @@
18
18
  &__delete-btn {
19
19
  width: 34px;
20
20
  height: 34px;
21
- border: 1px solid rgba(255, 255, 255, 0.35);
21
+ border: 1px solid var(--Gray-300, #d0d5dd);
22
22
  border-radius: 8px;
23
- background: rgba(255, 255, 255, 0.12);
24
- color: #fff;
23
+ background: var(--Gray-100, #f2f4f7);
24
+ color: var(--Gray-500, #667085);
25
25
  cursor: pointer;
26
26
  padding: 0;
27
27
  display: inline-flex;
@@ -7,3 +7,7 @@ export interface LineItemStatusOption {
7
7
  color?: string;
8
8
  danger?: boolean;
9
9
  }
10
+ export interface LineItemHolderOption {
11
+ id: string | number;
12
+ label: ReactNode;
13
+ }
@@ -65,6 +65,7 @@ export declare type productType = {
65
65
  */
66
66
  export declare type ProductCardTypes = {
67
67
  dataSource: productType;
68
+ isFormSubject?: boolean;
68
69
  isShowImage?: boolean;
69
70
  isShowOriginalPrice?: boolean;
70
71
  isShowHolder?: boolean;
@@ -71,7 +71,8 @@ var ButtonGroupPreview = (0, import_react.forwardRef)(
71
71
  } = items;
72
72
  const btnProps = { ...buttonProps, ...props.updateButtonProps };
73
73
  const { children, ...dropdownButtonProps } = btnProps;
74
- return isMore ? /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { menu: { items: menuData } }, /* @__PURE__ */ import_react.default.createElement(import_button.default, { key: id, ...dropdownButtonProps }, children ?? /* @__PURE__ */ import_react.default.createElement(import_icons.MoreOutlined, null))) : /* @__PURE__ */ import_react.default.createElement(
74
+ const moreButtonChildren = children ?? (dropdownButtonProps.icon ? null : /* @__PURE__ */ import_react.default.createElement(import_icons.MoreOutlined, null));
75
+ return isMore ? /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { menu: { items: menuData } }, /* @__PURE__ */ import_react.default.createElement(import_button.default, { key: id, ...dropdownButtonProps }, moreButtonChildren)) : /* @__PURE__ */ import_react.default.createElement(
75
76
  import_button.default,
76
77
  {
77
78
  key: id,
@@ -1,10 +1,37 @@
1
1
  import React from 'react';
2
2
  import type { PisellLookupProps, PisellLookupRef } from '../pisellLookup';
3
+ /**
4
+ * 原生扫码事件名,对齐宿主端约定。
5
+ */
6
+ export declare const SCAN_RESULT_EVENT = "nativeScanResult";
7
+ /**
8
+ * 扫码枪回传数据(对齐宿主 ScanResultPayload)
9
+ * - code: 条码标识(如条码格式 / 业务字段)
10
+ * - data: 扫描得到的字符串值(写入输入框的内容)
11
+ */
12
+ export interface PisellFindScannerData {
13
+ code: string;
14
+ data: string;
15
+ }
3
16
  /**
4
17
  * PisellFind Props
5
- * 继承 PisellLookup 的所有 Props
18
+ * 继承 PisellLookup 的所有 Props,并扩展扫码枪监听相关字段。
6
19
  */
7
- export declare type PisellFindProps = PisellLookupProps;
20
+ export interface PisellFindProps extends PisellLookupProps {
21
+ /**
22
+ * 是否开启扫码枪监听
23
+ * 通过宿主 `app.pubsub.subscribe('nativeScanResult', ...)` 订阅;
24
+ * 切换 false 时会 unsubscribe,停止接收事件。
25
+ * @default false
26
+ */
27
+ enableScanner?: boolean;
28
+ /**
29
+ * 扫码枪回调
30
+ * 监听到扫码枪事件时触发,参数为原始 payload 对象(含 `data` 字段)。
31
+ * 注意:仅在 enableScanner 为 true 时才会触发。
32
+ */
33
+ onScannerData?: (data: PisellFindScannerData) => void;
34
+ }
8
35
  /**
9
36
  * PisellFind Ref
10
37
  * 继承 PisellLookup 的所有 Ref 方法
@@ -19,22 +46,17 @@ export declare type PisellFindRef = PisellLookupRef;
19
46
  * - 默认不显示确认按钮(输入即搜索)
20
47
  * - 默认开启搜索历史
21
48
  * - 默认不展示结果区(结果在页面其他位置展示)
49
+ * - 通过 `enableScanner` 接入扫码枪:使用宿主 `app.pubsub.subscribe(SCAN_RESULT_EVENT, ...)`,
50
+ * 每次扫码直接覆盖输入框内容并触发 onSearch / onScannerData;切回 false 时自动 unsubscribe。
22
51
  *
23
52
  * @example
24
53
  * ```tsx
25
- * // 基础用法
26
- * <PisellFind
27
- * onSearch={(keyword) => {
28
- * const filtered = data.filter(item => item.name.includes(keyword));
29
- * setFilteredData(filtered);
30
- * }}
31
- * />
32
- *
33
- * // 切换为 Input 模式
34
54
  * <PisellFind
35
55
  * triggerType="input"
56
+ * enableScanner={isActive}
57
+ * onScannerData={(payload) => console.log('scan:', payload.data)}
36
58
  * onSearch={(keyword) => filterData(keyword)}
37
59
  * />
38
60
  * ```
39
61
  */
40
- export declare const PisellFind: React.ForwardRefExoticComponent<PisellLookupProps & React.RefAttributes<PisellLookupRef>>;
62
+ export declare const PisellFind: React.ForwardRefExoticComponent<PisellFindProps & React.RefAttributes<PisellLookupRef>>;
@@ -29,16 +29,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/components/pisellFind/index.tsx
30
30
  var pisellFind_exports = {};
31
31
  __export(pisellFind_exports, {
32
- PisellFind: () => PisellFind
32
+ PisellFind: () => PisellFind,
33
+ SCAN_RESULT_EVENT: () => SCAN_RESULT_EVENT
33
34
  });
34
35
  module.exports = __toCommonJS(pisellFind_exports);
35
36
  var import_react = __toESM(require("react"));
36
37
  var import_utils = require("@pisell/utils");
37
38
  var import_pisellLookup = require("../pisellLookup");
39
+ var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
38
40
  var import_locales = require("../../locales");
41
+ var SCAN_RESULT_EVENT = "nativeScanResult";
39
42
  var PisellFind = (0, import_react.forwardRef)((props, ref) => {
43
+ var _a, _b;
40
44
  const {
41
- // 提取需要设置默认值的 Props
42
45
  triggerType = "button",
43
46
  buttonText = (() => {
44
47
  const key = "pisell2.recordBoard.toolbar.find";
@@ -53,19 +56,90 @@ var PisellFind = (0, import_react.forwardRef)((props, ref) => {
53
56
  showConfirmButton = false,
54
57
  showHistory = true,
55
58
  historyKey = "pisell_find_history",
56
- // 透传其他所有 Props
59
+ enableScanner = false,
60
+ onScannerData,
61
+ onSearch,
57
62
  ...restProps
58
63
  } = props;
64
+ const lookupRef = (0, import_react.useRef)(null);
65
+ const onScannerDataRef = (0, import_react.useRef)(onScannerData);
66
+ const onSearchRef = (0, import_react.useRef)(onSearch);
67
+ (0, import_react.useEffect)(() => {
68
+ onScannerDataRef.current = onScannerData;
69
+ }, [onScannerData]);
70
+ (0, import_react.useEffect)(() => {
71
+ onSearchRef.current = onSearch;
72
+ }, [onSearch]);
73
+ (0, import_react.useImperativeHandle)(
74
+ ref,
75
+ () => ({
76
+ open: () => {
77
+ var _a2;
78
+ return (_a2 = lookupRef.current) == null ? void 0 : _a2.open();
79
+ },
80
+ close: () => {
81
+ var _a2;
82
+ return (_a2 = lookupRef.current) == null ? void 0 : _a2.close();
83
+ },
84
+ getKeyword: () => {
85
+ var _a2;
86
+ return ((_a2 = lookupRef.current) == null ? void 0 : _a2.getKeyword()) ?? "";
87
+ },
88
+ setKeyword: (v) => {
89
+ var _a2;
90
+ return (_a2 = lookupRef.current) == null ? void 0 : _a2.setKeyword(v);
91
+ }
92
+ }),
93
+ []
94
+ );
95
+ const engineContext = (0, import_useEngineContext.default)();
96
+ const getAppRef = (0, import_react.useRef)(void 0);
97
+ getAppRef.current = typeof ((_b = (_a = engineContext == null ? void 0 : engineContext.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.getApp) === "function" ? engineContext.appHelper.utils.getApp : void 0;
98
+ (0, import_react.useEffect)(() => {
99
+ if (!enableScanner) return void 0;
100
+ const getApp = getAppRef.current;
101
+ if (typeof getApp !== "function") return void 0;
102
+ const app = getApp();
103
+ const pubsub = app == null ? void 0 : app.pubsub;
104
+ if (!pubsub || typeof pubsub.subscribe !== "function") {
105
+ return void 0;
106
+ }
107
+ const onScan = (payload) => {
108
+ var _a2, _b2, _c;
109
+ const data = payload == null ? void 0 : payload.data;
110
+ if (typeof data !== "string" || data.length === 0) {
111
+ return;
112
+ }
113
+ (_a2 = lookupRef.current) == null ? void 0 : _a2.setKeyword(data);
114
+ (_b2 = onSearchRef.current) == null ? void 0 : _b2.call(onSearchRef, data);
115
+ (_c = onScannerDataRef.current) == null ? void 0 : _c.call(onScannerDataRef, payload);
116
+ };
117
+ try {
118
+ pubsub.subscribe(SCAN_RESULT_EVENT, onScan);
119
+ } catch (e) {
120
+ console.warn("[PisellFind] subscribe scanner failed:", e);
121
+ return void 0;
122
+ }
123
+ return () => {
124
+ var _a2;
125
+ try {
126
+ (_a2 = pubsub.unsubscribe) == null ? void 0 : _a2.call(pubsub, SCAN_RESULT_EVENT, onScan);
127
+ } catch (e) {
128
+ console.warn("[PisellFind] unsubscribe scanner failed:", e);
129
+ }
130
+ };
131
+ }, [enableScanner]);
59
132
  return /* @__PURE__ */ import_react.default.createElement(
60
133
  import_pisellLookup.PisellLookup,
61
134
  {
62
- ref,
135
+ ref: lookupRef,
63
136
  triggerType,
64
137
  buttonText,
65
138
  placeholder,
66
139
  showConfirmButton,
67
140
  showHistory,
68
141
  historyKey,
142
+ onSearch,
69
143
  ...restProps
70
144
  }
71
145
  );
@@ -73,5 +147,6 @@ var PisellFind = (0, import_react.forwardRef)((props, ref) => {
73
147
  PisellFind.displayName = "PisellFind";
74
148
  // Annotate the CommonJS export names for ESM import in node:
75
149
  0 && (module.exports = {
76
- PisellFind
150
+ PisellFind,
151
+ SCAN_RESULT_EVENT
77
152
  });
@@ -238,7 +238,7 @@ var RecordBoardGridView = (props) => {
238
238
  }) : rawScrollX;
239
239
  if ((scroll == null ? void 0 : scroll.autoCalc) && typeof ctx.scrollAreaHeight === "number") {
240
240
  const wrapHeight = ctx.scrollAreaHeight;
241
- const reservedHeight = 40 + uniformSummaryHeight + 24;
241
+ const reservedHeight = 40 + (uniformSummaryHeight > 0 ? uniformSummaryHeight + 25 : 0);
242
242
  return {
243
243
  x: scrollX ?? sumColumnWidths,
244
244
  y: Math.max(wrapHeight - reservedHeight, 100),
@@ -15,6 +15,10 @@
15
15
  overflow: hidden;
16
16
  text-overflow: ellipsis;
17
17
  margin: 0;
18
+
19
+ .resource-icon {
20
+ margin-right: 2px;
21
+ }
18
22
  }
19
23
 
20
24
  &--title {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { ProductCardTypes } from '../types';
3
- import type { LineItemStatusOption, LineItemType } from './types';
3
+ import type { LineItemHolderOption, LineItemStatusOption, LineItemType } from './types';
4
4
  interface BookingLineItemProps extends Omit<ProductCardTypes, 'dataSource'> {
5
5
  dataSource: any;
6
6
  type: LineItemType;
@@ -12,6 +12,7 @@ interface BookingLineItemProps extends Omit<ProductCardTypes, 'dataSource'> {
12
12
  statusLoading?: boolean;
13
13
  statusDisabled?: boolean;
14
14
  isShowRelatedProduct?: boolean;
15
+ holderOptions?: LineItemHolderOption[];
15
16
  onBookingStatusChange?: (status: string, item: any) => void;
16
17
  }
17
18
  declare const BookingLineItem: (props: BookingLineItemProps) => React.JSX.Element | null;
@@ -48,6 +48,7 @@ var import_swipeAction = require("../cartSkuCard/components/swipeAction");
48
48
  var import_Action = __toESM(require("../components/Action"));
49
49
  var import_TimeRange = __toESM(require("./components/TimeRange"));
50
50
  var import_Resources = __toESM(require("./components/Resources"));
51
+ var import_Holders = __toESM(require("./components/Holders"));
51
52
  var import_iconfont = __toESM(require("../../iconfont"));
52
53
  var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
53
54
  var PREFIX = "pisell-line-item";
@@ -100,6 +101,7 @@ var BookingLineItem = (props) => {
100
101
  rightActions = [],
101
102
  escapeDom,
102
103
  isShowImage,
104
+ isFormSubject,
103
105
  isShowDelete,
104
106
  isShowNote,
105
107
  isShowAmountFooter,
@@ -109,6 +111,7 @@ var BookingLineItem = (props) => {
109
111
  statusLoading = false,
110
112
  statusDisabled = false,
111
113
  isShowRelatedProduct = true,
114
+ holderOptions,
112
115
  onBookingStatusChange,
113
116
  onAction,
114
117
  onDelete,
@@ -146,7 +149,9 @@ var BookingLineItem = (props) => {
146
149
  }
147
150
  };
148
151
  const bookingRightActions = isShowDelete ? [deleteAction, ...rightActions] : rightActions;
149
- const bookingTitle = String((dataSource == null ? void 0 : dataSource.booking_id) || "-");
152
+ const resolvedHolderOptions = holderOptions ?? (dataSource == null ? void 0 : dataSource.holderOptions) ?? (dataSource == null ? void 0 : dataSource.holders) ?? [];
153
+ const resolvedIsFormSubject = isFormSubject ?? (dataSource == null ? void 0 : dataSource.isFormSubject);
154
+ const bookingTitle = String((dataSource == null ? void 0 : dataSource.booking_id) || "");
150
155
  const bookingTime = formatBookingTime(dataSource, locale);
151
156
  const resourceName = getResourceName(dataSource, translationOriginal) || "-";
152
157
  const renderStatusButton = () => /* @__PURE__ */ import_react.default.createElement(
@@ -223,7 +228,14 @@ var BookingLineItem = (props) => {
223
228
  /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-trash-01" })
224
229
  ) : null))
225
230
  ),
226
- /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ import_react.default.createElement(import_Resources.default, { dataSource }), /* @__PURE__ */ import_react.default.createElement(import_TimeRange.default, { dataSource })),
231
+ /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__booking-detail` }, /* @__PURE__ */ import_react.default.createElement(import_Resources.default, { dataSource }), /* @__PURE__ */ import_react.default.createElement(import_TimeRange.default, { dataSource }), resolvedIsFormSubject ? /* @__PURE__ */ import_react.default.createElement(
232
+ import_Holders.default,
233
+ {
234
+ dataSource,
235
+ holderOptions: resolvedHolderOptions,
236
+ isFormSubject: resolvedIsFormSubject
237
+ }
238
+ ) : null),
227
239
  isShowRelatedProduct && relatedProductDataSource ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Divider, { style: { margin: 0 } }), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__related-product` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__related-product-card` }, /* @__PURE__ */ import_react.default.createElement(
228
240
  import_basicInfo.default,
229
241
  {
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { LineItemHolderOption } from '../../types';
3
+ import './index.less';
4
+ interface LineItemHoldersProps {
5
+ dataSource?: any;
6
+ holderOptions?: LineItemHolderOption[];
7
+ isFormSubject?: boolean;
8
+ }
9
+ declare const LineItemHolders: (props: LineItemHoldersProps) => React.JSX.Element | null;
10
+ export default LineItemHolders;
@@ -0,0 +1,83 @@
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/components/productCard/lineItem/components/Holders/index.tsx
30
+ var Holders_exports = {};
31
+ __export(Holders_exports, {
32
+ default: () => Holders_default
33
+ });
34
+ module.exports = __toCommonJS(Holders_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
37
+ var import_iconfont = __toESM(require("../../../../iconfont"));
38
+ var import_index = require("./index.less");
39
+ var PREFIX = "pisell-line-item";
40
+ var holderIconMap = {
41
+ form: "pisell2-file-05",
42
+ minors: "pisell2-user-check-01",
43
+ waiver: "pisell2-file-lock-03"
44
+ };
45
+ var isEmptyHolderId = (value) => {
46
+ if (Array.isArray(value)) return value.length === 0;
47
+ return value === void 0 || value === null || value === "";
48
+ };
49
+ var normalizeHolderIds = (value) => {
50
+ if (isEmptyHolderId(value)) return [];
51
+ return Array.isArray(value) ? value : [value];
52
+ };
53
+ var pickHolderId = (dataSource) => {
54
+ var _a, _b, _c, _d, _e, _f, _g;
55
+ return (dataSource == null ? void 0 : dataSource.holder_id) ?? ((_a = dataSource == null ? void 0 : dataSource.metadata) == null ? void 0 : _a.holder_id) ?? ((_d = (_c = (_b = dataSource == null ? void 0 : dataSource._extend) == null ? void 0 : _b.product) == null ? void 0 : _c.metadata) == null ? void 0 : _d.holder_id) ?? ((_g = (_f = (_e = dataSource == null ? void 0 : dataSource._extend) == null ? void 0 : _e.product) == null ? void 0 : _f._extend) == null ? void 0 : _g.holder_id);
56
+ };
57
+ var pickHolderMaxCount = (dataSource, holderIds) => {
58
+ var _a, _b, _c, _d, _e, _f, _g;
59
+ const count = ((dataSource == null ? void 0 : dataSource.holderMaxCount) ?? (dataSource == null ? void 0 : dataSource.holder_max_count) ?? (dataSource == null ? void 0 : dataSource.number) ?? ((_b = (_a = dataSource == null ? void 0 : dataSource._extend) == null ? void 0 : _a.product) == null ? void 0 : _b.num) ?? ((_d = (_c = dataSource == null ? void 0 : dataSource._extend) == null ? void 0 : _c.product) == null ? void 0 : _d.product_quantity) ?? ((_g = (_f = (_e = dataSource == null ? void 0 : dataSource._extend) == null ? void 0 : _e.product) == null ? void 0 : _f._extend) == null ? void 0 : _g.quantity) ?? holderIds.length) || 1;
60
+ return Number(count) || 1;
61
+ };
62
+ var LineItemHolders = (props) => {
63
+ const { dataSource = {}, holderOptions = [], isFormSubject } = props;
64
+ const holderIds = (0, import_react.useMemo)(
65
+ () => normalizeHolderIds(pickHolderId(dataSource)),
66
+ [dataSource]
67
+ );
68
+ const holderMaxCount = pickHolderMaxCount(dataSource, holderIds);
69
+ const showUnassigned = Boolean(isFormSubject || (dataSource == null ? void 0 : dataSource.isFormSubject));
70
+ const holderType = (dataSource == null ? void 0 : dataSource.holderType) || (dataSource == null ? void 0 : dataSource.holder_type) || "minors";
71
+ const holderIcon = holderIconMap[holderType] || holderIconMap.minors;
72
+ if (!holderIds.length) {
73
+ if (!showUnassigned) return null;
74
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__holders` }, /* @__PURE__ */ import_react.default.createElement("div", { className: "holder-item unassigned" }, holderMaxCount > 1 ? /* @__PURE__ */ import_react.default.createElement("span", null, holderMaxCount, "/", holderMaxCount, " ") : null, /* @__PURE__ */ import_react.default.createElement("span", { className: "holder-label" }, import_utils.locales.getText("pisell2.cart.sku-card.unassigned"))));
75
+ }
76
+ const renderHolder = (id, index) => {
77
+ const holder = holderOptions.find((item) => String(item.id) === String(id));
78
+ const label = (holder == null ? void 0 : holder.label) ?? String(id);
79
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "holder-item", key: `${id}-${index}` }, /* @__PURE__ */ import_react.default.createElement("span", { className: "holder-icon" }, /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: holderIcon })), /* @__PURE__ */ import_react.default.createElement("span", { className: "holder-label" }, label));
80
+ };
81
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__holders` }, holderIds.map((id, index) => renderHolder(id, index)));
82
+ };
83
+ var Holders_default = LineItemHolders;
@@ -0,0 +1,39 @@
1
+ .pisell-line-item__holders {
2
+ user-select: none;
3
+ display: flex;
4
+ gap: 16px;
5
+ overflow: hidden;
6
+
7
+ .holder-item {
8
+ min-width: 30px;
9
+ display: flex;
10
+ align-items: center;
11
+ overflow: hidden;
12
+ white-space: nowrap;
13
+
14
+ .holder-icon {
15
+ margin-right: 2px;
16
+ color: #7f56da;
17
+ font-size: 16px;
18
+ }
19
+
20
+ .holder-label {
21
+ display: inline-block;
22
+ overflow: hidden;
23
+ color: #667085;
24
+ font-size: 14px;
25
+ font-weight: 500;
26
+ line-height: 20px;
27
+ text-overflow: ellipsis;
28
+ white-space: nowrap;
29
+ }
30
+ }
31
+
32
+ .unassigned {
33
+ color: red;
34
+
35
+ .holder-label {
36
+ color: red;
37
+ }
38
+ }
39
+ }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { ProductCardTypes } from '../types';
3
- import type { itemType, LineItemStatusOption, LineItemType } from './types';
3
+ import type { itemType, LineItemHolderOption, LineItemStatusOption, LineItemType } from './types';
4
4
  import './index.less';
5
5
  export declare const PREFIX = "pisell-line-item";
6
- export type { itemType, LineItemStatusOption, LineItemType } from './types';
6
+ export type { itemType, LineItemHolderOption, LineItemStatusOption, LineItemType, } from './types';
7
7
  declare type LocalizedText = string | Record<string, unknown> | null | undefined;
8
8
  export interface LineItemProps extends Omit<ProductCardTypes, 'dataSource'> {
9
9
  dataSource: any;
@@ -15,6 +15,7 @@ export interface LineItemProps extends Omit<ProductCardTypes, 'dataSource'> {
15
15
  statusLoading?: boolean;
16
16
  statusDisabled?: boolean;
17
17
  isShowRelatedProduct?: boolean;
18
+ holderOptions?: LineItemHolderOption[];
18
19
  onBookingStatusChange?: (status: string, item: any) => void;
19
20
  }
20
21
  export declare const convertProductToLineItemProduct: (product: any, translationOriginal: (text: LocalizedText) => string, symbol: string) => {
@@ -29,10 +30,10 @@ export declare const convertProductToLineItemProduct: (product: any, translation
29
30
  image: any;
30
31
  num: any;
31
32
  quantity: any;
32
- price: any;
33
- total: any;
34
- origin_total: any;
35
- original_total: any;
33
+ price: number;
34
+ total: number;
35
+ origin_total: number;
36
+ original_total: number;
36
37
  source_product_price: any;
37
38
  selling_price: any;
38
39
  payment_price: any;
@@ -45,6 +46,7 @@ export declare const convertProductToLineItemProduct: (product: any, translation
45
46
  product_option_string: string;
46
47
  discount_list: any;
47
48
  promotions: any;
49
+ discount_reason: any;
48
50
  isGift: boolean;
49
51
  giftData: any;
50
52
  _origin: any;
@@ -57,8 +59,8 @@ export declare const convertProductToLineItemProduct: (product: any, translation
57
59
  quantity: any;
58
60
  };
59
61
  note: any;
60
- total: any;
61
- origin_total: any;
62
+ total: number;
63
+ origin_total: number;
62
64
  payment_price: any;
63
65
  };
64
66
  };