@pisell/materials 2.2.13 → 2.2.14

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 (342) hide show
  1. package/build/lowcode/assets-daily.json +13 -13
  2. package/build/lowcode/assets-dev.json +4 -4
  3. package/build/lowcode/assets-prod.json +13 -13
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +29 -27
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +22 -20
  11. package/es/components/button/index.d.ts +4 -3
  12. package/es/components/button/index.js +14 -3
  13. package/es/components/iconfont/index.d.ts +2 -1
  14. package/es/components/iconfont/index.js +1 -1
  15. package/es/components/page/index.css +0 -0
  16. package/es/components/page/index.d.ts +2 -2
  17. package/es/components/page/index.js +226 -186
  18. package/es/components/pisell-config-provider/context.d.ts +20 -0
  19. package/es/components/pisell-config-provider/context.js +36 -0
  20. package/es/components/pisell-config-provider/hooks/usePisellConfig.d.ts +5 -0
  21. package/es/components/pisell-config-provider/hooks/usePisellConfig.js +11 -0
  22. package/es/components/pisell-config-provider/index.d.ts +12 -0
  23. package/es/components/pisell-config-provider/index.js +36 -0
  24. package/es/components/pisellAlert/index.d.ts +22 -0
  25. package/es/components/pisellAlert/index.js +73 -0
  26. package/es/components/pisellAlert/index.less +149 -0
  27. package/es/components/pisellCard/index.d.ts +12 -0
  28. package/es/components/pisellCard/index.js +16 -0
  29. package/es/components/pisellCard/index.less +9 -0
  30. package/es/components/pisellCardList/index.d.ts +43 -0
  31. package/es/components/pisellCardList/index.js +72 -0
  32. package/es/components/pisellCardList/index.less +75 -0
  33. package/es/components/pisellCheckboxGroup/index.d.ts +34 -0
  34. package/es/components/pisellCheckboxGroup/index.js +173 -0
  35. package/es/components/pisellCheckboxGroup/index.less +36 -0
  36. package/es/components/pisellCheckboxGroup/mock.d.ts +4 -0
  37. package/es/components/pisellCheckboxGroup/mock.js +16 -0
  38. package/es/components/pisellContainer/components/Portal/index.d.ts +10 -0
  39. package/es/components/pisellContainer/components/Portal/index.js +7 -0
  40. package/es/components/pisellContainer/containers.d.ts +1 -0
  41. package/es/components/pisellContainer/containers.js +8 -0
  42. package/es/components/pisellContainer/index.d.ts +22 -0
  43. package/es/components/pisellContainer/index.js +19 -0
  44. package/es/components/pisellCountdown/index.d.ts +24 -0
  45. package/es/components/pisellCountdown/index.js +44 -0
  46. package/es/components/pisellCountdown/utils.d.ts +7 -0
  47. package/es/components/pisellCountdown/utils.js +50 -0
  48. package/es/components/pisellDatePicker/datePickerCpt.d.ts +22 -0
  49. package/es/components/pisellDatePicker/datePickerCpt.js +191 -0
  50. package/es/components/pisellDatePicker/detePickerCpt.less +22 -0
  51. package/es/components/pisellDatePicker/index.d.ts +3 -0
  52. package/es/components/pisellDatePicker/index.js +17 -0
  53. package/es/components/pisellEmpty/index.d.ts +16 -0
  54. package/es/components/pisellEmpty/index.js +38 -0
  55. package/es/components/pisellEmpty/index.less +34 -0
  56. package/es/components/pisellInformationEntry/Input/index.d.ts +8 -0
  57. package/es/components/pisellInformationEntry/Input/index.js +50 -0
  58. package/es/components/pisellInformationEntry/Input/index.less +14 -0
  59. package/es/components/pisellInformationEntry/Scan/index.d.ts +8 -0
  60. package/es/components/pisellInformationEntry/Scan/index.js +25 -0
  61. package/es/components/pisellInformationEntry/Scan/index.less +8 -0
  62. package/es/components/pisellInformationEntry/constants.d.ts +3 -0
  63. package/es/components/pisellInformationEntry/constants.js +21 -0
  64. package/es/components/pisellInformationEntry/index.d.ts +31 -0
  65. package/es/components/pisellInformationEntry/index.js +188 -0
  66. package/es/components/pisellInformationEntry/index.less +40 -0
  67. package/es/components/pisellInformationEntry/utils.d.ts +4 -0
  68. package/es/components/pisellInformationEntry/utils.js +38 -0
  69. package/es/components/pisellInput/components/BankCard/cardPng/AMEX.png +0 -0
  70. package/es/components/pisellInput/components/BankCard/cardPng/Discover.png +0 -0
  71. package/es/components/pisellInput/components/BankCard/cardPng/JCB.png +0 -0
  72. package/es/components/pisellInput/components/BankCard/cardPng/MasterCard.png +0 -0
  73. package/es/components/pisellInput/components/BankCard/cardPng/UnionPay.png +0 -0
  74. package/es/components/pisellInput/components/BankCard/cardPng/VISA.png +0 -0
  75. package/es/components/pisellInput/components/BankCard/index.d.ts +11 -0
  76. package/es/components/pisellInput/components/BankCard/index.js +82 -0
  77. package/es/components/pisellInput/components/BankCard/index.less +4 -0
  78. package/es/components/pisellInput/components/BankCard/utils.d.ts +11 -0
  79. package/es/components/pisellInput/components/BankCard/utils.js +65 -0
  80. package/es/components/pisellInput/components/Copy/index.d.ts +11 -0
  81. package/es/components/pisellInput/components/Copy/index.js +53 -0
  82. package/es/components/pisellInput/components/SecurityCode/card.png +0 -0
  83. package/es/components/pisellInput/components/SecurityCode/index.d.ts +12 -0
  84. package/es/components/pisellInput/components/SecurityCode/index.js +46 -0
  85. package/es/components/pisellInput/components/SecurityCode/index.less +4 -0
  86. package/es/components/pisellInput/index.d.ts +13 -0
  87. package/es/components/pisellInput/index.js +15 -0
  88. package/es/components/pisellLoading/index.d.ts +18 -0
  89. package/es/components/pisellLoading/index.js +45 -0
  90. package/es/components/pisellLoading/index.less +35 -0
  91. package/es/components/pisellMessage/index.d.ts +4 -0
  92. package/es/components/pisellMessage/index.js +5 -0
  93. package/es/components/pisellModal/components/Information/index.d.ts +21 -0
  94. package/es/components/pisellModal/components/Information/index.js +25 -0
  95. package/es/components/pisellModal/components/Information/index.less +16 -0
  96. package/es/components/pisellModal/components/IpadModal/index.d.ts +6 -0
  97. package/es/components/pisellModal/components/IpadModal/index.js +6 -0
  98. package/es/components/pisellModal/components/MobileModal/index.d.ts +9 -0
  99. package/es/components/pisellModal/components/MobileModal/index.js +27 -0
  100. package/es/components/pisellModal/components/MobileModal/index.less +60 -0
  101. package/es/components/pisellModal/components/PcModal/index.d.ts +30 -0
  102. package/es/components/pisellModal/components/PcModal/index.js +129 -0
  103. package/es/components/pisellModal/components/PcModal/index.less +105 -0
  104. package/es/components/pisellModal/components/functions/index.d.ts +12 -0
  105. package/es/components/pisellModal/components/functions/index.js +44 -0
  106. package/es/components/pisellModal/components/functions/index.less +25 -0
  107. package/es/components/pisellModal/components/index.d.ts +10 -0
  108. package/es/components/pisellModal/components/index.js +9 -0
  109. package/es/components/pisellModal/constants.d.ts +6 -0
  110. package/es/components/pisellModal/constants.js +6 -0
  111. package/es/components/pisellModal/index.d.ts +43 -0
  112. package/es/components/pisellModal/index.js +30 -0
  113. package/es/components/pisellRow/index.d.ts +22 -0
  114. package/es/components/pisellRow/index.js +67 -0
  115. package/es/components/pisellRow/index.less +13 -0
  116. package/es/components/pisellScan/index.d.ts +21 -0
  117. package/es/components/pisellScan/index.js +80 -0
  118. package/es/components/pisellScan/index.less +12 -0
  119. package/es/components/pisellText/components/Amount/index.d.ts +18 -0
  120. package/es/components/pisellText/components/Amount/index.js +25 -0
  121. package/es/components/pisellText/index.d.ts +8 -0
  122. package/es/components/pisellText/index.js +7 -0
  123. package/es/components/pisellToast/index.d.ts +16 -0
  124. package/es/components/pisellToast/index.js +32 -0
  125. package/es/components/pisellToast/index.less +26 -0
  126. package/es/components/pisellTooltip/index.d.ts +10 -0
  127. package/es/components/pisellTooltip/index.js +15 -0
  128. package/es/components/pisellTooltip/index.less +5 -0
  129. package/es/components/pisellWalletPassCard/bg.jpeg +0 -0
  130. package/es/components/pisellWalletPassCard/index.d.ts +54 -0
  131. package/es/components/pisellWalletPassCard/index.js +93 -0
  132. package/es/components/pisellWalletPassCard/index.less +100 -0
  133. package/es/hooks/useCssVariables.d.ts +8 -0
  134. package/es/hooks/useCssVariables.js +21 -0
  135. package/es/index.d.ts +23 -0
  136. package/es/index.js +26 -1
  137. package/es/locales/en-US.d.ts +9 -0
  138. package/es/locales/en-US.js +13 -1
  139. package/es/locales/index.js +3 -1
  140. package/es/locales/zh-CN.d.ts +9 -0
  141. package/es/locales/zh-CN.js +13 -1
  142. package/es/locales/zh-TW.d.ts +9 -0
  143. package/es/locales/zh-TW.js +13 -1
  144. package/es/utils/index.d.ts +1 -0
  145. package/es/utils/index.js +15 -1
  146. package/es/utils/locale.js +2 -1
  147. package/lib/components/button/index.d.ts +4 -3
  148. package/lib/components/button/index.js +13 -9
  149. package/lib/components/iconfont/index.d.ts +2 -1
  150. package/lib/components/iconfont/index.js +1 -1
  151. package/lib/components/page/index.css +0 -0
  152. package/lib/components/page/index.d.ts +2 -2
  153. package/lib/components/page/index.js +201 -161
  154. package/lib/components/pisell-config-provider/context.d.ts +20 -0
  155. package/lib/components/pisell-config-provider/context.js +49 -0
  156. package/lib/components/pisell-config-provider/hooks/usePisellConfig.d.ts +5 -0
  157. package/lib/components/pisell-config-provider/hooks/usePisellConfig.js +31 -0
  158. package/lib/components/pisell-config-provider/index.d.ts +12 -0
  159. package/lib/components/pisell-config-provider/index.js +69 -0
  160. package/lib/components/pisellAlert/index.d.ts +22 -0
  161. package/lib/components/pisellAlert/index.js +95 -0
  162. package/lib/components/pisellAlert/index.less +149 -0
  163. package/lib/components/pisellCard/index.d.ts +12 -0
  164. package/lib/components/pisellCard/index.js +48 -0
  165. package/lib/components/pisellCard/index.less +9 -0
  166. package/lib/components/pisellCardList/index.d.ts +43 -0
  167. package/lib/components/pisellCardList/index.js +108 -0
  168. package/lib/components/pisellCardList/index.less +75 -0
  169. package/lib/components/pisellCheckboxGroup/index.d.ts +34 -0
  170. package/lib/components/pisellCheckboxGroup/index.js +150 -0
  171. package/lib/components/pisellCheckboxGroup/index.less +36 -0
  172. package/lib/components/pisellCheckboxGroup/mock.d.ts +4 -0
  173. package/lib/components/pisellCheckboxGroup/mock.js +35 -0
  174. package/lib/components/pisellContainer/components/Portal/index.d.ts +10 -0
  175. package/lib/components/pisellContainer/components/Portal/index.js +40 -0
  176. package/lib/components/pisellContainer/containers.d.ts +1 -0
  177. package/lib/components/pisellContainer/containers.js +46 -0
  178. package/lib/components/pisellContainer/index.d.ts +22 -0
  179. package/lib/components/pisellContainer/index.js +49 -0
  180. package/lib/components/pisellCountdown/index.d.ts +24 -0
  181. package/lib/components/pisellCountdown/index.js +63 -0
  182. package/lib/components/pisellCountdown/utils.d.ts +7 -0
  183. package/lib/components/pisellCountdown/utils.js +60 -0
  184. package/lib/components/pisellDatePicker/datePickerCpt.d.ts +22 -0
  185. package/lib/components/pisellDatePicker/datePickerCpt.js +157 -0
  186. package/lib/components/pisellDatePicker/detePickerCpt.less +22 -0
  187. package/lib/components/pisellDatePicker/index.d.ts +3 -0
  188. package/lib/components/pisellDatePicker/index.js +48 -0
  189. package/lib/components/pisellEmpty/index.d.ts +16 -0
  190. package/lib/components/pisellEmpty/index.js +61 -0
  191. package/lib/components/pisellEmpty/index.less +34 -0
  192. package/lib/components/pisellInformationEntry/Input/index.d.ts +8 -0
  193. package/lib/components/pisellInformationEntry/Input/index.js +56 -0
  194. package/lib/components/pisellInformationEntry/Input/index.less +14 -0
  195. package/lib/components/pisellInformationEntry/Scan/index.d.ts +8 -0
  196. package/lib/components/pisellInformationEntry/Scan/index.js +64 -0
  197. package/lib/components/pisellInformationEntry/Scan/index.less +8 -0
  198. package/lib/components/pisellInformationEntry/constants.d.ts +3 -0
  199. package/lib/components/pisellInformationEntry/constants.js +49 -0
  200. package/lib/components/pisellInformationEntry/index.d.ts +31 -0
  201. package/lib/components/pisellInformationEntry/index.js +162 -0
  202. package/lib/components/pisellInformationEntry/index.less +40 -0
  203. package/lib/components/pisellInformationEntry/utils.d.ts +4 -0
  204. package/lib/components/pisellInformationEntry/utils.js +40 -0
  205. package/lib/components/pisellInput/components/BankCard/cardPng/AMEX.png +0 -0
  206. package/lib/components/pisellInput/components/BankCard/cardPng/Discover.png +0 -0
  207. package/lib/components/pisellInput/components/BankCard/cardPng/JCB.png +0 -0
  208. package/lib/components/pisellInput/components/BankCard/cardPng/MasterCard.png +0 -0
  209. package/lib/components/pisellInput/components/BankCard/cardPng/UnionPay.png +0 -0
  210. package/lib/components/pisellInput/components/BankCard/cardPng/VISA.png +0 -0
  211. package/lib/components/pisellInput/components/BankCard/index.d.ts +11 -0
  212. package/lib/components/pisellInput/components/BankCard/index.js +98 -0
  213. package/lib/components/pisellInput/components/BankCard/index.less +4 -0
  214. package/lib/components/pisellInput/components/BankCard/utils.d.ts +11 -0
  215. package/lib/components/pisellInput/components/BankCard/utils.js +103 -0
  216. package/lib/components/pisellInput/components/Copy/index.d.ts +11 -0
  217. package/lib/components/pisellInput/components/Copy/index.js +61 -0
  218. package/lib/components/pisellInput/components/SecurityCode/card.png +0 -0
  219. package/lib/components/pisellInput/components/SecurityCode/index.d.ts +12 -0
  220. package/lib/components/pisellInput/components/SecurityCode/index.js +74 -0
  221. package/lib/components/pisellInput/components/SecurityCode/index.less +4 -0
  222. package/lib/components/pisellInput/index.d.ts +13 -0
  223. package/lib/components/pisellInput/index.js +46 -0
  224. package/lib/components/pisellLoading/index.d.ts +18 -0
  225. package/lib/components/pisellLoading/index.js +69 -0
  226. package/lib/components/pisellLoading/index.less +35 -0
  227. package/lib/components/pisellMessage/index.d.ts +4 -0
  228. package/lib/components/pisellMessage/index.js +34 -0
  229. package/lib/components/pisellModal/components/Information/index.d.ts +21 -0
  230. package/lib/components/pisellModal/components/Information/index.js +54 -0
  231. package/lib/components/pisellModal/components/Information/index.less +16 -0
  232. package/lib/components/pisellModal/components/IpadModal/index.d.ts +6 -0
  233. package/lib/components/pisellModal/components/IpadModal/index.js +40 -0
  234. package/lib/components/pisellModal/components/MobileModal/index.d.ts +9 -0
  235. package/lib/components/pisellModal/components/MobileModal/index.js +67 -0
  236. package/lib/components/pisellModal/components/MobileModal/index.less +60 -0
  237. package/lib/components/pisellModal/components/PcModal/index.d.ts +30 -0
  238. package/lib/components/pisellModal/components/PcModal/index.js +143 -0
  239. package/lib/components/pisellModal/components/PcModal/index.less +105 -0
  240. package/lib/components/pisellModal/components/functions/index.d.ts +12 -0
  241. package/lib/components/pisellModal/components/functions/index.js +90 -0
  242. package/lib/components/pisellModal/components/functions/index.less +25 -0
  243. package/lib/components/pisellModal/components/index.d.ts +10 -0
  244. package/lib/components/pisellModal/components/index.js +52 -0
  245. package/lib/components/pisellModal/constants.d.ts +6 -0
  246. package/lib/components/pisellModal/constants.js +33 -0
  247. package/lib/components/pisellModal/index.d.ts +43 -0
  248. package/lib/components/pisellModal/index.js +63 -0
  249. package/lib/components/pisellRow/index.d.ts +22 -0
  250. package/lib/components/pisellRow/index.js +82 -0
  251. package/lib/components/pisellRow/index.less +13 -0
  252. package/lib/components/pisellScan/index.d.ts +21 -0
  253. package/lib/components/pisellScan/index.js +100 -0
  254. package/lib/components/pisellScan/index.less +12 -0
  255. package/lib/components/pisellText/components/Amount/index.d.ts +18 -0
  256. package/lib/components/pisellText/components/Amount/index.js +64 -0
  257. package/lib/components/pisellText/index.d.ts +8 -0
  258. package/lib/components/pisellText/index.js +41 -0
  259. package/lib/components/pisellToast/index.d.ts +16 -0
  260. package/lib/components/pisellToast/index.js +59 -0
  261. package/lib/components/pisellToast/index.less +26 -0
  262. package/lib/components/pisellTooltip/index.d.ts +10 -0
  263. package/lib/components/pisellTooltip/index.js +53 -0
  264. package/lib/components/pisellTooltip/index.less +5 -0
  265. package/lib/components/pisellWalletPassCard/bg.jpeg +0 -0
  266. package/lib/components/pisellWalletPassCard/index.d.ts +54 -0
  267. package/lib/components/pisellWalletPassCard/index.js +101 -0
  268. package/lib/components/pisellWalletPassCard/index.less +100 -0
  269. package/lib/hooks/useCssVariables.d.ts +8 -0
  270. package/lib/hooks/useCssVariables.js +36 -0
  271. package/lib/index.d.ts +23 -0
  272. package/lib/index.js +71 -0
  273. package/lib/locales/en-US.d.ts +9 -0
  274. package/lib/locales/en-US.js +13 -1
  275. package/lib/locales/index.js +3 -1
  276. package/lib/locales/zh-CN.d.ts +9 -0
  277. package/lib/locales/zh-CN.js +13 -1
  278. package/lib/locales/zh-TW.d.ts +9 -0
  279. package/lib/locales/zh-TW.js +13 -1
  280. package/lib/utils/index.d.ts +1 -0
  281. package/lib/utils/index.js +16 -0
  282. package/lib/utils/locale.js +2 -1
  283. package/lowcode/_utils/transform-meta.ts +31 -10
  284. package/lowcode/button/__screenshots__/pisell-modal-information.png +0 -0
  285. package/lowcode/button/meta.ts +30 -0
  286. package/lowcode/button/snippets.ts +28 -0
  287. package/lowcode/information-modal/meta.ts +1931 -0
  288. package/lowcode/modal/meta.ts +1 -1
  289. package/lowcode/page/meta.ts +8 -1
  290. package/lowcode/pisell-alert/meta.ts +117 -0
  291. package/lowcode/pisell-alert/snippets.ts +50 -0
  292. package/lowcode/pisell-card/__screenshots__/card-1.png +0 -0
  293. package/lowcode/pisell-card/meta.ts +100 -0
  294. package/lowcode/pisell-card/snippets.ts +10 -0
  295. package/lowcode/pisell-card-list/meta.ts +145 -0
  296. package/lowcode/pisell-card-list/snippets.ts +9 -0
  297. package/lowcode/pisell-checkbox-group/meta.ts +112 -0
  298. package/lowcode/pisell-checkbox-group/snippets.ts +13 -0
  299. package/lowcode/pisell-container/meta.ts +71 -0
  300. package/lowcode/pisell-container/snippets.ts +14 -0
  301. package/lowcode/pisell-countdown/meta.ts +71 -0
  302. package/lowcode/pisell-countdown/snippets.ts +12 -0
  303. package/lowcode/pisell-date-picker/meta.ts +76 -0
  304. package/lowcode/pisell-date-picker/snippets.ts +9 -0
  305. package/lowcode/pisell-empty/__screenshots__/empty-1.png +0 -0
  306. package/lowcode/pisell-empty/meta.ts +85 -0
  307. package/lowcode/pisell-empty/snippets.ts +10 -0
  308. package/lowcode/pisell-information-entry/meta.ts +131 -0
  309. package/lowcode/pisell-information-entry/snippets.ts +17 -0
  310. package/lowcode/pisell-input/__screenshots__/input-1.png +0 -0
  311. package/lowcode/pisell-input/meta.ts +193 -0
  312. package/lowcode/pisell-input/snippets.ts +11 -0
  313. package/lowcode/pisell-input.bank-card-input/__screenshots__/pisell-input.bank-card-input.png +0 -0
  314. package/lowcode/pisell-input.bank-card-input/meta.ts +62 -0
  315. package/lowcode/pisell-input.bank-card-input/snippets.ts +11 -0
  316. package/lowcode/pisell-input.copy/meta.ts +73 -0
  317. package/lowcode/pisell-input.copy/snippets.ts +10 -0
  318. package/lowcode/pisell-input.security-code/__screenshots__/pisell-input.security-code.png +0 -0
  319. package/lowcode/pisell-input.security-code/meta.ts +92 -0
  320. package/lowcode/pisell-input.security-code/snippets.ts +11 -0
  321. package/lowcode/pisell-loading/meta.ts +98 -0
  322. package/lowcode/pisell-loading/snippets.ts +11 -0
  323. package/lowcode/pisell-modal/__screenshots__/modal-1.png +0 -0
  324. package/lowcode/pisell-modal/__screenshots__/modal-2.png +0 -0
  325. package/lowcode/pisell-modal/meta.ts +200 -0
  326. package/lowcode/pisell-modal/snippets.ts +38 -0
  327. package/lowcode/pisell-modal.information/__screenshots__/pisell-modal.information.png +0 -0
  328. package/lowcode/pisell-modal.information/meta.ts +116 -0
  329. package/lowcode/pisell-modal.information/snippets.ts +17 -0
  330. package/lowcode/pisell-row/meta.ts +127 -0
  331. package/lowcode/pisell-row/snippets.ts +24 -0
  332. package/lowcode/pisell-scan/meta.ts +53 -0
  333. package/lowcode/pisell-scan/snippets.ts +13 -0
  334. package/lowcode/pisell-text/meta.ts +8117 -0
  335. package/lowcode/pisell-text.amount/meta.ts +61 -0
  336. package/lowcode/pisell-text.amount/snippets.ts +15 -0
  337. package/lowcode/pisell-tooltip/__screenshots__/tooltip-1.jpg +0 -0
  338. package/lowcode/pisell-tooltip/meta.ts +306 -0
  339. package/lowcode/pisell-tooltip/snippets.ts +12 -0
  340. package/lowcode/pisell-wallet-pass-card/meta.ts +189 -0
  341. package/lowcode/pisell-wallet-pass-card/snippets.ts +20 -0
  342. package/package.json +4 -3
