@pisell/private-materials 6.3.92 → 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/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
- package/es/components/eftpos/hooks.d.ts +1 -0
- package/es/components/eftposPay/app.d.ts +1 -1
- package/es/components/eftposPay/tyro/hooks.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/es/hooks/useThemeTokens.d.ts +7 -0
- package/es/hooks/useThemeTokens.js +20 -0
- package/es/plus/skuOptionsSelection/components/NormalCard/index.js +6 -5
- 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/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +1 -0
- package/lib/components/eftpos/hooks.d.ts +1 -0
- package/lib/components/eftposPay/app.d.ts +1 -1
- package/lib/components/eftposPay/tyro/hooks.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/lib/hooks/useThemeTokens.d.ts +7 -0
- package/lib/hooks/useThemeTokens.js +40 -0
- package/lib/plus/skuOptionsSelection/components/NormalCard/index.js +11 -10
- 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 +2 -2
|
@@ -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 {
|
|
@@ -37,15 +37,21 @@ var import_OptionsCard = __toESM(require("../components/OptionsCard"));
|
|
|
37
37
|
var import_NormalCard = __toESM(require("../components/NormalCard"));
|
|
38
38
|
var import_TitleExtra = __toESM(require("../components/TitleExtra"));
|
|
39
39
|
var import_checkSkuStatus = require("./checkSkuStatus");
|
|
40
|
+
var import_store = __toESM(require("../store/store"));
|
|
40
41
|
var transformBundleGroup = (bundleGroup) => {
|
|
42
|
+
var _a;
|
|
41
43
|
if (!Array.isArray(bundleGroup)) return [];
|
|
44
|
+
const selectorLayout = ((_a = import_store.default.getState().customConfig) == null ? void 0 : _a.selectorLayout) || null;
|
|
42
45
|
const formattedGroup = bundleGroup.map((item) => {
|
|
43
|
-
var
|
|
44
|
-
const selectorOptionsDataSource = (
|
|
46
|
+
var _a2;
|
|
47
|
+
const selectorOptionsDataSource = (_a2 = item == null ? void 0 : item.bundle_item) == null ? void 0 : _a2.map((bundleItem) => {
|
|
45
48
|
const { canSell, hasStock } = (0, import_checkSkuStatus.checkSkuStockCanSell)(bundleItem);
|
|
46
49
|
const disabled = (0, import_checkSkuStatus.checkSkuDisabled)(bundleItem, canSell);
|
|
47
50
|
return {
|
|
48
|
-
_original: {
|
|
51
|
+
_original: {
|
|
52
|
+
...bundleItem || {},
|
|
53
|
+
_bundle_product_id: bundleItem == null ? void 0 : bundleItem.bundle_product_id
|
|
54
|
+
},
|
|
49
55
|
// 渲染需要的数据源
|
|
50
56
|
id: bundleItem == null ? void 0 : bundleItem.id,
|
|
51
57
|
title: (bundleItem == null ? void 0 : bundleItem.title) || "",
|
|
@@ -56,10 +62,7 @@ var transformBundleGroup = (bundleGroup) => {
|
|
|
56
62
|
max: bundleItem == null ? void 0 : bundleItem.max_quantity,
|
|
57
63
|
autoValidate: true
|
|
58
64
|
},
|
|
59
|
-
_extra: {
|
|
60
|
-
canSell,
|
|
61
|
-
hasStock
|
|
62
|
-
}
|
|
65
|
+
_extra: { canSell, hasStock, disabled }
|
|
63
66
|
};
|
|
64
67
|
});
|
|
65
68
|
const selectorDataSource = {
|
|
@@ -85,9 +88,12 @@ var transformBundleGroup = (bundleGroup) => {
|
|
|
85
88
|
showInput: true
|
|
86
89
|
}
|
|
87
90
|
};
|
|
91
|
+
if (!!selectorLayout) {
|
|
92
|
+
selectorDataSource.layout = selectorLayout;
|
|
93
|
+
}
|
|
88
94
|
selectorDataSource.renderItem = (itemProps) => {
|
|
89
|
-
var
|
|
90
|
-
if (!!((_c = (_b = (
|
|
95
|
+
var _a3, _b, _c;
|
|
96
|
+
if (!!((_c = (_b = (_a3 = itemProps == null ? void 0 : itemProps.dataSource) == null ? void 0 : _a3._original) == null ? void 0 : _b.option_group) == null ? void 0 : _c.length)) {
|
|
91
97
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
92
98
|
import_OptionsCard.default,
|
|
93
99
|
{
|
|
@@ -36,11 +36,14 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_NormalCard = __toESM(require("../components/NormalCard"));
|
|
37
37
|
var import_TitleExtra = __toESM(require("../components/TitleExtra"));
|
|
38
38
|
var import_checkSkuStatus = require("./checkSkuStatus");
|
|
39
|
+
var import_store = __toESM(require("../store/store"));
|
|
39
40
|
var transformOptionGroup = (optionGroup) => {
|
|
41
|
+
var _a;
|
|
40
42
|
if (!Array.isArray(optionGroup)) return [];
|
|
43
|
+
const selectorLayout = ((_a = import_store.default.getState().customConfig) == null ? void 0 : _a.selectorLayout) || null;
|
|
41
44
|
const formattedGroup = optionGroup.map((item) => {
|
|
42
|
-
var
|
|
43
|
-
const selectorOptionsDataSource = (
|
|
45
|
+
var _a2;
|
|
46
|
+
const selectorOptionsDataSource = (_a2 = item == null ? void 0 : item.option_item) == null ? void 0 : _a2.map(
|
|
44
47
|
(optionItem) => {
|
|
45
48
|
const { canSell, hasStock } = (0, import_checkSkuStatus.checkSkuStockCanSell)(optionItem);
|
|
46
49
|
const disabled = (0, import_checkSkuStatus.checkSkuDisabled)(optionItem, canSell);
|
|
@@ -58,10 +61,7 @@ var transformOptionGroup = (optionGroup) => {
|
|
|
58
61
|
max: optionItem == null ? void 0 : optionItem.max_quantity,
|
|
59
62
|
autoValidate: true
|
|
60
63
|
},
|
|
61
|
-
_extra: {
|
|
62
|
-
canSell,
|
|
63
|
-
hasStock
|
|
64
|
-
}
|
|
64
|
+
_extra: { canSell, hasStock, disabled }
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
);
|
|
@@ -94,6 +94,9 @@ var transformOptionGroup = (optionGroup) => {
|
|
|
94
94
|
showInput: true
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
+
if (!!selectorLayout) {
|
|
98
|
+
selectorDataSource.layout = selectorLayout;
|
|
99
|
+
}
|
|
97
100
|
selectorDataSource.renderItem = (itemProps) => {
|
|
98
101
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
99
102
|
import_NormalCard.default,
|
|
@@ -37,9 +37,10 @@ var import_store = __toESM(require("../store/store"));
|
|
|
37
37
|
var import_VariantCard = __toESM(require("../components/VariantCard"));
|
|
38
38
|
var import_checkSkuStatus = require("./checkSkuStatus");
|
|
39
39
|
var transformVariantGroup = (variantGroup) => {
|
|
40
|
-
var _a;
|
|
40
|
+
var _a, _b;
|
|
41
41
|
if (!Array.isArray(variantGroup)) return [];
|
|
42
42
|
const variantProducts = ((_a = import_store.default.getState().dataSource) == null ? void 0 : _a.variant) || [];
|
|
43
|
+
const selectorLayout = ((_b = import_store.default.getState().customConfig) == null ? void 0 : _b.selectorLayout) || null;
|
|
43
44
|
const formattedGroup = variantGroup.map((item) => {
|
|
44
45
|
var _a2;
|
|
45
46
|
const selectorOptionsDataSource = (_a2 = item == null ? void 0 : item.variant_item) == null ? void 0 : _a2.map(
|
|
@@ -61,10 +62,7 @@ var transformVariantGroup = (variantGroup) => {
|
|
|
61
62
|
ruleConfig: {
|
|
62
63
|
autoValidate: true
|
|
63
64
|
},
|
|
64
|
-
_extra: {
|
|
65
|
-
canSell,
|
|
66
|
-
hasStock
|
|
67
|
-
}
|
|
65
|
+
_extra: { canSell, hasStock, disabled }
|
|
68
66
|
};
|
|
69
67
|
}
|
|
70
68
|
);
|
|
@@ -95,13 +93,16 @@ var transformVariantGroup = (variantGroup) => {
|
|
|
95
93
|
showInput: true
|
|
96
94
|
}
|
|
97
95
|
};
|
|
96
|
+
if (!!selectorLayout) {
|
|
97
|
+
selectorDataSource.layout = selectorLayout;
|
|
98
|
+
}
|
|
98
99
|
selectorDataSource.renderItem = (itemProps) => {
|
|
99
|
-
var _a3,
|
|
100
|
+
var _a3, _b2, _c;
|
|
100
101
|
const { canSell, hasStock } = (0, import_checkSkuStatus.checkVariantStockByValue)(
|
|
101
102
|
(_a3 = itemProps == null ? void 0 : itemProps.dataSource) == null ? void 0 : _a3._original
|
|
102
103
|
);
|
|
103
104
|
const price = getVariantItemFixedPriceByValue({
|
|
104
|
-
variantItem: (
|
|
105
|
+
variantItem: (_b2 = itemProps == null ? void 0 : itemProps.dataSource) == null ? void 0 : _b2._original,
|
|
105
106
|
variantProducts
|
|
106
107
|
});
|
|
107
108
|
const _dataSource = {
|
|
@@ -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;
|
|
@@ -36,7 +36,11 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_materials = require("@pisell/materials");
|
|
37
37
|
var import_utils = require("@pisell/utils");
|
|
38
38
|
var import_classnames = __toESM(require("classnames"));
|
|
39
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
40
|
+
var import_locales = __toESM(require("./locales"));
|
|
41
|
+
var import_useThemeTokens = __toESM(require("../../../../hooks/useThemeTokens"));
|
|
39
42
|
var import_index = require("./index.less");
|
|
43
|
+
var import_index2 = require("./index.less");
|
|
40
44
|
var SKUCard = ({
|
|
41
45
|
cover,
|
|
42
46
|
title,
|
|
@@ -47,9 +51,15 @@ var SKUCard = ({
|
|
|
47
51
|
disabled,
|
|
48
52
|
onClick,
|
|
49
53
|
renderRight,
|
|
50
|
-
skuCardConfig
|
|
54
|
+
skuCardConfig,
|
|
55
|
+
skuDisabled,
|
|
56
|
+
theme
|
|
51
57
|
}) => {
|
|
52
|
-
var _a, _b, _c, _d;
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
59
|
+
const { colorPrimary, colorPrimaryBg } = (0, import_useThemeTokens.default)(theme);
|
|
60
|
+
const context = (0, import_useEngineContext.default)();
|
|
61
|
+
const language = ((_c = (_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.storage) == null ? void 0 : _c.get("umi_locale")) || "en";
|
|
62
|
+
import_utils.locales.init(import_locales.default, language);
|
|
53
63
|
const titleStyle = (0, import_react.useMemo)(() => {
|
|
54
64
|
const config = skuCardConfig == null ? void 0 : skuCardConfig.title;
|
|
55
65
|
const style = {};
|
|
@@ -126,10 +136,25 @@ var SKUCard = ({
|
|
|
126
136
|
}
|
|
127
137
|
return style;
|
|
128
138
|
}, [skuCardConfig == null ? void 0 : skuCardConfig.image]);
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
const disabledTextStyle = (0, import_react.useMemo)(() => {
|
|
140
|
+
const config = skuCardConfig == null ? void 0 : skuCardConfig.disabledText;
|
|
141
|
+
const style = {};
|
|
142
|
+
if (config == null ? void 0 : config.color) {
|
|
143
|
+
style.color = config.color;
|
|
144
|
+
}
|
|
145
|
+
if (config == null ? void 0 : config.fontSize) {
|
|
146
|
+
style.fontSize = config.fontSize;
|
|
147
|
+
}
|
|
148
|
+
if (config == null ? void 0 : config.fontWeight) {
|
|
149
|
+
style.fontWeight = config.fontWeight;
|
|
150
|
+
}
|
|
151
|
+
return style;
|
|
152
|
+
}, [skuCardConfig == null ? void 0 : skuCardConfig.disabledText]);
|
|
153
|
+
const showTitle = ((_d = skuCardConfig == null ? void 0 : skuCardConfig.title) == null ? void 0 : _d.visible) !== false;
|
|
154
|
+
const showSubTitle = ((_e = skuCardConfig == null ? void 0 : skuCardConfig.subTitle) == null ? void 0 : _e.visible) !== false;
|
|
155
|
+
const showPrice = ((_f = skuCardConfig == null ? void 0 : skuCardConfig.price) == null ? void 0 : _f.visible) !== false;
|
|
156
|
+
const showImage = ((_g = skuCardConfig == null ? void 0 : skuCardConfig.image) == null ? void 0 : _g.visible) !== false;
|
|
157
|
+
const showDisabledText = ((_h = skuCardConfig == null ? void 0 : skuCardConfig.disabledText) == null ? void 0 : _h.visible) !== false;
|
|
133
158
|
const titleText = (0, import_react.useMemo)(() => {
|
|
134
159
|
if (!title) return "";
|
|
135
160
|
if (title.length < 2) {
|
|
@@ -137,6 +162,7 @@ var SKUCard = ({
|
|
|
137
162
|
}
|
|
138
163
|
return title.substring(0, 2).toUpperCase();
|
|
139
164
|
}, [title]);
|
|
165
|
+
console.log("disabledTextStyle >>>>>>>>>", disabledTextStyle);
|
|
140
166
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
141
167
|
"div",
|
|
142
168
|
{
|
|
@@ -151,9 +177,19 @@ var SKUCard = ({
|
|
|
151
177
|
onClick == null ? void 0 : onClick();
|
|
152
178
|
},
|
|
153
179
|
style: {
|
|
154
|
-
cursor: disabled ? "not-allowed" : "pointer"
|
|
180
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
181
|
+
["--color-primary"]: colorPrimary,
|
|
182
|
+
["--color-primary-bg"]: colorPrimaryBg
|
|
155
183
|
}
|
|
156
184
|
},
|
|
185
|
+
!!skuDisabled && !!showDisabledText && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-cards-sku-card-disabled-mask" }, /* @__PURE__ */ import_react.default.createElement(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
className: "pisell-pro-cards-sku-card-disabled-text",
|
|
189
|
+
style: disabledTextStyle
|
|
190
|
+
},
|
|
191
|
+
((_i = skuCardConfig == null ? void 0 : skuCardConfig.disabledText) == null ? void 0 : _i.text) || import_utils.locales.getText("pisell2.pro.cards.skuCard.disabledText")
|
|
192
|
+
)),
|
|
157
193
|
showImage && /* @__PURE__ */ import_react.default.createElement(
|
|
158
194
|
"div",
|
|
159
195
|
{
|
|
@@ -177,16 +213,25 @@ var SKUCard = ({
|
|
|
177
213
|
},
|
|
178
214
|
subtitle
|
|
179
215
|
), showPrice && price && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-pro-cards-sku-card-price", style: priceStyle }, price)),
|
|
180
|
-
arrow || renderRight ? /* @__PURE__ */ import_react.default.createElement(
|
|
181
|
-
|
|
216
|
+
arrow || renderRight ? /* @__PURE__ */ import_react.default.createElement(
|
|
217
|
+
"div",
|
|
182
218
|
{
|
|
183
|
-
|
|
184
|
-
style: {
|
|
185
|
-
|
|
186
|
-
color: disabled ? "#f2f2f2" : "#475467"
|
|
219
|
+
className: "pisell-pro-cards-sku-card-right",
|
|
220
|
+
style: renderRight ? {} : {
|
|
221
|
+
alignItems: "center"
|
|
187
222
|
}
|
|
188
|
-
}
|
|
189
|
-
|
|
223
|
+
},
|
|
224
|
+
renderRight ? typeof renderRight === "function" ? renderRight() : renderRight : /* @__PURE__ */ import_react.default.createElement(
|
|
225
|
+
import_materials.Iconfont,
|
|
226
|
+
{
|
|
227
|
+
type: "pisell2-chevron-right",
|
|
228
|
+
style: {
|
|
229
|
+
fontSize: "28px",
|
|
230
|
+
color: disabled ? "#f2f2f2" : "#475467"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
) : null
|
|
190
235
|
);
|
|
191
236
|
};
|
|
192
237
|
var SKUCard_default = SKUCard;
|
|
@@ -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,35 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/pro/Cards/components/SKUCard/locales.ts
|
|
20
|
+
var locales_exports = {};
|
|
21
|
+
__export(locales_exports, {
|
|
22
|
+
default: () => locales_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(locales_exports);
|
|
25
|
+
var locales_default = {
|
|
26
|
+
en: {
|
|
27
|
+
"pisell2.pro.cards.skuCard.disabledText": "Sold out"
|
|
28
|
+
},
|
|
29
|
+
"zh-CN": {
|
|
30
|
+
"pisell2.pro.cards.skuCard.disabledText": "已售罄"
|
|
31
|
+
},
|
|
32
|
+
"zh-HK": {
|
|
33
|
+
"pisell2.pro.cards.skuCard.disabledText": "已售罄"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -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,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/pro/Cards/components/SKUCard/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -37,6 +37,7 @@ var import_react = require("react");
|
|
|
37
37
|
var import_classnames = __toESM(require("classnames"));
|
|
38
38
|
var import_utils = require("@pisell/utils");
|
|
39
39
|
var import_keyboards = require("../keyboards");
|
|
40
|
+
var import_useThemeTokens = __toESM(require("../../hooks/useThemeTokens"));
|
|
40
41
|
var import_index = require("./index.less");
|
|
41
42
|
var NumericStepper = ({
|
|
42
43
|
value,
|
|
@@ -55,13 +56,15 @@ var NumericStepper = ({
|
|
|
55
56
|
horizontalPadding = 0,
|
|
56
57
|
variant = "separated",
|
|
57
58
|
enableInput = true,
|
|
58
|
-
displayMaxWidth
|
|
59
|
+
displayMaxWidth,
|
|
60
|
+
theme
|
|
59
61
|
}) => {
|
|
60
62
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
61
63
|
const [internalValue, setInternalValue] = (0, import_react.useState)(
|
|
62
64
|
value !== void 0 ? value : defaultValue
|
|
63
65
|
);
|
|
64
66
|
const _isMobile = (0, import_react.useMemo)(() => (0, import_utils.isMobile)(), [import_utils.isMobile]);
|
|
67
|
+
const { colorPrimary } = (0, import_useThemeTokens.default)(theme);
|
|
65
68
|
const [tempValue, setTempValue] = (0, import_react.useState)("");
|
|
66
69
|
const currentValue = value !== void 0 ? value : internalValue;
|
|
67
70
|
(0, import_react.useEffect)(() => {
|
|
@@ -192,7 +195,9 @@ var NumericStepper = ({
|
|
|
192
195
|
if (isPlusOnly) {
|
|
193
196
|
return null;
|
|
194
197
|
}
|
|
195
|
-
const displayWrapperStyle = variant === "capsule" && displayMaxWidth ? {
|
|
198
|
+
const displayWrapperStyle = variant === "capsule" && displayMaxWidth ? {
|
|
199
|
+
maxWidth: typeof displayMaxWidth === "number" ? `${displayMaxWidth}px` : displayMaxWidth
|
|
200
|
+
} : {};
|
|
196
201
|
const displayElement = /* @__PURE__ */ React.createElement(
|
|
197
202
|
"span",
|
|
198
203
|
{
|
|
@@ -295,7 +300,10 @@ var NumericStepper = ({
|
|
|
295
300
|
"div",
|
|
296
301
|
{
|
|
297
302
|
className: stepperClasses,
|
|
298
|
-
style:
|
|
303
|
+
style: {
|
|
304
|
+
...(styles == null ? void 0 : styles.container) || {},
|
|
305
|
+
["--color-primary"]: colorPrimary
|
|
306
|
+
},
|
|
299
307
|
onClick: (e) => e.stopPropagation()
|
|
300
308
|
},
|
|
301
309
|
_minus,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// ========== 变量定义 ==========
|
|
2
|
-
@primary-color: #
|
|
3
|
-
@primary-hover: #6b46c1;
|
|
4
|
-
@primary-active: #553c9a;
|
|
2
|
+
@primary-color: var(--color-primary, #5d3f9f);
|
|
5
3
|
|
|
6
4
|
@text-color: #101828;
|
|
7
5
|
@text-secondary: #344054;
|
|
@@ -77,13 +75,7 @@
|
|
|
77
75
|
align-items: center;
|
|
78
76
|
display: flex;
|
|
79
77
|
height: 100%;
|
|
80
|
-
|
|
81
|
-
&:hover .numeric-stepper-button:not(.numeric-stepper-button-disabled) {
|
|
82
|
-
background-color: @primary-hover;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
78
|
&:active .numeric-stepper-button:not(.numeric-stepper-button-disabled) {
|
|
86
|
-
background-color: @primary-active;
|
|
87
79
|
transform: scale(0.95);
|
|
88
80
|
}
|
|
89
81
|
|