@pisell/private-materials 6.3.93 → 6.3.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  12. package/es/components/eftposPay/tyro/hooks.d.ts +0 -1
  13. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  14. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  15. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  16. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  17. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  18. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  19. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  20. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  21. package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +1 -3
  22. package/es/components/schedules/model.d.ts +1 -9
  23. package/es/hooks/useThemeTokens.d.ts +7 -0
  24. package/es/hooks/useThemeTokens.js +20 -0
  25. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  26. package/es/plus/skuOptionsSelection/components/NormalCard/index.js +3 -1
  27. package/es/plus/skuOptionsSelection/components/OptionsCard/index.js +3 -2
  28. package/es/plus/skuOptionsSelection/store/store.js +2 -1
  29. package/es/plus/skuOptionsSelection/types.d.ts +14 -0
  30. package/es/plus/skuOptionsSelection/types.js +4 -0
  31. package/es/plus/skuOptionsSelection/utils/transformBundleGroup.js +10 -1
  32. package/es/plus/skuOptionsSelection/utils/transformOptionGroup.js +10 -1
  33. package/es/plus/skuOptionsSelection/utils/transformVariantGroup.js +8 -2
  34. package/es/pro/Cards/components/SKUCard/index.d.ts +2 -56
  35. package/es/pro/Cards/components/SKUCard/index.js +51 -20
  36. package/es/pro/Cards/components/SKUCard/index.less +23 -2
  37. package/es/pro/Cards/components/SKUCard/locales.d.ts +12 -0
  38. package/es/pro/Cards/components/SKUCard/locales.js +11 -0
  39. package/es/pro/Cards/components/SKUCard/types.d.ts +73 -0
  40. package/es/pro/Cards/components/SKUCard/types.js +1 -0
  41. package/es/pro/NumericStepper/index.d.ts +5 -0
  42. package/es/pro/NumericStepper/index.js +8 -2
  43. package/es/pro/NumericStepper/index.less +1 -9
  44. package/es/pro/Selector/BatchSelectorDemo.js +2 -12
  45. package/es/pro/Selector/Selector.js +6 -4
  46. package/es/pro/Selector/SelectorGroup.d.ts +1 -1
  47. package/es/pro/Selector/SelectorGroup.js +5 -1
  48. package/es/pro/Selector/components/Card/index.js +9 -7
  49. package/es/pro/Selector/components/Card/index.less +24 -15
  50. package/es/pro/Selector/components/Indicator/index.js +1 -1
  51. package/es/pro/Selector/components/Indicator/index.less +12 -12
  52. package/es/pro/Selector/components/Media/index.d.ts +1 -1
  53. package/es/pro/Selector/components/Media/index.less +1 -1
  54. package/es/pro/Selector/selectorGroup.less +9 -1
  55. package/es/pro/Selector/types.d.ts +10 -0
  56. package/lib/components/booking/info/clientVariant/hooks/useIsLowSpeedNetwork.d.ts +0 -1
  57. package/lib/components/eftposPay/tyro/hooks.d.ts +0 -1
  58. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  59. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateStatus/index.d.ts +0 -1
  60. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  61. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  62. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/DayItem/index.d.ts +0 -1
  63. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Item/index.d.ts +0 -1
  64. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/Status/index.d.ts +0 -1
  65. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/StripeSDK/index.d.ts +0 -1
  66. package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +1 -3
  67. package/lib/components/schedules/model.d.ts +1 -9
  68. package/lib/hooks/useThemeTokens.d.ts +7 -0
  69. package/lib/hooks/useThemeTokens.js +40 -0
  70. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  71. package/lib/plus/skuOptionsSelection/components/NormalCard/index.js +8 -6
  72. package/lib/plus/skuOptionsSelection/components/OptionsCard/index.js +3 -2
  73. package/lib/plus/skuOptionsSelection/store/store.js +2 -1
  74. package/lib/plus/skuOptionsSelection/types.d.ts +14 -0
  75. package/lib/plus/skuOptionsSelection/utils/transformBundleGroup.js +15 -9
  76. package/lib/plus/skuOptionsSelection/utils/transformOptionGroup.js +9 -6
  77. package/lib/plus/skuOptionsSelection/utils/transformVariantGroup.js +8 -7
  78. package/lib/pro/Cards/components/SKUCard/index.d.ts +2 -56
  79. package/lib/pro/Cards/components/SKUCard/index.js +60 -15
  80. package/lib/pro/Cards/components/SKUCard/index.less +23 -2
  81. package/lib/pro/Cards/components/SKUCard/locales.d.ts +12 -0
  82. package/lib/pro/Cards/components/SKUCard/locales.js +35 -0
  83. package/lib/pro/Cards/components/SKUCard/types.d.ts +73 -0
  84. package/lib/pro/Cards/components/SKUCard/types.js +17 -0
  85. package/lib/pro/NumericStepper/index.d.ts +5 -0
  86. package/lib/pro/NumericStepper/index.js +11 -3
  87. package/lib/pro/NumericStepper/index.less +1 -9
  88. package/lib/pro/Selector/BatchSelectorDemo.js +13 -19
  89. package/lib/pro/Selector/Selector.js +7 -1
  90. package/lib/pro/Selector/SelectorGroup.d.ts +1 -1
  91. package/lib/pro/Selector/SelectorGroup.js +7 -1
  92. package/lib/pro/Selector/components/Card/index.js +10 -7
  93. package/lib/pro/Selector/components/Card/index.less +24 -15
  94. package/lib/pro/Selector/components/Indicator/index.js +1 -1
  95. package/lib/pro/Selector/components/Indicator/index.less +12 -12
  96. package/lib/pro/Selector/components/Media/index.d.ts +1 -1
  97. package/lib/pro/Selector/components/Media/index.js +7 -4
  98. package/lib/pro/Selector/components/Media/index.less +1 -1
  99. package/lib/pro/Selector/selectorGroup.less +9 -1
  100. package/lib/pro/Selector/types.d.ts +10 -0
  101. package/lowcode/eco-cup-list/meta.ts +1 -1
  102. package/lowcode/eco-customer-list/meta.ts +1 -1
  103. package/lowcode/selector/meta.ts +15 -2
  104. package/lowcode/selector.group/meta.ts +15 -2
  105. package/lowcode/sku-options-selection/meta.ts +106 -2
  106. package/package.json +2 -2
  107. package/es/components/Sales/Summary/utils.d.ts +0 -58
  108. package/es/components/booking/components/voucher/utils.d.ts +0 -4
  109. package/es/components/booking/editBookingModal/utils.d.ts +0 -12
  110. package/es/components/ecocup/components/CupInfoCard/index.d.ts +0 -8
  111. package/es/components/ecocup/components/CupStatusModal/hooks.d.ts +0 -5
  112. package/es/components/ecocup/components/CustomerCard/index.d.ts +0 -7
  113. package/es/components/ecocup/cupList/hooks/useCupApi.d.ts +0 -32
  114. package/es/components/ecocup/cupProject/const.d.ts +0 -7
  115. package/es/components/eftpos/const.d.ts +0 -64
  116. package/es/components/eftpos/device.d.ts +0 -9
  117. package/es/components/eftpos/hooks.d.ts +0 -34
  118. package/es/components/workSpaceList/components/AppearanceEdit/constants.d.ts +0 -8
  119. package/es/components/workSpaceList/components/Card/constants.d.ts +0 -2
  120. package/es/pro/Login2.0/components/PhoneInput.d.ts +0 -53
  121. package/es/test/setup.d.ts +0 -1
  122. package/lib/components/Sales/Summary/utils.d.ts +0 -58
  123. package/lib/components/booking/components/voucher/utils.d.ts +0 -4
  124. package/lib/components/booking/editBookingModal/utils.d.ts +0 -12
  125. package/lib/components/ecocup/components/CupInfoCard/index.d.ts +0 -8
  126. package/lib/components/ecocup/components/CupStatusModal/hooks.d.ts +0 -5
  127. package/lib/components/ecocup/components/CustomerCard/index.d.ts +0 -7
  128. package/lib/components/ecocup/cupList/hooks/useCupApi.d.ts +0 -32
  129. package/lib/components/ecocup/cupProject/const.d.ts +0 -7
  130. package/lib/components/eftpos/const.d.ts +0 -64
  131. package/lib/components/eftpos/device.d.ts +0 -9
  132. package/lib/components/eftpos/hooks.d.ts +0 -34
  133. package/lib/components/workSpaceList/components/AppearanceEdit/constants.d.ts +0 -8
  134. package/lib/components/workSpaceList/components/Card/constants.d.ts +0 -2
  135. package/lib/pro/Login2.0/components/PhoneInput.d.ts +0 -53
  136. package/lib/test/setup.d.ts +0 -1
