Skip to content

Commit

Permalink
Merge branch 'main' into feature/EMP-3795-migrate-main-scroll-compone…
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopf authored May 6, 2024
2 parents 9a9237d + a0573cb commit a700c7a
Show file tree
Hide file tree
Showing 29 changed files with 589 additions and 469 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'
}
};
27 changes: 27 additions & 0 deletions packages/_vue3-migration-test/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,33 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.0-alpha.4](https://github.com/empathyco/x/compare/[email protected]@1.0.0-alpha.4) (2024-05-06)


### ⚠ BREAKING CHANGES

* **ColumnPickerMixin:** `BaseColumnPickerDropdown` component will no longer emit the `change` event, use `update:modelValue` instead.
`BaseColumnPickerDropdown` prop for the selected columns was renamed from `value` to `modelValue`.

`BaseColumnPickerList` component will no longer emit the `change` event, use `update:modelValue` instead.
`BaseColumnPickerList` prop for the selected columns was renamed from `value` to `modelValue`.

`ColumnPickerMixin` has been removed.

### Code Refactoring

* **ColumnPickerMixin:** get rid of `ColumnPickerMixin` and refactor components which use it (#1461) ([c5b84da](https://github.com/empathyco/x/commit/c5b84da32b75a37d028e91b64220016a2cfb3037))



## [1.0.0-alpha.3](https://github.com/empathyco/x/compare/[email protected]@1.0.0-alpha.3) (2024-05-03)

**Note:** Version bump only for package vue3-migration-test





## [1.0.0-alpha.2](https://github.com/empathyco/x/compare/[email protected]@1.0.0-alpha.2) (2024-05-01)


Expand Down
4 changes: 2 additions & 2 deletions packages/_vue3-migration-test/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue3-migration-test",
"private": "true",
"version": "1.0.0-alpha.2",
"version": "1.0.0-alpha.4",
"scripts": {
"dev": "vite",
"preview": "vite preview",
Expand All @@ -10,7 +10,7 @@
},
"dependencies": {
"@empathyco/x-bus": "^1.0.3-alpha.1",
"@empathyco/x-types": "^10.1.0-alpha.2",
"@empathyco/x-types": "^10.1.0-alpha.3",
"@empathyco/x-utils": "^1.0.3-alpha.1",
"@vue/compat": "^3.4.22",
"@vueuse/core": "~10.7.1",
Expand Down
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,4 +1,6 @@
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 * from './scroll';
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,13 +1,15 @@
import { createRouter, createWebHistory } from 'vue-router';
import {
TestAnimateWidth,
TestBaseColumnPickerList,
TestBaseDropdown,
TestBaseEventButton,
TestFade,
TestSortDropdown,
TestSortList,
TestSortPickerList,
TestScroll
TestScroll,
TestBaseColumnPickerDropdown
} from './';

const routes = [
Expand Down Expand Up @@ -36,6 +38,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
8 changes: 8 additions & 0 deletions packages/x-adapter-platform/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.1.0-alpha.2](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-03)

**Note:** Version bump only for package @empathyco/x-adapter-platform





## [1.1.0-alpha.1](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-02-05)

**Note:** Version bump only for package @empathyco/x-adapter-platform
Expand Down
6 changes: 3 additions & 3 deletions packages/x-adapter-platform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@empathyco/x-adapter-platform",
"version": "1.1.0-alpha.1",
"version": "1.1.0-alpha.2",
"description": "A search client for the Empathy Platform API",
"author": "Empathy Systems Corporation S.L.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -41,8 +41,8 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@empathyco/x-adapter": "^8.0.3-alpha.1",
"@empathyco/x-types": "^10.1.0-alpha.2",
"@empathyco/x-adapter": "^8.1.0-alpha.0",
"@empathyco/x-types": "^10.1.0-alpha.3",
"@empathyco/x-utils": "^1.0.3-alpha.1",
"tslib": "~2.6.0"
},
Expand Down
9 changes: 9 additions & 0 deletions packages/x-adapter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [8.1.0-alpha.0](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-03)


### Features

* support empty params on adapter's requests (#1459) ([11a2efc](https://github.com/empathyco/x/commit/11a2efc2d0efe5ef7e34f8feb9e1bcc389bf847a))



## [8.0.3-alpha.1](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-02-05)

**Note:** Version bump only for package @empathyco/x-adapter
Expand Down
2 changes: 1 addition & 1 deletion packages/x-adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@empathyco/x-adapter",
"version": "8.0.3-alpha.1",
"version": "8.1.0-alpha.0",
"description": "A utils library to create a client for any API",
"author": "Empathy Systems Corporation S.L.",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ describe('fetch httpClient testing', () => {
expectFetchCallWith(endpoint);
});

it('maps empty values if configured to do so', async () => {
await fetchHttpClient(endpoint, {
sendEmptyParams: true,
parameters: {
q: undefined,
r: '',
s: null,
t: [],
u: {}
}
});
expectFetchCallWith(`${endpoint}?r=&s=null`);
});

it('cancels equal endpoint requests if no requestId parameter is passed', async () => {
await Promise.all([
expect(
Expand Down Expand Up @@ -186,6 +200,43 @@ describe('fetch httpClient testing', () => {
})
});
});

it('sends empty values in the body if configured to do so', async () => {
await fetchHttpClient(endpoint, {
sendParamsInBody: true,
sendEmptyParams: true,
parameters: {
q: 'shirt',
a: undefined,
b: null,
c: '',
d: [],
extraParams: {
lang: 'en',
e: undefined,
f: null,
g: '',
h: [],
i: {}
}
}
});
expectFetchCallWith(endpoint, {
body: JSON.stringify({
q: 'shirt',
b: null,
c: '',
d: [],
extraParams: {
lang: 'en',
f: null,
g: '',
h: [],
i: {}
}
})
});
});
});
});

