@atom8n/n8n-editor-ui 2.2.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 (310) hide show
  1. package/.stylelintcache +1 -0
  2. package/README.md +59 -0
  3. package/biome.jsonc +8 -0
  4. package/build.log +55 -0
  5. package/data/node-popularity.json +3998 -0
  6. package/dist/assets/AddDataTableModal-UINkk54_.js +1555 -0
  7. package/dist/assets/AgentEditorModal-CVww87TJ.js +358 -0
  8. package/dist/assets/Alert-Dy86dyOr.js +102 -0
  9. package/dist/assets/AnimatedSpinner-DmPN4poP.js +15 -0
  10. package/dist/assets/AnnotationTagsDropdown.ee-BJ7N9lek.js +71 -0
  11. package/dist/assets/AuthView-D2LWHrMp.js +106 -0
  12. package/dist/assets/BottomMenu-CIQiK_dJ.js +532 -0
  13. package/dist/assets/CalendarDate-DgQUMbNo.js +875 -0
  14. package/dist/assets/ChangePasswordView-Z6tUkw0u.js +133 -0
  15. package/dist/assets/ChatAgentAvatar-50YBnv3N.js +67 -0
  16. package/dist/assets/ChatFile-xZxmc2nV.js +146 -0
  17. package/dist/assets/ChatLayout-CTE_5SiM.js +96 -0
  18. package/dist/assets/ChatPersonalAgentsView-BGpHk03K.js +149 -0
  19. package/dist/assets/ChatSidebar-BkVwIypC.js +528 -0
  20. package/dist/assets/ChatView-BbbdeU9x.js +1559 -0
  21. package/dist/assets/ChatWorkflowAgentsView-BtunOxlC.js +116 -0
  22. package/dist/assets/CollectionParameter-BdcPG1lu.js +52 -0
  23. package/dist/assets/CommitMonoVariable-ytizKI8U.woff2 +0 -0
  24. package/dist/assets/CommunityNodeUpdateInfo-C37kca4W.js +273 -0
  25. package/dist/assets/CopyInput-DDZVu2iU.js +74 -0
  26. package/dist/assets/CredentialIcon-8YdTTFZ1.js +80 -0
  27. package/dist/assets/CredentialPicker-DWtj314o.js +293 -0
  28. package/dist/assets/CredentialSelectorModal-DTW2fKh0.js +138 -0
  29. package/dist/assets/CredentialsView-BjUchcCu.js +480 -0
  30. package/dist/assets/DataTableActions-DpAkoxg_.js +95 -0
  31. package/dist/assets/DataTableDetailsView-Coq7zdW5.js +41922 -0
  32. package/dist/assets/DataTableView-Cs-BIkzw.js +293 -0
  33. package/dist/assets/DemoFooter-Cga3jvi-.js +65 -0
  34. package/dist/assets/Draggable-vfvXl9Sp.js +105 -0
  35. package/dist/assets/EmptySharedSectionActionBox-DOXZtTCv.js +36 -0
  36. package/dist/assets/EnterpriseEdition.ee-D_rCFexM.js +15 -0
  37. package/dist/assets/EntityNotFound-3dhTRWsE.js +85 -0
  38. package/dist/assets/EntityUnAuthorised-ChJYZakE.js +66 -0
  39. package/dist/assets/ErrorView-zT9cX76a.js +61 -0
  40. package/dist/assets/EvaluationsRootView-C-OVWYnY.js +523 -0
  41. package/dist/assets/EvaluationsView-CJwJTruc.js +469 -0
  42. package/dist/assets/ExecutionsTime-DEQiyozR.js +573 -0
  43. package/dist/assets/ExecutionsView-Bd5Oh8TH.js +791 -0
  44. package/dist/assets/ExternalSecretsProviderConnectionSwitch.ee-C7Ih-uRo.js +191 -0
  45. package/dist/assets/FixedCollectionParameter-CYuTDW9t.js +496 -0
  46. package/dist/assets/ForgotMyPasswordView-Bs_L9P27.js +102 -0
  47. package/dist/assets/InsightsChartAverageRuntime-Bp3VA8_7.js +62 -0
  48. package/dist/assets/InsightsChartFailed-KPaNWoEr.js +52 -0
  49. package/dist/assets/InsightsChartFailureRate-DE6kE3FM.js +54 -0
  50. package/dist/assets/InsightsChartTimeSaved-auABNZlc.js +68 -0
  51. package/dist/assets/InsightsChartTotal-BKzYRKE7.js +56 -0
  52. package/dist/assets/InsightsDashboard-JWx4W6Db.js +473 -0
  53. package/dist/assets/InsightsPaywall-C8zLLKe8.js +63 -0
  54. package/dist/assets/InsightsSummary-cmN1lHDm.js +210 -0
  55. package/dist/assets/InsightsTableWorkflows-CqcC3IbQ.js +203 -0
  56. package/dist/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
  57. package/dist/assets/InterVariable-Italic-FCBEiFp6.woff2 +0 -0
  58. package/dist/assets/ItemsRenderer-DC8WVyMv.js +922 -0
  59. package/dist/assets/KeyboardShortcutTooltip-D8PAK5JP.js +31 -0
  60. package/dist/assets/LogsPanel-BR06u9RK.js +52 -0
  61. package/dist/assets/LogsPanel-C-_acMHp.js +2325 -0
  62. package/dist/assets/MCPConnectWorkflowsModal-3g8_iUa4.js +303 -0
  63. package/dist/assets/MainHeader-DiQc1edn.js +2153 -0
  64. package/dist/assets/MainSidebar-CoPGG5Ea.js +804 -0
  65. package/dist/assets/MigrationRuleDetail-BAxk1Pvl.js +295 -0
  66. package/dist/assets/MigrationRules-IW9lZMpE.js +285 -0
  67. package/dist/assets/Modal-CIzXlZdZ.js +204 -0
  68. package/dist/assets/ModelByIdSelectorModal-DLvBjzJO.js +115 -0
  69. package/dist/assets/NDVEmptyState-33UoX00I.js +19743 -0
  70. package/dist/assets/NodeCreation-BNzbSWSB.js +240 -0
  71. package/dist/assets/NodeCreator-BftgCKx7.js +1288 -0
  72. package/dist/assets/NodeDetailsView-CsoQCpcF.js +1075 -0
  73. package/dist/assets/NodeDetailsViewV2-C_wNQR_3.js +981 -0
  74. package/dist/assets/NodeIcon-B9VW6tX6.js +87 -0
  75. package/dist/assets/NodeSettings-ZwVip6VR.js +1872 -0
  76. package/dist/assets/NodeView-D4WUEvLB.js +2452 -0
  77. package/dist/assets/OAuthConsentView-DlrUqZbT.js +230 -0
  78. package/dist/assets/PageViewLayout-NT1KPFgy.js +12 -0
  79. package/dist/assets/ParameterInputList-sG2nz-Jo.js +38091 -0
  80. package/dist/assets/PrebuiltAgentTemplatesView-Csi5U8dc.js +154 -0
  81. package/dist/assets/ProjectBreadcrumb-C_XiY7sc.js +98 -0
  82. package/dist/assets/ProjectCardBadge-t_hs7vzx.js +209 -0
  83. package/dist/assets/ProjectHeader-Dq5Ihb26.js +549 -0
  84. package/dist/assets/ProjectIcon-DY8gGuHX.js +64 -0
  85. package/dist/assets/ProjectRoleView-Du-KTrAC.js +435 -0
  86. package/dist/assets/ProjectRolesView-DjxM_y4u.js +239 -0
  87. package/dist/assets/ProjectSettings-C6kWuV21.js +966 -0
  88. package/dist/assets/ProjectSharing-CVUgNWAY.js +262 -0
  89. package/dist/assets/ProjectVariables-CJlAo3dv.js +467 -0
  90. package/dist/assets/ProviderSettingsModal-BUFC2ZLv.js +307 -0
  91. package/dist/assets/PushConnectionTracker-DPBnGV0v.js +27 -0
  92. package/dist/assets/ResolversView-3BdkvvYA.js +209 -0
  93. package/dist/assets/ResourceFiltersDropdown-dgyXpcEX.js +159 -0
  94. package/dist/assets/ResourcesListLayout-qBLtomK6.js +631 -0
  95. package/dist/assets/RunDataHtml-BrW0OQra.js +7 -0
  96. package/dist/assets/RunDataHtml-Cleia4Cj.js +40 -0
  97. package/dist/assets/RunDataJson-uxkrhYRK.js +227 -0
  98. package/dist/assets/RunDataJsonActions-DkPk7E8d.js +5007 -0
  99. package/dist/assets/RunDataParsedAiContent-CtPRjig-.js +26 -0
  100. package/dist/assets/RunDataParsedAiContent-WAuqLQ5M.js +192 -0
  101. package/dist/assets/RunDataSearch-YBWUr93C.js +141 -0
  102. package/dist/assets/RunDataTable-DcXaBynW.js +631 -0
  103. package/dist/assets/SamlOnboarding-BTdQ_hr3.js +78 -0
  104. package/dist/assets/SaveButton-D5sQSxIk.js +89 -0
  105. package/dist/assets/SelectedItemsInfo-BHZ-NvF5.js +58 -0
  106. package/dist/assets/SettingsApiView-IfZTMXx1.js +313 -0
  107. package/dist/assets/SettingsChatHubView-gWh2X6vX.js +285 -0
  108. package/dist/assets/SettingsCommunityNodesView-D8VQtpGY.js +349 -0
  109. package/dist/assets/SettingsExternalSecrets-CpMc7mkW.js +233 -0
  110. package/dist/assets/SettingsLdapView-CU5a2MAy.js +2553 -0
  111. package/dist/assets/SettingsLogStreamingView-uojTe-oX.js +375 -0
  112. package/dist/assets/SettingsMCPView-B5Swp1C_.js +1214 -0
  113. package/dist/assets/SettingsPersonalView-Cr3aGood.js +402 -0
  114. package/dist/assets/SettingsSourceControl-DXOvFDEY.js +547 -0
  115. package/dist/assets/SettingsSso-27MfU1HV.js +1032 -0
  116. package/dist/assets/SettingsUsageAndPlan-DqIO-G46.js +419 -0
  117. package/dist/assets/SettingsUsersView-DfHB4_Kh.js +833 -0
  118. package/dist/assets/SettingsView-C4sA7Uny.js +90 -0
  119. package/dist/assets/SetupTemplateFormStep-BmiSzZin.js +258 -0
  120. package/dist/assets/SetupView-VORZ-L_u.js +112 -0
  121. package/dist/assets/SetupWorkflowCredentialsButton-DTmkOAW5.js +73 -0
  122. package/dist/assets/SetupWorkflowFromTemplateView-B9NupdJE.js +286 -0
  123. package/dist/assets/SeverityTag-CX1qTTNA.js +45 -0
  124. package/dist/assets/SigninView-D9_Pm16j.js +358 -0
  125. package/dist/assets/SignoutView-BFsjEAGz.js +19 -0
  126. package/dist/assets/SignupView-Am4ot0QZ.js +137 -0
  127. package/dist/assets/SkeletonAgentCard-C5TL-h8F.js +191 -0
  128. package/dist/assets/TagsDropdown-Bvx_Hd6Q.js +230 -0
  129. package/dist/assets/TemplateCard-CyQ1GuVz.js +105 -0
  130. package/dist/assets/TemplateDetails-CZRusTxE.js +124 -0
  131. package/dist/assets/TemplateList-DKvbwuiY.js +333 -0
  132. package/dist/assets/TemplatesCollectionView-D8dxU8By.js +184 -0
  133. package/dist/assets/TemplatesSearchView-CebC_GLs.js +1230 -0
  134. package/dist/assets/TemplatesView-025CcmIY.js +57 -0
  135. package/dist/assets/TemplatesWorkflowView-C2JfwJAn.js +170 -0
  136. package/dist/assets/TestRunDetailView-Ck78TTWO.js +395 -0
  137. package/dist/assets/TextWithHighlights-BxumwGnv.js +57 -0
  138. package/dist/assets/TimeAgo-C6EN4lCs.js +123 -0
  139. package/dist/assets/ToolsSelectorModal-8QJoUvRL.js +368 -0
  140. package/dist/assets/TriggerPanel-B6pacLkk.js +1225 -0
  141. package/dist/assets/VirtualSchema-B3zGe_8b.js +2402 -0
  142. package/dist/assets/VirtualSchema-Dkh0Cu5z.js +37 -0
  143. package/dist/assets/VueMarkdown-CQqJL9vK.js +28 -0
  144. package/dist/assets/WorkerView-Caznsljo.js +563 -0
  145. package/dist/assets/WorkflowActivationErrorMessage-CGrfPi9O.js +17 -0
  146. package/dist/assets/WorkflowActivator-BINnz0f7.js +362 -0
  147. package/dist/assets/WorkflowExecutionsInfoAccordion-Dg37yEfT.js +166 -0
  148. package/dist/assets/WorkflowExecutionsLandingPage-V2wdubhK.js +93 -0
  149. package/dist/assets/WorkflowExecutionsPreview-DdJaqYV6.js +616 -0
  150. package/dist/assets/WorkflowExecutionsView-DV8ySTfn.js +808 -0
  151. package/dist/assets/WorkflowHistory-GtaBMzIM.js +973 -0
  152. package/dist/assets/WorkflowLocation-CQ9Sq-2y.js +164 -0
  153. package/dist/assets/WorkflowOnboardingView-C49gt0Jr.js +61 -0
  154. package/dist/assets/WorkflowPreview-CXdvv4Nq.js +186 -0
  155. package/dist/assets/WorkflowTagsDropdown-QwbICWjN.js +71 -0
  156. package/dist/assets/WorkflowsView-B-MWIECO.js +3253 -0
  157. package/dist/assets/_MapCache-CcdIl4Ae.js +363 -0
  158. package/dist/assets/_baseOrderBy-N8Be_6z6.js +2989 -0
  159. package/dist/assets/_initCloneObject-viQQyT6o.js +80 -0
  160. package/dist/assets/_plugin-vue_export-helper-BwBpWJRZ.js +6 -0
  161. package/dist/assets/aiTemplatesStarterCollection.store-nL9nePkK.js +656 -0
  162. package/dist/assets/apiKeys.store-BhOFmP2j.js +51 -0
  163. package/dist/assets/assistant.store-CNywgN4S.js +518 -0
  164. package/dist/assets/auth.eventBus-CWXS0Qp7.js +5 -0
  165. package/dist/assets/banners.store-CGEcBTDn.js +195 -0
  166. package/dist/assets/builder.store-Czk2ipDE.js +31417 -0
  167. package/dist/assets/buttons.esm-yintpW2E.js +364 -0
  168. package/dist/assets/chart-CNvyywtJ.js +10958 -0
  169. package/dist/assets/chartjs.utils-BAE52Cv9.js +155 -0
  170. package/dist/assets/chat.store-290YeyrQ.js +865 -0
  171. package/dist/assets/chatPanel.store-NDaawEZL.js +118 -0
  172. package/dist/assets/chunk-6z4oVpB-.js +36 -0
  173. package/dist/assets/col-Cmt4cmuS.js +158 -0
  174. package/dist/assets/constants-C8OH4tTq.js +106256 -0
  175. package/dist/assets/constants-DMrsrpD7.js +32 -0
  176. package/dist/assets/core-B9gt_4yk.js +4 -0
  177. package/dist/assets/core-CP5FY4aX.js +1202 -0
  178. package/dist/assets/core-CRbPymLT.js +9741 -0
  179. package/dist/assets/dataTable.store-DmipQsol.js +207 -0
  180. package/dist/assets/date-picker-2IDsBs2n.js +4115 -0
  181. package/dist/assets/dateFormatter-ik4-9_9r.js +33 -0
  182. package/dist/assets/dateformat-hG8NERse.js +181 -0
  183. package/dist/assets/dialog-lMho1TD8.js +425 -0
  184. package/dist/assets/dist-Cw46Is-h.js +151 -0
  185. package/dist/assets/doppler-B__k0MeW.webp +0 -0
  186. package/dist/assets/element-icons-B-tDfklg.woff +0 -0
  187. package/dist/assets/element-icons-_lZGOqcG.ttf +0 -0
  188. package/dist/assets/empty-BuGRxzl4.js +2210 -0
  189. package/dist/assets/en-CF30SCh2.js +95 -0
  190. package/dist/assets/en-DyO2pPiC.js +2 -0
  191. package/dist/assets/es-BkUFJVtD.js +43338 -0
  192. package/dist/assets/evaluation.constants-GYAwmJnh.js +284 -0
  193. package/dist/assets/executions.store-B9uRYwgv.js +205 -0
  194. package/dist/assets/exports-Crx_gvt_.js +1799 -0
  195. package/dist/assets/externalSecrets.ee.store-BJh4a_6G.js +118 -0
  196. package/dist/assets/fileUtils-CRWqOQje.js +20 -0
  197. package/dist/assets/folders.store-yAFj-5Vl.js +235 -0
  198. package/dist/assets/get-BcEmeOxn.js +2781 -0
  199. package/dist/assets/index-SL8542zQ.js +28372 -0
  200. package/dist/assets/insights.constants-BkJCYJTL.js +55 -0
  201. package/dist/assets/insights.store-BFc3kDUo.js +61 -0
  202. package/dist/assets/insights.utils-CcLXdrrz.js +77 -0
  203. package/dist/assets/isEmpty-C3XXoHqJ.js +35216 -0
  204. package/dist/assets/languageModules-9LyndCqU.js +13862 -0
  205. package/dist/assets/logStreaming.store-IZhWe_VK.js +190 -0
  206. package/dist/assets/mcp.constants-_Jcn7fPq.js +10 -0
  207. package/dist/assets/mcp.store-B9yfcAN9.js +116 -0
  208. package/dist/assets/merge-DhuTk1HM.js +564 -0
  209. package/dist/assets/nodeCreator.store-Bpnrwp2l.js +5444 -0
  210. package/dist/assets/nodeIcon-D6X-ENYt.js +102 -0
  211. package/dist/assets/nodeTransforms-RzcOM0v2.js +42 -0
  212. package/dist/assets/orderBy-Cu9F9DU_.js +15 -0
  213. package/dist/assets/path-browserify-RUt2u7iT.js +328 -0
  214. package/dist/assets/personalizedTemplatesV3.store-BGYp0YBN.js +334 -0
  215. package/dist/assets/pickBy-UI0Jt4wC.js +18 -0
  216. package/dist/assets/preload-helper-dyVz7ck7.js +59 -0
  217. package/dist/assets/radio-CSce3UT0.js +262 -0
  218. package/dist/assets/readyToRun.store-YEMvPUqo.js +626 -0
  219. package/dist/assets/readyToRunWorkflows.store-G3srgIze.js +1319 -0
  220. package/dist/assets/retry-BgHaYzbB.js +23 -0
  221. package/dist/assets/roles.store-CRf_zJTb.js +51 -0
  222. package/dist/assets/router-DNpzz3GH.js +2631 -0
  223. package/dist/assets/sanitize-html-CbW56HUN.js +10758 -0
  224. package/dist/assets/schemaPreview.store-DUgN1yVE.js +113 -0
  225. package/dist/assets/semver-Bk6DGseV.js +1306 -0
  226. package/dist/assets/smartDecimal-DAZl4HKA.js +6 -0
  227. package/dist/assets/sortByProperty-Cn7iGKYu.js +8 -0
  228. package/dist/assets/sourceControl.eventBus-D47xXSc_.js +3 -0
  229. package/dist/assets/sqlite3-DBpDb1lf.wasm +0 -0
  230. package/dist/assets/sqlite3-opfs-async-proxy-vVtmDGHX.js +461 -0
  231. package/dist/assets/sqlite3-worker1-bundler-friendly-DLarOZDL.js +9405 -0
  232. package/dist/assets/src-jviYSG25.js +55454 -0
  233. package/dist/assets/sso.store-DyApJwhx.js +139 -0
  234. package/dist/assets/style-E3CrYFV8.css +111829 -0
  235. package/dist/assets/table-we1DjFMV.js +3944 -0
  236. package/dist/assets/templateActions-bEDSARw2.js +65 -0
  237. package/dist/assets/templateTransforms-BHWiRbtR.js +43 -0
  238. package/dist/assets/truncate-C0KYt7i3.js +4176 -0
  239. package/dist/assets/typescript.worker-CYqLvLHh.js +152048 -0
  240. package/dist/assets/uniqBy-xDyuCRP0.js +10 -0
  241. package/dist/assets/usage.store-CU5J_nGm.js +100 -0
  242. package/dist/assets/useActions-B1JckIRj.js +255 -0
  243. package/dist/assets/useBeforeUnload-DiDkvI8p.js +40 -0
  244. package/dist/assets/useCanvasMapping-BXT7rGhC.js +12570 -0
  245. package/dist/assets/useCanvasOperations-8ULLtMkY.js +1765 -0
  246. package/dist/assets/useClipboard-DvjhVHqJ.js +39 -0
  247. package/dist/assets/useCommandBar-C4tLJbKt.js +2425 -0
  248. package/dist/assets/useCredentialResolvers-BKeFGJnY.js +78 -0
  249. package/dist/assets/useCustomAgent-DpILEt5e.js +471 -0
  250. package/dist/assets/useDebounce-Br5_1ug-.js +147 -0
  251. package/dist/assets/useExecutionData-M5iKsX6z.js +23 -0
  252. package/dist/assets/useExecutionDebugging-8azMzbnd.js +191 -0
  253. package/dist/assets/useExecutionHelpers-BgRRhpBM.js +91 -0
  254. package/dist/assets/useImportCurlCommand-CKiEmX5P.js +8891 -0
  255. package/dist/assets/useIntersectionObserver-BWMwOueh.js +33 -0
  256. package/dist/assets/useKeybindings-B2jfN6rd.js +62 -0
  257. package/dist/assets/useLogsTreeExpand-sZViUfdM.js +843 -0
  258. package/dist/assets/useMcp-DoMOIfqT.js +27 -0
  259. package/dist/assets/usePageRedirectionHelper-DjkznpX6.js +51 -0
  260. package/dist/assets/usePinnedData-BhZkqttf.js +203 -0
  261. package/dist/assets/usePushConnection-DMS-F_IW.js +513 -0
  262. package/dist/assets/useRecentResources-BVORr7eM.js +118 -0
  263. package/dist/assets/useRunWorkflow-LO7ffLp9.js +950 -0
  264. package/dist/assets/useSettingsItems-BhZXwMZn.js +144 -0
  265. package/dist/assets/useTelemetryContext-V6bv4YRq.js +34 -0
  266. package/dist/assets/useWorkflowActivate-DeSmDXjI.js +152 -0
  267. package/dist/assets/useWorkflowsCache-DtcEEAIR.js +179 -0
  268. package/dist/assets/userRoleProvisioning.store-kkSIdeTo.js +33 -0
  269. package/dist/assets/utils-DI7dLldp.js +54 -0
  270. package/dist/assets/versions.store-B1z2OrLE.js +191 -0
  271. package/dist/assets/vue-CydWIhxN.js +4378 -0
  272. package/dist/assets/vue-json-pretty-CsGX66mG.js +1130 -0
  273. package/dist/assets/vue.runtime.esm-bundler-tP5dCd7J.js +7325 -0
  274. package/dist/assets/xml-B_oj6Mle.js +2060 -0
  275. package/dist/favicon.ico +0 -0
  276. package/dist/index.html +157 -0
  277. package/dist/static/base-path.js +1 -0
  278. package/dist/static/community_package_tooltip_img.png +0 -0
  279. package/dist/static/data-mapping-gif.gif +0 -0
  280. package/dist/static/form-grey.svg +1 -0
  281. package/dist/static/google-auth/disabled.dark.png +0 -0
  282. package/dist/static/google-auth/disabled.png +0 -0
  283. package/dist/static/google-auth/focus.dark.png +0 -0
  284. package/dist/static/google-auth/focus.png +0 -0
  285. package/dist/static/google-auth/normal.dark.png +0 -0
  286. package/dist/static/google-auth/normal.png +0 -0
  287. package/dist/static/google-auth/pressed.dark.png +0 -0
  288. package/dist/static/google-auth/pressed.png +0 -0
  289. package/dist/static/n8n-logo.png +0 -0
  290. package/dist/static/og_image.png +0 -0
  291. package/dist/static/open-ai.svg +1 -0
  292. package/dist/static/openChat.png +0 -0
  293. package/dist/static/posthog.init.js +41 -0
  294. package/dist/static/prefers-color-scheme.css +5 -0
  295. package/dist/static/webhook-icon.svg +1 -0
  296. package/dist/tree-sitter-bash.wasm +0 -0
  297. package/dist/tree-sitter.wasm +0 -0
  298. package/eslint.config.mjs +59 -0
  299. package/index.html +45 -0
  300. package/index.js +0 -0
  301. package/package.json +147 -0
  302. package/postcss.config.cjs +6 -0
  303. package/scripts/fetch-node-popularity.mjs +102 -0
  304. package/stylelint.config.mjs +9 -0
  305. package/tailwind.config.js +8 -0
  306. package/tsconfig.json +36 -0
  307. package/vite/i18n-locales-hmr-helpers.ts +19 -0
  308. package/vite/source-map-js-shim.ts +1 -0
  309. package/vite/vite-plugin-node-popularity.mts +32 -0
  310. package/vite.config.mts +304 -0
