@ui5/webcomponents-tools 2.3.1-rc.0 → 2.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lib/cem/event.mjs +21 -4
- package/lib/cem/schema-internal.json +8 -0
- package/lib/cem/types-internal.d.ts +13 -2
- package/lib/cem/utils.mjs +2 -2
- package/lib/hbs2ui5/index.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [2.4.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.3.1-rc.0...v2.4.0-rc.0) (2024-10-10)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* require handlebar file names processed by hbs2ui5 tool to end with the '.hbs' extension ([#9992](https://github.com/SAP/ui5-webcomponents/issues/9992)) ([1b23f3d](https://github.com/SAP/ui5-webcomponents/commit/1b23f3d2b02829844cb8c0cd4a4adefd628b7f4f))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* enhance `[@event](https://github.com/event)` decorator ([#9944](https://github.com/SAP/ui5-webcomponents/issues/9944)) ([fe1d816](https://github.com/SAP/ui5-webcomponents/commit/fe1d816f512400b839fd4ce1b9af1506d0cb4c9a))
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
## [2.3.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.3.0...v2.3.1-rc.0) (2024-10-03)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
package/lib/cem/event.mjs
CHANGED
@@ -16,6 +16,7 @@ import {
|
|
16
16
|
} from "./utils.mjs";
|
17
17
|
|
18
18
|
const jsDocRegExp = /\/\*\*(.|\n)+?\s+\*\//;
|
19
|
+
const ASTFalseKeywordCode = 94;
|
19
20
|
|
20
21
|
const getParams = (ts, eventDetails, commentParams, classNode, moduleDoc) => {
|
21
22
|
return commentParams?.map(commentParam => {
|
@@ -77,17 +78,33 @@ function processEvent(ts, event, classNode, moduleDoc) {
|
|
77
78
|
const privacy = findTag(eventParsedComment, ["public", "private", "protected"])?.tag || "private";
|
78
79
|
const sinceTag = findTag(eventParsedComment, "since");
|
79
80
|
const commentParams = findAllTags(eventParsedComment, "param");
|
80
|
-
const allowPreventDefault = hasTag(eventParsedComment, "allowPreventDefault") || undefined;
|
81
81
|
const description = normalizeDescription(eventParsedComment?.description);
|
82
82
|
const native = hasTag(eventParsedComment, "native");
|
83
|
-
const
|
83
|
+
const eventArgs = event?.expression?.arguments;
|
84
|
+
let eventBubbles;
|
85
|
+
let eventCancelable;
|
86
|
+
let eventDetails;
|
87
|
+
|
88
|
+
eventArgs && eventArgs.forEach(arg => {
|
89
|
+
arg.properties?.forEach(prop => {
|
90
|
+
if (prop.name?.text === "bubbles") {
|
91
|
+
eventBubbles = prop.initializer.kind === ASTFalseKeywordCode ? false : true;
|
92
|
+
} else if (prop.name?.text === "cancelable") {
|
93
|
+
eventCancelable = prop.initializer.kind === ASTFalseKeywordCode ? false : true;
|
94
|
+
} else if (prop.name?.text === "detail") {
|
95
|
+
eventDetails = prop.initializer?.properties;
|
96
|
+
}
|
97
|
+
});
|
98
|
+
});
|
84
99
|
|
85
|
-
if (
|
100
|
+
if (eventDetails && !event?.expression?.typeArguments) {
|
86
101
|
logDocumentationError(moduleDoc.path, `Event details for event '${name}' must be described using generics. Add type via generics to the decorator: @event<TypeForDetails>("${name}", {details}).`)
|
87
102
|
}
|
88
103
|
|
89
104
|
result.description = description;
|
90
|
-
result.
|
105
|
+
result._ui5Cancelable = eventCancelable !== undefined ? eventCancelable : false;
|
106
|
+
result._ui5allowPreventDefault = result._ui5Cancelable;
|
107
|
+
result._ui5Bubbles = eventBubbles !== undefined ? eventBubbles : true;
|
91
108
|
|
92
109
|
if (native) {
|
93
110
|
result.type = { text: "Event" };
|
@@ -818,6 +818,14 @@
|
|
818
818
|
"description": "Whether the parameter is optional. Undefined implies non-optional.",
|
819
819
|
"type": "boolean"
|
820
820
|
},
|
821
|
+
"_ui5Cancelable": {
|
822
|
+
"description": "Whether the event is cancelable or not.",
|
823
|
+
"type": "boolean"
|
824
|
+
},
|
825
|
+
"_ui5Bubbles": {
|
826
|
+
"description": "Whether the event bubbles or not.",
|
827
|
+
"type": "boolean"
|
828
|
+
},
|
821
829
|
"_ui5since": {
|
822
830
|
"description": "Marks when the field was introduced",
|
823
831
|
"type": "string"
|
@@ -319,9 +319,20 @@ export interface Event {
|
|
319
319
|
_ui5parameters?: Parameter[]
|
320
320
|
_ui5privacy?: Privacy
|
321
321
|
/**
|
322
|
-
* Whether the
|
322
|
+
* Whether the event is preventable.
|
323
|
+
*/
|
324
|
+
_ui5allowPreventDefault?: boolean;
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Whether the event is cancelable.
|
323
328
|
*/
|
324
|
-
|
329
|
+
_ui5Cancelable?: boolean;
|
330
|
+
|
331
|
+
/**
|
332
|
+
* Whether the event is bubbles.
|
333
|
+
*/
|
334
|
+
_ui5Bubbles?: boolean;
|
335
|
+
|
325
336
|
/**
|
326
337
|
* Marks when the field was introduced
|
327
338
|
*/
|
package/lib/cem/utils.mjs
CHANGED
@@ -222,7 +222,7 @@ const commonTags = ["public", "protected", "private", "since", "deprecated"];
|
|
222
222
|
const allowedTags = {
|
223
223
|
field: [...commonTags, "formEvents", "formProperty", "default"],
|
224
224
|
slot: [...commonTags, "default"],
|
225
|
-
event: [...commonTags, "param", "
|
225
|
+
event: [...commonTags, "param", "native", "allowPreventDefault"],
|
226
226
|
eventParam: [...commonTags],
|
227
227
|
method: [...commonTags, "param", "returns", "override"],
|
228
228
|
class: [...commonTags, "constructor", "class", "abstract", "experimental", "implements", "extends", "slot", "csspart"],
|
@@ -283,7 +283,7 @@ const findAllTags = (jsDoc, tagName) => {
|
|
283
283
|
};
|
284
284
|
|
285
285
|
const validateJSDocTag = (tag) => {
|
286
|
-
const booleanTags = ["private", "protected", "public", "abstract", "
|
286
|
+
const booleanTags = ["private", "protected", "public", "abstract", "native", "allowPreventDefault", "formProperty", "constructor", "override"];
|
287
287
|
let tagName = tag.tag;
|
288
288
|
|
289
289
|
if (booleanTags.includes(tag.tag)) {
|
package/lib/hbs2ui5/index.js
CHANGED
@@ -24,7 +24,7 @@ const onError = (place) => {
|
|
24
24
|
console.log(`A problem occoured when reading ${place}. Please recheck passed parameters.`);
|
25
25
|
};
|
26
26
|
|
27
|
-
const isHandlebars = (fileName) => fileName.
|
27
|
+
const isHandlebars = (fileName) => fileName.endsWith('.hbs');
|
28
28
|
|
29
29
|
const hasTypes = (file, componentName) => {
|
30
30
|
const tsFile = path.join(path.dirname(file), componentName + ".ts")
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.4.0-rc.0",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -86,5 +86,5 @@
|
|
86
86
|
"esbuild": "^0.19.9",
|
87
87
|
"yargs": "^17.5.1"
|
88
88
|
},
|
89
|
-
"gitHead": "
|
89
|
+
"gitHead": "464fc0e663f3e1142cdbba076cad777cf6ab2738"
|
90
90
|
}
|