You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initial values are only set by property initializers and there are no longer any defaults per type from the framework
Remove the defaultValue and related fields from the @Property decorator
Remove all runtime checks and validations
BREAKING CHANGE: @Property decorator must be adapted according to new type parameter
Copy file name to clipboardexpand all lines: docs/5-development/03-understanding-components-metadata.md
+53-66
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Defines the HTML tag for the Web Component.
15
15
tag: "my-component",
16
16
})
17
17
classMyComponentextendsUI5Element {};
18
-
```
18
+
```
19
19
20
20
21
21
@@ -94,10 +94,10 @@ class MyComponent extends UI5Element {
94
94
95
95
## Properties / Attributes
96
96
97
-
Defines the HTML properties for the Web Component.
97
+
Defines the HTML properties for the Web Component.
98
98
99
99
**Note about attributes:** By default, for each property an equivalent attribute is supported. Attributes have the same names as properties, but in `kebab-case` rather than `camelCase`.
100
-
Properties of type `Object`, properties with `multiple` set to`true` and properties with `noAttribute` set to `true` do not have an attribute equivalent.
100
+
Properties of type `Object`, properties with `multiple` set to`true` and properties with `noAttribute` set to `true` do not have an attribute equivalent.
101
101
102
102
#### Example
103
103
@@ -107,79 +107,66 @@ Properties of type `Object`, properties with `multiple` set to`true` and propert
|`type`| Property type | String | The type of the property. For more information on types see the table below. |
133
-
|`defaultValue`| Any valid value for the type | undefined | Default value of the property. Cannot be set for type "Boolean". Booleans are always false by default in HTML.|
134
-
|`multiple`| Boolean | false | Indicates whether the property represents a single value or is an array of values of the given type. |
135
-
|`noAttribute`| Boolean | false | No attribute equivalent will be created for that property. Always true for properties of type Object. |
136
-
|`validator`| Validator type | N/A | The validator of the property. For more information on validators see the table below |
|`type`| Property type | String | The type of the property. For more information on types see the table below. |
133
+
|`noAttribute`| Boolean | false | No attribute equivalent will be created for that property. Always true for properties of type Object. |
134
+
|`converter`| Object | N/A | A custom converter with two methods - `fromAttribute` and `toAttribute` that will receive the `type` and the value |
137
135
138
-
**Note:** The `type` setting is required, except these two cases:
136
+
Types are used for attribute conversion only. Converting from a property to a string, the framework can check the runtime type and convert to string, but coming an attribute, there is no way to know whether it is a boolean or a number unless a type is also given.
137
+
**Note:** If `type` is omitted, it is implied to be `String`
139
138
140
-
-`string` properties (type: String is considered default)
The `validator` is a custom class that implements `isValid` function that validates the property's value whenever it changes. If value is not valid, the framework will set the proeprty `defaultValue`.
|`type` * |`HTMLElement` or `Node`| N/A | The type of the children that can go into that slot. |
211
198
|`individualSlots`|`Boolean`| false | If set to `true`, each child will have its own slot, allowing you to arrange/wrap the children arbitrarily. |
212
199
|`propertyName`|`String`| N/A | Allows to set the name of the property on the Web Component, where the children belonging to this slot will be stored. |
213
200
|`invalidateOnChildChange`**|`Boolean` or `Object`| false |**Experimental, do not use.** Defines whether every invalidation of a UI5 Web Component in this slot should trigger an invalidation of the parent UI5 Web Component. |
214
201
215
202
`*` The `type` setting is required.
216
203
217
-
`**`
218
-
**Note:**`invalidateOnChildChange` is not meant to be used with standard DOM Elements and is not to be confused with `MutationObserver`-like functionality.
219
-
It rather targets the use case of components that slot abstract items (`UI5Element` instances without a template) and require to be invalidated in turn whenever these items are invalidated.
204
+
`**`
205
+
**Note:**`invalidateOnChildChange` is not meant to be used with standard DOM Elements and is not to be confused with `MutationObserver`-like functionality.
206
+
It rather targets the use case of components that slot abstract items (`UI5Element` instances without a template) and require to be invalidated in turn whenever these items are invalidated.
220
207
221
208
The `invalidateOnChildChange` setting can be either a `Boolean` (`true` meaning invalidate the component on any change of a child in this slot) or an `Object` with `properties` and `slots` fields. They in turn can be either of
222
209
type `Boolean` (`true` meaning invalidate on any property change or any slot change) or `Array` of strings indicating exactly which properties or slots lead to invalidation.
@@ -246,7 +233,7 @@ class MyComponent extends UI5Element {
246
233
247
234
```js
248
235
classMyComponentextendsUI5Element {
249
-
@slot({
236
+
@slot({
250
237
type:HTMLElement,
251
238
invalidateOnChildChange: {
252
239
"properties":true,
@@ -261,7 +248,7 @@ class MyComponent extends UI5Element {
261
248
262
249
```js
263
250
classMyComponentextendsUI5Element {
264
-
@slot({
251
+
@slot({
265
252
type:HTMLElement,
266
253
invalidateOnChildChange: {
267
254
"properties": ["text", "selected", "disabled"],
@@ -273,14 +260,14 @@ class MyComponent extends UI5Element {
273
260
```
274
261
275
262
Notes:
276
-
- Children without a `slot` attribute will be assigned to the `default` slot.
263
+
- Children without a `slot` attribute will be assigned to the `default` slot.
277
264
- All HTML text nodes will be assigned to the `default` slot, as they cannot have a `slot` attribute.
278
265
- For all slots the Web Component will have a property created, with the name of the slot, to hold a list of all children assigned to this slot.
279
266
For example, if you have a slot named "rows", "this.rows" will be an array, holding references to all children with `slot="rows"`, or no slot, if rows was default.
280
267
- For the `default` slot you can provide an accessor. In the following example, `this.items` will hold all children that were assigned to the default slot.
0 commit comments