@@ -0,0 +1,173 @@
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 = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "iconPosition", "optionClassName", "optionActiveClassName"];
3
+ 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); }
4
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ 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); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ 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."); }
11
+ 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); }
12
+ 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; }
13
+ 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; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+ 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; }
16
+ 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; }
17
+ import React, { useEffect, useMemo } from 'react';
18
+ import usePisellConfig from "../pisell-config-provider/hooks/usePisellConfig";
19
+ import classNames from 'classnames';
20
+ import { Checkbox, Radio } from 'antd';
21
+ import { isNumber } from '@pisell/utils';
22
+ import { changeArray } from '@pisell/utils';
23
+ import "./index.less";
24
+ import { useState } from 'react';
25
+ import PisellRow from "../pisellRow";
26
+ import { mockList } from "./mock";
27
+
28
+ // 列表选项
29
+
30
+ /**
31
+ * @title: PisellCheckboxGroup
32
+ * @description: 选中组件
33
+ * @param {PisellCheckboxGroupProps} props
34
+ * @return {*}
35
+ * @Author: zhiwei.Wang
36
+ * @Date: 2024-08-16 10:34
37
+ */
38
+ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
39
+ var config = usePisellConfig();
40
+ var platform = props.platform,
41
+ _props$gap = props.gap,
42
+ gap = _props$gap === void 0 ? 10 : _props$gap,
43
+ style = props.style,
44
+ _props$options = props.options,
45
+ options = _props$options === void 0 ? mockList : _props$options,
46
+ onChange = props.onChange,
47
+ value = props.value,
48
+ _props$renderOption = props.renderOption,
49
+ renderOption = _props$renderOption === void 0 ? function (option) {
50
+ return option.label;
51
+ } : _props$renderOption,
52
+ _props$padding = props.padding,
53
+ padding = _props$padding === void 0 ? 0 : _props$padding,
54
+ _props$rowKey = props.rowKey,
55
+ rowKey = _props$rowKey === void 0 ? 'value' : _props$rowKey,
56
+ _props$mode = props.mode,
57
+ mode = _props$mode === void 0 ? 'multiple' : _props$mode,
58
+ _props$iconPosition = props.iconPosition,
59
+ iconPosition = _props$iconPosition === void 0 ? 'left' : _props$iconPosition,
60
+ optionClassName = props.optionClassName,
61
+ optionActiveClassName = props.optionActiveClassName,
62
+ rest = _objectWithoutProperties(props, _excluded);
63
+ var _useState = useState([]),
64
+ _useState2 = _slicedToArray(_useState, 2),
65
+ _value = _useState2[0],
66
+ set_value = _useState2[1];
67
+
68
+ // 当value 发生变化时, 将外部value 处理成内部value
69
+ useEffect(function () {
70
+ initValue();
71
+ }, [value]);
72
+
73
+ /**
74
+ * @title: 转换value到内部
75
+ * @description:
76
+ * @return {*}
77
+ * @Author: zhiwei.Wang
78
+ * @Date: 2024-01-30 16:45
79
+ */
80
+ var initValue = function initValue() {
81
+ var _val = value;
82
+ // 没有value 格式化空数组
83
+ if (!value) {
84
+ _val = [];
85
+ } else {
86
+ // 不是数组的话, 转换成数组
87
+ if (!Array.isArray(value)) {
88
+ _val = [value];
89
+ }
90
+ }
91
+ set_value(_val);
92
+ };
93
+
94
+ // 样式
95
+ var _style = useMemo(function () {
96
+ // 间隔
97
+ var gapVal = isNumber(gap) ? gap + 'px' : gap;
98
+
99
+ // 内边距
100
+ var paddingVal = isNumber(padding) ? padding + 'px' : padding;
101
+ var obj = _objectSpread({
102
+ gap: gapVal,
103
+ padding: paddingVal
104
+ }, style);
105
+ return obj;
106
+ }, [style, gap, padding]);
107
+
108
+ /**
109
+ * @title: 统一外部onChange
110
+ * @description:
111
+ * @return {*}
112
+ * @Author: zhiwei.Wang
113
+ * @Date: 2024-08-16 10:35
114
+ */
115
+ var _onChange = function _onChange(val, item) {
116
+ // 单选模式, 只返回第一个值
117
+ onChange === null || onChange === void 0 ? void 0 : onChange(mode === 'single' ? val[0] : val, item);
118
+ };
119
+
120
+ /**
121
+ * @title: 选择
122
+ * @description:
123
+ * @param {any} item
124
+ * @return {*}
125
+ * @Author: zhiwei.Wang
126
+ * @Date: 2024-01-30 16:46
127
+ */
128
+ var handleSelectItem = function handleSelectItem(key, item) {
129
+ var newVal = [key];
130
+
131
+ // 多选进行合并
132
+ if (mode === 'multiple') {
133
+ newVal = changeArray(_value, key, 'this');
134
+ }
135
+
136
+ // 返回外部
137
+ _onChange(newVal, item);
138
+
139
+ // 设置内部值
140
+ set_value(newVal);
141
+ };
142
+
143
+ // 根据mode 切换不同的组件
144
+ var CheckBoxItem = mode === 'multiple' ? Checkbox : Radio;
145
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
146
+ className: classNames('pisell-checkbox-group', rest.className),
147
+ style: _style
148
+ }), options.map(function (option) {
149
+ var active = _value.includes(option[rowKey]);
150
+ return /*#__PURE__*/React.createElement(PisellRow, {
151
+ className: classNames('pisell-checkbox-group-item', optionClassName, _defineProperty({
152
+ 'pisell-checkbox-group-item-active': active
153
+ }, optionActiveClassName, active)),
154
+ key: option[rowKey],
155
+ gap: 10,
156
+ onClick: function onClick() {
157
+ if (option.disabled) return;
158
+ handleSelectItem(option[rowKey], option);
159
+ },
160
+ leftContent: iconPosition === 'left' && /*#__PURE__*/React.createElement(CheckBoxItem, {
161
+ checked: active,
162
+ className: "pisell-checkbox-group-item-checkbox"
163
+ }),
164
+ rightContent: iconPosition === 'right' && /*#__PURE__*/React.createElement(CheckBoxItem, {
165
+ checked: active,
166
+ className: "pisell-checkbox-group-item-checkbox"
167
+ }),
168
+ centerContent: renderOption === null || renderOption === void 0 ? void 0 : renderOption(option, active),
169
+ centerContentFill: true
170
+ });
171
+ }));
172
+ };
173
+ export default PisellCheckboxGroup;
@@ -0,0 +1,36 @@
1
+ .pisell-checkbox-group {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
+
6
+ .pisell-checkbox-group-item {
7
+ width: 100%;
8
+ cursor: pointer;
9
+ border-radius: 12px;
10
+ position: relative;
11
+
12
+ &::before {
13
+ content: '';
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ width: 100%;
18
+ height: 100%;
19
+ border-radius: 12px;
20
+ border: 1px solid var(--Gray-200, #EAECF0);
21
+ z-index: 2;
22
+ }
23
+
24
+ &.pisell-checkbox-group-item-active {
25
+ &::before {
26
+ border-width: 2px;
27
+ border-color: var(--theme-color);
28
+ }
29
+
30
+ }
31
+ }
32
+ }
33
+
34
+ .pisell-checkbox-group-item-checkbox {
35
+ margin: 0;
36
+ }
@@ -0,0 +1,4 @@
1
+ export declare const mockList: {
2
+ label: string;
3
+ value: string;
4
+ }[];
@@ -0,0 +1,16 @@
1
+ export var mockList = [{
2
+ label: "Option 1",
3
+ value: "1"
4
+ }, {
5
+ label: "Option 2",
6
+ value: "2"
7
+ }, {
8
+ label: "Option 3",
9
+ value: "3"
10
+ }, {
11
+ label: "Option 4",
12
+ value: "4"
13
+ }, {
14
+ label: "Option 5",
15
+ value: "5"
16
+ }];
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { PisellContextType } from "../../../pisell-config-provider/context";
3
+ export interface PortalProps {
4
+ /** 平台 */
5
+ platform?: PisellContextType['platform'];
6
+ children?: React.ReactNode;
7
+ container: HTMLElement | null;
8
+ }
9
+ declare const Portal: React.FC<PortalProps>;
10
+ export default Portal;
@@ -0,0 +1,7 @@
1
+ import ReactDOM from 'react-dom';
2
+ var Portal = function Portal(props) {
3
+ var children = props.children,
4
+ container = props.container;
5
+ return /*#__PURE__*/ReactDOM.createPortal(children, container || document.body);
6
+ };
7
+ export default Portal;
@@ -0,0 +1 @@
1
+ export declare const containers: Record<string, any>;
@@ -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,19 @@
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
+
8
+ /** undefined | "" | null 渲染到当前位置 */
9
+ if (!renderType) {
10
+ return children;
11
+ }
12
+ var Container = containers[renderType];
13
+ if (!Container) {
14
+ console.error('Container not found for renderType:', renderType);
15
+ return null;
16
+ }
17
+ return /*#__PURE__*/React.createElement(Container, cptProps, children);
18
+ };
19
+ 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,7 @@
1
+ /**
2
+ * 格式化时间字符串函数
3
+ * 该函数将给定的持续时间(以秒为单位)格式化为指定格式的时间字符串
4
+ * @param duration - 持续时间,单位为秒。
5
+ * @param format - 时间格式字符串,其中包含要显示的时间单位及其格式。例如:"[HH] hours, [mm] minutes, [ss] seconds"。
6
+ */
7
+ export declare function formatTimeStr(duration: number, format: string): string;
@@ -0,0 +1,50 @@
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
+
9
+ /**
10
+ * 格式化时间字符串函数
11
+ * 该函数将给定的持续时间(以秒为单位)格式化为指定格式的时间字符串
12
+ * @param duration - 持续时间,单位为秒。
13
+ * @param format - 时间格式字符串,其中包含要显示的时间单位及其格式。例如:"[HH] hours, [mm] minutes, [ss] seconds"。
14
+ */
15
+ export function formatTimeStr(duration, format) {
16
+ // 剩余的持续时间,初始值为输入的持续时间
17
+ var leftDuration = duration;
18
+
19
+ // 匹配格式字符串中带方括号的部分,例如 "[HH]"、"[mm]",以便后续处理
20
+ var escapeRegex = /\[[^\]]*]/g;
21
+ // 从格式字符串中提取带方括号的部分,并去掉方括号
22
+ var keepList = (format.match(escapeRegex) || []).map(function (str) {
23
+ return str.slice(1, -1);
24
+ });
25
+ // 用 "[]" 替换格式字符串中的带方括号的部分
26
+ var templateText = format.replace(escapeRegex, '[]');
27
+ var replacedText = timeUnits.reduce(function (current, _ref) {
28
+ var _ref2 = _slicedToArray(_ref, 2),
29
+ name = _ref2[0],
30
+ unit = _ref2[1];
31
+ if (current.includes(name)) {
32
+ // 计算当前时间单位的值
33
+ var value = Math.floor(leftDuration / unit);
34
+ // 更新剩余时间
35
+ leftDuration -= value * unit;
36
+ // 用数字填充替换格式字符串中的时间单位
37
+ return current.replace(new RegExp("".concat(name, "+"), 'g'), function (match) {
38
+ var len = match.length;
39
+ return value.toString().padStart(len, '0');
40
+ });
41
+ }
42
+ return current;
43
+ }, templateText);
44
+ var index = 0;
45
+ return replacedText.replace(escapeRegex, function () {
46
+ var match = keepList[index];
47
+ index += 1;
48
+ return match;
49
+ });
50
+ }
@@ -0,0 +1,22 @@
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
+ /** 当前类型
10
+ * input 仅输入
11
+ * select 仅选择
12
+ * both 输入和选择
13
+ * */
14
+ type: 'input' | 'select' | 'both';
15
+ }
16
+ /**
17
+ * 当前日期组件实例
18
+ * @param props
19
+ * @constructor
20
+ */
21
+ declare const DatePickerCpt: (props: DatePickerCptProps) => React.JSX.Element;
22
+ export default DatePickerCpt;
@@ -0,0 +1,191 @@
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, { useMemo } from 'react';
6
+ import { DatePicker, Input } from 'antd';
7
+ import "./detePickerCpt.less";
8
+ /**
9
+ * 校验时间字符串是否符合格式
10
+ * @param dateString
11
+ * @param format
12
+ */
13
+ var isValidDate = function isValidDate(dateString, format) {
14
+ var date = window.dayjs(dateString, format, true);
15
+ return date.isValid();
16
+ };
17
+ var DatePickerInput = function DatePickerInput(props) {
18
+ var format = props.format,
19
+ value = props.value,
20
+ onChange = props.onChange,
21
+ onDateChange = props.onDateChange,
22
+ others = _objectWithoutProperties(props, _excluded);
23
+
24
+ /**
25
+ * 数据输入变更事件
26
+ * @param val
27
+ */
28
+ var eventChange = function eventChange(val) {
29
+ onChange === null || onChange === void 0 ? void 0 : onChange({
30
+ target: {
31
+ value: val
32
+ }
33
+ });
34
+ if (isValidDate(val, format)) {
35
+ onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(window.dayjs(val, format), window.dayjs(val, format).format(format));
36
+ }
37
+ };
38
+ var handleChange = function handleChange(e) {
39
+ var inputValue = e.target.value;
40
+
41
+ // 禁止特殊字符时
42
+ if (!/^[\d/]*$/.test(inputValue)) {
43
+ return;
44
+ }
45
+
46
+ // 根据 format 字符串,将字母部分分离开来
47
+ var parts = format.split(/[^a-zA-Z]/);
48
+
49
+ // 提取 format 中的分隔符
50
+ var separators = format.match(/[^a-zA-Z]+/g) || [];
51
+
52
+ // 如果输入值长度小于之前的值,说明用户正在删除字符,直接触发 eventChange 事件
53
+ if (inputValue.length < value.length) {
54
+ eventChange === null || eventChange === void 0 ? void 0 : eventChange(inputValue);
55
+ return;
56
+ }
57
+
58
+ // 光标位置,用于跟踪当前输入的位置
59
+ var cursor = 0;
60
+ // 格式化后的结果
61
+ var result = '';
62
+ // 记录上一个分隔符后的索引位置
63
+ var lastIndex = 0;
64
+
65
+ // 遍历格式化字符串的部分
66
+ for (var i = 0; i < parts.length; i++) {
67
+ // 当前字母部分
68
+ var part = parts[i];
69
+ // 如果部分为空,则跳过
70
+ if (!part) continue;
71
+
72
+ // 当前部分的分隔符
73
+ var separator = separators[i] || '';
74
+ // 当前部分的期望长度
75
+ var expectedLength = part.length;
76
+
77
+ // 更新 lastIndex 到当前部分末尾(加上分隔符长度)
78
+ lastIndex = lastIndex + part.length + separator.length;
79
+
80
+ // 计算当前部分的起始和结束位置
81
+ var start = cursor;
82
+ if (i > 0) {
83
+ start += separators.slice(0, i).join('').length;
84
+ }
85
+ var end = start + expectedLength;
86
+ // 从用户输入中提取对应部分
87
+ var userPart = inputValue.slice(start, end);
88
+
89
+ // 如果当前部分有输入,添加前一个分隔符
90
+ if (userPart.length > 0) {
91
+ result += separators[i - 1] || '';
92
+ }
93
+
94
+ // 如果当前部分没有输入且格式化结果的最后一个字符不同于输入值的对应字符
95
+ if (userPart.length === 0 && result.slice(result.length - 1) !== inputValue.slice(result.length - 1)) {
96
+ userPart = inputValue.slice(result.length - 1);
97
+ }
98
+
99
+ // 如果当前部分包含 'Y'(表示年份等),直接添加用户输入
100
+ if (part.includes('Y')) {
101
+ result += userPart;
102
+ } else {
103
+ // 对日期时间部分的特殊处理(如月份、日期等)
104
+ if (userPart.length === 1 && ['M', 'D', 'H', 'm', 's'].includes(part[0])) {
105
+ if ('M' === part[0] && userPart > 1) {
106
+ // 月份第一位如果大于1,前面加 '0'
107
+ userPart = '0' + userPart;
108
+ }
109
+ if ('D' === part[0] && userPart > 3) {
110
+ // 日期第一位如果大于3,前面加 '0'
111
+ userPart = '0' + userPart;
112
+ }
113
+ if ('H' === part[0] && userPart > 2) {
114
+ // 小时第一位如果大于2,前面加 '0'
115
+ userPart = '0' + userPart;
116
+ }
117
+ if ('m' === part[0] && userPart > 7) {
118
+ // 分钟第一位如果大于7,前面加 '0'
119
+ userPart = '0' + userPart;
120
+ }
121
+ if ('s' === part[0] && userPart > 7) {
122
+ // 秒数第一位如果大于7,前面加 '0'
123
+ userPart = '0' + userPart;
124
+ }
125
+ }
126
+ result += userPart;
127
+ }
128
+
129
+ // 如果当前部分长度达到期望且下一个字符不是分隔符,则添加分隔符
130
+ if (userPart.length === expectedLength && !inputValue.slice(lastIndex - 1).startsWith(separator)) {
131
+ result += separator;
132
+ }
133
+ // 更新光标位置
134
+ cursor += userPart.length;
135
+ }
136
+ eventChange === null || eventChange === void 0 ? void 0 : eventChange(result);
137
+ };
138
+ return /*#__PURE__*/React.createElement(Input, _extends({}, others, {
139
+ type: "tel",
140
+ value: value,
141
+ onChange: handleChange
142
+ }));
143
+ };
144
+
145
+ /**
146
+ * 当前日期组件实例
147
+ * @param props
148
+ * @constructor
149
+ */
150
+ var DatePickerCpt = function DatePickerCpt(props) {
151
+ var format = props.format,
152
+ type = props.type,
153
+ onChange = props.onChange,
154
+ size = props.size,
155
+ picker = props.picker;
156
+
157
+ /**
158
+ * 不同类型时注入参数
159
+ */
160
+ var propsObj = useMemo(function () {
161
+ if (picker && picker !== 'date') {
162
+ return {
163
+ inputRender: undefined
164
+ };
165
+ }
166
+ if (type === 'input') {
167
+ return {
168
+ popupClassName: 'pisell-date-picker-type-input',
169
+ suffixIcon: null,
170
+ placeholder: format || ""
171
+ };
172
+ } else if (type === 'select') {
173
+ return {
174
+ inputReadOnly: true
175
+ };
176
+ }
177
+ return {};
178
+ }, [type, picker, format]);
179
+ return /*#__PURE__*/React.createElement(DatePicker, _extends({}, props, {
180
+ className: 'pisell-date-picker'
181
+ // size={size ?? 'large'}
182
+ ,
183
+ inputRender: function inputRender(props) {
184
+ return /*#__PURE__*/React.createElement(DatePickerInput, _extends({}, props, {
185
+ onDateChange: onChange,
186
+ format: format
187
+ }));
188
+ }
189
+ }, propsObj));
190
+ };
191
+ export default DatePickerCpt;