From 66746333cb7da69bad0ec5b39e848f6bf2f62e4b Mon Sep 17 00:00:00 2001 From: justwiner <30335393+justwiner@users.noreply.github.com> Date: Fri, 30 Oct 2020 11:28:45 +0800 Subject: [PATCH] fix(table): fix the filter panel of the table (#509) --- packages/table/src/dropdown.ts | 35 ----- packages/table/src/filter-panel.vue | 142 ++++++++---------- .../table/src/table-header/event-helper.ts | 1 - website/docs/en-US/table.md | 1 + website/docs/es/table.md | 1 + website/docs/fr-FR/table.md | 1 + website/docs/zh-CN/table.md | 1 + 7 files changed, 68 insertions(+), 114 deletions(-) delete mode 100644 packages/table/src/dropdown.ts diff --git a/packages/table/src/dropdown.ts b/packages/table/src/dropdown.ts deleted file mode 100644 index 2af430c508e9f..0000000000000 --- a/packages/table/src/dropdown.ts +++ /dev/null @@ -1,35 +0,0 @@ -import isServer from '@element-plus/utils/isServer' -const dropdowns = [] - -!isServer && document.addEventListener('click', function (event: Event) { - dropdowns.forEach(function (dropdown) { - const target = event.target - if (!dropdown || !dropdown.$el) return - if (target === dropdown.$el || dropdown.$el.contains(target)) { - return - } - dropdown.handleOutsideClick && dropdown.handleOutsideClick(event) - }) -}) - -function useDropdown(instance) { - const open = () => { - if (instance) { - dropdowns.push(instance) - } - } - - const close = () => { - const index = dropdowns.indexOf(instance) - if (index !== -1) { - dropdowns.splice(instance, 1) - } - } - - return { - open, - close, - } -} - -export default useDropdown diff --git a/packages/table/src/filter-panel.vue b/packages/table/src/filter-panel.vue index 7da9612fadea9..b7527907fd76c 100644 --- a/packages/table/src/filter-panel.vue +++ b/packages/table/src/filter-panel.vue @@ -1,78 +1,76 @@