@pisell/private-materials 6.3.93 → 6.3.94
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 +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/eftposPay/app.d.ts +1 -1
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/hooks/useThemeTokens.d.ts +7 -0
- package/es/hooks/useThemeTokens.js +20 -0
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/es/plus/skuOptionsSelection/components/NormalCard/index.js +3 -1
- package/es/plus/skuOptionsSelection/components/OptionsCard/index.js +3 -2
- package/es/plus/skuOptionsSelection/store/store.js +2 -1
- package/es/plus/skuOptionsSelection/types.d.ts +14 -0
- package/es/plus/skuOptionsSelection/types.js +4 -0
- package/es/plus/skuOptionsSelection/utils/transformBundleGroup.js +10 -1
- package/es/plus/skuOptionsSelection/utils/transformOptionGroup.js +10 -1
- package/es/plus/skuOptionsSelection/utils/transformVariantGroup.js +8 -2
- package/es/pro/Cards/components/SKUCard/index.d.ts +2 -56
- package/es/pro/Cards/components/SKUCard/index.js +51 -20
- package/es/pro/Cards/components/SKUCard/index.less +23 -2
- package/es/pro/Cards/components/SKUCard/locales.d.ts +12 -0
- package/es/pro/Cards/components/SKUCard/locales.js +11 -0
- package/es/pro/Cards/components/SKUCard/types.d.ts +73 -0
- package/es/pro/Cards/components/SKUCard/types.js +1 -0
- package/es/pro/NumericStepper/index.d.ts +5 -0
- package/es/pro/NumericStepper/index.js +8 -2
- package/es/pro/NumericStepper/index.less +1 -9
- package/es/pro/Selector/BatchSelectorDemo.js +2 -12
- package/es/pro/Selector/Selector.js +6 -4
- package/es/pro/Selector/SelectorGroup.d.ts +1 -1
- package/es/pro/Selector/SelectorGroup.js +5 -1
- package/es/pro/Selector/components/Card/index.js +9 -7
- package/es/pro/Selector/components/Card/index.less +24 -15
- package/es/pro/Selector/components/Indicator/index.js +1 -1
- package/es/pro/Selector/components/Indicator/index.less +12 -12
- package/es/pro/Selector/components/Media/index.d.ts +1 -1
- package/es/pro/Selector/components/Media/index.less +1 -1
- package/es/pro/Selector/selectorGroup.less +9 -1
- package/es/pro/Selector/types.d.ts +10 -0
- package/lib/components/eftposPay/app.d.ts +1 -1
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/hooks/useThemeTokens.d.ts +7 -0
- package/lib/hooks/useThemeTokens.js +40 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/lib/plus/skuOptionsSelection/components/NormalCard/index.js +8 -6
- package/lib/plus/skuOptionsSelection/components/OptionsCard/index.js +3 -2
- package/lib/plus/skuOptionsSelection/store/store.js +2 -1
- package/lib/plus/skuOptionsSelection/types.d.ts +14 -0
- package/lib/plus/skuOptionsSelection/utils/transformBundleGroup.js +15 -9
- package/lib/plus/skuOptionsSelection/utils/transformOptionGroup.js +9 -6
- package/lib/plus/skuOptionsSelection/utils/transformVariantGroup.js +8 -7
- package/lib/pro/Cards/components/SKUCard/index.d.ts +2 -56
- package/lib/pro/Cards/components/SKUCard/index.js +60 -15
- package/lib/pro/Cards/components/SKUCard/index.less +23 -2
- package/lib/pro/Cards/components/SKUCard/locales.d.ts +12 -0
- package/lib/pro/Cards/components/SKUCard/locales.js +35 -0
- package/lib/pro/Cards/components/SKUCard/types.d.ts +73 -0
- package/lib/pro/Cards/components/SKUCard/types.js +17 -0
- package/lib/pro/NumericStepper/index.d.ts +5 -0
- package/lib/pro/NumericStepper/index.js +11 -3
- package/lib/pro/NumericStepper/index.less +1 -9
- package/lib/pro/Selector/BatchSelectorDemo.js +13 -19
- package/lib/pro/Selector/Selector.js +7 -1
- package/lib/pro/Selector/SelectorGroup.d.ts +1 -1
- package/lib/pro/Selector/SelectorGroup.js +7 -1
- package/lib/pro/Selector/components/Card/index.js +10 -7
- package/lib/pro/Selector/components/Card/index.less +24 -15
- package/lib/pro/Selector/components/Indicator/index.js +1 -1
- package/lib/pro/Selector/components/Indicator/index.less +12 -12
- package/lib/pro/Selector/components/Media/index.d.ts +1 -1
- package/lib/pro/Selector/components/Media/index.js +7 -4
- package/lib/pro/Selector/components/Media/index.less +1 -1
- package/lib/pro/Selector/selectorGroup.less +9 -1
- package/lib/pro/Selector/types.d.ts +10 -0
- package/lowcode/eco-cup-list/meta.ts +1 -1
- package/lowcode/eco-customer-list/meta.ts +1 -1
- package/lowcode/selector/meta.ts +15 -2
- package/lowcode/selector.group/meta.ts +15 -2
- package/lowcode/sku-options-selection/meta.ts +106 -2
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PosProps, RouteType } from './const';
|
|
3
|
-
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "
|
|
3
|
+
declare const App: ({ action, api, device_number, terminal, tyroUrl, tyroVersion, onChangeParams, isMobile, channel, formatAmount, ...props }: Omit<PosProps, "mode" | "type" | "getApi"> & {
|
|
4
4
|
action: RouteType;
|
|
5
5
|
device_number: string | number;
|
|
6
6
|
api: ReturnType<PosProps['getApi']>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { theme } from 'antd';
|
|
2
|
+
var themeTokenCache = new Map();
|
|
3
|
+
var useThemeTokens = function useThemeTokens(themeInput) {
|
|
4
|
+
var _themeInput$token;
|
|
5
|
+
var useToken = theme.useToken,
|
|
6
|
+
getDesignToken = theme.getDesignToken;
|
|
7
|
+
var _useToken = useToken(),
|
|
8
|
+
antdToken = _useToken.token;
|
|
9
|
+
var overrideColorPrimary = (themeInput === null || themeInput === void 0 || (_themeInput$token = themeInput.token) === null || _themeInput$token === void 0 ? void 0 : _themeInput$token.colorPrimary) || antdToken.colorPrimary;
|
|
10
|
+
var cached = themeTokenCache.get(overrideColorPrimary);
|
|
11
|
+
if (cached) return cached;
|
|
12
|
+
var computed = getDesignToken({
|
|
13
|
+
token: {
|
|
14
|
+
colorPrimary: overrideColorPrimary
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
themeTokenCache.set(overrideColorPrimary, computed);
|
|
18
|
+
return computed;
|
|
19
|
+
};
|
|
20
|
+
export default useThemeTokens;
|
|
@@ -9,6 +9,7 @@ import Decimal from 'decimal.js';
|
|
|
9
9
|
import { useStore } from "../../hooks";
|
|
10
10
|
import { SKUCard } from "../../../../pro/Cards";
|
|
11
11
|
var NormalCard = function NormalCard(props) {
|
|
12
|
+
var _props$dataSource;
|
|
12
13
|
var _ref = (props === null || props === void 0 ? void 0 : props.dataSource) || {},
|
|
13
14
|
uniqueKey = _ref._key,
|
|
14
15
|
ruleConfig = _ref.ruleConfig,
|
|
@@ -124,7 +125,8 @@ var NormalCard = function NormalCard(props) {
|
|
|
124
125
|
}
|
|
125
126
|
}))),
|
|
126
127
|
onClick: handleChange,
|
|
127
|
-
skuCardConfig: skuCardConfig
|
|
128
|
+
skuCardConfig: skuCardConfig,
|
|
129
|
+
skuDisabled: (props === null || props === void 0 || (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 || (_props$dataSource = _props$dataSource._extra) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.disabled) === true
|
|
128
130
|
});
|
|
129
131
|
};
|
|
130
132
|
export default NormalCard;
|
|
@@ -24,7 +24,7 @@ import OptionsModal from "../OptionsModal";
|
|
|
24
24
|
import OptionItemCard from "./OptionItemCard";
|
|
25
25
|
import "./index.less";
|
|
26
26
|
var OptionsCard = function OptionsCard(props) {
|
|
27
|
-
var _props$dataSource, _props$parentDataSour2, _props$optionItemValu2, _props$dataSource3, _props$optionItemValu4;
|
|
27
|
+
var _props$dataSource, _props$parentDataSour2, _props$optionItemValu2, _props$dataSource3, _props$optionItemValu4, _props$dataSource4;
|
|
28
28
|
var _ref = (props === null || props === void 0 ? void 0 : props.dataSource) || {},
|
|
29
29
|
uniqueKey = _ref._key,
|
|
30
30
|
selected = _ref.selected,
|
|
@@ -219,7 +219,8 @@ var OptionsCard = function OptionsCard(props) {
|
|
|
219
219
|
arrow: true,
|
|
220
220
|
selected: selected,
|
|
221
221
|
disabled: disabled,
|
|
222
|
-
skuCardConfig: skuCardConfig
|
|
222
|
+
skuCardConfig: skuCardConfig,
|
|
223
|
+
skuDisabled: (props === null || props === void 0 || (_props$dataSource4 = props.dataSource) === null || _props$dataSource4 === void 0 || (_props$dataSource4 = _props$dataSource4._extra) === null || _props$dataSource4 === void 0 ? void 0 : _props$dataSource4.disabled) === true
|
|
223
224
|
})), (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0 && /*#__PURE__*/React.createElement(OptionItemCard, {
|
|
224
225
|
optionItemValue: props === null || props === void 0 ? void 0 : props.optionItemValue,
|
|
225
226
|
parentDataSource: props === null || props === void 0 ? void 0 : props.parentDataSource,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { LayoutConfig } from '../../pro/Selector/types';
|
|
2
3
|
/**
|
|
3
4
|
* SKU Card 文本样式配置
|
|
4
5
|
*/
|
|
@@ -29,6 +30,13 @@ export interface SkuCardImageConfig {
|
|
|
29
30
|
/** 边框 */
|
|
30
31
|
border?: string;
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* SKU Card 禁用文本配置
|
|
35
|
+
*/
|
|
36
|
+
export interface SkuCardDisabledTextConfig extends Omit<SkuCardTextConfig, 'lineClamp'> {
|
|
37
|
+
/** 文本(可能是多语言) */
|
|
38
|
+
text?: string;
|
|
39
|
+
}
|
|
32
40
|
/**
|
|
33
41
|
* SKU Card 配置
|
|
34
42
|
*/
|
|
@@ -46,6 +54,8 @@ export interface SkuCardConfig {
|
|
|
46
54
|
* - 默认不展示,避免影响现有业务 UI
|
|
47
55
|
*/
|
|
48
56
|
variantPriceVisible?: boolean;
|
|
57
|
+
/** 禁用文本配置 */
|
|
58
|
+
disabledText?: SkuCardDisabledTextConfig;
|
|
49
59
|
}
|
|
50
60
|
/**
|
|
51
61
|
* SKU store状态类型
|
|
@@ -72,6 +82,8 @@ export interface SkuSelectionState {
|
|
|
72
82
|
customConfig?: {
|
|
73
83
|
/** 弹窗宽度 */
|
|
74
84
|
modalWidth?: number | string;
|
|
85
|
+
/** 选项布局 */
|
|
86
|
+
selectorLayout?: LayoutConfig | null;
|
|
75
87
|
};
|
|
76
88
|
}
|
|
77
89
|
/** SKU Card 默认配置 */
|
|
@@ -98,6 +110,8 @@ export interface IProps {
|
|
|
98
110
|
customConfig?: {
|
|
99
111
|
/** 弹窗宽度 */
|
|
100
112
|
modalWidth?: number | string;
|
|
113
|
+
/** 选项布局 */
|
|
114
|
+
selectorLayout?: LayoutConfig | null;
|
|
101
115
|
};
|
|
102
116
|
}
|
|
103
117
|
export interface DataSource {
|
|
@@ -10,11 +10,16 @@ import OptionsCard from "../components/OptionsCard";
|
|
|
10
10
|
import NormalCard from "../components/NormalCard";
|
|
11
11
|
import TitleExtra from "../components/TitleExtra";
|
|
12
12
|
import { checkSkuDisabled, checkSkuStockCanSell } from "./checkSkuStatus";
|
|
13
|
+
import store from "../store/store";
|
|
13
14
|
|
|
14
15
|
// 定义基础数据类型(根据实际情况补充字段)
|
|
15
16
|
|
|
16
17
|
export var transformBundleGroup = function transformBundleGroup(bundleGroup) {
|
|
18
|
+
var _store$getState$custo;
|
|
17
19
|
if (!Array.isArray(bundleGroup)) return [];
|
|
20
|
+
|
|
21
|
+
// 获取自定义Selector布局配置
|
|
22
|
+
var selectorLayout = ((_store$getState$custo = store.getState().customConfig) === null || _store$getState$custo === void 0 ? void 0 : _store$getState$custo.selectorLayout) || null;
|
|
18
23
|
var formattedGroup = bundleGroup.map(function (item) {
|
|
19
24
|
var _item$bundle_item;
|
|
20
25
|
// Selector中选项数据源
|
|
@@ -39,7 +44,8 @@ export var transformBundleGroup = function transformBundleGroup(bundleGroup) {
|
|
|
39
44
|
},
|
|
40
45
|
_extra: {
|
|
41
46
|
canSell: canSell,
|
|
42
|
-
hasStock: hasStock
|
|
47
|
+
hasStock: hasStock,
|
|
48
|
+
disabled: disabled
|
|
43
49
|
}
|
|
44
50
|
};
|
|
45
51
|
});
|
|
@@ -71,6 +77,9 @@ export var transformBundleGroup = function transformBundleGroup(bundleGroup) {
|
|
|
71
77
|
showInput: true
|
|
72
78
|
}
|
|
73
79
|
};
|
|
80
|
+
if (!!selectorLayout) {
|
|
81
|
+
selectorDataSource.layout = selectorLayout;
|
|
82
|
+
}
|
|
74
83
|
|
|
75
84
|
// 渲染选项卡片
|
|
76
85
|
selectorDataSource.renderItem = function (itemProps) {
|
|
@@ -9,8 +9,13 @@ import React from 'react';
|
|
|
9
9
|
import NormalCard from "../components/NormalCard";
|
|
10
10
|
import TitleExtra from "../components/TitleExtra";
|
|
11
11
|
import { checkSkuDisabled, checkSkuStockCanSell } from "./checkSkuStatus";
|
|
12
|
+
import store from "../store/store";
|
|
12
13
|
export var transformOptionGroup = function transformOptionGroup(optionGroup) {
|
|
14
|
+
var _store$getState$custo;
|
|
13
15
|
if (!Array.isArray(optionGroup)) return [];
|
|
16
|
+
|
|
17
|
+
// 获取自定义Selector布局配置
|
|
18
|
+
var selectorLayout = ((_store$getState$custo = store.getState().customConfig) === null || _store$getState$custo === void 0 ? void 0 : _store$getState$custo.selectorLayout) || null;
|
|
14
19
|
var formattedGroup = optionGroup.map(function (item) {
|
|
15
20
|
var _item$option_item;
|
|
16
21
|
// Selector中选项数据源
|
|
@@ -34,7 +39,8 @@ export var transformOptionGroup = function transformOptionGroup(optionGroup) {
|
|
|
34
39
|
},
|
|
35
40
|
_extra: {
|
|
36
41
|
canSell: canSell,
|
|
37
|
-
hasStock: hasStock
|
|
42
|
+
hasStock: hasStock,
|
|
43
|
+
disabled: disabled
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
46
|
});
|
|
@@ -72,6 +78,9 @@ export var transformOptionGroup = function transformOptionGroup(optionGroup) {
|
|
|
72
78
|
showInput: true
|
|
73
79
|
}
|
|
74
80
|
};
|
|
81
|
+
if (!!selectorLayout) {
|
|
82
|
+
selectorDataSource.layout = selectorLayout;
|
|
83
|
+
}
|
|
75
84
|
|
|
76
85
|
// 渲染选项卡片
|
|
77
86
|
selectorDataSource.renderItem = function (itemProps) {
|
|
@@ -10,9 +10,11 @@ import store from "../store/store";
|
|
|
10
10
|
import VariantCard from "../components/VariantCard";
|
|
11
11
|
import { checkVariantStockCanSell, checkSkuDisabled, checkVariantStockByValue } from "./checkSkuStatus";
|
|
12
12
|
export var transformVariantGroup = function transformVariantGroup(variantGroup) {
|
|
13
|
-
var _store$getState$dataS;
|
|
13
|
+
var _store$getState$dataS, _store$getState$custo;
|
|
14
14
|
if (!Array.isArray(variantGroup)) return [];
|
|
15
15
|
var variantProducts = ((_store$getState$dataS = store.getState().dataSource) === null || _store$getState$dataS === void 0 ? void 0 : _store$getState$dataS.variant) || [];
|
|
16
|
+
// 获取自定义Selector布局配置
|
|
17
|
+
var selectorLayout = ((_store$getState$custo = store.getState().customConfig) === null || _store$getState$custo === void 0 ? void 0 : _store$getState$custo.selectorLayout) || null;
|
|
16
18
|
var formattedGroup = variantGroup.map(function (item) {
|
|
17
19
|
var _item$variant_item;
|
|
18
20
|
// Selector中选项数据源
|
|
@@ -38,7 +40,8 @@ export var transformVariantGroup = function transformVariantGroup(variantGroup)
|
|
|
38
40
|
},
|
|
39
41
|
_extra: {
|
|
40
42
|
canSell: canSell,
|
|
41
|
-
hasStock: hasStock
|
|
43
|
+
hasStock: hasStock,
|
|
44
|
+
disabled: disabled
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
47
|
});
|
|
@@ -74,6 +77,9 @@ export var transformVariantGroup = function transformVariantGroup(variantGroup)
|
|
|
74
77
|
showInput: true
|
|
75
78
|
}
|
|
76
79
|
};
|
|
80
|
+
if (!!selectorLayout) {
|
|
81
|
+
selectorDataSource.layout = selectorLayout;
|
|
82
|
+
}
|
|
77
83
|
|
|
78
84
|
// 渲染选项卡片
|
|
79
85
|
selectorDataSource.renderItem = function (itemProps) {
|
|
@@ -1,60 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { SKUCardProps } from './types';
|
|
3
|
+
import './index.less';
|
|
2
4
|
import './index.less';
|
|
3
|
-
/**
|
|
4
|
-
* SKU Card 文本样式配置
|
|
5
|
-
*/
|
|
6
|
-
interface SkuCardTextConfig {
|
|
7
|
-
/** 是否显示 */
|
|
8
|
-
visible?: boolean;
|
|
9
|
-
/** 字体大小 */
|
|
10
|
-
fontSize?: number;
|
|
11
|
-
/** 颜色 */
|
|
12
|
-
color?: string;
|
|
13
|
-
/** 字体粗细 */
|
|
14
|
-
fontWeight?: 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
15
|
-
/** 展示行数 */
|
|
16
|
-
lineClamp?: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* SKU Card 图片配置
|
|
20
|
-
*/
|
|
21
|
-
interface SkuCardImageConfig {
|
|
22
|
-
/** 是否显示 */
|
|
23
|
-
visible?: boolean;
|
|
24
|
-
/** 宽度 */
|
|
25
|
-
width?: number;
|
|
26
|
-
/** 高度 */
|
|
27
|
-
height?: number;
|
|
28
|
-
/** 圆角 */
|
|
29
|
-
borderRadius?: number | string;
|
|
30
|
-
/** 边框 */
|
|
31
|
-
border?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* SKU Card 配置
|
|
35
|
-
*/
|
|
36
|
-
interface SkuCardConfig {
|
|
37
|
-
/** 主标题配置 */
|
|
38
|
-
title?: SkuCardTextConfig;
|
|
39
|
-
/** 副标题配置 */
|
|
40
|
-
subTitle?: SkuCardTextConfig;
|
|
41
|
-
/** 价格配置 */
|
|
42
|
-
price?: Omit<SkuCardTextConfig, 'lineClamp'>;
|
|
43
|
-
/** 图片配置 */
|
|
44
|
-
image?: SkuCardImageConfig;
|
|
45
|
-
}
|
|
46
|
-
interface SKUCardProps {
|
|
47
|
-
cover?: string;
|
|
48
|
-
title?: string;
|
|
49
|
-
subtitle?: string;
|
|
50
|
-
price?: string;
|
|
51
|
-
arrow?: boolean;
|
|
52
|
-
selected?: boolean;
|
|
53
|
-
disabled?: boolean;
|
|
54
|
-
onClick?: () => void;
|
|
55
|
-
renderRight?: React.ReactNode | (() => React.ReactNode);
|
|
56
|
-
/** SKU Card 配置 */
|
|
57
|
-
skuCardConfig?: SkuCardConfig;
|
|
58
|
-
}
|
|
59
5
|
declare const SKUCard: React.FC<SKUCardProps>;
|
|
60
6
|
export default SKUCard;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
5
|
import React, { useMemo } from 'react';
|
|
2
6
|
import { Iconfont } from '@pisell/materials';
|
|
3
|
-
import { image as imageAli } from '@pisell/utils';
|
|
7
|
+
import { image as imageAli, locales } from '@pisell/utils';
|
|
4
8
|
import classNames from 'classnames';
|
|
9
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
10
|
+
import localeTexts from "./locales";
|
|
11
|
+
import useThemeTokens from "../../../../hooks/useThemeTokens";
|
|
12
|
+
import "./index.less";
|
|
5
13
|
import "./index.less";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* SKU Card 文本样式配置
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* SKU Card 图片配置
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* SKU Card 配置
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
14
|
var SKUCard = function SKUCard(_ref) {
|
|
20
|
-
var _skuCardConfig$title, _skuCardConfig$subTit, _skuCardConfig$price, _skuCardConfig$image;
|
|
15
|
+
var _context$appHelper, _skuCardConfig$title, _skuCardConfig$subTit, _skuCardConfig$price, _skuCardConfig$image, _skuCardConfig$disabl, _skuCardConfig$disabl2;
|
|
21
16
|
var cover = _ref.cover,
|
|
22
17
|
title = _ref.title,
|
|
23
18
|
subtitle = _ref.subtitle,
|
|
@@ -27,7 +22,16 @@ var SKUCard = function SKUCard(_ref) {
|
|
|
27
22
|
disabled = _ref.disabled,
|
|
28
23
|
_onClick = _ref.onClick,
|
|
29
24
|
renderRight = _ref.renderRight,
|
|
30
|
-
skuCardConfig = _ref.skuCardConfig
|
|
25
|
+
skuCardConfig = _ref.skuCardConfig,
|
|
26
|
+
skuDisabled = _ref.skuDisabled,
|
|
27
|
+
theme = _ref.theme;
|
|
28
|
+
var _useThemeTokens = useThemeTokens(theme),
|
|
29
|
+
colorPrimary = _useThemeTokens.colorPrimary,
|
|
30
|
+
colorPrimaryBg = _useThemeTokens.colorPrimaryBg;
|
|
31
|
+
var context = useEngineContext();
|
|
32
|
+
var language = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.storage) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.get('umi_locale')) || 'en';
|
|
33
|
+
locales.init(localeTexts, language);
|
|
34
|
+
|
|
31
35
|
/**
|
|
32
36
|
* 计算主标题样式
|
|
33
37
|
* 默认全部展示,可换行;如果配置了 lineClamp 则限制行数
|
|
@@ -128,6 +132,22 @@ var SKUCard = function SKUCard(_ref) {
|
|
|
128
132
|
return style;
|
|
129
133
|
}, [skuCardConfig === null || skuCardConfig === void 0 ? void 0 : skuCardConfig.image]);
|
|
130
134
|
|
|
135
|
+
/** 计算disabled文本样式 */
|
|
136
|
+
var disabledTextStyle = useMemo(function () {
|
|
137
|
+
var config = skuCardConfig === null || skuCardConfig === void 0 ? void 0 : skuCardConfig.disabledText;
|
|
138
|
+
var style = {};
|
|
139
|
+
if (config !== null && config !== void 0 && config.color) {
|
|
140
|
+
style.color = config.color;
|
|
141
|
+
}
|
|
142
|
+
if (config !== null && config !== void 0 && config.fontSize) {
|
|
143
|
+
style.fontSize = config.fontSize;
|
|
144
|
+
}
|
|
145
|
+
if (config !== null && config !== void 0 && config.fontWeight) {
|
|
146
|
+
style.fontWeight = config.fontWeight;
|
|
147
|
+
}
|
|
148
|
+
return style;
|
|
149
|
+
}, [skuCardConfig === null || skuCardConfig === void 0 ? void 0 : skuCardConfig.disabledText]);
|
|
150
|
+
|
|
131
151
|
/** 是否显示主标题 */
|
|
132
152
|
var showTitle = (skuCardConfig === null || skuCardConfig === void 0 || (_skuCardConfig$title = skuCardConfig.title) === null || _skuCardConfig$title === void 0 ? void 0 : _skuCardConfig$title.visible) !== false;
|
|
133
153
|
/** 是否显示副标题 */
|
|
@@ -136,6 +156,8 @@ var SKUCard = function SKUCard(_ref) {
|
|
|
136
156
|
var showPrice = (skuCardConfig === null || skuCardConfig === void 0 || (_skuCardConfig$price = skuCardConfig.price) === null || _skuCardConfig$price === void 0 ? void 0 : _skuCardConfig$price.visible) !== false;
|
|
137
157
|
/** 是否显示图片 */
|
|
138
158
|
var showImage = (skuCardConfig === null || skuCardConfig === void 0 || (_skuCardConfig$image = skuCardConfig.image) === null || _skuCardConfig$image === void 0 ? void 0 : _skuCardConfig$image.visible) !== false;
|
|
159
|
+
/** 是否显示disabled文本 */
|
|
160
|
+
var showDisabledText = (skuCardConfig === null || skuCardConfig === void 0 || (_skuCardConfig$disabl = skuCardConfig.disabledText) === null || _skuCardConfig$disabl === void 0 ? void 0 : _skuCardConfig$disabl.visible) !== false;
|
|
139
161
|
|
|
140
162
|
// 如果没有cover,则使用title前两个字符用于显示占位
|
|
141
163
|
var titleText = useMemo(function () {
|
|
@@ -146,6 +168,7 @@ var SKUCard = function SKUCard(_ref) {
|
|
|
146
168
|
}
|
|
147
169
|
return title.substring(0, 2).toUpperCase();
|
|
148
170
|
}, [title]);
|
|
171
|
+
console.log('disabledTextStyle >>>>>>>>>', disabledTextStyle);
|
|
149
172
|
return /*#__PURE__*/React.createElement("div", {
|
|
150
173
|
className: classNames('pisell-pro-cards-sku-card', {
|
|
151
174
|
'pisell-pro-cards-sku-card-active': selected,
|
|
@@ -157,10 +180,15 @@ var SKUCard = function SKUCard(_ref) {
|
|
|
157
180
|
if (disabled) return;
|
|
158
181
|
_onClick === null || _onClick === void 0 || _onClick();
|
|
159
182
|
},
|
|
160
|
-
style: {
|
|
183
|
+
style: _defineProperty(_defineProperty({
|
|
161
184
|
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
162
|
-
}
|
|
163
|
-
},
|
|
185
|
+
}, '--color-primary', colorPrimary), '--color-primary-bg', colorPrimaryBg)
|
|
186
|
+
}, !!skuDisabled && !!showDisabledText && /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
className: "pisell-pro-cards-sku-card-disabled-mask"
|
|
188
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: "pisell-pro-cards-sku-card-disabled-text",
|
|
190
|
+
style: disabledTextStyle
|
|
191
|
+
}, (skuCardConfig === null || skuCardConfig === void 0 || (_skuCardConfig$disabl2 = skuCardConfig.disabledText) === null || _skuCardConfig$disabl2 === void 0 ? void 0 : _skuCardConfig$disabl2.text) || locales.getText('pisell2.pro.cards.skuCard.disabledText'))), showImage && /*#__PURE__*/React.createElement("div", {
|
|
164
192
|
className: "pisell-pro-cards-sku-card-image-container",
|
|
165
193
|
style: imageStyle
|
|
166
194
|
}, !!cover ? /*#__PURE__*/React.createElement("img", {
|
|
@@ -181,7 +209,10 @@ var SKUCard = function SKUCard(_ref) {
|
|
|
181
209
|
className: "pisell-pro-cards-sku-card-price",
|
|
182
210
|
style: priceStyle
|
|
183
211
|
}, price)), arrow || renderRight ? /*#__PURE__*/React.createElement("div", {
|
|
184
|
-
className: "pisell-pro-cards-sku-card-right"
|
|
212
|
+
className: "pisell-pro-cards-sku-card-right",
|
|
213
|
+
style: renderRight ? {} : {
|
|
214
|
+
alignItems: 'center'
|
|
215
|
+
}
|
|
185
216
|
}, renderRight ? typeof renderRight === 'function' ? renderRight() : renderRight : /*#__PURE__*/React.createElement(Iconfont, {
|
|
186
217
|
type: "pisell2-chevron-right",
|
|
187
218
|
style: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.pisell-pro-cards-sku-card {
|
|
2
|
+
position: relative;
|
|
2
3
|
display: flex;
|
|
3
4
|
padding: 8px;
|
|
4
5
|
align-items: center;
|
|
@@ -9,6 +10,26 @@
|
|
|
9
10
|
cursor: pointer;
|
|
10
11
|
width: 100%;
|
|
11
12
|
|
|
13
|
+
&-disabled-mask {
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
background: rgba(255, 255, 255, 0.7);
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
z-index: 2;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
&-disabled-text {
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
font-weight: 700;
|
|
29
|
+
color: #000000;
|
|
30
|
+
transform: rotate(45deg);
|
|
31
|
+
}
|
|
32
|
+
|
|
12
33
|
&-with-image {
|
|
13
34
|
min-height: 80px;
|
|
14
35
|
}
|
|
@@ -18,8 +39,8 @@
|
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
&-active {
|
|
21
|
-
border: 1px solid #
|
|
22
|
-
background: #fcfaff;
|
|
42
|
+
border: 1px solid var(--color-primary, #5d3f9f);
|
|
43
|
+
background: var(--color-primary-bg, #fcfaff);
|
|
23
44
|
}
|
|
24
45
|
|
|
25
46
|
&-disabled {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
en: {
|
|
3
|
+
'pisell2.pro.cards.skuCard.disabledText': string;
|
|
4
|
+
};
|
|
5
|
+
'zh-CN': {
|
|
6
|
+
'pisell2.pro.cards.skuCard.disabledText': string;
|
|
7
|
+
};
|
|
8
|
+
'zh-HK': {
|
|
9
|
+
'pisell2.pro.cards.skuCard.disabledText': string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* SKU Card 文本样式配置
|
|
4
|
+
*/
|
|
5
|
+
export interface SkuCardTextConfig {
|
|
6
|
+
/** 是否显示 */
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
/** 字体大小 */
|
|
9
|
+
fontSize?: number;
|
|
10
|
+
/** 颜色 */
|
|
11
|
+
color?: string;
|
|
12
|
+
/** 字体粗细 */
|
|
13
|
+
fontWeight?: 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
14
|
+
/** 展示行数 */
|
|
15
|
+
lineClamp?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* SKU Card 图片配置
|
|
19
|
+
*/
|
|
20
|
+
export interface SkuCardImageConfig {
|
|
21
|
+
/** 是否显示 */
|
|
22
|
+
visible?: boolean;
|
|
23
|
+
/** 宽度 */
|
|
24
|
+
width?: number;
|
|
25
|
+
/** 高度 */
|
|
26
|
+
height?: number;
|
|
27
|
+
/** 圆角 */
|
|
28
|
+
borderRadius?: number | string;
|
|
29
|
+
/** 边框 */
|
|
30
|
+
border?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* SKU Card disabled文本配置
|
|
34
|
+
*/
|
|
35
|
+
export interface SkuCardDisabledTextConfig extends Omit<SkuCardTextConfig, 'lineClamp'> {
|
|
36
|
+
/** 文本 */
|
|
37
|
+
text?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SKU Card 配置
|
|
41
|
+
*/
|
|
42
|
+
export interface SkuCardConfig {
|
|
43
|
+
/** 主标题配置 */
|
|
44
|
+
title?: SkuCardTextConfig;
|
|
45
|
+
/** 副标题配置 */
|
|
46
|
+
subTitle?: SkuCardTextConfig;
|
|
47
|
+
/** 价格配置 */
|
|
48
|
+
price?: Omit<SkuCardTextConfig, 'lineClamp'>;
|
|
49
|
+
/** 图片配置 */
|
|
50
|
+
image?: SkuCardImageConfig;
|
|
51
|
+
/** disabled文本展示 */
|
|
52
|
+
disabledText?: SkuCardDisabledTextConfig;
|
|
53
|
+
}
|
|
54
|
+
export interface SKUCardProps {
|
|
55
|
+
cover?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
subtitle?: string;
|
|
58
|
+
price?: string;
|
|
59
|
+
arrow?: boolean;
|
|
60
|
+
selected?: boolean;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
onClick?: () => void;
|
|
63
|
+
renderRight?: React.ReactNode | (() => React.ReactNode);
|
|
64
|
+
/** SKU Card 配置 */
|
|
65
|
+
skuCardConfig?: SkuCardConfig;
|
|
66
|
+
/** SKU 是否禁用 */
|
|
67
|
+
skuDisabled?: boolean;
|
|
68
|
+
theme?: {
|
|
69
|
+
token: {
|
|
70
|
+
colorPrimary: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -13,6 +15,7 @@ import { useMemo, useState, useCallback, useEffect } from 'react';
|
|
|
13
15
|
import classNames from 'classnames';
|
|
14
16
|
import { isMobile } from '@pisell/utils';
|
|
15
17
|
import { NumberKeyboard } from "../keyboards";
|
|
18
|
+
import useThemeTokens from "../../hooks/useThemeTokens";
|
|
16
19
|
import "./index.less";
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -48,7 +51,8 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
48
51
|
variant = _ref$variant === void 0 ? 'separated' : _ref$variant,
|
|
49
52
|
_ref$enableInput = _ref.enableInput,
|
|
50
53
|
enableInput = _ref$enableInput === void 0 ? true : _ref$enableInput,
|
|
51
|
-
displayMaxWidth = _ref.displayMaxWidth
|
|
54
|
+
displayMaxWidth = _ref.displayMaxWidth,
|
|
55
|
+
theme = _ref.theme;
|
|
52
56
|
var _useState = useState(false),
|
|
53
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
54
58
|
open = _useState2[0],
|
|
@@ -60,6 +64,8 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
60
64
|
var _isMobile = useMemo(function () {
|
|
61
65
|
return isMobile();
|
|
62
66
|
}, [isMobile]);
|
|
67
|
+
var _useThemeTokens = useThemeTokens(theme),
|
|
68
|
+
colorPrimary = _useThemeTokens.colorPrimary;
|
|
63
69
|
var _useState5 = useState(''),
|
|
64
70
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
65
71
|
tempValue = _useState6[0],
|
|
@@ -267,7 +273,7 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
267
273
|
}))));
|
|
268
274
|
return /*#__PURE__*/React.createElement("div", {
|
|
269
275
|
className: stepperClasses,
|
|
270
|
-
style: styles === null || styles === void 0 ? void 0 : styles.container,
|
|
276
|
+
style: _objectSpread(_objectSpread({}, (styles === null || styles === void 0 ? void 0 : styles.container) || {}), {}, _defineProperty({}, '--color-primary', colorPrimary)),
|
|
271
277
|
onClick: function onClick(e) {
|
|
272
278
|
return e.stopPropagation();
|
|
273
279
|
}
|