@wavemaker-ai/react-codegen 1.0.0-rc.314 → 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 +213 -108
- package/dist/transpiler/index.mjs.map +1 -1
- package/package-lock.json +90 -89
- 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/transform-markup.js +2 -2
- package/src/transpile/transform-markup.js.map +1 -1
- package/src/transpile/transpile.js +94 -9
- 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 +43 -15
- 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);
|
|
@@ -41876,8 +41879,144 @@ var AutolayoutCodegen = class {
|
|
|
41876
41879
|
}
|
|
41877
41880
|
};
|
|
41878
41881
|
|
|
41882
|
+
// src/transpile/components/data/table/utils.ts
|
|
41883
|
+
var CUSTOM_PIPE_REGEX = /(custom(\s*:))/;
|
|
41884
|
+
function checkIsCustomPipeExpression(exp) {
|
|
41885
|
+
return CUSTOM_PIPE_REGEX.test(exp);
|
|
41886
|
+
}
|
|
41887
|
+
function findNearestElement(element, tagName) {
|
|
41888
|
+
var _a, _b;
|
|
41889
|
+
let current = element.parentNode;
|
|
41890
|
+
const target = tagName.toLowerCase();
|
|
41891
|
+
while (current) {
|
|
41892
|
+
if (((_a = current.tagName) == null ? void 0 : _a.toLowerCase()) === target) {
|
|
41893
|
+
return (_b = current.getAttribute("name")) != null ? _b : void 0;
|
|
41894
|
+
}
|
|
41895
|
+
current = current.parentNode;
|
|
41896
|
+
}
|
|
41897
|
+
return void 0;
|
|
41898
|
+
}
|
|
41899
|
+
function convertActionToClickHandler(actionAttr, tableName, liveTableName) {
|
|
41900
|
+
const statements = actionAttr.split(";").map((s) => s.trim()).filter(Boolean);
|
|
41901
|
+
const converted = statements.map((statement) => {
|
|
41902
|
+
statement = convertHyphenatedPropsToBracketNotation(statement);
|
|
41903
|
+
let cleaned = statement.replace(/\$event/g, "event");
|
|
41904
|
+
if (cleaned.startsWith("event.")) return cleaned;
|
|
41905
|
+
if (cleaned.startsWith("Actions") || cleaned.startsWith("Variables") || cleaned.startsWith("Widgets")) {
|
|
41906
|
+
return `fragment.${cleaned}`;
|
|
41907
|
+
}
|
|
41908
|
+
if (cleaned.includes("(")) {
|
|
41909
|
+
const funcName = cleaned.split("(")[0];
|
|
41910
|
+
if (tableName && funcName.startsWith(`${tableName}_`)) {
|
|
41911
|
+
return `fragment.${cleaned}`;
|
|
41912
|
+
}
|
|
41913
|
+
if (cleaned.includes("(event)")) {
|
|
41914
|
+
cleaned = cleaned.replace("(event)", "(event, widget, row)");
|
|
41915
|
+
}
|
|
41916
|
+
if (liveTableName && (funcName.endsWith("addNewRow") || funcName.endsWith("editRow"))) {
|
|
41917
|
+
return `fragment.Widgets.${liveTableName}.${cleaned}`;
|
|
41918
|
+
}
|
|
41919
|
+
return tableName ? `fragment.Widgets.${tableName}.${cleaned}` : `fragment.${cleaned}`;
|
|
41920
|
+
}
|
|
41921
|
+
return `fragment.${cleaned}`;
|
|
41922
|
+
});
|
|
41923
|
+
return `onClick={(event, widget, row) => {
|
|
41924
|
+
${converted.join("\n ")}
|
|
41925
|
+
}}`;
|
|
41926
|
+
}
|
|
41927
|
+
function transformTableColumnClassExpression(expression) {
|
|
41928
|
+
if (!expression) return "";
|
|
41929
|
+
let transformed = expression.replace(/fragment\??\.row/g, "rowData");
|
|
41930
|
+
transformed = transformed.replace(/\brow\./g, "rowData.");
|
|
41931
|
+
transformed = transformed.replace(/\brow\[/g, "rowData[");
|
|
41932
|
+
transformed = addOptionalChaining(transformed);
|
|
41933
|
+
transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
|
|
41934
|
+
transformed = transformed.replace(/"([^"]*)"/g, "'$1'");
|
|
41935
|
+
return transformed;
|
|
41936
|
+
}
|
|
41937
|
+
function getFormatCellExpression(element, context) {
|
|
41938
|
+
const binding = element.getAttribute("binding");
|
|
41939
|
+
if (!binding || binding === "rowOperations") {
|
|
41940
|
+
return null;
|
|
41941
|
+
}
|
|
41942
|
+
let formatPattern = element.getAttribute("custompipeformat") || element.getAttribute("formatpattern");
|
|
41943
|
+
if (!formatPattern || formatPattern === "None") {
|
|
41944
|
+
return null;
|
|
41945
|
+
}
|
|
41946
|
+
const columnValue = `row.getProperty('${binding}')`;
|
|
41947
|
+
let pipeExpression = "";
|
|
41948
|
+
if (checkIsCustomPipeExpression(formatPattern)) {
|
|
41949
|
+
pipeExpression = `${columnValue} | ${formatPattern} : row`;
|
|
41950
|
+
}
|
|
41951
|
+
if (!pipeExpression) {
|
|
41952
|
+
return null;
|
|
41953
|
+
}
|
|
41954
|
+
let transformed = bind_ex_transformer_default(pipeExpression, "fragment", "attr");
|
|
41955
|
+
transformed = transformed.replace(/fragment\??\.row/g, "rowData");
|
|
41956
|
+
transformed = transformed.replace(/\brow\./g, "rowData.");
|
|
41957
|
+
transformed = transformed.replace(/\brow\b(?![a-zA-Z_$0-9])/g, "rowData");
|
|
41958
|
+
transformed = resolveFormatContext(transformed, context);
|
|
41959
|
+
transformed = addOptionalChaining(transformed);
|
|
41960
|
+
transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
|
|
41961
|
+
return transformed;
|
|
41962
|
+
}
|
|
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
|
+
|
|
41879
41999
|
// src/transpile/transpile.ts
|
|
41880
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
|
+
}
|
|
41881
42020
|
var EVENT_NAME_MAP = {
|
|
41882
42021
|
"on-dblclick": "on-doubleClick",
|
|
41883
42022
|
"on-mouseenter": "on-mouseEnter",
|
|
@@ -42144,6 +42283,14 @@ var _Transpiler = class _Transpiler {
|
|
|
42144
42283
|
}
|
|
42145
42284
|
preTranspile(e) {
|
|
42146
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
|
+
});
|
|
42147
42294
|
Object.keys(e.attributes).forEach((name) => {
|
|
42148
42295
|
let value = e.attributes[name];
|
|
42149
42296
|
if (value.startsWith("bind:")) {
|
|
@@ -42205,6 +42352,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42205
42352
|
});
|
|
42206
42353
|
}
|
|
42207
42354
|
transformStyles(e, context) {
|
|
42355
|
+
var _a, _b;
|
|
42208
42356
|
let rawStylesObj = {};
|
|
42209
42357
|
const rawStyles = e.getAttribute("styles");
|
|
42210
42358
|
if (rawStyles && !rawStyles.startsWith("bind:") && !rawStyles.startsWith("{")) {
|
|
@@ -42272,7 +42420,13 @@ var _Transpiler = class _Transpiler {
|
|
|
42272
42420
|
}
|
|
42273
42421
|
let conditionalClasses = e.getAttribute("conditionalclass") || e.getAttribute("ngclass");
|
|
42274
42422
|
if (classes.startsWith("bind:")) {
|
|
42275
|
-
|
|
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
|
+
}
|
|
42276
42430
|
}
|
|
42277
42431
|
if (conditionalClasses) {
|
|
42278
42432
|
conditionalClasses = conditionalClasses.startsWith("bind:") ? `${conditionalClasses.substring(5)}` : conditionalClasses;
|
|
@@ -42299,6 +42453,11 @@ var _Transpiler = class _Transpiler {
|
|
|
42299
42453
|
} else {
|
|
42300
42454
|
classes = `{${conditionalClasses}}`;
|
|
42301
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}'`;
|
|
42302
42461
|
} else if (!!classes && !classes.startsWith("{")) {
|
|
42303
42462
|
classes = `'${classes}'`;
|
|
42304
42463
|
}
|
|
@@ -42403,7 +42562,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42403
42562
|
return false;
|
|
42404
42563
|
}
|
|
42405
42564
|
findArgs(str, context) {
|
|
42406
|
-
var _a;
|
|
42565
|
+
var _a, _b;
|
|
42407
42566
|
let argStr = "";
|
|
42408
42567
|
let maxSplits = 0;
|
|
42409
42568
|
(_a = str.match(/\([^;]*\)/g)) == null ? void 0 : _a.forEach((s) => {
|
|
@@ -42414,7 +42573,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42414
42573
|
}
|
|
42415
42574
|
});
|
|
42416
42575
|
argStr = argStr.replace(/\(|\)/g, "");
|
|
42417
|
-
if (context == null ? void 0 : context.get("isInsideList")) {
|
|
42576
|
+
if ((_b = context == null ? void 0 : context.get) == null ? void 0 : _b.call(context, "isInsideList")) {
|
|
42418
42577
|
argStr = argStr.split(",").filter((s) => !(0, import_lodash5.includes)(["$item", "currentItemWidgets"], s.trim())).join(",");
|
|
42419
42578
|
}
|
|
42420
42579
|
const parsedArgs = this.parseArguments(argStr);
|
|
@@ -42535,6 +42694,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42535
42694
|
return attrName.endsWith("url") || attrName.endsWith("src");
|
|
42536
42695
|
}
|
|
42537
42696
|
transformAttr(tagName, name, value, context, tx) {
|
|
42697
|
+
var _a, _b, _c;
|
|
42538
42698
|
if (name === "styles" || name === "style" || name === "className") ; else if (name === "groupby" && value.includes("(")) {
|
|
42539
42699
|
value = `${this.findArgs(value, context)} => ${value}`;
|
|
42540
42700
|
value = `{${value}}`;
|
|
@@ -42543,12 +42703,12 @@ var _Transpiler = class _Transpiler {
|
|
|
42543
42703
|
value = value.replace(/item,/g, "$item,");
|
|
42544
42704
|
value = value.replace(/item\./g, "$item.");
|
|
42545
42705
|
value = value.replace(/item\)/g, "$item)");
|
|
42546
|
-
if (context == null ? void 0 : context.get("isInsideList")) {
|
|
42706
|
+
if ((_a = context == null ? void 0 : context.get) == null ? void 0 : _a.call(context, "isInsideList")) {
|
|
42547
42707
|
value = value.replace(/;+\s*$/, "").trim();
|
|
42548
42708
|
value = addFragmentOptionalChaining(value, false);
|
|
42549
42709
|
}
|
|
42550
42710
|
const args = this.findArgs(value, context);
|
|
42551
|
-
if (context == null ? void 0 : context.get("isInsideTableColumn")) {
|
|
42711
|
+
if ((_b = context == null ? void 0 : context.get) == null ? void 0 : _b.call(context, "isInsideTableColumn")) {
|
|
42552
42712
|
value = value.replace(/\brow\b/g, "rowData");
|
|
42553
42713
|
}
|
|
42554
42714
|
const arrowParams = this.parseArrowParamNames(args);
|
|
@@ -42571,7 +42731,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42571
42731
|
let exp = `${value.substring(5)}`;
|
|
42572
42732
|
exp = exp.replace("fragment.Page", "fragment");
|
|
42573
42733
|
const isProgressCircleDatavalue = tagName === "wm-progress-circle" && name === "datavalue";
|
|
42574
|
-
exp = modifyExpression(exp);
|
|
42734
|
+
exp = ((_c = context == null ? void 0 : context.get) == null ? void 0 : _c.call(context, "isInsideTableColumn")) ? transformTableColumnClassExpression(exp) : modifyExpression(exp);
|
|
42575
42735
|
exp = resolveFormatContext(exp, context);
|
|
42576
42736
|
exp = this.convertStringBooleanTernary(exp);
|
|
42577
42737
|
if (!exp) {
|
|
@@ -42604,7 +42764,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42604
42764
|
return (0, import_lodash5.isNil)(value) || (0, import_lodash5.isEmpty)(value) ? "" : `${name}=${value}`;
|
|
42605
42765
|
}
|
|
42606
42766
|
transformAttrs(e, context, tx) {
|
|
42607
|
-
var _a, _b, _c;
|
|
42767
|
+
var _a, _b, _c, _d;
|
|
42608
42768
|
const autolayout = (_a = context.data) == null ? void 0 : _a.autolayoutCodegen;
|
|
42609
42769
|
const autoLayoutResult = (_b = autolayout == null ? void 0 : autolayout.processElement(e)) != null ? _b : null;
|
|
42610
42770
|
e.setAttribute("data-widget-id", generateWidgetId());
|
|
@@ -42641,7 +42801,6 @@ var _Transpiler = class _Transpiler {
|
|
|
42641
42801
|
);
|
|
42642
42802
|
if (foundInputs.length && floatingLabel) {
|
|
42643
42803
|
foundInputs[0].setAttribute("floatinglabel", labelCaption);
|
|
42644
|
-
labelNode && labelNode.remove();
|
|
42645
42804
|
}
|
|
42646
42805
|
if (isRequired) {
|
|
42647
42806
|
labelNode && labelNode.setAttribute("required", "true");
|
|
@@ -42657,6 +42816,13 @@ var _Transpiler = class _Transpiler {
|
|
|
42657
42816
|
const layoutClassNameValue = autolayout.buildLayoutClassNameAttr(autoLayoutResult);
|
|
42658
42817
|
str += ` layoutClassName=${layoutClassNameValue}`;
|
|
42659
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
|
+
}
|
|
42660
42826
|
return str;
|
|
42661
42827
|
}
|
|
42662
42828
|
createUniqueComponentName(components, name, counter = 0) {
|
|
@@ -42685,6 +42851,14 @@ var _Transpiler = class _Transpiler {
|
|
|
42685
42851
|
transpiler.transformers.set(tagName, transformer);
|
|
42686
42852
|
}
|
|
42687
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
|
+
};
|
|
42688
42862
|
// Pure property / safe-property / keyed-read chain rooted at `fragment`.
|
|
42689
42863
|
// Rejects callee refs that contain intermediate calls (e.g. `fragment.a?.b?.()?.c`),
|
|
42690
42864
|
// operators, assignments, whitespace — anything that would change semantics when
|
|
@@ -42696,7 +42870,7 @@ _Transpiler.INSTANCE_BOUND_CALLEE = /(?:\?\.|\.)(?:Actions|Variables)(?:\?\.|\.|
|
|
|
42696
42870
|
var Transpiler = _Transpiler;
|
|
42697
42871
|
var transpiler = new Transpiler();
|
|
42698
42872
|
var registerTransformer = transpiler.registerTransformer.bind(transpiler);
|
|
42699
|
-
var transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview) => {
|
|
42873
|
+
var transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview, insideTableColumn) => {
|
|
42700
42874
|
const parsed = parse5(markup, {
|
|
42701
42875
|
blockTextElements: {}
|
|
42702
42876
|
});
|
|
@@ -42709,11 +42883,15 @@ var transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview) =>
|
|
|
42709
42883
|
imports: []
|
|
42710
42884
|
};
|
|
42711
42885
|
const twoWayBindingVariables = /* @__PURE__ */ new Set();
|
|
42886
|
+
const loadableVariables = /* @__PURE__ */ new Set();
|
|
42712
42887
|
if (variables) {
|
|
42713
42888
|
Object.values(variables).forEach((v) => {
|
|
42714
42889
|
if (v.category === "wm.Variable" && v.twoWayBinding === true && v.name) {
|
|
42715
42890
|
twoWayBindingVariables.add(v.name);
|
|
42716
42891
|
}
|
|
42892
|
+
if (v.name && !CATEGORIES_WITHOUT_LOADING.has(v.category)) {
|
|
42893
|
+
loadableVariables.add(v.name);
|
|
42894
|
+
}
|
|
42717
42895
|
});
|
|
42718
42896
|
}
|
|
42719
42897
|
const autolayoutCodegen = new AutolayoutCodegen();
|
|
@@ -42724,8 +42902,10 @@ var transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview) =>
|
|
|
42724
42902
|
props: [],
|
|
42725
42903
|
data: {
|
|
42726
42904
|
twoWayBindingVariables,
|
|
42905
|
+
loadableVariables,
|
|
42727
42906
|
autolayoutCodegen,
|
|
42728
|
-
preview: preview === true
|
|
42907
|
+
preview: preview === true,
|
|
42908
|
+
...insideTableColumn ? { isInsideTableColumn: true } : {}
|
|
42729
42909
|
}
|
|
42730
42910
|
});
|
|
42731
42911
|
parsed.childNodes.forEach((node) => {
|
|
@@ -44022,7 +44202,7 @@ var getFormWidgetTemplate = (widgetType, widgetName, element, formDataVariable)
|
|
|
44022
44202
|
}
|
|
44023
44203
|
var commonFields = `name="${formfieldName}_formWidget"
|
|
44024
44204
|
formfield="true"
|
|
44025
|
-
datavalue="bind:$formField.datavalue
|
|
44205
|
+
datavalue="bind:$formField.datavalue ?? $formField.defaultvalue"
|
|
44026
44206
|
conditionalclass=""
|
|
44027
44207
|
${placeholder ? 'placeholder="' + placeholder + '"' : ""}
|
|
44028
44208
|
${onFocus ? "on-focus=" + onFocus : ""}
|
|
@@ -46193,88 +46373,6 @@ var liveform_transformer_default = {
|
|
|
46193
46373
|
imports: (element, context) => imports89
|
|
46194
46374
|
};
|
|
46195
46375
|
|
|
46196
|
-
// src/transpile/components/data/table/utils.ts
|
|
46197
|
-
var CUSTOM_PIPE_REGEX = /(custom(\s*:))/;
|
|
46198
|
-
function checkIsCustomPipeExpression(exp) {
|
|
46199
|
-
return CUSTOM_PIPE_REGEX.test(exp);
|
|
46200
|
-
}
|
|
46201
|
-
function findNearestElement(element, tagName) {
|
|
46202
|
-
var _a, _b;
|
|
46203
|
-
let current = element.parentNode;
|
|
46204
|
-
const target = tagName.toLowerCase();
|
|
46205
|
-
while (current) {
|
|
46206
|
-
if (((_a = current.tagName) == null ? void 0 : _a.toLowerCase()) === target) {
|
|
46207
|
-
return (_b = current.getAttribute("name")) != null ? _b : void 0;
|
|
46208
|
-
}
|
|
46209
|
-
current = current.parentNode;
|
|
46210
|
-
}
|
|
46211
|
-
return void 0;
|
|
46212
|
-
}
|
|
46213
|
-
function convertActionToClickHandler(actionAttr, tableName, liveTableName) {
|
|
46214
|
-
const statements = actionAttr.split(";").map((s) => s.trim()).filter(Boolean);
|
|
46215
|
-
const converted = statements.map((statement) => {
|
|
46216
|
-
statement = convertHyphenatedPropsToBracketNotation(statement);
|
|
46217
|
-
let cleaned = statement.replace(/\$event/g, "event");
|
|
46218
|
-
if (cleaned.startsWith("event.")) return cleaned;
|
|
46219
|
-
if (cleaned.startsWith("Actions") || cleaned.startsWith("Variables") || cleaned.startsWith("Widgets")) {
|
|
46220
|
-
return `fragment.${cleaned}`;
|
|
46221
|
-
}
|
|
46222
|
-
if (cleaned.includes("(")) {
|
|
46223
|
-
const funcName = cleaned.split("(")[0];
|
|
46224
|
-
if (tableName && funcName.startsWith(`${tableName}_`)) {
|
|
46225
|
-
return `fragment.${cleaned}`;
|
|
46226
|
-
}
|
|
46227
|
-
if (cleaned.includes("(event)")) {
|
|
46228
|
-
cleaned = cleaned.replace("(event)", "(event, widget, row)");
|
|
46229
|
-
}
|
|
46230
|
-
if (liveTableName && (funcName.endsWith("addNewRow") || funcName.endsWith("editRow"))) {
|
|
46231
|
-
return `fragment.Widgets.${liveTableName}.${cleaned}`;
|
|
46232
|
-
}
|
|
46233
|
-
return tableName ? `fragment.Widgets.${tableName}.${cleaned}` : `fragment.${cleaned}`;
|
|
46234
|
-
}
|
|
46235
|
-
return `fragment.${cleaned}`;
|
|
46236
|
-
});
|
|
46237
|
-
return `onClick={(event, widget, row) => {
|
|
46238
|
-
${converted.join("\n ")}
|
|
46239
|
-
}}`;
|
|
46240
|
-
}
|
|
46241
|
-
function transformTableColumnClassExpression(expression) {
|
|
46242
|
-
if (!expression) return "";
|
|
46243
|
-
let transformed = expression.replace(/fragment\??\.row/g, "rowData");
|
|
46244
|
-
transformed = transformed.replace(/\brow\./g, "rowData.");
|
|
46245
|
-
transformed = transformed.replace(/\brow\[/g, "rowData[");
|
|
46246
|
-
transformed = addOptionalChaining(transformed);
|
|
46247
|
-
transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
|
|
46248
|
-
transformed = transformed.replace(/"([^"]*)"/g, "'$1'");
|
|
46249
|
-
return transformed;
|
|
46250
|
-
}
|
|
46251
|
-
function getFormatCellExpression(element, context) {
|
|
46252
|
-
const binding = element.getAttribute("binding");
|
|
46253
|
-
if (!binding || binding === "rowOperations") {
|
|
46254
|
-
return null;
|
|
46255
|
-
}
|
|
46256
|
-
let formatPattern = element.getAttribute("custompipeformat") || element.getAttribute("formatpattern");
|
|
46257
|
-
if (!formatPattern || formatPattern === "None") {
|
|
46258
|
-
return null;
|
|
46259
|
-
}
|
|
46260
|
-
const columnValue = `row.getProperty('${binding}')`;
|
|
46261
|
-
let pipeExpression = "";
|
|
46262
|
-
if (checkIsCustomPipeExpression(formatPattern)) {
|
|
46263
|
-
pipeExpression = `${columnValue} | ${formatPattern} : row`;
|
|
46264
|
-
}
|
|
46265
|
-
if (!pipeExpression) {
|
|
46266
|
-
return null;
|
|
46267
|
-
}
|
|
46268
|
-
let transformed = bind_ex_transformer_default(pipeExpression, "fragment", "attr");
|
|
46269
|
-
transformed = transformed.replace(/fragment\??\.row/g, "rowData");
|
|
46270
|
-
transformed = transformed.replace(/\brow\./g, "rowData.");
|
|
46271
|
-
transformed = transformed.replace(/\brow\b(?![a-zA-Z_$0-9])/g, "rowData");
|
|
46272
|
-
transformed = resolveFormatContext(transformed, context);
|
|
46273
|
-
transformed = addOptionalChaining(transformed);
|
|
46274
|
-
transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
|
|
46275
|
-
return transformed;
|
|
46276
|
-
}
|
|
46277
|
-
|
|
46278
46376
|
// src/transpile/components/data/table/table-column.transformer.ts
|
|
46279
46377
|
var imports90 = [
|
|
46280
46378
|
{ name: "WmTableColumn", from: "@wavemaker-ai/react-runtime/components/data/table/table-column" }
|
|
@@ -46633,7 +46731,7 @@ var getFilterWidgetTemplate = (widgetType, widgetName, element, filterDataVariab
|
|
|
46633
46731
|
}
|
|
46634
46732
|
const filterfieldName = getAttribute(element, "name");
|
|
46635
46733
|
const widgetNameSuffix = isMaxWidget ? "_maxWidget" : "";
|
|
46636
|
-
const datavalueBinding = isMaxWidget ? "bind:$formField.maxDataValue
|
|
46734
|
+
const datavalueBinding = isMaxWidget ? "bind:$formField.maxDataValue ?? $formField.maxdefaultvalue" : "bind:$formField.datavalue ?? $formField.defaultvalue";
|
|
46637
46735
|
const isMaxWidgetProp = isMaxWidget ? "isMaxWidget={true}" : "";
|
|
46638
46736
|
var commonFields = `name="${filterfieldName}_formWidget${widgetNameSuffix}"
|
|
46639
46737
|
formfield="true"
|
|
@@ -47690,8 +47788,15 @@ export default (${scope}:any) => {
|
|
|
47690
47788
|
`;
|
|
47691
47789
|
}
|
|
47692
47790
|
function transformMarkup(markup, options = { appUrl: "", prefabName: "", isPartOfPrefab: false }) {
|
|
47693
|
-
const { isPartOfPrefab = false, variables, appUrl, prefabName } = options;
|
|
47694
|
-
const transpiledOutput = transpileMarkup(
|
|
47791
|
+
const { isPartOfPrefab = false, variables, appUrl, prefabName, insideTableColumn } = options;
|
|
47792
|
+
const transpiledOutput = transpileMarkup(
|
|
47793
|
+
markup,
|
|
47794
|
+
isPartOfPrefab,
|
|
47795
|
+
void 0,
|
|
47796
|
+
variables,
|
|
47797
|
+
true,
|
|
47798
|
+
insideTableColumn
|
|
47799
|
+
);
|
|
47695
47800
|
const transpiledVars = transpileVariableDefinitions(variables, appUrl, "Page");
|
|
47696
47801
|
const variablesCode = serializeVariablesToCode(transpiledVars, "Page", {
|
|
47697
47802
|
isPrefabApp: isPartOfPrefab,
|