@@ -0,0 +1,40 @@
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/hooks/useThemeTokens.ts
20
+ var useThemeTokens_exports = {};
21
+ __export(useThemeTokens_exports, {
22
+ default: () => useThemeTokens_default
23
+ });
24
+ module.exports = __toCommonJS(useThemeTokens_exports);
25
+ var import_antd = require("antd");
26
+ var themeTokenCache = /* @__PURE__ */ new Map();
27
+ var useThemeTokens = (themeInput) => {
28
+ var _a;
29
+ const { useToken, getDesignToken } = import_antd.theme;
30
+ const { token: antdToken } = useToken();
31
+ const overrideColorPrimary = ((_a = themeInput == null ? void 0 : themeInput.token) == null ? void 0 : _a.colorPrimary) || antdToken.colorPrimary;
32
+ const cached = themeTokenCache.get(overrideColorPrimary);
33
+ if (cached) return cached;
34
+ const computed = getDesignToken({
35
+ token: { colorPrimary: overrideColorPrimary }
36
+ });
37
+ themeTokenCache.set(overrideColorPrimary, computed);
38
+ return computed;
39
+ };
40
+ var useThemeTokens_default = useThemeTokens;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  declare const ErrorTip: ({ text }: any) => import("react").JSX.Element;
4
3
  export default ErrorTip;
