From 7439bb1b5b8e02e9835ecb07889c5681a874f5e2 Mon Sep 17 00:00:00 2001 From: Raul Aguilar Date: Thu, 21 Sep 2023 15:21:06 +0200 Subject: [PATCH] [ONL-7918] migrate sort direction enum --- src/components/ec-smart-table/ec-smart-table.spec.js | 2 +- src/components/ec-smart-table/ec-smart-table.story.js | 2 +- src/components/ec-smart-table/ec-smart-table.vue | 2 +- src/components/ec-table-head/ec-table-head.spec.js | 2 +- src/components/ec-table/ec-table.spec.js | 2 +- src/components/ec-table/ec-table.story.js | 2 +- src/composables/use-ec-sorting/use-ec-sorting.js | 2 +- src/composables/use-ec-sorting/use-ec-sorting.spec.js | 2 +- src/enums/sort-direction-cycle.js | 2 +- src/enums/sort-direction.js | 2 -- src/enums/sort-direction.ts | 4 ++++ src/main.js | 2 +- 12 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 src/enums/sort-direction.js create mode 100644 src/enums/sort-direction.ts diff --git a/src/components/ec-smart-table/ec-smart-table.spec.js b/src/components/ec-smart-table/ec-smart-table.spec.js index 26815ea46..54d248b7f 100644 --- a/src/components/ec-smart-table/ec-smart-table.spec.js +++ b/src/components/ec-smart-table/ec-smart-table.spec.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import { h, markRaw } from 'vue'; -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import EcSmartTable from './ec-smart-table.vue'; describe('EcSmartTable', () => { diff --git a/src/components/ec-smart-table/ec-smart-table.story.js b/src/components/ec-smart-table/ec-smart-table.story.js index eb188484d..518eb68fb 100644 --- a/src/components/ec-smart-table/ec-smart-table.story.js +++ b/src/components/ec-smart-table/ec-smart-table.story.js @@ -4,7 +4,7 @@ import { computed, markRaw, onBeforeUnmount, ref, } from 'vue'; -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import * as SortDirectionCycle from '../../enums/sort-direction-cycle'; import EcDateRangeFilter from '../ec-date-range-filter'; import EcIcon from '../ec-icon'; diff --git a/src/components/ec-smart-table/ec-smart-table.vue b/src/components/ec-smart-table/ec-smart-table.vue index a8e2dbb78..00d8b2838 100644 --- a/src/components/ec-smart-table/ec-smart-table.vue +++ b/src/components/ec-smart-table/ec-smart-table.vue @@ -123,7 +123,7 @@ import { import useEcPagination from '../../composables/use-ec-pagination'; import useEcSorting from '../../composables/use-ec-sorting'; -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import * as SortDirectionCycle from '../../enums/sort-direction-cycle'; import EcLoading from '../ec-loading'; import EcSmartTableHeading from '../ec-smart-table-heading'; diff --git a/src/components/ec-table-head/ec-table-head.spec.js b/src/components/ec-table-head/ec-table-head.spec.js index 72999602b..5efa1364c 100644 --- a/src/components/ec-table-head/ec-table-head.spec.js +++ b/src/components/ec-table-head/ec-table-head.spec.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import { withMockedConsole } from '../../../tests/utils/console'; -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import EcTableHead from './ec-table-head.vue'; describe('EcTableHead', () => { diff --git a/src/components/ec-table/ec-table.spec.js b/src/components/ec-table/ec-table.spec.js index 42977914c..541f73db8 100644 --- a/src/components/ec-table/ec-table.spec.js +++ b/src/components/ec-table/ec-table.spec.js @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'; import { defineComponent, h } from 'vue'; import { withMockedConsole } from '../../../tests/utils/console'; -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import EcTable from './ec-table.vue'; function mountEcTable(props, mountOpts) { diff --git a/src/components/ec-table/ec-table.story.js b/src/components/ec-table/ec-table.story.js index 0a0d3b9bd..a23f32d48 100644 --- a/src/components/ec-table/ec-table.story.js +++ b/src/components/ec-table/ec-table.story.js @@ -1,6 +1,6 @@ import { action } from '@storybook/addon-actions'; -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import EcIcon from '../ec-icon/ec-icon.vue'; import EcOptionCard from '../ec-option-card'; import EcTable from './ec-table.vue'; diff --git a/src/composables/use-ec-sorting/use-ec-sorting.js b/src/composables/use-ec-sorting/use-ec-sorting.js index 5bd7f77a5..92ed3c567 100644 --- a/src/composables/use-ec-sorting/use-ec-sorting.js +++ b/src/composables/use-ec-sorting/use-ec-sorting.js @@ -1,6 +1,6 @@ import { ref, unref } from 'vue'; -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import * as SortDirectionCycle from '../../enums/sort-direction-cycle'; export default function useEcSorting({ diff --git a/src/composables/use-ec-sorting/use-ec-sorting.spec.js b/src/composables/use-ec-sorting/use-ec-sorting.spec.js index e7ca401c3..984495f39 100644 --- a/src/composables/use-ec-sorting/use-ec-sorting.spec.js +++ b/src/composables/use-ec-sorting/use-ec-sorting.spec.js @@ -1,4 +1,4 @@ -import * as SortDirection from '../../enums/sort-direction'; +import { SortDirection } from '../../enums/sort-direction'; import * as SortDirectionCycle from '../../enums/sort-direction-cycle'; import useEcSorting from './use-ec-sorting'; diff --git a/src/enums/sort-direction-cycle.js b/src/enums/sort-direction-cycle.js index 066301070..ed65d12a9 100644 --- a/src/enums/sort-direction-cycle.js +++ b/src/enums/sort-direction-cycle.js @@ -1,4 +1,4 @@ -import * as SortDirection from './sort-direction'; +import { SortDirection } from './sort-direction'; export const LOWEST_FIRST = [SortDirection.ASC, SortDirection.DESC]; export const HIGHEST_FIRST = [SortDirection.DESC, SortDirection.ASC]; diff --git a/src/enums/sort-direction.js b/src/enums/sort-direction.js deleted file mode 100644 index 500ccc809..000000000 --- a/src/enums/sort-direction.js +++ /dev/null @@ -1,2 +0,0 @@ -export const ASC = 'asc'; -export const DESC = 'desc'; diff --git a/src/enums/sort-direction.ts b/src/enums/sort-direction.ts new file mode 100644 index 000000000..99554e087 --- /dev/null +++ b/src/enums/sort-direction.ts @@ -0,0 +1,4 @@ +export enum SortDirection { + ASC = 'asc', + DESC = 'desc', +} diff --git a/src/main.js b/src/main.js index 7b8c991f5..94f167f7c 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,4 @@ -import * as SortDirection from './enums/sort-direction'; +import { SortDirection } from './enums/sort-direction'; import * as SortDirectionCycle from './enums/sort-direction-cycle'; import * as TooltipPlacement from './enums/tooltip-placement';