@pisell/private-materials 3.4.80 → 3.4.82

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 (84) 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/meta.js +2 -2
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +1 -1
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +1 -1
  9. package/es/components/booking/components/footer/index.js +26 -20
  10. package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  11. package/es/components/booking/utils.d.ts +2 -2
  12. package/es/components/ecocup/hooks.js +11 -11
  13. package/es/components/eftposPay/amount.d.ts +1 -1
  14. package/es/components/eftposPay/device.d.ts +1 -1
  15. package/es/components/eftposPay/hooks.d.ts +2 -2
  16. package/es/components/eftposPay/store/index.d.ts +5 -5
  17. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  18. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  19. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  20. package/es/hooks/useLocale.js +8 -1
  21. package/es/hooks/useThemeTokens.d.ts +7 -0
  22. package/es/hooks/useThemeTokens.js +20 -0
  23. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  24. package/es/pro/Cards/components/SKUCard/index.js +12 -3
  25. package/es/pro/Cards/components/SKUCard/index.less +2 -2
  26. package/es/pro/Cards/components/SKUCard/types.d.ts +5 -0
  27. package/es/pro/NumericStepper/index.d.ts +5 -0
  28. package/es/pro/NumericStepper/index.js +8 -2
  29. package/es/pro/NumericStepper/index.less +1 -9
  30. package/es/pro/Selector/BatchSelectorDemo.js +2 -12
  31. package/es/pro/Selector/Selector.d.ts +1 -1
  32. package/es/pro/Selector/Selector.js +6 -4
  33. package/es/pro/Selector/SelectorGroup.d.ts +1 -1
  34. package/es/pro/Selector/SelectorGroup.js +5 -1
  35. package/es/pro/Selector/components/Card/index.js +9 -7
  36. package/es/pro/Selector/components/Card/index.less +24 -15
  37. package/es/pro/Selector/components/Indicator/index.js +1 -1
  38. package/es/pro/Selector/components/Indicator/index.less +12 -12
  39. package/es/pro/Selector/components/Media/index.d.ts +1 -1
  40. package/es/pro/Selector/components/Media/index.less +1 -1
  41. package/es/pro/Selector/selectorGroup.less +9 -1
  42. package/es/pro/Selector/types.d.ts +10 -0
  43. package/es/pro/comprehensiveSearch/components/searchSection/index.js +3 -2
  44. package/lib/components/booking/components/footer/index.js +5 -0
  45. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
  46. package/lib/components/booking/utils.d.ts +2 -2
  47. package/lib/components/ecocup/hooks.js +3 -3
  48. package/lib/components/eftposPay/amount.d.ts +1 -1
  49. package/lib/components/eftposPay/device.d.ts +1 -1
  50. package/lib/components/eftposPay/hooks.d.ts +2 -2
  51. package/lib/components/eftposPay/store/index.d.ts +5 -5
  52. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
  53. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +1 -0
  54. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +1 -0
  55. package/lib/hooks/useLocale.js +7 -2
  56. package/lib/hooks/useThemeTokens.d.ts +7 -0
  57. package/lib/hooks/useThemeTokens.js +40 -0
  58. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  59. package/lib/pro/Cards/components/SKUCard/index.js +7 -2
  60. package/lib/pro/Cards/components/SKUCard/index.less +2 -2
  61. package/lib/pro/Cards/components/SKUCard/types.d.ts +5 -0
  62. package/lib/pro/NumericStepper/index.d.ts +5 -0
  63. package/lib/pro/NumericStepper/index.js +11 -3
  64. package/lib/pro/NumericStepper/index.less +1 -9
  65. package/lib/pro/Selector/BatchSelectorDemo.js +13 -19
  66. package/lib/pro/Selector/Selector.d.ts +1 -1
  67. package/lib/pro/Selector/Selector.js +7 -1
  68. package/lib/pro/Selector/SelectorGroup.d.ts +1 -1
  69. package/lib/pro/Selector/SelectorGroup.js +7 -1
  70. package/lib/pro/Selector/components/Card/index.js +10 -7
  71. package/lib/pro/Selector/components/Card/index.less +24 -15
  72. package/lib/pro/Selector/components/Indicator/index.js +1 -1
  73. package/lib/pro/Selector/components/Indicator/index.less +12 -12
  74. package/lib/pro/Selector/components/Media/index.d.ts +1 -1
  75. package/lib/pro/Selector/components/Media/index.js +7 -4
  76. package/lib/pro/Selector/components/Media/index.less +1 -1
  77. package/lib/pro/Selector/selectorGroup.less +9 -1
  78. package/lib/pro/Selector/types.d.ts +10 -0
  79. package/lib/pro/comprehensiveSearch/components/searchSection/index.js +3 -2
  80. package/lowcode/eco-cup-list/meta.ts +1 -1
  81. package/lowcode/eco-customer-list/meta.ts +1 -1
  82. package/lowcode/selector/meta.ts +15 -2
  83. package/lowcode/selector.group/meta.ts +15 -2
  84. package/package.json +4 -4
