@pisell/materials 6.11.46 → 6.11.48

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 (31) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/pisellFloorMapLayout/components/ViewControls.less +3 -3
  12. package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +41 -15
  13. package/es/components/productCard/cartSkuCard/components/weighing/index.d.ts +18 -0
  14. package/es/components/productCard/cartSkuCard/components/weighing/index.js +39 -0
  15. package/es/components/productCard/cartSkuCard/components/weighing/index.less +25 -0
  16. package/es/components/productCard/cartSkuCard/locales.d.ts +20 -0
  17. package/es/components/productCard/cartSkuCard/locales.js +20 -0
  18. package/lib/components/pisellFloorMapLayout/components/ViewControls.less +3 -3
  19. package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +50 -12
  20. package/lib/components/productCard/cartSkuCard/components/weighing/index.d.ts +18 -0
  21. package/lib/components/productCard/cartSkuCard/components/weighing/index.js +61 -0
  22. package/lib/components/productCard/cartSkuCard/components/weighing/index.less +25 -0
  23. package/lib/components/productCard/cartSkuCard/locales.d.ts +20 -0
  24. package/lib/components/productCard/cartSkuCard/locales.js +20 -0
  25. package/package.json +3 -3
  26. package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +0 -35
  27. package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +0 -55
  28. package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +0 -12
  29. package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +0 -35
  30. package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +0 -55
  31. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +0 -12
@@ -133,16 +133,16 @@
133
133
  /**
134
134
  * 工具按钮激活态(展开条内与外侧折叠 pill 共用同一套色值)。
135
135
  * 主色链:`--color-primary`(与主色展开键、业务 HUD 一致)→ `--fmap-primary`(PisellFloorMapLayout 注入)
136
- * → 兜底 #1677ff。淡底用 color-mix 12%/18% hover。
136
+ * → 兜底 #1677ff。淡底用 color-mix 25%/32% hover。
137
137
  */
