@pisell/materials 1.0.363 → 1.0.365

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 (294) hide show
  1. package/build/lowcode/assets/7b1c7af5ce9e37e4b40ea53fea6ccfd9.jpeg +0 -0
  2. package/build/lowcode/assets-daily.json +13 -13
  3. package/build/lowcode/assets-dev.json +4 -4
  4. package/build/lowcode/assets-prod.json +13 -13
  5. package/build/lowcode/index.js +1 -1
  6. package/build/lowcode/meta.js +2 -2
  7. package/build/lowcode/preview.js +142 -142
  8. package/build/lowcode/render/default/assets/7b1c7af5ce9e37e4b40ea53fea6ccfd9.jpeg +0 -0
  9. package/build/lowcode/render/default/view.css +1 -1
  10. package/build/lowcode/render/default/view.js +29 -27
  11. package/build/lowcode/view.css +1 -1
  12. package/build/lowcode/view.js +23 -21
  13. package/dist/umd/materials.min.css +1 -0
  14. package/dist/umd/materials.min.js +1 -0
  15. package/dist/umd/static/DotsSix.57d66266.svg +1 -0
  16. package/dist/umd/static/arrow-left.e542294f.svg +1 -0
  17. package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
  18. package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
  19. package/dist/umd/static/help-circle.31c9be40.svg +1 -0
  20. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
  21. package/es/components/button/index.d.ts +4 -3
  22. package/es/components/button/index.js +14 -3
  23. package/es/components/iconfont/index.d.ts +2 -1
  24. package/es/components/iconfont/index.js +1 -1
  25. package/es/components/page/index.css +0 -0
  26. package/es/components/page/index.d.ts +2 -2
  27. package/es/components/page/index.js +208 -185
  28. package/es/components/pisell-config-provider/context.d.ts +16 -0
  29. package/es/components/pisell-config-provider/context.js +32 -0
  30. package/es/components/pisell-config-provider/hooks/usePisellConfig.d.ts +2 -0
  31. package/es/components/pisell-config-provider/hooks/usePisellConfig.js +7 -0
  32. package/es/components/pisell-config-provider/index.d.ts +9 -0
  33. package/es/components/pisell-config-provider/index.js +32 -0
  34. package/es/components/pisellCard/bg.jpeg +0 -0
  35. package/es/components/pisellCard/index.d.ts +47 -0
  36. package/es/components/pisellCard/index.js +84 -0
  37. package/es/components/pisellCard/index.less +89 -0
  38. package/es/components/pisellCardList/index.d.ts +23 -0
  39. package/es/components/pisellCardList/index.js +104 -0
  40. package/es/components/pisellCardList/index.less +75 -0
  41. package/es/components/pisellCheckboxGroup/index.d.ts +26 -0
  42. package/es/components/pisellCheckboxGroup/index.js +144 -0
  43. package/es/components/pisellCheckboxGroup/index.less +36 -0
  44. package/es/components/pisellCheckboxGroup/mock.d.ts +4 -0
  45. package/es/components/pisellCheckboxGroup/mock.js +16 -0
  46. package/es/components/pisellContainer/components/Portal/index.d.ts +10 -0
  47. package/es/components/pisellContainer/components/Portal/index.js +7 -0
  48. package/es/components/pisellContainer/containers.d.ts +1 -0
  49. package/es/components/pisellContainer/containers.js +8 -0
  50. package/es/components/pisellContainer/index.d.ts +22 -0
  51. package/es/components/pisellContainer/index.js +17 -0
  52. package/es/components/pisellCountdown/index.d.ts +24 -0
  53. package/es/components/pisellCountdown/index.js +44 -0
  54. package/es/components/pisellCountdown/utils.d.ts +1 -0
  55. package/es/components/pisellCountdown/utils.js +35 -0
  56. package/es/components/pisellDatePicker/datePickerCpt.d.ts +12 -0
  57. package/es/components/pisellDatePicker/datePickerCpt.js +131 -0
  58. package/es/components/pisellDatePicker/detePickerCpt.less +3 -0
  59. package/es/components/pisellDatePicker/index.d.ts +3 -0
  60. package/es/components/pisellDatePicker/index.js +17 -0
  61. package/es/components/pisellEmpty/index.d.ts +16 -0
  62. package/es/components/pisellEmpty/index.js +38 -0
  63. package/es/components/pisellEmpty/index.less +34 -0
  64. package/es/components/pisellInput/components/BankCard/cardPng/AMEX.png +0 -0
  65. package/es/components/pisellInput/components/BankCard/cardPng/Discover.png +0 -0
  66. package/es/components/pisellInput/components/BankCard/cardPng/JCB.png +0 -0
  67. package/es/components/pisellInput/components/BankCard/cardPng/MasterCard.png +0 -0
  68. package/es/components/pisellInput/components/BankCard/cardPng/UnionPay.png +0 -0
  69. package/es/components/pisellInput/components/BankCard/cardPng/VISA.png +0 -0
  70. package/es/components/pisellInput/components/BankCard/index.d.ts +11 -0
  71. package/es/components/pisellInput/components/BankCard/index.js +82 -0
  72. package/es/components/pisellInput/components/BankCard/index.less +4 -0
  73. package/es/components/pisellInput/components/BankCard/utils.d.ts +11 -0
  74. package/es/components/pisellInput/components/BankCard/utils.js +65 -0
  75. package/es/components/pisellInput/components/Copy/index.d.ts +11 -0
  76. package/es/components/pisellInput/components/Copy/index.js +53 -0
  77. package/es/components/pisellInput/components/SecurityCode/card.png +0 -0
  78. package/es/components/pisellInput/components/SecurityCode/index.d.ts +12 -0
  79. package/es/components/pisellInput/components/SecurityCode/index.js +46 -0
  80. package/es/components/pisellInput/components/SecurityCode/index.less +4 -0
  81. package/es/components/pisellInput/index.d.ts +13 -0
  82. package/es/components/pisellInput/index.js +15 -0
  83. package/es/components/pisellLoading/index.d.ts +15 -0
  84. package/es/components/pisellLoading/index.js +48 -0
  85. package/es/components/pisellLoading/index.less +35 -0
  86. package/es/components/pisellMessage/index.d.ts +4 -0
  87. package/es/components/pisellMessage/index.js +5 -0
  88. package/es/components/pisellModal/components/Information/index.d.ts +21 -0
  89. package/es/components/pisellModal/components/Information/index.js +23 -0
  90. package/es/components/pisellModal/components/Information/index.less +15 -0
  91. package/es/components/pisellModal/components/IpadModal/index.d.ts +6 -0
  92. package/es/components/pisellModal/components/IpadModal/index.js +6 -0
  93. package/es/components/pisellModal/components/MobileModal/index.d.ts +9 -0
  94. package/es/components/pisellModal/components/MobileModal/index.js +26 -0
  95. package/es/components/pisellModal/components/MobileModal/index.less +59 -0
  96. package/es/components/pisellModal/components/PcModal/index.d.ts +30 -0
  97. package/es/components/pisellModal/components/PcModal/index.js +129 -0
  98. package/es/components/pisellModal/components/PcModal/index.less +38 -0
  99. package/es/components/pisellModal/components/functions/index.d.ts +12 -0
  100. package/es/components/pisellModal/components/functions/index.js +44 -0
  101. package/es/components/pisellModal/components/functions/index.less +25 -0
  102. package/es/components/pisellModal/components/index.d.ts +10 -0
  103. package/es/components/pisellModal/components/index.js +9 -0
  104. package/es/components/pisellModal/constants.d.ts +6 -0
  105. package/es/components/pisellModal/constants.js +6 -0
  106. package/es/components/pisellModal/index.d.ts +43 -0
  107. package/es/components/pisellModal/index.js +30 -0
  108. package/es/components/pisellRow/index.d.ts +14 -0
  109. package/es/components/pisellRow/index.js +54 -0
  110. package/es/components/pisellRow/index.less +13 -0
  111. package/es/components/pisellText/components/Amount/index.d.ts +18 -0
  112. package/es/components/pisellText/components/Amount/index.js +25 -0
  113. package/es/components/pisellText/index.d.ts +8 -0
  114. package/es/components/pisellText/index.js +7 -0
  115. package/es/components/pisellToast/index.d.ts +16 -0
  116. package/es/components/pisellToast/index.js +32 -0
  117. package/es/components/pisellToast/index.less +26 -0
  118. package/es/components/pisellTooltip/index.d.ts +10 -0
  119. package/es/components/pisellTooltip/index.js +18 -0
  120. package/es/components/pisellTooltip/index.less +5 -0
  121. package/es/hooks/useCssVariables.d.ts +8 -0
  122. package/es/hooks/useCssVariables.js +21 -0
  123. package/es/index.d.ts +18 -0
  124. package/es/index.js +19 -1
  125. package/es/locales/en-US.d.ts +3 -0
  126. package/es/locales/en-US.js +5 -1
  127. package/es/locales/zh-CN.d.ts +3 -0
  128. package/es/locales/zh-CN.js +5 -1
  129. package/es/locales/zh-TW.d.ts +3 -0
  130. package/es/locales/zh-TW.js +5 -1
  131. package/es/utils/index.d.ts +1 -0
  132. package/es/utils/index.js +15 -1
  133. package/lib/components/button/index.d.ts +4 -3
  134. package/lib/components/button/index.js +13 -9
  135. package/lib/components/iconfont/index.d.ts +2 -1
  136. package/lib/components/iconfont/index.js +1 -1
  137. package/lib/components/page/index.css +0 -0
  138. package/lib/components/page/index.d.ts +2 -2
  139. package/lib/components/page/index.js +172 -159
  140. package/lib/components/pisell-config-provider/context.d.ts +16 -0
  141. package/lib/components/pisell-config-provider/context.js +49 -0
  142. package/lib/components/pisell-config-provider/hooks/usePisellConfig.d.ts +2 -0
  143. package/lib/components/pisell-config-provider/hooks/usePisellConfig.js +31 -0
  144. package/lib/components/pisell-config-provider/index.d.ts +9 -0
  145. package/lib/components/pisell-config-provider/index.js +61 -0
  146. package/lib/components/pisellCard/bg.jpeg +0 -0
  147. package/lib/components/pisellCard/index.d.ts +47 -0
  148. package/lib/components/pisellCard/index.js +97 -0
  149. package/lib/components/pisellCard/index.less +89 -0
  150. package/lib/components/pisellCardList/index.d.ts +23 -0
  151. package/lib/components/pisellCardList/index.js +146 -0
  152. package/lib/components/pisellCardList/index.less +75 -0
  153. package/lib/components/pisellCheckboxGroup/index.d.ts +26 -0
  154. package/lib/components/pisellCheckboxGroup/index.js +151 -0
  155. package/lib/components/pisellCheckboxGroup/index.less +36 -0
  156. package/lib/components/pisellCheckboxGroup/mock.d.ts +4 -0
  157. package/lib/components/pisellCheckboxGroup/mock.js +35 -0
  158. package/lib/components/pisellContainer/components/Portal/index.d.ts +10 -0
  159. package/lib/components/pisellContainer/components/Portal/index.js +40 -0
  160. package/lib/components/pisellContainer/containers.d.ts +1 -0
  161. package/lib/components/pisellContainer/containers.js +46 -0
  162. package/lib/components/pisellContainer/index.d.ts +22 -0
  163. package/lib/components/pisellContainer/index.js +49 -0
  164. package/lib/components/pisellCountdown/index.d.ts +24 -0
  165. package/lib/components/pisellCountdown/index.js +63 -0
  166. package/lib/components/pisellCountdown/utils.d.ts +1 -0
  167. package/lib/components/pisellCountdown/utils.js +60 -0
  168. package/lib/components/pisellDatePicker/datePickerCpt.d.ts +12 -0
  169. package/lib/components/pisellDatePicker/datePickerCpt.js +157 -0
  170. package/lib/components/pisellDatePicker/detePickerCpt.less +3 -0
  171. package/lib/components/pisellDatePicker/index.d.ts +3 -0
  172. package/lib/components/pisellDatePicker/index.js +48 -0
  173. package/lib/components/pisellEmpty/index.d.ts +16 -0
  174. package/lib/components/pisellEmpty/index.js +61 -0
  175. package/lib/components/pisellEmpty/index.less +34 -0
  176. package/lib/components/pisellInput/components/BankCard/cardPng/AMEX.png +0 -0
  177. package/lib/components/pisellInput/components/BankCard/cardPng/Discover.png +0 -0
  178. package/lib/components/pisellInput/components/BankCard/cardPng/JCB.png +0 -0
  179. package/lib/components/pisellInput/components/BankCard/cardPng/MasterCard.png +0 -0
  180. package/lib/components/pisellInput/components/BankCard/cardPng/UnionPay.png +0 -0
  181. package/lib/components/pisellInput/components/BankCard/cardPng/VISA.png +0 -0
  182. package/lib/components/pisellInput/components/BankCard/index.d.ts +11 -0
  183. package/lib/components/pisellInput/components/BankCard/index.js +98 -0
  184. package/lib/components/pisellInput/components/BankCard/index.less +4 -0
  185. package/lib/components/pisellInput/components/BankCard/utils.d.ts +11 -0
  186. package/lib/components/pisellInput/components/BankCard/utils.js +103 -0
  187. package/lib/components/pisellInput/components/Copy/index.d.ts +11 -0
  188. package/lib/components/pisellInput/components/Copy/index.js +61 -0
  189. package/lib/components/pisellInput/components/SecurityCode/card.png +0 -0
  190. package/lib/components/pisellInput/components/SecurityCode/index.d.ts +12 -0
  191. package/lib/components/pisellInput/components/SecurityCode/index.js +74 -0
  192. package/lib/components/pisellInput/components/SecurityCode/index.less +4 -0
  193. package/lib/components/pisellInput/index.d.ts +13 -0
  194. package/lib/components/pisellInput/index.js +46 -0
  195. package/lib/components/pisellLoading/index.d.ts +15 -0
  196. package/lib/components/pisellLoading/index.js +72 -0
  197. package/lib/components/pisellLoading/index.less +35 -0
  198. package/lib/components/pisellMessage/index.d.ts +4 -0
  199. package/lib/components/pisellMessage/index.js +34 -0
  200. package/lib/components/pisellModal/components/Information/index.d.ts +21 -0
  201. package/lib/components/pisellModal/components/Information/index.js +53 -0
  202. package/lib/components/pisellModal/components/Information/index.less +15 -0
  203. package/lib/components/pisellModal/components/IpadModal/index.d.ts +6 -0
  204. package/lib/components/pisellModal/components/IpadModal/index.js +40 -0
  205. package/lib/components/pisellModal/components/MobileModal/index.d.ts +9 -0
  206. package/lib/components/pisellModal/components/MobileModal/index.js +66 -0
  207. package/lib/components/pisellModal/components/MobileModal/index.less +59 -0
  208. package/lib/components/pisellModal/components/PcModal/index.d.ts +30 -0
  209. package/lib/components/pisellModal/components/PcModal/index.js +143 -0
  210. package/lib/components/pisellModal/components/PcModal/index.less +38 -0
  211. package/lib/components/pisellModal/components/functions/index.d.ts +12 -0
  212. package/lib/components/pisellModal/components/functions/index.js +90 -0
  213. package/lib/components/pisellModal/components/functions/index.less +25 -0
  214. package/lib/components/pisellModal/components/index.d.ts +10 -0
  215. package/lib/components/pisellModal/components/index.js +52 -0
  216. package/lib/components/pisellModal/constants.d.ts +6 -0
  217. package/lib/components/pisellModal/constants.js +33 -0
  218. package/lib/components/pisellModal/index.d.ts +43 -0
  219. package/lib/components/pisellModal/index.js +63 -0
  220. package/lib/components/pisellRow/index.d.ts +14 -0
  221. package/lib/components/pisellRow/index.js +85 -0
  222. package/lib/components/pisellRow/index.less +13 -0
  223. package/lib/components/pisellText/components/Amount/index.d.ts +18 -0
  224. package/lib/components/pisellText/components/Amount/index.js +64 -0
  225. package/lib/components/pisellText/index.d.ts +8 -0
  226. package/lib/components/pisellText/index.js +41 -0
  227. package/lib/components/pisellToast/index.d.ts +16 -0
  228. package/lib/components/pisellToast/index.js +59 -0
  229. package/lib/components/pisellToast/index.less +26 -0
  230. package/lib/components/pisellTooltip/index.d.ts +10 -0
  231. package/lib/components/pisellTooltip/index.js +56 -0
  232. package/lib/components/pisellTooltip/index.less +5 -0
  233. package/lib/hooks/useCssVariables.d.ts +8 -0
  234. package/lib/hooks/useCssVariables.js +36 -0
  235. package/lib/index.d.ts +18 -0
  236. package/lib/index.js +54 -0
  237. package/lib/locales/en-US.d.ts +3 -0
  238. package/lib/locales/en-US.js +5 -1
  239. package/lib/locales/zh-CN.d.ts +3 -0
  240. package/lib/locales/zh-CN.js +5 -1
  241. package/lib/locales/zh-TW.d.ts +3 -0
  242. package/lib/locales/zh-TW.js +5 -1
  243. package/lib/utils/index.d.ts +1 -0
  244. package/lib/utils/index.js +16 -0
  245. package/lowcode/_utils/transform-meta.ts +31 -10
  246. package/lowcode/button/__screenshots__/pisell-modal-information.png +0 -0
  247. package/lowcode/button/meta.ts +30 -0
  248. package/lowcode/button/snippets.ts +28 -0
  249. package/lowcode/information-modal/meta.ts +44 -1
  250. package/lowcode/modal/meta.ts +1 -1
  251. package/lowcode/pisell-card/meta.ts +189 -0
  252. package/lowcode/pisell-card/snippets.ts +20 -0
  253. package/lowcode/pisell-card-list/meta.ts +145 -0
  254. package/lowcode/pisell-card-list/snippets.ts +9 -0
  255. package/lowcode/pisell-checkbox-group/meta.ts +112 -0
  256. package/lowcode/pisell-checkbox-group/snippets.ts +13 -0
  257. package/lowcode/pisell-container/meta.ts +71 -0
  258. package/lowcode/pisell-container/snippets.ts +14 -0
  259. package/lowcode/pisell-countdown/meta.ts +71 -0
  260. package/lowcode/pisell-countdown/snippets.ts +12 -0
  261. package/lowcode/pisell-date-picker/meta.ts +76 -0
  262. package/lowcode/pisell-date-picker/snippets.ts +9 -0
  263. package/lowcode/pisell-empty/__screenshots__/empty-1.png +0 -0
  264. package/lowcode/pisell-empty/meta.ts +85 -0
  265. package/lowcode/pisell-empty/snippets.ts +10 -0
  266. package/lowcode/pisell-input/__screenshots__/input-1.png +0 -0
  267. package/lowcode/pisell-input/meta.ts +193 -0
  268. package/lowcode/pisell-input/snippets.ts +11 -0
  269. package/lowcode/pisell-input.bank-card-input/__screenshots__/pisell-input.bank-card-input.png +0 -0
  270. package/lowcode/pisell-input.bank-card-input/meta.ts +62 -0
  271. package/lowcode/pisell-input.bank-card-input/snippets.ts +11 -0
  272. package/lowcode/pisell-input.copy/meta.ts +73 -0
  273. package/lowcode/pisell-input.copy/snippets.ts +10 -0
  274. package/lowcode/pisell-input.security-code/__screenshots__/pisell-input.security-code.png +0 -0
  275. package/lowcode/pisell-input.security-code/meta.ts +92 -0
  276. package/lowcode/pisell-input.security-code/snippets.ts +11 -0
  277. package/lowcode/pisell-loading/meta.ts +98 -0
  278. package/lowcode/pisell-loading/snippets.ts +11 -0
  279. package/lowcode/pisell-modal/__screenshots__/modal-1.png +0 -0
  280. package/lowcode/pisell-modal/__screenshots__/modal-2.png +0 -0
  281. package/lowcode/pisell-modal/meta.ts +200 -0
  282. package/lowcode/pisell-modal/snippets.ts +38 -0
  283. package/lowcode/pisell-modal.information/__screenshots__/pisell-modal.information.png +0 -0
  284. package/lowcode/pisell-modal.information/meta.ts +109 -0
  285. package/lowcode/pisell-modal.information/snippets.ts +17 -0
  286. package/lowcode/pisell-row/meta.ts +127 -0
  287. package/lowcode/pisell-row/snippets.ts +24 -0
  288. package/lowcode/pisell-text/meta.ts +8117 -0
  289. package/lowcode/pisell-text.amount/meta.ts +61 -0
  290. package/lowcode/pisell-text.amount/snippets.ts +15 -0
  291. package/lowcode/pisell-tooltip/__screenshots__/tooltip-1.jpg +0 -0
  292. package/lowcode/pisell-tooltip/meta.ts +306 -0
  293. package/lowcode/pisell-tooltip/snippets.ts +12 -0
  294. package/package.json +3 -3
