@pisell/private-materials 3.4.16 → 3.4.18

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 (211) 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 +1 -1
  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 +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/appointmentBooking/components/Content/index.js +1 -1
  12. package/es/components/appointmentBooking/components/Content/index.less +3 -3
  13. package/es/components/appointmentBooking/components/Services/index.js +2 -2
  14. package/es/components/appointmentBooking/index.js +8 -2
  15. package/es/components/booking/info2/service/addTimeModal/index.js +0 -1
  16. package/es/components/booking/utils.d.ts +2 -2
  17. package/es/components/eftposPay/hooks.d.ts +1 -1
  18. package/es/components/eftposPay/store/index.d.ts +2 -2
  19. package/es/components/eventBooking/index.js +8 -1
  20. package/es/components/ticketBooking/components/addServiceVariant/addService.js +3 -3
  21. package/es/hooks/useWindowSize.js +8 -1
  22. package/es/index.d.ts +3 -0
  23. package/es/index.js +4 -1
  24. package/es/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
  25. package/es/plus/productSelect/CategoryTabs/CategorySkeleton.js +29 -0
  26. package/es/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
  27. package/es/plus/productSelect/CategoryTabs/index.d.ts +18 -0
  28. package/es/plus/productSelect/CategoryTabs/index.js +171 -0
  29. package/es/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
  30. package/es/plus/productSelect/ProductCard/ProductCardSkeleton.js +37 -0
  31. package/es/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
  32. package/es/plus/productSelect/ProductCard/index.d.ts +45 -0
  33. package/es/plus/productSelect/ProductCard/index.js +170 -0
  34. package/es/plus/productSelect/ProductCard/index.less +253 -0
  35. package/es/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
  36. package/es/plus/productSelect/ProductList/gridComponents.js +149 -0
  37. package/es/plus/productSelect/ProductList/index.d.ts +22 -0
  38. package/es/plus/productSelect/ProductList/index.js +72 -0
  39. package/es/plus/productSelect/ProductList/index.less +0 -0
  40. package/es/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
  41. package/es/plus/productSelect/components/IntersectionObserver.js +276 -0
  42. package/es/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
  43. package/es/plus/productSelect/components/TabsStructure/TabsStructure.js +357 -0
  44. package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
  45. package/es/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
  46. package/es/plus/productSelect/components/TabsStructure/hooks.js +243 -0
  47. package/es/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
  48. package/es/plus/productSelect/components/TabsStructure/index.js +13 -0
  49. package/es/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
  50. package/es/plus/productSelect/components/TabsStructure/styles.js +87 -0
  51. package/es/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
  52. package/es/plus/productSelect/components/TabsStructure/types.js +1 -0
  53. package/es/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
  54. package/es/plus/productSelect/components/TabsStructure/utils.js +56 -0
  55. package/es/plus/productSelect/components/pisellPriceText/index.d.ts +12 -0
  56. package/es/plus/productSelect/components/pisellPriceText/index.js +44 -0
  57. package/es/plus/productSelect/components/pisellPriceText/index.less +4 -0
  58. package/es/plus/productSelect/hooks/useToken.d.ts +18 -0
  59. package/es/plus/productSelect/hooks/useToken.js +34 -0
  60. package/es/plus/productSelect/index.d.ts +31 -0
  61. package/es/plus/productSelect/index.js +270 -0
  62. package/es/plus/productSelect/index.less +56 -0
  63. package/es/plus/productSelect/locales.d.ts +18 -0
  64. package/es/plus/productSelect/locales.js +17 -0
  65. package/es/plus/productSelect/theme/token.d.ts +17 -0
  66. package/es/plus/productSelect/theme/token.js +19 -0
  67. package/es/plus/productSelect/utils.d.ts +39 -0
  68. package/es/plus/productSelect/utils.js +162 -0
  69. package/es/plus/saasCreateOrganization/components/Header.d.ts +3 -0
  70. package/es/plus/saasCreateOrganization/components/Header.js +62 -0
  71. package/es/plus/saasCreateOrganization/index.d.ts +4 -0
  72. package/es/plus/saasCreateOrganization/index.js +15 -0
  73. package/es/plus/saasCreateOrganization/index.less +55 -0
  74. package/es/plus/saasCreateOrganization/locales.d.ts +15 -0
  75. package/es/plus/saasCreateOrganization/locales.js +14 -0
  76. package/es/plus/saasCreateOrganization/types.d.ts +69 -0
  77. package/es/plus/saasCreateOrganization/types.js +1 -0
  78. package/es/plus/saasLogin/index.d.ts +5 -0
  79. package/es/plus/saasLogin/index.js +165 -0
  80. package/es/plus/saasLogin/index.less +136 -0
  81. package/es/plus/saasLogin/locales.d.ts +51 -0
  82. package/es/plus/saasLogin/locales.js +50 -0
  83. package/es/plus/saasLogin/types.d.ts +62 -0
  84. package/es/plus/saasLogin/types.js +1 -0
  85. package/es/plus/saasLogin/utils.d.ts +35 -0
  86. package/es/plus/saasLogin/utils.js +31 -0
  87. package/es/plus/saasRegister/components/EntryEmail.d.ts +9 -0
  88. package/es/plus/saasRegister/components/EntryEmail.js +92 -0
  89. package/es/plus/saasRegister/components/EntryInfo.d.ts +9 -0
  90. package/es/plus/saasRegister/components/EntryInfo.js +145 -0
  91. package/es/plus/saasRegister/components/GoLogin.d.ts +4 -0
  92. package/es/plus/saasRegister/components/GoLogin.js +27 -0
  93. package/es/plus/saasRegister/components/Header.d.ts +3 -0
  94. package/es/plus/saasRegister/components/Header.js +62 -0
  95. package/es/plus/saasRegister/components/VerifyError.d.ts +8 -0
  96. package/es/plus/saasRegister/components/VerifyError.js +68 -0
  97. package/es/plus/saasRegister/components/VerifyingLink.d.ts +5 -0
  98. package/es/plus/saasRegister/components/VerifyingLink.js +16 -0
  99. package/es/plus/saasRegister/components/VertifyEmail.d.ts +7 -0
  100. package/es/plus/saasRegister/components/VertifyEmail.js +121 -0
  101. package/es/plus/saasRegister/index.d.ts +5 -0
  102. package/es/plus/saasRegister/index.js +246 -0
  103. package/es/plus/saasRegister/index.less +218 -0
  104. package/es/plus/saasRegister/locales.d.ts +117 -0
  105. package/es/plus/saasRegister/locales.js +116 -0
  106. package/es/plus/saasRegister/types.d.ts +114 -0
  107. package/es/plus/saasRegister/types.js +24 -0
  108. package/lib/components/appointmentBooking/components/Content/index.js +1 -1
  109. package/lib/components/appointmentBooking/components/Content/index.less +3 -3
  110. package/lib/components/appointmentBooking/components/Services/index.js +2 -2
  111. package/lib/components/appointmentBooking/index.js +6 -1
  112. package/lib/components/booking/info2/service/addTimeModal/index.js +0 -1
  113. package/lib/components/booking/utils.d.ts +2 -2
  114. package/lib/components/eftposPay/hooks.d.ts +1 -1
  115. package/lib/components/eftposPay/store/index.d.ts +2 -2
  116. package/lib/components/eventBooking/index.js +6 -1
  117. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +3 -3
  118. package/lib/hooks/useWindowSize.js +6 -1
  119. package/lib/index.d.ts +3 -0
  120. package/lib/index.js +9 -0
  121. package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.d.ts +10 -0
  122. package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.js +62 -0
  123. package/lib/plus/productSelect/CategoryTabs/CategorySkeleton.less +30 -0
  124. package/lib/plus/productSelect/CategoryTabs/index.d.ts +18 -0
  125. package/lib/plus/productSelect/CategoryTabs/index.js +183 -0
  126. package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.d.ts +10 -0
  127. package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.js +58 -0
  128. package/lib/plus/productSelect/ProductCard/ProductCardSkeleton.less +81 -0
  129. package/lib/plus/productSelect/ProductCard/index.d.ts +45 -0
  130. package/lib/plus/productSelect/ProductCard/index.js +184 -0
  131. package/lib/plus/productSelect/ProductCard/index.less +253 -0
  132. package/lib/plus/productSelect/ProductList/gridComponents.d.ts +44 -0
  133. package/lib/plus/productSelect/ProductList/gridComponents.js +148 -0
  134. package/lib/plus/productSelect/ProductList/index.d.ts +22 -0
  135. package/lib/plus/productSelect/ProductList/index.js +86 -0
  136. package/lib/plus/productSelect/ProductList/index.less +0 -0
  137. package/lib/plus/productSelect/components/IntersectionObserver.d.ts +42 -0
  138. package/lib/plus/productSelect/components/IntersectionObserver.js +269 -0
  139. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.d.ts +30 -0
  140. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.js +393 -0
  141. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +224 -0
  142. package/lib/plus/productSelect/components/TabsStructure/hooks.d.ts +22 -0
  143. package/lib/plus/productSelect/components/TabsStructure/hooks.js +209 -0
  144. package/lib/plus/productSelect/components/TabsStructure/index.d.ts +5 -0
  145. package/lib/plus/productSelect/components/TabsStructure/index.js +92 -0
  146. package/lib/plus/productSelect/components/TabsStructure/styles.d.ts +47 -0
  147. package/lib/plus/productSelect/components/TabsStructure/styles.js +122 -0
  148. package/lib/plus/productSelect/components/TabsStructure/types.d.ts +105 -0
  149. package/lib/plus/productSelect/components/TabsStructure/types.js +17 -0
  150. package/lib/plus/productSelect/components/TabsStructure/utils.d.ts +12 -0
  151. package/lib/plus/productSelect/components/TabsStructure/utils.js +72 -0
  152. package/lib/plus/productSelect/components/pisellPriceText/index.d.ts +12 -0
  153. package/lib/plus/productSelect/components/pisellPriceText/index.js +73 -0
  154. package/lib/plus/productSelect/components/pisellPriceText/index.less +4 -0
  155. package/lib/plus/productSelect/hooks/useToken.d.ts +18 -0
  156. package/lib/plus/productSelect/hooks/useToken.js +50 -0
  157. package/lib/plus/productSelect/index.d.ts +31 -0
  158. package/lib/plus/productSelect/index.js +299 -0
  159. package/lib/plus/productSelect/index.less +56 -0
  160. package/lib/plus/productSelect/locales.d.ts +18 -0
  161. package/lib/plus/productSelect/locales.js +41 -0
  162. package/lib/plus/productSelect/theme/token.d.ts +17 -0
  163. package/lib/plus/productSelect/theme/token.js +47 -0
  164. package/lib/plus/productSelect/utils.d.ts +39 -0
  165. package/lib/plus/productSelect/utils.js +138 -0
  166. package/lib/plus/saasCreateOrganization/components/Header.d.ts +3 -0
  167. package/lib/plus/saasCreateOrganization/components/Header.js +99 -0
  168. package/lib/plus/saasCreateOrganization/index.d.ts +4 -0
  169. package/lib/plus/saasCreateOrganization/index.js +47 -0
  170. package/lib/plus/saasCreateOrganization/index.less +55 -0
  171. package/lib/plus/saasCreateOrganization/locales.d.ts +15 -0
  172. package/lib/plus/saasCreateOrganization/locales.js +38 -0
  173. package/lib/plus/saasCreateOrganization/types.d.ts +69 -0
  174. package/lib/plus/saasCreateOrganization/types.js +17 -0
  175. package/lib/plus/saasLogin/index.d.ts +5 -0
  176. package/lib/plus/saasLogin/index.js +171 -0
  177. package/lib/plus/saasLogin/index.less +136 -0
  178. package/lib/plus/saasLogin/locales.d.ts +51 -0
  179. package/lib/plus/saasLogin/locales.js +74 -0
  180. package/lib/plus/saasLogin/types.d.ts +62 -0
  181. package/lib/plus/saasLogin/types.js +17 -0
  182. package/lib/plus/saasLogin/utils.d.ts +35 -0
  183. package/lib/plus/saasLogin/utils.js +50 -0
  184. package/lib/plus/saasRegister/components/EntryEmail.d.ts +9 -0
  185. package/lib/plus/saasRegister/components/EntryEmail.js +92 -0
  186. package/lib/plus/saasRegister/components/EntryInfo.d.ts +9 -0
  187. package/lib/plus/saasRegister/components/EntryInfo.js +128 -0
  188. package/lib/plus/saasRegister/components/GoLogin.d.ts +4 -0
  189. package/lib/plus/saasRegister/components/GoLogin.js +58 -0
  190. package/lib/plus/saasRegister/components/Header.d.ts +3 -0
  191. package/lib/plus/saasRegister/components/Header.js +99 -0
  192. package/lib/plus/saasRegister/components/VerifyError.d.ts +8 -0
  193. package/lib/plus/saasRegister/components/VerifyError.js +123 -0
  194. package/lib/plus/saasRegister/components/VerifyingLink.d.ts +5 -0
  195. package/lib/plus/saasRegister/components/VerifyingLink.js +44 -0
  196. package/lib/plus/saasRegister/components/VertifyEmail.d.ts +7 -0
  197. package/lib/plus/saasRegister/components/VertifyEmail.js +110 -0
  198. package/lib/plus/saasRegister/index.d.ts +5 -0
  199. package/lib/plus/saasRegister/index.js +205 -0
  200. package/lib/plus/saasRegister/index.less +218 -0
  201. package/lib/plus/saasRegister/locales.d.ts +117 -0
  202. package/lib/plus/saasRegister/locales.js +140 -0
  203. package/lib/plus/saasRegister/types.d.ts +114 -0
  204. package/lib/plus/saasRegister/types.js +54 -0
  205. package/lowcode/saas-create-organization/meta.ts +214 -0
  206. package/lowcode/saas-create-organization/snippets.ts +25 -0
  207. package/lowcode/saas-login/meta.ts +370 -0
  208. package/lowcode/saas-login/snippets.ts +38 -0
  209. package/lowcode/saas-register/meta.ts +386 -0
  210. package/lowcode/saas-register/snippets.ts +31 -0
  211. package/package.json +2 -2
