@wavemaker-ai/react-codegen 1.0.0-rc.647684 → 12.0.0-rc.335

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.
Files changed (69) hide show
  1. package/command.js +52 -7
  2. package/command.js.map +1 -1
  3. package/dist/transpiler/index.d.mts +42 -1
  4. package/dist/transpiler/index.mjs +682 -90
  5. package/dist/transpiler/index.mjs.map +1 -1
  6. package/dist/transpiler/wm-styles.css +10 -20
  7. package/index.js +7 -0
  8. package/index.js.map +1 -1
  9. package/package-lock.json +102 -102
  10. package/package.json +1 -1
  11. package/src/app.generator.js +223 -35
  12. package/src/app.generator.js.map +1 -1
  13. package/src/handlebar-helpers.js +32 -0
  14. package/src/handlebar-helpers.js.map +1 -1
  15. package/src/increment-builder.js +32 -2
  16. package/src/increment-builder.js.map +1 -1
  17. package/src/profiles/profile.js +2 -0
  18. package/src/profiles/profile.js.map +1 -1
  19. package/src/profiles/web-preview.profile.js +4 -0
  20. package/src/profiles/web-preview.profile.js.map +1 -1
  21. package/src/services/designtime-collector.js +235 -0
  22. package/src/services/designtime-collector.js.map +1 -0
  23. package/src/services/doc-normalizer.js +185 -0
  24. package/src/services/doc-normalizer.js.map +1 -0
  25. package/src/services/method-emitter.js +367 -0
  26. package/src/services/method-emitter.js.map +1 -0
  27. package/src/services/model-emitter.js +281 -0
  28. package/src/services/model-emitter.js.map +1 -0
  29. package/src/services/schema-to-ts.js +50 -0
  30. package/src/services/schema-to-ts.js.map +1 -0
  31. package/src/services/service.generator.js +223 -0
  32. package/src/services/service.generator.js.map +1 -0
  33. package/src/transpile/bind.ex.transformer.js +4 -1
  34. package/src/transpile/bind.ex.transformer.js.map +1 -1
  35. package/src/transpile/components/container/accordion.transformer.js +4 -4
  36. package/src/transpile/components/container/accordion.transformer.js.map +1 -1
  37. package/src/transpile/components/container/tabs.transformer.js +4 -2
  38. package/src/transpile/components/container/tabs.transformer.js.map +1 -1
  39. package/src/transpile/components/data/list/list-transformer.js +7 -2
  40. package/src/transpile/components/data/list/list-transformer.js.map +1 -1
  41. package/src/transpile/components/data/table/table.transformer.js +14 -20
  42. package/src/transpile/components/data/table/table.transformer.js.map +1 -1
  43. package/src/transpile/components/data/table/utils.js +90 -0
  44. package/src/transpile/components/data/table/utils.js.map +1 -1
  45. package/src/transpile/components/dialogs/dialog-actions.transformer.js +4 -6
  46. package/src/transpile/components/dialogs/dialog-actions.transformer.js.map +1 -1
  47. package/src/transpile/components/dialogs/dialog.transformer.js +14 -3
  48. package/src/transpile/components/dialogs/dialog.transformer.js.map +1 -1
  49. package/src/transpile/components/layout/layout-region-factory.js +8 -2
  50. package/src/transpile/components/layout/layout-region-factory.js.map +1 -1
  51. package/src/transpile/components/nav/nav.transformer.js +3 -5
  52. package/src/transpile/components/nav/nav.transformer.js.map +1 -1
  53. package/src/transpile/components/utils.js +11 -5
  54. package/src/transpile/components/utils.js.map +1 -1
  55. package/src/transpile/transpile.js +62 -21
  56. package/src/transpile/transpile.js.map +1 -1
  57. package/src/transpile/variables-template-source.js +2 -2
  58. package/src/transpile/variables-template-source.js.map +1 -1
  59. package/src/utils.browser.js +51 -6
  60. package/src/utils.browser.js.map +1 -1
  61. package/src/variables/variable.transformer.js +623 -12
  62. package/src/variables/variable.transformer.js.map +1 -1
  63. package/templates/project/app/client.layout.tsx +7 -7
  64. package/templates/project/app/components.css +10 -0
  65. package/templates/project/app/widgetInlineStylesOverride.css +0 -20
  66. package/templates/project/package.json +6 -5
  67. package/templates/project/services/base.service.ts +361 -0
  68. package/templates/service/service-class.hbs +19 -0
  69. package/templates/variables.template +67 -1