@@ -427,7 +427,7 @@ var Footer = function Footer(props) {
427
427
  */
428
428
  var handleSave = /*#__PURE__*/function () {
429
429
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4) {
430
- var type, _ref4$messageShow, messageShow, isHasDayProducts, _setLoading, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, _store$getState, _window, callbackData, values, api;
430
+ var type, _ref4$messageShow, messageShow, isHasDayProducts, _setLoading, loadingTimer, _getApis, createBooking, editBooking, editApi, createApi, saveOtherValue, _state$onSave, _store$getState, _window, callbackData, values, api;
431
431
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
432
432
  while (1) switch (_context4.prev = _context4.next) {
433
433
  case 0:
@@ -452,27 +452,31 @@ var Footer = function Footer(props) {
452
452
  // 区分loading, 是点击的checkout 还是save
453
453
  _setLoading = type === 'checkout' ? setCheckoutLoading : setLoading;
454
454
  _setLoading(true);
455
+ // 超时保护: 超过20秒自动关闭loading
456
+ loadingTimer = setTimeout(function () {
457
+ _setLoading(false);
458
+ }, 20000);
455
459
  _getApis = getApis(), createBooking = _getApis.createBooking, editBooking = _getApis.editBooking;
456
460
  editApi = state.renderType === 'eventBooking' ? editEventBooking : editBooking;
457
461
  createApi = state.renderType === 'eventBooking' ? createEventBooking : createBooking;
458
462
  saveOtherValue = {};
459
463
  if (!(type === 'save')) {
460
- _context4.next = 20;
464
+ _context4.next = 21;
461
465
  break;
462
466
  }
463
- _context4.next = 16;
467
+ _context4.next = 17;
464
468
  return state === null || state === void 0 || (_state$onSave = state.onSave) === null || _state$onSave === void 0 ? void 0 : _state$onSave.call(state, state.client);
465
- case 16:
469
+ case 17:
466
470
  _context4.t0 = _context4.sent;
467
471
  if (_context4.t0) {
468
- _context4.next = 19;
472
+ _context4.next = 20;
469
473
  break;
470
474
  }
471
475
  _context4.t0 = {};
472
- case 19:
473
- saveOtherValue = _context4.t0;
474
476
  case 20:
475
- _context4.prev = 20;
477
+ saveOtherValue = _context4.t0;
478
+ case 21:
479
+ _context4.prev = 21;
476
480
  callbackData = null; // 格式化提交的参数
477
481
  values = formatValues(_objectSpread(_objectSpread({}, state), saveOtherValue)); // 区分是新增还是编辑
478
482
  api = state.bookingId ? editApi : createApi; // 增加日志记录
@@ -528,43 +532,45 @@ var Footer = function Footer(props) {
528
532
 
529
533
  // 如果有addons改动, 则先保存
530
534
  if (!addonsEdit) {
531
- _context4.next = 28;
535
+ _context4.next = 29;
532
536
  break;
533
537
  }
534
- _context4.next = 28;
538
+ _context4.next = 29;
535
539
  return handleSaveAddons();
536
- case 28:
540
+ case 29:
537
541
  if (!infoEdit) {
538
- _context4.next = 33;
542
+ _context4.next = 34;
539
543
  break;
540
544
  }
541
- _context4.next = 31;
545
+ _context4.next = 32;
542
546
  return api(values, state.bookingId);
543
- case 31:
547
+ case 32:
544
548
  callbackData = _context4.sent;
545
549
  if (messageShow) {
546
550
  message.success(locales.getText(state.bookingId ? 'pisell2.text.appointment-updated' : 'pisell2.text.created-successfully'));
547
551
  }
548
- case 33:
552
+ case 34:
549
553
  // 回调关闭弹窗
550
554
  state === null || state === void 0 || state.callback(callbackData, type);
555
+ clearTimeout(loadingTimer);
551
556
  _setLoading(false);
552
557
 
553
558
  // return数据 checkout时需要
554
559
  return _context4.abrupt("return", callbackData || values);
555
- case 38:
556
- _context4.prev = 38;
557
- _context4.t1 = _context4["catch"](20);
560
+ case 40:
561
+ _context4.prev = 40;
562
+ _context4.t1 = _context4["catch"](21);
558
563
  console.log(_context4.t1);
559
564
  if ((_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.code) === 70101) {
560
565
  message.error(_context4.t1 === null || _context4.t1 === void 0 ? void 0 : _context4.t1.message);
561
566
  }
567
+ clearTimeout(loadingTimer);
562
568
  _setLoading(false);
563
- case 43:
569
+ case 46:
564
570
  case "end":
565
571
  return _context4.stop();
566
572
  }
567
- }, _callee4, null, [[20, 38]]);
573
+ }, _callee4, null, [[21, 40]]);
568
574
  }));
