linkmore-design 1.0.62 → 1.0.66

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 (386) hide show
  1. package/README.md +1 -1
  2. package/dist/Approval/demos/basic.d.ts +2 -0
  3. package/dist/Approval/index.d.ts +24 -0
  4. package/dist/Approval/style/index.d.ts +1 -0
  5. package/dist/AutoComplete/demos/basic.d.ts +3 -0
  6. package/dist/AutoComplete/index.d.ts +30 -0
  7. package/dist/AutoComplete/style/index.d.ts +1 -0
  8. package/dist/Avatar/demos/basic.d.ts +2 -0
  9. package/dist/Avatar/index.d.ts +3 -0
  10. package/dist/Avatar/style/index.d.ts +1 -0
  11. package/dist/Breadcrumb/demos/basic.d.ts +2 -0
  12. package/dist/Breadcrumb/demos/basic1.d.ts +2 -0
  13. package/dist/Breadcrumb/index.d.ts +4 -0
  14. package/dist/Breadcrumb/style/index.d.ts +1 -0
  15. package/dist/CardTable/utils.d.ts +1 -1
  16. package/dist/Col/demos/basic.d.ts +2 -0
  17. package/dist/Col/index.d.ts +3 -0
  18. package/dist/Col/style/index.d.ts +1 -0
  19. package/dist/Form/index.d.ts +1 -1
  20. package/dist/Grid/RowContext.d.ts +8 -0
  21. package/dist/Grid/col.d.ts +28 -0
  22. package/dist/Grid/demos/basic.d.ts +2 -0
  23. package/dist/Grid/hooks/useBreakpoint.d.ts +3 -0
  24. package/dist/Grid/index.d.ts +11 -0
  25. package/dist/Grid/row.d.ts +14 -0
  26. package/dist/Grid/style/index.d.ts +1 -0
  27. package/dist/Layout/demos/basic.d.ts +2 -0
  28. package/dist/Layout/index.d.ts +4 -0
  29. package/dist/Layout/style/index.d.ts +1 -0
  30. package/dist/LmEditTable/EditTable.d.ts +4 -1
  31. package/dist/LmEditTable/demos/colsort.d.ts +2 -0
  32. package/dist/LmEditTable/demos/size.d.ts +2 -0
  33. package/dist/LmEditTable/sortableBoxCol.d.ts +5 -0
  34. package/dist/LmEditTable/sortableItemCol.d.ts +1 -0
  35. package/dist/LmFilter/components/CustomSelectFilter.d.ts +4 -0
  36. package/dist/LmFilter/customFilter/drawer.d.ts +4 -0
  37. package/dist/LmFilter/customFilter/saveModal.d.ts +4 -0
  38. package/dist/LmFilter/customFilter/valueDrawer.d.ts +4 -0
  39. package/dist/LmFilter/filterFns/index.d.ts +35 -17
  40. package/dist/LmFilter/utils.d.ts +2 -0
  41. package/dist/Mentions/demos/basic.d.ts +2 -0
  42. package/dist/Mentions/index.d.ts +3 -0
  43. package/dist/Mentions/style/index.d.ts +1 -0
  44. package/dist/PageHeader/demos/basic.d.ts +2 -0
  45. package/dist/PageHeader/index.d.ts +24 -0
  46. package/dist/PageHeader/style/index.d.ts +1 -0
  47. package/dist/Popover/demos/basic.d.ts +2 -0
  48. package/dist/Popover/demos/basic1.d.ts +2 -0
  49. package/dist/Popover/index.d.ts +11 -0
  50. package/dist/Popover/style/index.d.ts +1 -0
  51. package/dist/Rate/demos/basic.d.ts +2 -0
  52. package/dist/Rate/index.d.ts +3 -0
  53. package/dist/Rate/style/index.d.ts +1 -0
  54. package/dist/Row/demos/basic.d.ts +2 -0
  55. package/dist/Row/index.d.ts +3 -0
  56. package/dist/Row/style/index.d.ts +1 -0
  57. package/dist/Steps/demos/basic.d.ts +2 -0
  58. package/dist/Steps/index.d.ts +3 -0
  59. package/dist/Steps/style/index.d.ts +1 -0
  60. package/dist/Tooltip/index.d.ts +43 -1
  61. package/dist/Typography/Base/Ellipsis.d.ts +14 -0
  62. package/dist/Typography/Base/EllipsisTooltip.d.ts +13 -0
  63. package/dist/Typography/Base/index.d.ts +54 -0
  64. package/dist/Typography/Editable.d.ts +20 -0
  65. package/dist/Typography/Link.d.ts +7 -0
  66. package/dist/Typography/Paragraph.d.ts +7 -0
  67. package/dist/Typography/Text.d.ts +8 -0
  68. package/dist/Typography/Title.d.ts +9 -0
  69. package/dist/Typography/Typography.d.ts +11 -0
  70. package/dist/Typography/demos/basic.d.ts +2 -0
  71. package/dist/Typography/hooks/useMergedConfig.d.ts +1 -0
  72. package/dist/Typography/hooks/useUpdatedEffect.d.ts +3 -0
  73. package/dist/Typography/index.d.ts +15 -0
  74. package/dist/Typography/style/index.d.ts +1 -0
  75. package/dist/_util/colors.d.ts +5 -0
  76. package/dist/_util/getRenderPropValue.d.ts +3 -0
  77. package/dist/_util/hooks/useFlexGapSupport.d.ts +2 -0
  78. package/dist/_util/hooks/useForceUpdate.d.ts +2 -0
  79. package/dist/_util/placements.d.ts +16 -0
  80. package/dist/_util/responsiveObserve.d.ts +21 -0
  81. package/dist/_util/styleChecker.d.ts +4 -0
  82. package/dist/_util/transButton.d.ts +9 -0
  83. package/dist/index.d.ts +14 -0
  84. package/dist/index.umd.js +17449 -8958
  85. package/dist/index.umd.min.js +6 -6
  86. package/es/Approval/index.d.ts +24 -0
  87. package/es/Approval/index.js +210 -0
  88. package/es/Approval/style/index.css +592 -0
  89. package/es/Approval/style/index.d.ts +1 -0
  90. package/es/Approval/style/index.js +1 -0
  91. package/es/AutoComplete/index.d.ts +30 -0
  92. package/es/AutoComplete/index.js +101 -0
  93. package/es/AutoComplete/style/index.css +505 -0
  94. package/es/AutoComplete/style/index.d.ts +1 -0
  95. package/es/AutoComplete/style/index.js +1 -0
  96. package/es/Avatar/index.d.ts +3 -0
  97. package/es/Avatar/index.js +3 -0
  98. package/es/Avatar/style/index.css +505 -0
  99. package/es/Avatar/style/index.d.ts +1 -0
  100. package/es/Avatar/style/index.js +1 -0
  101. package/es/Breadcrumb/index.d.ts +4 -0
  102. package/es/Breadcrumb/index.js +3 -0
  103. package/es/Breadcrumb/style/index.css +505 -0
  104. package/es/Breadcrumb/style/index.d.ts +1 -0
  105. package/es/Breadcrumb/style/index.js +1 -0
  106. package/es/Col/README.md.old +22 -0
  107. package/es/Col/index.d.ts +3 -0
  108. package/es/Col/index.js +2 -0
  109. package/es/Col/style/index.css +505 -0
  110. package/es/Col/style/index.d.ts +1 -0
  111. package/es/Col/style/index.js +1 -0
  112. package/es/EditTable/README.md.old +66 -0
  113. package/es/Form/container.js +17 -1
  114. package/es/Form/index.d.ts +1 -1
  115. package/es/Form/index.js +5 -2
  116. package/es/Form/style/index.css +32 -17
  117. package/es/Grid/RowContext.d.ts +8 -0
  118. package/es/Grid/RowContext.js +3 -0
  119. package/es/Grid/col.d.ts +28 -0
  120. package/es/Grid/col.js +112 -0
  121. package/es/Grid/hooks/useBreakpoint.d.ts +3 -0
  122. package/es/Grid/hooks/useBreakpoint.js +24 -0
  123. package/es/Grid/index.d.ts +11 -0
  124. package/es/Grid/index.js +14 -0
  125. package/es/Grid/row.d.ts +14 -0
  126. package/es/Grid/row.js +142 -0
  127. package/es/Grid/style/index.css +505 -0
  128. package/es/Grid/style/index.d.ts +1 -0
  129. package/es/Grid/style/index.js +1 -0
  130. package/es/Layout/index.d.ts +4 -0
  131. package/es/Layout/index.js +3 -0
  132. package/es/Layout/style/index.css +505 -0
  133. package/es/Layout/style/index.d.ts +1 -0
  134. package/es/Layout/style/index.js +1 -0
  135. package/es/LmEditTable/EditTable.d.ts +4 -1
  136. package/es/LmEditTable/EditTable.js +241 -59
  137. package/es/LmEditTable/sortableBoxCol.d.ts +5 -0
  138. package/es/LmEditTable/sortableBoxCol.js +13 -0
  139. package/es/LmEditTable/sortableItemCol.d.ts +1 -0
  140. package/es/LmEditTable/sortableItemCol.js +48 -0
  141. package/es/LmFilter/{icon_placeholder.png → assets/empty.png} +0 -0
  142. package/es/LmFilter/clearFilter/index.js +3 -5
  143. package/es/LmFilter/complexFilter/drawer.js +26 -9
  144. package/es/LmFilter/components/CheckboxFilter.js +1 -1
  145. package/es/LmFilter/components/CustomSelectFilter.js +139 -0
  146. package/es/LmFilter/components/EmptyFilter.js +2 -2
  147. package/es/LmFilter/components/SelectFilter.js +15 -6
  148. package/es/LmFilter/components/index.js +9 -2
  149. package/es/LmFilter/customFilter/drawer.js +427 -0
  150. package/es/LmFilter/customFilter/index.js +107 -2
  151. package/es/LmFilter/customFilter/saveModal.js +187 -0
  152. package/es/LmFilter/customFilter/valueDrawer.js +238 -0
  153. package/es/LmFilter/filterFns/index.js +316 -70
  154. package/es/LmFilter/style/{style.css → index.css} +61 -6
  155. package/es/LmFilter/style/index.js +1 -1
  156. package/es/LmFilter/utils.js +34 -0
  157. package/es/LmFilter/wrapper/FilterRoot.js +63 -49
  158. package/es/Mentions/index.d.ts +3 -0
  159. package/es/Mentions/index.js +3 -0
  160. package/es/Mentions/style/index.css +505 -0
  161. package/es/Mentions/style/index.d.ts +1 -0
  162. package/es/Mentions/style/index.js +1 -0
  163. package/es/PageHeader/index.d.ts +24 -0
  164. package/es/PageHeader/index.js +169 -0
  165. package/es/PageHeader/style/index.css +505 -0
  166. package/es/PageHeader/style/index.d.ts +1 -0
  167. package/es/PageHeader/style/index.js +1 -0
  168. package/es/Popover/index.d.ts +11 -0
  169. package/es/Popover/index.js +63 -0
  170. package/es/Popover/style/index.css +505 -0
  171. package/es/Popover/style/index.d.ts +1 -0
  172. package/es/Popover/style/index.js +1 -0
  173. package/es/Rate/index.d.ts +3 -0
  174. package/es/Rate/index.js +3 -0
  175. package/es/Rate/style/index.css +505 -0
  176. package/es/Rate/style/index.d.ts +1 -0
  177. package/es/Rate/style/index.js +1 -0
  178. package/es/Row/README.md.old +22 -0
  179. package/es/Row/index.d.ts +3 -0
  180. package/es/Row/index.js +2 -0
  181. package/es/Row/style/index.css +505 -0
  182. package/es/Row/style/index.d.ts +1 -0
  183. package/es/Row/style/index.js +1 -0
  184. package/es/Steps/index.d.ts +3 -0
  185. package/es/Steps/index.js +3 -0
  186. package/es/Steps/style/index.css +505 -0
  187. package/es/Steps/style/index.d.ts +1 -0
  188. package/es/Steps/style/index.js +1 -0
  189. package/es/Tooltip/index.d.ts +43 -1
  190. package/es/Tooltip/index.js +236 -1
  191. package/es/Typography/Base/Ellipsis.d.ts +14 -0
  192. package/es/Typography/Base/Ellipsis.js +197 -0
  193. package/es/Typography/Base/EllipsisTooltip.d.ts +13 -0
  194. package/es/Typography/Base/EllipsisTooltip.js +23 -0
  195. package/es/Typography/Base/index.d.ts +54 -0
  196. package/es/Typography/Base/index.js +509 -0
  197. package/es/Typography/Editable.d.ts +20 -0
  198. package/es/Typography/Editable.js +117 -0
  199. package/es/Typography/Link.d.ts +7 -0
  200. package/es/Typography/Link.js +43 -0
  201. package/es/Typography/Paragraph.d.ts +7 -0
  202. package/es/Typography/Paragraph.js +12 -0
  203. package/es/Typography/Text.d.ts +8 -0
  204. package/es/Typography/Text.js +41 -0
  205. package/es/Typography/Title.d.ts +9 -0
  206. package/es/Typography/Title.js +41 -0
  207. package/es/Typography/Typography.d.ts +11 -0
  208. package/es/Typography/Typography.js +61 -0
  209. package/es/Typography/hooks/useMergedConfig.d.ts +1 -0
  210. package/es/Typography/hooks/useMergedConfig.js +8 -0
  211. package/es/Typography/hooks/useUpdatedEffect.d.ts +3 -0
  212. package/es/Typography/hooks/useUpdatedEffect.js +13 -0
  213. package/es/Typography/index.d.ts +15 -0
  214. package/es/Typography/index.js +14 -0
  215. package/es/Typography/style/index.css +505 -0
  216. package/es/Typography/style/index.d.ts +1 -0
  217. package/es/Typography/style/index.js +1 -0
  218. package/es/_util/colors.d.ts +5 -0
  219. package/es/_util/colors.js +4 -0
  220. package/es/_util/getRenderPropValue.d.ts +3 -0
  221. package/es/_util/getRenderPropValue.js +13 -0
  222. package/es/_util/hooks/useFlexGapSupport.d.ts +2 -0
  223. package/es/_util/hooks/useFlexGapSupport.js +14 -0
  224. package/es/_util/hooks/useForceUpdate.d.ts +2 -0
  225. package/es/_util/hooks/useForceUpdate.js +11 -0
  226. package/es/_util/placements.d.ts +16 -0
  227. package/es/_util/placements.js +87 -0
  228. package/es/_util/responsiveObserve.d.ts +21 -0
  229. package/es/_util/responsiveObserve.js +66 -0
  230. package/es/_util/styleChecker.d.ts +4 -0
  231. package/es/_util/styleChecker.js +31 -0
  232. package/es/_util/transButton.d.ts +9 -0
  233. package/es/_util/transButton.js +73 -0
  234. package/es/index.d.ts +14 -0
  235. package/es/index.js +8 -1
  236. package/lib/Approval/index.d.ts +24 -0
  237. package/lib/Approval/index.js +223 -0
  238. package/lib/Approval/style/index.css +592 -0
  239. package/lib/Approval/style/index.d.ts +1 -0
  240. package/lib/Approval/style/index.js +3 -0
  241. package/lib/AutoComplete/index.d.ts +30 -0
  242. package/lib/AutoComplete/index.js +125 -0
  243. package/lib/AutoComplete/style/index.css +505 -0
  244. package/lib/AutoComplete/style/index.d.ts +1 -0
  245. package/lib/AutoComplete/style/index.js +3 -0
  246. package/lib/Avatar/index.d.ts +3 -0
  247. package/lib/Avatar/index.js +15 -0
  248. package/lib/Avatar/style/index.css +505 -0
  249. package/lib/Avatar/style/index.d.ts +1 -0
  250. package/lib/Avatar/style/index.js +3 -0
  251. package/lib/Breadcrumb/index.d.ts +4 -0
  252. package/lib/Breadcrumb/index.js +15 -0
  253. package/lib/Breadcrumb/style/index.css +505 -0
  254. package/lib/Breadcrumb/style/index.d.ts +1 -0
  255. package/lib/Breadcrumb/style/index.js +3 -0
  256. package/lib/Col/README.md.old +22 -0
  257. package/lib/Col/index.d.ts +3 -0
  258. package/lib/Col/index.js +11 -0
  259. package/lib/Col/style/index.css +505 -0
  260. package/lib/Col/style/index.d.ts +1 -0
  261. package/lib/Col/style/index.js +3 -0
  262. package/lib/EditTable/README.md.old +66 -0
  263. package/lib/Form/container.js +17 -1
  264. package/lib/Form/index.d.ts +1 -1
  265. package/lib/Form/index.js +5 -2
  266. package/lib/Form/style/index.css +32 -17
  267. package/lib/Grid/RowContext.d.ts +8 -0
  268. package/lib/Grid/RowContext.js +12 -0
  269. package/lib/Grid/col.d.ts +28 -0
  270. package/lib/Grid/col.js +128 -0
  271. package/lib/Grid/hooks/useBreakpoint.d.ts +3 -0
  272. package/lib/Grid/hooks/useBreakpoint.js +37 -0
  273. package/lib/Grid/index.d.ts +11 -0
  274. package/lib/Grid/index.js +45 -0
  275. package/lib/Grid/row.d.ts +14 -0
  276. package/lib/Grid/row.js +164 -0
  277. package/lib/Grid/style/index.css +505 -0
  278. package/lib/Grid/style/index.d.ts +1 -0
  279. package/lib/Grid/style/index.js +3 -0
  280. package/lib/Layout/index.d.ts +4 -0
  281. package/lib/Layout/index.js +15 -0
  282. package/lib/Layout/style/index.css +505 -0
  283. package/lib/Layout/style/index.d.ts +1 -0
  284. package/lib/Layout/style/index.js +3 -0
  285. package/lib/LmEditTable/EditTable.d.ts +4 -1
  286. package/lib/LmEditTable/EditTable.js +242 -60
  287. package/lib/LmEditTable/sortableBoxCol.d.ts +5 -0
  288. package/lib/LmEditTable/sortableBoxCol.js +24 -0
  289. package/lib/LmEditTable/sortableItemCol.d.ts +1 -0
  290. package/lib/LmEditTable/sortableItemCol.js +61 -0
  291. package/lib/LmFilter/{icon_placeholder.png → assets/empty.png} +0 -0
  292. package/lib/LmFilter/clearFilter/index.js +3 -5
  293. package/lib/LmFilter/complexFilter/drawer.js +26 -9
  294. package/lib/LmFilter/components/CheckboxFilter.js +1 -1
  295. package/lib/LmFilter/components/CustomSelectFilter.js +139 -0
  296. package/lib/LmFilter/components/EmptyFilter.js +2 -2
  297. package/lib/LmFilter/components/SelectFilter.js +15 -6
  298. package/lib/LmFilter/components/index.js +9 -2
  299. package/lib/LmFilter/customFilter/drawer.js +427 -0
  300. package/lib/LmFilter/customFilter/index.js +107 -2
  301. package/lib/LmFilter/customFilter/saveModal.js +187 -0
  302. package/lib/LmFilter/customFilter/valueDrawer.js +238 -0
  303. package/lib/LmFilter/filterFns/index.js +316 -70
  304. package/lib/LmFilter/style/{style.css → index.css} +61 -6
  305. package/lib/LmFilter/style/index.js +1 -1
  306. package/lib/LmFilter/utils.js +34 -0
  307. package/lib/LmFilter/wrapper/FilterRoot.js +63 -49
  308. package/lib/Mentions/index.d.ts +3 -0
  309. package/lib/Mentions/index.js +15 -0
  310. package/lib/Mentions/style/index.css +505 -0
  311. package/lib/Mentions/style/index.d.ts +1 -0
  312. package/lib/Mentions/style/index.js +3 -0
  313. package/lib/PageHeader/index.d.ts +24 -0
  314. package/lib/PageHeader/index.js +194 -0
  315. package/lib/PageHeader/style/index.css +505 -0
  316. package/lib/PageHeader/style/index.d.ts +1 -0
  317. package/lib/PageHeader/style/index.js +3 -0
  318. package/lib/Popover/index.d.ts +11 -0
  319. package/lib/Popover/index.js +81 -0
  320. package/lib/Popover/style/index.css +505 -0
  321. package/lib/Popover/style/index.d.ts +1 -0
  322. package/lib/Popover/style/index.js +3 -0
  323. package/lib/Rate/index.d.ts +3 -0
  324. package/lib/Rate/index.js +15 -0
  325. package/lib/Rate/style/index.css +505 -0
  326. package/lib/Rate/style/index.d.ts +1 -0
  327. package/lib/Rate/style/index.js +3 -0
  328. package/lib/Row/README.md.old +22 -0
  329. package/lib/Row/index.d.ts +3 -0
  330. package/lib/Row/index.js +11 -0
  331. package/lib/Row/style/index.css +505 -0
  332. package/lib/Row/style/index.d.ts +1 -0
  333. package/lib/Row/style/index.js +3 -0
  334. package/lib/Steps/index.d.ts +3 -0
  335. package/lib/Steps/index.js +15 -0
  336. package/lib/Steps/style/index.css +505 -0
  337. package/lib/Steps/style/index.d.ts +1 -0
  338. package/lib/Steps/style/index.js +3 -0
  339. package/lib/Tooltip/index.d.ts +43 -1
  340. package/lib/Tooltip/index.js +247 -1
  341. package/lib/Typography/Base/Ellipsis.d.ts +14 -0
  342. package/lib/Typography/Base/Ellipsis.js +212 -0
  343. package/lib/Typography/Base/EllipsisTooltip.d.ts +13 -0
  344. package/lib/Typography/Base/EllipsisTooltip.js +36 -0
  345. package/lib/Typography/Base/index.d.ts +54 -0
  346. package/lib/Typography/Base/index.js +545 -0
  347. package/lib/Typography/Editable.d.ts +20 -0
  348. package/lib/Typography/Editable.js +137 -0
  349. package/lib/Typography/Link.d.ts +7 -0
  350. package/lib/Typography/Link.js +58 -0
  351. package/lib/Typography/Paragraph.d.ts +7 -0
  352. package/lib/Typography/Paragraph.js +26 -0
  353. package/lib/Typography/Text.d.ts +8 -0
  354. package/lib/Typography/Text.js +57 -0
  355. package/lib/Typography/Title.d.ts +9 -0
  356. package/lib/Typography/Title.js +58 -0
  357. package/lib/Typography/Typography.d.ts +11 -0
  358. package/lib/Typography/Typography.js +77 -0
  359. package/lib/Typography/hooks/useMergedConfig.d.ts +1 -0
  360. package/lib/Typography/hooks/useMergedConfig.js +21 -0
  361. package/lib/Typography/hooks/useUpdatedEffect.d.ts +3 -0
  362. package/lib/Typography/hooks/useUpdatedEffect.js +24 -0
  363. package/lib/Typography/index.d.ts +15 -0
  364. package/lib/Typography/index.js +31 -0
  365. package/lib/Typography/style/index.css +505 -0
  366. package/lib/Typography/style/index.d.ts +1 -0
  367. package/lib/Typography/style/index.js +3 -0
  368. package/lib/_util/colors.d.ts +5 -0
  369. package/lib/_util/colors.js +14 -0
  370. package/lib/_util/getRenderPropValue.d.ts +3 -0
  371. package/lib/_util/getRenderPropValue.js +22 -0
  372. package/lib/_util/hooks/useFlexGapSupport.d.ts +2 -0
  373. package/lib/_util/hooks/useFlexGapSupport.js +30 -0
  374. package/lib/_util/hooks/useForceUpdate.d.ts +2 -0
  375. package/lib/_util/hooks/useForceUpdate.js +24 -0
  376. package/lib/_util/placements.d.ts +16 -0
  377. package/lib/_util/placements.js +98 -0
  378. package/lib/_util/responsiveObserve.d.ts +21 -0
  379. package/lib/_util/responsiveObserve.js +79 -0
  380. package/lib/_util/styleChecker.d.ts +4 -0
  381. package/lib/_util/styleChecker.js +52 -0
  382. package/lib/_util/transButton.d.ts +9 -0
  383. package/lib/_util/transButton.js +87 -0
  384. package/lib/index.d.ts +14 -0
  385. package/lib/index.js +57 -1
  386. package/package.json +2 -2