138
138
  .vc-tool-btn-active-colors() {
139
139
  @vc-p: var(--color-primary, var(--fmap-primary, #1677ff));
140
140
 
141
- background: color-mix(in srgb, @vc-p 12%, #fff);
141
+ background: color-mix(in srgb, @vc-p 25%, #fff);
142
142
  color: @vc-p;
143
143
 
144
144
  &:hover {
145
- background: color-mix(in srgb, @vc-p 18%, #fff);
145
+ background: color-mix(in srgb, @vc-p 32%, #fff);
146
146
  color: @vc-p;
147
147
  }
148
148
 
@@ -3,10 +3,20 @@ import classNames from 'classnames';
3
3
  import { image as imageAli, formatAmount } from '@pisell/utils';
4
4
  import Specs from "../specs";
5
5
  import Holders from "../holders";
6
+ import Weighing from "../weighing";
6
7
  import { PREFIX } from "../../index";
7
8
  import EditButton from "../../../components/Header/EditButton";
8
9
  import "./index.less";
10
+
11
+ /** 每种重量单位对应的展示缩写。 */
12
+ var UNIT_LABEL = {
13
+ KILOGRAMS: 'kg',
14
+ GRAMS: 'g',
15
+ POUNDS: 'lb',
16
+ OUNCES: 'oz'
17
+ };
9
18
  var BasicInfo = function BasicInfo(props) {
19
+ var _origin;
10
20
  var isShowImage = props.isShowImage,
11
21
  _props$dataSource = props.dataSource,
12
22
  dataSource = _props$dataSource === void 0 ? {} : _props$dataSource,
@@ -49,6 +59,29 @@ var BasicInfo = function BasicInfo(props) {
49
59
  }, num < 100 ? num : '99+');
50
60
  };
51
61
  var hasSpecs = (bundle === null || bundle === void 0 ? void 0 : bundle.length) || (options === null || options === void 0 ? void 0 : options.length) || product_option_string;
62
+ var weighingInfo = dataSource === null || dataSource === void 0 || (_origin = dataSource._origin) === null || _origin === void 0 || (_origin = _origin._extend) === null || _origin === void 0 ? void 0 : _origin.weighing;
63
+ var hasWeighingInfo = Boolean(weighingInfo && (Number.isFinite(Number(weighingInfo === null || weighingInfo === void 0 ? void 0 : weighingInfo.weight)) || Number.isFinite(Number(weighingInfo === null || weighingInfo === void 0 ? void 0 : weighingInfo.net_weight))));
64
+ var hasProductMeta = hasSpecs || hasWeighingInfo;
65
+ var renderProductMeta = function renderProductMeta() {
66
+ if (!hasProductMeta) {
67
+ return null;
68
+ }
69
+ return /*#__PURE__*/React.createElement(React.Fragment, null, hasWeighingInfo ? /*#__PURE__*/React.createElement(Weighing, {
70
+ dataSource: weighingInfo
71
+ }) : null, hasSpecs ? /*#__PURE__*/React.createElement(Specs, {
72
+ dataSource: dataSource,
73
+ maxSpecsCount: maxSpecsCount,
74
+ type: type
75
+ }) : null);
76
+ };
77
+ var renderProductPrice = function renderProductPrice() {
78
+ if (weighingInfo) {
79
+ var unit = weighingInfo.unit,
80
+ unit_price = weighingInfo.unit_price;
81
+ return "".concat(formatAmount(unit_price, 2, symbol), "/").concat(UNIT_LABEL[unit]);
82
+ }
83
+ return formatAmount(price, 2, symbol);
84
+ };
52
85
  var renderImage = function renderImage() {
53
86
  if (!isShowImage) return null;
54
87
  if (image) {
@@ -81,12 +114,12 @@ var BasicInfo = function BasicInfo(props) {
81
114
  }, [disabledEditClick]);
82
115
  var _isShowOriginalPrice = useMemo(function () {
83
116
  if (!isShowOriginalPrice) return false;
84
- if (hasSpecs) return false;
117
+ if (hasSpecs || hasWeighingInfo) return false;
85
118
  var _originalTotal = parseFloat(String(origin_total || 0));
86
119
  var _total = parseFloat(String(total || 0));
87
120
  if (isNaN(_originalTotal) || isNaN(total)) return false;
88
121
  return _originalTotal !== 0 && _originalTotal != _total;
89
- }, [isShowOriginalPrice, origin_total, total, hasSpecs]);
122
+ }, [isShowOriginalPrice, origin_total, total, hasSpecs, hasWeighingInfo]);
90
123
  if (type === 'a5') {
91
124
  return /*#__PURE__*/React.createElement("div", {
92
125
  className: "".concat(PREFIX, "__basic-info"),
@@ -101,9 +134,9 @@ var BasicInfo = function BasicInfo(props) {
101
134
  className: "product-basic-info-wrap"
102
135
  }, /*#__PURE__*/React.createElement("div", {
103
136
  className: "product-name ".concat(renderEdit ? 'product-name-edit' : '')
104
- }, name), (!holder_id || !(holder_id !== null && holder_id !== void 0 && holder_id.length)) && !isFormSubject ? /*#__PURE__*/React.createElement("div", {
137
+ }, name), renderProductMeta(), (!holder_id || !(holder_id !== null && holder_id !== void 0 && holder_id.length)) && !isFormSubject ? /*#__PURE__*/React.createElement("div", {
105
138
  className: "product-price"
106
- }, formatAmount(price, 2, symbol)) : /*#__PURE__*/React.createElement(Holders, {
139
+ }, renderProductPrice()) : /*#__PURE__*/React.createElement(Holders, {
107
140
  dataSource: dataSource
108
141
  })), renderEdit));
109
142
  }
@@ -128,13 +161,9 @@ var BasicInfo = function BasicInfo(props) {
128
161
  className: "product-name ".concat(renderEdit ? 'product-name-edit' : '')
129
162
  }, name), /*#__PURE__*/React.createElement("div", {
130
163
  className: "product-price"
131
- }, /*#__PURE__*/React.createElement("span", null, formatAmount(_price, 2, symbol)), _isShowOriginalPrice ? /*#__PURE__*/React.createElement("span", {
164
+ }, /*#__PURE__*/React.createElement("span", null, renderProductPrice()), _isShowOriginalPrice ? /*#__PURE__*/React.createElement("span", {
132
165
  className: "original-price"
133
- }, formatAmount(origin_total, 2, symbol)) : null)), hasSpecs ? /*#__PURE__*/React.createElement(Specs, {
134
- dataSource: dataSource,
135
- maxSpecsCount: maxSpecsCount,
136
- type: type
137
- }) : null), renderEdit));
166
+ }, formatAmount(origin_total, 2, symbol)) : null)), renderProductMeta()), renderEdit));
138
167
  }
