@pisell/materials 6.11.96 → 6.11.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +6 -6
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/buttonGroupPreview/index.js +1 -2
- package/es/components/pisellFind/index.d.ts +12 -34
- package/es/components/pisellFind/index.js +18 -114
- package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.js +2 -4
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.js +3 -1
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.less +5 -0
- package/es/components/productCard/cartSkuCard/components/resources/index.less +0 -4
- package/es/components/productCard/cartSkuCard/components/weighing/index.js +3 -3
- package/es/components/productCard/cartSkuCard/components/weighing/index.less +5 -0
- package/es/components/productCard/lineItem/BookingLineItem.d.ts +1 -2
- package/es/components/productCard/lineItem/BookingLineItem.js +6 -15
- package/es/components/productCard/lineItem/index.d.ts +8 -10
- package/es/components/productCard/lineItem/index.js +13 -61
- package/es/components/productCard/lineItem/index.less +3 -3
- package/es/components/productCard/lineItem/types.d.ts +0 -4
- package/es/components/productCard/types.d.ts +0 -1
- package/lib/components/buttonGroupPreview/index.js +1 -2
- package/lib/components/pisellFind/index.d.ts +12 -34
- package/lib/components/pisellFind/index.js +5 -80
- package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.js +1 -1
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.js +17 -5
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.less +5 -0
- package/lib/components/productCard/cartSkuCard/components/resources/index.less +0 -4
- package/lib/components/productCard/cartSkuCard/components/weighing/index.js +21 -1
- package/lib/components/productCard/cartSkuCard/components/weighing/index.less +5 -0
- package/lib/components/productCard/lineItem/BookingLineItem.d.ts +1 -2
- package/lib/components/productCard/lineItem/BookingLineItem.js +2 -14
- package/lib/components/productCard/lineItem/index.d.ts +8 -10
- package/lib/components/productCard/lineItem/index.js +10 -51
- package/lib/components/productCard/lineItem/index.less +3 -3
- package/lib/components/productCard/lineItem/types.d.ts +0 -4
- package/lib/components/productCard/types.d.ts +0 -1
- package/lowcode/pisell-find/meta.ts +0 -19
- package/package.json +3 -3
- package/es/components/PisellScrollView/PisellScrollView.d.ts +0 -5
- package/es/components/PisellScrollView/components/Actions/index.d.ts +0 -18
- package/es/components/PisellScrollView/types.d.ts +0 -203
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +0 -3
- package/es/components/dataSourceComponents/fields/DatePicker/index.d.ts +0 -3
- package/es/components/dataSourceComponents/fields/Input.Mobile/serve.d.ts +0 -26
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +0 -27
- package/es/components/pisellDataSourceContainer/components/Pagination/index.d.ts +0 -6
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +0 -13
- package/es/components/pisellFloorMapLayout/appearance/floorMapAppearance.d.ts +0 -29
- package/es/components/pisellFloorMapLayout/components/EdgeLayer.d.ts +0 -37
- package/es/components/pisellFloorMapLayout/components/EditableItemLayer.d.ts +0 -66
- package/es/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.d.ts +0 -16
- package/es/components/pisellFloorMapLayout/components/FloorMapEditPanel.d.ts +0 -14
- package/es/components/pisellFloorMapLayout/components/FloorMapEditQuickActions.d.ts +0 -26
- package/es/components/pisellFloorMapLayout/components/FloorMapOverview.d.ts +0 -44
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +0 -84
- package/es/components/pisellFloorMapLayout/components/FloorMapToolbarViewAllModal.d.ts +0 -20
- package/es/components/pisellFloorMapLayout/components/FloorMapZoneElement.d.ts +0 -9
- package/es/components/pisellFloorMapLayout/components/NodePortMarkers.d.ts +0 -20
- package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +0 -61
- package/es/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +0 -28
- package/es/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.d.ts +0 -5
- package/es/components/pisellFloorMapLayout/floorMapLayoutConstants.d.ts +0 -35
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEdgeEditing.d.ts +0 -61
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEdgeViewModel.d.ts +0 -15
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +0 -79
- package/es/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +0 -91
- package/es/components/pisellFloorMapLayout/hooks/useShopFloorPlanSubscription.d.ts +0 -19
- package/es/components/pisellFloorMapLayout/index.d.ts +0 -37
- package/es/components/pisellFloorMapLayout/locales-ja.d.ts +0 -184
- package/es/components/pisellFloorMapLayout/locales-pt.d.ts +0 -184
- package/es/components/pisellFloorMapLayout/locales.d.ts +0 -969
- package/es/components/pisellFloorMapLayout/types.d.ts +0 -778
- package/es/components/pisellFloorMapLayout/utils/alignSnap.d.ts +0 -64
- package/es/components/pisellFloorMapLayout/utils/batchScenePlacementLayout.d.ts +0 -45
- package/es/components/pisellFloorMapLayout/utils/edgeRouting.d.ts +0 -267
- package/es/components/pisellFloorMapLayout/utils/floorMapConfigMerge.d.ts +0 -8
- package/es/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +0 -35
- package/es/components/pisellFloorMapLayout/utils/floorMapFallbackRender.d.ts +0 -11
- package/es/components/pisellFloorMapLayout/utils/floorMapOverviewLayout.d.ts +0 -44
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.d.ts +0 -27
- package/es/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.d.ts +0 -109
- package/es/components/pisellFloorMapLayout/utils/floorMapToolbarPalette.d.ts +0 -34
- package/es/components/productCard/lineItem/components/Holders/index.d.ts +0 -10
- package/es/components/productCard/lineItem/components/Holders/index.js +0 -74
- package/es/components/productCard/lineItem/components/Holders/index.less +0 -39
- package/es/components/productCard/lineItem/components/TimeRange/index.d.ts +0 -12
- package/lib/components/PisellScrollView/PisellScrollView.d.ts +0 -5
- package/lib/components/PisellScrollView/components/Actions/index.d.ts +0 -18
- package/lib/components/PisellScrollView/types.d.ts +0 -203
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +0 -3
- package/lib/components/dataSourceComponents/fields/DatePicker/index.d.ts +0 -3
- package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.d.ts +0 -26
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +0 -27
- package/lib/components/pisellDataSourceContainer/components/Pagination/index.d.ts +0 -6
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +0 -13
- package/lib/components/pisellFloorMapLayout/appearance/floorMapAppearance.d.ts +0 -29
- package/lib/components/pisellFloorMapLayout/components/EdgeLayer.d.ts +0 -37
- package/lib/components/pisellFloorMapLayout/components/EditableItemLayer.d.ts +0 -66
- package/lib/components/pisellFloorMapLayout/components/FloorMapEdgeEditPanel.d.ts +0 -16
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditPanel.d.ts +0 -14
- package/lib/components/pisellFloorMapLayout/components/FloorMapEditQuickActions.d.ts +0 -26
- package/lib/components/pisellFloorMapLayout/components/FloorMapOverview.d.ts +0 -44
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbar.d.ts +0 -84
- package/lib/components/pisellFloorMapLayout/components/FloorMapToolbarViewAllModal.d.ts +0 -20
- package/lib/components/pisellFloorMapLayout/components/FloorMapZoneElement.d.ts +0 -9
- package/lib/components/pisellFloorMapLayout/components/NodePortMarkers.d.ts +0 -20
- package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +0 -61
- package/lib/components/pisellFloorMapLayout/components/ViewControlsWithZoom.d.ts +0 -28
- package/lib/components/pisellFloorMapLayout/context/mergeFloorMapLayoutContext.d.ts +0 -5
- package/lib/components/pisellFloorMapLayout/floorMapLayoutConstants.d.ts +0 -35
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEdgeEditing.d.ts +0 -61
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEdgeViewModel.d.ts +0 -15
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapEditState.d.ts +0 -79
- package/lib/components/pisellFloorMapLayout/hooks/useFloorMapTransformMetrics.d.ts +0 -91
- package/lib/components/pisellFloorMapLayout/hooks/useShopFloorPlanSubscription.d.ts +0 -19
- package/lib/components/pisellFloorMapLayout/index.d.ts +0 -37
- package/lib/components/pisellFloorMapLayout/locales-ja.d.ts +0 -184
- package/lib/components/pisellFloorMapLayout/locales-pt.d.ts +0 -184
- package/lib/components/pisellFloorMapLayout/locales.d.ts +0 -969
- package/lib/components/pisellFloorMapLayout/types.d.ts +0 -778
- package/lib/components/pisellFloorMapLayout/utils/alignSnap.d.ts +0 -64
- package/lib/components/pisellFloorMapLayout/utils/batchScenePlacementLayout.d.ts +0 -45
- package/lib/components/pisellFloorMapLayout/utils/edgeRouting.d.ts +0 -267
- package/lib/components/pisellFloorMapLayout/utils/floorMapConfigMerge.d.ts +0 -8
- package/lib/components/pisellFloorMapLayout/utils/floorMapElementKindUtils.d.ts +0 -35
- package/lib/components/pisellFloorMapLayout/utils/floorMapFallbackRender.d.ts +0 -11
- package/lib/components/pisellFloorMapLayout/utils/floorMapOverviewLayout.d.ts +0 -44
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerDisplay.d.ts +0 -27
- package/lib/components/pisellFloorMapLayout/utils/floorMapResourcePickerTypes.d.ts +0 -109
- package/lib/components/pisellFloorMapLayout/utils/floorMapToolbarPalette.d.ts +0 -34
- package/lib/components/productCard/lineItem/components/Holders/index.d.ts +0 -10
- package/lib/components/productCard/lineItem/components/Holders/index.js +0 -83
- package/lib/components/productCard/lineItem/components/Holders/index.less +0 -39
- package/lib/components/productCard/lineItem/components/TimeRange/index.d.ts +0 -12
|
@@ -66,14 +66,13 @@ var ButtonGroupPreview = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
66
66
|
var btnProps = _objectSpread(_objectSpread({}, buttonProps), props.updateButtonProps);
|
|
67
67
|
var children = btnProps.children,
|
|
68
68
|
dropdownButtonProps = _objectWithoutProperties(btnProps, _excluded);
|
|
69
|
-
var moreButtonChildren = children !== null && children !== void 0 ? children : dropdownButtonProps.icon ? null : /*#__PURE__*/React.createElement(MoreOutlined, null);
|
|
70
69
|
return isMore ? /*#__PURE__*/React.createElement(Dropdown, {
|
|
71
70
|
menu: {
|
|
72
71
|
items: menuData
|
|
73
72
|
}
|
|
74
73
|
}, /*#__PURE__*/React.createElement(Button, _extends({
|
|
75
74
|
key: id
|
|
76
|
-
}, dropdownButtonProps),
|
|
75
|
+
}, dropdownButtonProps), children !== null && children !== void 0 ? children : /*#__PURE__*/React.createElement(MoreOutlined, null))) : /*#__PURE__*/React.createElement(Button, _extends({
|
|
77
76
|
key: id
|
|
78
77
|
}, btnProps));
|
|
79
78
|
}));
|
|
@@ -1,37 +1,10 @@
|
|
|
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
|
-
}
|
|
16
3
|
/**
|
|
17
4
|
* PisellFind Props
|
|
18
|
-
* 继承 PisellLookup 的所有 Props
|
|
5
|
+
* 继承 PisellLookup 的所有 Props
|
|
19
6
|
*/
|
|
20
|
-
export
|
|
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
|
-
}
|
|
7
|
+
export declare type PisellFindProps = PisellLookupProps;
|
|
35
8
|
/**
|
|
36
9
|
* PisellFind Ref
|
|
37
10
|
* 继承 PisellLookup 的所有 Ref 方法
|
|
@@ -46,17 +19,22 @@ export declare type PisellFindRef = PisellLookupRef;
|
|
|
46
19
|
* - 默认不显示确认按钮(输入即搜索)
|
|
47
20
|
* - 默认开启搜索历史
|
|
48
21
|
* - 默认不展示结果区(结果在页面其他位置展示)
|
|
49
|
-
* - 通过 `enableScanner` 接入扫码枪:使用宿主 `app.pubsub.subscribe(SCAN_RESULT_EVENT, ...)`,
|
|
50
|
-
* 每次扫码直接覆盖输入框内容并触发 onSearch / onScannerData;切回 false 时自动 unsubscribe。
|
|
51
22
|
*
|
|
52
23
|
* @example
|
|
53
24
|
* ```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 模式
|
|
54
34
|
* <PisellFind
|
|
55
35
|
* triggerType="input"
|
|
56
|
-
* enableScanner={isActive}
|
|
57
|
-
* onScannerData={(payload) => console.log('scan:', payload.data)}
|
|
58
36
|
* onSearch={(keyword) => filterData(keyword)}
|
|
59
37
|
* />
|
|
60
38
|
* ```
|
|
61
39
|
*/
|
|
62
|
-
export declare const PisellFind: React.ForwardRefExoticComponent<
|
|
40
|
+
export declare const PisellFind: React.ForwardRefExoticComponent<PisellLookupProps & React.RefAttributes<PisellLookupRef>>;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
var _excluded = ["triggerType", "buttonText", "placeholder", "showConfirmButton", "showHistory", "historyKey"
|
|
1
|
+
var _excluded = ["triggerType", "buttonText", "placeholder", "showConfirmButton", "showHistory", "historyKey"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
-
import React, { forwardRef
|
|
5
|
+
import React, { forwardRef } from 'react';
|
|
6
6
|
import { locales as utilsLocales } from '@pisell/utils';
|
|
7
7
|
import { PisellLookup } from "../pisellLookup";
|
|
8
|
-
import useEngineContext from "../../hooks/useEngineContext";
|
|
9
8
|
import { getText } from "../../locales";
|
|
10
9
|
|
|
11
|
-
/**
|
|
12
|
-
* 原生扫码事件名,对齐宿主端约定。
|
|
13
|
-
*/
|
|
14
|
-
export var SCAN_RESULT_EVENT = 'nativeScanResult';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 扫码枪回传数据(对齐宿主 ScanResultPayload)
|
|
18
|
-
* - code: 条码标识(如条码格式 / 业务字段)
|
|
19
|
-
* - data: 扫描得到的字符串值(写入输入框的内容)
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
10
|
/**
|
|
23
11
|
* PisellFind Props
|
|
24
|
-
* 继承 PisellLookup 的所有 Props
|
|
12
|
+
* 继承 PisellLookup 的所有 Props
|
|
25
13
|
*/
|
|
26
14
|
|
|
27
15
|
/**
|
|
@@ -32,27 +20,31 @@ export var SCAN_RESULT_EVENT = 'nativeScanResult';
|
|
|
32
20
|
/**
|
|
33
21
|
* PisellFind 组件
|
|
34
22
|
* 基于 PisellLookup 的组件内查找优化版本
|
|
35
|
-
*
|
|
23
|
+
*
|
|
36
24
|
* 核心特点:
|
|
37
25
|
* - 默认使用 button 触发器
|
|
38
26
|
* - 默认不显示确认按钮(输入即搜索)
|
|
39
27
|
* - 默认开启搜索历史
|
|
40
28
|
* - 默认不展示结果区(结果在页面其他位置展示)
|
|
41
|
-
*
|
|
42
|
-
* 每次扫码直接覆盖输入框内容并触发 onSearch / onScannerData;切回 false 时自动 unsubscribe。
|
|
43
|
-
*
|
|
29
|
+
*
|
|
44
30
|
* @example
|
|
45
31
|
* ```tsx
|
|
32
|
+
* // 基础用法
|
|
33
|
+
* <PisellFind
|
|
34
|
+
* onSearch={(keyword) => {
|
|
35
|
+
* const filtered = data.filter(item => item.name.includes(keyword));
|
|
36
|
+
* setFilteredData(filtered);
|
|
37
|
+
* }}
|
|
38
|
+
* />
|
|
39
|
+
*
|
|
40
|
+
* // 切换为 Input 模式
|
|
46
41
|
* <PisellFind
|
|
47
42
|
* triggerType="input"
|
|
48
|
-
* enableScanner={isActive}
|
|
49
|
-
* onScannerData={(payload) => console.log('scan:', payload.data)}
|
|
50
43
|
* onSearch={(keyword) => filterData(keyword)}
|
|
51
44
|
* />
|
|
52
45
|
* ```
|
|
53
46
|
*/
|
|
54
47
|
export var PisellFind = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
|
-
var _engineContext$appHel;
|
|
56
48
|
var _props$triggerType = props.triggerType,
|
|
57
49
|
triggerType = _props$triggerType === void 0 ? 'button' : _props$triggerType,
|
|
58
50
|
_props$buttonText = props.buttonText,
|
|
@@ -73,105 +65,17 @@ export var PisellFind = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
73
65
|
showHistory = _props$showHistory === void 0 ? true : _props$showHistory,
|
|
74
66
|
_props$historyKey = props.historyKey,
|
|
75
67
|
historyKey = _props$historyKey === void 0 ? 'pisell_find_history' : _props$historyKey,
|
|
76
|
-
_props$enableScanner = props.enableScanner,
|
|
77
|
-
enableScanner = _props$enableScanner === void 0 ? false : _props$enableScanner,
|
|
78
|
-
onScannerData = props.onScannerData,
|
|
79
|
-
onSearch = props.onSearch,
|
|
80
68
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
81
|
-
var lookupRef = useRef(null);
|
|
82
|
-
|
|
83
|
-
/** 透传给监听回调的最新引用,避免回调闭包 stale */
|
|
84
|
-
var onScannerDataRef = useRef(onScannerData);
|
|
85
|
-
var onSearchRef = useRef(onSearch);
|
|
86
|
-
useEffect(function () {
|
|
87
|
-
onScannerDataRef.current = onScannerData;
|
|
88
|
-
}, [onScannerData]);
|
|
89
|
-
useEffect(function () {
|
|
90
|
-
onSearchRef.current = onSearch;
|
|
91
|
-
}, [onSearch]);
|
|
92
|
-
useImperativeHandle(ref, function () {
|
|
93
|
-
return {
|
|
94
|
-
open: function open() {
|
|
95
|
-
var _lookupRef$current;
|
|
96
|
-
return (_lookupRef$current = lookupRef.current) === null || _lookupRef$current === void 0 ? void 0 : _lookupRef$current.open();
|
|
97
|
-
},
|
|
98
|
-
close: function close() {
|
|
99
|
-
var _lookupRef$current2;
|
|
100
|
-
return (_lookupRef$current2 = lookupRef.current) === null || _lookupRef$current2 === void 0 ? void 0 : _lookupRef$current2.close();
|
|
101
|
-
},
|
|
102
|
-
getKeyword: function getKeyword() {
|
|
103
|
-
var _lookupRef$current$ge, _lookupRef$current3;
|
|
104
|
-
return (_lookupRef$current$ge = (_lookupRef$current3 = lookupRef.current) === null || _lookupRef$current3 === void 0 ? void 0 : _lookupRef$current3.getKeyword()) !== null && _lookupRef$current$ge !== void 0 ? _lookupRef$current$ge : '';
|
|
105
|
-
},
|
|
106
|
-
setKeyword: function setKeyword(v) {
|
|
107
|
-
var _lookupRef$current4;
|
|
108
|
-
return (_lookupRef$current4 = lookupRef.current) === null || _lookupRef$current4 === void 0 ? void 0 : _lookupRef$current4.setKeyword(v);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}, []);
|
|
112
|
-
|
|
113
|
-
/** 通过 useEngineContext 拿到宿主 app(含 pubsub.subscribe / unsubscribe) */
|
|
114
|
-
var engineContext = useEngineContext();
|
|
115
|
-
/**
|
|
116
|
-
* 用 ref 稳定 getApp 引用:低代码环境下 engineContext 每次渲染可能返回新引用,
|
|
117
|
-
* 若把 getApp 直接放进 effect 依赖会导致频繁 unsubscribe/subscribe(甚至漏掉扫码事件)。
|
|
118
|
-
* effect 依赖只保留 enableScanner,运行时通过 ref 拿最新的 getApp。
|
|
119
|
-
*/
|
|
120
|
-
var getAppRef = useRef(undefined);
|
|
121
|
-
getAppRef.current = typeof (engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 || (_engineContext$appHel = _engineContext$appHel.utils) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.getApp) === 'function' ? engineContext.appHelper.utils.getApp : undefined;
|
|
122
|
-
useEffect(function () {
|
|
123
|
-
if (!enableScanner) return undefined;
|
|
124
|
-
var getApp = getAppRef.current;
|
|
125
|
-
if (typeof getApp !== 'function') return undefined;
|
|
126
|
-
var app = getApp();
|
|
127
|
-
var pubsub = app === null || app === void 0 ? void 0 : app.pubsub;
|
|
128
|
-
if (!pubsub || typeof pubsub.subscribe !== 'function') {
|
|
129
|
-
return undefined;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* 监听回调:每次扫码直接覆盖输入框。
|
|
134
|
-
* ScanResultPayload: { code, data },取 code 作为输入框值与搜索关键词。
|
|
135
|
-
* setKeyword 在受控模式下会触发外部 onChange;onSearch 需要显式触发以驱动后续搜索流程
|
|
136
|
-
* (受控模式下宿主一般只通过 onSearch 拿到新关键词,不会在 onChange 里再触发一次 onSearch,
|
|
137
|
-
* 因此这里不会产生重复请求。如需自定义合流,可绑定 onScannerData 自行处理)。
|
|
138
|
-
*
|
|
139
|
-
* 非法 payload(无 code 或 code 为空串)直接忽略,避免把输入框/搜索条件意外清空。
|
|
140
|
-
*/
|
|
141
|
-
var onScan = function onScan(payload) {
|
|
142
|
-
var _lookupRef$current5, _onSearchRef$current, _onScannerDataRef$cur;
|
|
143
|
-
var data = payload === null || payload === void 0 ? void 0 : payload.data;
|
|
144
|
-
if (typeof data !== 'string' || data.length === 0) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
(_lookupRef$current5 = lookupRef.current) === null || _lookupRef$current5 === void 0 || _lookupRef$current5.setKeyword(data);
|
|
148
|
-
(_onSearchRef$current = onSearchRef.current) === null || _onSearchRef$current === void 0 || _onSearchRef$current.call(onSearchRef, data);
|
|
149
|
-
(_onScannerDataRef$cur = onScannerDataRef.current) === null || _onScannerDataRef$cur === void 0 || _onScannerDataRef$cur.call(onScannerDataRef, payload);
|
|
150
|
-
};
|
|
151
|
-
try {
|
|
152
|
-
pubsub.subscribe(SCAN_RESULT_EVENT, onScan);
|
|
153
|
-
} catch (e) {
|
|
154
|
-
console.warn('[PisellFind] subscribe scanner failed:', e);
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
return function () {
|
|
158
|
-
try {
|
|
159
|
-
var _pubsub$unsubscribe;
|
|
160
|
-
(_pubsub$unsubscribe = pubsub.unsubscribe) === null || _pubsub$unsubscribe === void 0 || _pubsub$unsubscribe.call(pubsub, SCAN_RESULT_EVENT, onScan);
|
|
161
|
-
} catch (e) {
|
|
162
|
-
console.warn('[PisellFind] unsubscribe scanner failed:', e);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}, [enableScanner]);
|
|
166
69
|
return /*#__PURE__*/React.createElement(PisellLookup, _extends({
|
|
167
|
-
ref:
|
|
70
|
+
ref: ref,
|
|
168
71
|
triggerType: triggerType,
|
|
169
72
|
buttonText: buttonText,
|
|
170
73
|
placeholder: placeholder,
|
|
171
74
|
showConfirmButton: showConfirmButton,
|
|
172
75
|
showHistory: showHistory,
|
|
173
|
-
historyKey: historyKey
|
|
174
|
-
onSearch: onSearch
|
|
76
|
+
historyKey: historyKey
|
|
175
77
|
}, restProps));
|
|
176
78
|
});
|
|
79
|
+
|
|
80
|
+
// 显示名称
|
|
177
81
|
PisellFind.displayName = 'PisellFind';
|
|
@@ -217,10 +217,8 @@ var RecordBoardGridView = function RecordBoardGridView(props) {
|
|
|
217
217
|
}) : rawScrollX;
|
|
218
218
|
if (scroll !== null && scroll !== void 0 && scroll.autoCalc && typeof ctx.scrollAreaHeight === 'number') {
|
|
219
219
|
var wrapHeight = ctx.scrollAreaHeight;
|
|
220
|
-
// 40
|
|
221
|
-
|
|
222
|
-
// 无总结时不应再多扣,否则 Table 不能撑满 scroll-body,会在 Table 与底部分页之间留白。
|
|
223
|
-
var reservedHeight = 40 + (uniformSummaryHeight > 0 ? uniformSummaryHeight + 25 : 0);
|
|
220
|
+
// 40:表头等固定占高;uniformSummaryHeight:同值列总结区动态高度,无总结时为 0, 24是 uniformSummary padding
|
|
221
|
+
var reservedHeight = 40 + uniformSummaryHeight + 24;
|
|
224
222
|
return {
|
|
225
223
|
x: scrollX !== null && scrollX !== void 0 ? scrollX : sumColumnWidths,
|
|
226
224
|
y: Math.max(wrapHeight - reservedHeight, 100),
|
|
@@ -8,6 +8,7 @@ import "./index.less";
|
|
|
8
8
|
import { locales } from '@pisell/utils';
|
|
9
9
|
import { PREFIX } from "../../index";
|
|
10
10
|
var Footer = function Footer(_ref) {
|
|
11
|
+
var _item$_origin;
|
|
11
12
|
var item = _ref.item,
|
|
12
13
|
hideDivider = _ref.hideDivider,
|
|
13
14
|
type = _ref.type,
|
|
@@ -18,6 +19,7 @@ var Footer = function Footer(_ref) {
|
|
|
18
19
|
tip = item.tip,
|
|
19
20
|
num = item.num,
|
|
20
21
|
discount_reason = item.discount_reason;
|
|
22
|
+
var weighingInfo = item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 || (_item$_origin = _item$_origin._extend) === null || _item$_origin === void 0 ? void 0 : _item$_origin.weighing;
|
|
21
23
|
/**
|
|
22
24
|
* @title: 折扣
|
|
23
25
|
* @description:
|
|
@@ -60,7 +62,7 @@ var Footer = function Footer(_ref) {
|
|
|
60
62
|
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
61
63
|
className: classNames("".concat(PREFIX, "__product-footer"), hideDivider && "".concat(PREFIX, "__hide-divider-footer"), isOnlyTotal && "".concat(PREFIX, "__only-total-footer"))
|
|
62
64
|
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: classNames("".concat(PREFIX, "__footer-price-wrap"))
|
|
65
|
+
className: classNames("".concat(PREFIX, "__footer-price-wrap"), weighingInfo && "".concat(PREFIX, "__footer-price-wrap--weighing"))
|
|
64
66
|
}, !isOnlyTotal ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
65
67
|
className: classNames("".concat(PREFIX, "__footer-price"))
|
|
66
68
|
}, /*#__PURE__*/React.createElement("span", null, _formatAmount(total, symbol)), tip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -40,11 +40,11 @@ var Weighing = function Weighing(props) {
|
|
|
40
40
|
}, isManualWeight ? /*#__PURE__*/React.createElement("div", {
|
|
41
41
|
className: "".concat(PREFIX, "__weighing-row")
|
|
42
42
|
}, /*#__PURE__*/React.createElement("span", null, manualLabel)) : null, tareValue > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
43
|
-
className: "".concat(PREFIX, "__weighing-row")
|
|
43
|
+
className: "".concat(PREFIX, "__weighing-row ").concat(PREFIX, "__weighing-row--large")
|
|
44
44
|
}, /*#__PURE__*/React.createElement("span", null, grossLabel, ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(weight, unit))) : null, tareValue > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: "".concat(PREFIX, "__weighing-row")
|
|
45
|
+
className: "".concat(PREFIX, "__weighing-row ").concat(PREFIX, "__weighing-row--large")
|
|
46
46
|
}, /*#__PURE__*/React.createElement("span", null, tareLabel, ":"), /*#__PURE__*/React.createElement("span", null, formatWeight(tare === null || tare === void 0 ? void 0 : tare.value, (tare === null || tare === void 0 ? void 0 : tare.unit) || unit))) : null, /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: "".concat(PREFIX, "__weighing-row")
|
|
47
|
+
className: "".concat(PREFIX, "__weighing-row ").concat(PREFIX, "__weighing-row--large")
|
|
48
48
|
}, /*#__PURE__*/React.createElement("span", null, "".concat(formatWeight(net_weight, unit), " ").concat(netLabel, " @ ").concat(unitPriceText, "/").concat(unitLabel))));
|
|
49
49
|
};
|
|
50
50
|
export default Weighing;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ProductCardTypes } from '../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LineItemStatusOption, LineItemType } from './types';
|
|
4
4
|
interface BookingLineItemProps extends Omit<ProductCardTypes, 'dataSource'> {
|
|
5
5
|
dataSource: any;
|
|
6
6
|
type: LineItemType;
|
|
@@ -12,7 +12,6 @@ interface BookingLineItemProps extends Omit<ProductCardTypes, 'dataSource'> {
|
|
|
12
12
|
statusLoading?: boolean;
|
|
13
13
|
statusDisabled?: boolean;
|
|
14
14
|
isShowRelatedProduct?: boolean;
|
|
15
|
-
holderOptions?: LineItemHolderOption[];
|
|
16
15
|
onBookingStatusChange?: (status: string, item: any) => void;
|
|
17
16
|
}
|
|
18
17
|
declare const BookingLineItem: (props: BookingLineItemProps) => React.JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["dataSource", "type", "cartSkuType", "relatedProductDataSource", "rightActions", "escapeDom", "isShowImage", "
|
|
1
|
+
var _excluded = ["dataSource", "type", "cartSkuType", "relatedProductDataSource", "rightActions", "escapeDom", "isShowImage", "isShowDelete", "isShowNote", "isShowAmountFooter", "disabledClick", "disabledEdit", "statusOptions", "statusLoading", "statusDisabled", "isShowRelatedProduct", "onBookingStatusChange", "onAction", "onDelete", "onNote", "onCard", "onPromotion", "onGift"];
|
|
2
2
|
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); }
|
|
3
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -24,7 +24,6 @@ import { SwipeAction } from "../cartSkuCard/components/swipeAction";
|
|
|
24
24
|
import Action from "../components/Action";
|
|
25
25
|
import TimeRange from "./components/TimeRange";
|
|
26
26
|
import Resources from "./components/Resources";
|
|
27
|
-
import Holders from "./components/Holders";
|
|
28
27
|
import Iconfont from "../../iconfont";
|
|
29
28
|
import useEngineContext from "../../../hooks/useEngineContext";
|
|
30
29
|
var PREFIX = 'pisell-line-item';
|
|
@@ -65,7 +64,7 @@ var getResourceName = function getResourceName(booking, translationOriginal) {
|
|
|
65
64
|
}).filter(Boolean).join(', ');
|
|
66
65
|
};
|
|
67
66
|
var BookingLineItem = function BookingLineItem(props) {
|
|
68
|
-
var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4,
|
|
67
|
+
var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _dataSource$promotion;
|
|
69
68
|
var dataSource = props.dataSource,
|
|
70
69
|
type = props.type,
|
|
71
70
|
cartSkuType = props.cartSkuType,
|
|
@@ -74,7 +73,6 @@ var BookingLineItem = function BookingLineItem(props) {
|
|
|
74
73
|
rightActions = _props$rightActions === void 0 ? [] : _props$rightActions,
|
|
75
74
|
escapeDom = props.escapeDom,
|
|
76
75
|
isShowImage = props.isShowImage,
|
|
77
|
-
isFormSubject = props.isFormSubject,
|
|
78
76
|
isShowDelete = props.isShowDelete,
|
|
79
77
|
isShowNote = props.isShowNote,
|
|
80
78
|
isShowAmountFooter = props.isShowAmountFooter,
|
|
@@ -88,7 +86,6 @@ var BookingLineItem = function BookingLineItem(props) {
|
|
|
88
86
|
statusDisabled = _props$statusDisabled === void 0 ? false : _props$statusDisabled,
|
|
89
87
|
_props$isShowRelatedP = props.isShowRelatedProduct,
|
|
90
88
|
isShowRelatedProduct = _props$isShowRelatedP === void 0 ? true : _props$isShowRelatedP,
|
|
91
|
-
holderOptions = props.holderOptions,
|
|
92
89
|
onBookingStatusChange = props.onBookingStatusChange,
|
|
93
90
|
_onAction = props.onAction,
|
|
94
91
|
onDelete = props.onDelete,
|
|
@@ -134,9 +131,7 @@ var BookingLineItem = function BookingLineItem(props) {
|
|
|
134
131
|
}
|
|
135
132
|
};
|
|
136
133
|
var bookingRightActions = isShowDelete ? [deleteAction].concat(_toConsumableArray(rightActions)) : rightActions;
|
|
137
|
-
var
|
|
138
|
-
var resolvedIsFormSubject = isFormSubject !== null && isFormSubject !== void 0 ? isFormSubject : dataSource === null || dataSource === void 0 ? void 0 : dataSource.isFormSubject;
|
|
139
|
-
var bookingTitle = String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.booking_id) || '');
|
|
134
|
+
var bookingTitle = String((dataSource === null || dataSource === void 0 ? void 0 : dataSource.booking_id) || '-');
|
|
140
135
|
var bookingTime = formatBookingTime(dataSource, locale);
|
|
141
136
|
var resourceName = getResourceName(dataSource, translationOriginal) || '-';
|
|
142
137
|
var renderStatusButton = function renderStatusButton() {
|
|
@@ -189,8 +184,8 @@ var BookingLineItem = function BookingLineItem(props) {
|
|
|
189
184
|
}, canChangeStatus ? /*#__PURE__*/React.createElement(Dropdown, {
|
|
190
185
|
menu: {
|
|
191
186
|
items: statusMenuItems,
|
|
192
|
-
onClick: function onClick(
|
|
193
|
-
var key =
|
|
187
|
+
onClick: function onClick(_ref) {
|
|
188
|
+
var key = _ref.key;
|
|
194
189
|
return onBookingStatusChange === null || onBookingStatusChange === void 0 ? void 0 : onBookingStatusChange(String(key), dataSource);
|
|
195
190
|
}
|
|
196
191
|
},
|
|
@@ -211,11 +206,7 @@ var BookingLineItem = function BookingLineItem(props) {
|
|
|
211
206
|
dataSource: dataSource
|
|
212
207
|
}), /*#__PURE__*/React.createElement(TimeRange, {
|
|
213
208
|
dataSource: dataSource
|
|
214
|
-
}),
|
|
215
|
-
dataSource: dataSource,
|
|
216
|
-
holderOptions: resolvedHolderOptions,
|
|
217
|
-
isFormSubject: resolvedIsFormSubject
|
|
218
|
-
}) : null), isShowRelatedProduct && relatedProductDataSource ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
209
|
+
})), isShowRelatedProduct && relatedProductDataSource ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
219
210
|
style: {
|
|
220
211
|
margin: 0
|
|
221
212
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ProductCardTypes } from '../types';
|
|
3
|
-
import type { itemType,
|
|
3
|
+
import type { itemType, LineItemStatusOption, LineItemType } from './types';
|
|
4
4
|
import './index.less';
|
|
5
5
|
export declare const PREFIX = "pisell-line-item";
|
|
6
|
-
export type { itemType,
|
|
6
|
+
export type { itemType, 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,7 +15,6 @@ export interface LineItemProps extends Omit<ProductCardTypes, 'dataSource'> {
|
|
|
15
15
|
statusLoading?: boolean;
|
|
16
16
|
statusDisabled?: boolean;
|
|
17
17
|
isShowRelatedProduct?: boolean;
|
|
18
|
-
holderOptions?: LineItemHolderOption[];
|
|
19
18
|
onBookingStatusChange?: (status: string, item: any) => void;
|
|
20
19
|
}
|
|
21
20
|
export declare const convertProductToLineItemProduct: (product: any, translationOriginal: (text: LocalizedText) => string, symbol: string) => {
|
|
@@ -30,10 +29,10 @@ export declare const convertProductToLineItemProduct: (product: any, translation
|
|
|
30
29
|
image: any;
|
|
31
30
|
num: any;
|
|
32
31
|
quantity: any;
|
|
33
|
-
price:
|
|
34
|
-
total:
|
|
35
|
-
origin_total:
|
|
36
|
-
original_total:
|
|
32
|
+
price: any;
|
|
33
|
+
total: any;
|
|
34
|
+
origin_total: any;
|
|
35
|
+
original_total: any;
|
|
37
36
|
source_product_price: any;
|
|
38
37
|
selling_price: any;
|
|
39
38
|
payment_price: any;
|
|
@@ -46,7 +45,6 @@ export declare const convertProductToLineItemProduct: (product: any, translation
|
|
|
46
45
|
product_option_string: string;
|
|
47
46
|
discount_list: any;
|
|
48
47
|
promotions: any;
|
|
49
|
-
discount_reason: any;
|
|
50
48
|
isGift: boolean;
|
|
51
49
|
giftData: any;
|
|
52
50
|
_origin: any;
|
|
@@ -59,8 +57,8 @@ export declare const convertProductToLineItemProduct: (product: any, translation
|
|
|
59
57
|
quantity: any;
|
|
60
58
|
};
|
|
61
59
|
note: any;
|
|
62
|
-
total:
|
|
63
|
-
origin_total:
|
|
60
|
+
total: any;
|
|
61
|
+
origin_total: any;
|
|
64
62
|
payment_price: any;
|
|
65
63
|
};
|
|
66
64
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["dataSource", "itemType", "type", "rightActions", "escapeDom", "isShowImage", "isShowDelete", "isShowNote", "isShowAmountFooter", "disabledClick", "disabledEdit", "statusOptions", "statusLoading", "statusDisabled", "isShowRelatedProduct", "
|
|
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"];
|
|
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,45 +27,6 @@ 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
|
-
}
|
|
69
30
|
var convertBundleOption = function convertBundleOption(option, translationOriginal) {
|
|
70
31
|
return _objectSpread(_objectSpread({}, option), {}, {
|
|
71
32
|
id: option.option_group_item_id,
|
|
@@ -101,14 +62,11 @@ var convertBundle = function convertBundle(bundle, translationOriginal) {
|
|
|
101
62
|
});
|
|
102
63
|
};
|
|
103
64
|
export var convertProductToLineItemProduct = function convertProductToLineItemProduct(product, translationOriginal, symbol) {
|
|
104
|
-
var _product$metadata,
|
|
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;
|
|
105
66
|
var title = translateText(product.product_title || product.title, translationOriginal);
|
|
106
67
|
var bundle = (product.product_bundle || []).map(function (bundleItem) {
|
|
107
68
|
return convertBundle(bundleItem, translationOriginal);
|
|
108
69
|
});
|
|
109
|
-
var _resolveLineItemUnitP = resolveLineItemUnitPrices(product),
|
|
110
|
-
unitSelling = _resolveLineItemUnitP.unitSelling,
|
|
111
|
-
unitOriginal = _resolveLineItemUnitP.unitOriginal;
|
|
112
70
|
return {
|
|
113
71
|
_id: ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.order_detail_id || product.product_id,
|
|
114
72
|
id: product.product_id,
|
|
@@ -119,13 +77,13 @@ export var convertProductToLineItemProduct = function convertProductToLineItemPr
|
|
|
119
77
|
name: title,
|
|
120
78
|
cover: product.cover,
|
|
121
79
|
image: product.cover,
|
|
122
|
-
num: (
|
|
123
|
-
quantity: (
|
|
124
|
-
price:
|
|
125
|
-
total:
|
|
126
|
-
origin_total:
|
|
127
|
-
original_total:
|
|
128
|
-
source_product_price: (_product$
|
|
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,
|
|
129
87
|
selling_price: product.selling_price,
|
|
130
88
|
payment_price: product.payment_price,
|
|
131
89
|
tax_fee: product.tax_fee,
|
|
@@ -137,11 +95,7 @@ export var convertProductToLineItemProduct = function convertProductToLineItemPr
|
|
|
137
95
|
product_option_string: product.product_sku ? translateText(product.product_sku.subtitle, translationOriginal) : '',
|
|
138
96
|
discount_list: product.discount_list,
|
|
139
97
|
promotions: product.promotions,
|
|
140
|
-
|
|
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),
|
|
98
|
+
isGift: Boolean(product.gift_card),
|
|
145
99
|
giftData: product.giftData,
|
|
146
100
|
_origin: product,
|
|
147
101
|
_extend: {
|
|
@@ -150,11 +104,11 @@ export var convertProductToLineItemProduct = function convertProductToLineItemPr
|
|
|
150
104
|
option: (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option,
|
|
151
105
|
bundle: product.product_bundle,
|
|
152
106
|
product_variant_id: product.product_variant_id,
|
|
153
|
-
quantity: (
|
|
107
|
+
quantity: (_ref3 = (_product$num3 = product.num) !== null && _product$num3 !== void 0 ? _product$num3 : product.product_quantity) !== null && _ref3 !== void 0 ? _ref3 : 1
|
|
154
108
|
},
|
|
155
109
|
note: product.note,
|
|
156
|
-
total:
|
|
157
|
-
origin_total:
|
|
110
|
+
total: product.payment_price,
|
|
111
|
+
origin_total: product.original_price,
|
|
158
112
|
payment_price: product.payment_price
|
|
159
113
|
}
|
|
160
114
|
};
|
|
@@ -189,7 +143,6 @@ var LineItem = function LineItem(props) {
|
|
|
189
143
|
statusDisabled = _props$statusDisabled === void 0 ? false : _props$statusDisabled,
|
|
190
144
|
_props$isShowRelatedP = props.isShowRelatedProduct,
|
|
191
145
|
isShowRelatedProduct = _props$isShowRelatedP === void 0 ? true : _props$isShowRelatedP,
|
|
192
|
-
holderOptions = props.holderOptions,
|
|
193
146
|
onBookingStatusChange = props.onBookingStatusChange,
|
|
194
147
|
onAction = props.onAction,
|
|
195
148
|
onDelete = props.onDelete,
|
|
@@ -250,7 +203,6 @@ var LineItem = function LineItem(props) {
|
|
|
250
203
|
statusLoading: statusLoading,
|
|
251
204
|
statusDisabled: statusDisabled,
|
|
252
205
|
isShowRelatedProduct: isShowRelatedProduct,
|
|
253
|
-
holderOptions: holderOptions,
|
|
254
206
|
onBookingStatusChange: onBookingStatusChange,
|
|
255
207
|
onAction: onAction,
|
|
256
208
|
onDelete: onDelete,
|