569
575
  return function handleSave(_x2) {
570
576
  return _ref5.apply(this, arguments);
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { EditServiceRef } from "../service/editService";
2
3
  declare const useInfoHolder: (state: any, dispatch: any) => {
3
4
  detailRef: import("react").MutableRefObject<EditServiceRef | undefined>;
@@ -166,10 +166,10 @@ export declare const getProductTotalPrice: (item: any) => number;
166
166
  export declare const getDuration: (duration: number | {
167
167
  type: string;
168
168
  value: number;
169
- }) => number | "flexible" | {
169
+ }) => number | {
170
170
  type: string;
171
171
  value: number;
172
- };
172
+ } | "flexible";
173
173
  export declare const isWalkIn: (customer_id?: number | string) => boolean;
174
174
  export declare const getIsEdit: (state: any) => boolean;
175
175
  export {};
@@ -12,24 +12,24 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { useState } from 'react';
14
14
  import useEngineContext, { usePlatform } from "../../hooks/useEngineContext";
15
+ import useLocale from "../../hooks/useLocale";
15
16
  import scanListener from "./utils/scanListener";
16
17
 
17
18
  /**
18
19
  * 获取当前语言
19
20
  */
20
21
  export var useLanguage = function useLanguage() {
21
- var _context$appHelper;
22
- var context = useEngineContext();
23
- return (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';
22
+ var locale = useLocale();
23
+ return locale || 'en';
24
24
  };
25
25
 
26
26
  /**
27
27
  * 扫码监听
28
28
  */
29
29
  export var useScanListener = function useScanListener() {
30
- var _context$appHelper2;
30
+ var _context$appHelper;
31
31
  var context = useEngineContext();
32
- var _ref = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {},
32
+ var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
33
33
  interaction = _ref.interaction;
34
34
  var addListener = function addListener(key, callback) {
35
35
  scanListener.addListener(interaction, key, callback);
@@ -51,9 +51,9 @@ export var useScanListener = function useScanListener() {
51
51
  * 获取app
52
52
  */
53
53
  export var useGetApp = function useGetApp() {
54
- var _context$appHelper3;
54
+ var _context$appHelper2;
55
55
  var context = useEngineContext();
56
- return (_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.utils) === null || _context$appHelper3 === void 0 ? void 0 : _context$appHelper3.getApp;
56
+ return (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 || (_context$appHelper2 = _context$appHelper2.utils) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.getApp;
57
57
  };
58
58
 
59
59
  /**
@@ -95,9 +95,9 @@ export var useModal = function useModal(key) {
95
95
  };
96
96
  };
97
97
  export var useRequest = function useRequest() {
98
- var _context$appHelper4;
98
+ var _context$appHelper3;
99
99
  var context = useEngineContext();
100
- var request = (context === null || context === void 0 || (_context$appHelper4 = context.appHelper) === null || _context$appHelper4 === void 0 || (_context$appHelper4 = _context$appHelper4.utils) === null || _context$appHelper4 === void 0 ? void 0 : _context$appHelper4.request) || {};
100
+ var request = (context === null || context === void 0 || (_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.utils) === null || _context$appHelper3 === void 0 ? void 0 : _context$appHelper3.request) || {};
101
101
  var get = function get(url, data, config) {
102
102
  return request === null || request === void 0 ? void 0 : request.get(url, data, config);
103
103
  };
@@ -137,9 +137,9 @@ export var useGetGoalShopInfo = function useGetGoalShopInfo() {
137
137
  * 获取当前店铺id
138
138
  */
139
139
  export var useGetShopId = function useGetShopId() {
140
- var _context$appHelper5, _utils$getStore, _utils$getStore$getSt, _utils$getData, _utils$store, _utils$store$getState;
140
+ var _context$appHelper4, _utils$getStore, _utils$getStore$getSt, _utils$getData, _utils$store, _utils$store$getState;
141
141
  var context = useEngineContext();
142
- var utils = (context === null || context === void 0 || (_context$appHelper5 = context.appHelper) === null || _context$appHelper5 === void 0 ? void 0 : _context$appHelper5.utils) || {};
142
+ var utils = (context === null || context === void 0 || (_context$appHelper4 = context.appHelper) === null || _context$appHelper4 === void 0 ? void 0 : _context$appHelper4.utils) || {};
143
143
  var shopId = (utils === null || utils === void 0 || (_utils$getStore = utils.getStore) === null || _utils$getStore === void 0 || (_utils$getStore = _utils$getStore.call(utils)) === null || _utils$getStore === void 0 || (_utils$getStore$getSt = _utils$getStore.getState) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.call(_utils$getStore)) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.shop) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.id) || (utils === null || utils === void 0 || (_utils$getData = utils.getData) === null || _utils$getData === void 0 ? void 0 : _utils$getData.call(utils, 'shop_id')) || ((_utils$store = utils.store) === null || _utils$store === void 0 || (_utils$store$getState = _utils$store.getState) === null || _utils$store$getState === void 0 || (_utils$store$getState = _utils$store$getState.call(_utils$store)) === null || _utils$store$getState === void 0 || (_utils$store$getState = _utils$store$getState.global) === null || _utils$store$getState === void 0 || (_utils$store$getState = _utils$store$getState.globalConfig) === null || _utils$store$getState === void 0 ? void 0 : _utils$store$getState.id) || undefined;
144
144
  return shopId;
145
145
  };
@@ -9,7 +9,7 @@ import { PosProps } from './const';
9
9
  */
10
10
  declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
11
11
  className?: string | undefined;
12
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
12
+ onChange?: ((status: "page" | "success" | "fail" | "print" | "mark_tx_processed", params?: string | {
13
13
  [keys: string]: unknown;
14
14
  } | undefined, other?: any) => void) | undefined;
15
15
  onClose: () => void;
@@ -11,7 +11,7 @@ import './device.less';
11
11
  declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
12
12
  api: PayProps['api'];
13
13
  className?: string | undefined;
14
- onChange?: ((status: "success" | "page" | "print" | "fail" | "mark_tx_processed", params?: string | {
14
+ onChange?: ((status: "page" | "success" | "fail" | "print" | "mark_tx_processed", params?: string | {
15
15
  [keys: string]: unknown;
16
16
  } | undefined, other?: any) => void) | undefined;
17
17
  onClose: () => void;
@@ -15,11 +15,11 @@ export declare const useStoreRef: <T extends {
15
15
  readonly numRef: React.MutableRefObject<string | number | undefined>;
16
16
  readonly orderIdRef: React.MutableRefObject<string | number>;
17
17
  readonly modeRef: React.MutableRefObject<ModeEnum>;
18
- readonly statusRef: React.MutableRefObject<"warn" | "success" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question">;
18
+ readonly statusRef: React.MutableRefObject<"loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question">;
19
19
  readonly netRef: React.MutableRefObject<boolean | undefined>;
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
- readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly">;
22
+ readonly eftposRef: React.MutableRefObject<"payo" | "tyro" | "windcave" | "stripe" | "linkly">;
23
23
  readonly clientRef: React.MutableRefObject<ClientEnum>;
24
24
  readonly dataRef: React.MutableRefObject<import("./store").State>;
25
25
  };
@@ -174,7 +174,7 @@ export declare const updateCustom: (payload: {
174
174
  export declare const updateStatus: (status: 'loading' | 'warn' | 'fail' | 'success' | 'question') => {
175
175
  type: EActionTypes;
176
176
  payload: {
177
- status: "warn" | "success" | "loading" | "fail" | "question";
177
+ status: "loading" | "success" | "warn" | "fail" | "question";
178
178
  };
179
179
  };
180
180
  /**
@@ -295,10 +295,10 @@ export declare const backUpFree: (payload: Partial<State>) => {
295
295
  name?: string | undefined;
296
296
  symbol?: string | undefined;
297
297
  amount?: string | number | undefined;
298
- mode?: "refund" | "pay" | "fullPay" | "query" | undefined;
298
+ mode?: "pay" | "fullPay" | "refund" | "query" | undefined;
299
299
  order_id?: string | number | undefined;
300
- eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | undefined;
301
- action?: "amount" | "pay" | "deviceList" | undefined;
300
+ eftpos?: "payo" | "tyro" | "windcave" | "stripe" | "linkly" | undefined;
301
+ action?: "pay" | "amount" | "deviceList" | undefined;
302
302
  key?: number | undefined;
303
303
  step?: number | undefined;
304
304
  title?: string | undefined;
@@ -308,7 +308,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
308
308
  net?: boolean | undefined;
309
309
  component?: string | undefined;
310
310
  form?: string | undefined;
311
- status?: "warn" | "success" | "loading" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
311
+ status?: "loading" | "success" | "warn" | "fail" | "pedding" | "resove" | "reject" | "question" | undefined;
312
312
  warn?: string | undefined;
313
313
  steps?: {
314
314
  /** 用于重置当前步骤 */
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type CallToBookProps = {
2
3
  show: boolean;
3
4
  type: string;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const StripePayment: () => import("react").JSX.Element;
2
3
  export default StripePayment;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const PageLoading: () => import("react").JSX.Element;
2
3
  export default PageLoading;
@@ -1,7 +1,14 @@
1
1
  import useEngineContext from "./useEngineContext";
2
2
  var useLocale = function useLocale() {
3
- var _context$engine;
3
+ var _context$appHelper, _app$locales, _context$engine;
4
4
  var context = useEngineContext();
5
+ var _ref = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
6
+ getApp = _ref.getApp;
7
+ var app = getApp && (getApp === null || getApp === void 0 ? void 0 : getApp()) || {};
8
+ if (app !== null && app !== void 0 && (_app$locales = app.locales) !== null && _app$locales !== void 0 && _app$locales.getLocale) {
9
+ var _app$locales2, _app$locales2$getLoca;
10
+ return app === null || app === void 0 || (_app$locales2 = app.locales) === null || _app$locales2 === void 0 || (_app$locales2$getLoca = _app$locales2.getLocale) === null || _app$locales2$getLoca === void 0 ? void 0 : _app$locales2$getLoca.call(_app$locales2);
11
+ }
5
12
  return (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en';
6
13
  };
7
14
  export default useLocale;
@@ -0,0 +1,7 @@
1
+ declare type ThemeInput = {
2
+ token?: {
3
+ colorPrimary?: string;
4
+ };
5
+ };
6
+ declare const useThemeTokens: (themeInput?: ThemeInput) => any;
7
+ export default useThemeTokens;
@@ -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;
@@ -3,6 +3,6 @@ export interface ImageUploadProps {
3
3
  value?: string;
4
4
  onChange?: (val: string) => void;
5
5
  }
6
- export declare const getBaseTime: (size: number) => 2000 | 1000 | 4000 | 8000;
6
+ export declare const getBaseTime: (size: number) => 1000 | 2000 | 4000 | 8000;
7
7
  declare const ImageUpload: React.FC<ImageUploadProps>;
8
8
  export default ImageUpload;
@@ -1,9 +1,14 @@
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
7
  import { image as imageAli, locales } from '@pisell/utils';
4
8
  import classNames from 'classnames';
5
9
  import useEngineContext from "../../../../hooks/useEngineContext";
6
10
  import localeTexts from "./locales";
11
+ import useThemeTokens from "../../../../hooks/useThemeTokens";
7
12
  import "./index.less";
8
13
  var SKUCard = function SKUCard(_ref) {
9
14
  var _context$appHelper, _skuCardConfig$title, _skuCardConfig$subTit, _skuCardConfig$price, _skuCardConfig$image, _skuCardConfig$disabl, _skuCardConfig$disabl2;
@@ -17,7 +22,11 @@ var SKUCard = function SKUCard(_ref) {
17
22
  _onClick = _ref.onClick,
18
23
  renderRight = _ref.renderRight,
19
24
  skuCardConfig = _ref.skuCardConfig,
20
- skuDisabled = _ref.skuDisabled;
25
+ skuDisabled = _ref.skuDisabled,
26
+ theme = _ref.theme;
27
+ var _useThemeTokens = useThemeTokens(theme),
28
+ colorPrimary = _useThemeTokens.colorPrimary,
29
+ colorPrimaryBg = _useThemeTokens.colorPrimaryBg;
21
30
  var context = useEngineContext();
22
31
  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';
23
32
  locales.init(localeTexts, language);
@@ -170,9 +179,9 @@ var SKUCard = function SKUCard(_ref) {
170
179
  if (disabled) return;
171
180
  _onClick === null || _onClick === void 0 || _onClick();
172
181
  },
173
- style: {
182
+ style: _defineProperty(_defineProperty({
174
183
  cursor: disabled ? 'not-allowed' : 'pointer'
175
- }
184
+ }, '--color-primary', colorPrimary), '--color-primary-bg', colorPrimaryBg)
176
185
  }, !!skuDisabled && !!showDisabledText && /*#__PURE__*/React.createElement("div", {
177
186
  className: "pisell-pro-cards-sku-card-disabled-mask"
178
187
  }, /*#__PURE__*/React.createElement("div", {
@@ -39,8 +39,8 @@
39
39
  }
40
40
 
41
41
  &-active {
42
- border: 1px solid #7f56d9;
43
- background: #fcfaff;
42
+ border: 1px solid var(--color-primary, #5d3f9f);
43
+ background: var(--color-primary-bg, #fcfaff);
44
44
  }
45
45
 
46
46
  &-disabled {
@@ -65,4 +65,9 @@ export interface SKUCardProps {
65
65
  skuCardConfig?: SkuCardConfig;
66
66
  /** SKU 是否禁用 */
67
67
  skuDisabled?: boolean;
68
+ theme?: {
69
+ token?: {
70
+ colorPrimary?: string;
71
+ };
72
+ };
68
73
  }
@@ -30,6 +30,11 @@ export interface NumericStepperProps {
30
30
  onChange?: (value: number) => void;
31
31
  /** 自定义类名 */
32
32
  className?: string;
33
+ theme?: {
34
+ token?: {
35
+ colorPrimary?: string;
36
+ };
37
+ };
33
38
  /** 自定义样式 */
34
39
  styles?: {
35
40
  container?: React.CSSProperties;
@@ -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
  }
@@ -1,7 +1,5 @@
1
1
  // ========== 变量定义 ==========
2
- @primary-color: #7f56d9;
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
 
@@ -35,13 +35,6 @@ var dataSource = [{
35
35
  title: '披萨',
36
36
  value: 'pizza'
37
37
  }],
38
- grid: {
39
- columns: 2,
40
- gutter: 16,
41
- colConfig: {
42
- span: 3
43
- }
44
- },
45
38
  ruleConfig: {
46
39
  required: 1,
47
40
  autoValidate: true
@@ -120,10 +113,6 @@ var dataSource = [{
120
113
  value: 'extra-onion',
121
114
  cover: 'https://file.mypisell-dev.com/pisel/image/9/52fe9ca4233877f2c06865d27b9fb7912022_12_01_13_32_47_147_00076174656__1080_1073__.jpeg'
122
115
  }],
123
- grid: {
124
- columns: 3,
125
- gutter: 16
126
- },
127
116
  variant: 'card',
128
117
  itemProps: {
129
118
  layout: 'vertical',
@@ -299,7 +288,8 @@ export var BatchSelectorDemo = function BatchSelectorDemo() {
299
288
  padding: '0',
300
289
  margin: '0 auto',
301
290
  height: '100vh',
302
- overflow: 'auto'
291
+ overflow: 'auto',
292
+ '--theme-color': '#5d3f9f'
303
293
  },
304
294
  ref: containerRef
305
295
  }, /*#__PURE__*/React.createElement(Title, {
@@ -3,7 +3,7 @@ import { ItemLayout, ItemProps, PresetConfig, SelectorProps, SelectorVariant } f
3
3
  import './selector.less';
4
4
  export declare const SelectorContext: React.Context<{
5
5
  disabled?: boolean | undefined;
6
- mode?: "multiple" | "single" | undefined;
6
+ mode?: "single" | "multiple" | undefined;
7
7
  itemLayout?: ItemLayout | undefined;
8
8
  valueType?: "object" | "primitive" | undefined;
9
9
  variant?: SelectorVariant | undefined;
@@ -10,7 +10,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
10
10
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
12
  import React, { useEffect, useImperativeHandle, forwardRef } from 'react';
13
- import { Row, Col, Tag, Select } from 'antd';
13
+ import { Tag, Select } from 'antd';
14
14
  import classNames from 'classnames';
15
15
  import { CheckCircleOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
16
16
  // @ts-ignore
@@ -22,10 +22,9 @@ import NumericStepper from "../NumericStepper";
22
22
  import useSelectionController from "./hooks/useSelectionController";
23
23
  import usePresetProps from "./hooks/usePresetProps";
24
24
  import useEngineContext from "../../hooks/useEngineContext";
25
+ import useThemeTokens from "../../hooks/useThemeTokens";
25
26
  import Item from "./Item";
26
27
  import "./selector.less";
27
- var ARow = Row;
28
- var ACol = Col;
29
28
  var ATag = Tag;
30
29
  export var SelectorContext = /*#__PURE__*/React.createContext({
31
30
  disabled: false,
@@ -55,6 +54,9 @@ var Selector = /*#__PURE__*/forwardRef(function (props, ref) {
55
54
  valueType = _props$valueType === void 0 ? 'primitive' : _props$valueType,
56
55
  _props$variant = props.variant,
57
56
  variant = _props$variant === void 0 ? 'default' : _props$variant;
57
+ var _useThemeTokens = useThemeTokens(props.theme),
58
+ colorPrimary = _useThemeTokens.colorPrimary,
59
+ colorPrimaryBg = _useThemeTokens.colorPrimaryBg;
58
60
  var context = useEngineContext();
59
61
  locales.init(localeTexts, (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');
60
62
  var _useSelectionControll = useSelectionController(props),
@@ -322,7 +324,7 @@ var Selector = /*#__PURE__*/forwardRef(function (props, ref) {
322
324
  return /*#__PURE__*/React.createElement("div", {
323
325
  id: "pisell-pro-selector-".concat(props.id),
324
326
  className: classNames('pisell-pro-selector', props.className),
325
- style: props.style
327
+ style: _objectSpread(_objectSpread({}, props.style || {}), {}, _defineProperty(_defineProperty({}, '--color-primary', colorPrimary), '--color-primary-bg', colorPrimaryBg))
326
328
  }, renderHeader(), /*#__PURE__*/React.createElement(SelectorContext.Provider, {
327
329
  value: {
328
330
  mode: mode,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SelectionValue, SelectorGroupProps } from './types';
2
+ import type { SelectionValue, SelectorGroupProps } from './types';
3
3
  import './selectorGroup.less';
4
4
  export declare type SelectorGroupRef = {
5
5
  getValues: (includeHidden?: boolean) => Record<string, SelectionValue>;
@@ -27,6 +27,7 @@ import { isEqual } from 'lodash';
27
27
  import { locales } from '@pisell/utils';
28
28
  import localeTexts from "./locales";
29
29
  import useEngineContext from "../../hooks/useEngineContext";
30
+ import useThemeTokens from "../../hooks/useThemeTokens";
30
31
  import Selector from "./Selector";
31
32
  import { normalizeRules, computeAutoHiddenGroups, computeEffects, getSelectedSet, pruneValuesByAllowOnly, generateSimpleUUID } from "./utils";
32
33
  import { IntersectionObserverProvider, IntersectionItem } from "./components/IntersectionObserver";
@@ -44,6 +45,9 @@ var SelectorGroup = /*#__PURE__*/forwardRef(function (props, ref) {
44
45
  _props$preserve = props.preserve,
45
46
  preserveDefault = _props$preserve === void 0 ? false : _props$preserve,
46
47
  style = props.style;
48
+ var _useThemeTokens = useThemeTokens(props.theme),
49
+ colorPrimary = _useThemeTokens.colorPrimary,
50
+ colorPrimaryBg = _useThemeTokens.colorPrimaryBg;
47
51
  var _useState = useState(-1),
48
52
  _useState2 = _slicedToArray(_useState, 2),
49
53
  activeIndex = _useState2[0],
@@ -556,7 +560,7 @@ var SelectorGroup = /*#__PURE__*/forwardRef(function (props, ref) {
556
560
  return /*#__PURE__*/React.createElement("div", {
557
561
  className: classNames('pisell-batch-selector', "pisell-batch-selector-".concat(_uniqueId)),
558
562
  ref: containerRef,
559
- style: style
563
+ style: _objectSpread(_objectSpread({}, style || {}), {}, _defineProperty(_defineProperty({}, '--color-primary', colorPrimary), '--color-primary-bg', colorPrimaryBg))
560
564
  }, renderTabs(), /*#__PURE__*/React.createElement(IntersectionObserverProvider, {
561
565
  rootMargin: "-70px 0px 0px 0px",
562
566
  disabled: ((_props$tabProps2 = props.tabProps) === null || _props$tabProps2 === void 0 ? void 0 : _props$tabProps2.visible) === false,
@@ -33,13 +33,15 @@ var Card = function Card(_ref) {
33
33
  className = _ref.className,
34
34
  style = _ref.style;
35
35
  // 样式属性对象,用于传递给样式函数
36
- var styleProps = {
37
- selected: selected,
38
- disabled: disabled,
39
- hoverable: hoverable,
40
- variant: variant,
41
- layout: layout
42
- };
36
+ var styleProps = useMemo(function () {
37
+ return {
38
+ selected: selected,
39
+ disabled: disabled,
40
+ hoverable: hoverable,
41
+ variant: variant,
42
+ layout: layout
43
+ };
44
+ }, [selected, disabled, hoverable, variant, layout]);
43
45
 
44
46
  // 计算容器样式
45
47
  var containerStyle = useMemo(function () {