@@ -0,0 +1,8 @@
1
+ import PisellModal from "../pisellModal";
2
+ import Drawer from "../drawer";
3
+ import Portal from "./components/Portal";
4
+ export var containers = {
5
+ modal: PisellModal,
6
+ drawer: Drawer,
7
+ portal: Portal
8
+ };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { DrawerProps } from 'antd';
3
+ import { PisellModalProps } from '../pisellModal';
4
+ import { PortalProps } from './components/Portal';
5
+ import { PisellContextType } from "../pisell-config-provider/context";
6
+ export declare type RenderType = 'modal' | 'drawer' | 'portal' | '';
7
+ export interface PisellContainerProps<T> {
8
+ /** 平台 */
9
+ platform?: PisellContextType['platform'];
10
+ /** 渲染类型
11
+ * "modal" 弹窗
12
+ * "drawer" 抽屉
13
+ * "portal" 渲染到指定dom位置
14
+ * undefined | "" | null 渲染到当前位置
15
+ * */
16
+ renderType?: T;
17
+ /** 对应组件的props */
18
+ props?: T extends 'modal' ? PisellModalProps : T extends 'drawer' ? DrawerProps : T extends 'portal' ? PortalProps : any;
19
+ children?: React.ReactNode;
20
+ }
21
+ declare const PisellContainer: <T extends RenderType>(props: PisellContainerProps<T>) => any;
22
+ export default PisellContainer;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { containers } from "./containers";
3
+ var PisellContainer = function PisellContainer(props) {
4
+ var renderType = props.renderType,
5
+ children = props.children,
6
+ cptProps = props.props;
7
+ if (!renderType) {
8
+ return children;
9
+ }
10
+ var Container = containers[renderType];
11
+ if (!Container) {
12
+ console.error('Container not found for renderType:', renderType);
13
+ return null;
14
+ }
15
+ return /*#__PURE__*/React.createElement(Container, cptProps, children);
16
+ };
17
+ export default PisellContainer;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { Options } from 'ahooks/es/useCountDown';
3
+ import { PisellContextType } from "../pisell-config-provider/context";
4
+ export declare type PisellCountdownProps = React.HTMLAttributes<HTMLSpanElement> & {
5
+ /** 平台 */
6
+ platform?: PisellContextType['platform'];
7
+ /** 剩余时间(毫秒) */
8
+ leftTime?: number;
9
+ /**
10
+ * 目标时间(如果同时传了 leftTime 和 targetDate,则会忽略 targetDate,以 leftTime 为主)
11
+ * 2024-12-31 00:00:00
12
+ * */
13
+ targetDate?: Options['targetDate'];
14
+ /** 倒计时时间变化时触发 */
15
+ onChange?: (val: number) => void;
16
+ /** 倒计时完成时触发 */
17
+ onFinish?: () => void;
18
+ /** 变化时间间隔(毫秒) */
19
+ interval?: number;
20
+ /** 格式化倒计时展示 参考 dayjs */
21
+ format?: string;
22
+ };
23
+ declare const PisellCountdown: (props: PisellCountdownProps) => React.JSX.Element;
24
+ export default PisellCountdown;
@@ -0,0 +1,44 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["leftTime", "targetDate", "interval", "onChange", "onFinish", "format"];
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
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 from 'react';
17
+ import { useCountDown, useUpdateEffect } from 'ahooks';
18
+ import { formatTimeStr } from "./utils";
19
+ var PisellCountdown = function PisellCountdown(props) {
20
+ var leftTime = props.leftTime,
21
+ targetDate = props.targetDate,
22
+ interval = props.interval,
23
+ onChange = props.onChange,
24
+ onFinish = props.onFinish,
25
+ _props$format = props.format,
26
+ format = _props$format === void 0 ? 'HH:mm:ss' : _props$format,
27
+ others = _objectWithoutProperties(props, _excluded);
28
+ var _useCountDown = useCountDown(_objectSpread(_objectSpread({}, leftTime ? {
29
+ leftTime: leftTime
30
+ } : {}), {}, {
31
+ targetDate: targetDate,
32
+ interval: interval,
33
+ onEnd: function onEnd() {
34
+ onFinish === null || onFinish === void 0 ? void 0 : onFinish();
35
+ }
36
+ })),
37
+ _useCountDown2 = _slicedToArray(_useCountDown, 1),
38
+ countdown = _useCountDown2[0];
39
+ useUpdateEffect(function () {
40
+ onChange === null || onChange === void 0 ? void 0 : onChange(countdown);
41
+ }, [countdown]);
42
+ return /*#__PURE__*/React.createElement("span", others, formatTimeStr(countdown, format || 'HH:mm:ss'));
43
+ };
44
+ export default PisellCountdown;
@@ -0,0 +1 @@
1
+ export declare function formatTimeStr(duration: number, format: string): string;
@@ -0,0 +1,35 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ var timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365], ['M', 1000 * 60 * 60 * 24 * 30], ['D', 1000 * 60 * 60 * 24], ['H', 1000 * 60 * 60], ['m', 1000 * 60], ['s', 1000], ['S', 1]];
8
+ export function formatTimeStr(duration, format) {
9
+ var leftDuration = duration;
10
+ var escapeRegex = /\[[^\]]*]/g;
11
+ var keepList = (format.match(escapeRegex) || []).map(function (str) {
12
+ return str.slice(1, -1);
13
+ });
14
+ var templateText = format.replace(escapeRegex, '[]');
15
+ var replacedText = timeUnits.reduce(function (current, _ref) {
16
+ var _ref2 = _slicedToArray(_ref, 2),
17
+ name = _ref2[0],
18
+ unit = _ref2[1];
19
+ if (current.includes(name)) {
20
+ var value = Math.floor(leftDuration / unit);
21
+ leftDuration -= value * unit;
22
+ return current.replace(new RegExp("".concat(name, "+"), 'g'), function (match) {
23
+ var len = match.length;
24
+ return value.toString().padStart(len, '0');
25
+ });
26
+ }
27
+ return current;
28
+ }, templateText);
29
+ var index = 0;
30
+ return replacedText.replace(escapeRegex, function () {
31
+ var match = keepList[index];
32
+ index += 1;
33
+ return match;
34
+ });
35
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { PickerDateProps } from 'antd/es/date-picker/generatePicker';
3
+ import { Dayjs } from 'dayjs';
4
+ import './detePickerCpt.less';
5
+ import { PisellContextType } from "../pisell-config-provider/context";
6
+ export interface DatePickerCptProps extends PickerDateProps<Dayjs> {
7
+ /** 平台 */
8
+ platform?: PisellContextType['platform'];
9
+ type: 'input' | 'select' | 'both';
10
+ }
11
+ declare const DatePickerCpt: (props: DatePickerCptProps) => React.JSX.Element;
12
+ export default DatePickerCpt;
@@ -0,0 +1,131 @@
1
+ var _excluded = ["format", "value", "onChange", "onDateChange"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ 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; }
4
+ 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; }
5
+ import React, { useEffect, useMemo } from 'react';
6
+ import { DatePicker, Input } from 'antd';
7
+ import "./detePickerCpt.less";
8
+ var isValidDate = function isValidDate(dateString, format) {
9
+ var date = window.dayjs(dateString, format, true);
10
+ return date.isValid();
11
+ };
12
+ var DatePickerInput = function DatePickerInput(props) {
13
+ var format = props.format,
14
+ value = props.value,
15
+ onChange = props.onChange,
16
+ onDateChange = props.onDateChange,
17
+ others = _objectWithoutProperties(props, _excluded);
18
+ var eventChange = function eventChange(val) {
19
+ onChange === null || onChange === void 0 ? void 0 : onChange({
20
+ target: {
21
+ value: val
22
+ }
23
+ });
24
+ if (isValidDate(val, format)) {
25
+ onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(window.dayjs(val, format), window.dayjs(val, format).format(format));
26
+ }
27
+ };
28
+ useEffect(function () {
29
+ document.body.id = 'body';
30
+ }, []);
31
+ var handleChange = function handleChange(e) {
32
+ var inputValue = e.target.value;
33
+ var parts = format.split(/[^a-zA-Z]/);
34
+ var separators = format.match(/[^a-zA-Z]+/g) || [];
35
+ if (inputValue.length < value.length) {
36
+ eventChange === null || eventChange === void 0 ? void 0 : eventChange(inputValue);
37
+ return;
38
+ }
39
+ var cursor = 0;
40
+ var result = '';
41
+ var lastIndex = 0;
42
+ for (var i = 0; i < parts.length; i++) {
43
+ var part = parts[i];
44
+ if (!part) continue;
45
+ var separator = separators[i] || '';
46
+ var expectedLength = part.length;
47
+ lastIndex = lastIndex + part.length + separator.length;
48
+
49
+ // 提取用户输入的部分
50
+ var start = cursor;
51
+ if (i > 0) {
52
+ start += separators.slice(0, i).join('').length;
53
+ }
54
+ var end = start + expectedLength;
55
+ var userPart = inputValue.slice(start, end);
56
+ if (userPart.length > 0) {
57
+ result += separators[i - 1] || '';
58
+ }
59
+ if (userPart.length === 0 && result.slice(result.length - 1) !== inputValue.slice(result.length - 1)) {
60
+ userPart = inputValue.slice(result.length - 1);
61
+ }
62
+ if (part.includes('Y')) {
63
+ result += userPart;
64
+ } else {
65
+ if (userPart.length === 1 && ['M', 'D', 'H', 'm', 's'].includes(part[0])) {
66
+ if ('M' === part[0] && userPart > 1) {
67
+ userPart = '0' + userPart;
68
+ }
69
+ if ('D' === part[0] && userPart > 3) {
70
+ userPart = '0' + userPart;
71
+ }
72
+ if ('H' === part[0] && userPart > 2) {
73
+ userPart = '0' + userPart;
74
+ }
75
+ if ('m' === part[0] && userPart > 7) {
76
+ userPart = '0' + userPart;
77
+ }
78
+ if ('s' === part[0] && userPart > 7) {
79
+ userPart = '0' + userPart;
80
+ }
81
+ }
82
+ result += userPart;
83
+ }
84
+ if (userPart.length === expectedLength && !inputValue.slice(lastIndex - 1).startsWith(separator)) {
85
+ result += separator;
86
+ }
87
+ cursor += userPart.length;
88
+ }
89
+ eventChange === null || eventChange === void 0 ? void 0 : eventChange(result);
90
+ };
91
+ return /*#__PURE__*/React.createElement(Input, _extends({}, others, {
92
+ value: value,
93
+ onChange: handleChange
94
+ }));
95
+ };
96
+ var DatePickerCpt = function DatePickerCpt(props) {
97
+ var format = props.format,
98
+ type = props.type,
99
+ onChange = props.onChange,
100
+ size = props.size,
101
+ picker = props.picker;
102
+ var propsObj = useMemo(function () {
103
+ if (picker && picker !== 'date') {
104
+ return {
105
+ inputRender: undefined
106
+ };
107
+ }
108
+ if (type === 'input') {
109
+ return {
110
+ popupClassName: 'pisell-date-picker-type-input',
111
+ suffixIcon: null,
112
+ placeholder: format || ""
113
+ };
114
+ } else if (type === 'select') {
115
+ return {
116
+ inputReadOnly: true
117
+ };
118
+ }
119
+ return {};
120
+ }, [type, picker, format]);
121
+ return /*#__PURE__*/React.createElement(DatePicker, _extends({}, props, {
122
+ size: size !== null && size !== void 0 ? size : 'large',
123
+ inputRender: function inputRender(props) {
124
+ return /*#__PURE__*/React.createElement(DatePickerInput, _extends({}, props, {
125
+ onDateChange: onChange,
126
+ format: format
127
+ }));
128
+ }
129
+ }, propsObj));
130
+ };
131
+ export default DatePickerCpt;
@@ -0,0 +1,3 @@
1
+ .pisell-date-picker-type-input {
2
+ display: none;
3
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const PisellDatePicker: (props: any) => import("react").JSX.Element;
3
+ export default PisellDatePicker;
@@ -0,0 +1,17 @@
1
+ import DatePickerCpt from "./datePickerCpt";
2
+ import { withMomentProps } from "../../utils/hoc";
3
+ import dayjs from 'dayjs';
4
+ import localeData from 'dayjs/plugin/localeData';
5
+ import weekday from 'dayjs/plugin/weekday';
6
+ dayjs.extend(weekday);
7
+ dayjs.extend(localeData);
8
+ var PisellDatePicker = withMomentProps(DatePickerCpt, ['defaultPickerValue', 'defaultValue', 'showTime.defaultValue', 'value']);
9
+
10
+ // const RangePicker = withMomentProps(OriginalRangePicker, [
11
+ // 'defaultPickerValue',
12
+ // 'defaultValue',
13
+ // 'showTime.defaultValue',
14
+ // 'value',
15
+ // ]);
16
+
17
+ export default PisellDatePicker;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { EmptyProps } from 'antd';
3
+ import { PisellContextType } from "../pisell-config-provider/context";
4
+ import './index.less';
5
+ export interface PisellEmptyProps extends EmptyProps {
6
+ /** 平台 */
7
+ platform?: PisellContextType['platform'];
8
+ /** 额外内容描述 */
9
+ extraDescription?: React.ReactNode;
10
+ /** 额外内容描述 */
11
+ icon?: React.ReactNode;
12
+ /** 自定义底部额外操作区域 */
13
+ footer?: React.ReactNode;
14
+ }
15
+ declare const PisellEmpty: (props: PisellEmptyProps) => React.JSX.Element;
16
+ export default PisellEmpty;
@@ -0,0 +1,38 @@
1
+ var _excluded = ["description", "extraDescription", "icon", "footer", "className"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ 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; }
4
+ 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; }
5
+ import React from 'react';
6
+ import { Empty } from 'antd';
7
+ import classNames from 'classnames';
8
+ import Inbox01 from '@pisell/icon/es/Inbox01';
9
+ import { getText } from "../../locales";
10
+ import "./index.less";
11
+ // 额外描述
12
+ var PisellEmpty = function PisellEmpty(props) {
13
+ var _props$description = props.description,
14
+ description = _props$description === void 0 ? getText('pisell-empty-description-no-data') : _props$description,
15
+ extraDescription = props.extraDescription,
16
+ icon = props.icon,
17
+ footer = props.footer,
18
+ className = props.className,
19
+ others = _objectWithoutProperties(props, _excluded);
20
+ return /*#__PURE__*/React.createElement(Empty, _extends({}, others, {
21
+ className: classNames('pisell-empty-wrap', className),
22
+ image: /*#__PURE__*/React.createElement("div", {
23
+ className: "pisell-empty-icon-wrap"
24
+ }, icon || /*#__PURE__*/React.createElement(Inbox01, {
25
+ style: {
26
+ color: '#667085'
27
+ }
28
+ })),
29
+ description: /*#__PURE__*/React.createElement("div", {
30
+ className: "pisell-empty-wrap-description-wrap"
31
+ }, /*#__PURE__*/React.createElement("div", {
32
+ className: "pisell-empty-wrap-description"
33
+ }, description), /*#__PURE__*/React.createElement("div", {
34
+ className: "pisell-empty-wrap-extra-description"
35
+ }, extraDescription))
36
+ }), footer);
37
+ };
38
+ export default PisellEmpty;
@@ -0,0 +1,34 @@
1
+ .pisell-empty-wrap {
2
+ margin: 50px auto;
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ .pisell-lowcode-empty-image {
7
+ height: auto;
8
+ margin-bottom: 0;
9
+ }
10
+ .pisell-empty-icon-wrap {
11
+ .anticon {
12
+ font-size: 44px !important;
13
+ }
14
+ }
15
+ .pisell-empty-wrap-description-wrap {
16
+ max-width: 300px;
17
+ .pisell-empty-wrap-description {
18
+ color: var(--Gray-500, #667085);
19
+ font-size: 14px;
20
+ font-style: normal;
21
+ font-weight: 600;
22
+ line-height: 20px; /* 142.857% */
23
+ margin: 12px 0;
24
+ }
25
+ .pisell-empty-wrap-extra-description {
26
+ color: var(--Gray-500, #667085);
27
+ text-align: center;
28
+ font-size: 14px;
29
+ font-style: normal;
30
+ font-weight: 400;
31
+ line-height: 20px; /* 142.857% */
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { InputProps } from 'antd';
3
+ import { PisellContextType } from "../../../pisell-config-provider/context";
4
+ import './index.less';
5
+ export declare type BankCardProps = InputProps & {
6
+ /** 平台 */
7
+ platform?: PisellContextType['platform'];
8
+ onChange?: (val: string) => void;
9
+ };
10
+ declare const BankCard: (props: BankCardProps) => React.JSX.Element;
11
+ export default BankCard;
@@ -0,0 +1,82 @@
1
+ var _excluded = ["onChange", "value"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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); }
6
+ 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; }
7
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ 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; }
10
+ 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; }
11
+ import React, { useEffect, useRef, useState } from 'react';
12
+ import Input from "../../../input";
13
+ import { bankTypeMap, getCardType } from "./utils";
14
+ import "./index.less";
15
+ var bankCardMaxLength = function bankCardMaxLength(str) {
16
+ return str.slice(0, 19);
17
+ };
18
+ var BankCard = function BankCard(props) {
19
+ var onChange = props.onChange,
20
+ propsValue = props.value,
21
+ others = _objectWithoutProperties(props, _excluded);
22
+ var inputRef = useRef(null);
23
+ var _useState = useState(propsValue || ''),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ _value = _useState2[0],
26
+ setValue = _useState2[1];
27
+ var _useState3 = useState(),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ currentBankType = _useState4[0],
30
+ setCurrentBankType = _useState4[1];
31
+
32
+ // const [state, setState] = useControllableValue<string>(props, {
33
+ // defaultValue: '',
34
+ // });
35
+
36
+ useEffect(function () {
37
+ document.body.id = 'body';
38
+ }, []);
39
+ useEffect(function () {
40
+ setValue(bankCardMaxLength(formatBankCardNumber("".concat(propsValue || ''))));
41
+ }, [propsValue]);
42
+ var formatBankCardNumber = function formatBankCardNumber(value) {
43
+ var cleanValue = value.replace(/\D/g, '');
44
+ var formattedValue = cleanValue.replace(/(.{4})/g, '$1 ').trim();
45
+ return formattedValue;
46
+ };
47
+ var handleChange = function handleChange(e) {
48
+ var _inputRef$current, _inputRef$current$inp;
49
+ var value = e.target.value;
50
+ setCurrentBankType(getCardType(value));
51
+ var formattedValue = formatBankCardNumber(value);
52
+ var start = ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$inp = _inputRef$current.input) === null || _inputRef$current$inp === void 0 ? void 0 : _inputRef$current$inp.selectionStart) || 0;
53
+ var val = bankCardMaxLength(formattedValue);
54
+ setValue(val);
55
+ onChange === null || onChange === void 0 ? void 0 : onChange(val.replace(/\s/g, ''));
56
+ if (formattedValue.length > 19 || formattedValue.length < _value.length) {
57
+ if ([4, 9, 14, 19].includes(start)) {
58
+ start = start + 1;
59
+ }
60
+ setTimeout(function () {
61
+ var _inputRef$current2;
62
+ (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.setSelectionRange(start, start);
63
+ });
64
+ }
65
+ };
66
+ return /*#__PURE__*/React.createElement(Input, _extends({}, others, {
67
+ suffix: currentBankType ? /*#__PURE__*/React.createElement("img", {
68
+ className: "pisell-input-bank-card-suffix",
69
+ src: bankTypeMap[currentBankType],
70
+ alt: currentBankType
71
+ }) : /*#__PURE__*/React.createElement("span", null)
72
+ // 数字类型时value无法带有空格
73
+ ,
74
+ type: "tel",
75
+ placeholder: 'XXXX XXXX XXXX XXXX',
76
+ size: "large",
77
+ ref: inputRef,
78
+ value: _value,
79
+ onChange: handleChange
80
+ }));
81
+ };
82
+ export default BankCard;
@@ -0,0 +1,4 @@
1
+ .pisell-input-bank-card-suffix {
2
+ width: 34px;
3
+ height: 24px;
4
+ }
@@ -0,0 +1,11 @@
1
+ export declare const getCardType: (str: string) => "jcb" | "amex" | "visa" | "masterCard" | "unionPay" | "discover" | undefined;
2
+ export declare const bankTypeMap: {
3
+ jcb: any;
4
+ amex: any;
5
+ masterCard: any;
6
+ visa: any;
7
+ unionPay: any;
8
+ discover: any;
9
+ };
10
+ export declare const getCardImgByType: (type: keyof typeof bankTypeMap) => any;
11
+ export declare const getBankCardTypeImg: (val: number | string) => any;
@@ -0,0 +1,65 @@
1
+ // @ts-ignore
2
+ import jcb from "./cardPng/JCB.png";
3
+ // @ts-ignore
4
+ import amex from "./cardPng/AMEX.png";
5
+ // @ts-ignore
6
+ import masterCard from "./cardPng/MasterCard.png";
7
+ // @ts-ignore
8
+ import visa from "./cardPng/VISA.png";
9
+ // @ts-ignore
10
+ import unionPay from "./cardPng/UnionPay.png";
11
+ // @ts-ignore
12
+ import discover from "./cardPng/Discover.png";
13
+ var isJcb = function isJcb(str) {
14
+ return str.startsWith('35');
15
+ };
16
+ var isAmex = function isAmex(str) {
17
+ return str.startsWith('34') || str.startsWith('37');
18
+ };
19
+ var isMasterCard = function isMasterCard(str) {
20
+ return str.startsWith('51') || str.startsWith('52') || str.startsWith('53') || str.startsWith('54') || str.startsWith('55') || str.startsWith('22') || str.startsWith('23') || str.startsWith('24') || str.startsWith('25') || str.startsWith('26') || str.startsWith('27');
21
+ };
22
+ var isVisa = function isVisa(str) {
23
+ return str.startsWith('4');
24
+ };
25
+ var isUnionPay = function isUnionPay(str) {
26
+ return str.startsWith('62') || str.startsWith('81');
27
+ };
28
+ var isDiscover = function isDiscover(str) {
29
+ return str.startsWith('60') || str.startsWith('64') || str.startsWith('65');
30
+ };
31
+ export var getCardType = function getCardType(str) {
32
+ if (isJcb(str)) {
33
+ return 'jcb';
34
+ }
35
+ if (isAmex(str)) {
36
+ return 'amex';
37
+ }
38
+ if (isVisa(str)) {
39
+ return 'visa';
40
+ }
41
+ if (isMasterCard(str)) {
42
+ return 'masterCard';
43
+ }
44
+ if (isUnionPay(str)) {
45
+ return 'unionPay';
46
+ }
47
+ if (isDiscover(str)) {
48
+ return 'discover';
49
+ }
50
+ };
51
+ export var bankTypeMap = {
52
+ jcb: jcb,
53
+ amex: amex,
54
+ masterCard: masterCard,
55
+ visa: visa,
56
+ unionPay: unionPay,
57
+ discover: discover
58
+ };
59
+ export var getCardImgByType = function getCardImgByType(type) {
60
+ return bankTypeMap[type] || "";
61
+ };
62
+ export var getBankCardTypeImg = function getBankCardTypeImg(val) {
63
+ var type = getCardType("".concat(val || ''));
64
+ return type ? bankTypeMap[type] : null;
65
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { InputProps, ButtonProps } from 'antd';
3
+ import { PisellContextType } from "../../../pisell-config-provider/context";
4
+ export interface CopyProps extends InputProps {
5
+ /** 平台 */
6
+ platform?: PisellContextType['platform'];
7
+ /** 后缀button的透传配置 */
8
+ buttonProps?: ButtonProps;
9
+ }
10
+ declare const Copy: (props: CopyProps) => React.JSX.Element;
11
+ export default Copy;