139
168
  return /*#__PURE__*/React.createElement("div", {
140
169
  className: "".concat(PREFIX, "__basic-info"),
@@ -147,12 +176,9 @@ var BasicInfo = function BasicInfo(props) {
147
176
  className: "product-info"
148
177
  }, /*#__PURE__*/React.createElement("div", {
149
178
  className: "product-name"
150
- }, name), hasSpecs ? /*#__PURE__*/React.createElement(Specs, {
151
- dataSource: dataSource,
152
- maxSpecsCount: maxSpecsCount
153
- }) : /*#__PURE__*/React.createElement("div", {
179
+ }, name), hasProductMeta ? renderProductMeta() : /*#__PURE__*/React.createElement("div", {
154
180
  className: "product-price"
155
- }, formatAmount(price, 2, symbol))), /*#__PURE__*/React.createElement("div", {
181
+ }, renderProductPrice())), /*#__PURE__*/React.createElement("div", {
156
182
  className: "product-amount"
157
183
  }, /*#__PURE__*/React.createElement("div", {
158
184
  className: "total-amont"
@@ -0,0 +1,18 @@
1
+ import './index.less';
2
+ declare type WeightUnit = 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
3
+ interface WeighingInfo {
4
+ weight?: number;
5
+ tare?: {
6
+ id?: string;
7
+ label?: string;
8
+ value?: number;
9
+ unit?: WeightUnit;
10
+ };
11
+ net_weight?: number;
12
+ unit?: WeightUnit;
13
+ }
14
+ interface WeighingProps {
15
+ dataSource?: WeighingInfo;
16
+ }
17
+ declare const Weighing: (props: WeighingProps) => JSX.Element | null;
18
+ export default Weighing;
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { locales } from '@pisell/utils';
3
+ import { PREFIX } from "../../index";
4
+ import "./index.less";
5
+ var UNIT_LABEL_MAP = {
6
+ KILOGRAMS: 'kg',
7
+ GRAMS: 'g',
8
+ POUNDS: 'lb',
9
+ OUNCES: 'oz'
10
+ };
11
+ var formatWeight = function formatWeight(value, unit) {
12
+ var parsedValue = Number(value);
13
+ var displayValue = Number.isFinite(parsedValue) ? parsedValue : 0;
14
+ var displayUnit = UNIT_LABEL_MAP[unit || 'KILOGRAMS'];
15
+ return "".concat(displayValue.toFixed(3), " ").concat(displayUnit);
16
+ };
17
+ var Weighing = function Weighing(props) {
18
+ var dataSource = props.dataSource;
19
+ if (!dataSource) {
20
+ return null;
21
+ }
22
+ var weight = dataSource.weight,
23
+ tare = dataSource.tare,
24
+ net_weight = dataSource.net_weight,
25
+ _dataSource$unit = dataSource.unit,
26
+ unit = _dataSource$unit === void 0 ? 'KILOGRAMS' : _dataSource$unit;
27
+ var tareValue = Number((tare === null || tare === void 0 ? void 0 : tare.value) || 0);
28
+ var tareLabel = (tare === null || tare === void 0 ? void 0 : tare.label) || locales.getText('pisell2.cart.sku-card.weighing.tare');
29
+ return /*#__PURE__*/React.createElement("div", {
30
+ className: "".concat(PREFIX, "__weighing")
31
+ }, /*#__PURE__*/React.createElement("div", {
32
+ className: "".concat(PREFIX, "__weighing-row")
33
+ }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.cart.sku-card.weighing.gross'), ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(weight, unit))), tareValue > 0 ? /*#__PURE__*/React.createElement("div", {
34
+ className: "".concat(PREFIX, "__weighing-row")
35
+ }, /*#__PURE__*/React.createElement("span", null, tareLabel, ":"), /*#__PURE__*/React.createElement("span", null, "-", formatWeight(tareValue, (tare === null || tare === void 0 ? void 0 : tare.unit) || unit))) : null, /*#__PURE__*/React.createElement("div", {
36
+ className: "".concat(PREFIX, "__weighing-row")
37
+ }, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.cart.sku-card.weighing.net'), ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(net_weight, unit))));
38
+ };
39
+ export default Weighing;
@@ -0,0 +1,25 @@
1
+ .pisell-cart-sku-card__weighing {
2
+ user-select: none;
3
+ color: #667085;
4
+ font-size: 14px;
5
+ font-weight: 400;
6
+ line-height: 20px;
7
+ overflow: hidden;
8
+ display: flex;
9
+ flex-direction: column;
10
+
11
+ &-row {
12
+ display: flex;
13
+ align-items: center;
14
+ gap: 4px;
15
+ overflow: hidden;
16
+ white-space: nowrap;
17
+ text-overflow: ellipsis;
18
+
19
+ > span {
20
+ overflow: hidden;
21
+ text-overflow: ellipsis;
22
+ white-space: nowrap;
23
+ }
24
+ }
25
+ }
@@ -6,6 +6,10 @@ declare const _default: {
6
6
  'pisell2.cart.sku-card.sales.title': string;
7
7
  'pisell2.cart.sku-card.actions.delete': string;
8
8
  'pisell2.cart.sku-card.unassigned': string;
9
+ 'pisell2.cart.sku-card.weighing.gross': string;
10
+ 'pisell2.cart.sku-card.weighing.tare': string;
11
+ 'pisell2.cart.sku-card.weighing.net': string;
12
+ 'pisell2.cart.sku-card.weighing.noTare': string;
9
13
  'pisell2.cart.sku-card.gift.title': string;
10
14
  'pisell2.cart.sku-card.gift.select.title': string;
11
15
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -41,6 +45,10 @@ declare const _default: {
41
45
  'pisell2.cart.sku-card.sales.title': string;
42
46
  'pisell2.cart.sku-card.actions.delete': string;
43
47
  'pisell2.cart.sku-card.unassigned': string;
48
+ 'pisell2.cart.sku-card.weighing.gross': string;
49
+ 'pisell2.cart.sku-card.weighing.tare': string;
50
+ 'pisell2.cart.sku-card.weighing.net': string;
51
+ 'pisell2.cart.sku-card.weighing.noTare': string;
44
52
  'pisell2.cart.sku-card.gift.title': string;
45
53
  'pisell2.cart.sku-card.gift.select.title': string;
46
54
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -76,6 +84,10 @@ declare const _default: {
76
84
  'pisell2.cart.sku-card.sales.title': string;
77
85
  'pisell2.cart.sku-card.actions.delete': string;
78
86
  'pisell2.cart.sku-card.unassigned': string;
87
+ 'pisell2.cart.sku-card.weighing.gross': string;
88
+ 'pisell2.cart.sku-card.weighing.tare': string;
89
+ 'pisell2.cart.sku-card.weighing.net': string;
90
+ 'pisell2.cart.sku-card.weighing.noTare': string;
79
91
  'pisell2.cart.sku-card.gift.title': string;
80
92
  'pisell2.cart.sku-card.gift.select.title': string;
81
93
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -111,6 +123,10 @@ declare const _default: {
111
123
  'pisell2.cart.sku-card.sales.title': string;
112
124
  'pisell2.cart.sku-card.actions.delete': string;
113
125
  'pisell2.cart.sku-card.unassigned': string;
126
+ 'pisell2.cart.sku-card.weighing.gross': string;
127
+ 'pisell2.cart.sku-card.weighing.tare': string;
128
+ 'pisell2.cart.sku-card.weighing.net': string;
129
+ 'pisell2.cart.sku-card.weighing.noTare': string;
114
130
  'pisell2.cart.sku-card.gift.title': string;
115
131
  'pisell2.cart.sku-card.gift.select.title': string;
116
132
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -146,6 +162,10 @@ declare const _default: {
146
162
  'pisell2.cart.sku-card.sales.title': string;
147
163
  'pisell2.cart.sku-card.actions.delete': string;
148
164
  'pisell2.cart.sku-card.unassigned': string;
165
+ 'pisell2.cart.sku-card.weighing.gross': string;
166
+ 'pisell2.cart.sku-card.weighing.tare': string;
167
+ 'pisell2.cart.sku-card.weighing.net': string;
168
+ 'pisell2.cart.sku-card.weighing.noTare': string;
149
169
  'pisell2.cart.sku-card.gift.title': string;
150
170
  'pisell2.cart.sku-card.gift.select.title': string;
151
171
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -13,6 +13,10 @@ export default {
13
13
  'pisell2.cart.sku-card.sales.title': 'Sales',
14
14
  'pisell2.cart.sku-card.actions.delete': 'Delete',
15
15
  'pisell2.cart.sku-card.unassigned': 'Unassigned',
16
+ 'pisell2.cart.sku-card.weighing.gross': 'Gross',
17
+ 'pisell2.cart.sku-card.weighing.tare': 'Tare',
18
+ 'pisell2.cart.sku-card.weighing.net': 'Net',
19
+ 'pisell2.cart.sku-card.weighing.noTare': 'No tare',
16
20
  'pisell2.cart.sku-card.gift.title': 'Gift',
17
21
  'pisell2.cart.sku-card.gift.select.title': 'Select Gift',
18
22
  'pisell2.cart.sku-card.gift.total': function pisell2CartSkuCardGiftTotal(num) {
@@ -26,6 +30,10 @@ export default {
26
30
  'pisell2.cart.sku-card.sales.title': '销售',
27
31
  'pisell2.cart.sku-card.actions.delete': '删除',
28
32
  'pisell2.cart.sku-card.unassigned': '未分配',
33
+ 'pisell2.cart.sku-card.weighing.gross': '毛重',
34
+ 'pisell2.cart.sku-card.weighing.tare': '皮重',
35
+ 'pisell2.cart.sku-card.weighing.net': '净重',
36
+ 'pisell2.cart.sku-card.weighing.noTare': '无皮重',
29
37
  'pisell2.cart.sku-card.gift.title': '赠品',
30
38
  'pisell2.cart.sku-card.gift.select.title': '选择赠品',
31
39
  'pisell2.cart.sku-card.gift.total': function pisell2CartSkuCardGiftTotal(num) {
@@ -39,6 +47,10 @@ export default {
39
47
  'pisell2.cart.sku-card.sales.title': '銷售',
40
48
  'pisell2.cart.sku-card.actions.delete': '刪除',
41
49
  'pisell2.cart.sku-card.unassigned': '未分配',
50
+ 'pisell2.cart.sku-card.weighing.gross': '毛重',
51
+ 'pisell2.cart.sku-card.weighing.tare': '皮重',
52
+ 'pisell2.cart.sku-card.weighing.net': '淨重',
53
+ 'pisell2.cart.sku-card.weighing.noTare': '無皮重',
42
54
  'pisell2.cart.sku-card.gift.title': '贈品',
43
55
  'pisell2.cart.sku-card.gift.select.title': '選擇贈品',
44
56
  'pisell2.cart.sku-card.gift.total': function pisell2CartSkuCardGiftTotal(num) {
@@ -52,6 +64,10 @@ export default {
52
64
  'pisell2.cart.sku-card.sales.title': 'セール',
53
65
  'pisell2.cart.sku-card.actions.delete': '削除',
54
66
  'pisell2.cart.sku-card.unassigned': '未割り当て',
67
+ 'pisell2.cart.sku-card.weighing.gross': '総重量',
68
+ 'pisell2.cart.sku-card.weighing.tare': '風袋',
69
+ 'pisell2.cart.sku-card.weighing.net': '正味重量',
70
+ 'pisell2.cart.sku-card.weighing.noTare': '風袋なし',
55
71
  'pisell2.cart.sku-card.gift.title': 'プレゼント',
56
72
  'pisell2.cart.sku-card.gift.select.title': 'プレゼントを選択',
57
73
  'pisell2.cart.sku-card.gift.total': function pisell2CartSkuCardGiftTotal(num) {
@@ -65,6 +81,10 @@ export default {
65
81
  'pisell2.cart.sku-card.sales.title': 'Vendas',
66
82
  'pisell2.cart.sku-card.actions.delete': 'Excluir',
67
83
  'pisell2.cart.sku-card.unassigned': 'Não atribuído',
84
+ 'pisell2.cart.sku-card.weighing.gross': 'Peso bruto',
85
+ 'pisell2.cart.sku-card.weighing.tare': 'Tara',
86
+ 'pisell2.cart.sku-card.weighing.net': 'Peso líquido',
87
+ 'pisell2.cart.sku-card.weighing.noTare': 'Sem tara',
68
88
  'pisell2.cart.sku-card.gift.title': 'Brinde',
69
89
  'pisell2.cart.sku-card.gift.select.title': 'Escolher brinde',
70
90
  'pisell2.cart.sku-card.gift.total': function pisell2CartSkuCardGiftTotal(num) {
@@ -133,16 +133,16 @@
133
133
  /**
134
134
  * 工具按钮激活态(展开条内与外侧折叠 pill 共用同一套色值)。
135
135
  * 主色链:`--color-primary`(与主色展开键、业务 HUD 一致)→ `--fmap-primary`(PisellFloorMapLayout 注入)
136
- * → 兜底 #1677ff。淡底用 color-mix 12%/18% hover。
136
+ * → 兜底 #1677ff。淡底用 color-mix 25%/32% hover。
137
137
  */
138
138
  .vc-tool-btn-active-colors() {
139
139
  @vc-p: var(--color-primary, var(--fmap-primary, #1677ff));
140
140
 
141
- background: color-mix(in srgb, @vc-p 12%, #fff);
141
+ background: color-mix(in srgb, @vc-p 25%, #fff);
142
142
  color: @vc-p;
143
143
 
144
144
  &:hover {
145
- background: color-mix(in srgb, @vc-p 18%, #fff);
145
+ background: color-mix(in srgb, @vc-p 32%, #fff);
146
146
  color: @vc-p;
147
147
  }
148
148
 
@@ -37,10 +37,18 @@ var import_classnames = __toESM(require("classnames"));
37
37
  var import_utils = require("@pisell/utils");
38
38
  var import_specs = __toESM(require("../specs"));
39
39
  var import_holders = __toESM(require("../holders"));
40
+ var import_weighing = __toESM(require("../weighing"));
40
41
  var import__ = require("../../index");
41
42
  var import_EditButton = __toESM(require("../../../components/Header/EditButton"));
42
43
  var import_index = require("./index.less");
44
+ var UNIT_LABEL = {
45
+ KILOGRAMS: "kg",
46
+ GRAMS: "g",
47
+ POUNDS: "lb",
48
+ OUNCES: "oz"
49
+ };
43
50
  var BasicInfo = (props) => {
51
+ var _a, _b;
44
52
  const {
45
53
  isShowImage,
46
54
  dataSource = {},
@@ -82,6 +90,31 @@ var BasicInfo = (props) => {
82
90
  );
83
91
  };
84
92
  const hasSpecs = (bundle == null ? void 0 : bundle.length) || (options == null ? void 0 : options.length) || product_option_string;
93
+ const weighingInfo = (_b = (_a = dataSource == null ? void 0 : dataSource._origin) == null ? void 0 : _a._extend) == null ? void 0 : _b.weighing;
94
+ const hasWeighingInfo = Boolean(
95
+ weighingInfo && (Number.isFinite(Number(weighingInfo == null ? void 0 : weighingInfo.weight)) || Number.isFinite(Number(weighingInfo == null ? void 0 : weighingInfo.net_weight)))
96
+ );
97
+ const hasProductMeta = hasSpecs || hasWeighingInfo;
98
+ const renderProductMeta = () => {
99
+ if (!hasProductMeta) {
100
+ return null;
101
+ }
102
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, hasWeighingInfo ? /* @__PURE__ */ import_react.default.createElement(import_weighing.default, { dataSource: weighingInfo }) : null, hasSpecs ? /* @__PURE__ */ import_react.default.createElement(
103
+ import_specs.default,
104
+ {
105
+ dataSource,
106
+ maxSpecsCount,
107
+ type
108
+ }
109
+ ) : null);
110
+ };
111
+ const renderProductPrice = () => {
112
+ if (weighingInfo) {
113
+ const { unit, unit_price } = weighingInfo;
114
+ return `${(0, import_utils.formatAmount)(unit_price, 2, symbol)}/${UNIT_LABEL[unit]}`;
115
+ }
116
+ return (0, import_utils.formatAmount)(price, 2, symbol);
117
+ };
85
118
  const renderImage = () => {
86
119
  if (!isShowImage) return null;
87
120
  if (image) {
@@ -92,16 +125,22 @@ var BasicInfo = (props) => {
92
125
  };
93
126
  const renderEdit = (0, import_react.useMemo)(() => {
94
127
  if (!isShowEditProduct) return null;
95
- return /* @__PURE__ */ import_react.default.createElement(import_EditButton.default, { onEdit: () => onEditProduct == null ? void 0 : onEditProduct(dataSource), disabledEditClick });
128
+ return /* @__PURE__ */ import_react.default.createElement(
129
+ import_EditButton.default,
130
+ {
131
+ onEdit: () => onEditProduct == null ? void 0 : onEditProduct(dataSource),
132
+ disabledEditClick
133
+ }
134
+ );
96
135
  }, [disabledEditClick]);
97
136
  const _isShowOriginalPrice = (0, import_react.useMemo)(() => {
98
137
  if (!isShowOriginalPrice) return false;
99
- if (hasSpecs) return false;
138
+ if (hasSpecs || hasWeighingInfo) return false;
100
139
  const _originalTotal = parseFloat(String(origin_total || 0));
101
140
  const _total = parseFloat(String(total || 0));
102
141
  if (isNaN(_originalTotal) || isNaN(total)) return false;
103
142
  return _originalTotal !== 0 && _originalTotal != _total;
104
- }, [isShowOriginalPrice, origin_total, total, hasSpecs]);
143
+ }, [isShowOriginalPrice, origin_total, total, hasSpecs, hasWeighingInfo]);
105
144
  if (type === "a5") {
106
145
  return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__basic-info`, style: style || {} }, renderNumTag(), renderImage(), !isShowImage || !image && !name ? /* @__PURE__ */ import_react.default.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-info product-info-a5` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-basic-info-wrap` }, /* @__PURE__ */ import_react.default.createElement(
107
146
  "div",
@@ -109,20 +148,19 @@ var BasicInfo = (props) => {
109
148
  className: `product-name ${renderEdit ? "product-name-edit" : ""}`
110
149
  },
111
150
  name
112
- ), (!holder_id || !(holder_id == null ? void 0 : holder_id.length)) && !isFormSubject ? /* @__PURE__ */ import_react.default.createElement("div", { className: `product-price` }, (0, import_utils.formatAmount)(price, 2, symbol)) : /* @__PURE__ */ import_react.default.createElement(import_holders.default, { dataSource })), renderEdit));
151
+ ), renderProductMeta(), (!holder_id || !(holder_id == null ? void 0 : holder_id.length)) && !isFormSubject ? /* @__PURE__ */ import_react.default.createElement("div", { className: `product-price` }, renderProductPrice()) : /* @__PURE__ */ import_react.default.createElement(import_holders.default, { dataSource })), renderEdit));
113
152
  }
114
153
  if (type === "a9") {
115
154
  const showAmount = isBundle && !showFooter;
116
155
  const _price = showAmount ? Number(price ?? 0) * num : price;
117
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__basic-info`, style: style || {} }, renderNumTag(), renderImage(), !isShowImage || !image && !name ? /* @__PURE__ */ import_react.default.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-info product-info-a9` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-basic-info-wrap` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-basic-info ${isBundle ? "row" : ""}` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-name ${renderEdit ? "product-name-edit" : ""}` }, name), /* @__PURE__ */ import_react.default.createElement("div", { className: `product-price` }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_utils.formatAmount)(_price, 2, symbol)), _isShowOriginalPrice ? /* @__PURE__ */ import_react.default.createElement("span", { className: `original-price` }, (0, import_utils.formatAmount)(origin_total, 2, symbol)) : null)), hasSpecs ? /* @__PURE__ */ import_react.default.createElement(
118
- import_specs.default,
156
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__basic-info`, style: style || {} }, renderNumTag(), renderImage(), !isShowImage || !image && !name ? /* @__PURE__ */ import_react.default.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-info product-info-a9` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-basic-info-wrap` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-basic-info ${isBundle ? "row" : ""}` }, /* @__PURE__ */ import_react.default.createElement(
157
+ "div",
119
158
  {
120
- dataSource,
121
- maxSpecsCount,
122
- type
123
- }
124
- ) : null), renderEdit));
159
+ className: `product-name ${renderEdit ? "product-name-edit" : ""}`
160
+ },
161
+ name
162
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: `product-price` }, /* @__PURE__ */ import_react.default.createElement("span", null, renderProductPrice()), _isShowOriginalPrice ? /* @__PURE__ */ import_react.default.createElement("span", { className: `original-price` }, (0, import_utils.formatAmount)(origin_total, 2, symbol)) : null)), renderProductMeta()), renderEdit));
125
163
  }
126
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__basic-info`, style: style || {} }, renderNumTag(), renderImage(), !isShowImage || !image && !name ? /* @__PURE__ */ import_react.default.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-info` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-name` }, name), hasSpecs ? /* @__PURE__ */ import_react.default.createElement(import_specs.default, { dataSource, maxSpecsCount }) : /* @__PURE__ */ import_react.default.createElement("div", { className: `product-price` }, (0, import_utils.formatAmount)(price, 2, symbol))), /* @__PURE__ */ import_react.default.createElement("div", { className: `product-amount` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `total-amont` }, (0, import_utils.formatAmount)(total * num - (totalDifference ?? 0), 2, symbol)), origin_total && Number(total) !== Number(origin_total) ? /* @__PURE__ */ import_react.default.createElement("div", { className: `origin-amount` }, (0, import_utils.formatAmount)(origin_total * num, 2, symbol)) : null));
164
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__basic-info`, style: style || {} }, renderNumTag(), renderImage(), !isShowImage || !image && !name ? /* @__PURE__ */ import_react.default.createElement("div", { style: { width: 20 } }) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-info` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `product-name` }, name), hasProductMeta ? renderProductMeta() : /* @__PURE__ */ import_react.default.createElement("div", { className: `product-price` }, renderProductPrice())), /* @__PURE__ */ import_react.default.createElement("div", { className: `product-amount` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `total-amont` }, (0, import_utils.formatAmount)(total * num - (totalDifference ?? 0), 2, symbol)), origin_total && Number(total) !== Number(origin_total) ? /* @__PURE__ */ import_react.default.createElement("div", { className: `origin-amount` }, (0, import_utils.formatAmount)(origin_total * num, 2, symbol)) : null));
127
165
  };
128
166
  var basicInfo_default = BasicInfo;
@@ -0,0 +1,18 @@
1
+ import './index.less';
2
+ declare type WeightUnit = 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
3
+ interface WeighingInfo {
4
+ weight?: number;
5
+ tare?: {
6
+ id?: string;
7
+ label?: string;
8
+ value?: number;
9
+ unit?: WeightUnit;
10
+ };
11
+ net_weight?: number;
12
+ unit?: WeightUnit;
13
+ }
14
+ interface WeighingProps {
15
+ dataSource?: WeighingInfo;
16
+ }
17
+ declare const Weighing: (props: WeighingProps) => JSX.Element | null;
18
+ export default Weighing;
@@ -0,0 +1,61 @@
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/cartSkuCard/components/weighing/index.tsx
30
+ var weighing_exports = {};
31
+ __export(weighing_exports, {
32
+ default: () => weighing_default
33
+ });
34
+ module.exports = __toCommonJS(weighing_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
37
+ var import__ = require("../../index");
38
+ var import_index = require("./index.less");
39
+ var UNIT_LABEL_MAP = {
40
+ KILOGRAMS: "kg",
41
+ GRAMS: "g",
42
+ POUNDS: "lb",
43
+ OUNCES: "oz"
44
+ };
45
+ var formatWeight = (value, unit) => {
46
+ const parsedValue = Number(value);
47
+ const displayValue = Number.isFinite(parsedValue) ? parsedValue : 0;
48
+ const displayUnit = UNIT_LABEL_MAP[unit || "KILOGRAMS"];
49
+ return `${displayValue.toFixed(3)} ${displayUnit}`;
50
+ };
51
+ var Weighing = (props) => {
52
+ const { dataSource } = props;
53
+ if (!dataSource) {
54
+ return null;
55
+ }
56
+ const { weight, tare, net_weight, unit = "KILOGRAMS" } = dataSource;
57
+ const tareValue = Number((tare == null ? void 0 : tare.value) || 0);
58
+ const tareLabel = (tare == null ? void 0 : tare.label) || import_utils.locales.getText("pisell2.cart.sku-card.weighing.tare");
59
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.cart.sku-card.weighing.gross"), ":"), /* @__PURE__ */ import_react.default.createElement("span", null, formatWeight(weight, unit))), tareValue > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, tareLabel, ":"), /* @__PURE__ */ import_react.default.createElement("span", null, "-", formatWeight(tareValue, (tare == null ? void 0 : tare.unit) || unit))) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__weighing-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell2.cart.sku-card.weighing.net"), ":"), /* @__PURE__ */ import_react.default.createElement("span", null, formatWeight(net_weight, unit))));
60
+ };
61
+ var weighing_default = Weighing;
@@ -0,0 +1,25 @@
1
+ .pisell-cart-sku-card__weighing {
2
+ user-select: none;
3
+ color: #667085;
4
+ font-size: 14px;
5
+ font-weight: 400;
6
+ line-height: 20px;
7
+ overflow: hidden;
8
+ display: flex;
9
+ flex-direction: column;
10
+
11
+ &-row {
12
+ display: flex;
13
+ align-items: center;
14
+ gap: 4px;
15
+ overflow: hidden;
16
+ white-space: nowrap;
17
+ text-overflow: ellipsis;
18
+
19
+ > span {
20
+ overflow: hidden;
21
+ text-overflow: ellipsis;
22
+ white-space: nowrap;
23
+ }
24
+ }
25
+ }
@@ -6,6 +6,10 @@ declare const _default: {
6
6
  'pisell2.cart.sku-card.sales.title': string;
7
7
  'pisell2.cart.sku-card.actions.delete': string;
8
8
  'pisell2.cart.sku-card.unassigned': string;
9
+ 'pisell2.cart.sku-card.weighing.gross': string;
10
+ 'pisell2.cart.sku-card.weighing.tare': string;
11
+ 'pisell2.cart.sku-card.weighing.net': string;
12
+ 'pisell2.cart.sku-card.weighing.noTare': string;
9
13
  'pisell2.cart.sku-card.gift.title': string;
10
14
  'pisell2.cart.sku-card.gift.select.title': string;
11
15
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -41,6 +45,10 @@ declare const _default: {
41
45
  'pisell2.cart.sku-card.sales.title': string;
42
46
  'pisell2.cart.sku-card.actions.delete': string;
43
47
  'pisell2.cart.sku-card.unassigned': string;
48
+ 'pisell2.cart.sku-card.weighing.gross': string;
49
+ 'pisell2.cart.sku-card.weighing.tare': string;
50
+ 'pisell2.cart.sku-card.weighing.net': string;
51
+ 'pisell2.cart.sku-card.weighing.noTare': string;
44
52
  'pisell2.cart.sku-card.gift.title': string;
45
53
  'pisell2.cart.sku-card.gift.select.title': string;
46
54
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -76,6 +84,10 @@ declare const _default: {
76
84
  'pisell2.cart.sku-card.sales.title': string;
77
85
  'pisell2.cart.sku-card.actions.delete': string;
78
86
  'pisell2.cart.sku-card.unassigned': string;
87
+ 'pisell2.cart.sku-card.weighing.gross': string;
88
+ 'pisell2.cart.sku-card.weighing.tare': string;
89
+ 'pisell2.cart.sku-card.weighing.net': string;
90
+ 'pisell2.cart.sku-card.weighing.noTare': string;
79
91
  'pisell2.cart.sku-card.gift.title': string;
80
92
  'pisell2.cart.sku-card.gift.select.title': string;
81
93
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -111,6 +123,10 @@ declare const _default: {
111
123
  'pisell2.cart.sku-card.sales.title': string;
112
124
  'pisell2.cart.sku-card.actions.delete': string;
113
125
  'pisell2.cart.sku-card.unassigned': string;
126
+ 'pisell2.cart.sku-card.weighing.gross': string;
127
+ 'pisell2.cart.sku-card.weighing.tare': string;
128
+ 'pisell2.cart.sku-card.weighing.net': string;
129
+ 'pisell2.cart.sku-card.weighing.noTare': string;
114
130
  'pisell2.cart.sku-card.gift.title': string;
115
131
  'pisell2.cart.sku-card.gift.select.title': string;
116
132
  'pisell2.cart.sku-card.gift.total': (num: number) => string;
@@ -146,6 +162,10 @@ declare const _default: {
146
162
  'pisell2.cart.sku-card.sales.title': string;
147
163
  'pisell2.cart.sku-card.actions.delete': string;
148
164
  'pisell2.cart.sku-card.unassigned': string;
165
+ 'pisell2.cart.sku-card.weighing.gross': string;
166
+ 'pisell2.cart.sku-card.weighing.tare': string;
167
+ 'pisell2.cart.sku-card.weighing.net': string;
168
+ 'pisell2.cart.sku-card.weighing.noTare': string;
149
169
  'pisell2.cart.sku-card.gift.title': string;
150
170
  'pisell2.cart.sku-card.gift.select.title': string;
151
171
  'pisell2.cart.sku-card.gift.total': (num: number) => string;