@@ -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, parse7) {
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 = parse7();
8140
+ result = parse8();
8141
8141
  this.state.noArrowParamsConversionAt.pop();
8142
8142
  } else {
8143
- result = parse7();
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 parse6(input, options) {
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 = parse6;
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 parse6(formula) {
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 = parse6;
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 = parse6(content);
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 = parse6(content, options);
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 = parse6(node);
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 = parse6(html);
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 parse6(data, options) {
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 = parse6;
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) => {
@@ -39346,14 +39375,17 @@ var removeLeadingCssBlockComments = (rule) => {
39346
39375
  }
39347
39376
  return { prefix, rest: rule.slice(idx) };
39348
39377
  };
39378
+ var CUSTOM_TAG_SELECTOR_PATTERN = /(^|[\s>+~,(])([a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]*)/g;
39379
+ var convertCustomTagSelectorsToClasses = (sel) => sel.replace(CUSTOM_TAG_SELECTOR_PATTERN, (_match, boundary, tag) => `${boundary}.${tag}`);
39349
39380
  var scopeSingleSelector = (selector, scopeClass) => {
39350
- const sel = selector.trim();
39351
- if (!sel) {
39352
- return sel;
39381
+ const trimmed = selector.trim();
39382
+ if (!trimmed) {
39383
+ return trimmed;
39353
39384
  }
39354
- if (sel.startsWith(":")) {
39355
- return sel;
39385
+ if (trimmed.startsWith(":")) {
39386
+ return trimmed;
39356
39387
  }
39388
+ const sel = convertCustomTagSelectorsToClasses(trimmed);
39357
39389
  const wmAppIndex = sel.search(/\.wm-app\b/);
39358
39390
  if (wmAppIndex !== -1) {
39359
39391
  if (sel.includes(`.${scopeClass}`)) {
@@ -39714,7 +39746,7 @@ var transform = (expr, scopeName = "this", mode = "attr") => {
39714
39746
  expr = convertHyphenatedPropsToBracketNotation(expr);
39715
39747
  try {
39716
39748
  const parser = new Parser$1(new Lexer());
39717
- let expressions = expr.split(";"), transformedExpressions = [];
39749
+ let expressions = splitTopLevel(expr, ";"), transformedExpressions = [];
39718
39750
  const $iExp = new RegExp("\\[" + scopeName + "\\.\\$i\\]", "g");
39719
39751
  expressions.forEach((currentExp) => {
39720
39752
  const ast = parser.parseBinding(currentExp, "", 0);
@@ -39742,6 +39774,54 @@ function resolveFormatContext(expression, context) {
39742
39774
  return expression.replace(/,\s*\{formatContext:''\}/g, "").replace(FORMAT_CONTEXT_REGEX, "");
39743
39775
  }
39744
39776
 
39777
+ // src/services/schema-to-ts.ts
39778
+ function toPascalCase(name) {
39779
+ const words = String(name || "").split(/[^a-zA-Z0-9]+/).filter(Boolean);
39780
+ if (!words.length) return "Model";
39781
+ let result = words.map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
39782
+ if (/^[0-9]/.test(result)) result = "_" + result;
39783
+ return result;
39784
+ }
39785
+ function buildServiceClassName(serviceId, tag) {
39786
+ const servicePascal = toPascalCase(serviceId || "");
39787
+ const serviceCore = servicePascal.endsWith("Service") ? servicePascal.slice(0, -"Service".length) : servicePascal;
39788
+ const core = tag === servicePascal || tag === serviceCore ? serviceCore : tag;
39789
+ return `${core}Service`;
39790
+ }
39791
+
39792
+ // src/services/doc-normalizer.ts
39793
+ function toCamelCaseIdentifier(name) {
39794
+ if (typeof name !== "string" || !/[^a-zA-Z0-9]/.test(name)) return name;
39795
+ const words = name.split(/[^a-zA-Z0-9]+/).filter(Boolean);
39796
+ if (!words.length) return name;
39797
+ let result = words.map((w, i) => i === 0 ? w : w.charAt(0).toUpperCase() + w.slice(1)).join("");
39798
+ if (/^[0-9]/.test(result)) result = "_" + result;
39799
+ return result;
39800
+ }
39801
+ function deriveMethodName(rawOperationId, prefixCandidates) {
39802
+ if (!rawOperationId) return "";
39803
+ for (const prefix of prefixCandidates) {
39804
+ if (!prefix) continue;
39805
+ const doubled = `${prefix}_${prefix}_`;
39806
+ if (rawOperationId.startsWith(doubled)) {
39807
+ return toCamelCaseIdentifier(rawOperationId.slice(prefix.length + 1));
39808
+ }
39809
+ }
39810
+ let operationId = rawOperationId;
39811
+ let strippedSomething = true;
39812
+ while (strippedSomething) {
39813
+ strippedSomething = false;
39814
+ for (const prefix of prefixCandidates) {
39815
+ if (prefix && operationId.startsWith(`${prefix}_`)) {
39816
+ operationId = operationId.slice(prefix.length + 1);
39817
+ strippedSomething = true;
39818
+ break;
39819
+ }
39820
+ }
39821
+ }
39822
+ return toCamelCaseIdentifier(operationId);
39823
+ }
39824
+
39745
39825
  // src/variables/variable.transformer.ts
39746
39826
  var import_lodash2 = __toESM(require_lodash());
39747
39827
  function bindingValueIsStatic(value) {
@@ -39774,6 +39854,28 @@ function isStaticParamsVariable(variable2) {
39774
39854
  }
39775
39855
  return filterExpressionsAreStatic(variable2.filterExpressions);
39776
39856
  }
39857
+ function simpleSingularize(plural) {
39858
+ const lower = plural.toLowerCase();
39859
+ if (lower.endsWith("ies")) return plural.substring(0, plural.length - 3) + "y";
39860
+ if (lower.endsWith("es")) return plural.substring(0, plural.length - 2);
39861
+ if (lower.endsWith("s")) return plural.substring(0, plural.length - 1);
39862
+ return plural;
39863
+ }
39864
+ function simplePluralize(singular) {
39865
+ if (!singular) return singular;
39866
+ const last = singular[singular.length - 1].toLowerCase();
39867
+ const prev = singular.length > 1 ? singular[singular.length - 2].toLowerCase() : null;
39868
+ const vowels = "aeiouy";
39869
+ if (last === "x" || last === "s") {
39870
+ return singular + "es";
39871
+ } else if (last === "y") {
39872
+ return prev !== null && vowels.includes(prev) ? singular + "s" : singular.slice(0, -1) + "ies";
39873
+ } else if (last === "h") {
39874
+ return prev !== null && (prev === "c" || prev === "s") ? singular + "es" : singular + "s";
39875
+ } else {
39876
+ return singular + "s";
39877
+ }
39878
+ }
39777
39879
  function parseStaticJsonValue(value) {
39778
39880
  const trimmedValue = value.trim();
39779
39881
  if (!trimmedValue.startsWith("{") && !trimmedValue.startsWith("[")) {
@@ -40183,9 +40285,166 @@ function transformModelVariable(variable2, scope) {
40183
40285
  tv.isList = !!variable2.isList;
40184
40286
  return tv;
40185
40287
  }
40186
- function transformServiceVariable(variable2, scope) {
40288
+ var capitalizeFirstLetter = (str) => {
40289
+ return str.charAt(0).toUpperCase() + str.slice(1);
40290
+ };
40291
+ var getServiceInstanceName = (className) => className.charAt(0).toLowerCase() + className.slice(1);
40292
+ function getServiceLocalName(serviceId, className) {
40293
+ const instanceName = getServiceInstanceName(className);
40294
+ if (!serviceId) {
40295
+ return instanceName;
40296
+ }
40297
+ const prefix = toPascalCase(serviceId);
40298
+ const core = prefix.endsWith("Service") ? prefix.slice(0, -"Service".length) : prefix;
40299
+ if (className.startsWith(core)) {
40300
+ return instanceName;
40301
+ }
40302
+ return getServiceInstanceName(`${core}${className}`);
40303
+ }
40304
+ function getServiceClassName(prefix) {
40305
+ if (!prefix || typeof prefix !== "string") return "Service";
40306
+ const base = prefix.replace(/[\s/\\\-_]+/g, "").trim();
40307
+ if (!base) return "Service";
40308
+ let basePascal = capitalizeFirstLetter(base);
40309
+ if (basePascal.endsWith("Controller")) {
40310
+ basePascal = basePascal.slice(0, -"Controller".length);
40311
+ }
40312
+ if (!basePascal) return "Service";
40313
+ return basePascal.endsWith("Service") ? basePascal : basePascal + "Service";
40314
+ }
40315
+ function toCamelCaseIdentifier2(name) {
40316
+ if (typeof name !== "string" || !/[^a-zA-Z0-9]/.test(name)) return name;
40317
+ const words = name.split(/[^a-zA-Z0-9]+/).filter(Boolean);
40318
+ if (!words.length) return name;
40319
+ let result = words.map((word, i) => i === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)).join("");
40320
+ if (/^[0-9]/.test(result)) result = "_" + result;
40321
+ return result;
40322
+ }
40323
+ function resolveServiceTag(serviceId, controller, serviceType) {
40324
+ const isLumpedOpenApiService = serviceType === "OpenAPIService" && (!controller || controller.toLowerCase() === "default");
40325
+ const base = isLumpedOpenApiService ? serviceId.endsWith("Service") ? serviceId.slice(0, -"Service".length) : serviceId : controller || serviceId;
40326
+ return base ? toPascalCase(base) : base;
40327
+ }
40328
+ function formatServiceDetails(variable2) {
40329
+ if (variable2.operationId) {
40330
+ const serviceName = variable2.service;
40331
+ let prefix;
40332
+ let invokeFnName;
40333
+ if (serviceName) {
40334
+ prefix = serviceName;
40335
+ const controllerRaw = variable2.controller ? `${variable2.controller}Controller` : void 0;
40336
+ const prefixCandidates = [serviceName, variable2.controller, controllerRaw].filter(
40337
+ Boolean
40338
+ );
40339
+ invokeFnName = deriveMethodName(variable2.operationId, prefixCandidates);
40340
+ } else {
40341
+ const sepIdx = variable2.operationId.indexOf("_");
40342
+ prefix = sepIdx >= 0 ? variable2.operationId.substring(0, sepIdx) : variable2.operationId;
40343
+ invokeFnName = sepIdx >= 0 ? variable2.operationId.substring(sepIdx + 1) : variable2.operationId;
40344
+ }
40345
+ invokeFnName = toCamelCaseIdentifier2(invokeFnName);
40346
+ const formattedServiceName = variable2.service ? buildServiceClassName(
40347
+ variable2.service,
40348
+ resolveServiceTag(variable2.service, variable2.controller, variable2.serviceType)
40349
+ ) : getServiceClassName(prefix);
40350
+ return {
40351
+ formattedServiceName,
40352
+ invokeFnName
40353
+ };
40354
+ }
40355
+ if (variable2.type && variable2.operation) {
40356
+ const entity = variable2.type;
40357
+ const singular = simpleSingularize(entity);
40358
+ const plural = simplePluralize(singular);
40359
+ const operationMap = {
40360
+ read: `filter${plural}`,
40361
+ insert: `create${singular}`,
40362
+ update: `edit${singular}`,
40363
+ delete: `delete${singular}`
40364
+ };
40365
+ const invokeFnName = operationMap[variable2.operation];
40366
+ if (!invokeFnName) return null;
40367
+ const formattedServiceName = variable2.liveSource ? buildServiceClassName(variable2.liveSource, capitalizeFirstLetter(entity)) : capitalizeFirstLetter(entity + "Service");
40368
+ return {
40369
+ formattedServiceName,
40370
+ invokeFnName
40371
+ };
40372
+ }
40373
+ return null;
40374
+ }
40375
+ function isServiceAvailable(className, validServiceClassNames) {
40376
+ return !validServiceClassNames || !className || validServiceClassNames.has(className);
40377
+ }
40378
+ function callArgExpression(arg, isLiveVariable, isBodyTypeQueryOrProcedure = false) {
40379
+ if (isBodyTypeQueryOrProcedure && arg.source.kind === "body") {
40380
+ return "params";
40381
+ }
40382
+ if (arg.source.kind === "pageable") {
40383
+ const props = arg.source.paramNames.map((wireName) => {
40384
+ const prop = wireName === "sort" ? "sort" : wireName === "size" ? "pageSize" : "pageNumber";
40385
+ return `${prop}: params?.[${JSON.stringify(wireName)}]`;
40386
+ }).join(", ");
40387
+ return `{ ${props} }`;
40388
+ }
40389
+ return `params?.[${JSON.stringify(liveVariableParamKey(arg, isLiveVariable))}]`;
40390
+ }
40391
+ function applyServiceCallShape(tv, lookupKey, methodArgsByOperation, servicePathByOperation, isLiveVariable = false, isBodyTypeQueryOrProcedure = false) {
40392
+ var _a;
40393
+ const importPath = servicePathByOperation == null ? void 0 : servicePathByOperation.get(lookupKey);
40394
+ if (importPath) {
40395
+ tv.serviceImportPath = importPath;
40396
+ const resolvedClassName = importPath.split("/").pop();
40397
+ if (resolvedClassName && resolvedClassName !== tv.serviceFileClass) {
40398
+ tv.serviceFile = resolvedClassName;
40399
+ tv.serviceFileClass = resolvedClassName;
40400
+ tv.serviceExportName = getServiceInstanceName(resolvedClassName);
40401
+ tv.serviceInstanceName = getServiceLocalName((_a = tv.service) != null ? _a : tv.liveSource, resolvedClassName);
40402
+ }
40403
+ }
40404
+ const args = methodArgsByOperation == null ? void 0 : methodArgsByOperation.get(lookupKey);
40405
+ if (!args) {
40406
+ return;
40407
+ }
40408
+ tv.hasResolvedCallArgs = true;
40409
+ tv.callArgs = args.map((arg) => callArgExpression(arg, isLiveVariable, isBodyTypeQueryOrProcedure));
40410
+ }
40411
+ function liveVariableParamKey(arg, isLiveVariable) {
40412
+ const swaggerName = arg.source.paramName;
40413
+ if (!isLiveVariable) {
40414
+ return swaggerName;
40415
+ }
40416
+ switch (arg.source.kind) {
40417
+ case "query":
40418
+ return swaggerName === "q" ? "data" : swaggerName;
40419
+ case "body":
40420
+ case "formData":
40421
+ return "data";
40422
+ case "path":
40423
+ return "id";
40424
+ default:
40425
+ return swaggerName;
40426
+ }
40427
+ }
40428
+ function transformServiceVariable(variable2, scope, validServiceClassNames, methodArgsByOperation, methodNameByOperation, servicePathByOperation) {
40429
+ var _a;
40430
+ const serviceDetails = formatServiceDetails(variable2);
40431
+ let skipInvokeHttp = false;
40432
+ if (!isServiceAvailable(serviceDetails == null ? void 0 : serviceDetails.formattedServiceName, validServiceClassNames)) {
40433
+ console.warn(
40434
+ `ServiceVariable "${variable2.name}" references service "${variable2.service}" (${serviceDetails == null ? void 0 : serviceDetails.formattedServiceName}), which was not generated. Emitting the variable without an invokeHttp \u2014 the runtime falls back to its own transport.`
40435
+ );
40436
+ skipInvokeHttp = true;
40437
+ }
40438
+ const operationKey = `${variable2.service}::${variable2.operationId}`;
40439
+ if (servicePathByOperation && !servicePathByOperation.has(operationKey)) {
40440
+ console.warn(
40441
+ `ServiceVariable "${variable2.name}" references operation "${variable2.operationId}" on service "${variable2.service}", which has no such operation. Emitting the variable without an invokeHttp \u2014 the runtime falls back to its own transport.`
40442
+ );
40443
+ skipInvokeHttp = true;
40444
+ }
40187
40445
  const tv = transformVariable(variable2, scope);
40188
40446
  tv.classname = "ServiceVariable";
40447
+ tv.hasInvokeHttp = !skipInvokeHttp;
40189
40448
  tv.operationId = variable2.operationId;
40190
40449
  tv.isList = !!variable2.isList;
40191
40450
  tv.inFlightBehavior = variable2.inFlightBehavior;
@@ -40199,6 +40458,21 @@ function transformServiceVariable(variable2, scope) {
40199
40458
  tv.autoUpdate = variable2.autoUpdate;
40200
40459
  tv.orderBy = variable2.orderBy;
40201
40460
  tv.isStaticParams = isStaticParamsVariable(variable2);
40461
+ tv.serviceFile = serviceDetails == null ? void 0 : serviceDetails.formattedServiceName;
40462
+ tv.serviceFileClass = serviceDetails == null ? void 0 : serviceDetails.formattedServiceName;
40463
+ tv.serviceExportName = serviceDetails && getServiceInstanceName(serviceDetails.formattedServiceName);
40464
+ tv.serviceInstanceName = serviceDetails && getServiceLocalName(variable2.service, serviceDetails.formattedServiceName);
40465
+ const lookupKey = `${variable2.service}::${variable2.operationId}`;
40466
+ tv.invokeFnName = (_a = methodNameByOperation == null ? void 0 : methodNameByOperation.get(lookupKey)) != null ? _a : serviceDetails == null ? void 0 : serviceDetails.invokeFnName;
40467
+ const isBodyTypeQueryOrProcedure = ["QueryExecution", "ProcedureExecution"].includes(variable2.controller) && ["put", "post"].includes(variable2.operationType);
40468
+ applyServiceCallShape(
40469
+ tv,
40470
+ lookupKey,
40471
+ methodArgsByOperation,
40472
+ servicePathByOperation,
40473
+ false,
40474
+ isBodyTypeQueryOrProcedure
40475
+ );
40202
40476
  return tv;
40203
40477
  }
40204
40478
  function transformNavigationAction(variable2, scope) {
@@ -40228,9 +40502,11 @@ function transformNotificationAction(variable2, scope, imports102) {
40228
40502
  tv.classname = "NotificationAction";
40229
40503
  tv.group = "action";
40230
40504
  tv.operation = variable2.operation;
40231
- const partialContent = Array.isArray(variable2.dataBinding) ? variable2.dataBinding.filter((binding) => {
40232
- return binding.target === "page";
40233
- })[0] : null;
40505
+ const bindings = Array.isArray(variable2.dataBinding) ? variable2.dataBinding : [];
40506
+ const getBinding = (target) => bindings.find((b) => b.target === target);
40507
+ const contentBinding = getBinding("content");
40508
+ const rendersPartial = contentBinding ? contentBinding.value === "page" : variable2.operation !== "toast";
40509
+ const partialContent = rendersPartial ? getBinding("page") : null;
40234
40510
  if (variable2.onOk || variable2.onClick) {
40235
40511
  tv.onOk = appendIfNotEmpty(bind_ex_transformer_default(variable2.onOk || variable2.onClick, scope, "event"));
40236
40512
  }
@@ -40286,9 +40562,61 @@ function transformLogoutVariable(variable2, scope) {
40286
40562
  tv.redirectTo = variable2.redirectTo;
40287
40563
  return tv;
40288
40564
  }
40289
- function transformLiveVariable(variable2, scope) {
40565
+ function findOperationKeyByMethodName(serviceName, methodName, methodNameByOperation) {
40566
+ if (!serviceName || !methodName || !methodNameByOperation) {
40567
+ return void 0;
40568
+ }
40569
+ const prefix = `${serviceName}::`;
40570
+ for (const [key, name] of methodNameByOperation) {
40571
+ if (name === methodName && key.startsWith(prefix)) {
40572
+ return key;
40573
+ }
40574
+ }
40575
+ return void 0;
40576
+ }
40577
+ function findLiveOperationKeyByVerb(liveSource, entity, verbTokens, methodNameByOperation) {
40578
+ if (!liveSource || !entity || !methodNameByOperation) {
40579
+ return void 0;
40580
+ }
40581
+ const tagPrefix = `${liveSource}::${entity}Controller_`;
40582
+ let best;
40583
+ for (const key of methodNameByOperation.keys()) {
40584
+ if (!key.startsWith(tagPrefix)) continue;
40585
+ const verbAndName = key.slice(tagPrefix.length);
40586
+ if (!verbTokens.some((verb) => verbAndName.startsWith(verb))) continue;
40587
+ if (!best || key.length < best.length) {
40588
+ best = key;
40589
+ }
40590
+ }
40591
+ return best;
40592
+ }
40593
+ var LIVE_OPERATION_VERBS = {
40594
+ readTableData: ["find"],
40595
+ searchTableDataWithQuery: ["filter"],
40596
+ searchTableData: ["search"],
40597
+ insertTableData: ["create"],
40598
+ updateTableData: ["edit"],
40599
+ deleteTableData: ["delete"]
40600
+ };
40601
+ var LIVE_DEFAULT_ACTION_BY_OPERATION = {
40602
+ read: "searchTableDataWithQuery",
40603
+ insert: "insertTableData",
40604
+ update: "updateTableData",
40605
+ delete: "deleteTableData"
40606
+ };
40607
+ function transformLiveVariable(variable2, scope, validServiceClassNames, methodArgsByOperation, methodNameByOperation, servicePathByOperation) {
40608
+ var _a, _b;
40609
+ const serviceDetails = formatServiceDetails(variable2);
40610
+ let skipInvokeHttp = false;
40611
+ if (serviceDetails && !isServiceAvailable(serviceDetails.formattedServiceName, validServiceClassNames)) {
40612
+ console.warn(
40613
+ `LiveVariable "${variable2.name}" targets entity "${variable2.type}" (${serviceDetails.formattedServiceName}), which was not generated. Emitting the variable without an invokeHttp \u2014 the runtime falls back to its own transport.`
40614
+ );
40615
+ skipInvokeHttp = true;
40616
+ }
40290
40617
  const tv = transformVariable(variable2, scope);
40291
40618
  tv.classname = "LiveVariable";
40619
+ tv.hasInvokeHttp = !skipInvokeHttp;
40292
40620
  tv.isList = !!variable2.isList;
40293
40621
  tv.inFlightBehavior = variable2.inFlightBehavior;
40294
40622
  tv.maxResults = variable2.maxResults;
@@ -40305,9 +40633,117 @@ function transformLiveVariable(variable2, scope) {
40305
40633
  tv.filterExpressions = variable2.filterExpressions;
40306
40634
  tv._id = variable2._id;
40307
40635
  tv.isStaticParams = isStaticParamsVariable(variable2);
40636
+ if (serviceDetails) {
40637
+ tv.serviceFile = serviceDetails.formattedServiceName;
40638
+ tv.serviceFileClass = serviceDetails.formattedServiceName;
40639
+ tv.serviceExportName = getServiceInstanceName(serviceDetails.formattedServiceName);
40640
+ tv.serviceInstanceName = getServiceLocalName(
40641
+ variable2.liveSource,
40642
+ serviceDetails.formattedServiceName
40643
+ );
40644
+ tv.invokeFnName = serviceDetails.invokeFnName;
40645
+ let lookupKey = findOperationKeyByMethodName(
40646
+ variable2.liveSource,
40647
+ serviceDetails.invokeFnName,
40648
+ methodNameByOperation
40649
+ );
40650
+ if (!lookupKey) {
40651
+ lookupKey = findLiveOperationKeyByVerb(
40652
+ variable2.liveSource,
40653
+ variable2.type,
40654
+ (_a = LIVE_OPERATION_VERBS[LIVE_DEFAULT_ACTION_BY_OPERATION[variable2.operation]]) != null ? _a : [],
40655
+ methodNameByOperation
40656
+ );
40657
+ }
40658
+ if (lookupKey) {
40659
+ tv.invokeFnName = (_b = methodNameByOperation == null ? void 0 : methodNameByOperation.get(lookupKey)) != null ? _b : tv.invokeFnName;
40660
+ applyServiceCallShape(
40661
+ tv,
40662
+ lookupKey,
40663
+ methodArgsByOperation,
40664
+ servicePathByOperation,
40665
+ true
40666
+ // LiveVariable — its params object is keyed by the runtime's own DB-operation names
40667
+ );
40668
+ }
40669
+ tv.liveTargets = buildLiveTargets(
40670
+ variable2,
40671
+ methodArgsByOperation,
40672
+ methodNameByOperation,
40673
+ servicePathByOperation
40674
+ );
40675
+ }
40308
40676
  return tv;
40309
40677
  }
40310
- function transformCrudVariable(variable2, scope) {
40678
+ function buildLiveTargets(variable2, methodArgsByOperation, methodNameByOperation, servicePathByOperation) {
40679
+ var _a, _b, _c;
40680
+ const entity = variable2.type;
40681
+ if (!entity) {
40682
+ return void 0;
40683
+ }
40684
+ const singular = simpleSingularize(entity);
40685
+ const plural = simplePluralize(singular);
40686
+ const byAction = [
40687
+ // readTableData's template is `GET /<entity>?page=&size=&:sort` — the collection GET, which
40688
+ // the generator names find<Plural>. filter<Plural> is the POST /filter twin and belongs only
40689
+ // to the query-bearing actions.
40690
+ ["readTableData", `find${plural}`],
40691
+ ["searchTableDataWithQuery", `filter${plural}`],
40692
+ ["searchTableData", `search${plural}ByQueryFilters`],
40693
+ ["insertTableData", `create${singular}`],
40694
+ ["updateTableData", `edit${singular}`],
40695
+ ["deleteTableData", `delete${singular}`]
40696
+ ];
40697
+ const targets = [];
40698
+ for (const [action, guessedMethodName] of byAction) {
40699
+ let lookupKey = findOperationKeyByMethodName(
40700
+ variable2.liveSource,
40701
+ guessedMethodName,
40702
+ methodNameByOperation
40703
+ );
40704
+ if (!lookupKey) {
40705
+ lookupKey = findLiveOperationKeyByVerb(
40706
+ variable2.liveSource,
40707
+ entity,
40708
+ (_a = LIVE_OPERATION_VERBS[action]) != null ? _a : [],
40709
+ methodNameByOperation
40710
+ );
40711
+ }
40712
+ if (!lookupKey || servicePathByOperation && !servicePathByOperation.has(lookupKey)) {
40713
+ continue;
40714
+ }
40715
+ const methodName = (_b = methodNameByOperation == null ? void 0 : methodNameByOperation.get(lookupKey)) != null ? _b : guessedMethodName;
40716
+ const shape = {};
40717
+ applyServiceCallShape(shape, lookupKey, methodArgsByOperation, servicePathByOperation, true);
40718
+ targets.push({
40719
+ action,
40720
+ invokeFnName: methodName,
40721
+ callArgs: (_c = shape.callArgs) != null ? _c : [],
40722
+ hasResolvedCallArgs: !!shape.hasResolvedCallArgs
40723
+ });
40724
+ }
40725
+ return targets.length ? targets : void 0;
40726
+ }
40727
+ function buildCrudTargets(variable2, crudOperationsById) {
40728
+ const group = crudOperationsById == null ? void 0 : crudOperationsById.get(variable2.crudOperationId);
40729
+ if (!group) {
40730
+ return void 0;
40731
+ }
40732
+ const targets = Object.entries(group).map(([operationType, target]) => {
40733
+ const className = target.importPath.split("/").pop();
40734
+ return {
40735
+ operationType,
40736
+ importPath: target.importPath,
40737
+ serviceExportName: getServiceInstanceName(className),
40738
+ serviceInstanceName: getServiceLocalName(variable2.service, className),
40739
+ invokeFnName: target.methodName,
40740
+ // A CrudVariable is never a LiveVariable, so params are keyed by the swagger names.
40741
+ callArgs: target.args.map((arg) => callArgExpression(arg, false))
40742
+ };
40743
+ });
40744
+ return targets.length ? targets : void 0;
40745
+ }
40746
+ function transformCrudVariable(variable2, scope, crudOperationsById) {
40311
40747
  const tv = transformVariable(variable2, scope);
40312
40748
  tv._id = variable2._id;
40313
40749
  tv.name = variable2.name;
@@ -40332,15 +40768,23 @@ function transformCrudVariable(variable2, scope) {
40332
40768
  tv.dataBinding = variable2._transformedDataBinding || variable2.dataBinding;
40333
40769
  tv.classname = "CrudVariable";
40334
40770
  tv.group = "variable";
40771
+ tv.crudTargets = buildCrudTargets(variable2, crudOperationsById);
40335
40772
  tv.isStaticParams = isStaticParamsVariable(variable2);
40336
40773
  return tv;
40337
40774
  }
40338
- var variable_transformer_default = (variable2, scope, appUrl, imports102) => {
40775
+ var variable_transformer_default = (variable2, scope, appUrl, imports102, validServiceClassNames, methodArgsByOperation, methodNameByOperation, servicePathByOperation, crudOperationsById) => {
40339
40776
  switch (variable2.category) {
40340
40777
  case "wm.Variable":
40341
40778
  return transformModelVariable(variable2, scope);
40342
40779
  case "wm.ServiceVariable":
40343
- return transformServiceVariable(variable2, scope);
40780
+ return transformServiceVariable(
40781
+ variable2,
40782
+ scope,
40783
+ validServiceClassNames,
40784
+ methodArgsByOperation,
40785
+ methodNameByOperation,
40786
+ servicePathByOperation
40787
+ );
40344
40788
  case "wm.NavigationAction":
40345
40789
  return transformNavigationAction(variable2, scope);
40346
40790
  case "wm.TimerAction":
@@ -40354,9 +40798,16 @@ var variable_transformer_default = (variable2, scope, appUrl, imports102) => {
40354
40798
  case "wm.LogoutAction":
40355
40799
  return transformLogoutVariable(variable2, scope);
40356
40800
  case "wm.LiveVariable":
40357
- return transformLiveVariable(variable2, scope);
40801
+ return transformLiveVariable(
40802
+ variable2,
40803
+ scope,
40804
+ validServiceClassNames,
40805
+ methodArgsByOperation,
40806
+ methodNameByOperation,
40807
+ servicePathByOperation
40808
+ );
40358
40809
  case "wm.CrudVariable":
40359
- return transformCrudVariable(variable2, scope);
40810
+ return transformCrudVariable(variable2, scope, crudOperationsById);
40360
40811
  }
40361
40812
  return null;
40362
40813
  };
@@ -40583,9 +41034,12 @@ var transformRepeatChildData = (element, dataSetEx, prefix = "repeat_item", list
40583
41034
  if (isList) {
40584
41035
  return;
40585
41036
  }
40586
- let value = element.attributes[name];
40587
- value = removeOptionChaining(value);
40588
- element.setAttribute(name, replaceAll(value, dataSetEx, "$item"));
41037
+ const value = element.attributes[name];
41038
+ const stripped = removeOptionChaining(value);
41039
+ const replaced = replaceAll(stripped, dataSetEx, "$item");
41040
+ if (replaced !== stripped) {
41041
+ element.setAttribute(name, replaced);
41042
+ }
40589
41043
  if (list) {
40590
41044
  let genrateRandomString2 = function() {
40591
41045
  return Math.random().toString(36).substring(2, 5);
@@ -40602,12 +41056,15 @@ var transformRepeatChildData = (element, dataSetEx, prefix = "repeat_item", list
40602
41056
  }
40603
41057
  });
40604
41058
  };
40605
- var transformRepeatChildAttr = (element, replace2, replaceWith) => {
41059
+ var transformRepeatChildAttr = (element, replace2, replaceWith, skipAttrNames) => {
40606
41060
  Object.keys(element.attributes).forEach((name) => {
40607
41061
  const isList = isListAndField(element);
40608
41062
  if (isList) {
40609
41063
  return;
40610
41064
  }
41065
+ if (skipAttrNames == null ? void 0 : skipAttrNames.includes(name)) {
41066
+ return;
41067
+ }
40611
41068
  const value = element.attributes[name];
40612
41069
  const regex = new RegExp(
40613
41070
  replace2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "(?![a-zA-Z_$0-9])",
@@ -40621,7 +41078,7 @@ var transformRepeatChildAttr = (element, replace2, replaceWith) => {
40621
41078
  });
40622
41079
  element.childNodes.forEach((c) => {
40623
41080
  if (isHTMLElement(c)) {
40624
- transformRepeatChildAttr(c, replace2, replaceWith);
41081
+ transformRepeatChildAttr(c, replace2, replaceWith, skipAttrNames);
40625
41082
  }
40626
41083
  });
40627
41084
  };
@@ -42245,6 +42702,73 @@ function getFormatCellExpression(element, context) {
42245
42702
  transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
42246
42703
  return transformed;
42247
42704
  }
42705
+ var VARIABLES_SCOPE_PREFIX = /^bind:fragment(?:\?\.|\.)((?:App(?:\?\.|\.)(?:activePage(?:\?\.|\.))?)?Variables)/;
42706
+ function findClosingBracket(value, start) {
42707
+ let depth = 0;
42708
+ let quote = null;
42709
+ for (let i = start; i < value.length; i++) {
42710
+ const ch = value[i];
42711
+ if (quote) {
42712
+ if (ch === "\\") i++;
42713
+ else if (ch === quote) quote = null;
42714
+ continue;
42715
+ }
42716
+ if (ch === "'" || ch === '"' || ch === "`") {
42717
+ quote = ch;
42718
+ } else if (ch === "[") {
42719
+ depth++;
42720
+ } else if (ch === "]") {
42721
+ depth--;
42722
+ if (depth === 0) return i;
42723
+ }
42724
+ }
42725
+ return -1;
42726
+ }
42727
+ function parseVariableDataSetBinding(value) {
42728
+ const prefix = VARIABLES_SCOPE_PREFIX.exec(value);
42729
+ if (!prefix) {
42730
+ return void 0;
42731
+ }
42732
+ const scopePath = prefix[1].replace(/\?\./g, ".");
42733
+ let index = prefix[0].length;
42734
+ let sawSeparator = false;
42735
+ if (value.startsWith("?.", index)) {
42736
+ index += 2;
42737
+ sawSeparator = true;
42738
+ } else if (value[index] === ".") {
42739
+ index += 1;
42740
+ sawSeparator = true;
42741
+ }
42742
+ let accessor;
42743
+ let variableName;
42744
+ if (value[index] === "[") {
42745
+ const close = findClosingBracket(value, index);
42746
+ if (close < 0) {
42747
+ return void 0;
42748
+ }
42749
+ const key = value.slice(index + 1, close).trim();
42750
+ accessor = `[${key}]`;
42751
+ const quote = key[0];
42752
+ const isQuotedLiteral = (quote === "'" || quote === '"') && key.length > 1 && key[key.length - 1] === quote;
42753
+ variableName = isQuotedLiteral ? key.slice(1, -1) : void 0;
42754
+ index = close + 1;
42755
+ } else {
42756
+ const identifier = /^[A-Za-z_$][A-Za-z0-9_$]*/.exec(value.slice(index));
42757
+ if (!identifier || !sawSeparator) {
42758
+ return void 0;
42759
+ }
42760
+ accessor = `.${identifier[0]}`;
42761
+ variableName = identifier[0];
42762
+ index += identifier[0].length;
42763
+ }
42764
+ if (!/^(?:\?\.|\.)dataSet(?![A-Za-z0-9_$])/.test(value.slice(index))) {
42765
+ return void 0;
42766
+ }
42767
+ const datasourceExpr = addOptionalChainingToPropertyPath(
42768
+ `fragment.${scopePath}${accessor}`.replace(/\?\./g, ".")
42769
+ );
42770
+ return { scopePath, datasourceExpr, variableName };
42771
+ }
42248
42772
 
42249
42773
  // src/transpile/class-expression.util.ts
42250
42774
  function transformClassWithMustacheExpressions(classes, options = {}) {
@@ -42327,7 +42851,14 @@ var EVENT_NAME_MAP = {
42327
42851
  "on-dragenter": "on-dragEnter",
42328
42852
  "on-dragleave": "on-dragLeave"
42329
42853
  };
42330
- var processTextContentForJSX = (textContent) => {
42854
+ var convertMustacheTextToJsx = (textContent, isInsideTableColumn) => {
42855
+ return textContent.replace(/\{\{([\s\S]*?)\}\}/g, (_match, rawExpr) => {
42856
+ const expr = rawExpr.trim();
42857
+ const transformed = isInsideTableColumn ? transformTableColumnClassExpression(expr) : modifyExpression(expr);
42858
+ return `{${transformed}}`;
42859
+ });
42860
+ };
42861
+ var processTextContentForJSX = (textContent, isInsideTableColumn = false) => {
42331
42862
  const trimmedContent = textContent.trim();
42332
42863
  if (!trimmedContent) {
42333
42864
  return "";
@@ -42335,6 +42866,9 @@ var processTextContentForJSX = (textContent) => {
42335
42866
  if (/^[<>&]+$/.test(trimmedContent)) {
42336
42867
  return trimmedContent.split("").map((char) => `{'${char}'}`).join("");
42337
42868
  }
42869
+ if (trimmedContent.includes("{{") && trimmedContent.includes("}}")) {
42870
+ return convertMustacheTextToJsx(textContent, isInsideTableColumn);
42871
+ }
42338
42872
  return textContent;
42339
42873
  };
42340
42874
  var parse5 = typeof esm_default === "function" ? esm_default : esm_default.parse;
@@ -42400,7 +42934,7 @@ var _Transpiler = class _Transpiler {
42400
42934
  this.transformers = /* @__PURE__ */ new Map();
42401
42935
  this.componentNamesList = [];
42402
42936
  this.transpile = (e, isPartOfPrefab, splitCode = true, oldContext) => {
42403
- var _a, _b;
42937
+ var _a, _b, _c;
42404
42938
  const tagName = e.tagName.toLowerCase();
42405
42939
  const isHtmlElement = htmlElements.includes(tagName);
42406
42940
  const isWebComponent = tagName.includes("-") && !tagName.startsWith("wm-");
@@ -42429,9 +42963,9 @@ var _Transpiler = class _Transpiler {
42429
42963
  this.componentNamesList = [];
42430
42964
  }
42431
42965
  if (isHtmlElement) {
42432
- result.markup = preTranspileHtmlElement(e);
42966
+ result.markup = preTranspileHtmlElement(e, !!((_c = oldContext == null ? void 0 : oldContext.data) == null ? void 0 : _c.isInsideTableColumn));
42433
42967
  e.childNodes.forEach((c) => {
42434
- var _a2;
42968
+ var _a2, _b2;
42435
42969
  if (c && c.nodeType == NodeType2.ELEMENT_NODE) {
42436
42970
  const cResult = this.transpile(c, isPartOfPrefab, splitCode);
42437
42971
  (0, import_lodash5.assignIn)(result.components, cResult.components);
@@ -42443,7 +42977,10 @@ var _Transpiler = class _Transpiler {
42443
42977
  result.components = { ...result.components, ...cResult.components };
42444
42978
  if (cResult.pageEvents) result.pageEvents = cResult.pageEvents;
42445
42979
  } else if (c && c.nodeType == NodeType2.TEXT_NODE) {
42446
- const processedContent = processTextContentForJSX(c.text);
42980
+ const processedContent = processTextContentForJSX(
42981
+ c.text,
42982
+ !!((_b2 = oldContext == null ? void 0 : oldContext.data) == null ? void 0 : _b2.isInsideTableColumn)
42983
+ );
42447
42984
  if (processedContent) {
42448
42985
  result.markup += processedContent;
42449
42986
  }
@@ -42463,7 +43000,7 @@ var _Transpiler = class _Transpiler {
42463
43000
  result.imports.push(...resolvedTransformer.imports(e, context));
42464
43001
  result.markup += resolvedTransformer.pre(e, context).replace(new RegExp(FORMAT_CONTEXT, "g"), "") + (e.childNodes.length > 0 ? "\n" : "");
42465
43002
  e.childNodes.forEach((c) => {
42466
- var _a2;
43003
+ var _a2, _b2;
42467
43004
  if (c && c.nodeType == NodeType2.ELEMENT_NODE) {
42468
43005
  const cResult = this.transpile(c, isPartOfPrefab, splitCode, context);
42469
43006
  (0, import_lodash5.assignIn)(result.components, cResult.components);
@@ -42476,7 +43013,10 @@ var _Transpiler = class _Transpiler {
42476
43013
  result.components = { ...result.components, ...cResult.components };
42477
43014
  if (cResult.pageEvents) result.pageEvents = cResult.pageEvents;
42478
43015
  } else if (c && c.nodeType == NodeType2.TEXT_NODE) {
42479
- const processedContent = processTextContentForJSX(c.text);
43016
+ const processedContent = processTextContentForJSX(
43017
+ c.text,
43018
+ !!((_b2 = context.data) == null ? void 0 : _b2.isInsideTableColumn)
43019
+ );
42480
43020
  if (processedContent) {
42481
43021
  result.markup += processedContent;
42482
43022
  }
@@ -42616,6 +43156,7 @@ var _Transpiler = class _Transpiler {
42616
43156
  let value = e.attributes[name];
42617
43157
  if (value.startsWith("bind:")) {
42618
43158
  value = value.substring(5).trim();
43159
+ value = decodeHTMLEntities(value);
42619
43160
  value = value.replace(/;+$/, "");
42620
43161
  const simpleSinglePattern = /^\$\[([^\]]+)\]$/;
42621
43162
  const match = value.match(simpleSinglePattern);
@@ -42762,9 +43303,9 @@ var _Transpiler = class _Transpiler {
42762
43303
  const transformCondition = (exp) => isInsideTableColumn ? transformTableColumnClassExpression(exp) : addOptionalChaining(exp);
42763
43304
  if (conditionalClasses.startsWith("{") && conditionalClasses.endsWith("}")) {
42764
43305
  conditionalClasses = conditionalClasses.slice(1, -1);
42765
- let expressions = conditionalClasses.split(",").map((expression) => {
42766
- const [className, condition] = expression.split(":");
42767
- if (!condition) {
43306
+ let expressions = splitTopLevel(conditionalClasses, ",").map((expression) => {
43307
+ const [className, condition] = splitTopLevel(expression, ":", 2);
43308
+ if (condition === void 0) {
42768
43309
  return `'${className.trim()}'`;
42769
43310
  }
42770
43311
  return `(${transformCondition(condition.trim())} ? ${className.replace(/'$/, " '")} : '')`;
@@ -43024,21 +43565,25 @@ var _Transpiler = class _Transpiler {
43024
43565
  return attrName.endsWith("url") || attrName.endsWith("src");
43025
43566
  }
43026
43567
  transformAttr(tagName, name, value, context, tx) {
43027
- var _a, _b, _c;
43568
+ var _a, _b, _c, _d;
43028
43569
  if (name === "styles" || name === "style" || name === "className") ; else if (name === "groupby" && value.includes("(")) {
43029
43570
  value = `${this.findArgs(value, context)} => ${value}`;
43030
43571
  value = `{${value}}`;
43031
43572
  } else if (name.startsWith("on-")) {
43032
43573
  name = "on" + name.charAt(3).toUpperCase() + name.substr(4);
43033
- value = value.replace(/item,/g, "$item,");
43034
- value = value.replace(/item\./g, "$item.");
43035
- value = value.replace(/item\)/g, "$item)");
43036
- if ((_a = context == null ? void 0 : context.get) == null ? void 0 : _a.call(context, "isInsideList")) {
43574
+ const standaloneDollarItem = /(?<=[(,]\s*)\$item(?=\s*[,)])/;
43575
+ const standaloneBareItem = /(?<=[(,]\s*)item(?=\s*[,)])/;
43576
+ if (((_a = context == null ? void 0 : context.get) == null ? void 0 : _a.call(context, "isInsideList")) && standaloneDollarItem.test(value) && standaloneBareItem.test(value)) {
43577
+ value = value.replace(new RegExp(standaloneDollarItem, "g"), "$eventItem");
43578
+ }
43579
+ value = value.replace(/(?<!\$)\bitem\b(?=[,)])/g, "$item");
43580
+ value = value.replace(/(?<!\$)\bitem\b\./g, "$item.");
43581
+ if ((_b = context == null ? void 0 : context.get) == null ? void 0 : _b.call(context, "isInsideList")) {
43037
43582
  value = value.replace(/;+\s*$/, "").trim();
43038
43583
  value = addFragmentOptionalChaining(value, false);
43039
43584
  }
43040
43585
  const args = this.findArgs(value, context);
43041
- if ((_b = context == null ? void 0 : context.get) == null ? void 0 : _b.call(context, "isInsideTableColumn")) {
43586
+ if ((_c = context == null ? void 0 : context.get) == null ? void 0 : _c.call(context, "isInsideTableColumn")) {
43042
43587
  value = value.replace(/\brow\b/g, "rowData");
43043
43588
  }
43044
43589
  const arrowParams = this.parseArrowParamNames(args);
@@ -43061,7 +43606,7 @@ var _Transpiler = class _Transpiler {
43061
43606
  let exp = `${value.substring(5)}`;
43062
43607
  exp = exp.replace("fragment.Page", "fragment");
43063
43608
  const isProgressCircleDatavalue = tagName === "wm-progress-circle" && name === "datavalue";
43064
- exp = ((_c = context == null ? void 0 : context.get) == null ? void 0 : _c.call(context, "isInsideTableColumn")) ? transformTableColumnClassExpression(exp) : modifyExpression(exp);
43609
+ exp = ((_d = context == null ? void 0 : context.get) == null ? void 0 : _d.call(context, "isInsideTableColumn")) ? transformTableColumnClassExpression(exp) : modifyExpression(exp);
43065
43610
  exp = resolveFormatContext(exp, context);
43066
43611
  exp = this.convertStringBooleanTernary(exp);
43067
43612
  if (!exp) {
@@ -43295,8 +43840,8 @@ var createExpression = (element, attrName) => {
43295
43840
  let displayexpression = element.attrs[attrName];
43296
43841
  if (displayexpression == null ? void 0 : displayexpression.startsWith("bind:")) {
43297
43842
  displayexpression = displayexpression.substring(5).trim();
43298
- displayexpression = displayexpression.replace(/;+$/, "");
43299
43843
  displayexpression = decodeHTMLEntities(displayexpression);
43844
+ displayexpression = displayexpression.replace(/;+$/, "");
43300
43845
  displayexpression = transformDollarBracketSyntax(displayexpression);
43301
43846
  displayexpression = displayexpression.replace(/fragment\.\$item/g, "$item");
43302
43847
  displayexpression = displayexpression.replace(/fragment\.\$index/g, "$index");
@@ -43325,7 +43870,7 @@ var createExpression = (element, attrName) => {
43325
43870
  return `{($item) => (${transformedExp})}`;
43326
43871
  }
43327
43872
  };
43328
- var preTranspileHtmlElement = (e) => {
43873
+ var preTranspileHtmlElement = (e, isInsideTableColumn = false) => {
43329
43874
  const styleObj = style_transformer_default(e, (propName) => {
43330
43875
  return true;
43331
43876
  }) || {};
@@ -43333,6 +43878,14 @@ var preTranspileHtmlElement = (e) => {
43333
43878
  const value = e.getAttribute(attr);
43334
43879
  if (!value) return `${attr}=""`;
43335
43880
  if (attr === "class") {
43881
+ if (value.includes("{{") && value.includes("}}")) {
43882
+ const mustacheClassName = transformClassWithMustacheExpressions(value, {
43883
+ isInsideTableColumn
43884
+ });
43885
+ if (mustacheClassName) {
43886
+ return `className=${mustacheClassName}`;
43887
+ }
43888
+ }
43336
43889
  return `className="${value}"`;
43337
43890
  } else if (attr === "style") {
43338
43891
  const styleObject = convertStyleStringToObject(value);
@@ -43402,6 +43955,12 @@ var label_transformer_default = {
43402
43955
  };
43403
43956
 
43404
43957
  // src/transpile/components/layout/layout-region-factory.ts
43958
+ var isOnlyWmParamChildren = (element) => {
43959
+ const elementChildren = element.childNodes.filter(
43960
+ (node) => node.nodeType === NodeType.ELEMENT_NODE
43961
+ );
43962
+ return elementChildren.length > 0 && elementChildren.every((node) => node.tagName === "WM-PARAM");
43963
+ };
43405
43964
  var partialContainerImport = [
43406
43965
  {
43407
43966
  name: "WmPartialContainer",
@@ -43417,9 +43976,7 @@ function createLayoutRegionTransformer(config) {
43417
43976
  const content = element.getAttribute("content") || defaultContent;
43418
43977
  const name = element.getAttribute("name") || defaultName;
43419
43978
  const isPreview = context.get("preview") === true;
43420
- const hasCustomContent = element.childNodes.some(
43421
- (node) => node.nodeType === NodeType.ELEMENT_NODE
43422
- );
43979
+ const hasCustomContent = element.childNodes.some((node) => node.nodeType === NodeType.ELEMENT_NODE) && !isOnlyWmParamChildren(element);
43423
43980
  if (hasCustomContent) {
43424
43981
  return `<${tag} ${transformAttrs(element, context)}>
43425
43982
  `;
@@ -43435,9 +43992,7 @@ function createLayoutRegionTransformer(config) {
43435
43992
  },
43436
43993
  post: () => `</${tag}>`,
43437
43994
  imports: (element, context) => {
43438
- const hasCustomContent = element.childNodes.some(
43439
- (node) => node.nodeType === NodeType.ELEMENT_NODE
43440
- );
43995
+ const hasCustomContent = element.childNodes.some((node) => node.nodeType === NodeType.ELEMENT_NODE) && !isOnlyWmParamChildren(element);
43441
43996
  if (hasCustomContent) {
43442
43997
  return [...componentImports];
43443
43998
  }
@@ -44031,10 +44586,10 @@ var createNavItemLabelExpression = (element) => {
44031
44586
  let expression;
44032
44587
  if (itemlabel.startsWith("bind:")) {
44033
44588
  expression = itemlabel.substring(5);
44034
- expression = expression.replace(/\[([^\]]+)\]/g, (match, content) => {
44035
- const transformedContent = content.replace(/fragment\./g, "item.");
44036
- return `[${transformedContent}]`;
44037
- });
44589
+ expression = expression.replace(
44590
+ /fragment\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g,
44591
+ (match, name) => FRAGMENT_SCOPED_NAMES.includes(name) ? match : `item.${name}`
44592
+ );
44038
44593
  } else {
44039
44594
  expression = `item.${itemlabel}`;
44040
44595
  }
@@ -44335,7 +44890,7 @@ var list_transformer_default = {
44335
44890
  true,
44336
44891
  widgetName
44337
44892
  );
44338
- transformRepeatChildAttr(template, dataSet.substring(5), "$item");
44893
+ transformRepeatChildAttr(template, dataSet.substring(5), "$item", ["dataset", "datasource"]);
44339
44894
  if ((_a = element.getAttribute("disableitem")) == null ? void 0 : _a.startsWith("bind:")) {
44340
44895
  const disabelItemExp = replaceAll(
44341
44896
  ((_b = element.getAttribute("disableitem")) == null ? void 0 : _b.substring(5)) || "",
@@ -44370,7 +44925,7 @@ var list_transformer_default = {
44370
44925
  `Variables.${variableName}.dataSet`
44371
44926
  ];
44372
44927
  dataPatterns.forEach((pattern) => {
44373
- transformRepeatChildAttr(template, pattern, "$item");
44928
+ transformRepeatChildAttr(template, pattern, "$item", ["dataset", "datasource"]);
44374
44929
  });
44375
44930
  }
44376
44931
  }
@@ -44391,6 +44946,7 @@ var list_transformer_default = {
44391
44946
  renderItem={($item:Record<string, any>, $index:number, list:Record<string, any>[] ,getCurrentItemWidgets :any) => {
44392
44947
  const currentItemWidgetsRef = React.useRef({})
44393
44948
  const currentItemWidgets = getCurrentItemWidgets($index);
44949
+ const item = $item;
44394
44950
  currentItemWidgetsRef.current = currentItemWidgets;
44395
44951
  const $first = $index === 0;
44396
44952
  const $last = list && $index === list.length - 1;
@@ -45221,9 +45777,14 @@ var dialog_transformer_default = {
45221
45777
  pre: (element, context) => {
45222
45778
  element.getAttribute("name");
45223
45779
  const hasExplicitBody = element.childNodes.some(
45224
- (e) => isHTMLElement(e) && ["wm-dialogcontent", "wm-dialogbody"].includes(e.tagName.toLowerCase())
45780
+ (e) => isHTMLElement(e) && ["wm-dialogcontent", "wm-dialogbody"].includes(e.tagName.toLowerCase()) && e.childNodes.some(isHTMLElement)
45225
45781
  );
45226
45782
  if (!hasExplicitBody) {
45783
+ const markerIndex = element.childNodes.findIndex(
45784
+ (e) => isHTMLElement(e) && ["wm-dialogcontent", "wm-dialogbody"].includes(e.tagName.toLowerCase())
45785
+ );
45786
+ const marker = markerIndex >= 0 ? element.childNodes[markerIndex] : null;
45787
+ const remainingChildren = markerIndex >= 0 ? element.childNodes.filter((_, i) => i !== markerIndex) : element.childNodes;
45227
45788
  const content = new HTMLElement(
45228
45789
  "wm-dialogbody",
45229
45790
  {},
@@ -45232,10 +45793,13 @@ var dialog_transformer_default = {
45232
45793
  [0, 41]
45233
45794
  );
45234
45795
  content.nodeType = NodeType.ELEMENT_NODE;
45235
- const actionsIndex = element.childNodes.findIndex(
45796
+ if (marker) {
45797
+ content.setAttributes(marker.attributes);
45798
+ }
45799
+ const actionsIndex = remainingChildren.findIndex(
45236
45800
  (e) => isHTMLElement(e) && e.tagName.toLowerCase() === "wm-dialogactions"
45237
45801
  );
45238
- content.childNodes = element.childNodes;
45802
+ content.childNodes = remainingChildren;
45239
45803
  element.childNodes = [content];
45240
45804
  if (actionsIndex >= 0) {
45241
45805
  const actions = content.childNodes.splice(actionsIndex, 1);
@@ -45265,10 +45829,10 @@ var applyAttr = (e, replace2, replaceWith) => {
45265
45829
  });
45266
45830
  e.childNodes.forEach((c) => isHTMLElement(c) && applyAttr(c, replace2, replaceWith));
45267
45831
  };
45832
+ var isInsideDialog = (element) => !!getParentNode(element, "wm-dialog");
45268
45833
  var dialog_actions_transformer_default = {
45269
45834
  pre: (element, context) => {
45270
- const parent = element.parentNode;
45271
- if (!(parent == null ? void 0 : parent.rawTagName.includes("dialog"))) {
45835
+ if (!isInsideDialog(element)) {
45272
45836
  Array.from(element.childNodes).forEach((child) => {
45273
45837
  element.removeChild(child);
45274
45838
  });
@@ -45285,15 +45849,13 @@ var dialog_actions_transformer_default = {
45285
45849
  return `<WmDialogActions ${transformAttrs(element, context)}>`;
45286
45850
  },
45287
45851
  post: (element, context) => {
45288
- const parent = element.parentNode;
45289
- if (!(parent == null ? void 0 : parent.rawTagName.includes("dialog"))) {
45852
+ if (!isInsideDialog(element)) {
45290
45853
  return ``;
45291
45854
  }
45292
45855
  return "</WmDialogActions>";
45293
45856
  },
45294
45857
  imports: (element, context) => {
45295
- const parent = element.parentNode;
45296
- if (!(parent == null ? void 0 : parent.rawTagName.includes("dialog"))) {
45858
+ if (!isInsideDialog(element)) {
45297
45859
  return [];
45298
45860
  }
45299
45861
  return imports37;
@@ -45354,15 +45916,21 @@ var tabs_transformer_default = {
45354
45916
  `fragment.Widgets.${widgetName}.currentItem`,
45355
45917
  "currentItem"
45356
45918
  );
45919
+ transformRepeatChildAttr(repeatTemplate, "fragment.item", "$item");
45920
+ transformRepeatChildAttr(repeatTemplate, "fragment.index", "$index");
45357
45921
  transformRepeatChildData(
45358
45922
  repeatTemplate,
45359
45923
  dataSet.substring(5) + "[0]",
45360
- "list_item"
45924
+ "list_item",
45925
+ true,
45926
+ widgetName
45361
45927
  );
45362
45928
  transformRepeatChildData(
45363
45929
  repeatTemplate,
45364
45930
  dataSet.substring(5) + "[$i]",
45365
- "list_item"
45931
+ "list_item",
45932
+ true,
45933
+ widgetName
45366
45934
  );
45367
45935
  repeatTemplate.childNodes = element.childNodes;
45368
45936
  element.childNodes = [repeatTemplate];
@@ -45459,6 +46027,8 @@ var prefab_container_transformer_default = {
45459
46027
  __toESM(require_lodash());
45460
46028
  var DefaultProfile = {
45461
46029
  generateWeb: false,
46030
+ generateWmxComponents: true,
46031
+ groupPagesByLayout: true,
45462
46032
  copyResources: true,
45463
46033
  lazyloadPages: true,
45464
46034
  lazyloadPartials: true,
@@ -45776,7 +46346,7 @@ var imports52 = [
45776
46346
  ];
45777
46347
  var accordion_transformer_default = {
45778
46348
  pre: (element, context) => {
45779
- element.attrs["name"];
46349
+ const widgetName = element.attrs["name"];
45780
46350
  let dataSet = element.getAttribute("dataset");
45781
46351
  if (dataSet && dataSet.startsWith("bind:") && element.getAttribute("type") === "dynamic") {
45782
46352
  dataSet = dataSet.substring(5);
@@ -45786,10 +46356,34 @@ var accordion_transformer_default = {
45786
46356
  accordionPane.setAttribute("active", "bind:$item.active");
45787
46357
  accordionPane.setAttribute("toggle", "bind:$item.toggle");
45788
46358
  }
45789
- transformRepeatChildData(template, dataSet + "[0]", "repeat_item");
45790
- transformRepeatChildData(template, dataSet + "[$i]", "repeat_item");
45791
- transformRepeatChildData(template, dataSet + "[fragment.$i]", "repeat_item");
45792
- transformRepeatChildData(template, dataSet + "[fragment.$i]", "repeat_item");
46359
+ transformRepeatChildData(
46360
+ template,
46361
+ dataSet + "[0]",
46362
+ "repeat_item",
46363
+ true,
46364
+ widgetName
46365
+ );
46366
+ transformRepeatChildData(
46367
+ template,
46368
+ dataSet + "[$i]",
46369
+ "repeat_item",
46370
+ true,
46371
+ widgetName
46372
+ );
46373
+ transformRepeatChildData(
46374
+ template,
46375
+ dataSet + "[fragment.$i]",
46376
+ "repeat_item",
46377
+ true,
46378
+ widgetName
46379
+ );
46380
+ transformRepeatChildData(
46381
+ template,
46382
+ dataSet + "[fragment.$i]",
46383
+ "repeat_item",
46384
+ true,
46385
+ widgetName
46386
+ );
45793
46387
  context.set("old_props", context.props);
45794
46388
  context.props = ["$item", "$index"];
45795
46389
  return `<WmAccordion listener={fragment} ${transformAttrs(element, context)} render={(($item:Record<string,any>,$index:number,data:Record<string,any>[])=>(`;
@@ -46988,18 +47582,16 @@ var table_transformer_default = {
46988
47582
  const datasourceAttr = element.getAttribute("datasource");
46989
47583
  const binddatasetAttr = element.getAttribute("binddataset");
46990
47584
  if (datasetAttr && datasetAttr.includes(".dataSet")) {
46991
- const match = datasetAttr.match(
46992
- /^bind:fragment\.((?:App\.activePage\.|App\.)?Variables)\.([^.]+)\.dataSet(?=[^A-Za-z0-9_]|$)/
46993
- );
46994
- if (match) {
46995
- const scopePath = match[1];
46996
- const variableName = match[2];
46997
- context.set("tableDatasetVariableName", variableName);
47585
+ const binding = parseVariableDataSetBinding(datasetAttr);
47586
+ if (binding) {
47587
+ const { scopePath, datasourceExpr, variableName } = binding;
47588
+ if (variableName) {
47589
+ context.set("tableDatasetVariableName", variableName);
47590
+ }
46998
47591
  if (!datasourceAttr) {
46999
- const datasourceExpr = `fragment.${scopePath}.${variableName}`.split(".").join("?.");
47000
47592
  element.setAttribute("datasource", `{${datasourceExpr}}`);
47001
47593
  }
47002
- if (!binddatasetAttr) {
47594
+ if (!binddatasetAttr && variableName) {
47003
47595
  element.setAttribute("binddataset", `${scopePath}.${variableName}.dataSet`);
47004
47596
  }
47005
47597
  }