@wavemaker-ai/react-codegen 1.0.0-rc.317 → 1.0.0-rc.319
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/dist/transpiler/index.mjs +113 -17
- package/dist/transpiler/index.mjs.map +1 -1
- package/package-lock.json +88 -87
- package/package.json +1 -1
- package/src/app.generator.js +3 -1
- package/src/app.generator.js.map +1 -1
- package/src/transpile/class-expression.util.js +44 -0
- package/src/transpile/class-expression.util.js.map +1 -0
- package/src/transpile/components/data/form/form-field.transformer.js +1 -1
- package/src/transpile/components/data/live-filter-field.transformer.js +2 -2
- package/src/transpile/property/property-parser.js +6 -8
- package/src/transpile/property/property-parser.js.map +1 -1
- package/src/transpile/transpile.js +83 -3
- package/src/transpile/transpile.js.map +1 -1
- package/src/transpile/widget-inline-style-processor.js +10 -3
- package/src/transpile/widget-inline-style-processor.js.map +1 -1
- package/src/utils/grouping-util.js +2 -2
- package/src/utils/grouping-util.js.map +1 -1
- package/templates/project/package.json +4 -4
|
@@ -40827,7 +40827,6 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
|
|
|
40827
40827
|
["modal", BOOLEAN_PARSER],
|
|
40828
40828
|
["multiple", BOOLEAN_PARSER],
|
|
40829
40829
|
["trailingzero", BOOLEAN_PARSER],
|
|
40830
|
-
["multilineskeleton", BOOLEAN_PARSER],
|
|
40831
40830
|
["muted", BOOLEAN_PARSER],
|
|
40832
40831
|
["pagesize", NUMERIC_PARSER],
|
|
40833
40832
|
["primaryKey", BOOLEAN_PARSER],
|
|
@@ -40841,7 +40840,7 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
|
|
|
40841
40840
|
["scrollable", BOOLEAN_PARSER],
|
|
40842
40841
|
["show", BOOLEAN_PARSER],
|
|
40843
40842
|
["showindevice", SHOW_IN_DEVICE_PARSER],
|
|
40844
|
-
["
|
|
40843
|
+
["showSkeleton", BOOLEAN_PARSER],
|
|
40845
40844
|
["showclear", BOOLEAN_PARSER],
|
|
40846
40845
|
["searchbutton", BOOLEAN_PARSER],
|
|
40847
40846
|
["selectionlimit", NUMERIC_PARSER],
|
|
@@ -40862,8 +40861,6 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
|
|
|
40862
40861
|
["showvalues", BOOLEAN_PARSER],
|
|
40863
40862
|
["showyaxis", BOOLEAN_PARSER],
|
|
40864
40863
|
["showxaxis", BOOLEAN_PARSER],
|
|
40865
|
-
["skeletonwidth", NUMERIC_PARSER],
|
|
40866
|
-
["skeletonheight", NUMERIC_PARSER],
|
|
40867
40864
|
["wrap", BOOLEAN_PARSER],
|
|
40868
40865
|
["thickness", NUMERIC_PARSER],
|
|
40869
40866
|
["iconheight", UNIT_PARSER],
|
|
@@ -40881,11 +40878,7 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
|
|
|
40881
40878
|
["shownext", BOOLEAN_PARSER],
|
|
40882
40879
|
["showdone", BOOLEAN_PARSER],
|
|
40883
40880
|
["nooflines", NUMERIC_PARSER],
|
|
40884
|
-
["showskeletonchildren", BOOLEAN_PARSER],
|
|
40885
|
-
["numberofskeletonitems", NUMERIC_PARSER],
|
|
40886
40881
|
["radiosetscroll", BOOLEAN_PARSER],
|
|
40887
|
-
["skeletonanimationresource", STRING_PARSER],
|
|
40888
|
-
["skeletonanimationspeed", NUMERIC_PARSER],
|
|
40889
40882
|
["enablegestures", BOOLEAN_PARSER],
|
|
40890
40883
|
["dateheadertitle", STRING_PARSER],
|
|
40891
40884
|
["dateconfirmationtitle", STRING_PARSER],
|
|
@@ -40945,9 +40938,14 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
|
|
|
40945
40938
|
["exportdatasize", NUMERIC_PARSER],
|
|
40946
40939
|
["filteronkeypress", BOOLEAN_PARSER],
|
|
40947
40940
|
["showviewlessbutton", BOOLEAN_PARSER],
|
|
40948
|
-
["isrowselectable", BOOLEAN_PARSER]
|
|
40941
|
+
["isrowselectable", BOOLEAN_PARSER],
|
|
40942
|
+
["skeletonRows", NUMERIC_PARSER],
|
|
40943
|
+
["skeletonColumns", NUMERIC_PARSER]
|
|
40949
40944
|
])
|
|
40950
40945
|
],
|
|
40946
|
+
["wm-tabs", /* @__PURE__ */ new Map([["skeletonRows", NUMERIC_PARSER]])],
|
|
40947
|
+
["wm-wizard", /* @__PURE__ */ new Map([["skeletonRows", NUMERIC_PARSER]])],
|
|
40948
|
+
["wm-accordion", /* @__PURE__ */ new Map([["skeletonRows", NUMERIC_PARSER]])],
|
|
40951
40949
|
[
|
|
40952
40950
|
"wm-table-column",
|
|
40953
40951
|
/* @__PURE__ */ new Map([
|
|
@@ -41677,13 +41675,18 @@ var AutolayoutCodegen = class {
|
|
|
41677
41675
|
if (m) innerPath = m[2].trim();
|
|
41678
41676
|
}
|
|
41679
41677
|
if (!innerPath.startsWith("/") && !innerPath.startsWith("http://") && !innerPath.startsWith("https://") && !innerPath.startsWith("data:")) {
|
|
41680
|
-
|
|
41678
|
+
const noLeadingSlash = innerPath.startsWith("/") ? innerPath.slice(1) : innerPath;
|
|
41679
|
+
if (noLeadingSlash.toLowerCase().startsWith("resources/")) {
|
|
41680
|
+
innerPath = noLeadingSlash;
|
|
41681
|
+
} else if (!innerPath.startsWith("/")) {
|
|
41682
|
+
innerPath = `/${innerPath}`;
|
|
41683
|
+
}
|
|
41681
41684
|
}
|
|
41682
41685
|
return `url(${innerPath})`;
|
|
41683
41686
|
}
|
|
41684
41687
|
// Converts static style attributes to CSS utility classes and removes them from element
|
|
41685
41688
|
processStaticStyleProps(element) {
|
|
41686
|
-
var _a;
|
|
41689
|
+
var _a, _b;
|
|
41687
41690
|
const classNames = [];
|
|
41688
41691
|
const bgImageRaw = element.getAttribute("backgroundimage");
|
|
41689
41692
|
if (bgImageRaw && !isBind(bgImageRaw)) {
|
|
@@ -41700,7 +41703,7 @@ var AutolayoutCodegen = class {
|
|
|
41700
41703
|
for (const dimKey of ["width", "height"]) {
|
|
41701
41704
|
const raw = element.getAttribute(dimKey);
|
|
41702
41705
|
if (!raw || isBind(raw)) continue;
|
|
41703
|
-
if (!this.getEffectiveParentDirection(element) && ((_a = element.tagName) == null ? void 0 : _a.toLowerCase()) === "wm-container") {
|
|
41706
|
+
if (!this.getEffectiveParentDirection(element) && (((_a = element.tagName) == null ? void 0 : _a.toLowerCase()) === "wm-container" || ((_b = element.tagName) == null ? void 0 : _b.toLowerCase()) === "wm-list")) {
|
|
41704
41707
|
element.setAttribute(dimKey === "width" ? "layoutWidth" : "layoutHeight", raw);
|
|
41705
41708
|
}
|
|
41706
41709
|
this.collectSizeFlexProps(element, dimKey, raw, flexProps);
|
|
@@ -41958,8 +41961,62 @@ function getFormatCellExpression(element, context) {
|
|
|
41958
41961
|
return transformed;
|
|
41959
41962
|
}
|
|
41960
41963
|
|
|
41964
|
+
// src/transpile/class-expression.util.ts
|
|
41965
|
+
function transformClassWithMustacheExpressions(classes, options = {}) {
|
|
41966
|
+
if (!classes || !classes.includes("{{") || !classes.includes("}}")) {
|
|
41967
|
+
return null;
|
|
41968
|
+
}
|
|
41969
|
+
const parts = [];
|
|
41970
|
+
const regex = /\{\{([\s\S]*?)\}\}/g;
|
|
41971
|
+
let lastIndex = 0;
|
|
41972
|
+
let match;
|
|
41973
|
+
while ((match = regex.exec(classes)) !== null) {
|
|
41974
|
+
const staticBefore = classes.substring(lastIndex, match.index).trim();
|
|
41975
|
+
if (staticBefore) {
|
|
41976
|
+
parts.push(`'${staticBefore}'`);
|
|
41977
|
+
}
|
|
41978
|
+
let expr = match[1].trim();
|
|
41979
|
+
if (options.isInsideTableColumn) {
|
|
41980
|
+
expr = transformTableColumnClassExpression(expr);
|
|
41981
|
+
} else {
|
|
41982
|
+
expr = modifyExpression(expr);
|
|
41983
|
+
}
|
|
41984
|
+
if (expr) {
|
|
41985
|
+
parts.push(`(${expr})`);
|
|
41986
|
+
}
|
|
41987
|
+
lastIndex = match.index + match[0].length;
|
|
41988
|
+
}
|
|
41989
|
+
const staticAfter = classes.substring(lastIndex).trim();
|
|
41990
|
+
if (staticAfter) {
|
|
41991
|
+
parts.push(`'${staticAfter}'`);
|
|
41992
|
+
}
|
|
41993
|
+
if (parts.length === 0) {
|
|
41994
|
+
return null;
|
|
41995
|
+
}
|
|
41996
|
+
return `{${parts.join(" + ' ' + ")}}`;
|
|
41997
|
+
}
|
|
41998
|
+
|
|
41961
41999
|
// src/transpile/transpile.ts
|
|
41962
42000
|
var generateRandomString = (length = 10) => Math.random().toString(20).substr(2, length);
|
|
42001
|
+
var CATEGORIES_WITHOUT_LOADING = /* @__PURE__ */ new Set([
|
|
42002
|
+
"wm.Variable",
|
|
42003
|
+
"wm.NavigationAction",
|
|
42004
|
+
"wm.TimerAction",
|
|
42005
|
+
"wm.NotificationAction",
|
|
42006
|
+
"wm.LoginAction",
|
|
42007
|
+
"wm.LogoutAction"
|
|
42008
|
+
]);
|
|
42009
|
+
function extractVariableNamesFromElement(e) {
|
|
42010
|
+
const vars = /* @__PURE__ */ new Set();
|
|
42011
|
+
const pattern = /fragment\??\.Variables\??\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g;
|
|
42012
|
+
Object.keys(e.attributes).forEach((attrName) => {
|
|
42013
|
+
const value = e.attributes[attrName];
|
|
42014
|
+
if (!value) return;
|
|
42015
|
+
const matches = [...value.matchAll(pattern)];
|
|
42016
|
+
matches.forEach((m) => vars.add(m[1]));
|
|
42017
|
+
});
|
|
42018
|
+
return Array.from(vars);
|
|
42019
|
+
}
|
|
41963
42020
|
var EVENT_NAME_MAP = {
|
|
41964
42021
|
"on-dblclick": "on-doubleClick",
|
|
41965
42022
|
"on-mouseenter": "on-mouseEnter",
|
|
@@ -42226,6 +42283,14 @@ var _Transpiler = class _Transpiler {
|
|
|
42226
42283
|
}
|
|
42227
42284
|
preTranspile(e) {
|
|
42228
42285
|
e == null ? void 0 : e.removeAttribute("variant");
|
|
42286
|
+
Object.keys(e.attributes).forEach((name) => {
|
|
42287
|
+
const camelName = _Transpiler.SKELETON_ATTR_RENAME[name];
|
|
42288
|
+
if (camelName) {
|
|
42289
|
+
const val = e.attributes[name];
|
|
42290
|
+
e.removeAttribute(name);
|
|
42291
|
+
e.setAttribute(camelName, val);
|
|
42292
|
+
}
|
|
42293
|
+
});
|
|
42229
42294
|
Object.keys(e.attributes).forEach((name) => {
|
|
42230
42295
|
let value = e.attributes[name];
|
|
42231
42296
|
if (value.startsWith("bind:")) {
|
|
@@ -42287,6 +42352,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42287
42352
|
});
|
|
42288
42353
|
}
|
|
42289
42354
|
transformStyles(e, context) {
|
|
42355
|
+
var _a, _b;
|
|
42290
42356
|
let rawStylesObj = {};
|
|
42291
42357
|
const rawStyles = e.getAttribute("styles");
|
|
42292
42358
|
if (rawStyles && !rawStyles.startsWith("bind:") && !rawStyles.startsWith("{")) {
|
|
@@ -42354,7 +42420,13 @@ var _Transpiler = class _Transpiler {
|
|
|
42354
42420
|
}
|
|
42355
42421
|
let conditionalClasses = e.getAttribute("conditionalclass") || e.getAttribute("ngclass");
|
|
42356
42422
|
if (classes.startsWith("bind:")) {
|
|
42357
|
-
|
|
42423
|
+
if ((_a = context == null ? void 0 : context.get) == null ? void 0 : _a.call(context, "isInsideTableColumn")) {
|
|
42424
|
+
let exp = classes.substring(5).replace("fragment.Page", "fragment");
|
|
42425
|
+
exp = transformTableColumnClassExpression(exp);
|
|
42426
|
+
classes = `{${exp}}`;
|
|
42427
|
+
} else {
|
|
42428
|
+
classes = `{${classes.substring(5)}}`;
|
|
42429
|
+
}
|
|
42358
42430
|
}
|
|
42359
42431
|
if (conditionalClasses) {
|
|
42360
42432
|
conditionalClasses = conditionalClasses.startsWith("bind:") ? `${conditionalClasses.substring(5)}` : conditionalClasses;
|
|
@@ -42381,6 +42453,11 @@ var _Transpiler = class _Transpiler {
|
|
|
42381
42453
|
} else {
|
|
42382
42454
|
classes = `{${conditionalClasses}}`;
|
|
42383
42455
|
}
|
|
42456
|
+
} else if (classes.includes("{{") && classes.includes("}}")) {
|
|
42457
|
+
const mustacheClass = transformClassWithMustacheExpressions(classes, {
|
|
42458
|
+
isInsideTableColumn: !!((_b = context == null ? void 0 : context.get) == null ? void 0 : _b.call(context, "isInsideTableColumn"))
|
|
42459
|
+
});
|
|
42460
|
+
classes = mustacheClass != null ? mustacheClass : `'${classes}'`;
|
|
42384
42461
|
} else if (!!classes && !classes.startsWith("{")) {
|
|
42385
42462
|
classes = `'${classes}'`;
|
|
42386
42463
|
}
|
|
@@ -42687,7 +42764,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42687
42764
|
return (0, import_lodash5.isNil)(value) || (0, import_lodash5.isEmpty)(value) ? "" : `${name}=${value}`;
|
|
42688
42765
|
}
|
|
42689
42766
|
transformAttrs(e, context, tx) {
|
|
42690
|
-
var _a, _b, _c;
|
|
42767
|
+
var _a, _b, _c, _d;
|
|
42691
42768
|
const autolayout = (_a = context.data) == null ? void 0 : _a.autolayoutCodegen;
|
|
42692
42769
|
const autoLayoutResult = (_b = autolayout == null ? void 0 : autolayout.processElement(e)) != null ? _b : null;
|
|
42693
42770
|
e.setAttribute("data-widget-id", generateWidgetId());
|
|
@@ -42724,7 +42801,6 @@ var _Transpiler = class _Transpiler {
|
|
|
42724
42801
|
);
|
|
42725
42802
|
if (foundInputs.length && floatingLabel) {
|
|
42726
42803
|
foundInputs[0].setAttribute("floatinglabel", labelCaption);
|
|
42727
|
-
labelNode && labelNode.remove();
|
|
42728
42804
|
}
|
|
42729
42805
|
if (isRequired) {
|
|
42730
42806
|
labelNode && labelNode.setAttribute("required", "true");
|
|
@@ -42740,6 +42816,13 @@ var _Transpiler = class _Transpiler {
|
|
|
42740
42816
|
const layoutClassNameValue = autolayout.buildLayoutClassNameAttr(autoLayoutResult);
|
|
42741
42817
|
str += ` layoutClassName=${layoutClassNameValue}`;
|
|
42742
42818
|
}
|
|
42819
|
+
const loadableVars = (_d = context.data) == null ? void 0 : _d.loadableVariables;
|
|
42820
|
+
const referencedVars = extractVariableNamesFromElement(e);
|
|
42821
|
+
const loadingVars = loadableVars ? referencedVars.filter((name) => loadableVars.has(name)) : referencedVars;
|
|
42822
|
+
if (loadingVars.length > 0) {
|
|
42823
|
+
const loadingParts = loadingVars.map((name) => `fragment?.Variables?.${name}?.loading`);
|
|
42824
|
+
str += ` loading={${loadingParts.join(" || ")} || false}`;
|
|
42825
|
+
}
|
|
42743
42826
|
return str;
|
|
42744
42827
|
}
|
|
42745
42828
|
createUniqueComponentName(components, name, counter = 0) {
|
|
@@ -42768,6 +42851,14 @@ var _Transpiler = class _Transpiler {
|
|
|
42768
42851
|
transpiler.transformers.set(tagName, transformer);
|
|
42769
42852
|
}
|
|
42770
42853
|
};
|
|
42854
|
+
// Skeleton-related attrs are authored in camelCase in WaveMaker markup but the HTML
|
|
42855
|
+
// parser lowercases all attribute names. Rename them back before attribute processing
|
|
42856
|
+
// so that property-parser.ts can match the camelCase keys it registers.
|
|
42857
|
+
_Transpiler.SKELETON_ATTR_RENAME = {
|
|
42858
|
+
skeletonrows: "skeletonRows",
|
|
42859
|
+
skeletoncolumns: "skeletonColumns",
|
|
42860
|
+
showskeleton: "showSkeleton"
|
|
42861
|
+
};
|
|
42771
42862
|
// Pure property / safe-property / keyed-read chain rooted at `fragment`.
|
|
42772
42863
|
// Rejects callee refs that contain intermediate calls (e.g. `fragment.a?.b?.()?.c`),
|
|
42773
42864
|
// operators, assignments, whitespace — anything that would change semantics when
|
|
@@ -42792,11 +42883,15 @@ var transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview, in
|
|
|
42792
42883
|
imports: []
|
|
42793
42884
|
};
|
|
42794
42885
|
const twoWayBindingVariables = /* @__PURE__ */ new Set();
|
|
42886
|
+
const loadableVariables = /* @__PURE__ */ new Set();
|
|
42795
42887
|
if (variables) {
|
|
42796
42888
|
Object.values(variables).forEach((v) => {
|
|
42797
42889
|
if (v.category === "wm.Variable" && v.twoWayBinding === true && v.name) {
|
|
42798
42890
|
twoWayBindingVariables.add(v.name);
|
|
42799
42891
|
}
|
|
42892
|
+
if (v.name && !CATEGORIES_WITHOUT_LOADING.has(v.category)) {
|
|
42893
|
+
loadableVariables.add(v.name);
|
|
42894
|
+
}
|
|
42800
42895
|
});
|
|
42801
42896
|
}
|
|
42802
42897
|
const autolayoutCodegen = new AutolayoutCodegen();
|
|
@@ -42807,6 +42902,7 @@ var transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview, in
|
|
|
42807
42902
|
props: [],
|
|
42808
42903
|
data: {
|
|
42809
42904
|
twoWayBindingVariables,
|
|
42905
|
+
loadableVariables,
|
|
42810
42906
|
autolayoutCodegen,
|
|
42811
42907
|
preview: preview === true,
|
|
42812
42908
|
...insideTableColumn ? { isInsideTableColumn: true } : {}
|
|
@@ -44106,7 +44202,7 @@ var getFormWidgetTemplate = (widgetType, widgetName, element, formDataVariable)
|
|
|
44106
44202
|
}
|
|
44107
44203
|
var commonFields = `name="${formfieldName}_formWidget"
|
|
44108
44204
|
formfield="true"
|
|
44109
|
-
datavalue="bind:$formField.datavalue
|
|
44205
|
+
datavalue="bind:$formField.datavalue ?? $formField.defaultvalue"
|
|
44110
44206
|
conditionalclass=""
|
|
44111
44207
|
${placeholder ? 'placeholder="' + placeholder + '"' : ""}
|
|
44112
44208
|
${onFocus ? "on-focus=" + onFocus : ""}
|
|
@@ -46635,7 +46731,7 @@ var getFilterWidgetTemplate = (widgetType, widgetName, element, filterDataVariab
|
|
|
46635
46731
|
}
|
|
46636
46732
|
const filterfieldName = getAttribute(element, "name");
|
|
46637
46733
|
const widgetNameSuffix = isMaxWidget ? "_maxWidget" : "";
|
|
46638
|
-
const datavalueBinding = isMaxWidget ? "bind:$formField.maxDataValue
|
|
46734
|
+
const datavalueBinding = isMaxWidget ? "bind:$formField.maxDataValue ?? $formField.maxdefaultvalue" : "bind:$formField.datavalue ?? $formField.defaultvalue";
|
|
46639
46735
|
const isMaxWidgetProp = isMaxWidget ? "isMaxWidget={true}" : "";
|
|
46640
46736
|
var commonFields = `name="${filterfieldName}_formWidget${widgetNameSuffix}"
|
|
46641
46737
|
formfield="true"
|