@wavemaker-ai/react-codegen 1.0.0-rc.647684 → 1.0.0-rc.647712
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 +230 -72
- package/dist/transpiler/index.mjs.map +1 -1
- package/dist/transpiler/wm-styles.css +3 -20
- package/package-lock.json +83 -83
- package/package.json +1 -1
- package/src/transpile/bind.ex.transformer.js +4 -1
- package/src/transpile/bind.ex.transformer.js.map +1 -1
- package/src/transpile/components/container/accordion.transformer.js +4 -4
- package/src/transpile/components/container/accordion.transformer.js.map +1 -1
- package/src/transpile/components/container/tabs.transformer.js +2 -2
- package/src/transpile/components/container/tabs.transformer.js.map +1 -1
- package/src/transpile/components/data/list/list-transformer.js +7 -2
- package/src/transpile/components/data/list/list-transformer.js.map +1 -1
- package/src/transpile/components/data/table/table.transformer.js +14 -20
- package/src/transpile/components/data/table/table.transformer.js.map +1 -1
- package/src/transpile/components/data/table/utils.js +90 -0
- package/src/transpile/components/data/table/utils.js.map +1 -1
- package/src/transpile/components/dialogs/dialog-actions.transformer.js +4 -6
- package/src/transpile/components/dialogs/dialog-actions.transformer.js.map +1 -1
- package/src/transpile/components/layout/layout-region-factory.js +8 -2
- package/src/transpile/components/layout/layout-region-factory.js.map +1 -1
- package/src/transpile/components/nav/nav.transformer.js +3 -5
- package/src/transpile/components/nav/nav.transformer.js.map +1 -1
- package/src/transpile/components/utils.js +11 -5
- package/src/transpile/components/utils.js.map +1 -1
- package/src/transpile/transpile.js +62 -21
- package/src/transpile/transpile.js.map +1 -1
- package/src/utils.browser.js +42 -1
- package/src/utils.browser.js.map +1 -1
- package/templates/project/app/components.css +3 -0
- package/templates/project/app/widgetInlineStylesOverride.css +0 -20
- package/templates/project/package.json +4 -4
|
@@ -8133,14 +8133,14 @@ var require_lib = __commonJS({
|
|
|
8133
8133
|
super.checkParams(node, false, true);
|
|
8134
8134
|
this.scope.exit();
|
|
8135
8135
|
}
|
|
8136
|
-
forwardNoArrowParamsConversionAt(node,
|
|
8136
|
+
forwardNoArrowParamsConversionAt(node, parse8) {
|
|
8137
8137
|
let result;
|
|
8138
8138
|
if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
|
|
8139
8139
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
8140
|
-
result =
|
|
8140
|
+
result = parse8();
|
|
8141
8141
|
this.state.noArrowParamsConversionAt.pop();
|
|
8142
8142
|
} else {
|
|
8143
|
-
result =
|
|
8143
|
+
result = parse8();
|
|
8144
8144
|
}
|
|
8145
8145
|
return result;
|
|
8146
8146
|
}
|
|
@@ -16778,7 +16778,7 @@ var require_lib = __commonJS({
|
|
|
16778
16778
|
}
|
|
16779
16779
|
return pluginMap;
|
|
16780
16780
|
}
|
|
16781
|
-
function
|
|
16781
|
+
function parse7(input, options) {
|
|
16782
16782
|
var _options;
|
|
16783
16783
|
if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
|
|
16784
16784
|
options = Object.assign({}, options);
|
|
@@ -16840,7 +16840,7 @@ var require_lib = __commonJS({
|
|
|
16840
16840
|
}
|
|
16841
16841
|
return cls;
|
|
16842
16842
|
}
|
|
16843
|
-
exports$1.parse =
|
|
16843
|
+
exports$1.parse = parse7;
|
|
16844
16844
|
exports$1.parseExpression = parseExpression2;
|
|
16845
16845
|
exports$1.tokTypes = types;
|
|
16846
16846
|
}
|
|
@@ -19892,7 +19892,7 @@ var require_parse = __commonJS({
|
|
|
19892
19892
|
var whitespace = /* @__PURE__ */ new Set([9, 10, 12, 13, 32]);
|
|
19893
19893
|
var ZERO = "0".charCodeAt(0);
|
|
19894
19894
|
var NINE = "9".charCodeAt(0);
|
|
19895
|
-
function
|
|
19895
|
+
function parse7(formula) {
|
|
19896
19896
|
formula = formula.trim().toLowerCase();
|
|
19897
19897
|
if (formula === "even") {
|
|
19898
19898
|
return [2, 0];
|
|
@@ -19944,7 +19944,7 @@ var require_parse = __commonJS({
|
|
|
19944
19944
|
}
|
|
19945
19945
|
}
|
|
19946
19946
|
}
|
|
19947
|
-
exports$1.parse =
|
|
19947
|
+
exports$1.parse = parse7;
|
|
19948
19948
|
}
|
|
19949
19949
|
});
|
|
19950
19950
|
|
|
@@ -21413,7 +21413,7 @@ var require_html = __commonJS({
|
|
|
21413
21413
|
}).join("");
|
|
21414
21414
|
},
|
|
21415
21415
|
set: function(content) {
|
|
21416
|
-
var r =
|
|
21416
|
+
var r = parse7(content);
|
|
21417
21417
|
this.childNodes = r.childNodes.length ? r.childNodes : [new text_1.default(content, this)];
|
|
21418
21418
|
},
|
|
21419
21419
|
enumerable: false,
|
|
@@ -21426,7 +21426,7 @@ var require_html = __commonJS({
|
|
|
21426
21426
|
if (content instanceof node_1.default) {
|
|
21427
21427
|
content = [content];
|
|
21428
21428
|
} else if (typeof content == "string") {
|
|
21429
|
-
var r =
|
|
21429
|
+
var r = parse7(content, options);
|
|
21430
21430
|
content = r.childNodes.length ? r.childNodes : [new text_1.default(content, this)];
|
|
21431
21431
|
}
|
|
21432
21432
|
this.childNodes = content;
|
|
@@ -21441,7 +21441,7 @@ var require_html = __commonJS({
|
|
|
21441
21441
|
if (node instanceof node_1.default) {
|
|
21442
21442
|
return [node];
|
|
21443
21443
|
} else if (typeof node == "string") {
|
|
21444
|
-
var r =
|
|
21444
|
+
var r = parse7(node);
|
|
21445
21445
|
return r.childNodes.length ? r.childNodes : [new text_1.default(node, _this)];
|
|
21446
21446
|
}
|
|
21447
21447
|
return [];
|
|
@@ -21766,7 +21766,7 @@ var require_html = __commonJS({
|
|
|
21766
21766
|
if (arguments.length < 2) {
|
|
21767
21767
|
throw new Error("2 arguments required");
|
|
21768
21768
|
}
|
|
21769
|
-
var p =
|
|
21769
|
+
var p = parse7(html);
|
|
21770
21770
|
if (where === "afterend") {
|
|
21771
21771
|
var idx = this.parentNode.childNodes.findIndex(function(child) {
|
|
21772
21772
|
return child === _this;
|
|
@@ -22056,7 +22056,7 @@ var require_html = __commonJS({
|
|
|
22056
22056
|
return stack;
|
|
22057
22057
|
}
|
|
22058
22058
|
exports$1.base_parse = base_parse;
|
|
22059
|
-
function
|
|
22059
|
+
function parse7(data, options) {
|
|
22060
22060
|
if (options === void 0) {
|
|
22061
22061
|
options = { lowerCaseTagName: false, comment: false };
|
|
22062
22062
|
}
|
|
@@ -22085,7 +22085,7 @@ var require_html = __commonJS({
|
|
|
22085
22085
|
}
|
|
22086
22086
|
return root;
|
|
22087
22087
|
}
|
|
22088
|
-
exports$1.parse =
|
|
22088
|
+
exports$1.parse = parse7;
|
|
22089
22089
|
}
|
|
22090
22090
|
});
|
|
22091
22091
|
|
|
@@ -39285,6 +39285,35 @@ var transformAppLocale = (exp) => {
|
|
|
39285
39285
|
const expression = exp.replace(appLocaleRegex, replacer);
|
|
39286
39286
|
return expression;
|
|
39287
39287
|
};
|
|
39288
|
+
var splitTopLevel = (expr, separator, limit = Infinity) => {
|
|
39289
|
+
const parts = [];
|
|
39290
|
+
let depth = 0;
|
|
39291
|
+
let inString = false;
|
|
39292
|
+
let stringChar = "";
|
|
39293
|
+
let start = 0;
|
|
39294
|
+
for (let i = 0; i < expr.length && parts.length < limit - 1; i++) {
|
|
39295
|
+
const ch = expr[i];
|
|
39296
|
+
if (inString) {
|
|
39297
|
+
if (ch === stringChar && expr[i - 1] !== "\\") {
|
|
39298
|
+
inString = false;
|
|
39299
|
+
}
|
|
39300
|
+
continue;
|
|
39301
|
+
}
|
|
39302
|
+
if (ch === '"' || ch === "'") {
|
|
39303
|
+
inString = true;
|
|
39304
|
+
stringChar = ch;
|
|
39305
|
+
} else if (ch === "(" || ch === "[" || ch === "{") {
|
|
39306
|
+
depth++;
|
|
39307
|
+
} else if (ch === ")" || ch === "]" || ch === "}") {
|
|
39308
|
+
depth--;
|
|
39309
|
+
} else if (ch === separator && depth === 0) {
|
|
39310
|
+
parts.push(expr.slice(start, i));
|
|
39311
|
+
start = i + 1;
|
|
39312
|
+
}
|
|
39313
|
+
}
|
|
39314
|
+
parts.push(expr.slice(start));
|
|
39315
|
+
return parts;
|
|
39316
|
+
};
|
|
39288
39317
|
var convertHyphenatedPropsToBracketNotation = (expr) => {
|
|
39289
39318
|
if (!expr || typeof expr !== "string") return expr;
|
|
39290
39319
|
return expr.replace(/\.([a-zA-Z_$][a-zA-Z0-9_$]*-[a-zA-Z_$][a-zA-Z0-9_$\-]*)/g, (_, propName) => {
|
|
@@ -39714,7 +39743,7 @@ var transform = (expr, scopeName = "this", mode = "attr") => {
|
|
|
39714
39743
|
expr = convertHyphenatedPropsToBracketNotation(expr);
|
|
39715
39744
|
try {
|
|
39716
39745
|
const parser = new Parser$1(new Lexer());
|
|
39717
|
-
let expressions = expr
|
|
39746
|
+
let expressions = splitTopLevel(expr, ";"), transformedExpressions = [];
|
|
39718
39747
|
const $iExp = new RegExp("\\[" + scopeName + "\\.\\$i\\]", "g");
|
|
39719
39748
|
expressions.forEach((currentExp) => {
|
|
39720
39749
|
const ast = parser.parseBinding(currentExp, "", 0);
|
|
@@ -40583,9 +40612,12 @@ var transformRepeatChildData = (element, dataSetEx, prefix = "repeat_item", list
|
|
|
40583
40612
|
if (isList) {
|
|
40584
40613
|
return;
|
|
40585
40614
|
}
|
|
40586
|
-
|
|
40587
|
-
|
|
40588
|
-
|
|
40615
|
+
const value = element.attributes[name];
|
|
40616
|
+
const stripped = removeOptionChaining(value);
|
|
40617
|
+
const replaced = replaceAll(stripped, dataSetEx, "$item");
|
|
40618
|
+
if (replaced !== stripped) {
|
|
40619
|
+
element.setAttribute(name, replaced);
|
|
40620
|
+
}
|
|
40589
40621
|
if (list) {
|
|
40590
40622
|
let genrateRandomString2 = function() {
|
|
40591
40623
|
return Math.random().toString(36).substring(2, 5);
|
|
@@ -40602,12 +40634,15 @@ var transformRepeatChildData = (element, dataSetEx, prefix = "repeat_item", list
|
|
|
40602
40634
|
}
|
|
40603
40635
|
});
|
|
40604
40636
|
};
|
|
40605
|
-
var transformRepeatChildAttr = (element, replace2, replaceWith) => {
|
|
40637
|
+
var transformRepeatChildAttr = (element, replace2, replaceWith, skipAttrNames) => {
|
|
40606
40638
|
Object.keys(element.attributes).forEach((name) => {
|
|
40607
40639
|
const isList = isListAndField(element);
|
|
40608
40640
|
if (isList) {
|
|
40609
40641
|
return;
|
|
40610
40642
|
}
|
|
40643
|
+
if (skipAttrNames == null ? void 0 : skipAttrNames.includes(name)) {
|
|
40644
|
+
return;
|
|
40645
|
+
}
|
|
40611
40646
|
const value = element.attributes[name];
|
|
40612
40647
|
const regex = new RegExp(
|
|
40613
40648
|
replace2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "(?![a-zA-Z_$0-9])",
|
|
@@ -40621,7 +40656,7 @@ var transformRepeatChildAttr = (element, replace2, replaceWith) => {
|
|
|
40621
40656
|
});
|
|
40622
40657
|
element.childNodes.forEach((c) => {
|
|
40623
40658
|
if (isHTMLElement(c)) {
|
|
40624
|
-
transformRepeatChildAttr(c, replace2, replaceWith);
|
|
40659
|
+
transformRepeatChildAttr(c, replace2, replaceWith, skipAttrNames);
|
|
40625
40660
|
}
|
|
40626
40661
|
});
|
|
40627
40662
|
};
|
|
@@ -42245,6 +42280,73 @@ function getFormatCellExpression(element, context) {
|
|
|
42245
42280
|
transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
|
|
42246
42281
|
return transformed;
|
|
42247
42282
|
}
|
|
42283
|
+
var VARIABLES_SCOPE_PREFIX = /^bind:fragment(?:\?\.|\.)((?:App(?:\?\.|\.)(?:activePage(?:\?\.|\.))?)?Variables)/;
|
|
42284
|
+
function findClosingBracket(value, start) {
|
|
42285
|
+
let depth = 0;
|
|
42286
|
+
let quote = null;
|
|
42287
|
+
for (let i = start; i < value.length; i++) {
|
|
42288
|
+
const ch = value[i];
|
|
42289
|
+
if (quote) {
|
|
42290
|
+
if (ch === "\\") i++;
|
|
42291
|
+
else if (ch === quote) quote = null;
|
|
42292
|
+
continue;
|
|
42293
|
+
}
|
|
42294
|
+
if (ch === "'" || ch === '"' || ch === "`") {
|
|
42295
|
+
quote = ch;
|
|
42296
|
+
} else if (ch === "[") {
|
|
42297
|
+
depth++;
|
|
42298
|
+
} else if (ch === "]") {
|
|
42299
|
+
depth--;
|
|
42300
|
+
if (depth === 0) return i;
|
|
42301
|
+
}
|
|
42302
|
+
}
|
|
42303
|
+
return -1;
|
|
42304
|
+
}
|
|
42305
|
+
function parseVariableDataSetBinding(value) {
|
|
42306
|
+
const prefix = VARIABLES_SCOPE_PREFIX.exec(value);
|
|
42307
|
+
if (!prefix) {
|
|
42308
|
+
return void 0;
|
|
42309
|
+
}
|
|
42310
|
+
const scopePath = prefix[1].replace(/\?\./g, ".");
|
|
42311
|
+
let index = prefix[0].length;
|
|
42312
|
+
let sawSeparator = false;
|
|
42313
|
+
if (value.startsWith("?.", index)) {
|
|
42314
|
+
index += 2;
|
|
42315
|
+
sawSeparator = true;
|
|
42316
|
+
} else if (value[index] === ".") {
|
|
42317
|
+
index += 1;
|
|
42318
|
+
sawSeparator = true;
|
|
42319
|
+
}
|
|
42320
|
+
let accessor;
|
|
42321
|
+
let variableName;
|
|
42322
|
+
if (value[index] === "[") {
|
|
42323
|
+
const close = findClosingBracket(value, index);
|
|
42324
|
+
if (close < 0) {
|
|
42325
|
+
return void 0;
|
|
42326
|
+
}
|
|
42327
|
+
const key = value.slice(index + 1, close).trim();
|
|
42328
|
+
accessor = `[${key}]`;
|
|
42329
|
+
const quote = key[0];
|
|
42330
|
+
const isQuotedLiteral = (quote === "'" || quote === '"') && key.length > 1 && key[key.length - 1] === quote;
|
|
42331
|
+
variableName = isQuotedLiteral ? key.slice(1, -1) : void 0;
|
|
42332
|
+
index = close + 1;
|
|
42333
|
+
} else {
|
|
42334
|
+
const identifier = /^[A-Za-z_$][A-Za-z0-9_$]*/.exec(value.slice(index));
|
|
42335
|
+
if (!identifier || !sawSeparator) {
|
|
42336
|
+
return void 0;
|
|
42337
|
+
}
|
|
42338
|
+
accessor = `.${identifier[0]}`;
|
|
42339
|
+
variableName = identifier[0];
|
|
42340
|
+
index += identifier[0].length;
|
|
42341
|
+
}
|
|
42342
|
+
if (!/^(?:\?\.|\.)dataSet(?![A-Za-z0-9_$])/.test(value.slice(index))) {
|
|
42343
|
+
return void 0;
|
|
42344
|
+
}
|
|
42345
|
+
const datasourceExpr = addOptionalChainingToPropertyPath(
|
|
42346
|
+
`fragment.${scopePath}${accessor}`.replace(/\?\./g, ".")
|
|
42347
|
+
);
|
|
42348
|
+
return { scopePath, datasourceExpr, variableName };
|
|
42349
|
+
}
|
|
42248
42350
|
|
|
42249
42351
|
// src/transpile/class-expression.util.ts
|
|
42250
42352
|
function transformClassWithMustacheExpressions(classes, options = {}) {
|
|
@@ -42327,7 +42429,14 @@ var EVENT_NAME_MAP = {
|
|
|
42327
42429
|
"on-dragenter": "on-dragEnter",
|
|
42328
42430
|
"on-dragleave": "on-dragLeave"
|
|
42329
42431
|
};
|
|
42330
|
-
var
|
|
42432
|
+
var convertMustacheTextToJsx = (textContent, isInsideTableColumn) => {
|
|
42433
|
+
return textContent.replace(/\{\{([\s\S]*?)\}\}/g, (_match, rawExpr) => {
|
|
42434
|
+
const expr = rawExpr.trim();
|
|
42435
|
+
const transformed = isInsideTableColumn ? transformTableColumnClassExpression(expr) : modifyExpression(expr);
|
|
42436
|
+
return `{${transformed}}`;
|
|
42437
|
+
});
|
|
42438
|
+
};
|
|
42439
|
+
var processTextContentForJSX = (textContent, isInsideTableColumn = false) => {
|
|
42331
42440
|
const trimmedContent = textContent.trim();
|
|
42332
42441
|
if (!trimmedContent) {
|
|
42333
42442
|
return "";
|
|
@@ -42335,6 +42444,9 @@ var processTextContentForJSX = (textContent) => {
|
|
|
42335
42444
|
if (/^[<>&]+$/.test(trimmedContent)) {
|
|
42336
42445
|
return trimmedContent.split("").map((char) => `{'${char}'}`).join("");
|
|
42337
42446
|
}
|
|
42447
|
+
if (trimmedContent.includes("{{") && trimmedContent.includes("}}")) {
|
|
42448
|
+
return convertMustacheTextToJsx(textContent, isInsideTableColumn);
|
|
42449
|
+
}
|
|
42338
42450
|
return textContent;
|
|
42339
42451
|
};
|
|
42340
42452
|
var parse5 = typeof esm_default === "function" ? esm_default : esm_default.parse;
|
|
@@ -42400,7 +42512,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42400
42512
|
this.transformers = /* @__PURE__ */ new Map();
|
|
42401
42513
|
this.componentNamesList = [];
|
|
42402
42514
|
this.transpile = (e, isPartOfPrefab, splitCode = true, oldContext) => {
|
|
42403
|
-
var _a, _b;
|
|
42515
|
+
var _a, _b, _c;
|
|
42404
42516
|
const tagName = e.tagName.toLowerCase();
|
|
42405
42517
|
const isHtmlElement = htmlElements.includes(tagName);
|
|
42406
42518
|
const isWebComponent = tagName.includes("-") && !tagName.startsWith("wm-");
|
|
@@ -42429,9 +42541,9 @@ var _Transpiler = class _Transpiler {
|
|
|
42429
42541
|
this.componentNamesList = [];
|
|
42430
42542
|
}
|
|
42431
42543
|
if (isHtmlElement) {
|
|
42432
|
-
result.markup = preTranspileHtmlElement(e);
|
|
42544
|
+
result.markup = preTranspileHtmlElement(e, !!((_c = oldContext == null ? void 0 : oldContext.data) == null ? void 0 : _c.isInsideTableColumn));
|
|
42433
42545
|
e.childNodes.forEach((c) => {
|
|
42434
|
-
var _a2;
|
|
42546
|
+
var _a2, _b2;
|
|
42435
42547
|
if (c && c.nodeType == NodeType2.ELEMENT_NODE) {
|
|
42436
42548
|
const cResult = this.transpile(c, isPartOfPrefab, splitCode);
|
|
42437
42549
|
(0, import_lodash5.assignIn)(result.components, cResult.components);
|
|
@@ -42443,7 +42555,10 @@ var _Transpiler = class _Transpiler {
|
|
|
42443
42555
|
result.components = { ...result.components, ...cResult.components };
|
|
42444
42556
|
if (cResult.pageEvents) result.pageEvents = cResult.pageEvents;
|
|
42445
42557
|
} else if (c && c.nodeType == NodeType2.TEXT_NODE) {
|
|
42446
|
-
const processedContent = processTextContentForJSX(
|
|
42558
|
+
const processedContent = processTextContentForJSX(
|
|
42559
|
+
c.text,
|
|
42560
|
+
!!((_b2 = oldContext == null ? void 0 : oldContext.data) == null ? void 0 : _b2.isInsideTableColumn)
|
|
42561
|
+
);
|
|
42447
42562
|
if (processedContent) {
|
|
42448
42563
|
result.markup += processedContent;
|
|
42449
42564
|
}
|
|
@@ -42463,7 +42578,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42463
42578
|
result.imports.push(...resolvedTransformer.imports(e, context));
|
|
42464
42579
|
result.markup += resolvedTransformer.pre(e, context).replace(new RegExp(FORMAT_CONTEXT, "g"), "") + (e.childNodes.length > 0 ? "\n" : "");
|
|
42465
42580
|
e.childNodes.forEach((c) => {
|
|
42466
|
-
var _a2;
|
|
42581
|
+
var _a2, _b2;
|
|
42467
42582
|
if (c && c.nodeType == NodeType2.ELEMENT_NODE) {
|
|
42468
42583
|
const cResult = this.transpile(c, isPartOfPrefab, splitCode, context);
|
|
42469
42584
|
(0, import_lodash5.assignIn)(result.components, cResult.components);
|
|
@@ -42476,7 +42591,10 @@ var _Transpiler = class _Transpiler {
|
|
|
42476
42591
|
result.components = { ...result.components, ...cResult.components };
|
|
42477
42592
|
if (cResult.pageEvents) result.pageEvents = cResult.pageEvents;
|
|
42478
42593
|
} else if (c && c.nodeType == NodeType2.TEXT_NODE) {
|
|
42479
|
-
const processedContent = processTextContentForJSX(
|
|
42594
|
+
const processedContent = processTextContentForJSX(
|
|
42595
|
+
c.text,
|
|
42596
|
+
!!((_b2 = context.data) == null ? void 0 : _b2.isInsideTableColumn)
|
|
42597
|
+
);
|
|
42480
42598
|
if (processedContent) {
|
|
42481
42599
|
result.markup += processedContent;
|
|
42482
42600
|
}
|
|
@@ -42616,6 +42734,7 @@ var _Transpiler = class _Transpiler {
|
|
|
42616
42734
|
let value = e.attributes[name];
|
|
42617
42735
|
if (value.startsWith("bind:")) {
|
|
42618
42736
|
value = value.substring(5).trim();
|
|
42737
|
+
value = decodeHTMLEntities(value);
|
|
42619
42738
|
value = value.replace(/;+$/, "");
|
|
42620
42739
|
const simpleSinglePattern = /^\$\[([^\]]+)\]$/;
|
|
42621
42740
|
const match = value.match(simpleSinglePattern);
|
|
@@ -42762,9 +42881,9 @@ var _Transpiler = class _Transpiler {
|
|
|
42762
42881
|
const transformCondition = (exp) => isInsideTableColumn ? transformTableColumnClassExpression(exp) : addOptionalChaining(exp);
|
|
42763
42882
|
if (conditionalClasses.startsWith("{") && conditionalClasses.endsWith("}")) {
|
|
42764
42883
|
conditionalClasses = conditionalClasses.slice(1, -1);
|
|
42765
|
-
let expressions = conditionalClasses
|
|
42766
|
-
const [className, condition] = expression
|
|
42767
|
-
if (
|
|
42884
|
+
let expressions = splitTopLevel(conditionalClasses, ",").map((expression) => {
|
|
42885
|
+
const [className, condition] = splitTopLevel(expression, ":", 2);
|
|
42886
|
+
if (condition === void 0) {
|
|
42768
42887
|
return `'${className.trim()}'`;
|
|
42769
42888
|
}
|
|
42770
42889
|
return `(${transformCondition(condition.trim())} ? ${className.replace(/'$/, " '")} : '')`;
|
|
@@ -43024,21 +43143,25 @@ var _Transpiler = class _Transpiler {
|
|
|
43024
43143
|
return attrName.endsWith("url") || attrName.endsWith("src");
|
|
43025
43144
|
}
|
|
43026
43145
|
transformAttr(tagName, name, value, context, tx) {
|
|
43027
|
-
var _a, _b, _c;
|
|
43146
|
+
var _a, _b, _c, _d;
|
|
43028
43147
|
if (name === "styles" || name === "style" || name === "className") ; else if (name === "groupby" && value.includes("(")) {
|
|
43029
43148
|
value = `${this.findArgs(value, context)} => ${value}`;
|
|
43030
43149
|
value = `{${value}}`;
|
|
43031
43150
|
} else if (name.startsWith("on-")) {
|
|
43032
43151
|
name = "on" + name.charAt(3).toUpperCase() + name.substr(4);
|
|
43033
|
-
|
|
43034
|
-
|
|
43035
|
-
|
|
43036
|
-
|
|
43152
|
+
const standaloneDollarItem = /(?<=[(,]\s*)\$item(?=\s*[,)])/;
|
|
43153
|
+
const standaloneBareItem = /(?<=[(,]\s*)item(?=\s*[,)])/;
|
|
43154
|
+
if (((_a = context == null ? void 0 : context.get) == null ? void 0 : _a.call(context, "isInsideList")) && standaloneDollarItem.test(value) && standaloneBareItem.test(value)) {
|
|
43155
|
+
value = value.replace(new RegExp(standaloneDollarItem, "g"), "$eventItem");
|
|
43156
|
+
}
|
|
43157
|
+
value = value.replace(/(?<!\$)\bitem\b(?=[,)])/g, "$item");
|
|
43158
|
+
value = value.replace(/(?<!\$)\bitem\b\./g, "$item.");
|
|
43159
|
+
if ((_b = context == null ? void 0 : context.get) == null ? void 0 : _b.call(context, "isInsideList")) {
|
|
43037
43160
|
value = value.replace(/;+\s*$/, "").trim();
|
|
43038
43161
|
value = addFragmentOptionalChaining(value, false);
|
|
43039
43162
|
}
|
|
43040
43163
|
const args = this.findArgs(value, context);
|
|
43041
|
-
if ((
|
|
43164
|
+
if ((_c = context == null ? void 0 : context.get) == null ? void 0 : _c.call(context, "isInsideTableColumn")) {
|
|
43042
43165
|
value = value.replace(/\brow\b/g, "rowData");
|
|
43043
43166
|
}
|
|
43044
43167
|
const arrowParams = this.parseArrowParamNames(args);
|
|
@@ -43061,7 +43184,7 @@ var _Transpiler = class _Transpiler {
|
|
|
43061
43184
|
let exp = `${value.substring(5)}`;
|
|
43062
43185
|
exp = exp.replace("fragment.Page", "fragment");
|
|
43063
43186
|
const isProgressCircleDatavalue = tagName === "wm-progress-circle" && name === "datavalue";
|
|
43064
|
-
exp = ((
|
|
43187
|
+
exp = ((_d = context == null ? void 0 : context.get) == null ? void 0 : _d.call(context, "isInsideTableColumn")) ? transformTableColumnClassExpression(exp) : modifyExpression(exp);
|
|
43065
43188
|
exp = resolveFormatContext(exp, context);
|
|
43066
43189
|
exp = this.convertStringBooleanTernary(exp);
|
|
43067
43190
|
if (!exp) {
|
|
@@ -43295,8 +43418,8 @@ var createExpression = (element, attrName) => {
|
|
|
43295
43418
|
let displayexpression = element.attrs[attrName];
|
|
43296
43419
|
if (displayexpression == null ? void 0 : displayexpression.startsWith("bind:")) {
|
|
43297
43420
|
displayexpression = displayexpression.substring(5).trim();
|
|
43298
|
-
displayexpression = displayexpression.replace(/;+$/, "");
|
|
43299
43421
|
displayexpression = decodeHTMLEntities(displayexpression);
|
|
43422
|
+
displayexpression = displayexpression.replace(/;+$/, "");
|
|
43300
43423
|
displayexpression = transformDollarBracketSyntax(displayexpression);
|
|
43301
43424
|
displayexpression = displayexpression.replace(/fragment\.\$item/g, "$item");
|
|
43302
43425
|
displayexpression = displayexpression.replace(/fragment\.\$index/g, "$index");
|
|
@@ -43325,7 +43448,7 @@ var createExpression = (element, attrName) => {
|
|
|
43325
43448
|
return `{($item) => (${transformedExp})}`;
|
|
43326
43449
|
}
|
|
43327
43450
|
};
|
|
43328
|
-
var preTranspileHtmlElement = (e) => {
|
|
43451
|
+
var preTranspileHtmlElement = (e, isInsideTableColumn = false) => {
|
|
43329
43452
|
const styleObj = style_transformer_default(e, (propName) => {
|
|
43330
43453
|
return true;
|
|
43331
43454
|
}) || {};
|
|
@@ -43333,6 +43456,14 @@ var preTranspileHtmlElement = (e) => {
|
|
|
43333
43456
|
const value = e.getAttribute(attr);
|
|
43334
43457
|
if (!value) return `${attr}=""`;
|
|
43335
43458
|
if (attr === "class") {
|
|
43459
|
+
if (value.includes("{{") && value.includes("}}")) {
|
|
43460
|
+
const mustacheClassName = transformClassWithMustacheExpressions(value, {
|
|
43461
|
+
isInsideTableColumn
|
|
43462
|
+
});
|
|
43463
|
+
if (mustacheClassName) {
|
|
43464
|
+
return `className=${mustacheClassName}`;
|
|
43465
|
+
}
|
|
43466
|
+
}
|
|
43336
43467
|
return `className="${value}"`;
|
|
43337
43468
|
} else if (attr === "style") {
|
|
43338
43469
|
const styleObject = convertStyleStringToObject(value);
|
|
@@ -43402,6 +43533,12 @@ var label_transformer_default = {
|
|
|
43402
43533
|
};
|
|
43403
43534
|
|
|
43404
43535
|
// src/transpile/components/layout/layout-region-factory.ts
|
|
43536
|
+
var isOnlyWmParamChildren = (element) => {
|
|
43537
|
+
const elementChildren = element.childNodes.filter(
|
|
43538
|
+
(node) => node.nodeType === NodeType.ELEMENT_NODE
|
|
43539
|
+
);
|
|
43540
|
+
return elementChildren.length > 0 && elementChildren.every((node) => node.tagName === "WM-PARAM");
|
|
43541
|
+
};
|
|
43405
43542
|
var partialContainerImport = [
|
|
43406
43543
|
{
|
|
43407
43544
|
name: "WmPartialContainer",
|
|
@@ -43417,9 +43554,7 @@ function createLayoutRegionTransformer(config) {
|
|
|
43417
43554
|
const content = element.getAttribute("content") || defaultContent;
|
|
43418
43555
|
const name = element.getAttribute("name") || defaultName;
|
|
43419
43556
|
const isPreview = context.get("preview") === true;
|
|
43420
|
-
const hasCustomContent = element.childNodes.some(
|
|
43421
|
-
(node) => node.nodeType === NodeType.ELEMENT_NODE
|
|
43422
|
-
);
|
|
43557
|
+
const hasCustomContent = element.childNodes.some((node) => node.nodeType === NodeType.ELEMENT_NODE) && !isOnlyWmParamChildren(element);
|
|
43423
43558
|
if (hasCustomContent) {
|
|
43424
43559
|
return `<${tag} ${transformAttrs(element, context)}>
|
|
43425
43560
|
`;
|
|
@@ -43435,9 +43570,7 @@ function createLayoutRegionTransformer(config) {
|
|
|
43435
43570
|
},
|
|
43436
43571
|
post: () => `</${tag}>`,
|
|
43437
43572
|
imports: (element, context) => {
|
|
43438
|
-
const hasCustomContent = element.childNodes.some(
|
|
43439
|
-
(node) => node.nodeType === NodeType.ELEMENT_NODE
|
|
43440
|
-
);
|
|
43573
|
+
const hasCustomContent = element.childNodes.some((node) => node.nodeType === NodeType.ELEMENT_NODE) && !isOnlyWmParamChildren(element);
|
|
43441
43574
|
if (hasCustomContent) {
|
|
43442
43575
|
return [...componentImports];
|
|
43443
43576
|
}
|
|
@@ -44031,10 +44164,10 @@ var createNavItemLabelExpression = (element) => {
|
|
|
44031
44164
|
let expression;
|
|
44032
44165
|
if (itemlabel.startsWith("bind:")) {
|
|
44033
44166
|
expression = itemlabel.substring(5);
|
|
44034
|
-
expression = expression.replace(
|
|
44035
|
-
|
|
44036
|
-
|
|
44037
|
-
|
|
44167
|
+
expression = expression.replace(
|
|
44168
|
+
/fragment\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g,
|
|
44169
|
+
(match, name) => FRAGMENT_SCOPED_NAMES.includes(name) ? match : `item.${name}`
|
|
44170
|
+
);
|
|
44038
44171
|
} else {
|
|
44039
44172
|
expression = `item.${itemlabel}`;
|
|
44040
44173
|
}
|
|
@@ -44335,7 +44468,7 @@ var list_transformer_default = {
|
|
|
44335
44468
|
true,
|
|
44336
44469
|
widgetName
|
|
44337
44470
|
);
|
|
44338
|
-
transformRepeatChildAttr(template, dataSet.substring(5), "$item");
|
|
44471
|
+
transformRepeatChildAttr(template, dataSet.substring(5), "$item", ["dataset", "datasource"]);
|
|
44339
44472
|
if ((_a = element.getAttribute("disableitem")) == null ? void 0 : _a.startsWith("bind:")) {
|
|
44340
44473
|
const disabelItemExp = replaceAll(
|
|
44341
44474
|
((_b = element.getAttribute("disableitem")) == null ? void 0 : _b.substring(5)) || "",
|
|
@@ -44370,7 +44503,7 @@ var list_transformer_default = {
|
|
|
44370
44503
|
`Variables.${variableName}.dataSet`
|
|
44371
44504
|
];
|
|
44372
44505
|
dataPatterns.forEach((pattern) => {
|
|
44373
|
-
transformRepeatChildAttr(template, pattern, "$item");
|
|
44506
|
+
transformRepeatChildAttr(template, pattern, "$item", ["dataset", "datasource"]);
|
|
44374
44507
|
});
|
|
44375
44508
|
}
|
|
44376
44509
|
}
|
|
@@ -44391,6 +44524,7 @@ var list_transformer_default = {
|
|
|
44391
44524
|
renderItem={($item:Record<string, any>, $index:number, list:Record<string, any>[] ,getCurrentItemWidgets :any) => {
|
|
44392
44525
|
const currentItemWidgetsRef = React.useRef({})
|
|
44393
44526
|
const currentItemWidgets = getCurrentItemWidgets($index);
|
|
44527
|
+
const item = $item;
|
|
44394
44528
|
currentItemWidgetsRef.current = currentItemWidgets;
|
|
44395
44529
|
const $first = $index === 0;
|
|
44396
44530
|
const $last = list && $index === list.length - 1;
|
|
@@ -45265,10 +45399,10 @@ var applyAttr = (e, replace2, replaceWith) => {
|
|
|
45265
45399
|
});
|
|
45266
45400
|
e.childNodes.forEach((c) => isHTMLElement(c) && applyAttr(c, replace2, replaceWith));
|
|
45267
45401
|
};
|
|
45402
|
+
var isInsideDialog = (element) => !!getParentNode(element, "wm-dialog");
|
|
45268
45403
|
var dialog_actions_transformer_default = {
|
|
45269
45404
|
pre: (element, context) => {
|
|
45270
|
-
|
|
45271
|
-
if (!(parent == null ? void 0 : parent.rawTagName.includes("dialog"))) {
|
|
45405
|
+
if (!isInsideDialog(element)) {
|
|
45272
45406
|
Array.from(element.childNodes).forEach((child) => {
|
|
45273
45407
|
element.removeChild(child);
|
|
45274
45408
|
});
|
|
@@ -45285,15 +45419,13 @@ var dialog_actions_transformer_default = {
|
|
|
45285
45419
|
return `<WmDialogActions ${transformAttrs(element, context)}>`;
|
|
45286
45420
|
},
|
|
45287
45421
|
post: (element, context) => {
|
|
45288
|
-
|
|
45289
|
-
if (!(parent == null ? void 0 : parent.rawTagName.includes("dialog"))) {
|
|
45422
|
+
if (!isInsideDialog(element)) {
|
|
45290
45423
|
return ``;
|
|
45291
45424
|
}
|
|
45292
45425
|
return "</WmDialogActions>";
|
|
45293
45426
|
},
|
|
45294
45427
|
imports: (element, context) => {
|
|
45295
|
-
|
|
45296
|
-
if (!(parent == null ? void 0 : parent.rawTagName.includes("dialog"))) {
|
|
45428
|
+
if (!isInsideDialog(element)) {
|
|
45297
45429
|
return [];
|
|
45298
45430
|
}
|
|
45299
45431
|
return imports37;
|
|
@@ -45357,12 +45489,16 @@ var tabs_transformer_default = {
|
|
|
45357
45489
|
transformRepeatChildData(
|
|
45358
45490
|
repeatTemplate,
|
|
45359
45491
|
dataSet.substring(5) + "[0]",
|
|
45360
|
-
"list_item"
|
|
45492
|
+
"list_item",
|
|
45493
|
+
true,
|
|
45494
|
+
widgetName
|
|
45361
45495
|
);
|
|
45362
45496
|
transformRepeatChildData(
|
|
45363
45497
|
repeatTemplate,
|
|
45364
45498
|
dataSet.substring(5) + "[$i]",
|
|
45365
|
-
"list_item"
|
|
45499
|
+
"list_item",
|
|
45500
|
+
true,
|
|
45501
|
+
widgetName
|
|
45366
45502
|
);
|
|
45367
45503
|
repeatTemplate.childNodes = element.childNodes;
|
|
45368
45504
|
element.childNodes = [repeatTemplate];
|
|
@@ -45776,7 +45912,7 @@ var imports52 = [
|
|
|
45776
45912
|
];
|
|
45777
45913
|
var accordion_transformer_default = {
|
|
45778
45914
|
pre: (element, context) => {
|
|
45779
|
-
element.attrs["name"];
|
|
45915
|
+
const widgetName = element.attrs["name"];
|
|
45780
45916
|
let dataSet = element.getAttribute("dataset");
|
|
45781
45917
|
if (dataSet && dataSet.startsWith("bind:") && element.getAttribute("type") === "dynamic") {
|
|
45782
45918
|
dataSet = dataSet.substring(5);
|
|
@@ -45786,10 +45922,34 @@ var accordion_transformer_default = {
|
|
|
45786
45922
|
accordionPane.setAttribute("active", "bind:$item.active");
|
|
45787
45923
|
accordionPane.setAttribute("toggle", "bind:$item.toggle");
|
|
45788
45924
|
}
|
|
45789
|
-
transformRepeatChildData(
|
|
45790
|
-
|
|
45791
|
-
|
|
45792
|
-
|
|
45925
|
+
transformRepeatChildData(
|
|
45926
|
+
template,
|
|
45927
|
+
dataSet + "[0]",
|
|
45928
|
+
"repeat_item",
|
|
45929
|
+
true,
|
|
45930
|
+
widgetName
|
|
45931
|
+
);
|
|
45932
|
+
transformRepeatChildData(
|
|
45933
|
+
template,
|
|
45934
|
+
dataSet + "[$i]",
|
|
45935
|
+
"repeat_item",
|
|
45936
|
+
true,
|
|
45937
|
+
widgetName
|
|
45938
|
+
);
|
|
45939
|
+
transformRepeatChildData(
|
|
45940
|
+
template,
|
|
45941
|
+
dataSet + "[fragment.$i]",
|
|
45942
|
+
"repeat_item",
|
|
45943
|
+
true,
|
|
45944
|
+
widgetName
|
|
45945
|
+
);
|
|
45946
|
+
transformRepeatChildData(
|
|
45947
|
+
template,
|
|
45948
|
+
dataSet + "[fragment.$i]",
|
|
45949
|
+
"repeat_item",
|
|
45950
|
+
true,
|
|
45951
|
+
widgetName
|
|
45952
|
+
);
|
|
45793
45953
|
context.set("old_props", context.props);
|
|
45794
45954
|
context.props = ["$item", "$index"];
|
|
45795
45955
|
return `<WmAccordion listener={fragment} ${transformAttrs(element, context)} render={(($item:Record<string,any>,$index:number,data:Record<string,any>[])=>(`;
|
|
@@ -46988,18 +47148,16 @@ var table_transformer_default = {
|
|
|
46988
47148
|
const datasourceAttr = element.getAttribute("datasource");
|
|
46989
47149
|
const binddatasetAttr = element.getAttribute("binddataset");
|
|
46990
47150
|
if (datasetAttr && datasetAttr.includes(".dataSet")) {
|
|
46991
|
-
const
|
|
46992
|
-
|
|
46993
|
-
|
|
46994
|
-
|
|
46995
|
-
|
|
46996
|
-
|
|
46997
|
-
context.set("tableDatasetVariableName", variableName);
|
|
47151
|
+
const binding = parseVariableDataSetBinding(datasetAttr);
|
|
47152
|
+
if (binding) {
|
|
47153
|
+
const { scopePath, datasourceExpr, variableName } = binding;
|
|
47154
|
+
if (variableName) {
|
|
47155
|
+
context.set("tableDatasetVariableName", variableName);
|
|
47156
|
+
}
|
|
46998
47157
|
if (!datasourceAttr) {
|
|
46999
|
-
const datasourceExpr = `fragment.${scopePath}.${variableName}`.split(".").join("?.");
|
|
47000
47158
|
element.setAttribute("datasource", `{${datasourceExpr}}`);
|
|
47001
47159
|
}
|
|
47002
|
-
if (!binddatasetAttr) {
|
|
47160
|
+
if (!binddatasetAttr && variableName) {
|
|
47003
47161
|
element.setAttribute("binddataset", `${scopePath}.${variableName}.dataSet`);
|
|
47004
47162
|
}
|
|
47005
47163
|
}
|