@uzum-tech/ui 2.3.8 → 2.4.0

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 (319) hide show
  1. package/dist/index.js +63601 -32546
  2. package/dist/index.mjs +64856 -33810
  3. package/dist/index.prod.js +3 -3
  4. package/dist/index.prod.mjs +3 -3
  5. package/es/_internal/icons/Bold.d.ts +2 -0
  6. package/es/_internal/icons/Bold.mjs +29 -0
  7. package/es/_internal/icons/BulletList.d.ts +2 -0
  8. package/es/_internal/icons/BulletList.mjs +23 -0
  9. package/es/_internal/icons/HorizontalRule.d.ts +2 -0
  10. package/es/_internal/icons/HorizontalRule.mjs +14 -0
  11. package/es/_internal/icons/Italic.d.ts +2 -0
  12. package/es/_internal/icons/Italic.mjs +19 -0
  13. package/es/_internal/icons/NumberedList.d.ts +2 -0
  14. package/es/_internal/icons/NumberedList.mjs +23 -0
  15. package/es/_internal/icons/Quote.d.ts +2 -0
  16. package/es/_internal/icons/Quote.mjs +23 -0
  17. package/es/_internal/icons/SettingsLine.d.ts +2 -0
  18. package/es/_internal/icons/SettingsLine.mjs +19 -0
  19. package/es/_internal/icons/Strikethrough.d.ts +2 -0
  20. package/es/_internal/icons/Strikethrough.mjs +14 -0
  21. package/es/_internal/icons/index.d.ts +8 -0
  22. package/es/_internal/icons/index.mjs +8 -0
  23. package/es/_styles/markdown/markdown-content.cssr.d.ts +6 -0
  24. package/es/_styles/markdown/markdown-content.cssr.mjs +22 -0
  25. package/es/_utils/markdown/index.d.ts +3 -2
  26. package/es/_utils/markdown/index.mjs +2 -1
  27. package/es/_utils/markdown/render-markdown.d.ts +2 -1
  28. package/es/_utils/markdown/render-markdown.mjs +1 -1
  29. package/es/chat/src/Chat.d.ts +261 -24
  30. package/es/chat/src/Chat.mjs +2 -0
  31. package/es/chat/src/ChatMainArea.d.ts +81 -8
  32. package/es/chat/src/ChatMainArea.mjs +111 -355
  33. package/es/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.d.ts +9084 -0
  34. package/es/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.mjs +71 -0
  35. package/es/chat/src/ChatParts/ChatAttachmentButton/interface.d.ts +2645 -0
  36. package/es/chat/src/ChatParts/ChatAttachmentButton/interface.mjs +19 -0
  37. package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.d.ts +9070 -0
  38. package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.mjs +78 -0
  39. package/es/chat/src/ChatParts/ChatEditingBlock/interface.d.ts +2637 -0
  40. package/es/chat/src/ChatParts/ChatEditingBlock/interface.mjs +15 -0
  41. package/es/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.d.ts +89 -0
  42. package/es/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.mjs +63 -0
  43. package/es/chat/src/ChatParts/ChatEditorInput/interface.d.ts +42 -0
  44. package/es/chat/src/ChatParts/ChatEditorInput/interface.mjs +34 -0
  45. package/es/chat/src/ChatParts/ChatFooter/ChatFooter.d.ts +115 -0
  46. package/es/chat/src/ChatParts/ChatFooter/ChatFooter.mjs +99 -0
  47. package/es/chat/src/ChatParts/ChatFooter/interface.d.ts +56 -0
  48. package/es/chat/src/ChatParts/ChatFooter/interface.mjs +46 -0
  49. package/es/chat/src/ChatParts/ChatHeader/ChatHeader.d.ts +9205 -0
  50. package/es/chat/src/ChatParts/ChatHeader/ChatHeader.mjs +219 -0
  51. package/es/chat/src/ChatParts/ChatHeader/interface.d.ts +2694 -0
  52. package/es/chat/src/ChatParts/ChatHeader/interface.mjs +67 -0
  53. package/es/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.d.ts +9142 -0
  54. package/es/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.mjs +129 -0
  55. package/es/chat/src/ChatParts/ChatLegacyInput/interface.d.ts +2654 -0
  56. package/es/chat/src/ChatParts/ChatLegacyInput/interface.mjs +27 -0
  57. package/es/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.d.ts +148 -0
  58. package/es/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.mjs +92 -0
  59. package/es/chat/src/ChatParts/ChatMessagesArea/interface.d.ts +72 -0
  60. package/es/chat/src/ChatParts/ChatMessagesArea/interface.mjs +58 -0
  61. package/es/chat/src/interface.d.ts +7 -0
  62. package/es/chat/src/interface.mjs +4 -0
  63. package/es/chat/styles/light.d.ts +4 -0
  64. package/es/chat/styles/light.mjs +18 -0
  65. package/es/components.d.ts +12933 -32
  66. package/es/components.mjs +5 -0
  67. package/es/config-provider/src/internal-interface.d.ts +2 -0
  68. package/es/data-table/index.d.ts +1 -1
  69. package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +156 -0
  70. package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.mjs +220 -0
  71. package/es/data-table/src/ColumnSettings/styles.cssr.d.ts +2 -0
  72. package/es/data-table/src/ColumnSettings/styles.cssr.mjs +25 -0
  73. package/es/data-table/src/DataTable.d.ts +60 -2
  74. package/es/data-table/src/DataTable.mjs +99 -23
  75. package/es/data-table/src/HeaderButton/FilterMenu.d.ts +14 -0
  76. package/es/data-table/src/interface.d.ts +53 -1
  77. package/es/data-table/src/interface.mjs +18 -1
  78. package/es/data-table/src/styles/index.cssr.mjs +17 -1
  79. package/es/data-table/src/use-column-settings.d.ts +2 -0
  80. package/es/data-table/src/use-column-settings.mjs +124 -0
  81. package/es/data-table/src/utils/column-utils.d.ts +2 -1
  82. package/es/data-table/src/utils/column-utils.mjs +6 -0
  83. package/es/editor/index.d.ts +10 -0
  84. package/es/editor/index.mjs +5 -0
  85. package/es/editor/src/Editor.d.ts +3896 -0
  86. package/es/editor/src/Editor.mjs +220 -0
  87. package/es/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.d.ts +37 -0
  88. package/es/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.mjs +63 -0
  89. package/es/editor/src/EditorParts/BlockTypeSelect/interface.d.ts +21 -0
  90. package/es/editor/src/EditorParts/BlockTypeSelect/interface.mjs +14 -0
  91. package/es/editor/src/EditorParts/EditorContent/EditorContent.d.ts +4078 -0
  92. package/es/editor/src/EditorParts/EditorContent/EditorContent.mjs +154 -0
  93. package/es/editor/src/EditorParts/EditorContent/index.d.ts +2 -0
  94. package/es/editor/src/EditorParts/EditorContent/index.mjs +2 -0
  95. package/es/editor/src/EditorParts/EditorContent/interface.d.ts +1906 -0
  96. package/es/editor/src/EditorParts/EditorContent/interface.mjs +17 -0
  97. package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +4582 -0
  98. package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.mjs +170 -0
  99. package/es/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.d.ts +11 -0
  100. package/es/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.mjs +54 -0
  101. package/es/editor/src/EditorParts/EditorToolbar/index.d.ts +2 -0
  102. package/es/editor/src/EditorParts/EditorToolbar/index.mjs +2 -0
  103. package/es/editor/src/EditorParts/EditorToolbar/interface.d.ts +1912 -0
  104. package/es/editor/src/EditorParts/EditorToolbar/interface.mjs +18 -0
  105. package/es/editor/src/EditorParts/SendButton/SendButton.d.ts +23 -0
  106. package/es/editor/src/EditorParts/SendButton/SendButton.mjs +42 -0
  107. package/es/editor/src/EditorParts/SendButton/interface.d.ts +18 -0
  108. package/es/editor/src/EditorParts/SendButton/interface.mjs +8 -0
  109. package/es/editor/src/EditorParts/ToolbarButton/ToolbarButton.d.ts +32 -0
  110. package/es/editor/src/EditorParts/ToolbarButton/ToolbarButton.mjs +44 -0
  111. package/es/editor/src/EditorParts/ToolbarButton/interface.d.ts +20 -0
  112. package/es/editor/src/EditorParts/ToolbarButton/interface.mjs +13 -0
  113. package/es/editor/src/composables/use-editor-commands.d.ts +8 -0
  114. package/es/editor/src/composables/use-editor-commands.mjs +69 -0
  115. package/es/editor/src/composables/use-editor-css-vars.d.ts +4 -0
  116. package/es/editor/src/composables/use-editor-css-vars.mjs +81 -0
  117. package/es/editor/src/constants.d.ts +12 -0
  118. package/es/editor/src/constants.mjs +25 -0
  119. package/es/editor/src/extensions.d.ts +7 -0
  120. package/es/editor/src/extensions.mjs +129 -0
  121. package/es/editor/src/interface.d.ts +2019 -0
  122. package/es/editor/src/interface.mjs +52 -0
  123. package/es/editor/src/markdown/constants.d.ts +8 -0
  124. package/es/editor/src/markdown/constants.mjs +206 -0
  125. package/es/editor/src/markdown/editor-serializer.d.ts +9 -0
  126. package/es/editor/src/markdown/editor-serializer.mjs +18 -0
  127. package/es/editor/src/markdown/escape.d.ts +2 -0
  128. package/es/editor/src/markdown/escape.mjs +24 -0
  129. package/es/editor/src/markdown/html.d.ts +1 -0
  130. package/es/editor/src/markdown/html.mjs +4 -0
  131. package/es/editor/src/markdown/parser.d.ts +4 -0
  132. package/es/editor/src/markdown/parser.mjs +36 -0
  133. package/es/editor/src/markdown/serializer-state.d.ts +10 -0
  134. package/es/editor/src/markdown/serializer-state.mjs +12 -0
  135. package/es/editor/src/markdown/serializer.d.ts +3 -0
  136. package/es/editor/src/markdown/serializer.mjs +8 -0
  137. package/es/editor/src/styles/index.cssr.d.ts +2 -0
  138. package/es/editor/src/styles/index.cssr.mjs +119 -0
  139. package/es/editor/styles/dark.d.ts +630 -0
  140. package/es/editor/styles/dark.mjs +21 -0
  141. package/es/editor/styles/index.d.ts +3 -0
  142. package/es/editor/styles/index.mjs +2 -0
  143. package/es/editor/styles/light.d.ts +677 -0
  144. package/es/editor/styles/light.mjs +87 -0
  145. package/es/editor/tests/fixtures/round-trip.d.ts +12 -0
  146. package/es/editor/tests/fixtures/round-trip.mjs +98 -0
  147. package/es/editor/tests/utils.d.ts +7 -0
  148. package/es/editor/tests/utils.mjs +27 -0
  149. package/es/locales/common/enUS.d.ts +21 -0
  150. package/es/locales/common/enUS.mjs +22 -1
  151. package/es/locales/common/ruRU.mjs +22 -1
  152. package/es/locales/common/uzUZ.mjs +22 -1
  153. package/es/locales/common/zhCN.mjs +22 -1
  154. package/es/message-bubble/src/styles/index.cssr.mjs +4 -17
  155. package/es/styles.d.ts +1 -0
  156. package/es/styles.mjs +1 -0
  157. package/es/themes/dark.mjs +2 -0
  158. package/es/themes/light.mjs +2 -0
  159. package/es/version.d.ts +1 -1
  160. package/es/version.mjs +1 -1
  161. package/lib/_internal/icons/Bold.d.ts +2 -0
  162. package/lib/_internal/icons/Bold.js +13 -0
  163. package/lib/_internal/icons/BulletList.d.ts +2 -0
  164. package/lib/_internal/icons/BulletList.js +13 -0
  165. package/lib/_internal/icons/HorizontalRule.d.ts +2 -0
  166. package/lib/_internal/icons/HorizontalRule.js +10 -0
  167. package/lib/_internal/icons/Italic.d.ts +2 -0
  168. package/lib/_internal/icons/Italic.js +11 -0
  169. package/lib/_internal/icons/NumberedList.d.ts +2 -0
  170. package/lib/_internal/icons/NumberedList.js +13 -0
  171. package/lib/_internal/icons/Quote.d.ts +2 -0
  172. package/lib/_internal/icons/Quote.js +13 -0
  173. package/lib/_internal/icons/SettingsLine.d.ts +2 -0
  174. package/lib/_internal/icons/SettingsLine.js +11 -0
  175. package/lib/_internal/icons/Strikethrough.d.ts +2 -0
  176. package/lib/_internal/icons/Strikethrough.js +10 -0
  177. package/lib/_internal/icons/index.d.ts +8 -0
  178. package/lib/_internal/icons/index.js +18 -2
  179. package/lib/_styles/markdown/markdown-content.cssr.d.ts +6 -0
  180. package/lib/_styles/markdown/markdown-content.cssr.js +28 -0
  181. package/lib/_utils/markdown/index.d.ts +3 -2
  182. package/lib/_utils/markdown/index.js +4 -1
  183. package/lib/_utils/markdown/render-markdown.d.ts +2 -1
  184. package/lib/_utils/markdown/render-markdown.js +1 -0
  185. package/lib/chat/src/Chat.d.ts +261 -24
  186. package/lib/chat/src/Chat.js +2 -0
  187. package/lib/chat/src/ChatMainArea.d.ts +81 -8
  188. package/lib/chat/src/ChatMainArea.js +93 -223
  189. package/lib/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.d.ts +9084 -0
  190. package/lib/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.js +52 -0
  191. package/lib/chat/src/ChatParts/ChatAttachmentButton/interface.d.ts +2645 -0
  192. package/lib/chat/src/ChatParts/ChatAttachmentButton/interface.js +17 -0
  193. package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.d.ts +9070 -0
  194. package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.js +55 -0
  195. package/lib/chat/src/ChatParts/ChatEditingBlock/interface.d.ts +2637 -0
  196. package/lib/chat/src/ChatParts/ChatEditingBlock/interface.js +14 -0
  197. package/lib/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.d.ts +89 -0
  198. package/lib/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.js +45 -0
  199. package/lib/chat/src/ChatParts/ChatEditorInput/interface.d.ts +42 -0
  200. package/lib/chat/src/ChatParts/ChatEditorInput/interface.js +37 -0
  201. package/lib/chat/src/ChatParts/ChatFooter/ChatFooter.d.ts +115 -0
  202. package/lib/chat/src/ChatParts/ChatFooter/ChatFooter.js +66 -0
  203. package/lib/chat/src/ChatParts/ChatFooter/interface.d.ts +56 -0
  204. package/lib/chat/src/ChatParts/ChatFooter/interface.js +49 -0
  205. package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.d.ts +9205 -0
  206. package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.js +164 -0
  207. package/lib/chat/src/ChatParts/ChatHeader/interface.d.ts +2694 -0
  208. package/lib/chat/src/ChatParts/ChatHeader/interface.js +53 -0
  209. package/lib/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.d.ts +9142 -0
  210. package/lib/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.js +98 -0
  211. package/lib/chat/src/ChatParts/ChatLegacyInput/interface.d.ts +2654 -0
  212. package/lib/chat/src/ChatParts/ChatLegacyInput/interface.js +23 -0
  213. package/lib/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.d.ts +148 -0
  214. package/lib/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.js +49 -0
  215. package/lib/chat/src/ChatParts/ChatMessagesArea/interface.d.ts +72 -0
  216. package/lib/chat/src/ChatParts/ChatMessagesArea/interface.js +61 -0
  217. package/lib/chat/src/interface.d.ts +7 -0
  218. package/lib/chat/src/interface.js +3 -0
  219. package/lib/chat/styles/light.d.ts +4 -0
  220. package/lib/chat/styles/light.js +19 -0
  221. package/lib/components.d.ts +12933 -32
  222. package/lib/components.js +17 -7
  223. package/lib/config-provider/src/internal-interface.d.ts +2 -0
  224. package/lib/data-table/index.d.ts +1 -1
  225. package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +156 -0
  226. package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.js +181 -0
  227. package/lib/data-table/src/ColumnSettings/styles.cssr.d.ts +2 -0
  228. package/lib/data-table/src/ColumnSettings/styles.cssr.js +30 -0
  229. package/lib/data-table/src/DataTable.d.ts +60 -2
  230. package/lib/data-table/src/DataTable.js +65 -23
  231. package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +14 -0
  232. package/lib/data-table/src/interface.d.ts +53 -1
  233. package/lib/data-table/src/interface.js +17 -2
  234. package/lib/data-table/src/styles/index.cssr.js +17 -1
  235. package/lib/data-table/src/use-column-settings.d.ts +2 -0
  236. package/lib/data-table/src/use-column-settings.js +144 -0
  237. package/lib/data-table/src/utils/column-utils.d.ts +2 -1
  238. package/lib/data-table/src/utils/column-utils.js +5 -0
  239. package/lib/editor/index.d.ts +10 -0
  240. package/lib/editor/index.js +19 -0
  241. package/lib/editor/src/Editor.d.ts +3896 -0
  242. package/lib/editor/src/Editor.js +216 -0
  243. package/lib/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.d.ts +37 -0
  244. package/lib/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.js +47 -0
  245. package/lib/editor/src/EditorParts/BlockTypeSelect/interface.d.ts +21 -0
  246. package/lib/editor/src/EditorParts/BlockTypeSelect/interface.js +17 -0
  247. package/lib/editor/src/EditorParts/EditorContent/EditorContent.d.ts +4078 -0
  248. package/lib/editor/src/EditorParts/EditorContent/EditorContent.js +121 -0
  249. package/lib/editor/src/EditorParts/EditorContent/index.d.ts +2 -0
  250. package/lib/editor/src/EditorParts/EditorContent/index.js +10 -0
  251. package/lib/editor/src/EditorParts/EditorContent/interface.d.ts +1906 -0
  252. package/lib/editor/src/EditorParts/EditorContent/interface.js +8 -0
  253. package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +4582 -0
  254. package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.js +126 -0
  255. package/lib/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.d.ts +11 -0
  256. package/lib/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.js +52 -0
  257. package/lib/editor/src/EditorParts/EditorToolbar/index.d.ts +2 -0
  258. package/lib/editor/src/EditorParts/EditorToolbar/index.js +10 -0
  259. package/lib/editor/src/EditorParts/EditorToolbar/interface.d.ts +1912 -0
  260. package/lib/editor/src/EditorParts/EditorToolbar/interface.js +11 -0
  261. package/lib/editor/src/EditorParts/SendButton/SendButton.d.ts +23 -0
  262. package/lib/editor/src/EditorParts/SendButton/SendButton.js +31 -0
  263. package/lib/editor/src/EditorParts/SendButton/interface.d.ts +18 -0
  264. package/lib/editor/src/EditorParts/SendButton/interface.js +11 -0
  265. package/lib/editor/src/EditorParts/ToolbarButton/ToolbarButton.d.ts +32 -0
  266. package/lib/editor/src/EditorParts/ToolbarButton/ToolbarButton.js +34 -0
  267. package/lib/editor/src/EditorParts/ToolbarButton/interface.d.ts +20 -0
  268. package/lib/editor/src/EditorParts/ToolbarButton/interface.js +16 -0
  269. package/lib/editor/src/composables/use-editor-commands.d.ts +8 -0
  270. package/lib/editor/src/composables/use-editor-commands.js +70 -0
  271. package/lib/editor/src/composables/use-editor-css-vars.d.ts +4 -0
  272. package/lib/editor/src/composables/use-editor-css-vars.js +46 -0
  273. package/lib/editor/src/constants.d.ts +12 -0
  274. package/lib/editor/src/constants.js +56 -0
  275. package/lib/editor/src/extensions.d.ts +7 -0
  276. package/lib/editor/src/extensions.js +136 -0
  277. package/lib/editor/src/interface.d.ts +2019 -0
  278. package/lib/editor/src/interface.js +22 -0
  279. package/lib/editor/src/markdown/constants.d.ts +8 -0
  280. package/lib/editor/src/markdown/constants.js +201 -0
  281. package/lib/editor/src/markdown/editor-serializer.d.ts +9 -0
  282. package/lib/editor/src/markdown/editor-serializer.js +20 -0
  283. package/lib/editor/src/markdown/escape.d.ts +2 -0
  284. package/lib/editor/src/markdown/escape.js +31 -0
  285. package/lib/editor/src/markdown/html.d.ts +1 -0
  286. package/lib/editor/src/markdown/html.js +9 -0
  287. package/lib/editor/src/markdown/parser.d.ts +4 -0
  288. package/lib/editor/src/markdown/parser.js +42 -0
  289. package/lib/editor/src/markdown/serializer-state.d.ts +10 -0
  290. package/lib/editor/src/markdown/serializer-state.js +16 -0
  291. package/lib/editor/src/markdown/serializer.d.ts +3 -0
  292. package/lib/editor/src/markdown/serializer.js +9 -0
  293. package/lib/editor/src/styles/index.cssr.d.ts +2 -0
  294. package/lib/editor/src/styles/index.cssr.js +124 -0
  295. package/lib/editor/styles/dark.d.ts +630 -0
  296. package/lib/editor/styles/dark.js +23 -0
  297. package/lib/editor/styles/index.d.ts +3 -0
  298. package/lib/editor/styles/index.js +10 -0
  299. package/lib/editor/styles/light.d.ts +677 -0
  300. package/lib/editor/styles/light.js +71 -0
  301. package/lib/editor/tests/fixtures/round-trip.d.ts +12 -0
  302. package/lib/editor/tests/fixtures/round-trip.js +125 -0
  303. package/lib/editor/tests/utils.d.ts +7 -0
  304. package/lib/editor/tests/utils.js +26 -0
  305. package/lib/locales/common/enUS.d.ts +21 -0
  306. package/lib/locales/common/enUS.js +22 -1
  307. package/lib/locales/common/ruRU.js +22 -1
  308. package/lib/locales/common/uzUZ.js +22 -1
  309. package/lib/locales/common/zhCN.js +22 -1
  310. package/lib/message-bubble/src/styles/index.cssr.js +4 -17
  311. package/lib/styles.d.ts +1 -0
  312. package/lib/styles.js +127 -125
  313. package/lib/themes/dark.js +136 -134
  314. package/lib/themes/light.js +136 -134
  315. package/lib/version.d.ts +1 -1
  316. package/lib/version.js +1 -1
  317. package/package.json +8 -1
  318. package/volar.d.ts +3 -0
  319. package/web-types.json +437 -2