@@ -37,6 +37,7 @@ var import_decimal = __toESM(require("decimal.js"));
37
37
  var import_hooks = require("../../hooks");
38
38
  var import_Cards = require("../../../../pro/Cards");
39
39
  var NormalCard = (props) => {
40
+ var _a, _b;
40
41
  const {
41
42
  _key: uniqueKey,
42
43
  ruleConfig,
@@ -58,7 +59,7 @@ var NormalCard = (props) => {
58
59
  return null;
59
60
  return import_react.default.cloneElement(props == null ? void 0 : props.numberSelector, {
60
61
  onChange: (v) => {
61
- var _a;
62
+ var _a2;
62
63
  const _price = add_price !== void 0 && add_price !== null ? add_price : price;
63
64
  const priceType = price_type === "markdown" ? -1 : 1;
64
65
  const totalPrice = new import_decimal.default(_price).times(new import_decimal.default(v)).times(priceType).toNumber();
@@ -70,7 +71,7 @@ var NormalCard = (props) => {
70
71
  original_price: _price,
71
72
  original_total: _price
72
73
  };
73
- (_a = props == null ? void 0 : props.actions) == null ? void 0 : _a.update(uniqueKey, {
74
+ (_a2 = props == null ? void 0 : props.actions) == null ? void 0 : _a2.update(uniqueKey, {
74
75
  quantity: v,
75
76
  data: newOriginal,
76
77
  totalPrice
@@ -90,10 +91,10 @@ var NormalCard = (props) => {
90
91
  return `${price_type === "markdown" ? "-" : ""}${symbol}${price || 0}`;
91
92
  }, [price, price_type, symbol, add_price]);
92
93
  const handleChange = () => {
93
- var _a, _b;
94
+ var _a2, _b2;
94
95
  if (disabled || isNumberSelector) return;
95
96
  if (selected) {
96
- (_a = props == null ? void 0 : props.actions) == null ? void 0 : _a.update(uniqueKey, { quantity: 0 });
97
+ (_a2 = props == null ? void 0 : props.actions) == null ? void 0 : _a2.update(uniqueKey, { quantity: 0 });
97
98
  } else {
98
99
  const _price = add_price !== void 0 && add_price !== null ? add_price : price;
99
100
  const priceType = price_type === "markdown" ? -1 : 1;
@@ -105,7 +106,7 @@ var NormalCard = (props) => {
105
106
  original_price: _price,
106
107
  original_total: _price
107
108
  };
108
- (_b = props == null ? void 0 : props.actions) == null ? void 0 : _b.update(uniqueKey, {
109
+ (_b2 = props == null ? void 0 : props.actions) == null ? void 0 : _b2.update(uniqueKey, {
109
110
  quantity: 1,
110
111
  data: newOriginal,
111
112
  totalPrice: new import_decimal.default(_price).times(priceType).toNumber()
@@ -134,7 +135,8 @@ var NormalCard = (props) => {
134
135
  }
135
136
  ))),
136
137
  onClick: handleChange,
137
- skuCardConfig
138
+ skuCardConfig,
139
+ skuDisabled: ((_b = (_a = props == null ? void 0 : props.dataSource) == null ? void 0 : _a._extra) == null ? void 0 : _b.disabled) === true
138
140
  }
139
141
  );
140
142
  };
@@ -42,7 +42,7 @@ var import_OptionsModal = __toESM(require("../OptionsModal"));
42
42
  var import_OptionItemCard = __toESM(require("./OptionItemCard"));
43
43
  var import_index = require("./index.less");
44
44
  var OptionsCard = (props) => {
45
- var _a, _b, _c, _d, _e, _f, _g, _h;
45
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
46
46
  const { _key: uniqueKey, selected, disabled } = (props == null ? void 0 : props.dataSource) || {};
47
47
  const {
48
48
  cover,
@@ -196,7 +196,8 @@ var OptionsCard = (props) => {
196
196
  arrow: true,
197
197
  selected,
198
198
  disabled,
199
- skuCardConfig
199
+ skuCardConfig,
200
+ skuDisabled: ((_j = (_i = props == null ? void 0 : props.dataSource) == null ? void 0 : _i._extra) == null ? void 0 : _j.disabled) === true
200
201
  }
201
202
  )), (selectedOptions == null ? void 0 : selectedOptions.length) > 0 && /* @__PURE__ */ import_react.default.createElement(
202
203
  import_OptionItemCard.default,
@@ -46,7 +46,8 @@ var initialState = {
46
46
  selectorValue: {},
47
47
  skuCardConfig: import_types.defaultSkuCardConfig,
48
48
  customConfig: {
49
- modalWidth: "480px"
49
+ modalWidth: "480px",
50
+ selectorLayout: null
50
51
  }
51
52
  };
52
53
  var store = (0, import_createStore.default)(initialState);
@@ -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 _a;
44
- const selectorOptionsDataSource = (_a = item == null ? void 0 : item.bundle_item) == null ? void 0 : _a.map((bundleItem) => {
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: { ...bundleItem || {}, _bundle_product_id: bundleItem == null ? void 0 : bundleItem.bundle_product_id },
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 _a2, _b, _c;
90
- if (!!((_c = (_b = (_a2 = itemProps == null ? void 0 : itemProps.dataSource) == null ? void 0 : _a2._original) == null ? void 0 : _b.option_group) == null ? void 0 : _c.length)) {
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 _a;
43
- const selectorOptionsDataSource = (_a = item == null ? void 0 : item.option_item) == null ? void 0 : _a.map(
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, _b, _c;
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: (_b = itemProps == null ? void 0 : itemProps.dataSource) == null ? void 0 : _b._original,
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 showTitle = ((_a = skuCardConfig == null ? void 0 : skuCardConfig.title) == null ? void 0 : _a.visible) !== false;
130
- const showSubTitle = ((_b = skuCardConfig == null ? void 0 : skuCardConfig.subTitle) == null ? void 0 : _b.visible) !== false;
131
- const showPrice = ((_c = skuCardConfig == null ? void 0 : skuCardConfig.price) == null ? void 0 : _c.visible) !== false;
132
- const showImage = ((_d = skuCardConfig == null ? void 0 : skuCardConfig.image) == null ? void 0 : _d.visible) !== false;
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("div", { className: "pisell-pro-cards-sku-card-right" }, renderRight ? typeof renderRight === "function" ? renderRight() : renderRight : /* @__PURE__ */ import_react.default.createElement(
181
- import_materials.Iconfont,
216
+ arrow || renderRight ? /* @__PURE__ */ import_react.default.createElement(
217
+ "div",
182
218
  {
183
- type: "pisell2-chevron-right",
184
- style: {
185
- fontSize: "28px",
186
- color: disabled ? "#f2f2f2" : "#475467"
219
+ className: "pisell-pro-cards-sku-card-right",
220
+ style: renderRight ? {} : {
221
+ alignItems: "center"
187
222
  }
188
- }
189
- )) : null
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 #7f56d9;
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
+ }