@@ -0,0 +1,3944 @@
1
+ import { o as __toESM, t as __commonJSMin } from "./chunk-6z4oVpB-.js";
2
+ import { $ as onUpdated, $t as hasOwn, C as computed, Cn as toDisplayString, D as createElementBlock, E as createCommentVNode, F as getCurrentInstance, G as nextTick, Gt as unref, Ht as toRefs, It as ref, J as onBeforeUnmount, L as h, M as createVNode, P as defineComponent, Q as onUnmounted, T as createBlock, Z as onMounted, _ as Fragment, _t as watch, at as renderSlot, bn as normalizeStyle, bt as withCtx, cn as isObject, et as openBlock, g as Comment, it as renderList, j as createTextVNode, jt as isRef, mn as isString, nn as isArray, nt as provide, ot as resolveComponent, p as vShow, q as onBeforeMount, st as resolveDirective, tn as init_shared_esm_bundler, vn as normalizeClass, vt as watchEffect, w as createBaseVNode, xt as withDirectives, z as inject } from "./vue.runtime.esm-bundler-tP5dCd7J.js";
3
+ import { Bt as ElTooltip, Ht as ElScrollbar, Jt as _baseIteratee_default, Lt as ElCheckbox, Ut as useDelayedToggle, Wt as yn, _n as identity_default, an as keys_default, cn as isTypedArray_default, dn as isBuffer_default, fn as isArguments_default, gn as _setToString_default, hn as _overRest_default, mn as isArrayLike_default, rn as _baseFlatten_default, tn as _Stack_default, zt as ClickOutside } from "./src-jviYSG25.js";
4
+ import { A as useLocale, At as debugWarn, Bt as isUndefined, C as useSizeProp, Gt as get_default, It as isBoolean, K as withNoopInstall, Lt as isElement, Nt as getProp, Ot as hasClass, Tt as addClass, W as withInstall, Wt as debounce_default, bn as useResizeObserver, cn as isObject_default, dn as isObjectLike_default, en as eq_default, fn as _baseGetTag_default, g as useFormSize, ht as loading_default, it as arrow_up_default, jt as throwError, k as useNamespace, kt as removeClass, ln as isArray_default, nn as _isIndex_default, on as isFunction_default, rt as arrow_right_default, tn as _baseAssignValue_default, tt as arrow_down_default, un as _arrayMap_default, v as ElIcon, w as useZIndex, wn as isClient, y as _export_sfc, yn as useEventListener, zt as isNumber } from "./truncate-C0KYt7i3.js";
5
+ import { a as _getPrototype_default, c as _copyArray_default, i as _cloneBuffer_default, n as _cloneTypedArray_default, o as keysIn_default, s as _copyObject_default, t as _initCloneObject_default } from "./_initCloneObject-viQQyT6o.js";
6
+ function baseRest(func, start) {
7
+ return _setToString_default(_overRest_default(func, start, identity_default), func + "");
8
+ }
9
+ var _baseRest_default = baseRest;
10
+ function isIterateeCall(value, index, object) {
11
+ if (!isObject_default(object)) return false;
12
+ var type = typeof index;
13
+ if (type == "number" ? isArrayLike_default(object) && _isIndex_default(index, object.length) : type == "string" && index in object) return eq_default(object[index], value);
14
+ return false;
15
+ }
16
+ var _isIterateeCall_default = isIterateeCall;
17
+ function createAssigner(assigner) {
18
+ return _baseRest_default(function(object, sources) {
19
+ var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
20
+ customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
21
+ if (guard && _isIterateeCall_default(sources[0], sources[1], guard)) {
22
+ customizer = length < 3 ? void 0 : customizer;
23
+ length = 1;
24
+ }
25
+ object = Object(object);
26
+ while (++index < length) {
27
+ var source = sources[index];
28
+ if (source) assigner(object, source, index, customizer);
29
+ }
30
+ return object;
31
+ });
32
+ }
33
+ var _createAssigner_default = createAssigner;
34
+ var objectTag = "[object Object]";
35
+ var funcProto = Function.prototype, objectProto = Object.prototype;
36
+ var funcToString = funcProto.toString;
37
+ var hasOwnProperty = objectProto.hasOwnProperty;
38
+ var objectCtorString = funcToString.call(Object);
39
+ function isPlainObject(value) {
40
+ if (!isObjectLike_default(value) || _baseGetTag_default(value) != objectTag) return false;
41
+ var proto = _getPrototype_default(value);
42
+ if (proto === null) return true;
43
+ var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
44
+ return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
45
+ }
46
+ var isPlainObject_default = isPlainObject;
47
+ function createBaseFor(fromRight) {
48
+ return function(object, iteratee, keysFunc) {
49
+ var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
50
+ while (length--) {
51
+ var key = props[fromRight ? length : ++index];
52
+ if (iteratee(iterable[key], key, iterable) === false) break;
53
+ }
54
+ return object;
55
+ };
56
+ }
57
+ var _baseFor_default = createBaseFor();
58
+ function baseForOwn(object, iteratee) {
59
+ return object && _baseFor_default(object, iteratee, keys_default);
60
+ }
61
+ var _baseForOwn_default = baseForOwn;
62
+ function createBaseEach(eachFunc, fromRight) {
63
+ return function(collection, iteratee) {
64
+ if (collection == null) return collection;
65
+ if (!isArrayLike_default(collection)) return eachFunc(collection, iteratee);
66
+ var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
67
+ while (fromRight ? index-- : ++index < length) if (iteratee(iterable[index], index, iterable) === false) break;
68
+ return collection;
69
+ };
70
+ }
71
+ var _baseEach_default = createBaseEach(_baseForOwn_default);
72
+ function assignMergeValue(object, key, value) {
73
+ if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) _baseAssignValue_default(object, key, value);
74
+ }
75
+ var _assignMergeValue_default = assignMergeValue;
76
+ function isArrayLikeObject(value) {
77
+ return isObjectLike_default(value) && isArrayLike_default(value);
78
+ }
79
+ var isArrayLikeObject_default = isArrayLikeObject;
80
+ function safeGet(object, key) {
81
+ if (key === "constructor" && typeof object[key] === "function") return;
82
+ if (key == "__proto__") return;
83
+ return object[key];
84
+ }
85
+ var _safeGet_default = safeGet;
86
+ function toPlainObject(value) {
87
+ return _copyObject_default(value, keysIn_default(value));
88
+ }
89
+ var toPlainObject_default = toPlainObject;
90
+ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
91
+ var objValue = _safeGet_default(object, key), srcValue = _safeGet_default(source, key), stacked = stack.get(srcValue);
92
+ if (stacked) {
93
+ _assignMergeValue_default(object, key, stacked);
94
+ return;
95
+ }
96
+ var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
97
+ var isCommon = newValue === void 0;
98
+ if (isCommon) {
99
+ var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue);
100
+ newValue = srcValue;
101
+ if (isArr || isBuff || isTyped) if (isArray_default(objValue)) newValue = objValue;
102
+ else if (isArrayLikeObject_default(objValue)) newValue = _copyArray_default(objValue);
103
+ else if (isBuff) {
104
+ isCommon = false;
105
+ newValue = _cloneBuffer_default(srcValue, true);
106
+ } else if (isTyped) {
107
+ isCommon = false;
108
+ newValue = _cloneTypedArray_default(srcValue, true);
109
+ } else newValue = [];
110
+ else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) {
111
+ newValue = objValue;
112
+ if (isArguments_default(objValue)) newValue = toPlainObject_default(objValue);
113
+ else if (!isObject_default(objValue) || isFunction_default(objValue)) newValue = _initCloneObject_default(srcValue);
114
+ } else isCommon = false;
115
+ }
116
+ if (isCommon) {
117
+ stack.set(srcValue, newValue);
118
+ mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
119
+ stack["delete"](srcValue);
120
+ }
121
+ _assignMergeValue_default(object, key, newValue);
122
+ }
123
+ var _baseMergeDeep_default = baseMergeDeep;
124
+ function baseMerge(object, source, srcIndex, customizer, stack) {
125
+ if (object === source) return;
126
+ _baseFor_default(source, function(srcValue, key) {
127
+ stack || (stack = new _Stack_default());
128
+ if (isObject_default(srcValue)) _baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack);
129
+ else {
130
+ var newValue = customizer ? customizer(_safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0;
131
+ if (newValue === void 0) newValue = srcValue;
132
+ _assignMergeValue_default(object, key, newValue);
133
+ }
134
+ }, keysIn_default);
135
+ }
136
+ var _baseMerge_default = baseMerge;
137
+ function baseMap(collection, iteratee) {
138
+ var index = -1, result = isArrayLike_default(collection) ? Array(collection.length) : [];
139
+ _baseEach_default(collection, function(value, key, collection$1) {
140
+ result[++index] = iteratee(value, key, collection$1);
141
+ });
142
+ return result;
143
+ }
144
+ var _baseMap_default = baseMap;
145
+ function map(collection, iteratee) {
146
+ return (isArray_default(collection) ? _arrayMap_default : _baseMap_default)(collection, _baseIteratee_default(iteratee, 3));
147
+ }
148
+ var map_default = map;
149
+ function flatMap(collection, iteratee) {
150
+ return _baseFlatten_default(map_default(collection, iteratee), 1);
151
+ }
152
+ var flatMap_default = flatMap;
153
+ var merge_default = _createAssigner_default(function(object, source, srcIndex) {
154
+ _baseMerge_default(object, source, srcIndex);
155
+ });
156
+ var rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
157
+ var v = !1, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
158
+ function a() {
159
+ if (!v) {
160
+ v = !0;
161
+ var e = navigator.userAgent, n = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e), i = /(Mac OS X)|(Windows)|(Linux)/.exec(e);
162
+ if (x = /\b(iPhone|iP[ao]d)/.exec(e), E = /\b(iP[ao]d)/.exec(e), w = /Android/i.exec(e), M = /FBAN\/\w+;/i.exec(e), F = /Mobile/i.exec(e), D = !!/Win64/.exec(e), n) {
163
+ o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
164
+ var r = /(?:Trident\/(\d+.\d+))/.exec(e);
165
+ N = r ? parseFloat(r[1]) + 4 : o, f = n[2] ? parseFloat(n[2]) : NaN, s = n[3] ? parseFloat(n[3]) : NaN, u = n[4] ? parseFloat(n[4]) : NaN, u ? (n = /(?:Chrome\/(\d+\.\d+))/.exec(e), d = n && n[1] ? parseFloat(n[1]) : NaN) : d = NaN;
166
+ } else o = f = s = d = u = NaN;
167
+ if (i) {
168
+ if (i[1]) {
169
+ var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
170
+ l = t ? parseFloat(t[1].replace("_", ".")) : !0;
171
+ } else l = !1;
172
+ p = !!i[2], m = !!i[3];
173
+ } else l = p = m = !1;
174
+ }
175
+ }
176
+ var _ = {
177
+ ie: function() {
178
+ return a() || o;
179
+ },
180
+ ieCompatibilityMode: function() {
181
+ return a() || N > o;
182
+ },
183
+ ie64: function() {
184
+ return _.ie() && D;
185
+ },
186
+ firefox: function() {
187
+ return a() || f;
188
+ },
189
+ opera: function() {
190
+ return a() || s;
191
+ },
192
+ webkit: function() {
193
+ return a() || u;
194
+ },
195
+ safari: function() {
196
+ return _.webkit();
197
+ },
198
+ chrome: function() {
199
+ return a() || d;
200
+ },
201
+ windows: function() {
202
+ return a() || p;
203
+ },
204
+ osx: function() {
205
+ return a() || l;
206
+ },
207
+ linux: function() {
208
+ return a() || m;
209
+ },
210
+ iphone: function() {
211
+ return a() || x;
212
+ },
213
+ mobile: function() {
214
+ return a() || x || E || w || F;
215
+ },
216
+ nativeApp: function() {
217
+ return a() || M;
218
+ },
219
+ android: function() {
220
+ return a() || w;
221
+ },
222
+ ipad: function() {
223
+ return a() || E;
224
+ }
225
+ }, A = _;
226
+ var c = !!(typeof window < "u" && window.document && window.document.createElement), h$1 = {
227
+ canUseDOM: c,
228
+ canUseWorkers: typeof Worker < "u",
229
+ canUseEventListeners: c && !!(window.addEventListener || window.attachEvent),
230
+ canUseViewport: c && !!window.screen,
231
+ isInWorker: !c
232
+ };
233
+ var X;
234
+ h$1.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== !0);
235
+ function S(e, n) {
236
+ if (!h$1.canUseDOM || n && !("addEventListener" in document)) return !1;
237
+ var i = "on" + e, r = i in document;
238
+ if (!r) {
239
+ var t = document.createElement("div");
240
+ t.setAttribute(i, "return;"), r = typeof t[i] == "function";
241
+ }
242
+ return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
243
+ }
244
+ var b = S;
245
+ var O = 10, I = 40, P = 800;
246
+ function T(e) {
247
+ var n = 0, i = 0, r = 0, t = 0;
248
+ return "detail" in e && (i = e.detail), "wheelDelta" in e && (i = -e.wheelDelta / 120), "wheelDeltaY" in e && (i = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (n = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (n = i, i = 0), r = n * O, t = i * O, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= I, t *= I) : (r *= P, t *= P)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), {
249
+ spinX: n,
250
+ spinY: i,
251
+ pixelX: r,
252
+ pixelY: t
253
+ };
254
+ }
255
+ T.getEventType = function() {
256
+ return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
257
+ };
258
+ var Y = T;
259
+ /**
260
+ * Checks if an event is supported in the current execution environment.
261
+ *
262
+ * NOTE: This will not work correctly for non-generic events such as `change`,
263
+ * `reset`, `load`, `error`, and `select`.
264
+ *
265
+ * Borrows from Modernizr.
266
+ *
267
+ * @param {string} eventNameSuffix Event name, e.g. "click".
268
+ * @param {?boolean} capture Check if the capture phase is supported.
269
+ * @return {boolean} True if the event is supported.
270
+ * @internal
271
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
272
+ */
273
+ var mousewheel = function(element, callback) {
274
+ if (element && element.addEventListener) {
275
+ const fn = function(event) {
276
+ const normalized = Y(event);
277
+ callback && Reflect.apply(callback, this, [event, normalized]);
278
+ };
279
+ element.addEventListener("wheel", fn, { passive: true });
280
+ }
281
+ };
282
+ var Mousewheel = { beforeMount(el, binding) {
283
+ mousewheel(el, binding.value);
284
+ } };
285
+ var import_escape_html = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
286
+ var matchHtmlRegExp = /["'&<>]/;
287
+ module.exports = escapeHtml$1;
288
+ function escapeHtml$1(string) {
289
+ var str = "" + string;
290
+ var match = matchHtmlRegExp.exec(str);
291
+ if (!match) return str;
292
+ var escape;
293
+ var html = "";
294
+ var index = 0;
295
+ var lastIndex = 0;
296
+ for (index = match.index; index < str.length; index++) {
297
+ switch (str.charCodeAt(index)) {
298
+ case 34:
299
+ escape = "&quot;";
300
+ break;
301
+ case 38:
302
+ escape = "&amp;";
303
+ break;
304
+ case 39:
305
+ escape = "&#39;";
306
+ break;
307
+ case 60:
308
+ escape = "&lt;";
309
+ break;
310
+ case 62:
311
+ escape = "&gt;";
312
+ break;
313
+ default: continue;
314
+ }
315
+ if (lastIndex !== index) html += str.substring(lastIndex, index);
316
+ lastIndex = index + 1;
317
+ html += escape;
318
+ }
319
+ return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
320
+ }
321
+ })))(), 1);
322
+ init_shared_esm_bundler();
323
+ var getCell = function(event) {
324
+ var _a;
325
+ return (_a = event.target) == null ? void 0 : _a.closest("td");
326
+ };
327
+ var orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
328
+ if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) return array;
329
+ if (typeof reverse === "string") reverse = reverse === "descending" ? -1 : 1;
330
+ else reverse = reverse && reverse < 0 ? -1 : 1;
331
+ const getKey = sortMethod ? null : function(value, index) {
332
+ if (sortBy) {
333
+ if (!Array.isArray(sortBy)) sortBy = [sortBy];
334
+ return sortBy.map((by) => {
335
+ if (typeof by === "string") return get_default(value, by);
336
+ else return by(value, index, array);
337
+ });
338
+ }
339
+ if (sortKey !== "$key") {
340
+ if (isObject(value) && "$value" in value) value = value.$value;
341
+ }
342
+ return [isObject(value) ? get_default(value, sortKey) : value];
343
+ };
344
+ const compare = function(a$1, b$1) {
345
+ if (sortMethod) return sortMethod(a$1.value, b$1.value);
346
+ for (let i = 0, len = a$1.key.length; i < len; i++) {
347
+ if (a$1.key[i] < b$1.key[i]) return -1;
348
+ if (a$1.key[i] > b$1.key[i]) return 1;
349
+ }
350
+ return 0;
351
+ };
352
+ return array.map((value, index) => {
353
+ return {
354
+ value,
355
+ index,
356
+ key: getKey ? getKey(value, index) : null
357
+ };
358
+ }).sort((a$1, b$1) => {
359
+ let order = compare(a$1, b$1);
360
+ if (!order) order = a$1.index - b$1.index;
361
+ return order * +reverse;
362
+ }).map((item) => item.value);
363
+ };
364
+ var getColumnById = function(table, columnId) {
365
+ let column = null;
366
+ table.columns.forEach((item) => {
367
+ if (item.id === columnId) column = item;
368
+ });
369
+ return column;
370
+ };
371
+ var getColumnByKey = function(table, columnKey) {
372
+ let column = null;
373
+ for (let i = 0; i < table.columns.length; i++) {
374
+ const item = table.columns[i];
375
+ if (item.columnKey === columnKey) {
376
+ column = item;
377
+ break;
378
+ }
379
+ }
380
+ if (!column) throwError("ElTable", `No column matching with column-key: ${columnKey}`);
381
+ return column;
382
+ };
383
+ var getColumnByCell = function(table, cell, namespace) {
384
+ const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
385
+ if (matches) return getColumnById(table, matches[0]);
386
+ return null;
387
+ };
388
+ var getRowIdentity = (row, rowKey) => {
389
+ if (!row) throw new Error("Row is required when get row identity");
390
+ if (typeof rowKey === "string") {
391
+ if (!rowKey.includes(".")) return `${row[rowKey]}`;
392
+ const key = rowKey.split(".");
393
+ let current = row;
394
+ for (const element of key) current = current[element];
395
+ return `${current}`;
396
+ } else if (typeof rowKey === "function") return rowKey.call(null, row);
397
+ };
398
+ var getKeysMap = function(array, rowKey) {
399
+ const arrayMap = {};
400
+ (array || []).forEach((row, index) => {
401
+ arrayMap[getRowIdentity(row, rowKey)] = {
402
+ row,
403
+ index
404
+ };
405
+ });
406
+ return arrayMap;
407
+ };
408
+ function mergeOptions(defaults, config) {
409
+ const options = {};
410
+ let key;
411
+ for (key in defaults) options[key] = defaults[key];
412
+ for (key in config) if (hasOwn(config, key)) {
413
+ const value = config[key];
414
+ if (typeof value !== "undefined") options[key] = value;
415
+ }
416
+ return options;
417
+ }
418
+ function parseWidth(width) {
419
+ if (width === "") return width;
420
+ if (width !== void 0) {
421
+ width = Number.parseInt(width, 10);
422
+ if (Number.isNaN(width)) width = "";
423
+ }
424
+ return width;
425
+ }
426
+ function parseMinWidth(minWidth) {
427
+ if (minWidth === "") return minWidth;
428
+ if (minWidth !== void 0) {
429
+ minWidth = parseWidth(minWidth);
430
+ if (Number.isNaN(minWidth)) minWidth = 80;
431
+ }
432
+ return minWidth;
433
+ }
434
+ function parseHeight(height) {
435
+ if (typeof height === "number") return height;
436
+ if (typeof height === "string") if (/^\d+(?:px)?$/.test(height)) return Number.parseInt(height, 10);
437
+ else return height;
438
+ return null;
439
+ }
440
+ function compose(...funcs) {
441
+ if (funcs.length === 0) return (arg) => arg;
442
+ if (funcs.length === 1) return funcs[0];
443
+ return funcs.reduce((a$1, b$1) => (...args) => a$1(b$1(...args)));
444
+ }
445
+ function toggleRowStatus(statusArr, row, newVal) {
446
+ let changed = false;
447
+ const index = statusArr.indexOf(row);
448
+ const included = index !== -1;
449
+ const toggleStatus = (type) => {
450
+ if (type === "add") statusArr.push(row);
451
+ else statusArr.splice(index, 1);
452
+ changed = true;
453
+ if (isArray(row.children)) row.children.forEach((item) => {
454
+ toggleRowStatus(statusArr, item, newVal != null ? newVal : !included);
455
+ });
456
+ };
457
+ if (isBoolean(newVal)) {
458
+ if (newVal && !included) toggleStatus("add");
459
+ else if (!newVal && included) toggleStatus("remove");
460
+ } else included ? toggleStatus("remove") : toggleStatus("add");
461
+ return changed;
462
+ }
463
+ function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
464
+ const isNil = (array) => !(Array.isArray(array) && array.length);
465
+ function _walker(parent, children, level) {
466
+ cb(parent, children, level);
467
+ children.forEach((item) => {
468
+ if (item[lazyKey]) {
469
+ cb(item, null, level + 1);
470
+ return;
471
+ }
472
+ const children2 = item[childrenKey];
473
+ if (!isNil(children2)) _walker(item, children2, level + 1);
474
+ });
475
+ }
476
+ root.forEach((item) => {
477
+ if (item[lazyKey]) {
478
+ cb(item, null, 0);
479
+ return;
480
+ }
481
+ const children = item[childrenKey];
482
+ if (!isNil(children)) _walker(item, children, 0);
483
+ });
484
+ }
485
+ var removePopper;
486
+ function createTablePopper(parentNode, trigger, popperContent, nextZIndex, tooltipOptions) {
487
+ tooltipOptions = merge_default({
488
+ enterable: true,
489
+ showArrow: true
490
+ }, tooltipOptions);
491
+ const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
492
+ const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
493
+ function renderContent() {
494
+ const isLight = tooltipOptions.effect === "light";
495
+ const content2 = document.createElement("div");
496
+ content2.className = [
497
+ `${ns}-popper`,
498
+ isLight ? "is-light" : "is-dark",
499
+ tooltipOptions.popperClass || ""
500
+ ].join(" ");
501
+ popperContent = (0, import_escape_html.default)(popperContent);
502
+ content2.innerHTML = popperContent;
503
+ content2.style.zIndex = String(nextZIndex());
504
+ parentNode?.appendChild(content2);
505
+ return content2;
506
+ }
507
+ function renderArrow() {
508
+ const arrow = document.createElement("div");
509
+ arrow.className = `${ns}-popper__arrow`;
510
+ return arrow;
511
+ }
512
+ function showPopper() {
513
+ popperInstance && popperInstance.update();
514
+ }
515
+ removePopper?.();
516
+ removePopper = () => {
517
+ try {
518
+ popperInstance && popperInstance.destroy();
519
+ content && parentNode?.removeChild(content);
520
+ trigger.removeEventListener("mouseenter", onOpen);
521
+ trigger.removeEventListener("mouseleave", onClose);
522
+ scrollContainer?.removeEventListener("scroll", removePopper);
523
+ removePopper = void 0;
524
+ } catch (e) {}
525
+ };
526
+ let popperInstance = null;
527
+ let onOpen = showPopper;
528
+ let onClose = removePopper;
529
+ if (tooltipOptions.enterable) ({onOpen, onClose} = useDelayedToggle({
530
+ showAfter: tooltipOptions.showAfter,
531
+ hideAfter: tooltipOptions.hideAfter,
532
+ open: showPopper,
533
+ close: removePopper
534
+ }));
535
+ const content = renderContent();
536
+ content.onmouseenter = onOpen;
537
+ content.onmouseleave = onClose;
538
+ const modifiers = [];
539
+ if (tooltipOptions.offset) modifiers.push({
540
+ name: "offset",
541
+ options: { offset: [0, tooltipOptions.offset] }
542
+ });
543
+ if (tooltipOptions.showArrow) {
544
+ const arrow = content.appendChild(renderArrow());
545
+ modifiers.push({
546
+ name: "arrow",
547
+ options: {
548
+ element: arrow,
549
+ padding: 10
550
+ }
551
+ });
552
+ }
553
+ const popperOptions = tooltipOptions.popperOptions || {};
554
+ popperInstance = yn(trigger, content, {
555
+ placement: tooltipOptions.placement || "top",
556
+ strategy: "fixed",
557
+ ...popperOptions,
558
+ modifiers: popperOptions.modifiers ? modifiers.concat(popperOptions.modifiers) : modifiers
559
+ });
560
+ trigger.addEventListener("mouseenter", onOpen);
561
+ trigger.addEventListener("mouseleave", onClose);
562
+ scrollContainer?.addEventListener("scroll", removePopper);
563
+ return popperInstance;
564
+ }
565
+ function getCurrentColumns(column) {
566
+ if (column.children) return flatMap_default(column.children, getCurrentColumns);
567
+ else return [column];
568
+ }
569
+ function getColSpan(colSpan, column) {
570
+ return colSpan + column.colSpan;
571
+ }
572
+ var isFixedColumn = (index, fixed, store, realColumns) => {
573
+ let start = 0;
574
+ let after = index;
575
+ const columns = store.states.columns.value;
576
+ if (realColumns) {
577
+ const curColumns = getCurrentColumns(realColumns[index]);
578
+ start = columns.slice(0, columns.indexOf(curColumns[0])).reduce(getColSpan, 0);
579
+ after = start + curColumns.reduce(getColSpan, 0) - 1;
580
+ } else start = index;
581
+ let fixedLayout;
582
+ switch (fixed) {
583
+ case "left":
584
+ if (after < store.states.fixedLeafColumnsLength.value) fixedLayout = "left";
585
+ break;
586
+ case "right":
587
+ if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) fixedLayout = "right";
588
+ break;
589
+ default: if (after < store.states.fixedLeafColumnsLength.value) fixedLayout = "left";
590
+ else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) fixedLayout = "right";
591
+ }
592
+ return fixedLayout ? {
593
+ direction: fixedLayout,
594
+ start,
595
+ after
596
+ } : {};
597
+ };
598
+ var getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
599
+ const classes = [];
600
+ const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
601
+ if (direction) {
602
+ const isLeft = direction === "left";
603
+ classes.push(`${namespace}-fixed-column--${direction}`);
604
+ if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) classes.push("is-last-column");
605
+ else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) classes.push("is-first-column");
606
+ }
607
+ return classes;
608
+ };
609
+ function getOffset(offset, column) {
610
+ return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
611
+ }
612
+ var getFixedColumnOffset = (index, fixed, store, realColumns) => {
613
+ const { direction, start = 0, after = 0 } = isFixedColumn(index, fixed, store, realColumns);
614
+ if (!direction) return;
615
+ const styles = {};
616
+ const isLeft = direction === "left";
617
+ const columns = store.states.columns.value;
618
+ if (isLeft) styles.left = columns.slice(0, start).reduce(getOffset, 0);
619
+ else styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
620
+ return styles;
621
+ };
622
+ var ensurePosition = (style, key) => {
623
+ if (!style) return;
624
+ if (!Number.isNaN(style[key])) style[key] = `${style[key]}px`;
625
+ };
626
+ function useExpand(watcherData) {
627
+ const instance = getCurrentInstance();
628
+ const defaultExpandAll = ref(false);
629
+ const expandRows = ref([]);
630
+ const updateExpandRows = () => {
631
+ const data = watcherData.data.value || [];
632
+ const rowKey = watcherData.rowKey.value;
633
+ if (defaultExpandAll.value) expandRows.value = data.slice();
634
+ else if (rowKey) {
635
+ const expandRowsMap = getKeysMap(expandRows.value, rowKey);
636
+ expandRows.value = data.reduce((prev, row) => {
637
+ if (expandRowsMap[getRowIdentity(row, rowKey)]) prev.push(row);
638
+ return prev;
639
+ }, []);
640
+ } else expandRows.value = [];
641
+ };
642
+ const toggleRowExpansion = (row, expanded) => {
643
+ if (toggleRowStatus(expandRows.value, row, expanded)) instance.emit("expand-change", row, expandRows.value.slice());
644
+ };
645
+ const setExpandRowKeys = (rowKeys) => {
646
+ instance.store.assertRowKey();
647
+ const data = watcherData.data.value || [];
648
+ const rowKey = watcherData.rowKey.value;
649
+ const keysMap = getKeysMap(data, rowKey);
650
+ expandRows.value = rowKeys.reduce((prev, cur) => {
651
+ const info = keysMap[cur];
652
+ if (info) prev.push(info.row);
653
+ return prev;
654
+ }, []);
655
+ };
656
+ const isRowExpanded = (row) => {
657
+ const rowKey = watcherData.rowKey.value;
658
+ if (rowKey) return !!getKeysMap(expandRows.value, rowKey)[getRowIdentity(row, rowKey)];
659
+ return expandRows.value.includes(row);
660
+ };
661
+ return {
662
+ updateExpandRows,
663
+ toggleRowExpansion,
664
+ setExpandRowKeys,
665
+ isRowExpanded,
666
+ states: {
667
+ expandRows,
668
+ defaultExpandAll
669
+ }
670
+ };
671
+ }
672
+ function useCurrent(watcherData) {
673
+ const instance = getCurrentInstance();
674
+ const _currentRowKey = ref(null);
675
+ const currentRow = ref(null);
676
+ const setCurrentRowKey = (key) => {
677
+ instance.store.assertRowKey();
678
+ _currentRowKey.value = key;
679
+ setCurrentRowByKey(key);
680
+ };
681
+ const restoreCurrentRowKey = () => {
682
+ _currentRowKey.value = null;
683
+ };
684
+ const setCurrentRowByKey = (key) => {
685
+ const { data, rowKey } = watcherData;
686
+ let _currentRow = null;
687
+ if (rowKey.value) _currentRow = (unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
688
+ currentRow.value = _currentRow;
689
+ instance.emit("current-change", currentRow.value, null);
690
+ };
691
+ const updateCurrentRow = (_currentRow) => {
692
+ const oldCurrentRow = currentRow.value;
693
+ if (_currentRow && _currentRow !== oldCurrentRow) {
694
+ currentRow.value = _currentRow;
695
+ instance.emit("current-change", currentRow.value, oldCurrentRow);
696
+ return;
697
+ }
698
+ if (!_currentRow && oldCurrentRow) {
699
+ currentRow.value = null;
700
+ instance.emit("current-change", null, oldCurrentRow);
701
+ }
702
+ };
703
+ const updateCurrentRowData = () => {
704
+ const rowKey = watcherData.rowKey.value;
705
+ const data = watcherData.data.value || [];
706
+ const oldCurrentRow = currentRow.value;
707
+ if (!data.includes(oldCurrentRow) && oldCurrentRow) {
708
+ if (rowKey) setCurrentRowByKey(getRowIdentity(oldCurrentRow, rowKey));
709
+ else currentRow.value = null;
710
+ if (currentRow.value === null) instance.emit("current-change", null, oldCurrentRow);
711
+ } else if (_currentRowKey.value) {
712
+ setCurrentRowByKey(_currentRowKey.value);
713
+ restoreCurrentRowKey();
714
+ }
715
+ };
716
+ return {
717
+ setCurrentRowKey,
718
+ restoreCurrentRowKey,
719
+ setCurrentRowByKey,
720
+ updateCurrentRow,
721
+ updateCurrentRowData,
722
+ states: {
723
+ _currentRowKey,
724
+ currentRow
725
+ }
726
+ };
727
+ }
728
+ function useTree(watcherData) {
729
+ const expandRowKeys = ref([]);
730
+ const treeData = ref({});
731
+ const indent = ref(16);
732
+ const lazy = ref(false);
733
+ const lazyTreeNodeMap = ref({});
734
+ const lazyColumnIdentifier = ref("hasChildren");
735
+ const childrenColumnName = ref("children");
736
+ const instance = getCurrentInstance();
737
+ const normalizedData = computed(() => {
738
+ if (!watcherData.rowKey.value) return {};
739
+ return normalize(watcherData.data.value || []);
740
+ });
741
+ const normalizedLazyNode = computed(() => {
742
+ const rowKey = watcherData.rowKey.value;
743
+ const keys = Object.keys(lazyTreeNodeMap.value);
744
+ const res = {};
745
+ if (!keys.length) return res;
746
+ keys.forEach((key) => {
747
+ if (lazyTreeNodeMap.value[key].length) {
748
+ const item = { children: [] };
749
+ lazyTreeNodeMap.value[key].forEach((row) => {
750
+ const currentRowKey = getRowIdentity(row, rowKey);
751
+ item.children.push(currentRowKey);
752
+ if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) res[currentRowKey] = { children: [] };
753
+ });
754
+ res[key] = item;
755
+ }
756
+ });
757
+ return res;
758
+ });
759
+ const normalize = (data) => {
760
+ const rowKey = watcherData.rowKey.value;
761
+ const res = {};
762
+ walkTreeNode(data, (parent, children, level) => {
763
+ const parentId = getRowIdentity(parent, rowKey);
764
+ if (Array.isArray(children)) res[parentId] = {
765
+ children: children.map((row) => getRowIdentity(row, rowKey)),
766
+ level
767
+ };
768
+ else if (lazy.value) res[parentId] = {
769
+ children: [],
770
+ lazy: true,
771
+ level
772
+ };
773
+ }, childrenColumnName.value, lazyColumnIdentifier.value);
774
+ return res;
775
+ };
776
+ const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
777
+ var _a2;
778
+ const nested = normalizedData.value;
779
+ const normalizedLazyNode_ = normalizedLazyNode.value;
780
+ const keys = Object.keys(nested);
781
+ const newTreeData = {};
782
+ if (keys.length) {
783
+ const oldTreeData = unref(treeData);
784
+ const rootLazyRowKeys = [];
785
+ const getExpanded = (oldValue, key) => {
786
+ if (ifChangeExpandRowKeys) if (expandRowKeys.value) return ifExpandAll || expandRowKeys.value.includes(key);
787
+ else return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
788
+ else {
789
+ const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
790
+ return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
791
+ }
792
+ };
793
+ keys.forEach((key) => {
794
+ const oldValue = oldTreeData[key];
795
+ const newValue = { ...nested[key] };
796
+ newValue.expanded = getExpanded(oldValue, key);
797
+ if (newValue.lazy) {
798
+ const { loaded = false, loading = false } = oldValue || {};
799
+ newValue.loaded = !!loaded;
800
+ newValue.loading = !!loading;
801
+ rootLazyRowKeys.push(key);
802
+ }
803
+ newTreeData[key] = newValue;
804
+ });
805
+ const lazyKeys = Object.keys(normalizedLazyNode_);
806
+ if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) lazyKeys.forEach((key) => {
807
+ const oldValue = oldTreeData[key];
808
+ const lazyNodeChildren = normalizedLazyNode_[key].children;
809
+ if (rootLazyRowKeys.includes(key)) {
810
+ if (newTreeData[key].children.length !== 0) throw new Error("[ElTable]children must be an empty array.");
811
+ newTreeData[key].children = lazyNodeChildren;
812
+ } else {
813
+ const { loaded = false, loading = false } = oldValue || {};
814
+ newTreeData[key] = {
815
+ lazy: true,
816
+ loaded: !!loaded,
817
+ loading: !!loading,
818
+ expanded: getExpanded(oldValue, key),
819
+ children: lazyNodeChildren,
820
+ level: ""
821
+ };
822
+ }
823
+ });
824
+ }
825
+ treeData.value = newTreeData;
826
+ (_a2 = instance.store) == null || _a2.updateTableScrollY();
827
+ };
828
+ watch(() => expandRowKeys.value, () => {
829
+ updateTreeData(true);
830
+ });
831
+ watch(() => normalizedData.value, () => {
832
+ updateTreeData();
833
+ });
834
+ watch(() => normalizedLazyNode.value, () => {
835
+ updateTreeData();
836
+ });
837
+ const updateTreeExpandKeys = (value) => {
838
+ expandRowKeys.value = value;
839
+ updateTreeData();
840
+ };
841
+ const toggleTreeExpansion = (row, expanded) => {
842
+ instance.store.assertRowKey();
843
+ const rowKey = watcherData.rowKey.value;
844
+ const id = getRowIdentity(row, rowKey);
845
+ const data = id && treeData.value[id];
846
+ if (id && data && "expanded" in data) {
847
+ const oldExpanded = data.expanded;
848
+ expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
849
+ treeData.value[id].expanded = expanded;
850
+ if (oldExpanded !== expanded) instance.emit("expand-change", row, expanded);
851
+ instance.store.updateTableScrollY();
852
+ }
853
+ };
854
+ const loadOrToggle = (row) => {
855
+ instance.store.assertRowKey();
856
+ const rowKey = watcherData.rowKey.value;
857
+ const id = getRowIdentity(row, rowKey);
858
+ const data = treeData.value[id];
859
+ if (lazy.value && data && "loaded" in data && !data.loaded) loadData(row, id, data);
860
+ else toggleTreeExpansion(row, void 0);
861
+ };
862
+ const loadData = (row, key, treeNode) => {
863
+ const { load } = instance.props;
864
+ if (load && !treeData.value[key].loaded) {
865
+ treeData.value[key].loading = true;
866
+ load(row, treeNode, (data) => {
867
+ if (!Array.isArray(data)) throw new TypeError("[ElTable] data must be an array");
868
+ treeData.value[key].loading = false;
869
+ treeData.value[key].loaded = true;
870
+ treeData.value[key].expanded = true;
871
+ if (data.length) lazyTreeNodeMap.value[key] = data;
872
+ instance.emit("expand-change", row, true);
873
+ });
874
+ }
875
+ };
876
+ return {
877
+ loadData,
878
+ loadOrToggle,
879
+ toggleTreeExpansion,
880
+ updateTreeExpandKeys,
881
+ updateTreeData,
882
+ normalize,
883
+ states: {
884
+ expandRowKeys,
885
+ treeData,
886
+ indent,
887
+ lazy,
888
+ lazyTreeNodeMap,
889
+ lazyColumnIdentifier,
890
+ childrenColumnName
891
+ }
892
+ };
893
+ }
894
+ init_shared_esm_bundler();
895
+ var sortData = (data, states) => {
896
+ const sortingColumn = states.sortingColumn;
897
+ if (!sortingColumn || typeof sortingColumn.sortable === "string") return data;
898
+ return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
899
+ };
900
+ var doFlattenColumns = (columns) => {
901
+ const result = [];
902
+ columns.forEach((column) => {
903
+ if (column.children && column.children.length > 0) result.push.apply(result, doFlattenColumns(column.children));
904
+ else result.push(column);
905
+ });
906
+ return result;
907
+ };
908
+ function useWatcher$1() {
909
+ var _a;
910
+ const instance = getCurrentInstance();
911
+ const { size: tableSize } = toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
912
+ const rowKey = ref(null);
913
+ const data = ref([]);
914
+ const _data = ref([]);
915
+ const isComplex = ref(false);
916
+ const _columns = ref([]);
917
+ const originColumns = ref([]);
918
+ const columns = ref([]);
919
+ const fixedColumns = ref([]);
920
+ const rightFixedColumns = ref([]);
921
+ const leafColumns = ref([]);
922
+ const fixedLeafColumns = ref([]);
923
+ const rightFixedLeafColumns = ref([]);
924
+ const updateOrderFns = [];
925
+ const leafColumnsLength = ref(0);
926
+ const fixedLeafColumnsLength = ref(0);
927
+ const rightFixedLeafColumnsLength = ref(0);
928
+ const isAllSelected = ref(false);
929
+ const selection = ref([]);
930
+ const reserveSelection = ref(false);
931
+ const selectOnIndeterminate = ref(false);
932
+ const selectable = ref(null);
933
+ const filters = ref({});
934
+ const filteredData = ref(null);
935
+ const sortingColumn = ref(null);
936
+ const sortProp = ref(null);
937
+ const sortOrder = ref(null);
938
+ const hoverRow = ref(null);
939
+ watch(data, () => instance.state && scheduleLayout(false), { deep: true });
940
+ const assertRowKey = () => {
941
+ if (!rowKey.value) throw new Error("[ElTable] prop row-key is required");
942
+ };
943
+ const updateChildFixed = (column) => {
944
+ var _a2;
945
+ (_a2 = column.children) == null || _a2.forEach((childColumn) => {
946
+ childColumn.fixed = column.fixed;
947
+ updateChildFixed(childColumn);
948
+ });
949
+ };
950
+ const updateColumns = () => {
951
+ _columns.value.forEach((column) => {
952
+ updateChildFixed(column);
953
+ });
954
+ fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
955
+ rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
956
+ if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
957
+ _columns.value[0].fixed = true;
958
+ fixedColumns.value.unshift(_columns.value[0]);
959
+ }
960
+ const notFixedColumns = _columns.value.filter((column) => !column.fixed);
961
+ originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
962
+ const leafColumns2 = doFlattenColumns(notFixedColumns);
963
+ const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
964
+ const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
965
+ leafColumnsLength.value = leafColumns2.length;
966
+ fixedLeafColumnsLength.value = fixedLeafColumns2.length;
967
+ rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
968
+ columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
969
+ isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
970
+ };
971
+ const scheduleLayout = (needUpdateColumns, immediate = false) => {
972
+ if (needUpdateColumns) updateColumns();
973
+ if (immediate) instance.state.doLayout();
974
+ else instance.state.debouncedUpdateLayout();
975
+ };
976
+ const isSelected = (row) => {
977
+ return selection.value.includes(row);
978
+ };
979
+ const clearSelection = () => {
980
+ isAllSelected.value = false;
981
+ if (selection.value.length) {
982
+ selection.value = [];
983
+ instance.emit("selection-change", []);
984
+ }
985
+ };
986
+ const cleanSelection = () => {
987
+ let deleted;
988
+ if (rowKey.value) {
989
+ deleted = [];
990
+ const selectedMap = getKeysMap(selection.value, rowKey.value);
991
+ const dataMap = getKeysMap(data.value, rowKey.value);
992
+ for (const key in selectedMap) if (hasOwn(selectedMap, key) && !dataMap[key]) deleted.push(selectedMap[key].row);
993
+ } else deleted = selection.value.filter((item) => !data.value.includes(item));
994
+ if (deleted.length) {
995
+ const newSelection = selection.value.filter((item) => !deleted.includes(item));
996
+ selection.value = newSelection;
997
+ instance.emit("selection-change", newSelection.slice());
998
+ }
999
+ };
1000
+ const getSelectionRows = () => {
1001
+ return (selection.value || []).slice();
1002
+ };
1003
+ const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
1004
+ if (toggleRowStatus(selection.value, row, selected)) {
1005
+ const newSelection = (selection.value || []).slice();
1006
+ if (emitChange) instance.emit("select", newSelection, row);
1007
+ instance.emit("selection-change", newSelection);
1008
+ }
1009
+ };
1010
+ const _toggleAllSelection = () => {
1011
+ var _a2, _b;
1012
+ const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
1013
+ isAllSelected.value = value;
1014
+ let selectionChanged = false;
1015
+ let childrenCount = 0;
1016
+ const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
1017
+ data.value.forEach((row, index) => {
1018
+ const rowIndex = index + childrenCount;
1019
+ if (selectable.value) {
1020
+ if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) selectionChanged = true;
1021
+ } else if (toggleRowStatus(selection.value, row, value)) selectionChanged = true;
1022
+ childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
1023
+ });
1024
+ if (selectionChanged) instance.emit("selection-change", selection.value ? selection.value.slice() : []);
1025
+ instance.emit("select-all", selection.value);
1026
+ };
1027
+ const updateSelectionByRowKey = () => {
1028
+ const selectedMap = getKeysMap(selection.value, rowKey.value);
1029
+ data.value.forEach((row) => {
1030
+ const rowInfo = selectedMap[getRowIdentity(row, rowKey.value)];
1031
+ if (rowInfo) selection.value[rowInfo.index] = row;
1032
+ });
1033
+ };
1034
+ const updateAllSelected = () => {
1035
+ var _a2, _b, _c;
1036
+ if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
1037
+ isAllSelected.value = false;
1038
+ return;
1039
+ }
1040
+ let selectedMap;
1041
+ if (rowKey.value) selectedMap = getKeysMap(selection.value, rowKey.value);
1042
+ const isSelected2 = function(row) {
1043
+ if (selectedMap) return !!selectedMap[getRowIdentity(row, rowKey.value)];
1044
+ else return selection.value.includes(row);
1045
+ };
1046
+ let isAllSelected_ = true;
1047
+ let selectedCount = 0;
1048
+ let childrenCount = 0;
1049
+ for (let i = 0, j = (data.value || []).length; i < j; i++) {
1050
+ const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value;
1051
+ const rowIndex = i + childrenCount;
1052
+ const item = data.value[i];
1053
+ const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
1054
+ if (!isSelected2(item)) {
1055
+ if (!selectable.value || isRowSelectable) {
1056
+ isAllSelected_ = false;
1057
+ break;
1058
+ }
1059
+ } else selectedCount++;
1060
+ childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
1061
+ }
1062
+ if (selectedCount === 0) isAllSelected_ = false;
1063
+ isAllSelected.value = isAllSelected_;
1064
+ };
1065
+ const getChildrenCount = (rowKey2) => {
1066
+ var _a2;
1067
+ if (!instance || !instance.store) return 0;
1068
+ const { treeData } = instance.store.states;
1069
+ let count = 0;
1070
+ const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
1071
+ if (children) {
1072
+ count += children.length;
1073
+ children.forEach((childKey) => {
1074
+ count += getChildrenCount(childKey);
1075
+ });
1076
+ }
1077
+ return count;
1078
+ };
1079
+ const updateFilters = (columns2, values) => {
1080
+ if (!Array.isArray(columns2)) columns2 = [columns2];
1081
+ const filters_ = {};
1082
+ columns2.forEach((col) => {
1083
+ filters.value[col.id] = values;
1084
+ filters_[col.columnKey || col.id] = values;
1085
+ });
1086
+ return filters_;
1087
+ };
1088
+ const updateSort = (column, prop, order) => {
1089
+ if (sortingColumn.value && sortingColumn.value !== column) sortingColumn.value.order = null;
1090
+ sortingColumn.value = column;
1091
+ sortProp.value = prop;
1092
+ sortOrder.value = order;
1093
+ };
1094
+ const execFilter = () => {
1095
+ let sourceData = unref(_data);
1096
+ Object.keys(filters.value).forEach((columnId) => {
1097
+ const values = filters.value[columnId];
1098
+ if (!values || values.length === 0) return;
1099
+ const column = getColumnById({ columns: columns.value }, columnId);
1100
+ if (column && column.filterMethod) sourceData = sourceData.filter((row) => {
1101
+ return values.some((value) => column.filterMethod.call(null, value, row, column));
1102
+ });
1103
+ });
1104
+ filteredData.value = sourceData;
1105
+ };
1106
+ const execSort = () => {
1107
+ data.value = sortData(filteredData.value, {
1108
+ sortingColumn: sortingColumn.value,
1109
+ sortProp: sortProp.value,
1110
+ sortOrder: sortOrder.value
1111
+ });
1112
+ };
1113
+ const execQuery = (ignore = void 0) => {
1114
+ if (!(ignore && ignore.filter)) execFilter();
1115
+ execSort();
1116
+ };
1117
+ const clearFilter = (columnKeys) => {
1118
+ const { tableHeaderRef } = instance.refs;
1119
+ if (!tableHeaderRef) return;
1120
+ const panels = Object.assign({}, tableHeaderRef.filterPanels);
1121
+ const keys = Object.keys(panels);
1122
+ if (!keys.length) return;
1123
+ if (typeof columnKeys === "string") columnKeys = [columnKeys];
1124
+ if (Array.isArray(columnKeys)) {
1125
+ const columns_ = columnKeys.map((key) => getColumnByKey({ columns: columns.value }, key));
1126
+ keys.forEach((key) => {
1127
+ const column = columns_.find((col) => col.id === key);
1128
+ if (column) column.filteredValue = [];
1129
+ });
1130
+ instance.store.commit("filterChange", {
1131
+ column: columns_,
1132
+ values: [],
1133
+ silent: true,
1134
+ multi: true
1135
+ });
1136
+ } else {
1137
+ keys.forEach((key) => {
1138
+ const column = columns.value.find((col) => col.id === key);
1139
+ if (column) column.filteredValue = [];
1140
+ });
1141
+ filters.value = {};
1142
+ instance.store.commit("filterChange", {
1143
+ column: {},
1144
+ values: [],
1145
+ silent: true
1146
+ });
1147
+ }
1148
+ };
1149
+ const clearSort = () => {
1150
+ if (!sortingColumn.value) return;
1151
+ updateSort(null, null, null);
1152
+ instance.store.commit("changeSortCondition", { silent: true });
1153
+ };
1154
+ const { setExpandRowKeys, toggleRowExpansion, updateExpandRows, states: expandStates, isRowExpanded } = useExpand({
1155
+ data,
1156
+ rowKey
1157
+ });
1158
+ const { updateTreeExpandKeys, toggleTreeExpansion, updateTreeData, loadOrToggle, states: treeStates } = useTree({
1159
+ data,
1160
+ rowKey
1161
+ });
1162
+ const { updateCurrentRowData, updateCurrentRow, setCurrentRowKey, states: currentData } = useCurrent({
1163
+ data,
1164
+ rowKey
1165
+ });
1166
+ const setExpandRowKeysAdapter = (val) => {
1167
+ setExpandRowKeys(val);
1168
+ updateTreeExpandKeys(val);
1169
+ };
1170
+ const toggleRowExpansionAdapter = (row, expanded) => {
1171
+ if (columns.value.some(({ type }) => type === "expand")) toggleRowExpansion(row, expanded);
1172
+ else toggleTreeExpansion(row, expanded);
1173
+ };
1174
+ return {
1175
+ assertRowKey,
1176
+ updateColumns,
1177
+ scheduleLayout,
1178
+ isSelected,
1179
+ clearSelection,
1180
+ cleanSelection,
1181
+ getSelectionRows,
1182
+ toggleRowSelection,
1183
+ _toggleAllSelection,
1184
+ toggleAllSelection: null,
1185
+ updateSelectionByRowKey,
1186
+ updateAllSelected,
1187
+ updateFilters,
1188
+ updateCurrentRow,
1189
+ updateSort,
1190
+ execFilter,
1191
+ execSort,
1192
+ execQuery,
1193
+ clearFilter,
1194
+ clearSort,
1195
+ toggleRowExpansion,
1196
+ setExpandRowKeysAdapter,
1197
+ setCurrentRowKey,
1198
+ toggleRowExpansionAdapter,
1199
+ isRowExpanded,
1200
+ updateExpandRows,
1201
+ updateCurrentRowData,
1202
+ loadOrToggle,
1203
+ updateTreeData,
1204
+ states: {
1205
+ tableSize,
1206
+ rowKey,
1207
+ data,
1208
+ _data,
1209
+ isComplex,
1210
+ _columns,
1211
+ originColumns,
1212
+ columns,
1213
+ fixedColumns,
1214
+ rightFixedColumns,
1215
+ leafColumns,
1216
+ fixedLeafColumns,
1217
+ rightFixedLeafColumns,
1218
+ updateOrderFns,
1219
+ leafColumnsLength,
1220
+ fixedLeafColumnsLength,
1221
+ rightFixedLeafColumnsLength,
1222
+ isAllSelected,
1223
+ selection,
1224
+ reserveSelection,
1225
+ selectOnIndeterminate,
1226
+ selectable,
1227
+ filters,
1228
+ filteredData,
1229
+ sortingColumn,
1230
+ sortProp,
1231
+ sortOrder,
1232
+ hoverRow,
1233
+ ...expandStates,
1234
+ ...treeStates,
1235
+ ...currentData
1236
+ }
1237
+ };
1238
+ }
1239
+ function replaceColumn(array, column) {
1240
+ return array.map((item) => {
1241
+ var _a;
1242
+ if (item.id === column.id) return column;
1243
+ else if ((_a = item.children) == null ? void 0 : _a.length) item.children = replaceColumn(item.children, column);
1244
+ return item;
1245
+ });
1246
+ }
1247
+ function sortColumn(array) {
1248
+ array.forEach((item) => {
1249
+ var _a, _b;
1250
+ item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
1251
+ if ((_b = item.children) == null ? void 0 : _b.length) sortColumn(item.children);
1252
+ });
1253
+ array.sort((cur, pre) => cur.no - pre.no);
1254
+ }
1255
+ function useStore() {
1256
+ const instance = getCurrentInstance();
1257
+ const watcher = useWatcher$1();
1258
+ const ns = useNamespace("table");
1259
+ const mutations = {
1260
+ setData(states, data) {
1261
+ const dataInstanceChanged = unref(states._data) !== data;
1262
+ states.data.value = data;
1263
+ states._data.value = data;
1264
+ instance.store.execQuery();
1265
+ instance.store.updateCurrentRowData();
1266
+ instance.store.updateExpandRows();
1267
+ instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
1268
+ if (unref(states.reserveSelection)) {
1269
+ instance.store.assertRowKey();
1270
+ instance.store.updateSelectionByRowKey();
1271
+ } else if (dataInstanceChanged) instance.store.clearSelection();
1272
+ else instance.store.cleanSelection();
1273
+ instance.store.updateAllSelected();
1274
+ if (instance.$ready) instance.store.scheduleLayout();
1275
+ },
1276
+ insertColumn(states, column, parent, updateColumnOrder) {
1277
+ const array = unref(states._columns);
1278
+ let newColumns = [];
1279
+ if (!parent) {
1280
+ array.push(column);
1281
+ newColumns = array;
1282
+ } else {
1283
+ if (parent && !parent.children) parent.children = [];
1284
+ parent.children.push(column);
1285
+ newColumns = replaceColumn(array, parent);
1286
+ }
1287
+ sortColumn(newColumns);
1288
+ states._columns.value = newColumns;
1289
+ states.updateOrderFns.push(updateColumnOrder);
1290
+ if (column.type === "selection") {
1291
+ states.selectable.value = column.selectable;
1292
+ states.reserveSelection.value = column.reserveSelection;
1293
+ }
1294
+ if (instance.$ready) {
1295
+ instance.store.updateColumns();
1296
+ instance.store.scheduleLayout();
1297
+ }
1298
+ },
1299
+ updateColumnOrder(states, column) {
1300
+ var _a;
1301
+ if (((_a = column.getColumnIndex) == null ? void 0 : _a.call(column)) === column.no) return;
1302
+ sortColumn(states._columns.value);
1303
+ if (instance.$ready) instance.store.updateColumns();
1304
+ },
1305
+ removeColumn(states, column, parent, updateColumnOrder) {
1306
+ const array = unref(states._columns) || [];
1307
+ if (parent) {
1308
+ parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
1309
+ nextTick(() => {
1310
+ var _a;
1311
+ if (((_a = parent.children) == null ? void 0 : _a.length) === 0) delete parent.children;
1312
+ });
1313
+ states._columns.value = replaceColumn(array, parent);
1314
+ } else {
1315
+ const index = array.indexOf(column);
1316
+ if (index > -1) {
1317
+ array.splice(index, 1);
1318
+ states._columns.value = array;
1319
+ }
1320
+ }
1321
+ const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
1322
+ updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
1323
+ if (instance.$ready) {
1324
+ instance.store.updateColumns();
1325
+ instance.store.scheduleLayout();
1326
+ }
1327
+ },
1328
+ sort(states, options) {
1329
+ const { prop, order, init } = options;
1330
+ if (prop) {
1331
+ const column = unref(states.columns).find((column2) => column2.property === prop);
1332
+ if (column) {
1333
+ column.order = order;
1334
+ instance.store.updateSort(column, prop, order);
1335
+ instance.store.commit("changeSortCondition", { init });
1336
+ }
1337
+ }
1338
+ },
1339
+ changeSortCondition(states, options) {
1340
+ const { sortingColumn, sortProp, sortOrder } = states;
1341
+ const columnValue = unref(sortingColumn), propValue = unref(sortProp), orderValue = unref(sortOrder);
1342
+ if (orderValue === null) {
1343
+ states.sortingColumn.value = null;
1344
+ states.sortProp.value = null;
1345
+ }
1346
+ instance.store.execQuery({ filter: true });
1347
+ if (!options || !(options.silent || options.init)) instance.emit("sort-change", {
1348
+ column: columnValue,
1349
+ prop: propValue,
1350
+ order: orderValue
1351
+ });
1352
+ instance.store.updateTableScrollY();
1353
+ },
1354
+ filterChange(_states, options) {
1355
+ const { column, values, silent } = options;
1356
+ const newFilters = instance.store.updateFilters(column, values);
1357
+ instance.store.execQuery();
1358
+ if (!silent) instance.emit("filter-change", newFilters);
1359
+ instance.store.updateTableScrollY();
1360
+ },
1361
+ toggleAllSelection() {
1362
+ instance.store.toggleAllSelection();
1363
+ },
1364
+ rowSelectedChanged(_states, row) {
1365
+ instance.store.toggleRowSelection(row);
1366
+ instance.store.updateAllSelected();
1367
+ },
1368
+ setHoverRow(states, row) {
1369
+ states.hoverRow.value = row;
1370
+ },
1371
+ setCurrentRow(_states, row) {
1372
+ instance.store.updateCurrentRow(row);
1373
+ }
1374
+ };
1375
+ const commit = function(name, ...args) {
1376
+ const mutations2 = instance.store.mutations;
1377
+ if (mutations2[name]) mutations2[name].apply(instance, [instance.store.states].concat(args));
1378
+ else throw new Error(`Action not found: ${name}`);
1379
+ };
1380
+ const updateTableScrollY = function() {
1381
+ nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
1382
+ };
1383
+ return {
1384
+ ns,
1385
+ ...watcher,
1386
+ mutations,
1387
+ commit,
1388
+ updateTableScrollY
1389
+ };
1390
+ }
1391
+ var InitialStateMap = {
1392
+ rowKey: "rowKey",
1393
+ defaultExpandAll: "defaultExpandAll",
1394
+ selectOnIndeterminate: "selectOnIndeterminate",
1395
+ indent: "indent",
1396
+ lazy: "lazy",
1397
+ data: "data",
1398
+ ["treeProps.hasChildren"]: {
1399
+ key: "lazyColumnIdentifier",
1400
+ default: "hasChildren"
1401
+ },
1402
+ ["treeProps.children"]: {
1403
+ key: "childrenColumnName",
1404
+ default: "children"
1405
+ }
1406
+ };
1407
+ function createStore(table, props) {
1408
+ if (!table) throw new Error("Table is required.");
1409
+ const store = useStore();
1410
+ store.toggleAllSelection = debounce_default(store._toggleAllSelection, 10);
1411
+ Object.keys(InitialStateMap).forEach((key) => {
1412
+ handleValue(getArrKeysValue(props, key), key, store);
1413
+ });
1414
+ proxyTableProps(store, props);
1415
+ return store;
1416
+ }
1417
+ function proxyTableProps(store, props) {
1418
+ Object.keys(InitialStateMap).forEach((key) => {
1419
+ watch(() => getArrKeysValue(props, key), (value) => {
1420
+ handleValue(value, key, store);
1421
+ });
1422
+ });
1423
+ }
1424
+ function handleValue(value, propsKey, store) {
1425
+ let newVal = value;
1426
+ let storeKey = InitialStateMap[propsKey];
1427
+ if (typeof InitialStateMap[propsKey] === "object") {
1428
+ storeKey = storeKey.key;
1429
+ newVal = newVal || InitialStateMap[propsKey].default;
1430
+ }
1431
+ store.states[storeKey].value = newVal;
1432
+ }
1433
+ function getArrKeysValue(props, keys) {
1434
+ if (keys.includes(".")) {
1435
+ const keyList = keys.split(".");
1436
+ let value = props;
1437
+ keyList.forEach((key) => {
1438
+ value = value[key];
1439
+ });
1440
+ return value;
1441
+ } else return props[keys];
1442
+ }
1443
+ init_shared_esm_bundler();
1444
+ var TableLayout = class {
1445
+ constructor(options) {
1446
+ this.observers = [];
1447
+ this.table = null;
1448
+ this.store = null;
1449
+ this.columns = [];
1450
+ this.fit = true;
1451
+ this.showHeader = true;
1452
+ this.height = ref(null);
1453
+ this.scrollX = ref(false);
1454
+ this.scrollY = ref(false);
1455
+ this.bodyWidth = ref(null);
1456
+ this.fixedWidth = ref(null);
1457
+ this.rightFixedWidth = ref(null);
1458
+ this.gutterWidth = 0;
1459
+ for (const name in options) if (hasOwn(options, name)) if (isRef(this[name])) this[name].value = options[name];
1460
+ else this[name] = options[name];
1461
+ if (!this.table) throw new Error("Table is required for Table Layout");
1462
+ if (!this.store) throw new Error("Store is required for Table Layout");
1463
+ }
1464
+ updateScrollY() {
1465
+ if (this.height.value === null) return false;
1466
+ const scrollBarRef = this.table.refs.scrollBarRef;
1467
+ if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
1468
+ let scrollY = true;
1469
+ const prevScrollY = this.scrollY.value;
1470
+ scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
1471
+ this.scrollY.value = scrollY;
1472
+ return prevScrollY !== scrollY;
1473
+ }
1474
+ return false;
1475
+ }
1476
+ setHeight(value, prop = "height") {
1477
+ if (!isClient) return;
1478
+ const el = this.table.vnode.el;
1479
+ value = parseHeight(value);
1480
+ this.height.value = Number(value);
1481
+ if (!el && (value || value === 0)) return nextTick(() => this.setHeight(value, prop));
1482
+ if (typeof value === "number") {
1483
+ el.style[prop] = `${value}px`;
1484
+ this.updateElsHeight();
1485
+ } else if (typeof value === "string") {
1486
+ el.style[prop] = value;
1487
+ this.updateElsHeight();
1488
+ }
1489
+ }
1490
+ setMaxHeight(value) {
1491
+ this.setHeight(value, "max-height");
1492
+ }
1493
+ getFlattenColumns() {
1494
+ const flattenColumns = [];
1495
+ this.table.store.states.columns.value.forEach((column) => {
1496
+ if (column.isColumnGroup) flattenColumns.push.apply(flattenColumns, column.columns);
1497
+ else flattenColumns.push(column);
1498
+ });
1499
+ return flattenColumns;
1500
+ }
1501
+ updateElsHeight() {
1502
+ this.updateScrollY();
1503
+ this.notifyObservers("scrollable");
1504
+ }
1505
+ headerDisplayNone(elm) {
1506
+ if (!elm) return true;
1507
+ let headerChild = elm;
1508
+ while (headerChild.tagName !== "DIV") {
1509
+ if (getComputedStyle(headerChild).display === "none") return true;
1510
+ headerChild = headerChild.parentElement;
1511
+ }
1512
+ return false;
1513
+ }
1514
+ updateColumnsWidth() {
1515
+ if (!isClient) return;
1516
+ const fit = this.fit;
1517
+ const bodyWidth = this.table.vnode.el.clientWidth;
1518
+ let bodyMinWidth = 0;
1519
+ const flattenColumns = this.getFlattenColumns();
1520
+ const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
1521
+ flattenColumns.forEach((column) => {
1522
+ if (typeof column.width === "number" && column.realWidth) column.realWidth = null;
1523
+ });
1524
+ if (flexColumns.length > 0 && fit) {
1525
+ flattenColumns.forEach((column) => {
1526
+ bodyMinWidth += Number(column.width || column.minWidth || 80);
1527
+ });
1528
+ if (bodyMinWidth <= bodyWidth) {
1529
+ this.scrollX.value = false;
1530
+ const totalFlexWidth = bodyWidth - bodyMinWidth;
1531
+ if (flexColumns.length === 1) flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
1532
+ else {
1533
+ const flexWidthPerPixel = totalFlexWidth / flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
1534
+ let noneFirstWidth = 0;
1535
+ flexColumns.forEach((column, index) => {
1536
+ if (index === 0) return;
1537
+ const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
1538
+ noneFirstWidth += flexWidth;
1539
+ column.realWidth = Number(column.minWidth || 80) + flexWidth;
1540
+ });
1541
+ flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
1542
+ }
1543
+ } else {
1544
+ this.scrollX.value = true;
1545
+ flexColumns.forEach((column) => {
1546
+ column.realWidth = Number(column.minWidth);
1547
+ });
1548
+ }
1549
+ this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
1550
+ this.table.state.resizeState.value.width = this.bodyWidth.value;
1551
+ } else {
1552
+ flattenColumns.forEach((column) => {
1553
+ if (!column.width && !column.minWidth) column.realWidth = 80;
1554
+ else column.realWidth = Number(column.width || column.minWidth);
1555
+ bodyMinWidth += column.realWidth;
1556
+ });
1557
+ this.scrollX.value = bodyMinWidth > bodyWidth;
1558
+ this.bodyWidth.value = bodyMinWidth;
1559
+ }
1560
+ const fixedColumns = this.store.states.fixedColumns.value;
1561
+ if (fixedColumns.length > 0) {
1562
+ let fixedWidth = 0;
1563
+ fixedColumns.forEach((column) => {
1564
+ fixedWidth += Number(column.realWidth || column.width);
1565
+ });
1566
+ this.fixedWidth.value = fixedWidth;
1567
+ }
1568
+ const rightFixedColumns = this.store.states.rightFixedColumns.value;
1569
+ if (rightFixedColumns.length > 0) {
1570
+ let rightFixedWidth = 0;
1571
+ rightFixedColumns.forEach((column) => {
1572
+ rightFixedWidth += Number(column.realWidth || column.width);
1573
+ });
1574
+ this.rightFixedWidth.value = rightFixedWidth;
1575
+ }
1576
+ this.notifyObservers("columns");
1577
+ }
1578
+ addObserver(observer) {
1579
+ this.observers.push(observer);
1580
+ }
1581
+ removeObserver(observer) {
1582
+ const index = this.observers.indexOf(observer);
1583
+ if (index !== -1) this.observers.splice(index, 1);
1584
+ }
1585
+ notifyObservers(event) {
1586
+ this.observers.forEach((observer) => {
1587
+ var _a, _b;
1588
+ switch (event) {
1589
+ case "columns":
1590
+ (_a = observer.state) == null || _a.onColumnsChange(this);
1591
+ break;
1592
+ case "scrollable":
1593
+ (_b = observer.state) == null || _b.onScrollableChange(this);
1594
+ break;
1595
+ default: throw new Error(`Table Layout don't have event ${event}.`);
1596
+ }
1597
+ });
1598
+ }
1599
+ };
1600
+ var { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
1601
+ var _sfc_main$1 = defineComponent({
1602
+ name: "ElTableFilterPanel",
1603
+ components: {
1604
+ ElCheckbox,
1605
+ ElCheckboxGroup,
1606
+ ElScrollbar,
1607
+ ElTooltip,
1608
+ ElIcon,
1609
+ ArrowDown: arrow_down_default,
1610
+ ArrowUp: arrow_up_default
1611
+ },
1612
+ directives: { ClickOutside },
1613
+ props: {
1614
+ placement: {
1615
+ type: String,
1616
+ default: "bottom-start"
1617
+ },
1618
+ store: { type: Object },
1619
+ column: { type: Object },
1620
+ upDataColumn: { type: Function }
1621
+ },
1622
+ setup(props) {
1623
+ const instance = getCurrentInstance();
1624
+ const { t } = useLocale();
1625
+ const ns = useNamespace("table-filter");
1626
+ const parent = instance == null ? void 0 : instance.parent;
1627
+ if (!parent.filterPanels.value[props.column.id]) parent.filterPanels.value[props.column.id] = instance;
1628
+ const tooltipVisible = ref(false);
1629
+ const tooltip = ref(null);
1630
+ const filters = computed(() => {
1631
+ return props.column && props.column.filters;
1632
+ });
1633
+ const filterValue = computed({
1634
+ get: () => {
1635
+ var _a;
1636
+ return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
1637
+ },
1638
+ set: (value) => {
1639
+ if (filteredValue.value) if (typeof value !== "undefined" && value !== null) filteredValue.value.splice(0, 1, value);
1640
+ else filteredValue.value.splice(0, 1);
1641
+ }
1642
+ });
1643
+ const filteredValue = computed({
1644
+ get() {
1645
+ if (props.column) return props.column.filteredValue || [];
1646
+ return [];
1647
+ },
1648
+ set(value) {
1649
+ if (props.column) props.upDataColumn("filteredValue", value);
1650
+ }
1651
+ });
1652
+ const multiple = computed(() => {
1653
+ if (props.column) return props.column.filterMultiple;
1654
+ return true;
1655
+ });
1656
+ const isActive = (filter) => {
1657
+ return filter.value === filterValue.value;
1658
+ };
1659
+ const hidden = () => {
1660
+ tooltipVisible.value = false;
1661
+ };
1662
+ const showFilterPanel = (e) => {
1663
+ e.stopPropagation();
1664
+ tooltipVisible.value = !tooltipVisible.value;
1665
+ };
1666
+ const hideFilterPanel = () => {
1667
+ tooltipVisible.value = false;
1668
+ };
1669
+ const handleConfirm = () => {
1670
+ confirmFilter(filteredValue.value);
1671
+ hidden();
1672
+ };
1673
+ const handleReset = () => {
1674
+ filteredValue.value = [];
1675
+ confirmFilter(filteredValue.value);
1676
+ hidden();
1677
+ };
1678
+ const handleSelect = (_filterValue) => {
1679
+ filterValue.value = _filterValue;
1680
+ if (typeof _filterValue !== "undefined" && _filterValue !== null) confirmFilter(filteredValue.value);
1681
+ else confirmFilter([]);
1682
+ hidden();
1683
+ };
1684
+ const confirmFilter = (filteredValue2) => {
1685
+ props.store.commit("filterChange", {
1686
+ column: props.column,
1687
+ values: filteredValue2
1688
+ });
1689
+ props.store.updateAllSelected();
1690
+ };
1691
+ watch(tooltipVisible, (value) => {
1692
+ if (props.column) props.upDataColumn("filterOpened", value);
1693
+ }, { immediate: true });
1694
+ return {
1695
+ tooltipVisible,
1696
+ multiple,
1697
+ filteredValue,
1698
+ filterValue,
1699
+ filters,
1700
+ handleConfirm,
1701
+ handleReset,
1702
+ handleSelect,
1703
+ isActive,
1704
+ t,
1705
+ ns,
1706
+ showFilterPanel,
1707
+ hideFilterPanel,
1708
+ popperPaneRef: computed(() => {
1709
+ var _a, _b;
1710
+ return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
1711
+ }),
1712
+ tooltip
1713
+ };
1714
+ }
1715
+ });
1716
+ var _hoisted_1$1 = { key: 0 };
1717
+ var _hoisted_2$1 = ["disabled"];
1718
+ var _hoisted_3 = ["label", "onClick"];
1719
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1720
+ const _component_el_checkbox = resolveComponent("el-checkbox");
1721
+ const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
1722
+ const _component_el_scrollbar = resolveComponent("el-scrollbar");
1723
+ const _component_arrow_up = resolveComponent("arrow-up");
1724
+ const _component_arrow_down = resolveComponent("arrow-down");
1725
+ const _component_el_icon = resolveComponent("el-icon");
1726
+ const _component_el_tooltip = resolveComponent("el-tooltip");
1727
+ const _directive_click_outside = resolveDirective("click-outside");
1728
+ return openBlock(), createBlock(_component_el_tooltip, {
1729
+ ref: "tooltip",
1730
+ visible: _ctx.tooltipVisible,
1731
+ offset: 0,
1732
+ placement: _ctx.placement,
1733
+ "show-arrow": false,
1734
+ "stop-popper-mouse-event": false,
1735
+ teleported: "",
1736
+ effect: "light",
1737
+ pure: "",
1738
+ "popper-class": _ctx.ns.b(),
1739
+ persistent: ""
1740
+ }, {
1741
+ content: withCtx(() => [_ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$1, [createBaseVNode("div", { class: normalizeClass(_ctx.ns.e("content")) }, [createVNode(_component_el_scrollbar, { "wrap-class": _ctx.ns.e("wrap") }, {
1742
+ default: withCtx(() => [createVNode(_component_el_checkbox_group, {
1743
+ modelValue: _ctx.filteredValue,
1744
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
1745
+ class: normalizeClass(_ctx.ns.e("checkbox-group"))
1746
+ }, {
1747
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
1748
+ return openBlock(), createBlock(_component_el_checkbox, {
1749
+ key: filter.value,
1750
+ label: filter.value
1751
+ }, {
1752
+ default: withCtx(() => [createTextVNode(toDisplayString(filter.text), 1)]),
1753
+ _: 2
1754
+ }, 1032, ["label"]);
1755
+ }), 128))]),
1756
+ _: 1
1757
+ }, 8, ["modelValue", "class"])]),
1758
+ _: 1
1759
+ }, 8, ["wrap-class"])], 2), createBaseVNode("div", { class: normalizeClass(_ctx.ns.e("bottom")) }, [createBaseVNode("button", {
1760
+ class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
1761
+ disabled: _ctx.filteredValue.length === 0,
1762
+ type: "button",
1763
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
1764
+ }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$1), createBaseVNode("button", {
1765
+ type: "button",
1766
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
1767
+ }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)], 2)])) : (openBlock(), createElementBlock("ul", {
1768
+ key: 1,
1769
+ class: normalizeClass(_ctx.ns.e("list"))
1770
+ }, [createBaseVNode("li", {
1771
+ class: normalizeClass([_ctx.ns.e("list-item"), { [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null }]),
1772
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
1773
+ }, toDisplayString(_ctx.t("el.table.clearFilter")), 3), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
1774
+ return openBlock(), createElementBlock("li", {
1775
+ key: filter.value,
1776
+ class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
1777
+ label: filter.value,
1778
+ onClick: ($event) => _ctx.handleSelect(filter.value)
1779
+ }, toDisplayString(filter.text), 11, _hoisted_3);
1780
+ }), 128))], 2))]),
1781
+ default: withCtx(() => [withDirectives((openBlock(), createElementBlock("span", {
1782
+ class: normalizeClass([`${_ctx.ns.namespace.value}-table__column-filter-trigger`, `${_ctx.ns.namespace.value}-none-outline`]),
1783
+ onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
1784
+ }, [createVNode(_component_el_icon, null, {
1785
+ default: withCtx(() => [_ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))]),
1786
+ _: 1
1787
+ })], 2)), [[
1788
+ _directive_click_outside,
1789
+ _ctx.hideFilterPanel,
1790
+ _ctx.popperPaneRef
1791
+ ]])]),
1792
+ _: 1
1793
+ }, 8, [
1794
+ "visible",
1795
+ "placement",
1796
+ "popper-class"
1797
+ ]);
1798
+ }
1799
+ var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);
1800
+ function useLayoutObserver(root) {
1801
+ const instance = getCurrentInstance();
1802
+ onBeforeMount(() => {
1803
+ tableLayout.value.addObserver(instance);
1804
+ });
1805
+ onMounted(() => {
1806
+ onColumnsChange(tableLayout.value);
1807
+ onScrollableChange(tableLayout.value);
1808
+ });
1809
+ onUpdated(() => {
1810
+ onColumnsChange(tableLayout.value);
1811
+ onScrollableChange(tableLayout.value);
1812
+ });
1813
+ onUnmounted(() => {
1814
+ tableLayout.value.removeObserver(instance);
1815
+ });
1816
+ const tableLayout = computed(() => {
1817
+ const layout = root.layout;
1818
+ if (!layout) throw new Error("Can not find table layout.");
1819
+ return layout;
1820
+ });
1821
+ const onColumnsChange = (layout) => {
1822
+ var _a;
1823
+ const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
1824
+ if (!cols.length) return;
1825
+ const flattenColumns = layout.getFlattenColumns();
1826
+ const columnsMap = {};
1827
+ flattenColumns.forEach((column) => {
1828
+ columnsMap[column.id] = column;
1829
+ });
1830
+ for (let i = 0, j = cols.length; i < j; i++) {
1831
+ const col = cols[i];
1832
+ const column = columnsMap[col.getAttribute("name")];
1833
+ if (column) col.setAttribute("width", column.realWidth || column.width);
1834
+ }
1835
+ };
1836
+ const onScrollableChange = (layout) => {
1837
+ var _a, _b;
1838
+ const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
1839
+ for (let i = 0, j = cols.length; i < j; i++) cols[i].setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
1840
+ const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
1841
+ for (let i = 0, j = ths.length; i < j; i++) {
1842
+ const th = ths[i];
1843
+ th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
1844
+ th.style.display = layout.scrollY.value ? "" : "none";
1845
+ }
1846
+ };
1847
+ return {
1848
+ tableLayout: tableLayout.value,
1849
+ onColumnsChange,
1850
+ onScrollableChange
1851
+ };
1852
+ }
1853
+ var TABLE_INJECTION_KEY = Symbol("ElTable");
1854
+ function useEvent(props, emit) {
1855
+ const instance = getCurrentInstance();
1856
+ const parent = inject(TABLE_INJECTION_KEY);
1857
+ const handleFilterClick = (event) => {
1858
+ event.stopPropagation();
1859
+ };
1860
+ const handleHeaderClick = (event, column) => {
1861
+ if (!column.filters && column.sortable) handleSortClick(event, column, false);
1862
+ else if (column.filterable && !column.sortable) handleFilterClick(event);
1863
+ parent?.emit("header-click", column, event);
1864
+ };
1865
+ const handleHeaderContextMenu = (event, column) => {
1866
+ parent?.emit("header-contextmenu", column, event);
1867
+ };
1868
+ const draggingColumn = ref(null);
1869
+ const dragging = ref(false);
1870
+ const dragState = ref({});
1871
+ const handleMouseDown = (event, column) => {
1872
+ if (!isClient) return;
1873
+ if (column.children && column.children.length > 0) return;
1874
+ if (draggingColumn.value && props.border) {
1875
+ dragging.value = true;
1876
+ const table = parent;
1877
+ emit("set-drag-visible", true);
1878
+ const tableLeft = (table == null ? void 0 : table.vnode.el).getBoundingClientRect().left;
1879
+ const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
1880
+ const columnRect = columnEl.getBoundingClientRect();
1881
+ const minLeft = columnRect.left - tableLeft + 30;
1882
+ addClass(columnEl, "noclick");
1883
+ dragState.value = {
1884
+ startMouseLeft: event.clientX,
1885
+ startLeft: columnRect.right - tableLeft,
1886
+ startColumnLeft: columnRect.left - tableLeft,
1887
+ tableLeft
1888
+ };
1889
+ const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
1890
+ resizeProxy.style.left = `${dragState.value.startLeft}px`;
1891
+ document.onselectstart = function() {
1892
+ return false;
1893
+ };
1894
+ document.ondragstart = function() {
1895
+ return false;
1896
+ };
1897
+ const handleMouseMove2 = (event2) => {
1898
+ const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
1899
+ const proxyLeft = dragState.value.startLeft + deltaLeft;
1900
+ resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
1901
+ };
1902
+ const handleMouseUp = () => {
1903
+ if (dragging.value) {
1904
+ const { startColumnLeft, startLeft } = dragState.value;
1905
+ column.width = column.realWidth = Number.parseInt(resizeProxy.style.left, 10) - startColumnLeft;
1906
+ table?.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
1907
+ requestAnimationFrame(() => {
1908
+ props.store.scheduleLayout(false, true);
1909
+ });
1910
+ document.body.style.cursor = "";
1911
+ dragging.value = false;
1912
+ draggingColumn.value = null;
1913
+ dragState.value = {};
1914
+ emit("set-drag-visible", false);
1915
+ }
1916
+ document.removeEventListener("mousemove", handleMouseMove2);
1917
+ document.removeEventListener("mouseup", handleMouseUp);
1918
+ document.onselectstart = null;
1919
+ document.ondragstart = null;
1920
+ setTimeout(() => {
1921
+ removeClass(columnEl, "noclick");
1922
+ }, 0);
1923
+ };
1924
+ document.addEventListener("mousemove", handleMouseMove2);
1925
+ document.addEventListener("mouseup", handleMouseUp);
1926
+ }
1927
+ };
1928
+ const handleMouseMove = (event, column) => {
1929
+ if (column.children && column.children.length > 0) return;
1930
+ const el = event.target;
1931
+ if (!isElement(el)) return;
1932
+ const target = el == null ? void 0 : el.closest("th");
1933
+ if (!column || !column.resizable) return;
1934
+ if (!dragging.value && props.border) {
1935
+ const rect = target.getBoundingClientRect();
1936
+ const bodyStyle = document.body.style;
1937
+ if (rect.width > 12 && rect.right - event.pageX < 8) {
1938
+ bodyStyle.cursor = "col-resize";
1939
+ if (hasClass(target, "is-sortable")) target.style.cursor = "col-resize";
1940
+ draggingColumn.value = column;
1941
+ } else if (!dragging.value) {
1942
+ bodyStyle.cursor = "";
1943
+ if (hasClass(target, "is-sortable")) target.style.cursor = "pointer";
1944
+ draggingColumn.value = null;
1945
+ }
1946
+ }
1947
+ };
1948
+ const handleMouseOut = () => {
1949
+ if (!isClient) return;
1950
+ document.body.style.cursor = "";
1951
+ };
1952
+ const toggleOrder = ({ order, sortOrders }) => {
1953
+ if (order === "") return sortOrders[0];
1954
+ const index = sortOrders.indexOf(order || null);
1955
+ return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
1956
+ };
1957
+ const handleSortClick = (event, column, givenOrder) => {
1958
+ var _a;
1959
+ event.stopPropagation();
1960
+ const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
1961
+ const target = (_a = event.target) == null ? void 0 : _a.closest("th");
1962
+ if (target) {
1963
+ if (hasClass(target, "noclick")) {
1964
+ removeClass(target, "noclick");
1965
+ return;
1966
+ }
1967
+ }
1968
+ if (!column.sortable) return;
1969
+ const states = props.store.states;
1970
+ let sortProp = states.sortProp.value;
1971
+ let sortOrder;
1972
+ const sortingColumn = states.sortingColumn.value;
1973
+ if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
1974
+ if (sortingColumn) sortingColumn.order = null;
1975
+ states.sortingColumn.value = column;
1976
+ sortProp = column.property;
1977
+ }
1978
+ if (!order) sortOrder = column.order = null;
1979
+ else sortOrder = column.order = order;
1980
+ states.sortProp.value = sortProp;
1981
+ states.sortOrder.value = sortOrder;
1982
+ parent?.store.commit("changeSortCondition");
1983
+ };
1984
+ return {
1985
+ handleHeaderClick,
1986
+ handleHeaderContextMenu,
1987
+ handleMouseDown,
1988
+ handleMouseMove,
1989
+ handleMouseOut,
1990
+ handleSortClick,
1991
+ handleFilterClick
1992
+ };
1993
+ }
1994
+ function useStyle$2(props) {
1995
+ const parent = inject(TABLE_INJECTION_KEY);
1996
+ const ns = useNamespace("table");
1997
+ const getHeaderRowStyle = (rowIndex) => {
1998
+ const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
1999
+ if (typeof headerRowStyle === "function") return headerRowStyle.call(null, { rowIndex });
2000
+ return headerRowStyle;
2001
+ };
2002
+ const getHeaderRowClass = (rowIndex) => {
2003
+ const classes = [];
2004
+ const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
2005
+ if (typeof headerRowClassName === "string") classes.push(headerRowClassName);
2006
+ else if (typeof headerRowClassName === "function") classes.push(headerRowClassName.call(null, { rowIndex }));
2007
+ return classes.join(" ");
2008
+ };
2009
+ const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
2010
+ var _a;
2011
+ let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
2012
+ if (typeof headerCellStyles === "function") headerCellStyles = headerCellStyles.call(null, {
2013
+ rowIndex,
2014
+ columnIndex,
2015
+ row,
2016
+ column
2017
+ });
2018
+ const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
2019
+ ensurePosition(fixedStyle, "left");
2020
+ ensurePosition(fixedStyle, "right");
2021
+ return Object.assign({}, headerCellStyles, fixedStyle);
2022
+ };
2023
+ const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
2024
+ const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
2025
+ const classes = [
2026
+ column.id,
2027
+ column.order,
2028
+ column.headerAlign,
2029
+ column.className,
2030
+ column.labelClassName,
2031
+ ...fixedClasses
2032
+ ];
2033
+ if (!column.children) classes.push("is-leaf");
2034
+ if (column.sortable) classes.push("is-sortable");
2035
+ const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
2036
+ if (typeof headerCellClassName === "string") classes.push(headerCellClassName);
2037
+ else if (typeof headerCellClassName === "function") classes.push(headerCellClassName.call(null, {
2038
+ rowIndex,
2039
+ columnIndex,
2040
+ row,
2041
+ column
2042
+ }));
2043
+ classes.push(ns.e("cell"));
2044
+ return classes.filter((className) => Boolean(className)).join(" ");
2045
+ };
2046
+ return {
2047
+ getHeaderRowStyle,
2048
+ getHeaderRowClass,
2049
+ getHeaderCellStyle,
2050
+ getHeaderCellClass
2051
+ };
2052
+ }
2053
+ var getAllColumns = (columns) => {
2054
+ const result = [];
2055
+ columns.forEach((column) => {
2056
+ if (column.children) {
2057
+ result.push(column);
2058
+ result.push.apply(result, getAllColumns(column.children));
2059
+ } else result.push(column);
2060
+ });
2061
+ return result;
2062
+ };
2063
+ var convertToRows = (originColumns) => {
2064
+ let maxLevel = 1;
2065
+ const traverse = (column, parent) => {
2066
+ if (parent) {
2067
+ column.level = parent.level + 1;
2068
+ if (maxLevel < column.level) maxLevel = column.level;
2069
+ }
2070
+ if (column.children) {
2071
+ let colSpan = 0;
2072
+ column.children.forEach((subColumn) => {
2073
+ traverse(subColumn, column);
2074
+ colSpan += subColumn.colSpan;
2075
+ });
2076
+ column.colSpan = colSpan;
2077
+ } else column.colSpan = 1;
2078
+ };
2079
+ originColumns.forEach((column) => {
2080
+ column.level = 1;
2081
+ traverse(column, void 0);
2082
+ });
2083
+ const rows = [];
2084
+ for (let i = 0; i < maxLevel; i++) rows.push([]);
2085
+ getAllColumns(originColumns).forEach((column) => {
2086
+ if (!column.children) column.rowSpan = maxLevel - column.level + 1;
2087
+ else {
2088
+ column.rowSpan = 1;
2089
+ column.children.forEach((col) => col.isSubColumn = true);
2090
+ }
2091
+ rows[column.level - 1].push(column);
2092
+ });
2093
+ return rows;
2094
+ };
2095
+ function useUtils$1(props) {
2096
+ const parent = inject(TABLE_INJECTION_KEY);
2097
+ const columnRows = computed(() => {
2098
+ return convertToRows(props.store.states.originColumns.value);
2099
+ });
2100
+ const isGroup = computed(() => {
2101
+ const result = columnRows.value.length > 1;
2102
+ if (result && parent) parent.state.isGroup.value = true;
2103
+ return result;
2104
+ });
2105
+ const toggleAllSelection = (event) => {
2106
+ event.stopPropagation();
2107
+ parent?.store.commit("toggleAllSelection");
2108
+ };
2109
+ return {
2110
+ isGroup,
2111
+ toggleAllSelection,
2112
+ columnRows
2113
+ };
2114
+ }
2115
+ var TableHeader = defineComponent({
2116
+ name: "ElTableHeader",
2117
+ components: { ElCheckbox },
2118
+ props: {
2119
+ fixed: {
2120
+ type: String,
2121
+ default: ""
2122
+ },
2123
+ store: {
2124
+ required: true,
2125
+ type: Object
2126
+ },
2127
+ border: Boolean,
2128
+ defaultSort: {
2129
+ type: Object,
2130
+ default: () => {
2131
+ return {
2132
+ prop: "",
2133
+ order: ""
2134
+ };
2135
+ }
2136
+ }
2137
+ },
2138
+ setup(props, { emit }) {
2139
+ const instance = getCurrentInstance();
2140
+ const parent = inject(TABLE_INJECTION_KEY);
2141
+ const ns = useNamespace("table");
2142
+ const filterPanels = ref({});
2143
+ const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
2144
+ onMounted(async () => {
2145
+ await nextTick();
2146
+ await nextTick();
2147
+ const { prop, order } = props.defaultSort;
2148
+ parent?.store.commit("sort", {
2149
+ prop,
2150
+ order,
2151
+ init: true
2152
+ });
2153
+ });
2154
+ const { handleHeaderClick, handleHeaderContextMenu, handleMouseDown, handleMouseMove, handleMouseOut, handleSortClick, handleFilterClick } = useEvent(props, emit);
2155
+ const { getHeaderRowStyle, getHeaderRowClass, getHeaderCellStyle, getHeaderCellClass } = useStyle$2(props);
2156
+ const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
2157
+ instance.state = {
2158
+ onColumnsChange,
2159
+ onScrollableChange
2160
+ };
2161
+ instance.filterPanels = filterPanels;
2162
+ return {
2163
+ ns,
2164
+ filterPanels,
2165
+ onColumnsChange,
2166
+ onScrollableChange,
2167
+ columnRows,
2168
+ getHeaderRowClass,
2169
+ getHeaderRowStyle,
2170
+ getHeaderCellClass,
2171
+ getHeaderCellStyle,
2172
+ handleHeaderClick,
2173
+ handleHeaderContextMenu,
2174
+ handleMouseDown,
2175
+ handleMouseMove,
2176
+ handleMouseOut,
2177
+ handleSortClick,
2178
+ handleFilterClick,
2179
+ isGroup,
2180
+ toggleAllSelection
2181
+ };
2182
+ },
2183
+ render() {
2184
+ const { ns, isGroup, columnRows, getHeaderCellStyle, getHeaderCellClass, getHeaderRowClass, getHeaderRowStyle, handleHeaderClick, handleHeaderContextMenu, handleMouseDown, handleMouseMove, handleSortClick, handleMouseOut, store, $parent } = this;
2185
+ let rowSpan = 1;
2186
+ return h("thead", { class: { [ns.is("group")]: isGroup } }, columnRows.map((subColumns, rowIndex) => h("tr", {
2187
+ class: getHeaderRowClass(rowIndex),
2188
+ key: rowIndex,
2189
+ style: getHeaderRowStyle(rowIndex)
2190
+ }, subColumns.map((column, cellIndex) => {
2191
+ if (column.rowSpan > rowSpan) rowSpan = column.rowSpan;
2192
+ return h("th", {
2193
+ class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
2194
+ colspan: column.colSpan,
2195
+ key: `${column.id}-thead`,
2196
+ rowspan: column.rowSpan,
2197
+ style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
2198
+ onClick: ($event) => handleHeaderClick($event, column),
2199
+ onContextmenu: ($event) => handleHeaderContextMenu($event, column),
2200
+ onMousedown: ($event) => handleMouseDown($event, column),
2201
+ onMousemove: ($event) => handleMouseMove($event, column),
2202
+ onMouseout: handleMouseOut
2203
+ }, [h("div", { class: ["cell", column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""] }, [
2204
+ column.renderHeader ? column.renderHeader({
2205
+ column,
2206
+ $index: cellIndex,
2207
+ store,
2208
+ _self: $parent
2209
+ }) : column.label,
2210
+ column.sortable && h("span", {
2211
+ onClick: ($event) => handleSortClick($event, column),
2212
+ class: "caret-wrapper"
2213
+ }, [h("i", {
2214
+ onClick: ($event) => handleSortClick($event, column, "ascending"),
2215
+ class: "sort-caret ascending"
2216
+ }), h("i", {
2217
+ onClick: ($event) => handleSortClick($event, column, "descending"),
2218
+ class: "sort-caret descending"
2219
+ })]),
2220
+ column.filterable && h(FilterPanel, {
2221
+ store,
2222
+ placement: column.filterPlacement || "bottom-start",
2223
+ column,
2224
+ upDataColumn: (key, value) => {
2225
+ column[key] = value;
2226
+ }
2227
+ })
2228
+ ])]);
2229
+ }))));
2230
+ }
2231
+ });
2232
+ function useEvents(props) {
2233
+ const parent = inject(TABLE_INJECTION_KEY);
2234
+ const tooltipContent = ref("");
2235
+ const tooltipTrigger = ref(h("div"));
2236
+ const { nextZIndex } = useZIndex();
2237
+ const handleEvent = (event, row, name) => {
2238
+ var _a;
2239
+ const table = parent;
2240
+ const cell = getCell(event);
2241
+ let column;
2242
+ const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
2243
+ if (cell) {
2244
+ column = getColumnByCell({ columns: props.store.states.columns.value }, cell, namespace);
2245
+ if (column) table?.emit(`cell-${name}`, row, column, cell, event);
2246
+ }
2247
+ table?.emit(`row-${name}`, row, column, event);
2248
+ };
2249
+ const handleDoubleClick = (event, row) => {
2250
+ handleEvent(event, row, "dblclick");
2251
+ };
2252
+ const handleClick = (event, row) => {
2253
+ props.store.commit("setCurrentRow", row);
2254
+ handleEvent(event, row, "click");
2255
+ };
2256
+ const handleContextMenu = (event, row) => {
2257
+ handleEvent(event, row, "contextmenu");
2258
+ };
2259
+ const handleMouseEnter = debounce_default((index) => {
2260
+ props.store.commit("setHoverRow", index);
2261
+ }, 30);
2262
+ const handleMouseLeave = debounce_default(() => {
2263
+ props.store.commit("setHoverRow", null);
2264
+ }, 30);
2265
+ const getPadding = (el) => {
2266
+ const style = window.getComputedStyle(el, null);
2267
+ return {
2268
+ left: Number.parseInt(style.paddingLeft, 10) || 0,
2269
+ right: Number.parseInt(style.paddingRight, 10) || 0,
2270
+ top: Number.parseInt(style.paddingTop, 10) || 0,
2271
+ bottom: Number.parseInt(style.paddingBottom, 10) || 0
2272
+ };
2273
+ };
2274
+ const handleCellMouseEnter = (event, row, tooltipOptions) => {
2275
+ var _a;
2276
+ const table = parent;
2277
+ const cell = getCell(event);
2278
+ const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
2279
+ if (cell) {
2280
+ const hoverState = table.hoverState = {
2281
+ cell,
2282
+ column: getColumnByCell({ columns: props.store.states.columns.value }, cell, namespace),
2283
+ row
2284
+ };
2285
+ table?.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
2286
+ }
2287
+ if (!tooltipOptions) return;
2288
+ const cellChild = event.target.querySelector(".cell");
2289
+ if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) return;
2290
+ const range = document.createRange();
2291
+ range.setStart(cellChild, 0);
2292
+ range.setEnd(cellChild, cellChild.childNodes.length);
2293
+ let rangeWidth = range.getBoundingClientRect().width;
2294
+ let rangeHeight = range.getBoundingClientRect().height;
2295
+ if (rangeWidth - Math.floor(rangeWidth) < .001) rangeWidth = Math.floor(rangeWidth);
2296
+ if (rangeHeight - Math.floor(rangeHeight) < .001) rangeHeight = Math.floor(rangeHeight);
2297
+ const { top, left, right, bottom } = getPadding(cellChild);
2298
+ const horizontalPadding = left + right;
2299
+ const verticalPadding = top + bottom;
2300
+ if (rangeWidth + horizontalPadding > cellChild.offsetWidth || rangeHeight + verticalPadding > cellChild.offsetHeight || cellChild.scrollWidth > cellChild.offsetWidth) createTablePopper(parent == null ? void 0 : parent.refs.tableWrapper, cell, cell.innerText || cell.textContent, nextZIndex, tooltipOptions);
2301
+ };
2302
+ const handleCellMouseLeave = (event) => {
2303
+ if (!getCell(event)) return;
2304
+ const oldHoverState = parent == null ? void 0 : parent.hoverState;
2305
+ parent?.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
2306
+ };
2307
+ return {
2308
+ handleDoubleClick,
2309
+ handleClick,
2310
+ handleContextMenu,
2311
+ handleMouseEnter,
2312
+ handleMouseLeave,
2313
+ handleCellMouseEnter,
2314
+ handleCellMouseLeave,
2315
+ tooltipContent,
2316
+ tooltipTrigger
2317
+ };
2318
+ }
2319
+ function useStyles(props) {
2320
+ const parent = inject(TABLE_INJECTION_KEY);
2321
+ const ns = useNamespace("table");
2322
+ const getRowStyle = (row, rowIndex) => {
2323
+ const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
2324
+ if (typeof rowStyle === "function") return rowStyle.call(null, {
2325
+ row,
2326
+ rowIndex
2327
+ });
2328
+ return rowStyle || null;
2329
+ };
2330
+ const getRowClass = (row, rowIndex) => {
2331
+ const classes = [ns.e("row")];
2332
+ if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) classes.push("current-row");
2333
+ if (props.stripe && rowIndex % 2 === 1) classes.push(ns.em("row", "striped"));
2334
+ const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
2335
+ if (typeof rowClassName === "string") classes.push(rowClassName);
2336
+ else if (typeof rowClassName === "function") classes.push(rowClassName.call(null, {
2337
+ row,
2338
+ rowIndex
2339
+ }));
2340
+ return classes;
2341
+ };
2342
+ const getCellStyle = (rowIndex, columnIndex, row, column) => {
2343
+ const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
2344
+ let cellStyles = cellStyle != null ? cellStyle : {};
2345
+ if (typeof cellStyle === "function") cellStyles = cellStyle.call(null, {
2346
+ rowIndex,
2347
+ columnIndex,
2348
+ row,
2349
+ column
2350
+ });
2351
+ const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
2352
+ ensurePosition(fixedStyle, "left");
2353
+ ensurePosition(fixedStyle, "right");
2354
+ return Object.assign({}, cellStyles, fixedStyle);
2355
+ };
2356
+ const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
2357
+ const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
2358
+ const classes = [
2359
+ column.id,
2360
+ column.align,
2361
+ column.className,
2362
+ ...fixedClasses
2363
+ ];
2364
+ const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
2365
+ if (typeof cellClassName === "string") classes.push(cellClassName);
2366
+ else if (typeof cellClassName === "function") classes.push(cellClassName.call(null, {
2367
+ rowIndex,
2368
+ columnIndex,
2369
+ row,
2370
+ column
2371
+ }));
2372
+ classes.push(ns.e("cell"));
2373
+ return classes.filter((className) => Boolean(className)).join(" ");
2374
+ };
2375
+ const getSpan = (row, column, rowIndex, columnIndex) => {
2376
+ let rowspan = 1;
2377
+ let colspan = 1;
2378
+ const fn = parent == null ? void 0 : parent.props.spanMethod;
2379
+ if (typeof fn === "function") {
2380
+ const result = fn({
2381
+ row,
2382
+ column,
2383
+ rowIndex,
2384
+ columnIndex
2385
+ });
2386
+ if (Array.isArray(result)) {
2387
+ rowspan = result[0];
2388
+ colspan = result[1];
2389
+ } else if (typeof result === "object") {
2390
+ rowspan = result.rowspan;
2391
+ colspan = result.colspan;
2392
+ }
2393
+ }
2394
+ return {
2395
+ rowspan,
2396
+ colspan
2397
+ };
2398
+ };
2399
+ const getColspanRealWidth = (columns, colspan, index) => {
2400
+ if (colspan < 1) return columns[index].realWidth;
2401
+ const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
2402
+ return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
2403
+ };
2404
+ return {
2405
+ getRowStyle,
2406
+ getRowClass,
2407
+ getCellStyle,
2408
+ getCellClass,
2409
+ getSpan,
2410
+ getColspanRealWidth
2411
+ };
2412
+ }
2413
+ function useRender$1(props) {
2414
+ const parent = inject(TABLE_INJECTION_KEY);
2415
+ const ns = useNamespace("table");
2416
+ const { handleDoubleClick, handleClick, handleContextMenu, handleMouseEnter, handleMouseLeave, handleCellMouseEnter, handleCellMouseLeave, tooltipContent, tooltipTrigger } = useEvents(props);
2417
+ const { getRowStyle, getRowClass, getCellStyle, getCellClass, getSpan, getColspanRealWidth } = useStyles(props);
2418
+ const firstDefaultColumnIndex = computed(() => {
2419
+ return props.store.states.columns.value.findIndex(({ type }) => type === "default");
2420
+ });
2421
+ const getKeyOfRow = (row, index) => {
2422
+ const rowKey = parent.props.rowKey;
2423
+ if (rowKey) return getRowIdentity(row, rowKey);
2424
+ return index;
2425
+ };
2426
+ const rowRender = (row, $index, treeRowData, expanded = false) => {
2427
+ const { tooltipEffect, tooltipOptions, store } = props;
2428
+ const { indent, columns } = store.states;
2429
+ const rowClasses = getRowClass(row, $index);
2430
+ let display = true;
2431
+ if (treeRowData) {
2432
+ rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
2433
+ display = treeRowData.display;
2434
+ }
2435
+ return h("tr", {
2436
+ style: [display ? null : { display: "none" }, getRowStyle(row, $index)],
2437
+ class: rowClasses,
2438
+ key: getKeyOfRow(row, $index),
2439
+ onDblclick: ($event) => handleDoubleClick($event, row),
2440
+ onClick: ($event) => handleClick($event, row),
2441
+ onContextmenu: ($event) => handleContextMenu($event, row),
2442
+ onMouseenter: () => handleMouseEnter($index),
2443
+ onMouseleave: handleMouseLeave
2444
+ }, columns.value.map((column, cellIndex) => {
2445
+ const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
2446
+ if (!rowspan || !colspan) return null;
2447
+ const columnData = Object.assign({}, column);
2448
+ columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
2449
+ const data = {
2450
+ store: props.store,
2451
+ _self: props.context || parent,
2452
+ column: columnData,
2453
+ row,
2454
+ $index,
2455
+ cellIndex,
2456
+ expanded
2457
+ };
2458
+ if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
2459
+ data.treeNode = {
2460
+ indent: treeRowData.level * indent.value,
2461
+ level: treeRowData.level
2462
+ };
2463
+ if (typeof treeRowData.expanded === "boolean") {
2464
+ data.treeNode.expanded = treeRowData.expanded;
2465
+ if ("loading" in treeRowData) data.treeNode.loading = treeRowData.loading;
2466
+ if ("noLazyChildren" in treeRowData) data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
2467
+ }
2468
+ }
2469
+ const baseKey = `${$index},${cellIndex}`;
2470
+ const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
2471
+ const tdChildren = cellChildren(cellIndex, column, data);
2472
+ const mergedTooltipOptions = column.showOverflowTooltip && merge_default({ effect: tooltipEffect }, tooltipOptions, column.showOverflowTooltip);
2473
+ return h("td", {
2474
+ style: getCellStyle($index, cellIndex, row, column),
2475
+ class: getCellClass($index, cellIndex, row, column, colspan - 1),
2476
+ key: `${patchKey}${baseKey}`,
2477
+ rowspan,
2478
+ colspan,
2479
+ onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
2480
+ onMouseleave: handleCellMouseLeave
2481
+ }, [tdChildren]);
2482
+ }));
2483
+ };
2484
+ const cellChildren = (cellIndex, column, data) => {
2485
+ return column.renderCell(data);
2486
+ };
2487
+ const wrappedRowRender = (row, $index) => {
2488
+ const store = props.store;
2489
+ const { isRowExpanded, assertRowKey } = store;
2490
+ const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
2491
+ const columns = store.states.columns.value;
2492
+ if (columns.some(({ type }) => type === "expand")) {
2493
+ const expanded = isRowExpanded(row);
2494
+ const tr = rowRender(row, $index, void 0, expanded);
2495
+ const renderExpanded = parent.renderExpanded;
2496
+ if (expanded) {
2497
+ if (!renderExpanded) {
2498
+ console.error("[Element Error]renderExpanded is required.");
2499
+ return tr;
2500
+ }
2501
+ return [[tr, h("tr", { key: `expanded-row__${tr.key}` }, [h("td", {
2502
+ colspan: columns.length,
2503
+ class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
2504
+ }, [renderExpanded({
2505
+ row,
2506
+ $index,
2507
+ store,
2508
+ expanded
2509
+ })])])]];
2510
+ } else return [[tr]];
2511
+ } else if (Object.keys(treeData.value).length) {
2512
+ assertRowKey();
2513
+ const key = getRowIdentity(row, rowKey.value);
2514
+ let cur = treeData.value[key];
2515
+ let treeRowData = null;
2516
+ if (cur) {
2517
+ treeRowData = {
2518
+ expanded: cur.expanded,
2519
+ level: cur.level,
2520
+ display: true
2521
+ };
2522
+ if (typeof cur.lazy === "boolean") {
2523
+ if (typeof cur.loaded === "boolean" && cur.loaded) treeRowData.noLazyChildren = !(cur.children && cur.children.length);
2524
+ treeRowData.loading = cur.loading;
2525
+ }
2526
+ }
2527
+ const tmp = [rowRender(row, $index, treeRowData)];
2528
+ if (cur) {
2529
+ let i = 0;
2530
+ const traverse = (children, parent2) => {
2531
+ if (!(children && children.length && parent2)) return;
2532
+ children.forEach((node) => {
2533
+ const innerTreeRowData = {
2534
+ display: parent2.display && parent2.expanded,
2535
+ level: parent2.level + 1,
2536
+ expanded: false,
2537
+ noLazyChildren: false,
2538
+ loading: false
2539
+ };
2540
+ const childKey = getRowIdentity(node, rowKey.value);
2541
+ if (childKey === void 0 || childKey === null) throw new Error("For nested data item, row-key is required.");
2542
+ cur = { ...treeData.value[childKey] };
2543
+ if (cur) {
2544
+ innerTreeRowData.expanded = cur.expanded;
2545
+ cur.level = cur.level || innerTreeRowData.level;
2546
+ cur.display = !!(cur.expanded && innerTreeRowData.display);
2547
+ if (typeof cur.lazy === "boolean") {
2548
+ if (typeof cur.loaded === "boolean" && cur.loaded) innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
2549
+ innerTreeRowData.loading = cur.loading;
2550
+ }
2551
+ }
2552
+ i++;
2553
+ tmp.push(rowRender(node, $index + i, innerTreeRowData));
2554
+ if (cur) traverse(lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value], cur);
2555
+ });
2556
+ };
2557
+ cur.display = true;
2558
+ traverse(lazyTreeNodeMap.value[key] || row[childrenColumnName.value], cur);
2559
+ }
2560
+ return tmp;
2561
+ } else return rowRender(row, $index, void 0);
2562
+ };
2563
+ return {
2564
+ wrappedRowRender,
2565
+ tooltipContent,
2566
+ tooltipTrigger
2567
+ };
2568
+ }
2569
+ var TableBody = defineComponent({
2570
+ name: "ElTableBody",
2571
+ props: {
2572
+ store: {
2573
+ required: true,
2574
+ type: Object
2575
+ },
2576
+ stripe: Boolean,
2577
+ tooltipEffect: String,
2578
+ tooltipOptions: { type: Object },
2579
+ context: {
2580
+ default: () => ({}),
2581
+ type: Object
2582
+ },
2583
+ rowClassName: [String, Function],
2584
+ rowStyle: [Object, Function],
2585
+ fixed: {
2586
+ type: String,
2587
+ default: ""
2588
+ },
2589
+ highlight: Boolean
2590
+ },
2591
+ setup(props) {
2592
+ const instance = getCurrentInstance();
2593
+ const parent = inject(TABLE_INJECTION_KEY);
2594
+ const ns = useNamespace("table");
2595
+ const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
2596
+ const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
2597
+ watch(props.store.states.hoverRow, (newVal, oldVal) => {
2598
+ if (!props.store.states.isComplex.value || !isClient) return;
2599
+ rAF(() => {
2600
+ const el = instance == null ? void 0 : instance.vnode.el;
2601
+ const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
2602
+ const oldRow = rows[oldVal];
2603
+ const newRow = rows[newVal];
2604
+ if (oldRow) removeClass(oldRow, "hover-row");
2605
+ if (newRow) addClass(newRow, "hover-row");
2606
+ });
2607
+ });
2608
+ onUnmounted(() => {
2609
+ var _a;
2610
+ (_a = removePopper) == null || _a();
2611
+ });
2612
+ return {
2613
+ ns,
2614
+ onColumnsChange,
2615
+ onScrollableChange,
2616
+ wrappedRowRender,
2617
+ tooltipContent,
2618
+ tooltipTrigger
2619
+ };
2620
+ },
2621
+ render() {
2622
+ const { wrappedRowRender, store } = this;
2623
+ return h("tbody", { tabIndex: -1 }, [(store.states.data.value || []).reduce((acc, row) => {
2624
+ return acc.concat(wrappedRowRender(row, acc.length));
2625
+ }, [])]);
2626
+ }
2627
+ });
2628
+ function useMapState() {
2629
+ const table = inject(TABLE_INJECTION_KEY);
2630
+ const store = table == null ? void 0 : table.store;
2631
+ return {
2632
+ leftFixedLeafCount: computed(() => {
2633
+ return store.states.fixedLeafColumnsLength.value;
2634
+ }),
2635
+ rightFixedLeafCount: computed(() => {
2636
+ return store.states.rightFixedColumns.value.length;
2637
+ }),
2638
+ columnsCount: computed(() => {
2639
+ return store.states.columns.value.length;
2640
+ }),
2641
+ leftFixedCount: computed(() => {
2642
+ return store.states.fixedColumns.value.length;
2643
+ }),
2644
+ rightFixedCount: computed(() => {
2645
+ return store.states.rightFixedColumns.value.length;
2646
+ }),
2647
+ columns: store.states.columns
2648
+ };
2649
+ }
2650
+ function useStyle$1(props) {
2651
+ const { columns } = useMapState();
2652
+ const ns = useNamespace("table");
2653
+ const getCellClasses = (columns2, cellIndex) => {
2654
+ const column = columns2[cellIndex];
2655
+ const classes = [
2656
+ ns.e("cell"),
2657
+ column.id,
2658
+ column.align,
2659
+ column.labelClassName,
2660
+ ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
2661
+ ];
2662
+ if (column.className) classes.push(column.className);
2663
+ if (!column.children) classes.push(ns.is("leaf"));
2664
+ return classes;
2665
+ };
2666
+ const getCellStyles = (column, cellIndex) => {
2667
+ const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
2668
+ ensurePosition(fixedStyle, "left");
2669
+ ensurePosition(fixedStyle, "right");
2670
+ return fixedStyle;
2671
+ };
2672
+ return {
2673
+ getCellClasses,
2674
+ getCellStyles,
2675
+ columns
2676
+ };
2677
+ }
2678
+ var TableFooter = defineComponent({
2679
+ name: "ElTableFooter",
2680
+ props: {
2681
+ fixed: {
2682
+ type: String,
2683
+ default: ""
2684
+ },
2685
+ store: {
2686
+ required: true,
2687
+ type: Object
2688
+ },
2689
+ summaryMethod: Function,
2690
+ sumText: String,
2691
+ border: Boolean,
2692
+ defaultSort: {
2693
+ type: Object,
2694
+ default: () => {
2695
+ return {
2696
+ prop: "",
2697
+ order: ""
2698
+ };
2699
+ }
2700
+ }
2701
+ },
2702
+ setup(props) {
2703
+ const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
2704
+ return {
2705
+ ns: useNamespace("table"),
2706
+ getCellClasses,
2707
+ getCellStyles,
2708
+ columns
2709
+ };
2710
+ },
2711
+ render() {
2712
+ const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
2713
+ const data = this.store.states.data.value;
2714
+ let sums = [];
2715
+ if (summaryMethod) sums = summaryMethod({
2716
+ columns,
2717
+ data
2718
+ });
2719
+ else columns.forEach((column, index) => {
2720
+ if (index === 0) {
2721
+ sums[index] = sumText;
2722
+ return;
2723
+ }
2724
+ const values = data.map((item) => Number(item[column.property]));
2725
+ const precisions = [];
2726
+ let notNumber = true;
2727
+ values.forEach((value) => {
2728
+ if (!Number.isNaN(+value)) {
2729
+ notNumber = false;
2730
+ const decimal = `${value}`.split(".")[1];
2731
+ precisions.push(decimal ? decimal.length : 0);
2732
+ }
2733
+ });
2734
+ const precision = Math.max.apply(null, precisions);
2735
+ if (!notNumber) sums[index] = values.reduce((prev, curr) => {
2736
+ const value = Number(curr);
2737
+ if (!Number.isNaN(+value)) return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
2738
+ else return prev;
2739
+ }, 0);
2740
+ else sums[index] = "";
2741
+ });
2742
+ return h(h("tfoot", [h("tr", {}, [...columns.map((column, cellIndex) => h("td", {
2743
+ key: cellIndex,
2744
+ colspan: column.colSpan,
2745
+ rowspan: column.rowSpan,
2746
+ class: getCellClasses(columns, cellIndex),
2747
+ style: getCellStyles(column, cellIndex)
2748
+ }, [h("div", { class: ["cell", column.labelClassName] }, [sums[cellIndex]])]))])]));
2749
+ }
2750
+ });
2751
+ function useUtils(store) {
2752
+ const setCurrentRow = (row) => {
2753
+ store.commit("setCurrentRow", row);
2754
+ };
2755
+ const getSelectionRows = () => {
2756
+ return store.getSelectionRows();
2757
+ };
2758
+ const toggleRowSelection = (row, selected) => {
2759
+ store.toggleRowSelection(row, selected, false);
2760
+ store.updateAllSelected();
2761
+ };
2762
+ const clearSelection = () => {
2763
+ store.clearSelection();
2764
+ };
2765
+ const clearFilter = (columnKeys) => {
2766
+ store.clearFilter(columnKeys);
2767
+ };
2768
+ const toggleAllSelection = () => {
2769
+ store.commit("toggleAllSelection");
2770
+ };
2771
+ const toggleRowExpansion = (row, expanded) => {
2772
+ store.toggleRowExpansionAdapter(row, expanded);
2773
+ };
2774
+ const clearSort = () => {
2775
+ store.clearSort();
2776
+ };
2777
+ const sort = (prop, order) => {
2778
+ store.commit("sort", {
2779
+ prop,
2780
+ order
2781
+ });
2782
+ };
2783
+ return {
2784
+ setCurrentRow,
2785
+ getSelectionRows,
2786
+ toggleRowSelection,
2787
+ clearSelection,
2788
+ clearFilter,
2789
+ toggleAllSelection,
2790
+ toggleRowExpansion,
2791
+ clearSort,
2792
+ sort
2793
+ };
2794
+ }
2795
+ function useStyle(props, layout, store, table) {
2796
+ const isHidden = ref(false);
2797
+ const renderExpanded = ref(null);
2798
+ const resizeProxyVisible = ref(false);
2799
+ const setDragVisible = (visible) => {
2800
+ resizeProxyVisible.value = visible;
2801
+ };
2802
+ const resizeState = ref({
2803
+ width: null,
2804
+ height: null,
2805
+ headerHeight: null
2806
+ });
2807
+ const isGroup = ref(false);
2808
+ const scrollbarViewStyle = {
2809
+ display: "inline-block",
2810
+ verticalAlign: "middle"
2811
+ };
2812
+ const tableWidth = ref();
2813
+ const tableScrollHeight = ref(0);
2814
+ const bodyScrollHeight = ref(0);
2815
+ const headerScrollHeight = ref(0);
2816
+ const footerScrollHeight = ref(0);
2817
+ const appendScrollHeight = ref(0);
2818
+ watchEffect(() => {
2819
+ layout.setHeight(props.height);
2820
+ });
2821
+ watchEffect(() => {
2822
+ layout.setMaxHeight(props.maxHeight);
2823
+ });
2824
+ watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
2825
+ if (!unref(rowKey) || !unref(currentRowKey)) return;
2826
+ store.setCurrentRowKey(`${currentRowKey}`);
2827
+ }, { immediate: true });
2828
+ watch(() => props.data, (data) => {
2829
+ table.store.commit("setData", data);
2830
+ }, {
2831
+ immediate: true,
2832
+ deep: true
2833
+ });
2834
+ watchEffect(() => {
2835
+ if (props.expandRowKeys) store.setExpandRowKeysAdapter(props.expandRowKeys);
2836
+ });
2837
+ const handleMouseLeave = () => {
2838
+ table.store.commit("setHoverRow", null);
2839
+ if (table.hoverState) table.hoverState = null;
2840
+ };
2841
+ const handleHeaderFooterMousewheel = (event, data) => {
2842
+ const { pixelX, pixelY } = data;
2843
+ if (Math.abs(pixelX) >= Math.abs(pixelY)) table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
2844
+ };
2845
+ const shouldUpdateHeight = computed(() => {
2846
+ return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
2847
+ });
2848
+ const tableBodyStyles = computed(() => {
2849
+ return { width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : "" };
2850
+ });
2851
+ const doLayout = () => {
2852
+ if (shouldUpdateHeight.value) layout.updateElsHeight();
2853
+ layout.updateColumnsWidth();
2854
+ requestAnimationFrame(syncPosition);
2855
+ };
2856
+ onMounted(async () => {
2857
+ await nextTick();
2858
+ store.updateColumns();
2859
+ bindEvents();
2860
+ requestAnimationFrame(doLayout);
2861
+ const el = table.vnode.el;
2862
+ const tableHeader = table.refs.headerWrapper;
2863
+ if (props.flexible && el && el.parentElement) el.parentElement.style.minWidth = "0";
2864
+ resizeState.value = {
2865
+ width: tableWidth.value = el.offsetWidth,
2866
+ height: el.offsetHeight,
2867
+ headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
2868
+ };
2869
+ store.states.columns.value.forEach((column) => {
2870
+ if (column.filteredValue && column.filteredValue.length) table.store.commit("filterChange", {
2871
+ column,
2872
+ values: column.filteredValue,
2873
+ silent: true
2874
+ });
2875
+ });
2876
+ table.$ready = true;
2877
+ });
2878
+ const setScrollClassByEl = (el, className) => {
2879
+ if (!el) return;
2880
+ const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
2881
+ classList.push(layout.scrollX.value ? className : "is-scrolling-none");
2882
+ el.className = classList.join(" ");
2883
+ };
2884
+ const setScrollClass = (className) => {
2885
+ const { tableWrapper } = table.refs;
2886
+ setScrollClassByEl(tableWrapper, className);
2887
+ };
2888
+ const hasScrollClass = (className) => {
2889
+ const { tableWrapper } = table.refs;
2890
+ return !!(tableWrapper && tableWrapper.classList.contains(className));
2891
+ };
2892
+ const syncPosition = function() {
2893
+ if (!table.refs.scrollBarRef) return;
2894
+ if (!layout.scrollX.value) {
2895
+ const scrollingNoneClass = "is-scrolling-none";
2896
+ if (!hasScrollClass(scrollingNoneClass)) setScrollClass(scrollingNoneClass);
2897
+ return;
2898
+ }
2899
+ const scrollContainer = table.refs.scrollBarRef.wrapRef;
2900
+ if (!scrollContainer) return;
2901
+ const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
2902
+ const { headerWrapper, footerWrapper } = table.refs;
2903
+ if (headerWrapper) headerWrapper.scrollLeft = scrollLeft;
2904
+ if (footerWrapper) footerWrapper.scrollLeft = scrollLeft;
2905
+ if (scrollLeft >= scrollWidth - offsetWidth - 1) setScrollClass("is-scrolling-right");
2906
+ else if (scrollLeft === 0) setScrollClass("is-scrolling-left");
2907
+ else setScrollClass("is-scrolling-middle");
2908
+ };
2909
+ const bindEvents = () => {
2910
+ if (!table.refs.scrollBarRef) return;
2911
+ if (table.refs.scrollBarRef.wrapRef) useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, { passive: true });
2912
+ if (props.fit) useResizeObserver(table.vnode.el, resizeListener);
2913
+ else useEventListener(window, "resize", resizeListener);
2914
+ useResizeObserver(table.refs.bodyWrapper, () => {
2915
+ var _a, _b;
2916
+ resizeListener();
2917
+ (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null || _b.update();
2918
+ });
2919
+ };
2920
+ const resizeListener = () => {
2921
+ var _a, _b, _c, _d;
2922
+ const el = table.vnode.el;
2923
+ if (!table.$ready || !el) return;
2924
+ let shouldUpdateLayout = false;
2925
+ const { width: oldWidth, height: oldHeight, headerHeight: oldHeaderHeight } = resizeState.value;
2926
+ const width = tableWidth.value = el.offsetWidth;
2927
+ if (oldWidth !== width) shouldUpdateLayout = true;
2928
+ const height = el.offsetHeight;
2929
+ if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) shouldUpdateLayout = true;
2930
+ const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
2931
+ if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) shouldUpdateLayout = true;
2932
+ tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
2933
+ headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
2934
+ footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
2935
+ appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
2936
+ bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
2937
+ if (shouldUpdateLayout) {
2938
+ resizeState.value = {
2939
+ width,
2940
+ height,
2941
+ headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
2942
+ };
2943
+ doLayout();
2944
+ }
2945
+ };
2946
+ const tableSize = useFormSize();
2947
+ const bodyWidth = computed(() => {
2948
+ const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
2949
+ return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
2950
+ });
2951
+ const tableLayout = computed(() => {
2952
+ if (props.maxHeight) return "fixed";
2953
+ return props.tableLayout;
2954
+ });
2955
+ const emptyBlockStyle = computed(() => {
2956
+ if (props.data && props.data.length) return null;
2957
+ let height = "100%";
2958
+ if (props.height && bodyScrollHeight.value) height = `${bodyScrollHeight.value}px`;
2959
+ const width = tableWidth.value;
2960
+ return {
2961
+ width: width ? `${width}px` : "",
2962
+ height
2963
+ };
2964
+ });
2965
+ const tableInnerStyle = computed(() => {
2966
+ if (props.height) return { height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height };
2967
+ if (props.maxHeight) return { maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight };
2968
+ return {};
2969
+ });
2970
+ const scrollbarStyle = computed(() => {
2971
+ if (props.height) return { height: "100%" };
2972
+ if (props.maxHeight) if (!Number.isNaN(Number(props.maxHeight))) return { maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px` };
2973
+ else return { maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)` };
2974
+ return {};
2975
+ });
2976
+ const handleFixedMousewheel = (event, data) => {
2977
+ const bodyWrapper = table.refs.bodyWrapper;
2978
+ if (Math.abs(data.spinY) > 0) {
2979
+ const currentScrollTop = bodyWrapper.scrollTop;
2980
+ if (data.pixelY < 0 && currentScrollTop !== 0) event.preventDefault();
2981
+ if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) event.preventDefault();
2982
+ bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
2983
+ } else bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
2984
+ };
2985
+ return {
2986
+ isHidden,
2987
+ renderExpanded,
2988
+ setDragVisible,
2989
+ isGroup,
2990
+ handleMouseLeave,
2991
+ handleHeaderFooterMousewheel,
2992
+ tableSize,
2993
+ emptyBlockStyle,
2994
+ handleFixedMousewheel,
2995
+ resizeProxyVisible,
2996
+ bodyWidth,
2997
+ resizeState,
2998
+ doLayout,
2999
+ tableBodyStyles,
3000
+ tableLayout,
3001
+ scrollbarViewStyle,
3002
+ tableInnerStyle,
3003
+ scrollbarStyle
3004
+ };
3005
+ }
3006
+ function useKeyRender(table) {
3007
+ const observer = ref();
3008
+ const initWatchDom = () => {
3009
+ const columnsWrapper = table.vnode.el.querySelector(".hidden-columns");
3010
+ const config = {
3011
+ childList: true,
3012
+ subtree: true
3013
+ };
3014
+ const updateOrderFns = table.store.states.updateOrderFns;
3015
+ observer.value = new MutationObserver(() => {
3016
+ updateOrderFns.forEach((fn) => fn());
3017
+ });
3018
+ observer.value.observe(columnsWrapper, config);
3019
+ };
3020
+ onMounted(() => {
3021
+ initWatchDom();
3022
+ });
3023
+ onUnmounted(() => {
3024
+ var _a;
3025
+ (_a = observer.value) == null || _a.disconnect();
3026
+ });
3027
+ }
3028
+ var defaultProps$1 = {
3029
+ data: {
3030
+ type: Array,
3031
+ default: () => []
3032
+ },
3033
+ size: useSizeProp,
3034
+ width: [String, Number],
3035
+ height: [String, Number],
3036
+ maxHeight: [String, Number],
3037
+ fit: {
3038
+ type: Boolean,
3039
+ default: true
3040
+ },
3041
+ stripe: Boolean,
3042
+ border: Boolean,
3043
+ rowKey: [String, Function],
3044
+ showHeader: {
3045
+ type: Boolean,
3046
+ default: true
3047
+ },
3048
+ showSummary: Boolean,
3049
+ sumText: String,
3050
+ summaryMethod: Function,
3051
+ rowClassName: [String, Function],
3052
+ rowStyle: [Object, Function],
3053
+ cellClassName: [String, Function],
3054
+ cellStyle: [Object, Function],
3055
+ headerRowClassName: [String, Function],
3056
+ headerRowStyle: [Object, Function],
3057
+ headerCellClassName: [String, Function],
3058
+ headerCellStyle: [Object, Function],
3059
+ highlightCurrentRow: Boolean,
3060
+ currentRowKey: [String, Number],
3061
+ emptyText: String,
3062
+ expandRowKeys: Array,
3063
+ defaultExpandAll: Boolean,
3064
+ defaultSort: Object,
3065
+ tooltipEffect: String,
3066
+ tooltipOptions: Object,
3067
+ spanMethod: Function,
3068
+ selectOnIndeterminate: {
3069
+ type: Boolean,
3070
+ default: true
3071
+ },
3072
+ indent: {
3073
+ type: Number,
3074
+ default: 16
3075
+ },
3076
+ treeProps: {
3077
+ type: Object,
3078
+ default: () => {
3079
+ return {
3080
+ hasChildren: "hasChildren",
3081
+ children: "children"
3082
+ };
3083
+ }
3084
+ },
3085
+ lazy: Boolean,
3086
+ load: Function,
3087
+ style: {
3088
+ type: Object,
3089
+ default: () => ({})
3090
+ },
3091
+ className: {
3092
+ type: String,
3093
+ default: ""
3094
+ },
3095
+ tableLayout: {
3096
+ type: String,
3097
+ default: "fixed"
3098
+ },
3099
+ scrollbarAlwaysOn: {
3100
+ type: Boolean,
3101
+ default: false
3102
+ },
3103
+ flexible: Boolean,
3104
+ showOverflowTooltip: [Boolean, Object]
3105
+ };
3106
+ function hColgroup(props) {
3107
+ const isAuto = props.tableLayout === "auto";
3108
+ let columns = props.columns || [];
3109
+ if (isAuto) {
3110
+ if (columns.every((column) => column.width === void 0)) columns = [];
3111
+ }
3112
+ const getPropsData = (column) => {
3113
+ const propsData = {
3114
+ key: `${props.tableLayout}_${column.id}`,
3115
+ style: {},
3116
+ name: void 0
3117
+ };
3118
+ if (isAuto) propsData.style = { width: `${column.width}px` };
3119
+ else propsData.name = column.id;
3120
+ return propsData;
3121
+ };
3122
+ return h("colgroup", {}, columns.map((column) => h("col", getPropsData(column))));
3123
+ }
3124
+ hColgroup.props = ["columns", "tableLayout"];
3125
+ var useScrollbar = () => {
3126
+ const scrollBarRef = ref();
3127
+ const scrollTo = (options, yCoord) => {
3128
+ const scrollbar = scrollBarRef.value;
3129
+ if (scrollbar) scrollbar.scrollTo(options, yCoord);
3130
+ };
3131
+ const setScrollPosition = (position, offset) => {
3132
+ const scrollbar = scrollBarRef.value;
3133
+ if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) scrollbar[`setScroll${position}`](offset);
3134
+ };
3135
+ const setScrollTop = (top) => setScrollPosition("Top", top);
3136
+ const setScrollLeft = (left) => setScrollPosition("Left", left);
3137
+ return {
3138
+ scrollBarRef,
3139
+ scrollTo,
3140
+ setScrollTop,
3141
+ setScrollLeft
3142
+ };
3143
+ };
3144
+ var tableIdSeed = 1;
3145
+ var _sfc_main = defineComponent({
3146
+ name: "ElTable",
3147
+ directives: { Mousewheel },
3148
+ components: {
3149
+ TableHeader,
3150
+ TableBody,
3151
+ TableFooter,
3152
+ ElScrollbar,
3153
+ hColgroup
3154
+ },
3155
+ props: defaultProps$1,
3156
+ emits: [
3157
+ "select",
3158
+ "select-all",
3159
+ "selection-change",
3160
+ "cell-mouse-enter",
3161
+ "cell-mouse-leave",
3162
+ "cell-contextmenu",
3163
+ "cell-click",
3164
+ "cell-dblclick",
3165
+ "row-click",
3166
+ "row-contextmenu",
3167
+ "row-dblclick",
3168
+ "header-click",
3169
+ "header-contextmenu",
3170
+ "sort-change",
3171
+ "filter-change",
3172
+ "current-change",
3173
+ "header-dragend",
3174
+ "expand-change"
3175
+ ],
3176
+ setup(props) {
3177
+ const { t } = useLocale();
3178
+ const ns = useNamespace("table");
3179
+ const table = getCurrentInstance();
3180
+ provide(TABLE_INJECTION_KEY, table);
3181
+ const store = createStore(table, props);
3182
+ table.store = store;
3183
+ const layout = new TableLayout({
3184
+ store: table.store,
3185
+ table,
3186
+ fit: props.fit,
3187
+ showHeader: props.showHeader
3188
+ });
3189
+ table.layout = layout;
3190
+ const isEmpty = computed(() => (store.states.data.value || []).length === 0);
3191
+ const { setCurrentRow, getSelectionRows, toggleRowSelection, clearSelection, clearFilter, toggleAllSelection, toggleRowExpansion, clearSort, sort } = useUtils(store);
3192
+ const { isHidden, renderExpanded, setDragVisible, isGroup, handleMouseLeave, handleHeaderFooterMousewheel, tableSize, emptyBlockStyle, handleFixedMousewheel, resizeProxyVisible, bodyWidth, resizeState, doLayout, tableBodyStyles, tableLayout, scrollbarViewStyle, tableInnerStyle, scrollbarStyle } = useStyle(props, layout, store, table);
3193
+ const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
3194
+ const debouncedUpdateLayout = debounce_default(doLayout, 50);
3195
+ const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
3196
+ table.tableId = tableId;
3197
+ table.state = {
3198
+ isGroup,
3199
+ resizeState,
3200
+ doLayout,
3201
+ debouncedUpdateLayout
3202
+ };
3203
+ const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
3204
+ const computedEmptyText = computed(() => {
3205
+ return props.emptyText || t("el.table.emptyText");
3206
+ });
3207
+ useKeyRender(table);
3208
+ return {
3209
+ ns,
3210
+ layout,
3211
+ store,
3212
+ handleHeaderFooterMousewheel,
3213
+ handleMouseLeave,
3214
+ tableId,
3215
+ tableSize,
3216
+ isHidden,
3217
+ isEmpty,
3218
+ renderExpanded,
3219
+ resizeProxyVisible,
3220
+ resizeState,
3221
+ isGroup,
3222
+ bodyWidth,
3223
+ tableBodyStyles,
3224
+ emptyBlockStyle,
3225
+ debouncedUpdateLayout,
3226
+ handleFixedMousewheel,
3227
+ setCurrentRow,
3228
+ getSelectionRows,
3229
+ toggleRowSelection,
3230
+ clearSelection,
3231
+ clearFilter,
3232
+ toggleAllSelection,
3233
+ toggleRowExpansion,
3234
+ clearSort,
3235
+ doLayout,
3236
+ sort,
3237
+ t,
3238
+ setDragVisible,
3239
+ context: table,
3240
+ computedSumText,
3241
+ computedEmptyText,
3242
+ tableLayout,
3243
+ scrollbarViewStyle,
3244
+ tableInnerStyle,
3245
+ scrollbarStyle,
3246
+ scrollBarRef,
3247
+ scrollTo,
3248
+ setScrollLeft,
3249
+ setScrollTop
3250
+ };
3251
+ }
3252
+ });
3253
+ var _hoisted_1 = ["data-prefix"];
3254
+ var _hoisted_2 = {
3255
+ ref: "hiddenColumns",
3256
+ class: "hidden-columns"
3257
+ };
3258
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3259
+ const _component_hColgroup = resolveComponent("hColgroup");
3260
+ const _component_table_header = resolveComponent("table-header");
3261
+ const _component_table_body = resolveComponent("table-body");
3262
+ const _component_table_footer = resolveComponent("table-footer");
3263
+ const _component_el_scrollbar = resolveComponent("el-scrollbar");
3264
+ const _directive_mousewheel = resolveDirective("mousewheel");
3265
+ return openBlock(), createElementBlock("div", {
3266
+ ref: "tableWrapper",
3267
+ class: normalizeClass([
3268
+ {
3269
+ [_ctx.ns.m("fit")]: _ctx.fit,
3270
+ [_ctx.ns.m("striped")]: _ctx.stripe,
3271
+ [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
3272
+ [_ctx.ns.m("hidden")]: _ctx.isHidden,
3273
+ [_ctx.ns.m("group")]: _ctx.isGroup,
3274
+ [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
3275
+ [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
3276
+ [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
3277
+ [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
3278
+ [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
3279
+ "has-footer": _ctx.showSummary
3280
+ },
3281
+ _ctx.ns.m(_ctx.tableSize),
3282
+ _ctx.className,
3283
+ _ctx.ns.b(),
3284
+ _ctx.ns.m(`layout-${_ctx.tableLayout}`)
3285
+ ]),
3286
+ style: normalizeStyle(_ctx.style),
3287
+ "data-prefix": _ctx.ns.namespace.value,
3288
+ onMouseleave: _cache[0] || (_cache[0] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args))
3289
+ }, [createBaseVNode("div", {
3290
+ class: normalizeClass(_ctx.ns.e("inner-wrapper")),
3291
+ style: normalizeStyle(_ctx.tableInnerStyle)
3292
+ }, [
3293
+ createBaseVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "default")], 512),
3294
+ _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
3295
+ key: 0,
3296
+ ref: "headerWrapper",
3297
+ class: normalizeClass(_ctx.ns.e("header-wrapper"))
3298
+ }, [createBaseVNode("table", {
3299
+ ref: "tableHeader",
3300
+ class: normalizeClass(_ctx.ns.e("header")),
3301
+ style: normalizeStyle(_ctx.tableBodyStyles),
3302
+ border: "0",
3303
+ cellpadding: "0",
3304
+ cellspacing: "0"
3305
+ }, [createVNode(_component_hColgroup, {
3306
+ columns: _ctx.store.states.columns.value,
3307
+ "table-layout": _ctx.tableLayout
3308
+ }, null, 8, ["columns", "table-layout"]), createVNode(_component_table_header, {
3309
+ ref: "tableHeaderRef",
3310
+ border: _ctx.border,
3311
+ "default-sort": _ctx.defaultSort,
3312
+ store: _ctx.store,
3313
+ onSetDragVisible: _ctx.setDragVisible
3314
+ }, null, 8, [
3315
+ "border",
3316
+ "default-sort",
3317
+ "store",
3318
+ "onSetDragVisible"
3319
+ ])], 6)], 2)), [[_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]]) : createCommentVNode("v-if", true),
3320
+ createBaseVNode("div", {
3321
+ ref: "bodyWrapper",
3322
+ class: normalizeClass(_ctx.ns.e("body-wrapper"))
3323
+ }, [createVNode(_component_el_scrollbar, {
3324
+ ref: "scrollBarRef",
3325
+ "view-style": _ctx.scrollbarViewStyle,
3326
+ "wrap-style": _ctx.scrollbarStyle,
3327
+ always: _ctx.scrollbarAlwaysOn
3328
+ }, {
3329
+ default: withCtx(() => [
3330
+ createBaseVNode("table", {
3331
+ ref: "tableBody",
3332
+ class: normalizeClass(_ctx.ns.e("body")),
3333
+ cellspacing: "0",
3334
+ cellpadding: "0",
3335
+ border: "0",
3336
+ style: normalizeStyle({
3337
+ width: _ctx.bodyWidth,
3338
+ tableLayout: _ctx.tableLayout
3339
+ })
3340
+ }, [
3341
+ createVNode(_component_hColgroup, {
3342
+ columns: _ctx.store.states.columns.value,
3343
+ "table-layout": _ctx.tableLayout
3344
+ }, null, 8, ["columns", "table-layout"]),
3345
+ _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
3346
+ key: 0,
3347
+ ref: "tableHeaderRef",
3348
+ class: normalizeClass(_ctx.ns.e("body-header")),
3349
+ border: _ctx.border,
3350
+ "default-sort": _ctx.defaultSort,
3351
+ store: _ctx.store,
3352
+ onSetDragVisible: _ctx.setDragVisible
3353
+ }, null, 8, [
3354
+ "class",
3355
+ "border",
3356
+ "default-sort",
3357
+ "store",
3358
+ "onSetDragVisible"
3359
+ ])) : createCommentVNode("v-if", true),
3360
+ createVNode(_component_table_body, {
3361
+ context: _ctx.context,
3362
+ highlight: _ctx.highlightCurrentRow,
3363
+ "row-class-name": _ctx.rowClassName,
3364
+ "tooltip-effect": _ctx.tooltipEffect,
3365
+ "tooltip-options": _ctx.tooltipOptions,
3366
+ "row-style": _ctx.rowStyle,
3367
+ store: _ctx.store,
3368
+ stripe: _ctx.stripe
3369
+ }, null, 8, [
3370
+ "context",
3371
+ "highlight",
3372
+ "row-class-name",
3373
+ "tooltip-effect",
3374
+ "tooltip-options",
3375
+ "row-style",
3376
+ "store",
3377
+ "stripe"
3378
+ ]),
3379
+ _ctx.showSummary && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_footer, {
3380
+ key: 1,
3381
+ class: normalizeClass(_ctx.ns.e("body-footer")),
3382
+ border: _ctx.border,
3383
+ "default-sort": _ctx.defaultSort,
3384
+ store: _ctx.store,
3385
+ "sum-text": _ctx.computedSumText,
3386
+ "summary-method": _ctx.summaryMethod
3387
+ }, null, 8, [
3388
+ "class",
3389
+ "border",
3390
+ "default-sort",
3391
+ "store",
3392
+ "sum-text",
3393
+ "summary-method"
3394
+ ])) : createCommentVNode("v-if", true)
3395
+ ], 6),
3396
+ _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
3397
+ key: 0,
3398
+ ref: "emptyBlock",
3399
+ style: normalizeStyle(_ctx.emptyBlockStyle),
3400
+ class: normalizeClass(_ctx.ns.e("empty-block"))
3401
+ }, [createBaseVNode("span", { class: normalizeClass(_ctx.ns.e("empty-text")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)])], 2)], 6)) : createCommentVNode("v-if", true),
3402
+ _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
3403
+ key: 1,
3404
+ ref: "appendWrapper",
3405
+ class: normalizeClass(_ctx.ns.e("append-wrapper"))
3406
+ }, [renderSlot(_ctx.$slots, "append")], 2)) : createCommentVNode("v-if", true)
3407
+ ]),
3408
+ _: 3
3409
+ }, 8, [
3410
+ "view-style",
3411
+ "wrap-style",
3412
+ "always"
3413
+ ])], 2),
3414
+ _ctx.showSummary && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
3415
+ key: 1,
3416
+ ref: "footerWrapper",
3417
+ class: normalizeClass(_ctx.ns.e("footer-wrapper"))
3418
+ }, [createBaseVNode("table", {
3419
+ class: normalizeClass(_ctx.ns.e("footer")),
3420
+ cellspacing: "0",
3421
+ cellpadding: "0",
3422
+ border: "0",
3423
+ style: normalizeStyle(_ctx.tableBodyStyles)
3424
+ }, [createVNode(_component_hColgroup, {
3425
+ columns: _ctx.store.states.columns.value,
3426
+ "table-layout": _ctx.tableLayout
3427
+ }, null, 8, ["columns", "table-layout"]), createVNode(_component_table_footer, {
3428
+ border: _ctx.border,
3429
+ "default-sort": _ctx.defaultSort,
3430
+ store: _ctx.store,
3431
+ "sum-text": _ctx.computedSumText,
3432
+ "summary-method": _ctx.summaryMethod
3433
+ }, null, 8, [
3434
+ "border",
3435
+ "default-sort",
3436
+ "store",
3437
+ "sum-text",
3438
+ "summary-method"
3439
+ ])], 6)], 2)), [[vShow, !_ctx.isEmpty], [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]]) : createCommentVNode("v-if", true),
3440
+ _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
3441
+ key: 2,
3442
+ class: normalizeClass(_ctx.ns.e("border-left-patch"))
3443
+ }, null, 2)) : createCommentVNode("v-if", true)
3444
+ ], 6), withDirectives(createBaseVNode("div", {
3445
+ ref: "resizeProxy",
3446
+ class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
3447
+ }, null, 2), [[vShow, _ctx.resizeProxyVisible]])], 46, _hoisted_1);
3448
+ }
3449
+ var Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);
3450
+ var defaultClassNames = {
3451
+ selection: "table-column--selection",
3452
+ expand: "table__expand-column"
3453
+ };
3454
+ var cellStarts = {
3455
+ default: { order: "" },
3456
+ selection: {
3457
+ width: 48,
3458
+ minWidth: 48,
3459
+ realWidth: 48,
3460
+ order: ""
3461
+ },
3462
+ expand: {
3463
+ width: 48,
3464
+ minWidth: 48,
3465
+ realWidth: 48,
3466
+ order: ""
3467
+ },
3468
+ index: {
3469
+ width: 48,
3470
+ minWidth: 48,
3471
+ realWidth: 48,
3472
+ order: ""
3473
+ }
3474
+ };
3475
+ var getDefaultClassName = (type) => {
3476
+ return defaultClassNames[type] || "";
3477
+ };
3478
+ var cellForced = {
3479
+ selection: {
3480
+ renderHeader({ store, column }) {
3481
+ function isDisabled() {
3482
+ return store.states.data.value && store.states.data.value.length === 0;
3483
+ }
3484
+ return h(ElCheckbox, {
3485
+ disabled: isDisabled(),
3486
+ size: store.states.tableSize.value,
3487
+ indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
3488
+ "onUpdate:modelValue": store.toggleAllSelection,
3489
+ modelValue: store.states.isAllSelected.value,
3490
+ ariaLabel: column.label
3491
+ });
3492
+ },
3493
+ renderCell({ row, column, store, $index }) {
3494
+ return h(ElCheckbox, {
3495
+ disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
3496
+ size: store.states.tableSize.value,
3497
+ onChange: () => {
3498
+ store.commit("rowSelectedChanged", row);
3499
+ },
3500
+ onClick: (event) => event.stopPropagation(),
3501
+ modelValue: store.isSelected(row),
3502
+ ariaLabel: column.label
3503
+ });
3504
+ },
3505
+ sortable: false,
3506
+ resizable: false
3507
+ },
3508
+ index: {
3509
+ renderHeader({ column }) {
3510
+ return column.label || "#";
3511
+ },
3512
+ renderCell({ column, $index }) {
3513
+ let i = $index + 1;
3514
+ const index = column.index;
3515
+ if (typeof index === "number") i = $index + index;
3516
+ else if (typeof index === "function") i = index($index);
3517
+ return h("div", {}, [i]);
3518
+ },
3519
+ sortable: false
3520
+ },
3521
+ expand: {
3522
+ renderHeader({ column }) {
3523
+ return column.label || "";
3524
+ },
3525
+ renderCell({ row, store, expanded }) {
3526
+ const { ns } = store;
3527
+ const classes = [ns.e("expand-icon")];
3528
+ if (expanded) classes.push(ns.em("expand-icon", "expanded"));
3529
+ const callback = function(e) {
3530
+ e.stopPropagation();
3531
+ store.toggleRowExpansion(row);
3532
+ };
3533
+ return h("div", {
3534
+ class: classes,
3535
+ onClick: callback
3536
+ }, { default: () => {
3537
+ return [h(ElIcon, null, { default: () => {
3538
+ return [h(arrow_right_default)];
3539
+ } })];
3540
+ } });
3541
+ },
3542
+ sortable: false,
3543
+ resizable: false
3544
+ }
3545
+ };
3546
+ function defaultRenderCell({ row, column, $index }) {
3547
+ var _a;
3548
+ const property = column.property;
3549
+ const value = property && getProp(row, property).value;
3550
+ if (column && column.formatter) return column.formatter(row, column, value, $index);
3551
+ return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
3552
+ }
3553
+ function treeCellPrefix({ row, treeNode, store }, createPlaceholder = false) {
3554
+ const { ns } = store;
3555
+ if (!treeNode) {
3556
+ if (createPlaceholder) return [h("span", { class: ns.e("placeholder") })];
3557
+ return null;
3558
+ }
3559
+ const ele = [];
3560
+ const callback = function(e) {
3561
+ e.stopPropagation();
3562
+ if (treeNode.loading) return;
3563
+ store.loadOrToggle(row);
3564
+ };
3565
+ if (treeNode.indent) ele.push(h("span", {
3566
+ class: ns.e("indent"),
3567
+ style: { "padding-left": `${treeNode.indent}px` }
3568
+ }));
3569
+ if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
3570
+ const expandClasses = [ns.e("expand-icon"), treeNode.expanded ? ns.em("expand-icon", "expanded") : ""];
3571
+ let icon = arrow_right_default;
3572
+ if (treeNode.loading) icon = loading_default;
3573
+ ele.push(h("div", {
3574
+ class: expandClasses,
3575
+ onClick: callback
3576
+ }, { default: () => {
3577
+ return [h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, { default: () => [h(icon)] })];
3578
+ } }));
3579
+ } else ele.push(h("span", { class: ns.e("placeholder") }));
3580
+ return ele;
3581
+ }
3582
+ init_shared_esm_bundler();
3583
+ function getAllAliases(props, aliases) {
3584
+ return props.reduce((prev, cur) => {
3585
+ prev[cur] = cur;
3586
+ return prev;
3587
+ }, aliases);
3588
+ }
3589
+ function useWatcher(owner, props_) {
3590
+ const instance = getCurrentInstance();
3591
+ const registerComplexWatchers = () => {
3592
+ const props = ["fixed"];
3593
+ const aliases = {
3594
+ realWidth: "width",
3595
+ realMinWidth: "minWidth"
3596
+ };
3597
+ const allAliases = getAllAliases(props, aliases);
3598
+ Object.keys(allAliases).forEach((key) => {
3599
+ const columnKey = aliases[key];
3600
+ if (hasOwn(props_, columnKey)) watch(() => props_[columnKey], (newVal) => {
3601
+ let value = newVal;
3602
+ if (columnKey === "width" && key === "realWidth") value = parseWidth(newVal);
3603
+ if (columnKey === "minWidth" && key === "realMinWidth") value = parseMinWidth(newVal);
3604
+ instance.columnConfig.value[columnKey] = value;
3605
+ instance.columnConfig.value[key] = value;
3606
+ const updateColumns = columnKey === "fixed";
3607
+ owner.value.store.scheduleLayout(updateColumns);
3608
+ });
3609
+ });
3610
+ };
3611
+ const registerNormalWatchers = () => {
3612
+ const props = [
3613
+ "label",
3614
+ "filters",
3615
+ "filterMultiple",
3616
+ "filteredValue",
3617
+ "sortable",
3618
+ "index",
3619
+ "formatter",
3620
+ "className",
3621
+ "labelClassName",
3622
+ "showOverflowTooltip"
3623
+ ];
3624
+ const aliases = {
3625
+ property: "prop",
3626
+ align: "realAlign",
3627
+ headerAlign: "realHeaderAlign"
3628
+ };
3629
+ const allAliases = getAllAliases(props, aliases);
3630
+ Object.keys(allAliases).forEach((key) => {
3631
+ const columnKey = aliases[key];
3632
+ if (hasOwn(props_, columnKey)) watch(() => props_[columnKey], (newVal) => {
3633
+ instance.columnConfig.value[key] = newVal;
3634
+ });
3635
+ });
3636
+ };
3637
+ return {
3638
+ registerComplexWatchers,
3639
+ registerNormalWatchers
3640
+ };
3641
+ }
3642
+ function useRender(props, slots, owner) {
3643
+ const instance = getCurrentInstance();
3644
+ const columnId = ref("");
3645
+ const isSubColumn = ref(false);
3646
+ const realAlign = ref();
3647
+ const realHeaderAlign = ref();
3648
+ const ns = useNamespace("table");
3649
+ watchEffect(() => {
3650
+ realAlign.value = props.align ? `is-${props.align}` : null;
3651
+ realAlign.value;
3652
+ });
3653
+ watchEffect(() => {
3654
+ realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
3655
+ realHeaderAlign.value;
3656
+ });
3657
+ const columnOrTableParent = computed(() => {
3658
+ let parent = instance.vnode.vParent || instance.parent;
3659
+ while (parent && !parent.tableId && !parent.columnId) parent = parent.vnode.vParent || parent.parent;
3660
+ return parent;
3661
+ });
3662
+ const hasTreeColumn = computed(() => {
3663
+ const { store } = instance.parent;
3664
+ if (!store) return false;
3665
+ const { treeData } = store.states;
3666
+ const treeDataValue = treeData.value;
3667
+ return treeDataValue && Object.keys(treeDataValue).length > 0;
3668
+ });
3669
+ const realWidth = ref(parseWidth(props.width));
3670
+ const realMinWidth = ref(parseMinWidth(props.minWidth));
3671
+ const setColumnWidth = (column) => {
3672
+ if (realWidth.value) column.width = realWidth.value;
3673
+ if (realMinWidth.value) column.minWidth = realMinWidth.value;
3674
+ if (!realWidth.value && realMinWidth.value) column.width = void 0;
3675
+ if (!column.minWidth) column.minWidth = 80;
3676
+ column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
3677
+ return column;
3678
+ };
3679
+ const setColumnForcedProps = (column) => {
3680
+ const type = column.type;
3681
+ const source = cellForced[type] || {};
3682
+ Object.keys(source).forEach((prop) => {
3683
+ const value = source[prop];
3684
+ if (prop !== "className" && value !== void 0) column[prop] = value;
3685
+ });
3686
+ const className = getDefaultClassName(type);
3687
+ if (className) {
3688
+ const forceClass = `${unref(ns.namespace)}-${className}`;
3689
+ column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
3690
+ }
3691
+ return column;
3692
+ };
3693
+ const checkSubColumn = (children) => {
3694
+ if (Array.isArray(children)) children.forEach((child) => check(child));
3695
+ else check(children);
3696
+ function check(item) {
3697
+ var _a;
3698
+ if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") item.vParent = instance;
3699
+ }
3700
+ };
3701
+ const setColumnRenders = (column) => {
3702
+ if (props.renderHeader) debugWarn("TableColumn", "Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.");
3703
+ else if (column.type !== "selection") column.renderHeader = (scope) => {
3704
+ instance.columnConfig.value["label"];
3705
+ const renderHeader = slots.header;
3706
+ return renderHeader ? renderHeader(scope) : column.label;
3707
+ };
3708
+ let originRenderCell = column.renderCell;
3709
+ if (column.type === "expand") {
3710
+ column.renderCell = (data) => h("div", { class: "cell" }, [originRenderCell(data)]);
3711
+ owner.value.renderExpanded = (data) => {
3712
+ return slots.default ? slots.default(data) : slots.default;
3713
+ };
3714
+ } else {
3715
+ originRenderCell = originRenderCell || defaultRenderCell;
3716
+ column.renderCell = (data) => {
3717
+ let children = null;
3718
+ if (slots.default) {
3719
+ const vnodes = slots.default(data);
3720
+ children = vnodes.some((v$1) => v$1.type !== Comment) ? vnodes : originRenderCell(data);
3721
+ } else children = originRenderCell(data);
3722
+ const { columns } = owner.value.store.states;
3723
+ const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
3724
+ const prefix = treeCellPrefix(data, hasTreeColumn.value && data.cellIndex === firstUserColumnIndex);
3725
+ const props2 = {
3726
+ class: "cell",
3727
+ style: {}
3728
+ };
3729
+ if (column.showOverflowTooltip) {
3730
+ props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
3731
+ props2.style = { width: `${(data.column.realWidth || Number(data.column.width)) - 1}px` };
3732
+ }
3733
+ checkSubColumn(children);
3734
+ return h("div", props2, [prefix, children]);
3735
+ };
3736
+ }
3737
+ return column;
3738
+ };
3739
+ const getPropsData = (...propsKey) => {
3740
+ return propsKey.reduce((prev, cur) => {
3741
+ if (Array.isArray(cur)) cur.forEach((key) => {
3742
+ prev[key] = props[key];
3743
+ });
3744
+ return prev;
3745
+ }, {});
3746
+ };
3747
+ const getColumnElIndex = (children, child) => {
3748
+ return Array.prototype.indexOf.call(children, child);
3749
+ };
3750
+ const updateColumnOrder = () => {
3751
+ owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
3752
+ };
3753
+ return {
3754
+ columnId,
3755
+ realAlign,
3756
+ isSubColumn,
3757
+ realHeaderAlign,
3758
+ columnOrTableParent,
3759
+ setColumnWidth,
3760
+ setColumnForcedProps,
3761
+ setColumnRenders,
3762
+ getPropsData,
3763
+ getColumnElIndex,
3764
+ updateColumnOrder
3765
+ };
3766
+ }
3767
+ var defaultProps = {
3768
+ type: {
3769
+ type: String,
3770
+ default: "default"
3771
+ },
3772
+ label: String,
3773
+ className: String,
3774
+ labelClassName: String,
3775
+ property: String,
3776
+ prop: String,
3777
+ width: {
3778
+ type: [String, Number],
3779
+ default: ""
3780
+ },
3781
+ minWidth: {
3782
+ type: [String, Number],
3783
+ default: ""
3784
+ },
3785
+ renderHeader: Function,
3786
+ sortable: {
3787
+ type: [Boolean, String],
3788
+ default: false
3789
+ },
3790
+ sortMethod: Function,
3791
+ sortBy: [
3792
+ String,
3793
+ Function,
3794
+ Array
3795
+ ],
3796
+ resizable: {
3797
+ type: Boolean,
3798
+ default: true
3799
+ },
3800
+ columnKey: String,
3801
+ align: String,
3802
+ headerAlign: String,
3803
+ showOverflowTooltip: {
3804
+ type: [Boolean, Object],
3805
+ default: void 0
3806
+ },
3807
+ fixed: [Boolean, String],
3808
+ formatter: Function,
3809
+ selectable: Function,
3810
+ reserveSelection: Boolean,
3811
+ filterMethod: Function,
3812
+ filteredValue: Array,
3813
+ filters: Array,
3814
+ filterPlacement: String,
3815
+ filterMultiple: {
3816
+ type: Boolean,
3817
+ default: true
3818
+ },
3819
+ index: [Number, Function],
3820
+ sortOrders: {
3821
+ type: Array,
3822
+ default: () => {
3823
+ return [
3824
+ "ascending",
3825
+ "descending",
3826
+ null
3827
+ ];
3828
+ },
3829
+ validator: (val) => {
3830
+ return val.every((order) => [
3831
+ "ascending",
3832
+ "descending",
3833
+ null
3834
+ ].includes(order));
3835
+ }
3836
+ }
3837
+ };
3838
+ init_shared_esm_bundler();
3839
+ var columnIdSeed = 1;
3840
+ var ElTableColumn = defineComponent({
3841
+ name: "ElTableColumn",
3842
+ components: { ElCheckbox },
3843
+ props: defaultProps,
3844
+ setup(props, { slots }) {
3845
+ const instance = getCurrentInstance();
3846
+ const columnConfig = ref({});
3847
+ const owner = computed(() => {
3848
+ let parent2 = instance.parent;
3849
+ while (parent2 && !parent2.tableId) parent2 = parent2.parent;
3850
+ return parent2;
3851
+ });
3852
+ const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
3853
+ const { columnId, isSubColumn, realHeaderAlign, columnOrTableParent, setColumnWidth, setColumnForcedProps, setColumnRenders, getPropsData, getColumnElIndex, realAlign, updateColumnOrder } = useRender(props, slots, owner);
3854
+ const parent = columnOrTableParent.value;
3855
+ columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
3856
+ onBeforeMount(() => {
3857
+ isSubColumn.value = owner.value !== parent;
3858
+ const type = props.type || "default";
3859
+ const sortable = props.sortable === "" ? true : props.sortable;
3860
+ const showOverflowTooltip = isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
3861
+ const defaults = {
3862
+ ...cellStarts[type],
3863
+ id: columnId.value,
3864
+ type,
3865
+ property: props.prop || props.property,
3866
+ align: realAlign,
3867
+ headerAlign: realHeaderAlign,
3868
+ showOverflowTooltip,
3869
+ filterable: props.filters || props.filterMethod,
3870
+ filteredValue: [],
3871
+ filterPlacement: "",
3872
+ isColumnGroup: false,
3873
+ isSubColumn: false,
3874
+ filterOpened: false,
3875
+ sortable,
3876
+ index: props.index,
3877
+ rawColumnKey: instance.vnode.key
3878
+ };
3879
+ let column = getPropsData([
3880
+ "columnKey",
3881
+ "label",
3882
+ "className",
3883
+ "labelClassName",
3884
+ "type",
3885
+ "renderHeader",
3886
+ "formatter",
3887
+ "fixed",
3888
+ "resizable"
3889
+ ], [
3890
+ "sortMethod",
3891
+ "sortBy",
3892
+ "sortOrders"
3893
+ ], ["selectable", "reserveSelection"], [
3894
+ "filterMethod",
3895
+ "filters",
3896
+ "filterMultiple",
3897
+ "filterOpened",
3898
+ "filteredValue",
3899
+ "filterPlacement"
3900
+ ]);
3901
+ column = mergeOptions(defaults, column);
3902
+ column = compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
3903
+ columnConfig.value = column;
3904
+ registerNormalWatchers();
3905
+ registerComplexWatchers();
3906
+ });
3907
+ onMounted(() => {
3908
+ var _a;
3909
+ const parent2 = columnOrTableParent.value;
3910
+ const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
3911
+ const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
3912
+ columnConfig.value.getColumnIndex = getColumnIndex;
3913
+ getColumnIndex() > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
3914
+ });
3915
+ onBeforeUnmount(() => {
3916
+ owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
3917
+ });
3918
+ instance.columnId = columnId.value;
3919
+ instance.columnConfig = columnConfig;
3920
+ },
3921
+ render() {
3922
+ var _a, _b, _c;
3923
+ try {
3924
+ const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
3925
+ row: {},
3926
+ column: {},
3927
+ $index: -1
3928
+ });
3929
+ const children = [];
3930
+ if (Array.isArray(renderDefault)) {
3931
+ for (const childNode of renderDefault) if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) children.push(childNode);
3932
+ else if (childNode.type === Fragment && Array.isArray(childNode.children)) childNode.children.forEach((vnode2) => {
3933
+ if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) children.push(vnode2);
3934
+ });
3935
+ }
3936
+ return h("div", children);
3937
+ } catch (e) {
3938
+ return h("div", []);
3939
+ }
3940
+ }
3941
+ });
3942
+ var ElTable = withInstall(Table, { TableColumn: ElTableColumn });
3943
+ var ElTableColumn$1 = withNoopInstall(ElTableColumn);
3944
+ export { ElTableColumn$1 as n, ElTable as t };