@@ -1,13 +1,18 @@
1
1
  import { computed, defineComponent, h, onMounted, provide, ref, toRef, Transition, useId, watch, watchEffect } from 'vue';
2
2
  import { UBaseLoading } from "../../_internal/index.mjs";
3
+ import { UIcon } from "../../_internal/icon/index.mjs";
4
+ import { SettingsLine } from "../../_internal/icons/index.mjs";
3
5
  import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
4
- import { createKey, download, resolveSlot, warnOnce } from "../../_utils/index.mjs";
6
+ import { createKey, download, isSlotEmpty, resolveSlot, warnOnce } from "../../_utils/index.mjs";
7
+ import { UButton } from "../../button/index.mjs";
5
8
  import { UPagination } from "../../pagination/index.mjs";
6
9
  import { dataTableLight } from "../styles/index.mjs";
10
+ import ColumnSettingsDrawer from "./ColumnSettings/ColumnSettingsDrawer.mjs";
7
11
  import { dataTableInjectionKey, dataTableProps } from "./interface.mjs";
8
12
  import MainTable from "./MainTable.mjs";
9
13
  import style from "./styles/index.cssr.mjs";
10
14
  import { useCheck } from "./use-check.mjs";
15
+ import { useColumnSettings } from "./use-column-settings.mjs";
11
16
  import { useExpand } from "./use-expand.mjs";
