Skip to content

Commit

Permalink
feat(column-picker-mixin): get rid of ColumnPickerMixin and refactor …
Browse files Browse the repository at this point in the history
…components which use it

EMP-3960
  • Loading branch information
joseacabaneros committed May 2, 2024
1 parent 91c3350 commit 5c6d71d
Show file tree
Hide file tree
Showing 15 changed files with 423 additions and 447 deletions.
3 changes: 3 additions & 0 deletions packages/_vue3-migration-test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.eslint.json'
},
rules: {
'max-len': 'off'
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<BaseColumnPickerDropdown v-model="selectedColumns" :columns="columns">
<template #toggle="{ item, isOpen }">Selected: {{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>
<template #item="{ item, isSelected, isHighlighted }">
<span v-if="isHighlighted">🟢</span>
<span v-if="isSelected">✅</span>
<span>{{ item }}</span>
</template>
</BaseColumnPickerDropdown>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import BaseColumnPickerDropdown from '../../../../x-components/src/components/column-picker/base-column-picker-dropdown.vue';
const columns = ref([2, 4, 6]);
const selectedColumns = ref(4);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<!--
<BaseColumnPickerList v-model="selectedColumns" :columns="columns">
<template #default="{ column, isSelected }">
<span v-if="isSelected">✅</span>
<span>{{ column }}</span>
</template>
<template #divider>
<span>-----</span>
</template>
</BaseColumnPickerList>
-->
<span>
BREAKING Vue3: `template v-for` key should be placed on the `template` tag (rather than on its
children)
</span>
</template>

<script setup lang="ts">
/*
import { ref } from 'vue';
import BaseColumnPickerList from '../../../../x-components/src/components/column-picker/base-column-picker-list.vue';
const columns = ref([2, 4, 6]);
const selectedColumns = ref(4);
*/
</script>
2 changes: 2 additions & 0 deletions packages/_vue3-migration-test/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './animations';
export { default as TestBaseColumnPickerDropdown } from './column-picker/test-base-column-picker-dropdown.vue';
export { default as TestBaseColumnPickerList } from './column-picker/test-base-column-picker-list.vue';
export { default as TestBaseDropdown } from './test-base-dropdown.vue';
export { default as TestBaseEventButton } from './test-base-event-button.vue';
14 changes: 13 additions & 1 deletion packages/_vue3-migration-test/src/router.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createRouter, createWebHistory } from 'vue-router';
import {
TestAnimateWidth,
TestBaseColumnPickerList,
TestBaseDropdown,
TestBaseEventButton,
TestFade,
TestSortDropdown,
TestSortList,
TestSortPickerList
TestSortPickerList,
TestBaseColumnPickerDropdown
} from './';

const routes = [
Expand All @@ -30,6 +32,16 @@ const routes = [
name: 'BaseEventButton',
component: TestBaseEventButton
},
{
path: '/base-column-picker-dropdown',
name: 'BaseColumnPickerDropdown',
component: TestBaseColumnPickerDropdown
},
{
path: '/base-column-picker-list',
name: 'BaseColumnPickerList',
component: TestBaseColumnPickerList
},
{
path: '/sort-dropdown',
name: 'SortDropdown',
Expand Down
2 changes: 1 addition & 1 deletion packages/x-components/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
preset: 'ts-jest',
transform: {
'^.+\\.vue$': require.resolve('./vue-preprocessor'),
'^.+\\.vue$': '@vue/vue2-jest',
'^.+\\.scss$': 'jest-scss-transform'
},
testMatch: ['<rootDir>/src/**/*.spec.ts'],
Expand Down
Loading

0 comments on commit 5c6d71d

Please sign in to comment.