1 | # Migrating from v3.x to v4.x
|
2 |
|
3 | Version 4 of Rendition includes some breaking changes. This document aims to
|
4 | list these changes and provide a migration path for users wanting to upgrade.
|
5 |
|
6 | ## Dependency updates
|
7 |
|
8 | The following dependencies have been updated to their latest versions:
|
9 | - `react`
|
10 | - `react-dom`
|
11 | - `@types/react`
|
12 | - `@types/react-dom`
|
13 | - `grid-styled`
|
14 | - `resin-semver`
|
15 | - `styled-components`
|
16 |
|
17 | ## Tooltips
|
18 |
|
19 | The tooltip component has been removed in v4. To add a tooltip to your
|
20 | component, simply add the `tooltip` property to it.
|
21 | The `tooltip` property can be either a string containing the tooltip text or an
|
22 | options object.
|
23 |
|
24 | | Option | Type | Description |
|
25 | --- | --- | ---
|
26 | text | string | The text displayed in the tooltip
|
27 | trigger | 'hover' | 'click' | The event used to display the tooltip, defaults to 'hover'
|
28 | placement | 'top' | 'right' | 'bottom' | 'left' | The position that the tooltip should be displayed
|
29 |
|
30 | ## Image
|
31 |
|
32 | The `Image` component has been renamed to `Img` to prevent conflicts with the
|
33 | `Image()` web API - https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image
|
34 |
|
35 | ## Text
|
36 |
|
37 | The `Text` component has been renamed to `Txt` to prevent conflicts with the
|
38 | `Text()` web API - https://developer.mozilla.org/en-US/docs/Web/API/Text
|
39 |
|
40 | ## Filters
|
41 | The `Semver` and `Semver Range` types have been removed
|
42 | `SchemaSieve` is no longer a factory function, and its methods can be accessed
|
43 | without instantiation.
|
44 |
|
45 | ```
|
46 | import { SchemaSieve } from 'rendition';
|
47 | const sieve = SchemaSieve();
|
48 | // ...
|
49 | sieve.filter(items, rules)
|
50 | ```
|
51 |
|
52 | now becomes:
|
53 |
|
54 | ```
|
55 | import { SchemaSieve } from 'rendition';
|
56 | SchemaSieve.filter(filters, items)
|
57 | ```
|
58 |
|
59 | Filters now use JSON schema (draft 6) for both schemas and rules.
|
60 | Any views, schemas or filters created using v3 can be migrated using the
|
61 | functions `migrateLegacyFilter()`, `migrateLegacyViews()` and
|
62 | `migrateLegacySchema()` functions in the `SchemaSieve` object
|
63 |
|
64 | The filters components now only requires a schema property to bootstrap. You can
|
65 | be notified of filter and view changes using the `onFiltersUpdate` and
|
66 | `onViewsUpdate` properties.
|