@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,162 @@
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
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
+ // 商品按目录分组的工具函数
14
+ import { locales } from '@pisell/utils';
15
+ /**
16
+ * 按目录对商品进行分组,产出平级的数据结构用于虚拟列表渲染
17
+ * @param products 商品列表
18
+ * @returns 包含目录项和商品项的平级数组
19
+ */
20
+ export function groupProductsByCategory(products) {
21
+ if (!products || products.length === 0) {
22
+ return [];
23
+ }
24
+
25
+ // 收集所有的目录信息
26
+ var categoryMap = new Map();
27
+ var categoryProductsMap = new Map();
28
+ var uncategorizedProducts = [];
29
+
30
+ // 遍历商品,收集目录信息和建立目录-商品映射
31
+ products.forEach(function (product) {
32
+ if (product.category && Array.isArray(product.category) && product.category.length > 0) {
33
+ product.category.forEach(function (cat) {
34
+ // 收集目录信息
35
+ if (!categoryMap.has(cat.id)) {
36
+ categoryMap.set(cat.id, {
37
+ __typename: 'category',
38
+ id: cat.id,
39
+ name: cat.name,
40
+ icon: cat.icon,
41
+ slug: cat.slug,
42
+ sort: cat.sort
43
+ });
44
+ }
45
+
46
+ // 建立目录-商品映射
47
+ if (!categoryProductsMap.has(cat.id)) {
48
+ categoryProductsMap.set(cat.id, []);
49
+ }
50
+ categoryProductsMap.get(cat.id).push(_objectSpread(_objectSpread({}, product), {}, {
51
+ __typename: 'product',
52
+ __categoryId: cat.id
53
+ }));
54
+ });
55
+ } else {
56
+ // 没有分组的商品放入未分类列表
57
+ uncategorizedProducts.push(_objectSpread(_objectSpread({}, product), {}, {
58
+ __typename: 'product',
59
+ __categoryId: 0
60
+ }));
61
+ }
62
+ });
63
+
64
+ // 按目录的sort字段排序
65
+ var sortedCategories = Array.from(categoryMap.values()).sort(function (a, b) {
66
+ return b.sort - a.sort;
67
+ });
68
+
69
+ // 构建最终的平级数组
70
+ var result = [];
71
+ sortedCategories.forEach(function (category) {
72
+ // 添加目录项
73
+ result.push(category);
74
+
75
+ // 添加该目录下的商品,按商品的sort字段排序
76
+ var categoryProducts = categoryProductsMap.get(category.id) || [];
77
+ var sortedProducts = categoryProducts.sort(function (a, b) {
78
+ var sortA = a.sort || 0;
79
+ var sortB = b.sort || 0;
80
+ return sortB - sortA;
81
+ });
82
+ result.push.apply(result, _toConsumableArray(sortedProducts));
83
+ });
84
+
85
+ // 如果有未分类的商品,添加other分组
86
+ if (uncategorizedProducts.length > 0) {
87
+ var otherCategory = {
88
+ __typename: 'category',
89
+ id: 0,
90
+ name: locales.getText('pisell2.text.other'),
91
+ icon: '',
92
+ slug: 'other',
93
+ sort: 99999999 // 确保other分组排在最后
94
+ };
95
+ result.push(otherCategory);
96
+ // 对未分类商品也进行排序
97
+ var sortedUncategorizedProducts = uncategorizedProducts.sort(function (a, b) {
98
+ var sortA = a.sort || 0;
99
+ var sortB = b.sort || 0;
100
+ return sortB - sortA;
101
+ });
102
+ result.push.apply(result, _toConsumableArray(sortedUncategorizedProducts));
103
+ }
104
+ console.log('xxxxxx', result);
105
+ return result;
106
+ }
107
+
108
+ /**
109
+ * 根据传入的元素标识符获取DOM元素
110
+ * @param elementIdentifier 元素标识符,可以是HTMLElement、带'#'的id、带'.'的类名或CSS选择器
111
+ * @returns 找到的DOM元素或null
112
+ */
113
+ export function getElementByIdentifier(elementIdentifier) {
114
+ // 如果没有提供标识符,返回null
115
+ if (!elementIdentifier) {
116
+ return null;
117
+ }
118
+
119
+ // 如果是HTMLElement,直接返回
120
+ if (elementIdentifier instanceof HTMLElement) {
121
+ return elementIdentifier;
122
+ }
123
+
124
+ // 如果是字符串,判断是id、类名还是选择器
125
+ if (typeof elementIdentifier === 'string') {
126
+ // 如果以#开头,按id查找
127
+ if (elementIdentifier.startsWith('#')) {
128
+ return document.getElementById(elementIdentifier.slice(1));
129
+ }
130
+ // 如果以.开头,按类名查找
131
+ if (elementIdentifier.startsWith('.')) {
132
+ return document.querySelector(elementIdentifier);
133
+ }
134
+ // 否则直接作为选择器查找
135
+ return document.querySelector(elementIdentifier);
136
+ }
137
+ return null;
138
+ }
139
+
140
+ // 获取元素相对于指定滚动容器的偏移量
141
+ export var getOffsetTopRelativeToScrollContainer = function getOffsetTopRelativeToScrollContainer(targetElement, scrollContainer) {
142
+ if (!targetElement || !scrollContainer) return 0;
143
+
144
+ // 如果目标元素就是滚动容器本身,返回0
145
+ if (targetElement === scrollContainer) {
146
+ return 0;
147
+ }
148
+ var bodyTransform = getComputedStyle(document.body).transform;
149
+ var scaleY = 1;
150
+ if (bodyTransform !== 'none') {
151
+ var matrix = new DOMMatrix(bodyTransform);
152
+ scaleY = matrix.d;
153
+ }
154
+ // 使用getBoundingClientRect计算相对偏移量
155
+ var targetRect = targetElement.getBoundingClientRect();
156
+ var containerRect = scrollContainer.getBoundingClientRect();
157
+
158
+ // targetRect.top - containerRect.top 得到目标元素相对于容器顶部的可视距离
159
+ // 考虑容器已经滚动的距离 再加上scrollContainer.scrollTop
160
+ // 这样得到的是目标元素在容器内容中的绝对位置
161
+ return targetRect.top / scaleY - containerRect.top / scaleY + scrollContainer.scrollTop;
162
+ };
@@ -0,0 +1,3 @@
1
+ import { SCOProps } from '../types';
2
+ import '../index.less';
3
+ export declare const Header: (props: SCOProps) => JSX.Element;
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { locales } from '@pisell/utils';
3
+ import "../index.less";
4
+ export var Header = function Header(props) {
5
+ var _props$showLogo = props.showLogo,
6
+ showLogo = _props$showLogo === void 0 ? true : _props$showLogo,
7
+ _props$logo = props.logo,
8
+ logo = _props$logo === void 0 ? '' : _props$logo,
9
+ _props$logoSize = props.logoSize,
10
+ logoSize = _props$logoSize === void 0 ? {
11
+ width: 48,
12
+ height: 48
13
+ } : _props$logoSize,
14
+ _props$logoPosition = props.logoPosition,
15
+ logoPosition = _props$logoPosition === void 0 ? 'center' : _props$logoPosition,
16
+ _props$showWelcomeMes = props.showWelcomeMessage,
17
+ showWelcomeMessage = _props$showWelcomeMes === void 0 ? true : _props$showWelcomeMes,
18
+ _props$welcomeMessage = props.welcomeMessage,
19
+ welcomeMessage = _props$welcomeMessage === void 0 ? locales.getText('pisell-saas-create-org-welcome-message') : _props$welcomeMessage,
20
+ _props$welcomeMessage2 = props.welcomeMessageAlign,
21
+ welcomeMessageAlign = _props$welcomeMessage2 === void 0 ? 'center' : _props$welcomeMessage2,
22
+ _props$showTitle = props.showTitle,
23
+ showTitle = _props$showTitle === void 0 ? true : _props$showTitle,
24
+ _props$title = props.title,
25
+ title = _props$title === void 0 ? locales.getText('pisell-saas-create-org-title') : _props$title,
26
+ _props$titleAlign = props.titleAlign,
27
+ titleAlign = _props$titleAlign === void 0 ? 'center' : _props$titleAlign,
28
+ _props$showSubtitle = props.showSubtitle,
29
+ showSubtitle = _props$showSubtitle === void 0 ? true : _props$showSubtitle,
30
+ _props$subtitle = props.subtitle,
31
+ subtitle = _props$subtitle === void 0 ? '' : _props$subtitle,
32
+ _props$subtitleAlign = props.subtitleAlign,
33
+ subtitleAlign = _props$subtitleAlign === void 0 ? 'center' : _props$subtitleAlign;
34
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showLogo && /*#__PURE__*/React.createElement("div", {
35
+ className: "pisell-saas-create-org-logo ".concat(logoPosition),
36
+ style: {
37
+ width: logoSize.width,
38
+ height: logoSize.height
39
+ }
40
+ }, logo && /*#__PURE__*/React.createElement("img", {
41
+ src: logo,
42
+ alt: "logo",
43
+ style: {
44
+ height: (logoSize === null || logoSize === void 0 ? void 0 : logoSize.height) || 48
45
+ }
46
+ })), showWelcomeMessage && /*#__PURE__*/React.createElement("h1", {
47
+ className: "pisell-saas-create-org-welcome-message",
48
+ style: {
49
+ textAlign: welcomeMessageAlign
50
+ }
51
+ }, welcomeMessage || ''), showTitle && /*#__PURE__*/React.createElement("h1", {
52
+ className: "pisell-saas-create-org-title",
53
+ style: {
54
+ textAlign: titleAlign
55
+ }
56
+ }, title || ''), showSubtitle && /*#__PURE__*/React.createElement("div", {
57
+ className: "pisell-saas-create-org-subtitle",
58
+ style: {
59
+ textAlign: subtitleAlign
60
+ }
61
+ }, subtitle || ''));
62
+ };
@@ -0,0 +1,4 @@
1
+ import { SCOProps } from './types';
2
+ import './index.less';
3
+ declare const SaasCreateOrganization: (props: SCOProps) => JSX.Element;
4
+ export default SaasCreateOrganization;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { locales } from '@pisell/utils';
3
+ import useEngineContext from "../../hooks/useEngineContext";
4
+ import { Header } from "./components/Header";
5
+ import localeTexts from "./locales";
6
+ import "./index.less";
7
+ var SaasCreateOrganization = function SaasCreateOrganization(props) {
8
+ var _context$engine;
9
+ var context = useEngineContext();
10
+ locales.init(localeTexts, (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');
11
+ return /*#__PURE__*/React.createElement("div", {
12
+ className: "pisell-saas-create-org-container"
13
+ }, /*#__PURE__*/React.createElement(Header, props), /*#__PURE__*/React.createElement("div", null, props === null || props === void 0 ? void 0 : props.children));
14
+ };
15
+ export default SaasCreateOrganization;
@@ -0,0 +1,55 @@
1
+ .pisell-saas-create-org-container {
2
+ width: 360px;
3
+ max-width: 360px;
4
+ min-width: 266px;
5
+ margin: 0 20px;
6
+ overflow-x: hidden;
7
+
8
+ // Logo样式
9
+ .pisell-saas-create-org-logo {
10
+ width: fit-content;
11
+ height: 48px;
12
+ border-radius: 8px;
13
+
14
+ &.left {
15
+ margin-right: auto;
16
+ margin-left: 0;
17
+ }
18
+
19
+ &.center {
20
+ margin: 0 auto;
21
+ }
22
+
23
+ &.right {
24
+ margin-left: auto;
25
+ margin-right: 0;
26
+ }
27
+
28
+ img {
29
+ height: 48px;
30
+ object-fit: contain;
31
+ }
32
+ }
33
+
34
+ .pisell-saas-create-org-welcome-message {
35
+ margin-top: 10px;
36
+ color: #101828;
37
+ text-align: center;
38
+ font-size: 20px;
39
+ font-weight: 500;
40
+ }
41
+
42
+ .pisell-saas-create-org-title {
43
+ margin-top: 24px;
44
+ font-size: 30px;
45
+ font-weight: 600;
46
+ color: #101828;
47
+ }
48
+
49
+ .pisell-saas-create-org-subtitle {
50
+ margin-top: 12px;
51
+ font-size: 16px;
52
+ color: #475467;
53
+ font-weight: 400;
54
+ }
55
+ }
@@ -0,0 +1,15 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'pisell-saas-create-org-welcome-message': string;
4
+ 'pisell-saas-create-org-title': string;
5
+ };
6
+ 'zh-CN': {
7
+ 'pisell-saas-create-org-welcome-message': string;
8
+ 'pisell-saas-create-org-title': string;
9
+ };
10
+ 'zh-TW': {
11
+ 'pisell-saas-create-org-welcome-message': string;
12
+ 'pisell-saas-create-org-title': string;
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,14 @@
1
+ export default {
2
+ en: {
3
+ 'pisell-saas-create-org-welcome-message': 'Welcome to',
4
+ 'pisell-saas-create-org-title': 'Create your organization'
5
+ },
6
+ 'zh-CN': {
7
+ 'pisell-saas-create-org-welcome-message': '欢迎使用',
8
+ 'pisell-saas-create-org-title': '创建您的企业'
9
+ },
10
+ 'zh-TW': {
11
+ 'pisell-saas-create-org-welcome-message': '歡迎使用',
12
+ 'pisell-saas-create-org-title': '創建您的企業'
13
+ }
14
+ };
@@ -0,0 +1,69 @@
1
+ /// <reference types="react" />
2
+ export interface SCOProps {
3
+ /** 是否显示Logo */
4
+ showLogo?: boolean;
5
+ /** Logo图片地址 */
6
+ logo?: string;
7
+ /** Logo位置 */
8
+ logoPosition?: 'left' | 'center' | 'right';
9
+ /** Logo尺寸 */
10
+ logoSize?: {
11
+ width?: number;
12
+ height?: number;
13
+ };
14
+ /** 是否显示欢迎语 */
15
+ showWelcomeMessage?: boolean;
16
+ /** 欢迎语 */
17
+ welcomeMessage?: string;
18
+ /** 欢迎语对齐方式 */
19
+ welcomeMessageAlign?: 'left' | 'center' | 'right';
20
+ /** 是否显示标题 */
21
+ showTitle?: boolean;
22
+ /** 标题 */
23
+ title?: string;
24
+ /** 标题对齐方式 */
25
+ titleAlign?: 'left' | 'center' | 'right';
26
+ /** 副标题 */
27
+ subtitle?: string;
28
+ /** 是否显示副标题 */
29
+ showSubtitle?: boolean;
30
+ /** 副标题对齐方式 */
31
+ subtitleAlign?: 'left' | 'center' | 'right';
32
+ /** 是否显示公司名称输入框 */
33
+ showCompanyName?: boolean;
34
+ /** 公司名称输入框标题 */
35
+ companyNameLabel?: string;
36
+ /** 公司名称输入框占位符 */
37
+ companyNamePlaceholder?: string;
38
+ /** 公司名称输入框必填 */
39
+ companyNameRequired?: boolean;
40
+ /** 是否显示域名输入框 */
41
+ showDomain?: boolean;
42
+ /** 域名输入框标题 */
43
+ domainLabel?: string;
44
+ /** 域名输入框占位符 */
45
+ domainPlaceholder?: string;
46
+ /** 域名输入框必填 */
47
+ domainRequired?: boolean;
48
+ /** 是否显示分割线 */
49
+ showDivider?: boolean;
50
+ /** 分割线文案 */
51
+ dividerText?: string;
52
+ /** 是否显示时区选择 */
53
+ showTimezoneSelect?: boolean;
54
+ /** 时区选择标题 */
55
+ timezoneSelectLabel?: string;
56
+ /** 时区选择必填 */
57
+ timezoneSelectRequired?: boolean;
58
+ /** 是否显示语言选择 */
59
+ showLanguageSelect?: boolean;
60
+ /** 语言选择标题 */
61
+ languageSelectLabel?: string;
62
+ /** 语言选择必填 */
63
+ languageSelectRequired?: boolean;
64
+ /** 按钮文本 */
65
+ buttonText?: string;
66
+ /** 创建企业回调 */
67
+ onCreateOrganization?: (info: any) => Promise<void>;
68
+ children?: React.ReactNode;
69
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { SaasLoginProps } from './types';
3
+ import './index.less';
4
+ declare const SaasLogin: React.FC<SaasLoginProps>;
5
+ export default SaasLogin;
@@ -0,0 +1,165 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ 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; }
6
+ 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; }
7
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ 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."); }
12
+ 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); }
13
+ 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; }
14
+ 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; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ import React, { useEffect, useState } from 'react';
17
+ import { Form, Input, Button } from 'antd';
18
+ import { locales } from '@pisell/utils';
19
+ import useEngineContext from "../../hooks/useEngineContext";
20
+ import localeTexts from "./locales";
21
+ import { mergeData } from "./utils";
22
+ import "./index.less";
23
+ var SaasLogin = function SaasLogin(props) {
24
+ var _context$engine, _data$logoSize, _data$logoSize2, _data$logoSize3;
25
+ var context = useEngineContext();
26
+ locales.init(localeTexts, (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');
27
+ var _Form$useForm = Form.useForm(),
28
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
29
+ form = _Form$useForm2[0];
30
+ var _useState = useState(false),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ loading = _useState2[0],
33
+ setLoading = _useState2[1];
34
+ var _useState3 = useState({}),
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ data = _useState4[0],
37
+ setData = _useState4[1];
38
+ useEffect(function () {
39
+ var newData = mergeData(locales, props);
40
+ setData(_objectSpread({}, newData));
41
+ }, [props, locales]);
42
+ var emailRules = [{
43
+ required: true,
44
+ message: locales.getText('pisell-saas-login-email-error')
45
+ }, {
46
+ type: 'email',
47
+ message: locales.getText('pisell-saas-login-email-error-valid')
48
+ }];
49
+
50
+ /**
51
+ * 处理邮箱登录
52
+ */
53
+ var handleEmailLogin = /*#__PURE__*/function () {
54
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
55
+ var _props$onLogin, values;
56
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
57
+ while (1) switch (_context.prev = _context.next) {
58
+ case 0:
59
+ _context.prev = 0;
60
+ setLoading(true);
61
+ _context.next = 4;
62
+ return form.validateFields();
63
+ case 4:
64
+ values = _context.sent;
65
+ _context.next = 7;
66
+ return props === null || props === void 0 || (_props$onLogin = props.onLogin) === null || _props$onLogin === void 0 ? void 0 : _props$onLogin.call(props, _objectSpread(_objectSpread({}, values), {}, {
67
+ loginMethod: 'email'
68
+ }));
69
+ case 7:
70
+ _context.next = 12;
71
+ break;
72
+ case 9:
73
+ _context.prev = 9;
74
+ _context.t0 = _context["catch"](0);
75
+ console.error('Validation failed:', _context.t0);
76
+ case 12:
77
+ _context.prev = 12;
78
+ setLoading(false);
79
+ return _context.finish(12);
80
+ case 15:
81
+ case "end":
82
+ return _context.stop();
83
+ }
84
+ }, _callee, null, [[0, 9, 12, 15]]);
85
+ }));
86
+ return function handleEmailLogin() {
87
+ return _ref.apply(this, arguments);
88
+ };
89
+ }();
90
+ return /*#__PURE__*/React.createElement("div", {
91
+ className: "pisell-saas-login-main"
92
+ }, /*#__PURE__*/React.createElement("div", {
93
+ className: "pisell-saas-login-container"
94
+ }, (data === null || data === void 0 ? void 0 : data.showLogo) && /*#__PURE__*/React.createElement("div", {
95
+ className: "pisell-saas-login-logo ".concat(data.logoPosition),
96
+ style: {
97
+ width: (data === null || data === void 0 || (_data$logoSize = data.logoSize) === null || _data$logoSize === void 0 ? void 0 : _data$logoSize.width) || 48,
98
+ height: (data === null || data === void 0 || (_data$logoSize2 = data.logoSize) === null || _data$logoSize2 === void 0 ? void 0 : _data$logoSize2.height) || 48
99
+ }
100
+ }, (data === null || data === void 0 ? void 0 : data.logo) && /*#__PURE__*/React.createElement("img", {
101
+ src: data === null || data === void 0 ? void 0 : data.logo,
102
+ alt: "logo",
103
+ style: {
104
+ height: (data === null || data === void 0 || (_data$logoSize3 = data.logoSize) === null || _data$logoSize3 === void 0 ? void 0 : _data$logoSize3.height) || 48
105
+ }
106
+ })), (data === null || data === void 0 ? void 0 : data.showWelcomeMessage) && /*#__PURE__*/React.createElement("h1", {
107
+ className: "pisell-saas-login-welcome-message",
108
+ style: {
109
+ textAlign: data === null || data === void 0 ? void 0 : data.welcomeMessageAlign
110
+ }
111
+ }, (data === null || data === void 0 ? void 0 : data.welcomeMessage) || ''), (data === null || data === void 0 ? void 0 : data.showTitle) && /*#__PURE__*/React.createElement("h1", {
112
+ className: "pisell-saas-login-title",
113
+ style: {
114
+ textAlign: data === null || data === void 0 ? void 0 : data.titleAlign
115
+ }
116
+ }, (data === null || data === void 0 ? void 0 : data.title) || ''), (data === null || data === void 0 ? void 0 : data.showSubtitle) && /*#__PURE__*/React.createElement("p", {
117
+ className: "pisell-saas-login-subtitle",
118
+ style: {
119
+ textAlign: data === null || data === void 0 ? void 0 : data.subtitleAlign
120
+ }
121
+ }, (data === null || data === void 0 ? void 0 : data.subtitle) || ''), /*#__PURE__*/React.createElement("div", {
122
+ className: "pisell-saas-login-form"
123
+ }, /*#__PURE__*/React.createElement(Form, {
124
+ form: form
125
+ }, /*#__PURE__*/React.createElement("div", {
126
+ className: "form-item-label"
127
+ }, (data === null || data === void 0 ? void 0 : data.emailLabel) || ''), /*#__PURE__*/React.createElement(Form.Item, {
128
+ name: "email",
129
+ rules: emailRules
130
+ }, /*#__PURE__*/React.createElement(Input, {
131
+ placeholder: (data === null || data === void 0 ? void 0 : data.emailPlaceholder) || '',
132
+ size: "large",
133
+ className: "pisell-saas-login-input"
134
+ })), /*#__PURE__*/React.createElement("div", {
135
+ className: "form-item-label"
136
+ }, (data === null || data === void 0 ? void 0 : data.passwordLabel) || ''), /*#__PURE__*/React.createElement(Form.Item, {
137
+ name: "password",
138
+ rules: [{
139
+ required: true,
140
+ message: locales.getText('pisell-saas-login-password-required')
141
+ }]
142
+ }, /*#__PURE__*/React.createElement(Input.Password, {
143
+ placeholder: (data === null || data === void 0 ? void 0 : data.passwordPlaceholder) || '',
144
+ size: "large",
145
+ className: "pisell-saas-login-input"
146
+ })), /*#__PURE__*/React.createElement(Button, {
147
+ type: "primary",
148
+ block: true,
149
+ size: "large",
150
+ loading: loading,
151
+ onClick: handleEmailLogin,
152
+ className: "pisell-saas-login-button"
153
+ }, (data === null || data === void 0 ? void 0 : data.buttonText) || ''))), /*#__PURE__*/React.createElement("div", {
154
+ className: "pisell-saas-login-footer"
155
+ }, (data === null || data === void 0 ? void 0 : data.showRegister) && /*#__PURE__*/React.createElement("p", {
156
+ className: "pisell-saas-login-signup",
157
+ style: {
158
+ textAlign: data === null || data === void 0 ? void 0 : data.registerAlign
159
+ }
160
+ }, data !== null && data !== void 0 && data.showRegisterText ? data === null || data === void 0 ? void 0 : data.registerText : '', (data === null || data === void 0 ? void 0 : data.showRegisterLinkText) && /*#__PURE__*/React.createElement("a", {
161
+ onClick: props === null || props === void 0 ? void 0 : props.onGoRegister,
162
+ className: "pisell-saas-login-signup-link"
163
+ }, (data === null || data === void 0 ? void 0 : data.registerLinkText) || '')))));
164
+ };
165
+ export default SaasLogin;