Expand Down
16 changes: 13 additions & 3 deletions packages/x-adapter/src/http-clients/fetch.http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ import { buildUrl, toJson } from './utils';
*/
export const fetchHttpClient: HttpClient = (
endpoint,
{ id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false } = {}
{
id = endpoint,
cancelable = true,
parameters = {},
properties,
sendParamsInBody = false,
sendEmptyParams = false
} = {}
) => {
const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};
if (!sendEmptyParams) {
parameters = cleanEmpty(parameters);
}
const flatParameters = flatObject(parameters);
const url = sendParamsInBody ? endpoint : buildUrl(endpoint, cleanEmpty(flatParameters));
const bodyParameters = sendParamsInBody ? { body: JSON.stringify(cleanEmpty(parameters)) } : {};
const url = sendParamsInBody ? endpoint : buildUrl(endpoint, flatParameters);
const bodyParameters = sendParamsInBody ? { body: JSON.stringify(parameters) } : {};

return fetch(url, {
...properties,
Expand Down
4 changes: 4 additions & 0 deletions packages/x-adapter/src/http-clients/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export interface RequestOptions {
* A flag to send parameters in the body if true or in the url QueryString if false.
*/
sendParamsInBody?: boolean;
/**
* A flag to always send the parameters even if their values are empty.
*/
sendEmptyParams?: boolean;
/**
* A list of parameters to send to the API.
*/
Expand Down
27 changes: 27 additions & 0 deletions packages/x-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,33 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [5.0.0-alpha.7](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-06)


### ⚠ BREAKING CHANGES

* **ColumnPickerMixin:** `BaseColumnPickerDropdown` component will no longer emit the `change` event, use `update:modelValue` instead.
`BaseColumnPickerDropdown` prop for the selected columns was renamed from `value` to `modelValue`.

`BaseColumnPickerList` component will no longer emit the `change` event, use `update:modelValue` instead.
`BaseColumnPickerList` prop for the selected columns was renamed from `value` to `modelValue`.

`ColumnPickerMixin` has been removed.

### Code Refactoring

* **ColumnPickerMixin:** get rid of `ColumnPickerMixin` and refactor components which use it (#1461) ([c5b84da](https://github.com/empathyco/x/commit/c5b84da32b75a37d028e91b64220016a2cfb3037))



## [5.0.0-alpha.6](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-03)

**Note:** Version bump only for package @empathyco/x-components





## [5.0.0-alpha.5](https://github.com/empathyco/x/compare/@empathyco/[email protected]...@empathyco/[email protected]) (2024-05-01)


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
8 changes: 4 additions & 4 deletions packages/x-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@empathyco/x-components",
"version": "5.0.0-alpha.5",
"version": "5.0.0-alpha.7",
"description": "Empathy X Components",
"author": "Empathy Systems Corporation S.L.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -69,13 +69,13 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@empathyco/x-adapter": "^8.0.3-alpha.1",
"@empathyco/x-adapter-platform": "^1.1.0-alpha.1",
"@empathyco/x-adapter": "^8.1.0-alpha.0",
"@empathyco/x-adapter-platform": "^1.1.0-alpha.2",
"@empathyco/x-bus": "^1.0.3-alpha.1",
"@empathyco/x-deep-merge": "^2.0.3-alpha.1",
"@empathyco/x-logger": "^1.2.0-alpha.11",
"@empathyco/x-storage-service": "^2.0.3-alpha.0",
"@empathyco/x-types": "^10.1.0-alpha.2",
"@empathyco/x-types": "^10.1.0-alpha.3",
"@empathyco/x-utils": "^1.0.3-alpha.1",
"@vue/devtools-api": "~6.5.0",
"@vueuse/core": "~10.7.1",
Expand Down
Loading

0 comments on commit a700c7a

Please sign in to comment.