@wavemaker-ai/react-codegen 1.0.0-rc.647469 → 1.0.0-rc.647499
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/command.js +6 -1
- package/command.js.map +1 -1
- package/dist/transpiler/index.d.mts +62 -0
- package/dist/transpiler/index.mjs +47857 -0
- package/dist/transpiler/index.mjs.map +1 -0
- package/dist/transpiler/wm-styles.css +1502 -0
- package/package-lock.json +1144 -254
- package/package.json +21 -3
- package/src/app.generator.js +12 -10
- package/src/app.generator.js.map +1 -1
- package/src/gen-app-override-css.js +7 -7
- package/src/gen-app-override-css.js.map +1 -1
- package/src/handlebar-helpers.js +8 -356
- package/src/handlebar-helpers.js.map +1 -1
- package/src/transpile/bind.ex.transformer.js +13 -7
- package/src/transpile/bind.ex.transformer.js.map +1 -1
- package/src/transpile/components/advanced/carousel.transformer.js +1 -2
- package/src/transpile/components/advanced/carousel.transformer.js.map +1 -1
- package/src/transpile/components/advanced/login.transformer.js +1 -2
- package/src/transpile/components/advanced/login.transformer.js.map +1 -1
- package/src/transpile/components/container/accordion-pane.transformer.js +10 -0
- package/src/transpile/components/container/accordion-pane.transformer.js.map +1 -1
- package/src/transpile/components/container/accordion.transformer.js +2 -3
- package/src/transpile/components/container/accordion.transformer.js.map +1 -1
- package/src/transpile/components/container/container.transformer.js +13 -1
- package/src/transpile/components/container/container.transformer.js.map +1 -1
- package/src/transpile/components/container/panel.transformer.js +10 -0
- package/src/transpile/components/container/panel.transformer.js.map +1 -1
- package/src/transpile/components/container/tabpane.transformer.js +10 -0
- package/src/transpile/components/container/tabpane.transformer.js.map +1 -1
- package/src/transpile/components/container/tabs.transformer.js +3 -37
- package/src/transpile/components/container/tabs.transformer.js.map +1 -1
- package/src/transpile/components/container/wizard.transformer.js +3 -4
- package/src/transpile/components/container/wizard.transformer.js.map +1 -1
- package/src/transpile/components/container/wizardstep.transformer.js +25 -0
- package/src/transpile/components/container/wizardstep.transformer.js.map +1 -1
- package/src/transpile/components/data/card/card-content.transformer.js +10 -0
- package/src/transpile/components/data/card/card-content.transformer.js.map +1 -1
- package/src/transpile/components/data/form/form-action.transformer.js +2 -2
- package/src/transpile/components/data/form/form-action.transformer.js.map +1 -1
- package/src/transpile/components/data/form/form-field.transformer.js +2 -3
- package/src/transpile/components/data/form/form-field.transformer.js.map +1 -1
- package/src/transpile/components/data/form/form.transformer.js +6 -7
- package/src/transpile/components/data/form/form.transformer.js.map +1 -1
- package/src/transpile/components/data/list/list-template-transformer.js +10 -1
- package/src/transpile/components/data/list/list-template-transformer.js.map +1 -1
- package/src/transpile/components/data/list/list-transformer.js +24 -45
- package/src/transpile/components/data/list/list-transformer.js.map +1 -1
- package/src/transpile/components/data/live-filter-field.transformer.js +2 -3
- package/src/transpile/components/data/live-filter-field.transformer.js.map +1 -1
- package/src/transpile/components/data/livefilter.transformer.js +6 -7
- package/src/transpile/components/data/livefilter.transformer.js.map +1 -1
- package/src/transpile/components/data/liveform.transformer.js +6 -7
- package/src/transpile/components/data/liveform.transformer.js.map +1 -1
- package/src/transpile/components/data/table/table-column.transformer.js +9 -9
- package/src/transpile/components/data/table/table-column.transformer.js.map +1 -1
- package/src/transpile/components/data/table/table-row.transformer.js +20 -7
- package/src/transpile/components/data/table/table-row.transformer.js.map +1 -1
- package/src/transpile/components/data/table/utils.js +3 -3
- package/src/transpile/components/data/table/utils.js.map +1 -1
- package/src/transpile/components/dialogs/dialog-actions.transformer.js +1 -2
- package/src/transpile/components/dialogs/dialog-actions.transformer.js.map +1 -1
- package/src/transpile/components/dialogs/dialog.transformer.js +1 -1
- package/src/transpile/components/dialogs/dialog.transformer.js.map +1 -1
- package/src/transpile/components/dialogs/login-dialog.transformer.js +2 -3
- package/src/transpile/components/dialogs/login-dialog.transformer.js.map +1 -1
- package/src/transpile/components/layout/footer.transformer.js +27 -10
- package/src/transpile/components/layout/footer.transformer.js.map +1 -1
- package/src/transpile/components/layout/header.transformer.js +29 -12
- package/src/transpile/components/layout/header.transformer.js.map +1 -1
- package/src/transpile/components/layout/leftnav.transformer.js +26 -9
- package/src/transpile/components/layout/leftnav.transformer.js.map +1 -1
- package/src/transpile/components/layout/rightnav.transformer.js +27 -10
- package/src/transpile/components/layout/rightnav.transformer.js.map +1 -1
- package/src/transpile/components/layout/topnav.transformer.js +26 -13
- package/src/transpile/components/layout/topnav.transformer.js.map +1 -1
- package/src/transpile/components/nav/nav-item.transformer.js +1 -2
- package/src/transpile/components/nav/nav-item.transformer.js.map +1 -1
- package/src/transpile/components/nav/nav.transformer.js +1 -2
- package/src/transpile/components/nav/nav.transformer.js.map +1 -1
- package/src/transpile/components/nav/navbar.transformer.js +7 -8
- package/src/transpile/components/nav/navbar.transformer.js.map +1 -1
- package/src/transpile/components/navigation/popover.transformer.js +10 -0
- package/src/transpile/components/navigation/popover.transformer.js.map +1 -1
- package/src/transpile/components/page/partial-container.transformer.js +2 -36
- package/src/transpile/components/page/partial-container.transformer.js.map +1 -1
- package/src/transpile/components/partial/partial-content.transformer.js +56 -0
- package/src/transpile/components/partial/partial-content.transformer.js.map +1 -0
- package/src/transpile/components/prefab/prefab.transformer.js +11 -5
- package/src/transpile/components/prefab/prefab.transformer.js.map +1 -1
- package/src/transpile/components/utils.js +5 -5
- package/src/transpile/components/utils.js.map +1 -1
- package/src/transpile/index.js +65 -0
- package/src/transpile/index.js.map +1 -0
- package/src/transpile/property/property-parser.js +1 -0
- package/src/transpile/property/property-parser.js.map +1 -1
- package/src/transpile/serialize-variables.js +322 -0
- package/src/transpile/serialize-variables.js.map +1 -0
- package/src/transpile/style/split-css-shorthand.js +60 -0
- package/src/transpile/style/split-css-shorthand.js.map +1 -0
- package/src/transpile/transform-markup.js +283 -0
- package/src/transpile/transform-markup.js.map +1 -0
- package/src/transpile/transpile-variables.js +35 -0
- package/src/transpile/transpile-variables.js.map +1 -0
- package/src/transpile/transpile.js +67 -26
- package/src/transpile/transpile.js.map +1 -1
- package/src/transpile/transpiler.js +26 -0
- package/src/transpile/transpiler.js.map +1 -0
- package/src/transpile/variables-template-source.js +6 -0
- package/src/transpile/variables-template-source.js.map +1 -0
- package/src/transpile/variables-template.js +15 -0
- package/src/transpile/variables-template.js.map +1 -0
- package/src/transpile/widget-inline-style-processor.js +14 -44
- package/src/transpile/widget-inline-style-processor.js.map +1 -1
- package/src/utils.browser.js +853 -0
- package/src/utils.browser.js.map +1 -0
- package/src/utils.js +141 -87
- package/src/utils.js.map +1 -1
- package/src/variables/variable.transformer.js +15 -0
- package/src/variables/variable.transformer.js.map +1 -1
- package/templates/component/component.hbs +4 -17
- package/templates/component/partial.hbs +5 -14
- package/templates/project/app/client.layout.tsx +4 -4
- package/templates/project/app/components.css +1 -5
- package/templates/project/app/globals.css +1 -153
- package/templates/project/app/widgetInlineStylesOverride.css +351 -0
- package/templates/project/app/wm-globals.css +152 -0
- package/templates/project/app/wm-styles.css +4 -0
- package/templates/project/package.json +7 -4
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeVariablesToCode = serializeVariablesToCode;
|
|
4
|
+
exports.transformMarkup = transformMarkup;
|
|
5
|
+
const transpile_1 = require("./transpile");
|
|
6
|
+
const transpile_variables_1 = require("./transpile-variables");
|
|
7
|
+
const serialize_variables_1 = require("./serialize-variables");
|
|
8
|
+
/**
|
|
9
|
+
* Serializes a single transpiled variable/action definition into a constructor call string.
|
|
10
|
+
* Mirrors the Handlebars template logic but as pure TypeScript — no Handlebars dependency.
|
|
11
|
+
*/
|
|
12
|
+
function serializeVariableEntry(v, scope, isPrefabApp, isPrefabScope, prefabName) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
14
|
+
const lines = [];
|
|
15
|
+
const key = (0, serialize_variables_1.quoteKeyIfHyphen)(v.name);
|
|
16
|
+
lines.push(`${key}: new (${v.classname} as any)({`);
|
|
17
|
+
lines.push(` name: '${v.name}',`);
|
|
18
|
+
lines.push(` _context: ${scope},`);
|
|
19
|
+
if (v.serviceType)
|
|
20
|
+
lines.push(` serviceType: '${v.serviceType}',`);
|
|
21
|
+
if (v.operation !== undefined && v.operation !== null && v.operation !== "") {
|
|
22
|
+
lines.push(` operation: ${(0, serialize_variables_1.stringify)(v.operation)},`);
|
|
23
|
+
}
|
|
24
|
+
if (v.service !== undefined && v.service !== null && v.service !== "") {
|
|
25
|
+
lines.push(` service: ${(0, serialize_variables_1.stringify)(v.service)},`);
|
|
26
|
+
}
|
|
27
|
+
if (v.maxResults !== undefined && v.maxResults !== null && v.maxResults !== "") {
|
|
28
|
+
lines.push(` maxResults: '${v.maxResults}',`);
|
|
29
|
+
}
|
|
30
|
+
if (v.operationId !== undefined && v.operationId !== null && v.operationId !== "") {
|
|
31
|
+
lines.push(` operationId: '${v.operationId}',`);
|
|
32
|
+
}
|
|
33
|
+
if (v.operationType !== undefined && v.operationType !== null && v.operationType !== "") {
|
|
34
|
+
lines.push(` operationType: '${v.operationType}',`);
|
|
35
|
+
}
|
|
36
|
+
if (v.controller !== undefined && v.controller !== null && v.controller !== "") {
|
|
37
|
+
lines.push(` controller: '${v.controller}',`);
|
|
38
|
+
}
|
|
39
|
+
// paramProvider
|
|
40
|
+
if (v.name === "loggedInUser") {
|
|
41
|
+
lines.push(` paramProvider: () => App.appConfig.loggedInUser,`);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
let paramStr;
|
|
45
|
+
if (v.classname === "ModelVariable") {
|
|
46
|
+
paramStr = (0, serialize_variables_1.stringifyModelParams)(v.params, scope);
|
|
47
|
+
}
|
|
48
|
+
else if (v.classname === "ServiceVariable" || v.classname === "LiveVariable") {
|
|
49
|
+
paramStr = (0, serialize_variables_1.stringify)(v.params);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const entries = Object.entries((_a = v.params) !== null && _a !== void 0 ? _a : {})
|
|
53
|
+
.map(([k, val]) => `'${k}': ${(0, serialize_variables_1.quoteIfString)(val)}`)
|
|
54
|
+
.join(",\n ");
|
|
55
|
+
paramStr = `{\n ${entries}\n }`;
|
|
56
|
+
}
|
|
57
|
+
lines.push(` paramProvider: () => (${paramStr}),`);
|
|
58
|
+
}
|
|
59
|
+
// filterProvider
|
|
60
|
+
if (v.filters && Object.keys(v.filters).length > 0) {
|
|
61
|
+
const filterEntries = Object.entries(v.filters)
|
|
62
|
+
.map(([k, val]) => `'${k}': ${(0, serialize_variables_1.quoteIfString)(val)}`)
|
|
63
|
+
.join(",\n ");
|
|
64
|
+
lines.push(` filterProvider: () => ({\n ${filterEntries}\n }),`);
|
|
65
|
+
}
|
|
66
|
+
// ServiceVariable-specific
|
|
67
|
+
if (v.classname === "ServiceVariable") {
|
|
68
|
+
if (isPrefabApp) {
|
|
69
|
+
lines.push(` baseUrl: ${scope}.baseUrl,`);
|
|
70
|
+
}
|
|
71
|
+
else if (isPrefabScope) {
|
|
72
|
+
lines.push(` baseUrl: ${scope}.baseUrl + '/prefabs/' + ${scope}.prefabname,`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
lines.push(` baseUrl: ${scope}.baseUrl + '/services',`);
|
|
76
|
+
}
|
|
77
|
+
lines.push(` getServiceInfo: () => ${scope}.serviceDefinitions['${v.operationId}']?.wmServiceOperationInfo,`);
|
|
78
|
+
lines.push(` orderBy: '${(_b = v.orderBy) !== null && _b !== void 0 ? _b : ""}',`);
|
|
79
|
+
lines.push(` isStaticParams: ${(0, serialize_variables_1.stringify)(v.isStaticParams)},`);
|
|
80
|
+
if (v.onBeforeUpdate) {
|
|
81
|
+
lines.push(` onBeforeUpdate: (variable, inputData, options) => {\n return ${v.onBeforeUpdate}\n },`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// NavigationAction-specific
|
|
85
|
+
if (v.classname === "NavigationAction") {
|
|
86
|
+
lines.push(` appConfig: ${scope}.appConfig,`);
|
|
87
|
+
}
|
|
88
|
+
// LoginAction-specific
|
|
89
|
+
if (v.classname === "LoginAction") {
|
|
90
|
+
lines.push(` baseURL: ${scope}.appConfig.url,`);
|
|
91
|
+
lines.push(` securityService: () => ${scope}.appConfig.SecurityService,`);
|
|
92
|
+
lines.push(` useDefaultSuccessHandler: ${v.useDefaultSuccessHandler},`);
|
|
93
|
+
}
|
|
94
|
+
// LogoutAction-specific
|
|
95
|
+
if (v.classname === "LogoutAction") {
|
|
96
|
+
lines.push(` baseURL: ${scope}.appConfig.url,`);
|
|
97
|
+
lines.push(` redirectTo: '${(_c = v.redirectTo) !== null && _c !== void 0 ? _c : ""}',`);
|
|
98
|
+
lines.push(` useDefaultSuccessHandler: ${v.useDefaultSuccessHandler},`);
|
|
99
|
+
lines.push(` securityService: () => ${scope}.appConfig.SecurityService,`);
|
|
100
|
+
}
|
|
101
|
+
// TimerAction-specific
|
|
102
|
+
if (v.classname === "TimerAction") {
|
|
103
|
+
lines.push(` repeating: ${(0, serialize_variables_1.stringify)(v.repeating)},`);
|
|
104
|
+
lines.push(` delay: ${(0, serialize_variables_1.stringify)(v.delay)},`);
|
|
105
|
+
if (v.onTimerFire) {
|
|
106
|
+
lines.push(` onSuccess: (variable, data, options) => {\n ${v.onTimerFire}\n },`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// NotificationAction-specific
|
|
110
|
+
if (v.classname === "NotificationAction") {
|
|
111
|
+
if (v.showDialog) {
|
|
112
|
+
lines.push(` showDialog: (options) => {\n ${v.showDialog}\n },`);
|
|
113
|
+
}
|
|
114
|
+
if (v.partialContent) {
|
|
115
|
+
lines.push(` partialContent: {\n component: ${v.partialContent.component}\n },`);
|
|
116
|
+
}
|
|
117
|
+
lines.push(` onOk: (variable, data, options) => {\n ${(_d = v.onOk) !== null && _d !== void 0 ? _d : ""}\n },`);
|
|
118
|
+
if (v.operation === "confirm") {
|
|
119
|
+
lines.push(` onCancel: (variable, data, options) => {\n ${(_e = v.onCancel) !== null && _e !== void 0 ? _e : ""}\n },`);
|
|
120
|
+
}
|
|
121
|
+
if (v.operation === "toast") {
|
|
122
|
+
lines.push(` toasterService: () => ${scope}.toaster,`);
|
|
123
|
+
}
|
|
124
|
+
lines.push(` onClose: (variable, data, options) => {\n ${(_f = v.onClose) !== null && _f !== void 0 ? _f : ""}\n },`);
|
|
125
|
+
}
|
|
126
|
+
// CrudVariable-specific
|
|
127
|
+
if (v.classname === "CrudVariable") {
|
|
128
|
+
lines.push(` isStaticParams: ${(0, serialize_variables_1.stringify)(v.isStaticParams)},`);
|
|
129
|
+
lines.push(` saveInPhonegap: ${v.saveInPhonegap},`);
|
|
130
|
+
lines.push(` crudOperationId: '${v.crudOperationId}',`);
|
|
131
|
+
lines.push(` transformationRequired: ${v.transformationRequired},`);
|
|
132
|
+
if (isPrefabScope) {
|
|
133
|
+
lines.push(` baseUrl: ${scope}.baseUrl + '/prefabs/' + ${scope}.prefabname,`);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
lines.push(` baseUrl: ${scope}.baseUrl,`);
|
|
137
|
+
}
|
|
138
|
+
if (v.dataBinding) {
|
|
139
|
+
lines.push(` dataBinding: ${v.dataBinding},`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// LiveVariable-specific
|
|
143
|
+
if (v.classname === "LiveVariable") {
|
|
144
|
+
lines.push(` isStaticParams: ${(0, serialize_variables_1.stringify)(v.isStaticParams)},`);
|
|
145
|
+
lines.push(` type: '${v.type}',`);
|
|
146
|
+
if (v.autoUpdate === true) {
|
|
147
|
+
lines.push(` autoUpdate: ${v.autoUpdate},`);
|
|
148
|
+
}
|
|
149
|
+
if (v.onBeforeUpdate) {
|
|
150
|
+
if (v.operation === "read") {
|
|
151
|
+
lines.push(` onBeforeUpdate: (variable, dataFilter, options) => {\n return ${v.onBeforeUpdate}\n },`);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
lines.push(` onBeforeUpdate: (variable, inputData, options) => {\n return ${v.onBeforeUpdate}\n },`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
lines.push(` liveSource: '${v.liveSource}',`);
|
|
158
|
+
lines.push(` baseUrl: ${scope}.baseUrl,`);
|
|
159
|
+
lines.push(` orderBy: '${(_g = v.orderBy) !== null && _g !== void 0 ? _g : ""}',`);
|
|
160
|
+
lines.push(` propertiesMap: getEntityPropertyMap('${v.liveSource}', '${v.type}'),`);
|
|
161
|
+
lines.push(` relatedTables: getEntityRelatedTables('${v.liveSource}', '${v.type}'),`);
|
|
162
|
+
lines.push(` category: '${v.category}',`);
|
|
163
|
+
lines.push(` tableName: '${v.tableName}',`);
|
|
164
|
+
lines.push(` tableType: '${v.tableType}',`);
|
|
165
|
+
if (v._id) {
|
|
166
|
+
lines.push(` _id: '${v._id}',`);
|
|
167
|
+
}
|
|
168
|
+
if (v.filterExpressions !== undefined &&
|
|
169
|
+
v.filterExpressions !== null &&
|
|
170
|
+
v.filterExpressions !== "" &&
|
|
171
|
+
!(typeof v.filterExpressions === "object" && Object.keys(v.filterExpressions).length === 0)) {
|
|
172
|
+
lines.push(`filterExpressions: ${(0, serialize_variables_1.stringify)(v.filterExpressions)},`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// Common event handlers
|
|
176
|
+
if (v.onSuccess) {
|
|
177
|
+
lines.push(` onSuccess: (variable, data, options) => {\n ${v.onSuccess}\n },`);
|
|
178
|
+
}
|
|
179
|
+
if (v.onError) {
|
|
180
|
+
lines.push(` onError: (variable, data, options) => {\n ${v.onError}\n },`);
|
|
181
|
+
}
|
|
182
|
+
if (v.onCanUpdate) {
|
|
183
|
+
lines.push(` onCanUpdate: (variable, data, options) => {\n ${v.onCanUpdate}\n },`);
|
|
184
|
+
}
|
|
185
|
+
if (v.onResult) {
|
|
186
|
+
lines.push(` onResult: (variable, data, options) => {\n ${v.onResult}\n },`);
|
|
187
|
+
}
|
|
188
|
+
if (v.onBeforeDatasetReady) {
|
|
189
|
+
lines.push(` onBeforeDatasetReady: (variable, data, options) => {\n return ${v.onBeforeDatasetReady}\n },`);
|
|
190
|
+
}
|
|
191
|
+
if (v.onOnline) {
|
|
192
|
+
lines.push(` onOnline: (variable, data, options) => {\n return ${v.onOnline}\n },`);
|
|
193
|
+
}
|
|
194
|
+
if (v.onOffline) {
|
|
195
|
+
lines.push(` onOffline: (variable, data, options) => {\n return ${v.onOffline}\n },`);
|
|
196
|
+
}
|
|
197
|
+
if (v.inFlightBehavior !== undefined &&
|
|
198
|
+
v.inFlightBehavior !== null &&
|
|
199
|
+
v.inFlightBehavior !== "") {
|
|
200
|
+
lines.push(` inFlightBehavior: ${(0, serialize_variables_1.stringify)(v.inFlightBehavior)},`);
|
|
201
|
+
}
|
|
202
|
+
if (v.isList === true) {
|
|
203
|
+
lines.push(` isList: ${v.isList},`);
|
|
204
|
+
}
|
|
205
|
+
if (v.twoWayBinding === true) {
|
|
206
|
+
lines.push(` twoWayBinding: ${v.twoWayBinding},`);
|
|
207
|
+
}
|
|
208
|
+
if (v.spinnerContext) {
|
|
209
|
+
lines.push(` spinnerContext: '${v.spinnerContext}',`);
|
|
210
|
+
}
|
|
211
|
+
if (v.spinnerMessage) {
|
|
212
|
+
lines.push(` spinnerMessage: '${v.spinnerMessage}',`);
|
|
213
|
+
}
|
|
214
|
+
lines.push(`}),`);
|
|
215
|
+
return lines.join("\n");
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Serializes transpiled variable definitions into a TypeScript code string.
|
|
219
|
+
* This is the pure-JS equivalent of compileVariablesTemplate — no Handlebars required.
|
|
220
|
+
*/
|
|
221
|
+
function serializeVariablesToCode(result, scope, options = {}) {
|
|
222
|
+
const { isPrefabApp = false, isPrefabScope = false, prefabName, addEntityProvider = true, } = options;
|
|
223
|
+
const importLines = [
|
|
224
|
+
`import React from 'react';`,
|
|
225
|
+
`import { ModelVariable } from '@wavemaker-ai/react-runtime/variables/model-variable';`,
|
|
226
|
+
`import { ServiceVariable } from '@wavemaker-ai/react-runtime/variables/service-variable';`,
|
|
227
|
+
`import { NavigationAction } from '@wavemaker-ai/react-runtime/actions/navigation-action';`,
|
|
228
|
+
`import {TimerAction} from '@wavemaker-ai/react-runtime/actions/timer-action'`,
|
|
229
|
+
`import {NotificationAction} from '@wavemaker-ai/react-runtime/actions/notification-action'`,
|
|
230
|
+
`import { LoginAction } from '@wavemaker-ai/react-runtime/actions/login-action';`,
|
|
231
|
+
`import { LogoutAction } from '@wavemaker-ai/react-runtime/actions/logout-action';`,
|
|
232
|
+
`import LiveVariable from '@wavemaker-ai/react-runtime/variables/live-variable';`,
|
|
233
|
+
`import CrudVariable from "@wavemaker-ai/react-runtime/variables/crud-variable"`,
|
|
234
|
+
];
|
|
235
|
+
if (addEntityProvider) {
|
|
236
|
+
importLines.push(`import { getEntityPropertyMap, getEntityRelatedTables } from '@/libs/metadata/entities/entity-provider';`);
|
|
237
|
+
}
|
|
238
|
+
for (const imp of result.imports) {
|
|
239
|
+
importLines.push(`${imp};`);
|
|
240
|
+
}
|
|
241
|
+
const serializeGroup = (items) => {
|
|
242
|
+
if (items.length === 0)
|
|
243
|
+
return "";
|
|
244
|
+
return items
|
|
245
|
+
.map(v => serializeVariableEntry(v, scope, isPrefabApp, isPrefabScope, prefabName))
|
|
246
|
+
.join("\n");
|
|
247
|
+
};
|
|
248
|
+
const variablesBlock = serializeGroup(result.variables);
|
|
249
|
+
const actionsBlock = serializeGroup(result.actions);
|
|
250
|
+
return `${importLines.join("\n")}
|
|
251
|
+
|
|
252
|
+
export default (${scope}:any) => {
|
|
253
|
+
return {
|
|
254
|
+
Variables: {
|
|
255
|
+
${variablesBlock}
|
|
256
|
+
},
|
|
257
|
+
Actions: {
|
|
258
|
+
${actionsBlock}
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Transforms markup and variable JSON into a TranspiledOutput.
|
|
266
|
+
* Pure functional — no Handlebars dependency.
|
|
267
|
+
*/
|
|
268
|
+
function transformMarkup(markup, options = { appUrl: "", prefabName: "", isPartOfPrefab: false }) {
|
|
269
|
+
const { isPartOfPrefab = false, variables, appUrl, prefabName } = options;
|
|
270
|
+
const transpiledOutput = (0, transpile_1.transpileMarkup)(markup, isPartOfPrefab, undefined, variables, true);
|
|
271
|
+
const transpiledVars = (0, transpile_variables_1.transpileVariableDefinitions)(variables, appUrl, "Page");
|
|
272
|
+
const variablesCode = serializeVariablesToCode(transpiledVars, "Page", {
|
|
273
|
+
isPrefabApp: isPartOfPrefab,
|
|
274
|
+
isPrefabScope: false,
|
|
275
|
+
prefabName,
|
|
276
|
+
addEntityProvider: !isPartOfPrefab,
|
|
277
|
+
});
|
|
278
|
+
return {
|
|
279
|
+
...transpiledOutput,
|
|
280
|
+
variables: variablesCode,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=transform-markup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-markup.js","sourceRoot":"","sources":["../../../src/transpile/transform-markup.ts"],"names":[],"mappings":";;AAkQA,4DA+DC;AAMD,0CAoBC;AA3VD,2CAAgE;AAChE,+DAAoG;AACpG,+DAK+B;AAY/B;;;GAGG;AACH,SAAS,sBAAsB,CAC7B,CAAM,EACN,KAAa,EACb,WAAoB,EACpB,aAAsB,EACtB,UAAmB;;IAEnB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,IAAA,sCAAgB,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAErC,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC,SAAS,YAAY,CAAC,CAAC;IACpD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,GAAG,CAAC,CAAC;IAEpC,IAAI,CAAC,CAAC,WAAW;QAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,WAAW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,cAAc;;;QAGd,YAAY;;;;CAInB,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAC7B,MAAc,EACd,UAAkC,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE;IAEvF,MAAM,EAAE,cAAc,GAAG,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE1E,MAAM,gBAAgB,GAAG,IAAA,2BAAe,EAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7F,MAAM,cAAc,GAAG,IAAA,kDAA4B,EAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/E,MAAM,aAAa,GAAG,wBAAwB,CAAC,cAAc,EAAE,MAAM,EAAE;QACrE,WAAW,EAAE,cAAc;QAC3B,aAAa,EAAE,KAAK;QACpB,UAAU;QACV,iBAAiB,EAAE,CAAC,cAAc;KACnC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,gBAAgB;QACnB,SAAS,EAAE,aAAa;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transpileVariableDefinitions = transpileVariableDefinitions;
|
|
7
|
+
const transform_register_1 = __importDefault(require("./components/transform-register"));
|
|
8
|
+
const variable_transformer_1 = __importDefault(require("../variables/variable.transformer"));
|
|
9
|
+
let registered = false;
|
|
10
|
+
function ensureRegistered() {
|
|
11
|
+
if (!registered) {
|
|
12
|
+
(0, transform_register_1.default)();
|
|
13
|
+
registered = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Transforms raw variable JSON definitions into transpiled variable config objects.
|
|
18
|
+
* Pure functional — no Handlebars, no file generation.
|
|
19
|
+
*
|
|
20
|
+
* Use this in the dynamic runtime to get the same bind:/paramProvider/event handling
|
|
21
|
+
* as the codegen without pulling in the Handlebars template engine.
|
|
22
|
+
*/
|
|
23
|
+
function transpileVariableDefinitions(variables, appUrl, scope) {
|
|
24
|
+
ensureRegistered();
|
|
25
|
+
const imports = [];
|
|
26
|
+
const transformed = Object.values(variables !== null && variables !== void 0 ? variables : {})
|
|
27
|
+
.map((v) => (0, variable_transformer_1.default)(v, scope, appUrl, imports))
|
|
28
|
+
.filter(v => !!v);
|
|
29
|
+
return {
|
|
30
|
+
variables: transformed.filter(v => v.group === "variable"),
|
|
31
|
+
actions: transformed.filter(v => v.group === "action"),
|
|
32
|
+
imports,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=transpile-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transpile-variables.js","sourceRoot":"","sources":["../../../src/transpile/transpile-variables.ts"],"names":[],"mappings":";;;;;AAyBA,oEAgBC;AAzCD,yFAAmE;AACnE,6FAAkE;AAElE,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,SAAS,gBAAgB;IACvB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,IAAA,4BAAoB,GAAE,CAAC;QACvB,UAAU,GAAG,IAAI,CAAC;IACpB,CAAC;AACH,CAAC;AAQD;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAC1C,SAA0C,EAC1C,MAAc,EACd,KAAa;IAEb,gBAAgB,EAAE,CAAC;IACnB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;SAC/C,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,IAAA,8BAAiB,EAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;SAC7D,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpB,OAAO;QACL,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC;QAC1D,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC;QACtD,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -36,14 +36,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.createExpression = exports.transformDollarBracketSyntax = exports.decodeHTMLEntities = exports.transpileElement = exports.processTextContentForJSX = exports.addFragmentOptionalChaining = exports.createComponent = exports.preTranspile = exports.transformAttrs = exports.transpileMarkup = exports.registerTransformer = exports.TranspilationContext = exports.generateRandomString = void 0;
|
|
39
|
+
exports.createExpression = exports.transformDollarBracketSyntax = exports.decodeHTMLEntities = exports.transpileElement = exports.processTextContentForJSX = exports.addFragmentOptionalChaining = exports.createComponent = exports.preTranspile = exports.transformAttrs = exports.transpileMarkup = exports.registerTransformer = exports.TranspilationContext = exports.HTMLElementClass = exports.isHTMLElement = exports.NodeType = exports.parse = exports.generateRandomString = void 0;
|
|
40
40
|
const lodash_1 = require("lodash");
|
|
41
|
-
const node_html_parser_1 = require("node-html-parser");
|
|
41
|
+
const node_html_parser_1 = __importStar(require("node-html-parser"));
|
|
42
42
|
const fomatter_1 = require("../fomatter");
|
|
43
43
|
const bind_ex_transformer_1 = __importStar(require("./bind.ex.transformer"));
|
|
44
44
|
const style_transformer_1 = __importDefault(require("./style.transformer"));
|
|
45
45
|
const property_parser_1 = require("./property/property-parser");
|
|
46
|
-
const
|
|
46
|
+
const utils_browser_1 = require("../utils.browser");
|
|
47
47
|
const id_generator_1 = require("./id-generator");
|
|
48
48
|
const widget_inline_style_processor_1 = require("./widget-inline-style-processor");
|
|
49
49
|
const generateRandomString = (length = 10) => Math.random().toString(20).substr(2, length);
|
|
@@ -83,6 +83,32 @@ const processTextContentForJSX = (textContent) => {
|
|
|
83
83
|
return textContent;
|
|
84
84
|
};
|
|
85
85
|
exports.processTextContentForJSX = processTextContentForJSX;
|
|
86
|
+
// node-html-parser ESM wrapper bug: when bundlers use default interop, named exports (parse, NodeType, HTMLElement) are undefined
|
|
87
|
+
exports.parse = typeof node_html_parser_1.default === "function"
|
|
88
|
+
? node_html_parser_1.default
|
|
89
|
+
: node_html_parser_1.default.parse;
|
|
90
|
+
// Use standard DOM node type constants (1, 3) - NodeType named export breaks under Turbopack/Next bundling
|
|
91
|
+
exports.NodeType = {
|
|
92
|
+
ELEMENT_NODE: 1,
|
|
93
|
+
TEXT_NODE: 3,
|
|
94
|
+
};
|
|
95
|
+
/** Prefer over `instanceof HTMLElement` when the constructor may not match (e.g. bundlers). */
|
|
96
|
+
const isHTMLElement = (node) => node != null && node.nodeType === exports.NodeType.ELEMENT_NODE;
|
|
97
|
+
exports.isHTMLElement = isHTMLElement;
|
|
98
|
+
// HTMLElement constructor - fallback for when named export is undefined (Turbopack/Next bundling)
|
|
99
|
+
function getHTMLElementClass() {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
const fromModule = (_a = node_html_parser_1.default.HTMLElement) !== null && _a !== void 0 ? _a : node_html_parser_1.HTMLElement;
|
|
102
|
+
if (fromModule)
|
|
103
|
+
return fromModule;
|
|
104
|
+
// Fallback: get from parsed node (parse creates HTMLElement instances)
|
|
105
|
+
const parsed = (0, exports.parse)("<div></div>");
|
|
106
|
+
const firstEl = (_b = parsed.childNodes) === null || _b === void 0 ? void 0 : _b.find((c) => (c === null || c === void 0 ? void 0 : c.nodeType) === 1);
|
|
107
|
+
return ((_c = firstEl === null || firstEl === void 0 ? void 0 : firstEl.constructor) !== null && _c !== void 0 ? _c : (() => {
|
|
108
|
+
throw new Error("node-html-parser HTMLElement not available");
|
|
109
|
+
})());
|
|
110
|
+
}
|
|
111
|
+
exports.HTMLElementClass = getHTMLElementClass();
|
|
86
112
|
// Input widgets that should inherit required/floating-label behavior from wm-composite
|
|
87
113
|
const COMPOSITE_INPUT_TAGS = new Set([
|
|
88
114
|
"wm-text",
|
|
@@ -117,7 +143,7 @@ const addFragmentOptionalChaining = (expression, addFallback = false) => {
|
|
|
117
143
|
detectFunctionCalls: true,
|
|
118
144
|
...(addFallback && { fallbackValue: '""' }),
|
|
119
145
|
};
|
|
120
|
-
return (0,
|
|
146
|
+
return (0, utils_browser_1.addOptionalChaining)(expression);
|
|
121
147
|
};
|
|
122
148
|
exports.addFragmentOptionalChaining = addFragmentOptionalChaining;
|
|
123
149
|
class TranspilationContext {
|
|
@@ -143,7 +169,7 @@ class Transpiler {
|
|
|
143
169
|
this.componentNamesList = [];
|
|
144
170
|
this.transpile = (e, isPartOfPrefab, splitCode = true, oldContext) => {
|
|
145
171
|
var _a;
|
|
146
|
-
const isHtmlElement =
|
|
172
|
+
const isHtmlElement = utils_browser_1.htmlElements.includes(e.tagName.toLowerCase());
|
|
147
173
|
const ignoreElements = ["wm-filter-action", "wm-form-action"];
|
|
148
174
|
const transformer = this.transformers.get(e && e.tagName.toLowerCase());
|
|
149
175
|
let result = {
|
|
@@ -168,7 +194,7 @@ class Transpiler {
|
|
|
168
194
|
if (isHtmlElement) {
|
|
169
195
|
result.markup = preTranspileHtmlElement(e);
|
|
170
196
|
e.childNodes.forEach(c => {
|
|
171
|
-
if (c && c.nodeType ==
|
|
197
|
+
if (c && c.nodeType == exports.NodeType.ELEMENT_NODE) {
|
|
172
198
|
const cResult = this.transpile(c, isPartOfPrefab, splitCode);
|
|
173
199
|
(0, lodash_1.assignIn)(result.components, cResult.components);
|
|
174
200
|
result.markup += cResult.markup;
|
|
@@ -179,7 +205,7 @@ class Transpiler {
|
|
|
179
205
|
if (cResult.pageEvents)
|
|
180
206
|
result.pageEvents = cResult.pageEvents;
|
|
181
207
|
}
|
|
182
|
-
else if (c && c.nodeType ==
|
|
208
|
+
else if (c && c.nodeType == exports.NodeType.TEXT_NODE) {
|
|
183
209
|
// Preserve text nodes
|
|
184
210
|
const processedContent = processTextContentForJSX(c.text);
|
|
185
211
|
if (processedContent) {
|
|
@@ -203,7 +229,7 @@ class Transpiler {
|
|
|
203
229
|
transformer.pre(e, context).replace(new RegExp(bind_ex_transformer_1.FORMAT_CONTEXT, "g"), "") +
|
|
204
230
|
(e.childNodes.length > 0 ? "\n" : "");
|
|
205
231
|
e.childNodes.forEach(c => {
|
|
206
|
-
if (c && c.nodeType ==
|
|
232
|
+
if (c && c.nodeType == exports.NodeType.ELEMENT_NODE) {
|
|
207
233
|
const cResult = this.transpile(c, isPartOfPrefab, splitCode, context);
|
|
208
234
|
(0, lodash_1.assignIn)(result.components, cResult.components);
|
|
209
235
|
result.markup += cResult.markup;
|
|
@@ -215,7 +241,7 @@ class Transpiler {
|
|
|
215
241
|
if (cResult.pageEvents)
|
|
216
242
|
result.pageEvents = cResult.pageEvents;
|
|
217
243
|
}
|
|
218
|
-
else if (c && c.nodeType ==
|
|
244
|
+
else if (c && c.nodeType == exports.NodeType.TEXT_NODE) {
|
|
219
245
|
// Handle text nodes for custom elements
|
|
220
246
|
const processedContent = processTextContentForJSX(c.text);
|
|
221
247
|
if (processedContent) {
|
|
@@ -315,13 +341,13 @@ class Transpiler {
|
|
|
315
341
|
transformedInner = transformedInner
|
|
316
342
|
.replace(/fragment\?\.item\b/g, "item")
|
|
317
343
|
.replace(/fragment\.item\b/g, "item");
|
|
318
|
-
const transformedBase = (0,
|
|
344
|
+
const transformedBase = (0, utils_browser_1.addOptionalChaining)(`fragment.${basePath}`);
|
|
319
345
|
const mapExpression = `${transformedBase}?.map((item) => ${transformedInner})`;
|
|
320
346
|
return `mapfn:() => ${mapExpression}`;
|
|
321
347
|
}
|
|
322
348
|
// Simple path case: use nested map logic
|
|
323
349
|
const basePath = segments[0];
|
|
324
|
-
const transformedBase = (0,
|
|
350
|
+
const transformedBase = (0, utils_browser_1.addOptionalChaining)(`fragment.${basePath}`);
|
|
325
351
|
const buildNestedMap = (segmentIndex, itemVar) => {
|
|
326
352
|
const segment = segments[segmentIndex];
|
|
327
353
|
let cleanSegment = segment.startsWith(".") ? segment.substring(1) : segment;
|
|
@@ -329,7 +355,7 @@ class Transpiler {
|
|
|
329
355
|
const isLastSegment = segmentIndex === segments.length - 1;
|
|
330
356
|
if (isLastSegment) {
|
|
331
357
|
if (cleanSegment) {
|
|
332
|
-
return (0,
|
|
358
|
+
return (0, utils_browser_1.addOptionalChaining)(`${itemVar}.${cleanSegment}`);
|
|
333
359
|
}
|
|
334
360
|
return itemVar;
|
|
335
361
|
}
|
|
@@ -337,7 +363,7 @@ class Transpiler {
|
|
|
337
363
|
const nextItemVar = segmentIndex === 1 ? "child" : `item${segmentIndex}`;
|
|
338
364
|
const nextExpression = buildNestedMap(segmentIndex + 1, nextItemVar);
|
|
339
365
|
if (cleanSegment) {
|
|
340
|
-
const propertyAccess = (0,
|
|
366
|
+
const propertyAccess = (0, utils_browser_1.addOptionalChaining)(`${itemVar}.${cleanSegment}`);
|
|
341
367
|
return `${propertyAccess}?.map(${nextItemVar} => ${nextExpression})`;
|
|
342
368
|
}
|
|
343
369
|
return `${itemVar}?.map(${nextItemVar} => ${nextExpression})`;
|
|
@@ -347,6 +373,9 @@ class Transpiler {
|
|
|
347
373
|
return `mapfn:() => ${mapExpression}`;
|
|
348
374
|
}
|
|
349
375
|
preTranspile(e) {
|
|
376
|
+
// remove variant attribute from element
|
|
377
|
+
// because it's not required in JSX
|
|
378
|
+
e === null || e === void 0 ? void 0 : e.removeAttribute("variant");
|
|
350
379
|
Object.keys(e.attributes).forEach(name => {
|
|
351
380
|
let value = e.attributes[name];
|
|
352
381
|
if (value.startsWith("bind:")) {
|
|
@@ -419,7 +448,7 @@ class Transpiler {
|
|
|
419
448
|
}
|
|
420
449
|
});
|
|
421
450
|
e.childNodes.forEach(c => {
|
|
422
|
-
if (
|
|
451
|
+
if ((0, exports.isHTMLElement)(c)) {
|
|
423
452
|
this.preTranspile(c);
|
|
424
453
|
}
|
|
425
454
|
});
|
|
@@ -481,7 +510,7 @@ class Transpiler {
|
|
|
481
510
|
if ((0, lodash_1.isString)(styleProp) && styleProp.startsWith("bind:")) {
|
|
482
511
|
isStatic = false;
|
|
483
512
|
const bindExpr = styleProp.substring(5);
|
|
484
|
-
styleObj[i] = `{___${(0,
|
|
513
|
+
styleObj[i] = `{___${(0, utils_browser_1.addOptionalChaining)(bindExpr)}___}`;
|
|
485
514
|
}
|
|
486
515
|
});
|
|
487
516
|
if (styles.background) {
|
|
@@ -511,7 +540,7 @@ class Transpiler {
|
|
|
511
540
|
if (!condition) {
|
|
512
541
|
return `'${className.trim()}'`;
|
|
513
542
|
}
|
|
514
|
-
return `(${(0,
|
|
543
|
+
return `(${(0, utils_browser_1.addOptionalChaining)(condition.trim())} ? ${className.replace(/'$/, " '")} : '')`;
|
|
515
544
|
});
|
|
516
545
|
conditionalClasses = expressions.join("+");
|
|
517
546
|
}
|
|
@@ -522,7 +551,7 @@ class Transpiler {
|
|
|
522
551
|
conditionalClasses = `${conditionalClasses}`;
|
|
523
552
|
}
|
|
524
553
|
else {
|
|
525
|
-
conditionalClasses = (0,
|
|
554
|
+
conditionalClasses = (0, utils_browser_1.addOptionalChaining)(conditionalClasses);
|
|
526
555
|
}
|
|
527
556
|
if (classes === null || classes === void 0 ? void 0 : classes.startsWith("{")) {
|
|
528
557
|
classes = classes.substring(0, classes.length - 1);
|
|
@@ -544,7 +573,7 @@ class Transpiler {
|
|
|
544
573
|
e.removeAttribute("style");
|
|
545
574
|
return {
|
|
546
575
|
styles: styles,
|
|
547
|
-
className: (0,
|
|
576
|
+
className: (0, utils_browser_1.addOptionalChaining)(classes),
|
|
548
577
|
};
|
|
549
578
|
}
|
|
550
579
|
findArgs(str, context) {
|
|
@@ -559,10 +588,10 @@ class Transpiler {
|
|
|
559
588
|
}
|
|
560
589
|
});
|
|
561
590
|
argStr = argStr.replace(/\(|\)/g, "");
|
|
562
|
-
if (
|
|
591
|
+
if (context === null || context === void 0 ? void 0 : context.get("isInsideList")) {
|
|
563
592
|
argStr = argStr
|
|
564
593
|
.split(",")
|
|
565
|
-
//
|
|
594
|
+
// List row context: omit loop-scoped proxies from synthesized handler params (`$item` from outer closure)
|
|
566
595
|
.filter(s => !(0, lodash_1.includes)(["$item", "currentItemWidgets"], s.trim()))
|
|
567
596
|
.join(",");
|
|
568
597
|
}
|
|
@@ -688,6 +717,11 @@ class Transpiler {
|
|
|
688
717
|
.filter(s => !isPropertyAccess(s))
|
|
689
718
|
.filter(s => !isObjectLiteral(s))
|
|
690
719
|
.filter(s => !isArrayLiteral(s));
|
|
720
|
+
const usesBareEvent = /\$event\b/.test(str);
|
|
721
|
+
const hasEventParam = args.some(a => a.trim() === "$event");
|
|
722
|
+
if (usesBareEvent && !hasEventParam) {
|
|
723
|
+
return args.length > 0 ? `(${args.join(", ")}, $event)` : `($event)`;
|
|
724
|
+
}
|
|
691
725
|
return `(${args.join(", ")})`;
|
|
692
726
|
}
|
|
693
727
|
quoteAttr(v) {
|
|
@@ -723,6 +757,12 @@ class Transpiler {
|
|
|
723
757
|
value = value.replace(/item,/g, "$item,");
|
|
724
758
|
value = value.replace(/item\./g, "$item.");
|
|
725
759
|
value = value.replace(/item\)/g, "$item)");
|
|
760
|
+
// List preprocessors strip `?.` via removeOptionChaining before dataset replace — restore
|
|
761
|
+
// fragment/Variables optional chaining for the emitted handler body.
|
|
762
|
+
if (context === null || context === void 0 ? void 0 : context.get("isInsideList")) {
|
|
763
|
+
value = value.replace(/;+\s*$/, "").trim();
|
|
764
|
+
value = addFragmentOptionalChaining(value, false);
|
|
765
|
+
}
|
|
726
766
|
const args = this.findArgs(value, context);
|
|
727
767
|
if (context === null || context === void 0 ? void 0 : context.get("isInsideTableColumn")) {
|
|
728
768
|
value = value.replace(/\brow\b/g, "rowData");
|
|
@@ -744,7 +784,7 @@ class Transpiler {
|
|
|
744
784
|
let exp = `${value.substring(5)}`;
|
|
745
785
|
exp = exp.replace("fragment.Page", "fragment");
|
|
746
786
|
const isProgressCircleDatavalue = tagName === "wm-progress-circle" && name === "datavalue";
|
|
747
|
-
exp = (0,
|
|
787
|
+
exp = (0, utils_browser_1.modifyExpression)(exp);
|
|
748
788
|
exp = this.convertStringBooleanTernary(exp);
|
|
749
789
|
// If expression is empty after transformation, use empty string instead of empty braces
|
|
750
790
|
if (!exp) {
|
|
@@ -852,8 +892,8 @@ class Transpiler {
|
|
|
852
892
|
}
|
|
853
893
|
const transpiler = new Transpiler();
|
|
854
894
|
exports.registerTransformer = transpiler.registerTransformer.bind(transpiler);
|
|
855
|
-
const transpileMarkup = (markup, isPartOfPrefab, splitCode, variables) => {
|
|
856
|
-
const parsed = (0,
|
|
895
|
+
const transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview) => {
|
|
896
|
+
const parsed = (0, exports.parse)(markup, {
|
|
857
897
|
blockTextElements: {},
|
|
858
898
|
});
|
|
859
899
|
let finalResult = {
|
|
@@ -886,17 +926,18 @@ const transpileMarkup = (markup, isPartOfPrefab, splitCode, variables) => {
|
|
|
886
926
|
data: {
|
|
887
927
|
twoWayBindingVariables: twoWayBindingVariables,
|
|
888
928
|
autolayoutCodegen,
|
|
929
|
+
preview: preview === true,
|
|
889
930
|
},
|
|
890
931
|
});
|
|
891
932
|
// Process all child nodes (including text nodes that come before the main element)
|
|
892
933
|
parsed.childNodes.forEach((node) => {
|
|
893
|
-
if (node.nodeType ===
|
|
934
|
+
if (node.nodeType === exports.NodeType.TEXT_NODE) {
|
|
894
935
|
const textContent = node.text;
|
|
895
936
|
if (textContent.trim()) {
|
|
896
937
|
finalResult.markup += `{"${textContent.trim()}"} \n`;
|
|
897
938
|
}
|
|
898
939
|
}
|
|
899
|
-
else if (node.nodeType ===
|
|
940
|
+
else if (node.nodeType === exports.NodeType.ELEMENT_NODE) {
|
|
900
941
|
transpiler.preTranspile(node);
|
|
901
942
|
const result = transpiler.transpile(node, isPartOfPrefab, splitCode, initialContext);
|
|
902
943
|
finalResult.markup += result.markup;
|
|
@@ -988,7 +1029,7 @@ const createExpression = (element, attrName) => {
|
|
|
988
1029
|
}
|
|
989
1030
|
return `{($item) => (${exp})}`;
|
|
990
1031
|
}
|
|
991
|
-
if ((0,
|
|
1032
|
+
if ((0, utils_browser_1.isJSExpression)(displayexpression)) {
|
|
992
1033
|
const transformedExp = (0, bind_ex_transformer_1.default)(displayexpression, "$item");
|
|
993
1034
|
return `{($item) => (${transformedExp})}`;
|
|
994
1035
|
}
|