@@ -0,0 +1,545 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
+
16
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
+
18
+ var _CheckOutlined = _interopRequireDefault(require("@ant-design/icons/CheckOutlined"));
19
+
20
+ var _CopyOutlined = _interopRequireDefault(require("@ant-design/icons/CopyOutlined"));
21
+
22
+ var _EditOutlined = _interopRequireDefault(require("@ant-design/icons/EditOutlined"));
23
+
24
+ var _classnames = _interopRequireDefault(require("classnames"));
25
+
26
+ var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard"));
27
+
28
+ var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
29
+
30
+ var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
31
+
32
+ var _useLayoutEffect = _interopRequireDefault(require("rc-util/lib/hooks/useLayoutEffect"));
33
+
34
+ var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
35
+
36
+ var _omit = _interopRequireDefault(require("rc-util/lib/omit"));
37
+
38
+ var _ref3 = require("rc-util/lib/ref");
39
+
40
+ var React = _interopRequireWildcard(require("react"));
41
+
42
+ var _configProvider = require("antd/es/config-provider");
43
+
44
+ var _LocaleReceiver = require("antd/es/locale-provider/LocaleReceiver");
45
+
46
+ var _transButton = _interopRequireDefault(require("../../_util/transButton"));
47
+
48
+ var _styleChecker = require("../../_util/styleChecker");
49
+
50
+ var _Tooltip = _interopRequireDefault(require("../../Tooltip"));
51
+
52
+ var _Editable = _interopRequireDefault(require("../Editable"));
53
+
54
+ var _useMergedConfig7 = _interopRequireDefault(require("../hooks/useMergedConfig"));
55
+
56
+ var _useUpdatedEffect = _interopRequireDefault(require("../hooks/useUpdatedEffect"));
57
+
58
+ var _Typography = _interopRequireDefault(require("../Typography"));
59
+
60
+ var _Ellipsis = _interopRequireDefault(require("./Ellipsis"));
61
+
62
+ var _EllipsisTooltip = _interopRequireDefault(require("./EllipsisTooltip"));
63
+
64
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
65
+ var t = {};
66
+
67
+ for (var p in s) {
68
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
69
+ }
70
+
71
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
72
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
73
+ }
74
+ return t;
75
+ };
76
+
77
+ function wrapperDecorations(_ref, content) {
78
+ var mark = _ref.mark,
79
+ code = _ref.code,
80
+ underline = _ref.underline,
81
+ del = _ref.delete,
82
+ strong = _ref.strong,
83
+ keyboard = _ref.keyboard,
84
+ italic = _ref.italic;
85
+ var currentContent = content;
86
+
87
+ function wrap(needed, tag) {
88
+ if (!needed) return;
89
+ currentContent = /*#__PURE__*/React.createElement(tag, {}, currentContent);
90
+ }
91
+
92
+ wrap(strong, 'strong');
93
+ wrap(underline, 'u');
94
+ wrap(del, 'del');
95
+ wrap(code, 'code');
96
+ wrap(mark, 'mark');
97
+ wrap(keyboard, 'kbd');
98
+ wrap(italic, 'i');
99
+ return currentContent;
100
+ }
101
+
102
+ function getNode(dom, defaultNode, needDom) {
103
+ if (dom === true || dom === undefined) {
104
+ return defaultNode;
105
+ }
106
+
107
+ return dom || needDom && defaultNode;
108
+ }
109
+
110
+ function toList(val) {
111
+ return Array.isArray(val) ? val : [val];
112
+ }
113
+
114
+ var ELLIPSIS_STR = '...';
115
+ var Base = /*#__PURE__*/React.forwardRef(function (props, ref) {
116
+ var customizePrefixCls = props.prefixCls,
117
+ className = props.className,
118
+ style = props.style,
119
+ type = props.type,
120
+ disabled = props.disabled,
121
+ children = props.children,
122
+ ellipsis = props.ellipsis,
123
+ editable = props.editable,
124
+ copyable = props.copyable,
125
+ component = props.component,
126
+ title = props.title,
127
+ restProps = __rest(props, ["prefixCls", "className", "style", "type", "disabled", "children", "ellipsis", "editable", "copyable", "component", "title"]);
128
+
129
+ var _React$useContext = React.useContext(_configProvider.ConfigContext),
130
+ getPrefixCls = _React$useContext.getPrefixCls,
131
+ direction = _React$useContext.direction;
132
+
133
+ var textLocale = (0, _LocaleReceiver.useLocaleReceiver)('Text')[0]; // Force TS get this
134
+
135
+ var typographyRef = React.useRef(null);
136
+ var editIconRef = React.useRef(null); // ============================ MISC ============================
137
+
138
+ var prefixCls = getPrefixCls('typography', customizePrefixCls);
139
+ var textProps = (0, _omit.default)(restProps, ['mark', 'code', 'delete', 'underline', 'strong', 'keyboard', 'italic']); // ========================== Editable ==========================
140
+
141
+ var _useMergedConfig = (0, _useMergedConfig7.default)(editable),
142
+ _useMergedConfig2 = (0, _slicedToArray2.default)(_useMergedConfig, 2),
143
+ enableEdit = _useMergedConfig2[0],
144
+ editConfig = _useMergedConfig2[1];
145
+
146
+ var _useMergedState = (0, _useMergedState3.default)(false, {
147
+ value: editConfig.editing
148
+ }),
149
+ _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2),
150
+ editing = _useMergedState2[0],
151
+ setEditing = _useMergedState2[1];
152
+
153
+ var _editConfig$triggerTy = editConfig.triggerType,
154
+ triggerType = _editConfig$triggerTy === void 0 ? ['icon'] : _editConfig$triggerTy;
155
+
156
+ var triggerEdit = function triggerEdit(edit) {
157
+ var _a;
158
+
159
+ if (edit) {
160
+ (_a = editConfig.onStart) === null || _a === void 0 ? void 0 : _a.call(editConfig);
161
+ }
162
+
163
+ setEditing(edit);
164
+ }; // Focus edit icon when back
165
+
166
+
167
+ (0, _useUpdatedEffect.default)(function () {
168
+ var _a;
169
+
170
+ if (!editing) {
171
+ (_a = editIconRef.current) === null || _a === void 0 ? void 0 : _a.focus();
172
+ }
173
+ }, [editing]);
174
+
175
+ var onEditClick = function onEditClick(e) {
176
+ e === null || e === void 0 ? void 0 : e.preventDefault();
177
+ triggerEdit(true);
178
+ };
179
+
180
+ var onEditChange = function onEditChange(value) {
181
+ var _a;
182
+
183
+ (_a = editConfig.onChange) === null || _a === void 0 ? void 0 : _a.call(editConfig, value);
184
+ triggerEdit(false);
185
+ };
186
+
187
+ var onEditCancel = function onEditCancel() {
188
+ var _a;
189
+
190
+ (_a = editConfig.onCancel) === null || _a === void 0 ? void 0 : _a.call(editConfig);
191
+ triggerEdit(false);
192
+ }; // ========================== Copyable ==========================
193
+
194
+
195
+ var _useMergedConfig3 = (0, _useMergedConfig7.default)(copyable),
196
+ _useMergedConfig4 = (0, _slicedToArray2.default)(_useMergedConfig3, 2),
197
+ enableCopy = _useMergedConfig4[0],
198
+ copyConfig = _useMergedConfig4[1];
199
+
200
+ var _React$useState = React.useState(false),
201
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
202
+ copied = _React$useState2[0],
203
+ setCopied = _React$useState2[1];
204
+
205
+ var copyIdRef = React.useRef();
206
+ var copyOptions = {};
207
+
208
+ if (copyConfig.format) {
209
+ copyOptions.format = copyConfig.format;
210
+ }
211
+
212
+ var cleanCopyId = function cleanCopyId() {
213
+ clearTimeout(copyIdRef.current);
214
+ };
215
+
216
+ var onCopyClick = function onCopyClick(e) {
217
+ var _a;
218
+
219
+ e === null || e === void 0 ? void 0 : e.preventDefault();
220
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
221
+ (0, _copyToClipboard.default)(copyConfig.text || String(children) || '', copyOptions);
222
+ setCopied(true); // Trigger tips update
223
+
224
+ cleanCopyId();
225
+ copyIdRef.current = setTimeout(function () {
226
+ setCopied(false);
227
+ }, 3000);
228
+ (_a = copyConfig.onCopy) === null || _a === void 0 ? void 0 : _a.call(copyConfig, e);
229
+ };
230
+
231
+ React.useEffect(function () {
232
+ return cleanCopyId;
233
+ }, []); // ========================== Ellipsis ==========================
234
+
235
+ var _React$useState3 = React.useState(false),
236
+ _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
237
+ isLineClampSupport = _React$useState4[0],
238
+ setIsLineClampSupport = _React$useState4[1];
239
+
240
+ var _React$useState5 = React.useState(false),
241
+ _React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
242
+ isTextOverflowSupport = _React$useState6[0],
243
+ setIsTextOverflowSupport = _React$useState6[1];
244
+
245
+ var _React$useState7 = React.useState(false),
246
+ _React$useState8 = (0, _slicedToArray2.default)(_React$useState7, 2),
247
+ expanded = _React$useState8[0],
248
+ setExpanded = _React$useState8[1];
249
+
250
+ var _React$useState9 = React.useState(false),
251
+ _React$useState10 = (0, _slicedToArray2.default)(_React$useState9, 2),
252
+ isJsEllipsis = _React$useState10[0],
253
+ setIsJsEllipsis = _React$useState10[1];
254
+
255
+ var _React$useState11 = React.useState(false),
256
+ _React$useState12 = (0, _slicedToArray2.default)(_React$useState11, 2),
257
+ isNativeEllipsis = _React$useState12[0],
258
+ setIsNativeEllipsis = _React$useState12[1];
259
+
260
+ var _React$useState13 = React.useState(true),
261
+ _React$useState14 = (0, _slicedToArray2.default)(_React$useState13, 2),
262
+ isNativeVisible = _React$useState14[0],
263
+ setIsNativeVisible = _React$useState14[1];
264
+
265
+ var _useMergedConfig5 = (0, _useMergedConfig7.default)(ellipsis, {
266
+ expandable: false
267
+ }),
268
+ _useMergedConfig6 = (0, _slicedToArray2.default)(_useMergedConfig5, 2),
269
+ enableEllipsis = _useMergedConfig6[0],
270
+ ellipsisConfig = _useMergedConfig6[1];
271
+
272
+ var mergedEnableEllipsis = enableEllipsis && !expanded; // Shared prop to reduce bundle size
273
+
274
+ var _ellipsisConfig$rows = ellipsisConfig.rows,
275
+ rows = _ellipsisConfig$rows === void 0 ? 1 : _ellipsisConfig$rows;
276
+ var needMeasureEllipsis = React.useMemo(function () {
277
+ return (// Disable ellipsis
278
+ !mergedEnableEllipsis || // Provide suffix
279
+ ellipsisConfig.suffix !== undefined || ellipsisConfig.onEllipsis || // Can't use css ellipsis since we need to provide the place for button
280
+ ellipsisConfig.expandable || enableEdit || enableCopy
281
+ );
282
+ }, [mergedEnableEllipsis, ellipsisConfig, enableEdit, enableCopy]);
283
+ (0, _useLayoutEffect.default)(function () {
284
+ if (enableEllipsis && !needMeasureEllipsis) {
285
+ setIsLineClampSupport((0, _styleChecker.isStyleSupport)('webkitLineClamp'));
286
+ setIsTextOverflowSupport((0, _styleChecker.isStyleSupport)('textOverflow'));
287
+ }
288
+ }, [needMeasureEllipsis, enableEllipsis]);
289
+ var cssEllipsis = React.useMemo(function () {
290
+ if (needMeasureEllipsis) {
291
+ return false;
292
+ }
293
+
294
+ if (rows === 1) {
295
+ return isTextOverflowSupport;
296
+ }
297
+
298
+ return isLineClampSupport;
299
+ }, [needMeasureEllipsis, isTextOverflowSupport, isLineClampSupport]);
300
+ var isMergedEllipsis = mergedEnableEllipsis && (cssEllipsis ? isNativeEllipsis : isJsEllipsis);
301
+ var cssTextOverflow = mergedEnableEllipsis && rows === 1 && cssEllipsis;
302
+ var cssLineClamp = mergedEnableEllipsis && rows > 1 && cssEllipsis; // >>>>> Expand
303
+
304
+ var onExpandClick = function onExpandClick(e) {
305
+ var _a;
306
+
307
+ setExpanded(true);
308
+ (_a = ellipsisConfig.onExpand) === null || _a === void 0 ? void 0 : _a.call(ellipsisConfig, e);
309
+ };
310
+
311
+ var _React$useState15 = React.useState(0),
312
+ _React$useState16 = (0, _slicedToArray2.default)(_React$useState15, 2),
313
+ ellipsisWidth = _React$useState16[0],
314
+ setEllipsisWidth = _React$useState16[1];
315
+
316
+ var onResize = function onResize(_ref2) {
317
+ var offsetWidth = _ref2.offsetWidth;
318
+ setEllipsisWidth(offsetWidth);
319
+ }; // >>>>> JS Ellipsis
320
+
321
+
322
+ var onJsEllipsis = function onJsEllipsis(jsEllipsis) {
323
+ var _a;
324
+
325
+ setIsJsEllipsis(jsEllipsis); // Trigger if changed
326
+
327
+ if (isJsEllipsis !== jsEllipsis) {
328
+ (_a = ellipsisConfig.onEllipsis) === null || _a === void 0 ? void 0 : _a.call(ellipsisConfig, jsEllipsis);
329
+ }
330
+ }; // >>>>> Native ellipsis
331
+
332
+
333
+ React.useEffect(function () {
334
+ var textEle = typographyRef.current;
335
+
336
+ if (enableEllipsis && cssEllipsis && textEle) {
337
+ var currentEllipsis = cssLineClamp ? textEle.offsetHeight < textEle.scrollHeight : textEle.offsetWidth < textEle.scrollWidth;
338
+
339
+ if (isNativeEllipsis !== currentEllipsis) {
340
+ setIsNativeEllipsis(currentEllipsis);
341
+ }
342
+ }
343
+ }, [enableEllipsis, cssEllipsis, children, cssLineClamp, isNativeVisible]); // https://github.com/ant-design/ant-design/issues/36786
344
+ // Use IntersectionObserver to check if element is invisible
345
+
346
+ React.useEffect(function () {
347
+ var textEle = typographyRef.current;
348
+
349
+ if (typeof IntersectionObserver === 'undefined' || !textEle || !cssEllipsis || !mergedEnableEllipsis) {
350
+ // @ts-ignore
351
+ return;
352
+ }
353
+ /* eslint-disable-next-line compat/compat */
354
+
355
+
356
+ var observer = new IntersectionObserver(function () {
357
+ setIsNativeVisible(!!textEle.offsetParent);
358
+ });
359
+ observer.observe(textEle);
360
+ return function () {
361
+ observer.disconnect();
362
+ };
363
+ }, [cssEllipsis, mergedEnableEllipsis]); // ========================== Tooltip ===========================
364
+
365
+ var tooltipProps = {};
366
+
367
+ if (ellipsisConfig.tooltip === true) {
368
+ tooltipProps = {
369
+ title: children
370
+ };
371
+ } else if ( /*#__PURE__*/React.isValidElement(ellipsisConfig.tooltip)) {
372
+ tooltipProps = {
373
+ title: ellipsisConfig.tooltip
374
+ };
375
+ } else if ((0, _typeof2.default)(ellipsisConfig.tooltip) === 'object') {
376
+ tooltipProps = Object.assign({
377
+ title: children
378
+ }, ellipsisConfig.tooltip);
379
+ } else {
380
+ tooltipProps = {
381
+ title: ellipsisConfig.tooltip
382
+ };
383
+ }
384
+
385
+ var topAriaLabel = React.useMemo(function () {
386
+ var isValid = function isValid(val) {
387
+ return ['string', 'number'].includes((0, _typeof2.default)(val));
388
+ };
389
+
390
+ if (!enableEllipsis || cssEllipsis) {
391
+ return undefined;
392
+ }
393
+
394
+ if (isValid(children)) {
395
+ return children;
396
+ }
397
+
398
+ if (isValid(title)) {
399
+ return title;
400
+ }
401
+
402
+ if (isValid(tooltipProps.title)) {
403
+ return tooltipProps.title;
404
+ }
405
+
406
+ return undefined;
407
+ }, [enableEllipsis, cssEllipsis, title, tooltipProps.title, isMergedEllipsis]); // =========================== Render ===========================
408
+ // >>>>>>>>>>> Editing input
409
+
410
+ if (editing) {
411
+ return /*#__PURE__*/React.createElement(_Editable.default, {
412
+ value: typeof children === 'string' ? children : '',
413
+ onSave: onEditChange,
414
+ onCancel: onEditCancel,
415
+ onEnd: editConfig.onEnd,
416
+ prefixCls: prefixCls,
417
+ className: className,
418
+ style: style,
419
+ direction: direction,
420
+ component: component,
421
+ maxLength: editConfig.maxLength,
422
+ autoSize: editConfig.autoSize,
423
+ enterIcon: editConfig.enterIcon
424
+ });
425
+ } // >>>>>>>>>>> Typography
426
+ // Expand
427
+
428
+
429
+ var renderExpand = function renderExpand() {
430
+ var expandable = ellipsisConfig.expandable,
431
+ symbol = ellipsisConfig.symbol;
432
+ if (!expandable) return null;
433
+ var expandContent;
434
+
435
+ if (symbol) {
436
+ expandContent = symbol;
437
+ } else {
438
+ expandContent = textLocale.expand;
439
+ }
440
+
441
+ return /*#__PURE__*/React.createElement("a", {
442
+ key: "expand",
443
+ className: "".concat(prefixCls, "-expand"),
444
+ onClick: onExpandClick,
445
+ "aria-label": textLocale.expand
446
+ }, expandContent);
447
+ }; // Edit
448
+
449
+
450
+ var renderEdit = function renderEdit() {
451
+ // @ts-ignore
452
+ if (!enableEdit) return;
453
+ var icon = editConfig.icon,
454
+ tooltip = editConfig.tooltip;
455
+ var editTitle = (0, _toArray.default)(tooltip)[0] || textLocale.edit;
456
+ var ariaLabel = typeof editTitle === 'string' ? editTitle : '';
457
+ return triggerType.includes('icon') ? /*#__PURE__*/React.createElement(_Tooltip.default, {
458
+ key: "edit",
459
+ title: tooltip === false ? '' : editTitle
460
+ }, /*#__PURE__*/React.createElement(_transButton.default, {
461
+ ref: editIconRef,
462
+ className: "".concat(prefixCls, "-edit"),
463
+ onClick: onEditClick,
464
+ "aria-label": ariaLabel
465
+ }, icon || /*#__PURE__*/React.createElement(_EditOutlined.default, {
466
+ role: "button"
467
+ }))) : null;
468
+ }; // Copy
469
+
470
+
471
+ var renderCopy = function renderCopy() {
472
+ // @ts-ignore
473
+ if (!enableCopy) return;
474
+ var tooltips = copyConfig.tooltips,
475
+ icon = copyConfig.icon;
476
+ var tooltipNodes = toList(tooltips);
477
+ var iconNodes = toList(icon);
478
+ var copyTitle = copied ? getNode(tooltipNodes[1], textLocale.copied) : getNode(tooltipNodes[0], textLocale.copy);
479
+ var systemStr = copied ? textLocale.copied : textLocale.copy;
480
+ var ariaLabel = typeof copyTitle === 'string' ? copyTitle : systemStr;
481
+ return /*#__PURE__*/React.createElement(_Tooltip.default, {
482
+ key: "copy",
483
+ title: copyTitle
484
+ }, /*#__PURE__*/React.createElement(_transButton.default, {
485
+ className: (0, _classnames.default)("".concat(prefixCls, "-copy"), copied && "".concat(prefixCls, "-copy-success")),
486
+ onClick: onCopyClick,
487
+ "aria-label": ariaLabel
488
+ }, copied ? getNode(iconNodes[1], /*#__PURE__*/React.createElement(_CheckOutlined.default, null), true) : getNode(iconNodes[0], /*#__PURE__*/React.createElement(_CopyOutlined.default, null), true)));
489
+ };
490
+
491
+ var renderOperations = function renderOperations(renderExpanded) {
492
+ return [renderExpanded && renderExpand(), renderEdit(), renderCopy()];
493
+ };
494
+
495
+ var renderEllipsis = function renderEllipsis(needEllipsis) {
496
+ return [needEllipsis && /*#__PURE__*/React.createElement("span", {
497
+ "aria-hidden": true,
498
+ key: "ellipsis"
499
+ }, ELLIPSIS_STR), ellipsisConfig.suffix, renderOperations(needEllipsis)];
500
+ };
501
+
502
+ return /*#__PURE__*/React.createElement(_rcResizeObserver.default, {
503
+ onResize: onResize,
504
+ disabled: !mergedEnableEllipsis || cssEllipsis
505
+ }, function (resizeRef) {
506
+ var _classNames;
507
+
508
+ return /*#__PURE__*/React.createElement(_EllipsisTooltip.default, {
509
+ tooltipProps: tooltipProps,
510
+ enabledEllipsis: mergedEnableEllipsis,
511
+ isEllipsis: isMergedEllipsis
512
+ }, /*#__PURE__*/React.createElement(_Typography.default, Object.assign({
513
+ className: (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-").concat(type), type), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-ellipsis"), enableEllipsis), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-single-line"), mergedEnableEllipsis && rows === 1), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-ellipsis-single-line"), cssTextOverflow), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-ellipsis-multiple-line"), cssLineClamp), _classNames), className),
514
+ style: Object.assign(Object.assign({}, style), {
515
+ WebkitLineClamp: cssLineClamp ? rows : undefined
516
+ }),
517
+ component: component,
518
+ ref: (0, _ref3.composeRef)(resizeRef, typographyRef, ref),
519
+ direction: direction,
520
+ onClick: triggerType.includes('text') ? onEditClick : null,
521
+ "aria-label": topAriaLabel,
522
+ title: title
523
+ }, textProps), /*#__PURE__*/React.createElement(_Ellipsis.default, {
524
+ enabledMeasure: mergedEnableEllipsis && !cssEllipsis,
525
+ text: children,
526
+ rows: rows,
527
+ width: ellipsisWidth,
528
+ onEllipsis: onJsEllipsis
529
+ }, function (node, needEllipsis) {
530
+ var renderNode = node;
531
+
532
+ if (node.length && needEllipsis && topAriaLabel) {
533
+ renderNode = /*#__PURE__*/React.createElement("span", {
534
+ key: "show-content",
535
+ "aria-hidden": true
536
+ }, renderNode);
537
+ }
538
+
539
+ var wrappedContext = wrapperDecorations(props, /*#__PURE__*/React.createElement(React.Fragment, null, renderNode, renderEllipsis(needEllipsis)));
540
+ return wrappedContext;
541
+ })));
542
+ });
543
+ });
544
+ var _default = Base;
545
+ exports.default = _default;
@@ -0,0 +1,20 @@
1
+ import type { AutoSizeType } from 'rc-textarea/lib/ResizableTextArea';
2
+ import * as React from 'react';
3
+ import type { DirectionType } from 'antd/es/config-provider';
4
+ interface EditableProps {
5
+ prefixCls?: string;
6
+ value: string;
7
+ ['aria-label']?: string;
8
+ onSave: (value: string) => void;
9
+ onCancel: () => void;
10
+ onEnd?: () => void;
11
+ className?: string;
12
+ style?: React.CSSProperties;
13
+ direction?: DirectionType;
14
+ maxLength?: number;
15
+ autoSize?: boolean | AutoSizeType;
16
+ enterIcon?: React.ReactNode;
17
+ component?: string;
18
+ }
19
+ declare const Editable: React.FC<EditableProps>;
20
+ export default Editable;
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
16
+ var _EnterOutlined = _interopRequireDefault(require("@ant-design/icons/EnterOutlined"));
17
+
18
+ var _classnames = _interopRequireDefault(require("classnames"));
19
+
20
+ var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode"));
21
+
22
+ var React = _interopRequireWildcard(require("react"));
23
+
24
+ var _linkmoreDesign = require("linkmore-design");
25
+
26
+ var _reactNode = require("../_util/reactNode");
27
+
28
+ var TextArea = _linkmoreDesign.Input.TextArea;
29
+
30
+ var Editable = function Editable(_ref) {
31
+ var prefixCls = _ref.prefixCls,
32
+ ariaLabel = _ref['aria-label'],
33
+ className = _ref.className,
34
+ style = _ref.style,
35
+ direction = _ref.direction,
36
+ maxLength = _ref.maxLength,
37
+ _ref$autoSize = _ref.autoSize,
38
+ autoSize = _ref$autoSize === void 0 ? true : _ref$autoSize,
39
+ value = _ref.value,
40
+ onSave = _ref.onSave,
41
+ onCancel = _ref.onCancel,
42
+ onEnd = _ref.onEnd,
43
+ component = _ref.component,
44
+ _ref$enterIcon = _ref.enterIcon,
45
+ enterIcon = _ref$enterIcon === void 0 ? /*#__PURE__*/React.createElement(_EnterOutlined.default, null) : _ref$enterIcon;
46
+ var ref = React.useRef();
47
+ var inComposition = React.useRef(false);
48
+ var lastKeyCode = React.useRef();
49
+
50
+ var _React$useState = React.useState(value),
51
+ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
52
+ current = _React$useState2[0],
53
+ setCurrent = _React$useState2[1];
54
+
55
+ React.useEffect(function () {
56
+ setCurrent(value);
57
+ }, [value]);
58
+ React.useEffect(function () {
59
+ if (ref.current && ref.current.resizableTextArea) {
60
+ var textArea = ref.current.resizableTextArea.textArea;
61
+ textArea.focus();
62
+ var length = textArea.value.length;
63
+ textArea.setSelectionRange(length, length);
64
+ }
65
+ }, []);
66
+
67
+ var onChange = function onChange(_ref2) {
68
+ var target = _ref2.target;
69
+ setCurrent(target.value.replace(/[\n\r]/g, ''));
70
+ };
71
+
72
+ var onCompositionStart = function onCompositionStart() {
73
+ inComposition.current = true;
74
+ };
75
+
76
+ var onCompositionEnd = function onCompositionEnd() {
77
+ inComposition.current = false;
78
+ };
79
+
80
+ var onKeyDown = function onKeyDown(_ref3) {
81
+ var keyCode = _ref3.keyCode;
82
+ // We don't record keyCode when IME is using
83
+ if (inComposition.current) return;
84
+ lastKeyCode.current = keyCode;
85
+ };
86
+
87
+ var confirmChange = function confirmChange() {
88
+ onSave(current.trim());
89
+ };
90
+
91
+ var onKeyUp = function onKeyUp(_ref4) {
92
+ var keyCode = _ref4.keyCode,
93
+ ctrlKey = _ref4.ctrlKey,
94
+ altKey = _ref4.altKey,
95
+ metaKey = _ref4.metaKey,
96
+ shiftKey = _ref4.shiftKey;
97
+
98
+ // Check if it's a real key
99
+ if (lastKeyCode.current === keyCode && !inComposition.current && !ctrlKey && !altKey && !metaKey && !shiftKey) {
100
+ if (keyCode === _KeyCode.default.ENTER) {
101
+ confirmChange();
102
+ onEnd === null || onEnd === void 0 ? void 0 : onEnd();
103
+ } else if (keyCode === _KeyCode.default.ESC) {
104
+ onCancel();
105
+ }
106
+ }
107
+ };
108
+
109
+ var onBlur = function onBlur() {
110
+ confirmChange();
111
+ };
112
+
113
+ var textClassName = component ? "".concat(prefixCls, "-").concat(component) : '';
114
+ var textAreaClassName = (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-edit-content"), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className, textClassName);
115
+ return /*#__PURE__*/React.createElement("div", {
116
+ className: textAreaClassName,
117
+ style: style
118
+ }, /*#__PURE__*/React.createElement(TextArea, {
119
+ ref: ref,
120
+ maxLength: maxLength,
121
+ value: current,
122
+ onChange: onChange,
123
+ onKeyDown: onKeyDown,
124
+ onKeyUp: onKeyUp,
125
+ onCompositionStart: onCompositionStart,
126
+ onCompositionEnd: onCompositionEnd,
127
+ onBlur: onBlur,
128
+ "aria-label": ariaLabel,
129
+ rows: 1,
130
+ autoSize: autoSize
131
+ }), enterIcon !== null ? (0, _reactNode.cloneElement)(enterIcon, {
132
+ className: "".concat(prefixCls, "-edit-content-confirm")
133
+ }) : null);
134
+ };
135
+
136
+ var _default = Editable;
137
+ exports.default = _default;