12
17
  import { useGroupHeader } from "./use-group-header.mjs";
13
18
  import { useResizable } from "./use-resizable.mjs";
@@ -25,6 +30,7 @@ export default defineComponent({
25
30
  slots,
26
31
  emit
27
32
  }) {
33
+ var _a;
28
34
  const componentId = useId();
29
35
  if (process.env.NODE_ENV !== 'production') {
30
36
  watchEffect(() => {
@@ -70,12 +76,38 @@ export default defineComponent({
70
76
  setResizableWidths,
71
77
  resizableWidthsRef
72
78
  } = useResizable();
79
+ if (props.localStorageKey && props.resizableStorage !== false) {
80
+ const storedWidths = (_a = loadTableState(props.localStorageKey)) === null || _a === void 0 ? void 0 : _a.columnWidths;
81
+ if (storedWidths && Object.keys(storedWidths).length > 0) {
82
+ resizableWidthsRef.value = Object.assign(Object.assign({}, resizableWidthsRef.value), storedWidths);
83
+ }
84
+ }
85
+ const {
86
+ enabledRef: columnSettingsEnabledRef,
87
+ resolvedColumnsRef,
88
+ scrollXRef: columnSettingsScrollXRef,
89
+ columnsConfigRef,
90
+ drawerOpenRef,
91
+ drawerItemsRef,
92
+ defaultDrawerItemsRef,
93
+ openDrawer: openColumnSettings,
94
+ resetConfig: resetColumnSettings,
95
+ applyConfig: applyColumnSettings,
96
+ applyConfigFromKeys: applyColumnSettingsFromKeys
97
+ } = useColumnSettings(props, getResizableWidth);
98
+ const columnsProps = new Proxy(props, {
99
+ get(target, prop, receiver) {
100
+ if (prop === 'columns') return resolvedColumnsRef.value;
101
+ if (prop === 'scrollX') return columnSettingsScrollXRef.value;
102
+ return Reflect.get(target, prop, receiver);
103
+ }
104
+ });
73
105
  const {
74
106
  rowsRef,
75
107
  colsRef,
76
108
  dataRelatedColsRef,
77
109
  hasEllipsisRef
78
- } = useGroupHeader(props, getResizableWidth);
110
+ } = useGroupHeader(columnsProps, getResizableWidth);
79
111
  const {
80
112
  treeMateRef,
81
113
  mergedCurrentPageRef,
@@ -100,7 +132,7 @@ export default defineComponent({
100
132
  clearSorter,
101
133
  page,
102
134
  sort
103
- } = useTableData(props, {
135
+ } = useTableData(columnsProps, {
104
136
  dataRelatedColsRef
105
137
  });
106
138
  const downloadCsv = options => {
@@ -109,7 +141,7 @@ export default defineComponent({
109
141
  keepOriginalData = false
110
142
  } = options || {};
111
143
  const data = keepOriginalData ? props.data : rawPaginatedDataRef.value;
112
- const csvData = generateCsv(props.columns, data, props.getCsvCell, props.getCsvHeader);
144
+ const csvData = generateCsv(resolvedColumnsRef.value, data, props.getCsvCell, props.getCsvHeader);
113
145
  const blob = new Blob([csvData], {
114
146
  type: 'text/csv;charset=utf-8'
115
147
  });
@@ -129,7 +161,7 @@ export default defineComponent({
129
161
  allRowsCheckedRef,
130
162
  mergedCheckedRowKeySetRef,
131
163
  mergedInderminateRowKeySetRef
132
- } = useCheck(props, {
164
+ } = useCheck(columnsProps, {
133
165
  selectionColumnRef,
134
166
  treeMateRef,
135
167
  paginatedDataRef
@@ -140,7 +172,7 @@ export default defineComponent({
140
172
  renderExpandRef,
141
173
  expandableRef,
142
174
  doUpdateExpandedRowKeys
143
- } = useExpand(props, treeMateRef);
175
+ } = useExpand(columnsProps, treeMateRef);
144
176
  const {
145
177
  draggableColumnRef,
146
178
  draggingRowKeySetRef,
@@ -151,7 +183,7 @@ export default defineComponent({
151
183
  handleRowDragLeave,
152
184
  handleRowDragEnd,
153
185
  handleRowDrop
154
- } = useRowDrag(props, {
186
+ } = useRowDrag(columnsProps, {
155
187
  paginatedDataRef,
156
188
  mergedCheckedRowKeySetRef,
157
189
  mergedClsPrefixRef
@@ -169,7 +201,7 @@ export default defineComponent({
169
201
  rightFixedColumnsRef,
170
202
  fixedColumnLeftMapRef,
171
203
  fixedColumnRightMapRef
172
- } = useScroll(props, {
204
+ } = useScroll(columnsProps, {
173
205
  bodyWidthRef,
174
206
  mainTableInstRef,
175
207
  mergedCurrentPageRef,
@@ -181,9 +213,6 @@ export default defineComponent({
181
213
  if (!key) return;
182
214
  const stored = loadTableState(key);
183
215
  if (!stored) return;
184
- if (props.resizableStorage && stored.columnWidths && Object.keys(stored.columnWidths).length > 0) {
185
- resizableWidthsRef.value = Object.assign(Object.assign({}, resizableWidthsRef.value), stored.columnWidths);
186
- }
187
216
  if (props.pagination && stored.page != null) {
188
217
  doUpdatePage(stored.page);
189
218
  }
@@ -209,6 +238,7 @@ export default defineComponent({
209
238
  return props.localStorageKey ? {
210
239
  key: props.localStorageKey,
211
240
  columnWidths: resizableWidthsRef.value,
241
+ columnsConfig: columnsConfigRef.value,
212
242
  page: (_a = mergedPaginationRef.value) === null || _a === void 0 ? void 0 : _a.page,
213
243
  pageSize: (_b = mergedPaginationRef.value) === null || _b === void 0 ? void 0 : _b.pageSize,
214
244
  filters: mergedFilterStateRef.value,
@@ -220,16 +250,17 @@ export default defineComponent({
220
250
  expandedRowKeys: mergedExpandedRowKeysRef.value
221
251
  } : null;
222
252
  }, state => {
223
- var _a, _b;
253
+ var _a, _b, _c;
224
254
  if (!(state === null || state === void 0 ? void 0 : state.key)) return;
225
255
  saveTableState(state.key, {
226
256
  columnWidths: state.columnWidths && Object.keys(state.columnWidths).length ? state.columnWidths : undefined,
257
+ columnsConfig: ((_a = state.columnsConfig) === null || _a === void 0 ? void 0 : _a.length) ? state.columnsConfig : undefined,
227
258
  page: state.page,
228
259
  pageSize: state.pageSize,
229
260
  filters: state.filters,
230
261
  sortState: state.sortState.length ? state.sortState : undefined,
231
- checkedRowKeys: ((_a = state.checkedRowKeys) === null || _a === void 0 ? void 0 : _a.length) ? state.checkedRowKeys : undefined,
232
- expandedRowKeys: ((_b = state.expandedRowKeys) === null || _b === void 0 ? void 0 : _b.length) ? state.expandedRowKeys : undefined
262
+ checkedRowKeys: ((_b = state.checkedRowKeys) === null || _b === void 0 ? void 0 : _b.length) ? state.checkedRowKeys : undefined,
263
+ expandedRowKeys: ((_c = state.expandedRowKeys) === null || _c === void 0 ? void 0 : _c.length) ? state.expandedRowKeys : undefined
233
264
  });
234
265
  }, {
235
266
  deep: true
@@ -271,7 +302,7 @@ export default defineComponent({
271
302
  });
272
303
  const containerWidthSignalRef = computed(() => {
273
304
  const bodyWidth = bodyWidthRef.value;
274
- const scrollXWidth = parseLengthToNumber(props.scrollX);
305
+ const scrollXWidth = parseLengthToNumber(columnSettingsScrollXRef.value);
275
306
  return bodyWidth !== null && bodyWidth > 0 ? bodyWidth : scrollXWidth !== undefined && scrollXWidth > 0 ? scrollXWidth : undefined;
276
307
  });
277
308
  const widthConstraintSignalRef = computed(() => {
@@ -425,7 +456,7 @@ export default defineComponent({
425
456
  }
426
457
  };
427
458
  const autoSummaryRef = computed(() => {
428
- const columns = props.columns;
459
+ const columns = resolvedColumnsRef.value;
429
460
  const hasTotalRow = columns.some(col => !('children' in col) && 'totalRow' in col && col.totalRow);
430
461
  if (!hasTotalRow) return null;
431
462
  return pageData => {
@@ -506,7 +537,7 @@ export default defineComponent({
506
537
  emit('edit', value, row, key);
507
538
  };
508
539
  provide(dataTableInjectionKey, {
509
- props,
540
+ props: columnsProps,
510
541
  sizeRef: toRef(props, 'size'),
511
542
  treeMateRef,
512
543
  renderExpandIconRef: toRef(props, 'renderExpandIcon'),
@@ -519,7 +550,7 @@ export default defineComponent({
519
550
  hoverKeyRef,
520
551
  mergedClsPrefixRef,
521
552
  mergedThemeRef: themeRef,
522
- scrollXRef: computed(() => props.scrollX),
553
+ scrollXRef: columnSettingsScrollXRef,
523
554
  rowsRef,
524
555
  colsRef,
525
556
  paginatedDataRef,
@@ -639,7 +670,10 @@ export default defineComponent({
639
670
  return summaryResult;
640
671
  }
641
672
  return null;
642
- }
673
+ },
674
+ openColumnSettings,
675
+ resetColumnSettings,
676
+ applyColumnSettings
643
677
  };
644
678
  const cssVarsRef = computed(() => {
645
679
  const {
@@ -773,18 +807,30 @@ export default defineComponent({
773
807
  mergedShowPagination: mergedShowPaginationRef,
774
808
  cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
775
809
  themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
776
- onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
810
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender,
811
+ columnSettingsEnabled: columnSettingsEnabledRef,
812
+ drawerOpen: drawerOpenRef,
813
+ drawerItems: drawerItemsRef,
814
+ defaultDrawerItems: defaultDrawerItemsRef,
815
+ applyColumnSettingsFromKeys,
816
+ locale: localeRef
777
817
  }, exposedMethods);
778
818
  },
779
819
  render() {
820
+ var _a;
780
821
  const {
781
822
  mergedClsPrefix,
782
823
  themeClass,
783
824
  onRender,
784
825
  $slots,
785
- spinProps
826
+ spinProps,
827
+ locale,
828
+ mergedTheme,
829
+ columnSettingsTriggerProps
786
830
  } = this;
787
831
  onRender === null || onRender === void 0 ? void 0 : onRender();
832
+ const hasFilters = !isSlotEmpty($slots.filters);
833
+ const showToolbar = hasFilters || this.columnSettingsEnabled;
788
834
  return h("div", {
789
835
  class: [`${mergedClsPrefix}-data-table`, themeClass, {
790
836
  [`${mergedClsPrefix}-data-table--bordered`]: this.mergedBordered,
@@ -795,7 +841,23 @@ export default defineComponent({
795
841
  [`${mergedClsPrefix}-data-table--flex-height`]: this.flexHeight
796
842
  }],
797
843
  style: this.cssVars
798
- }, h("div", {
844
+ }, showToolbar ? h("div", {
845
+ class: [`${mergedClsPrefix}-data-table-toolbar`, hasFilters && `${mergedClsPrefix}-data-table-toolbar--with-filters`]
846
+ }, hasFilters ? h("div", {
847
+ class: `${mergedClsPrefix}-data-table-toolbar__filters`
848
+ }, (_a = $slots.filters) === null || _a === void 0 ? void 0 : _a.call($slots)) : null, this.columnSettingsEnabled ? resolveSlot($slots['column-settings-trigger'], () => [h(UButton, Object.assign({
849
+ secondary: true,
850
+ round: true,
851
+ size: "small",
852
+ class: `${mergedClsPrefix}-data-table-toolbar-button`,
853
+ theme: mergedTheme.peers.Button,
854
+ themeOverrides: mergedTheme.peerOverrides.Button,
855
+ renderIcon: () => h(UIcon, null, {
856
+ default: () => h(SettingsLine)
857
+ })
858
+ }, columnSettingsTriggerProps, {
859
+ onClick: this.openColumnSettings
860
+ }), locale.columnSettingsButton)]) : null) : null, h("div", {
799
861
  class: `${mergedClsPrefix}-data-table-wrapper`
800
862
  }, h(MainTable, {
801
863
  ref: "mainTableInstRef",
@@ -819,6 +881,20 @@ export default defineComponent({
819
881
  strokeWidth: 20
820
882
  }, spinProps))])) : null;
821
883
  }
822
- }));
884
+ }), this.columnSettingsEnabled ? h(ColumnSettingsDrawer, {
885
+ show: this.drawerOpen,
886
+ items: this.drawerItems,
887
+ defaultItems: this.defaultDrawerItems,
888
+ title: locale.columnSettingsTitle,
889
+ subtitle: locale.columnSettingsSubtitle,
890
+ selectAllText: locale.columnSettingsSelectAll,
891
+ resetText: locale.columnSettingsReset,
892
+ cancelText: locale.columnSettingsCancel,
893
+ applyText: locale.columnSettingsApply,
894
+ 'onUpdate:show': value => {
895
+ this.drawerOpen = value;
896
+ },
897
+ onApply: this.applyColumnSettingsFromKeys
898
+ }) : null);
823
899
  }
824
900
  });
@@ -3819,11 +3819,25 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
3819
3819
  uncheckTableAll: string;
3820
3820
  confirm: string;
3821
3821
  clear: string;
3822
+ columnSettingsTitle: string;
3823
+ columnSettingsButton: string;
3824
+ columnSettingsSubtitle: string;
3825
+ columnSettingsSelectAll: string;
3826
+ columnSettingsReset: string;
3827
+ columnSettingsCancel: string;
3828
+ columnSettingsApply: string;
3822
3829
  }, {
3823
3830
  checkTableAll: string;
3824
3831
  uncheckTableAll: string;
3825
3832
  confirm: string;
3826
3833
  clear: string;
3834
+ columnSettingsTitle: string;
3835
+ columnSettingsButton: string;
3836
+ columnSettingsSubtitle: string;
3837
+ columnSettingsSelectAll: string;
3838
+ columnSettingsReset: string;
3839
+ columnSettingsCancel: string;
3840
+ columnSettingsApply: string;
3827
3841
  }>;
3828
3842
  checkboxGroupValue: import("vue").ComputedRef<FilterOptionValue[] | null>;
3829
3843
  radioGroupValue: import("vue").ComputedRef<FilterOptionValue | null>;
@@ -3,6 +3,7 @@ import type { ComputedRef, CSSProperties, ExtractPropTypes, HTMLAttributes, Prop
3
3
  import type { BaseLoadingExposedProps } from '../../_internal';
4
4
  import type { MergedTheme } from '../../_mixins';
5
5
  import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
6
+ import type { ButtonProps } from '../../button';
6
7
  import type { EllipsisProps } from '../../ellipsis/src/Ellipsis';
7
8
  import type { EmptyProps } from '../../empty';
8
9
  import type { ULocale } from '../../locales';
@@ -11,6 +12,11 @@ import type { ScrollbarProps, ScrollTo } from '../../scrollbar/src/Scrollbar';
11
12
  import type { DataTableTheme } from '../styles';
12
13
  import type { DataTableGetCsvCell, DataTableGetCsvHeader, DataTableSize } from './public-types';
13
14
  import type { ColItem, RowItem } from './use-group-header';
15
+ export declare enum TableColumnType {
16
+ SELECTION = "selection",
17
+ EXPAND = "expand",
18
+ DRAGGABLE = "draggable"
19
+ }
14
20
  export declare const dataTableProps: {
15
21
  readonly onUnstableColumnResize: PropType<(resizedWidth: number, limitedWidth: number, column: TableBaseColumn, getColumnWidth: (key: ColumnKey) => number | undefined) => void>;
16
22
  readonly pagination: {
@@ -106,7 +112,18 @@ export declare const dataTableProps: {
106
112
  readonly default: "current";
107
113
  };
108
114
  readonly scrollbarProps: PropType<ScrollbarProps>;
109
- readonly localStorageKey: StringConstructor;
115
+ readonly localStorageKey: {
116
+ readonly type: StringConstructor;
117
+ readonly default: undefined;
118
+ };
119
+ readonly columnSettings: {
120
+ readonly type: BooleanConstructor;
121
+ readonly default: false;
122
+ };
123
+ readonly columnSettingsTriggerProps: {
124
+ readonly type: PropType<Partial<ButtonProps>>;
125
+ readonly default: undefined;
126
+ };
110
127
  readonly renderCell: PropType<(value: any, rowData: object, column: TableBaseColumn) => VNodeChild>;
111
128
  readonly defaultEmptyValue: PropType<string | (() => VNodeChild) | undefined>;
112
129
  readonly renderExpandIcon: PropType<RenderExpandIcon>;
@@ -3764,6 +3781,8 @@ export interface DataTableSlots {
3764
3781
  empty?: () => VNode[];
3765
3782
  loading?: () => VNode[];
3766
3783
  'drag-handle'?: () => VNode[];
3784
+ filters?: () => VNode[];
3785
+ 'column-settings-trigger'?: () => VNode[];
3767
3786
  }
3768
3787
  export type RowData = Record<string, any>;
3769
3788
  export type InternalRowData = Record<string, unknown>;
@@ -3799,6 +3818,7 @@ export interface CommonColumnInfo<T = InternalRowData> {
3799
3818
  cellProps?: (rowData: T, rowIndex: number) => HTMLAttributes;
3800
3819
  allowExport?: boolean;
3801
3820
  visible?: boolean;
3821
+ required?: boolean;
3802
3822
  }
3803
3823
  export interface TableColumnMaskObject {
3804
3824
  postProcess: (value: string) => string;
@@ -4104,8 +4124,37 @@ export interface MainTableInjection {
4104
4124
  leftActiveFixedColKey: ColumnKey | null;
4105
4125
  rightActiveFixedColKey: ColumnKey | null;
4106
4126
  }
4127
+ export interface DataTableColumnConfigState {
4128
+ key: string;
4129
+ order: number;
4130
+ hidden: boolean;
4131
+ }
4132
+ export interface DataTableColumnSettingsItem {
4133
+ key: string;
4134
+ title: string;
4135
+ visible: boolean;
4136
+ required: boolean;
4137
+ sortOrder: number;
4138
+ }
4139
+ export type DataTableConfigurableColumn = TableBaseColumn & {
4140
+ key: string | number;
4141
+ };
4142
+ export interface UseColumnSettingsReturn {
4143
+ enabledRef: ComputedRef<boolean>;
4144
+ resolvedColumnsRef: ComputedRef<TableColumns>;
4145
+ scrollXRef: ComputedRef<string | number | undefined>;
4146
+ columnsConfigRef: Ref<DataTableColumnConfigState[] | null>;
4147
+ drawerOpenRef: Ref<boolean>;
4148
+ drawerItemsRef: ComputedRef<DataTableColumnSettingsItem[]>;
4149
+ defaultDrawerItemsRef: ComputedRef<DataTableColumnSettingsItem[]>;
4150
+ openDrawer: () => void;
4151
+ resetConfig: () => void;
4152
+ applyConfig: (config: DataTableColumnConfigState[]) => void;
4153
+ applyConfigFromKeys: (orderedKeys: string[], hiddenKeys: string[]) => void;
4154
+ }
4107
4155
  export interface DataTableStorageState {
4108
4156
  columnWidths?: Record<string, number>;
4157
+ columnsConfig?: DataTableColumnConfigState[];
4109
4158
  page?: number;
4110
4159
  pageSize?: number;
4111
4160
  filters?: FilterState;
@@ -4170,6 +4219,9 @@ export interface DataTableInst {
4170
4219
  totalRows: InternalRowData | null;
4171
4220
  };
4172
4221
  getTotalRowData: () => InternalRowData | null;
4222
+ openColumnSettings: () => void;
4223
+ resetColumnSettings: () => void;
4224
+ applyColumnSettings: (config: DataTableColumnConfigState[]) => void;
4173
4225
  /** @deprecated it but just leave it here, it does no harm */
4174
4226
  clearFilter: () => void;
4175
4227
  }
@@ -1,5 +1,11 @@
1
1
  import { useTheme } from "../../_mixins/index.mjs";
2
2
  import { createInjectionKey } from "../../_utils/index.mjs";
3
+ export var TableColumnType;
4
+ (function (TableColumnType) {
5
+ TableColumnType["SELECTION"] = "selection";
6
+ TableColumnType["EXPAND"] = "expand";
7
+ TableColumnType["DRAGGABLE"] = "draggable";
8
+ })(TableColumnType || (TableColumnType = {}));
3
9
  export const dataTableProps = Object.assign(Object.assign({}, useTheme.props), {
4
10
  onUnstableColumnResize: Function,
5
11
  pagination: {
@@ -96,7 +102,18 @@ export const dataTableProps = Object.assign(Object.assign({}, useTheme.props), {
96
102
  default: 'current'
97
103
  },
98
104
  scrollbarProps: Object,
99
- localStorageKey: String,
105
+ localStorageKey: {
106
+ type: String,
107
+ default: undefined
108
+ },
109
+ columnSettings: {
110
+ type: Boolean,
111
+ default: false
112
+ },
113
+ columnSettingsTriggerProps: {
114
+ type: Object,
115
+ default: undefined
116
+ },
100
117
  renderCell: Function,
101
118
  defaultEmptyValue: [String, Function],
102
119
  renderExpandIcon: Function,
@@ -59,7 +59,23 @@ export default c([cB('data-table', `
59
59
  --u-merged-th-color-hover: var(--u-th-color-hover);
60
60
  --u-merged-td-color-hover: var(--u-td-color-hover);
61
61
  --u-merged-td-color-striped: var(--u-td-color-striped);
62
- `, [cB('data-table-wrapper', `
62
+ `, [cB('data-table-toolbar', `
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: flex-end;
66
+ gap: 16px;
67
+ margin-bottom: 12px;
68
+ flex-shrink: 0;
69
+ `, [cM('with-filters', `
70
+ justify-content: space-between;
71
+ `), cE('filters', `
72
+ display: flex;
73
+ align-items: center;
74
+ flex: 1;
75
+ min-width: 0;
76
+ `)]), cB('data-table-toolbar-button', `
77
+ flex-shrink: 0;
78
+ `), cB('data-table-wrapper', `
63
79
  flex-grow: 1;
64
80
  display: flex;
65
81
  flex-direction: column;
@@ -0,0 +1,2 @@
1
+ import type { ColumnKey, DataTableSetupProps, UseColumnSettingsReturn } from './interface';
2
+ export declare function useColumnSettings(props: DataTableSetupProps, getResizableWidth?: (key: ColumnKey) => number | undefined): UseColumnSettingsReturn;
@@ -0,0 +1,124 @@
1
+ import { computed, ref } from 'vue';
2
+ import { TableColumnType } from "./interface.mjs";
3
+ import { loadTableState } from "./use-table-storage.mjs";
4
+ import { getNumberColWidth } from "./utils/index.mjs";
5
+ function isConfigurableColumn(column) {
6
+ if ('children' in column) return false;
7
+ if (column.type === TableColumnType.SELECTION || column.type === TableColumnType.EXPAND || column.type === TableColumnType.DRAGGABLE) {
8
+ return false;
9
+ }
10
+ return column.visible !== false;
11
+ }
12
+ function toColumnTitle(column) {
13
+ return typeof column.title === 'string' ? column.title : String(column.key);
14
+ }
15
+ function calcColumnsScrollX(columns, getResizableWidth) {
16
+ let total = 0;
17
+ for (const column of columns) {
18
+ if (!('key' in column)) return undefined;
19
+ const resized = getResizableWidth === null || getResizableWidth === void 0 ? void 0 : getResizableWidth(column.key);
20
+ const width = resized !== null && resized !== void 0 ? resized : getNumberColWidth(column);
21
+ if (width === undefined) return undefined;
22
+ total += width;
23
+ }
24
+ return total;
25
+ }
26
+ export function useColumnSettings(props, getResizableWidth) {
27
+ var _a, _b;
28
+ const enabledRef = computed(() => !!props.columnSettings && !!props.localStorageKey);
29
+ const columnsConfigRef = ref(props.localStorageKey ? (_b = (_a = loadTableState(props.localStorageKey)) === null || _a === void 0 ? void 0 : _a.columnsConfig) !== null && _b !== void 0 ? _b : null : null);
30
+ const drawerOpenRef = ref(false);
31
+ const configurableColumnsRef = computed(() => {
32
+ return props.columns.filter(isConfigurableColumn);
33
+ });
34
+ const visibleColumnsRef = computed(() => {
35
+ const cols = configurableColumnsRef.value;
36
+ const config = columnsConfigRef.value;
37
+ if (!enabledRef.value || !config) return props.columns;
38
+ const stateMap = new Map(config.map(state => [state.key, state]));
39
+ const specialColumns = props.columns.filter(column => {
40
+ if ('children' in column) return true;
41
+ return column.type === TableColumnType.SELECTION || column.type === TableColumnType.EXPAND || column.type === TableColumnType.DRAGGABLE;
42
+ });
43
+ const ordered = [...cols].filter(col => {
44
+ var _a;
45
+ return !((_a = stateMap.get(String(col.key))) === null || _a === void 0 ? void 0 : _a.hidden);
46
+ }).sort((left, right) => {
47
+ var _a, _b, _c, _d;
48
+ const leftOrder = (_b = (_a = stateMap.get(String(left.key))) === null || _a === void 0 ? void 0 : _a.order) !== null && _b !== void 0 ? _b : config.length;
49
+ const rightOrder = (_d = (_c = stateMap.get(String(right.key))) === null || _c === void 0 ? void 0 : _c.order) !== null && _d !== void 0 ? _d : config.length;
50
+ return leftOrder - rightOrder;
51
+ });
52
+ return [...specialColumns, ...ordered];
53
+ });
54
+ function openDrawer() {
55
+ drawerOpenRef.value = true;
56
+ }
57
+ function resetConfig() {
58
+ columnsConfigRef.value = null;
59
+ }
60
+ function applyConfig(config) {
61
+ columnsConfigRef.value = config.map((item, index) => {
62
+ var _a;
63
+ return {
64
+ key: item.key,
65
+ order: (_a = item.order) !== null && _a !== void 0 ? _a : index,
66
+ hidden: !!item.hidden
67
+ };
68
+ });
69
+ }
70
+ function applyConfigFromKeys(orderedKeys, hiddenKeys) {
71
+ const hiddenSet = new Set(hiddenKeys);
72
+ applyConfig(orderedKeys.map((key, index) => ({
73
+ key,
74
+ order: index,
75
+ hidden: hiddenSet.has(key)
76
+ })));
77
+ }
78
+ const resolvedColumnsRef = computed(() => {
79
+ if (!enabledRef.value) return props.columns;
80
+ return visibleColumnsRef.value;
81
+ });
82
+ const scrollXRef = computed(() => {
83
+ if (!enabledRef.value) return props.scrollX;
84
+ if (props.scrollX !== undefined) return props.scrollX;
85
+ return calcColumnsScrollX(visibleColumnsRef.value, getResizableWidth);
86
+ });
87
+ const defaultDrawerItemsRef = computed(() => configurableColumnsRef.value.map((col, index) => ({
88
+ key: String(col.key),
89
+ title: toColumnTitle(col),
90
+ visible: true,
91
+ required: !!col.required,
92
+ sortOrder: index
93
+ })));
94
+ const drawerItemsRef = computed(() => {
95
+ const cols = configurableColumnsRef.value;
96
+ const config = columnsConfigRef.value;
97
+ const stateMap = config ? new Map(config.map(state => [state.key, state])) : new Map();
98
+ return cols.map((col, defaultIndex) => {
99
+ var _a;
100
+ const key = String(col.key);
101
+ const state = stateMap.get(key);
102
+ return {
103
+ key,
104
+ title: toColumnTitle(col),
105
+ visible: state ? !state.hidden : true,
106
+ required: !!col.required,
107
+ sortOrder: (_a = state === null || state === void 0 ? void 0 : state.order) !== null && _a !== void 0 ? _a : defaultIndex
108
+ };
109
+ }).sort((left, right) => left.sortOrder - right.sortOrder);
110
+ });
111
+ return {
112
+ enabledRef,
113
+ resolvedColumnsRef,
114
+ scrollXRef,
115
+ columnsConfigRef,
116
+ drawerOpenRef,
117
+ drawerItemsRef,
118
+ defaultDrawerItemsRef,
119
+ openDrawer,
120
+ resetConfig,
121
+ applyConfig,
122
+ applyConfigFromKeys
123
+ };
124
+ }
@@ -1,5 +1,5 @@
1
1
  import type { CSSProperties } from 'vue';
2
- import type { CreateRowClassName, DataRelatedColumn, InternalRowData, TableColumn } from '../interface';
2
+ import type { CreateRowClassName, DataRelatedColumn, DataTableColumnSettingsItem, InternalRowData, TableColumn } from '../interface';
3
3
  export declare const SELECTION_COL_WIDTH = 40;
4
4
  export declare const EXPAND_COL_WIDTH = 40;
5
5
  export declare const DRAGGABLE_COL_WIDTH = 40;
@@ -12,3 +12,4 @@ export declare function isColumnSortable(column: TableColumn): boolean;
12
12
  export declare function isColumnEllipsisEnabled(column: Pick<TableColumn, 'ellipsis'>): boolean;
13
13
  export declare function isColumnResizable(column: TableColumn): boolean;
14
14
  export declare function isColumnFilterable(column: TableColumn): boolean;
15
+ export declare function withSortSteps(items: DataTableColumnSettingsItem[]): DataTableColumnSettingsItem[];
@@ -89,4 +89,10 @@ export function isColumnResizable(column) {
89
89
  export function isColumnFilterable(column) {
90
90
  if ('children' in column) return false;
91
91
  return !!column.filter && (!!column.filterOptions || !!column.renderFilterMenu);
92
+ }
93
+ const SORT_ORDER_STEP = 1000;
94
+ export function withSortSteps(items) {
95
+ return items.map((item, index) => Object.assign(Object.assign({}, item), {
96
+ sortOrder: index * SORT_ORDER_STEP
97
+ }));
92
98
  }
@@ -0,0 +1,10 @@
1
+ export { default as UEditor } from './src/Editor';
2
+ export type { BlockTypeSelectProps } from './src/EditorParts/BlockTypeSelect/interface';
3
+ export { editorContentProps, type EditorContentProps, UEditorContent } from './src/EditorParts/EditorContent';
4
+ export { type EditorToolbarProps, editorToolbarProps, UEditorToolbar } from './src/EditorParts/EditorToolbar';
5
+ export type { SendButtonProps } from './src/EditorParts/SendButton/interface';
6
+ export type { ToolbarButtonProps } from './src/EditorParts/ToolbarButton/interface';
7
+ export { createEditorExtensions } from './src/extensions';
8
+ export { editorInjectionKey, editorProps } from './src/interface';
9
+ export type { EditorInst, EditorProps, EditorSlots, EditorToolbar, EditorToolbarItemKey } from './src/interface';
10
+ export type { Editor } from '@tiptap/vue-3';
@@ -0,0 +1,5 @@
1
+ export { default as UEditor } from "./src/Editor.mjs";
2
+ export { editorContentProps, UEditorContent } from "./src/EditorParts/EditorContent/index.mjs";
3
+ export { editorToolbarProps, UEditorToolbar } from "./src/EditorParts/EditorToolbar/index.mjs";
4
+ export { createEditorExtensions } from "./src/extensions.mjs";
5
+ export { editorInjectionKey, editorProps } from "./src/interface.mjs";