@@ -0,0 +1,34 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ 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; }
9
+ 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; }
10
+ 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; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ 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
+ import { useMemo } from 'react';
14
+ import { defaultToken } from "../theme/token";
15
+ export function useToken(customToken) {
16
+ return useMemo(function () {
17
+ // 预留 context 获取逻辑的位置
18
+ var contextToken = null;
19
+ return _objectSpread(_objectSpread(_objectSpread({}, defaultToken), contextToken || {}), customToken || {});
20
+ }, [customToken]);
21
+ }
22
+ export function genCSSVars(token) {
23
+ var cssVars = {};
24
+ Object.entries(token).forEach(function (_ref) {
25
+ var _ref2 = _slicedToArray(_ref, 2),
26
+ key = _ref2[0],
27
+ value = _ref2[1];
28
+ var cssKey = "--ps-".concat(key.replace(/[A-Z]/g, function (m) {
29
+ return "-".concat(m.toLowerCase());
30
+ }));
31
+ cssVars[cssKey] = value;
32
+ });
33
+ return cssVars;
34
+ }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface ProductSelectProps {
4
+ dataSource: any[];
5
+ showSearch?: boolean;
6
+ showTab?: boolean;
7
+ layout?: {
8
+ grid: boolean;
9
+ config: string;
10
+ };
11
+ onChange: (value: any) => void;
12
+ value?: number;
13
+ loading?: boolean;
14
+ style?: React.CSSProperties;
15
+ emptyDescription?: string;
16
+ /** 当前滚动元素 */
17
+ scrollDom?: string;
18
+ /** 商品列表上方的其它组件 */
19
+ offsetDom?: any;
20
+ /** 样式变量 */
21
+ token?: Partial<any>;
22
+ /** 后台装修单选模式下的已选中项 */
23
+ selectedItems?: Array<any>;
24
+ /** 后台装修配置 */
25
+ productListSetting?: Partial<any>;
26
+ /** 兼容scrollDom */
27
+ customScrollParent?: HTMLElement | string;
28
+ }
29
+ export declare const PREFIX = "pisell-product-select";
30
+ declare const index: ({ dataSource, emptyDescription, showSearch, scrollDom, offsetDom, style, token: customToken, onChange, value, selectedItems, productListSetting, customScrollParent, loading, layout, ...rest }: ProductSelectProps) => JSX.Element;
31
+ export default index;
@@ -0,0 +1,270 @@
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
+ var _excluded = ["dataSource", "emptyDescription", "showSearch", "scrollDom", "offsetDom", "style", "token", "onChange", "value", "selectedItems", "productListSetting", "customScrollParent", "loading", "layout"];
3
+ 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; }
4
+ 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; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ 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; }
15
+ 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; }
16
+ import React, { useEffect, useCallback, useMemo, useRef, useState, useLayoutEffect } from 'react';
17
+ import classNames from 'classnames';
18
+ import { Input } from '@pisell/materials';
19
+ import { locales } from '@pisell/utils';
20
+ import SearchLg from '@pisell/icon/es/SearchLg';
21
+ import CategoryTabs, { CategorySkeleton } from "./CategoryTabs";
22
+ import ProductList, { createGridComponents } from "./ProductList";
23
+ import { useToken, genCSSVars } from "./hooks/useToken";
24
+ import { groupProductsByCategory, getElementByIdentifier, getOffsetTopRelativeToScrollContainer } from "./utils";
25
+ import IntersectionObserverProvider from "./components/IntersectionObserver";
26
+ import ProductCard, { ProductCardSkeleton } from "./ProductCard";
27
+ import localeTexts from "./locales";
28
+ import useEngineContext from "../../hooks/useEngineContext";
29
+ import { PisellEmpty } from '@pisell/materials';
30
+ import "./index.less";
31
+ // 虚假数据常量,用于loading状态
32
+ var MOCK_DATA = function () {
33
+ var mockData = [];
34
+ // 添加分类项
35
+ mockData.push({
36
+ __typename: 'category',
37
+ id: '_c1_1'
38
+ });
39
+ // 添加该分类下的商品
40
+ for (var productIndex = 0; productIndex < 4; productIndex++) {
41
+ mockData.push({
42
+ __typename: 'product',
43
+ id: '_pi' + productIndex
44
+ });
45
+ }
46
+ return mockData;
47
+ }();
48
+ export var PREFIX = 'pisell-product-select';
49
+ var CONTAINER_CLASS = "".concat(PREFIX, "-wrapper");
50
+ var index = function index(_ref) {
51
+ var _ref$dataSource = _ref.dataSource,
52
+ dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource,
53
+ emptyDescription = _ref.emptyDescription,
54
+ _ref$showSearch = _ref.showSearch,
55
+ showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
56
+ scrollDom = _ref.scrollDom,
57
+ offsetDom = _ref.offsetDom,
58
+ _ref$style = _ref.style,
59
+ style = _ref$style === void 0 ? {} : _ref$style,
60
+ customToken = _ref.token,
61
+ onChange = _ref.onChange,
62
+ value = _ref.value,
63
+ selectedItems = _ref.selectedItems,
64
+ _ref$productListSetti = _ref.productListSetting,
65
+ productListSetting = _ref$productListSetti === void 0 ? {} : _ref$productListSetti,
66
+ customScrollParent = _ref.customScrollParent,
67
+ _ref$loading = _ref.loading,
68
+ loading = _ref$loading === void 0 ? false : _ref$loading,
69
+ layout = _ref.layout,
70
+ rest = _objectWithoutProperties(_ref, _excluded);
71
+ var searchRef = useRef(null);
72
+ var _useState = useState(''),
73
+ _useState2 = _slicedToArray(_useState, 2),
74
+ keyword = _useState2[0],
75
+ setKeyword = _useState2[1];
76
+ var _useState3 = useState(''),
77
+ _useState4 = _slicedToArray(_useState3, 2),
78
+ activeKey = _useState4[0],
79
+ setActiveKey = _useState4[1];
80
+ var _useState5 = useState(null),
81
+ _useState6 = _slicedToArray(_useState5, 2),
82
+ scrollParent = _useState6[0],
83
+ setScrollParent = _useState6[1];
84
+ var isIndicatorVisibleRef = useRef(false);
85
+ var containerRef = useRef(null);
86
+ var _customScrollParent = customScrollParent || scrollDom;
87
+ var gridComponents = useMemo(function () {
88
+ return createGridComponents(layout);
89
+ }, [layout]);
90
+ var context = useEngineContext();
91
+ useEffect(function () {
92
+ var _context$appHelper$ut;
93
+ locales.init(localeTexts, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get('umi_locale')) || 'en');
94
+ }, []);
95
+ var _filteredList = useMemo(function () {
96
+ if (!keyword) return dataSource;
97
+ return dataSource.filter(function (product) {
98
+ if (typeof (product === null || product === void 0 ? void 0 : product.title) !== 'string') return false;
99
+ return product.title.toLowerCase().indexOf(keyword.toLowerCase()) !== -1;
100
+ });
101
+ }, [keyword, dataSource]);
102
+ var _groupedList = useMemo(function () {
103
+ var _list = _filteredList || [];
104
+ return groupProductsByCategory(_list);
105
+ }, [_filteredList]);
106
+ var _categories = useMemo(function () {
107
+ return _groupedList.filter(function (item) {
108
+ return item.__typename === 'category';
109
+ }).map(function (item) {
110
+ return _objectSpread(_objectSpread({}, item), {}, {
111
+ key: String(item.id),
112
+ label: item.name
113
+ });
114
+ });
115
+ }, [_groupedList]);
116
+ useEffect(function () {
117
+ if (!(_categories !== null && _categories !== void 0 && _categories.length)) {
118
+ setActiveKey('');
119
+ return;
120
+ }
121
+ if (!activeKey) {
122
+ switchCategory(_categories[0].key);
123
+ } else {
124
+ var found = _categories.find(function (category) {
125
+ return category.key === activeKey;
126
+ });
127
+ if (!found) switchCategory(_categories[0].key);
128
+ }
129
+ }, [_categories]);
130
+ useLayoutEffect(function () {
131
+ if (_customScrollParent) {
132
+ var sp = getElementByIdentifier(_customScrollParent);
133
+ setScrollParent(sp);
134
+ }
135
+ }, [_customScrollParent]);
136
+ var token = useToken(customToken);
137
+ var cssVars = useMemo(function () {
138
+ return genCSSVars(token);
139
+ }, [token]);
140
+ var mergedStyle = useMemo(function () {
141
+ var baseStyle = _objectSpread(_objectSpread({}, cssVars), style);
142
+ if (!scrollParent) return baseStyle;
143
+ if (scrollParent !== containerRef.current) {
144
+ return _objectSpread(_objectSpread({}, baseStyle), {}, {
145
+ overflow: 'unset',
146
+ height: 'unset'
147
+ });
148
+ }
149
+ return baseStyle;
150
+ }, [cssVars, style, scrollParent]);
151
+ var disabled = useMemo(function () {
152
+ return !!(productListSetting !== null && productListSetting !== void 0 && productListSetting.list_max_length) && Array.isArray(selectedItems) && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0;
153
+ }, [productListSetting, selectedItems]);
154
+ var _onChange = useCallback(function (value) {
155
+ if (disabled) return;
156
+ onChange === null || onChange === void 0 || onChange(value);
157
+ }, [disabled, onChange]);
158
+ var debounceIndicator = useCallback(function (delay) {
159
+ isIndicatorVisibleRef.current = true;
160
+ var timeoutId = setTimeout(function () {
161
+ isIndicatorVisibleRef.current = false;
162
+ }, delay);
163
+ return function () {
164
+ return clearTimeout(timeoutId);
165
+ };
166
+ }, []);
167
+ var lastActiveKeyRef = useRef('');
168
+
169
+ // 项目进入视口时的回调
170
+ var handleItemIntersectionIn = useCallback(function (item) {
171
+ var _key = String(item.__categoryId);
172
+ if (!isIndicatorVisibleRef.current && _key && _key !== lastActiveKeyRef.current) {
173
+ setActiveKey(_key);
174
+ lastActiveKeyRef.current = _key;
175
+ }
176
+ }, []);
177
+ var switchCategory = function switchCategory(key) {
178
+ setActiveKey(key);
179
+ lastActiveKeyRef.current = key; // 同步ref值
180
+ debounceIndicator(300);
181
+ var categoryIndex = _groupedList.findIndex(function (item) {
182
+ return item.__typename === 'category' && String(item.id) === key;
183
+ });
184
+ // 获取可滚动祖先元素
185
+ var _scrollParent = scrollParent || containerRef.current;
186
+ if (!_scrollParent || !containerRef.current) return;
187
+ var target = document.getElementById("ps_category_".concat(key));
188
+ if (!target) return;
189
+ // 获取产品选择器包装容器
190
+ var productSelectWrapper = document.querySelector(".".concat(PREFIX, "-wrapper"));
191
+ // 获取标签页包装容器
192
+ var tabsWrapper = document.querySelector(".".concat(PREFIX, "__tabs-wrapper"));
193
+ var tabsHeight = (tabsWrapper === null || tabsWrapper === void 0 ? void 0 : tabsWrapper.offsetHeight) || 0;
194
+ // 获取额外偏移元素(如固定头部等)
195
+ var offsetElement = getElementByIdentifier(offsetDom);
196
+ var extraOffset = offsetElement ? offsetElement.clientHeight : 0;
197
+ if (categoryIndex === 0) {
198
+ // 如果是第一个tab,滚动到产品选择器包装容器的位置
199
+ if (productSelectWrapper) {
200
+ var wrapperOffsetTop = getOffsetTopRelativeToScrollContainer(productSelectWrapper, _scrollParent);
201
+ _scrollParent.scrollTop = wrapperOffsetTop - extraOffset;
202
+ }
203
+ return;
204
+ } else {
205
+ // 其他tab,滚动到对应列表元素位置,需要减去标签页高度
206
+ var listOffsetTop = getOffsetTopRelativeToScrollContainer(target, _scrollParent);
207
+ _scrollParent.scrollTop = listOffsetTop - tabsHeight - extraOffset;
208
+ }
209
+ };
210
+ return /*#__PURE__*/React.createElement("div", {
211
+ ref: containerRef,
212
+ className: classNames(PREFIX, CONTAINER_CLASS, {
213
+ disabled: disabled
214
+ }),
215
+ style: mergedStyle
216
+ }, showSearch ? /*#__PURE__*/React.createElement("div", {
217
+ className: "".concat(PREFIX, "__search-wrapper")
218
+ }, /*#__PURE__*/React.createElement(Input, {
219
+ ref: searchRef,
220
+ prefix: /*#__PURE__*/React.createElement(SearchLg, null),
221
+ style: {
222
+ height: 44
223
+ },
224
+ placeholder: locales.getText('pisell2.product-select.search'),
225
+ allowClear: true,
226
+ value: keyword,
227
+ onChange: function onChange(e) {
228
+ // switchCategory('');
229
+ setKeyword(e.target.value);
230
+ }
231
+ })) : null, /*#__PURE__*/React.createElement(CategoryTabs, {
232
+ activeKey: activeKey,
233
+ items: _categories,
234
+ onChange: switchCategory,
235
+ loading: loading,
236
+ skeleton: /*#__PURE__*/React.createElement(CategorySkeleton, null)
237
+ }), !loading && !(_groupedList !== null && _groupedList !== void 0 && _groupedList.length) ? /*#__PURE__*/React.createElement(PisellEmpty, {
238
+ description: emptyDescription || locales.getText('pisell2.product-select.empty')
239
+ }) : /*#__PURE__*/React.createElement(IntersectionObserverProvider, {
240
+ rootMargin: "-270px 0px -270px 0px",
241
+ priorityMode: "top"
242
+ }, /*#__PURE__*/React.createElement(ProductList, {
243
+ className: "".concat(PREFIX, "__product-list"),
244
+ loading: loading,
245
+ data: loading ? MOCK_DATA : _groupedList,
246
+ context: {
247
+ onItemIntersectionIn: handleItemIntersectionIn,
248
+ onItemIntersectionOut: function onItemIntersectionOut() {}
249
+ },
250
+ _customScrollParent: scrollParent,
251
+ components: gridComponents,
252
+ itemContent: function itemContent(index, item, context) {
253
+ if (loading) {
254
+ return /*#__PURE__*/React.createElement(ProductCardSkeleton, {
255
+ index: index,
256
+ item: item
257
+ });
258
+ }
259
+ return /*#__PURE__*/React.createElement(ProductCard, {
260
+ index: index,
261
+ item: item,
262
+ context: context,
263
+ onSelect: _onChange,
264
+ isSelected: item.id === value,
265
+ decorateConfig: productListSetting
266
+ });
267
+ }
268
+ })));
269
+ };
270
+ export default index;
@@ -0,0 +1,56 @@
1
+ .pisell-product-select {
2
+ &-wrapper {
3
+ height: 100%;
4
+ background: var(--ps-container-bg, #ffffff);
5
+ overflow-y: auto;
6
+
7
+ &::-webkit-scrollbar {
8
+ display: none !important;
9
+ }
10
+
11
+ &.disabled {
12
+ .pisell-product-select__product-card {
13
+ background: var(--ps-card-hover-bg, #eaecf0);
14
+ cursor: not-allowed;
15
+ }
16
+ }
17
+ }
18
+
19
+ &__search-wrapper {
20
+ padding: 12px 12px 0px;
21
+ line-height: 0;
22
+ margin-top: 0 !important;
23
+
24
+ .pisell-lowcode-input-affix-wrapper {
25
+ &:hover,
26
+ &:focus,
27
+ &:focus-within {
28
+ border-color: var(--ps-color-primary, #8157d5) !important;
29
+ box-shadow: none !important;
30
+ }
31
+ }
32
+
33
+ > span {
34
+ background: var(--ps-container-bg, #ffffff);
35
+ color: var(--ps-search-input-color, #98a2b3);
36
+ }
37
+
38
+ input {
39
+ background: transparent;
40
+ color: var(--ps-search-input-color, #98a2b3);
41
+ }
42
+ }
43
+
44
+ &__product-list {
45
+ padding: 0px 12px 12px;
46
+ }
47
+
48
+ &__tabs-wrapper {
49
+ position: sticky;
50
+ top: 0;
51
+ z-index: 10;
52
+ // 基础样式采用原pill样式
53
+ padding: 16px 12px;
54
+ background: var(--ps-container-bg, #fff);
55
+ }
56
+ }
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'pisell2.product-select.search': string;
4
+ 'pisell2.product-select.stock': string;
5
+ 'pisell2.product-select.empty': string;
6
+ };
7
+ 'zh-CN': {
8
+ 'pisell2.product-select.search': string;
9
+ 'pisell2.product-select.stock': string;
10
+ 'pisell2.product-select.empty': string;
11
+ };
12
+ 'zh-HK': {
13
+ 'pisell2.product-select.search': string;
14
+ 'pisell2.product-select.stock': string;
15
+ 'pisell2.product-select.empty': string;
16
+ };
17
+ };
18
+ export default _default;
@@ -0,0 +1,17 @@
1
+ export default {
2
+ en: {
3
+ 'pisell2.product-select.search': 'Search',
4
+ 'pisell2.product-select.stock': 'Stock',
5
+ 'pisell2.product-select.empty': 'No Data'
6
+ },
7
+ 'zh-CN': {
8
+ 'pisell2.product-select.search': '搜索',
9
+ 'pisell2.product-select.stock': '库存',
10
+ 'pisell2.product-select.empty': '暂无数据'
11
+ },
12
+ 'zh-HK': {
13
+ 'pisell2.product-select.search': '搜索',
14
+ 'pisell2.product-select.stock': '庫存',
15
+ 'pisell2.product-select.empty': '暂无数据'
16
+ }
17
+ };
@@ -0,0 +1,17 @@
1
+ export interface ProductSelectToken {
2
+ colorPrimary: string;
3
+ colorText: string;
4
+ colorTextSecondary: string;
5
+ searchInputColor: string;
6
+ containerBg: string;
7
+ tabItemBg: string;
8
+ tabItemHoverBg: string;
9
+ tabItemActiveBg: string;
10
+ categoryTextColor: string;
11
+ cardBg: string;
12
+ cardHoverBg: string;
13
+ cardSelectedBg: string;
14
+ cardSelectedTextColor: string;
15
+ cardSelectedSecondaryTextColor: string;
16
+ }
17
+ export declare const defaultToken: ProductSelectToken;
@@ -0,0 +1,19 @@
1
+ export var defaultToken = {
2
+ colorPrimary: '#8157D5',
3
+ colorText: '#1B1B1B',
4
+ colorTextSecondary: '#4E4E4E',
5
+ containerBg: '#4E4E4E',
6
+ // search
7
+ searchInputColor: '#98a2b3',
8
+ // tab
9
+ tabItemBg: '#FFFFFF',
10
+ tabItemHoverBg: '#FFFFFF',
11
+ tabItemActiveBg: '#8157D5',
12
+ // category
13
+ categoryTextColor: '#FFFFFF',
14
+ cardBg: '#FFFFFF',
15
+ cardHoverBg: '#eaecf0',
16
+ cardSelectedBg: '#8157D5',
17
+ cardSelectedTextColor: '#ffffff',
18
+ cardSelectedSecondaryTextColor: 'rgba(255, 255, 255, 0.7)'
19
+ };
@@ -0,0 +1,39 @@
1
+ interface Product {
2
+ id: number;
3
+ title: string;
4
+ sort?: number;
5
+ category: Array<{
6
+ id: number;
7
+ name: string;
8
+ icon?: string;
9
+ slug: string;
10
+ sort: number;
11
+ }>;
12
+ [key: string]: any;
13
+ }
14
+ interface CategoryItem {
15
+ __typename: 'category';
16
+ id: number;
17
+ name: string;
18
+ icon?: string;
19
+ slug: string;
20
+ sort: number;
21
+ }
22
+ interface ProductItem extends Product {
23
+ __typename?: 'product';
24
+ }
25
+ declare type ListItem = CategoryItem | ProductItem;
26
+ /**
27
+ * 按目录对商品进行分组,产出平级的数据结构用于虚拟列表渲染
28
+ * @param products 商品列表
29
+ * @returns 包含目录项和商品项的平级数组
30
+ */
31
+ export declare function groupProductsByCategory(products: Product[]): ListItem[];
32
+ /**
33
+ * 根据传入的元素标识符获取DOM元素
34
+ * @param elementIdentifier 元素标识符,可以是HTMLElement、带'#'的id、带'.'的类名或CSS选择器
35
+ * @returns 找到的DOM元素或null
36
+ */
37
+ export declare function getElementByIdentifier(elementIdentifier: HTMLElement | string | null | undefined): HTMLElement | null;
38
+ export declare const getOffsetTopRelativeToScrollContainer: (targetElement: HTMLElement, scrollContainer: HTMLElement) => number;
39
+ export {};