@wavemaker-ai/react-codegen 1.0.0-rc.324 → 1.0.0-rc.328

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 (52) hide show
  1. package/dist/transpiler/index.d.mts +10 -1
  2. package/dist/transpiler/index.mjs +396 -91
  3. package/dist/transpiler/index.mjs.map +1 -1
  4. package/dist/transpiler/wm-styles.css +34 -30
  5. package/package-lock.json +44 -539
  6. package/package.json +7 -23
  7. package/src/app.generator.js +14 -1
  8. package/src/app.generator.js.map +1 -1
  9. package/src/transpile/bind.ex.transformer.js +42 -14
  10. package/src/transpile/bind.ex.transformer.js.map +1 -1
  11. package/src/transpile/components/container/wizardaction.transformer.js +27 -26
  12. package/src/transpile/components/container/wizardaction.transformer.js.map +1 -1
  13. package/src/transpile/components/container/wizardstep.transformer.js +1 -1
  14. package/src/transpile/components/container/wizardstep.transformer.js.map +1 -1
  15. package/src/transpile/components/data/form/form-field.transformer.js +16 -1
  16. package/src/transpile/components/data/form/form-field.transformer.js.map +1 -1
  17. package/src/transpile/components/data/live-filter-field.transformer.js +18 -5
  18. package/src/transpile/components/data/live-filter-field.transformer.js.map +1 -1
  19. package/src/transpile/components/data/table/table-row.transformer.js +3 -1
  20. package/src/transpile/components/data/table/table-row.transformer.js.map +1 -1
  21. package/src/transpile/components/data/table/utils.js +70 -0
  22. package/src/transpile/components/data/table/utils.js.map +1 -1
  23. package/src/transpile/components/dialogs/dialog.transformer.js +15 -8
  24. package/src/transpile/components/dialogs/dialog.transformer.js.map +1 -1
  25. package/src/transpile/components/page/build-partial-markup.js +12 -1
  26. package/src/transpile/components/page/build-partial-markup.js.map +1 -1
  27. package/src/transpile/components/transform-register.js +1 -0
  28. package/src/transpile/components/transform-register.js.map +1 -1
  29. package/src/transpile/components/wmx-component/wmx-component.transformer.js +12 -15
  30. package/src/transpile/components/wmx-component/wmx-component.transformer.js.map +1 -1
  31. package/src/transpile/property/property-parser.js +1 -0
  32. package/src/transpile/property/property-parser.js.map +1 -1
  33. package/src/transpile/style.transformer.js +6 -1
  34. package/src/transpile/style.transformer.js.map +1 -1
  35. package/src/transpile/transpile.js +1 -1
  36. package/src/transpile/transpile.js.map +1 -1
  37. package/src/transpile/transpiler.js +5 -1
  38. package/src/transpile/transpiler.js.map +1 -1
  39. package/src/transpile/widget-inline-style-constants.js +5 -2
  40. package/src/transpile/widget-inline-style-constants.js.map +1 -1
  41. package/src/transpile/widget-inline-style-processor.js +12 -5
  42. package/src/transpile/widget-inline-style-processor.js.map +1 -1
  43. package/src/utils.browser.js +96 -45
  44. package/src/utils.browser.js.map +1 -1
  45. package/src/utils.js +8 -161
  46. package/src/utils.js.map +1 -1
  47. package/src/wmx.generator.js +4 -26
  48. package/src/wmx.generator.js.map +1 -1
  49. package/templates/component/app.template.hbs +8 -0
  50. package/templates/project/app/autoLayout.css +31 -30
  51. package/templates/project/app/components.css +3 -0
  52. package/templates/project/package.json +4 -4
@@ -4567,9 +4567,9 @@ var require_lodash = __commonJS({
4567
4567
  }
4568
4568
  var camelCase = createCompounder(function(result2, word, index) {
4569
4569
  word = word.toLowerCase();
4570
- return result2 + (index ? capitalize5(word) : word);
4570
+ return result2 + (index ? capitalize4(word) : word);
4571
4571
  });
4572
- function capitalize5(string) {
4572
+ function capitalize4(string) {
4573
4573
  return upperFirst2(toString(string).toLowerCase());
4574
4574
  }
4575
4575
  function deburr(string) {
@@ -5178,7 +5178,7 @@ var require_lodash = __commonJS({
5178
5178
  lodash.add = add;
5179
5179
  lodash.attempt = attempt;
5180
5180
  lodash.camelCase = camelCase;
5181
- lodash.capitalize = capitalize5;
5181
+ lodash.capitalize = capitalize4;
5182
5182
  lodash.ceil = ceil;
5183
5183
  lodash.clamp = clamp;
5184
5184
  lodash.clone = clone2;
@@ -38981,6 +38981,7 @@ var NodeType = import_dist.default.NodeType;
38981
38981
  var esm_default = import_dist.default;
38982
38982
 
38983
38983
  // src/utils.browser.ts
38984
+ var appLocaleRegex = /(fragment\.)?(?:App\.)?appLocale(?:\.messages)?(?:\[(['"])([^'"]+)\2\]|\.([a-zA-Z0-9_]+))/g;
38984
38985
  function isValid(expr) {
38985
38986
  try {
38986
38987
  (0, import_parser.parse)(expr, { sourceType: "module", plugins: ["optionalChaining"] });
@@ -39249,12 +39250,27 @@ var addOptionalChaining = (bindPath, options = {}) => {
39249
39250
  }
39250
39251
  return result;
39251
39252
  };
39253
+ var fixURLPath = (file_content, basePath, isAppCss) => {
39254
+ let updatedContent = file_content.replace(
39255
+ /url\((['"]?)resources/g,
39256
+ `url($1${basePath || ""}/resources`
39257
+ );
39258
+ if (isAppCss) {
39259
+ updatedContent = updatedContent.replace(
39260
+ /url\((['"])(?!\/|http|data:)([^'"]+)\1\)/g,
39261
+ (match, quote, url) => {
39262
+ const fixedUrl = url.startsWith("/") ? url : `/${url}`;
39263
+ return `url(${quote}${fixedUrl}${quote})`;
39264
+ }
39265
+ );
39266
+ }
39267
+ return updatedContent;
39268
+ };
39252
39269
  var transformAppLocale = (exp) => {
39253
39270
  if (exp.startsWith("fragment?.Prefab") || exp.startsWith("fragment.Prefab")) {
39254
39271
  exp = exp.replace("fragment?.Prefab", "fragment");
39255
39272
  exp = exp.replace("fragment.Prefab", "fragment");
39256
39273
  }
39257
- const appLocaleRegex = /(fragment\.)?appLocale(?:\.messages)?(?:\[(['"])([^'"]+)\2\]|\.([a-zA-Z0-9_]+))/g;
39258
39274
  const replacer = (fullMatch, fragmentPrefix, quoteType, keyFromBrackets, keyFromDot) => {
39259
39275
  const key = keyFromBrackets || keyFromDot;
39260
39276
  if (key) {
@@ -39287,6 +39303,168 @@ var modifyExpression = (exp) => {
39287
39303
  return addOptionalChaining(exp);
39288
39304
  }
39289
39305
  };
39306
+ var DISABLE_SCOPING_MARKER = "/*DISABLE_SCOPING*/";
39307
+ var buildCssScopeClass = (scopeType, name) => {
39308
+ const lowerName = name.toLowerCase();
39309
+ switch (scopeType) {
39310
+ case "page":
39311
+ return `app-page-${lowerName}`;
39312
+ case "partial":
39313
+ return `app-partial-${lowerName}`;
39314
+ case "prefab":
39315
+ return `app-prefab-${lowerName}`;
39316
+ }
39317
+ };
39318
+ var removeLeadingCssBlockComments = (rule) => {
39319
+ let idx = 0;
39320
+ const len = rule.length;
39321
+ let prefix = "";
39322
+ while (idx < len) {
39323
+ const wsStart = idx;
39324
+ while (idx < len && /\s/.test(rule.charAt(idx))) {
39325
+ idx++;
39326
+ }
39327
+ prefix += rule.slice(wsStart, idx);
39328
+ if (idx > len - 2 || rule.charAt(idx) !== "/" || rule.charAt(idx + 1) !== "*") {
39329
+ break;
39330
+ }
39331
+ const commentStart = idx;
39332
+ idx += 2;
39333
+ let closed = false;
39334
+ while (idx < len - 1) {
39335
+ if (rule.charAt(idx) === "*" && rule.charAt(idx + 1) === "/") {
39336
+ idx += 2;
39337
+ closed = true;
39338
+ break;
39339
+ }
39340
+ idx++;
39341
+ }
39342
+ if (!closed) {
39343
+ return { prefix: "", rest: rule };
39344
+ }
39345
+ prefix += rule.slice(commentStart, idx);
39346
+ }
39347
+ return { prefix, rest: rule.slice(idx) };
39348
+ };
39349
+ var scopeSingleSelector = (selector, scopeClass) => {
39350
+ const sel = selector.trim();
39351
+ if (!sel) {
39352
+ return sel;
39353
+ }
39354
+ if (sel.startsWith(":")) {
39355
+ return sel;
39356
+ }
39357
+ const wmAppIndex = sel.search(/\.wm-app\b/);
39358
+ if (wmAppIndex !== -1) {
39359
+ if (sel.includes(`.${scopeClass}`)) {
39360
+ return sel;
39361
+ }
39362
+ return sel.replace(/\.wm-app\b/, `.wm-app .${scopeClass}`);
39363
+ }
39364
+ return `.wm-app .${scopeClass} ${sel}`;
39365
+ };
39366
+ var splitCssIntoRules = (cssContent) => {
39367
+ const rules = [];
39368
+ let currentRule = "";
39369
+ let inComment = false;
39370
+ let inString = false;
39371
+ let stringChar = "";
39372
+ let braceLevel = 0;
39373
+ for (let i = 0; i < cssContent.length; i++) {
39374
+ const char = cssContent[i];
39375
+ const nextChar = cssContent[i + 1];
39376
+ if (!inString && char === "/" && nextChar === "*") {
39377
+ inComment = true;
39378
+ currentRule += char;
39379
+ continue;
39380
+ }
39381
+ if (inComment && char === "*" && nextChar === "/") {
39382
+ inComment = false;
39383
+ currentRule += char;
39384
+ continue;
39385
+ }
39386
+ if (inComment) {
39387
+ currentRule += char;
39388
+ continue;
39389
+ }
39390
+ if (!inString && (char === '"' || char === "'")) {
39391
+ inString = true;
39392
+ stringChar = char;
39393
+ currentRule += char;
39394
+ continue;
39395
+ }
39396
+ if (inString && char === stringChar && cssContent[i - 1] !== "\\") {
39397
+ inString = false;
39398
+ stringChar = "";
39399
+ currentRule += char;
39400
+ continue;
39401
+ }
39402
+ if (inString) {
39403
+ currentRule += char;
39404
+ continue;
39405
+ }
39406
+ if (char === "{") {
39407
+ braceLevel++;
39408
+ currentRule += char;
39409
+ } else if (char === "}") {
39410
+ braceLevel--;
39411
+ currentRule += char;
39412
+ if (braceLevel === 0) {
39413
+ rules.push(currentRule.trim());
39414
+ currentRule = "";
39415
+ }
39416
+ } else {
39417
+ currentRule += char;
39418
+ }
39419
+ }
39420
+ if (currentRule.trim()) {
39421
+ rules.push(currentRule.trim());
39422
+ }
39423
+ return rules;
39424
+ };
39425
+ var scopeCssUnderWmApp = (cssContent, scopeOptions) => {
39426
+ if (!cssContent || cssContent.trim() === "") {
39427
+ return cssContent;
39428
+ }
39429
+ if (!scopeOptions) {
39430
+ return cssContent;
39431
+ }
39432
+ if (cssContent.trimStart().startsWith(DISABLE_SCOPING_MARKER)) {
39433
+ return cssContent;
39434
+ }
39435
+ const scopeClass = buildCssScopeClass(scopeOptions.scopeType, scopeOptions.name);
39436
+ const rules = splitCssIntoRules(cssContent);
39437
+ const processedRules = rules.map((rule) => {
39438
+ if (!rule) {
39439
+ return rule;
39440
+ }
39441
+ const { prefix, rest } = removeLeadingCssBlockComments(rule);
39442
+ const body = rest;
39443
+ if (!body.trim()) {
39444
+ return rule;
39445
+ }
39446
+ if (body.startsWith("@import") || body.startsWith("@charset")) {
39447
+ return rule;
39448
+ }
39449
+ if (body.startsWith("@")) {
39450
+ return rule;
39451
+ }
39452
+ const openBraceIndex = body.indexOf("{");
39453
+ if (openBraceIndex === -1) {
39454
+ return rule;
39455
+ }
39456
+ const selector = body.substring(0, openBraceIndex).trim();
39457
+ const declarations = body.substring(openBraceIndex);
39458
+ const selectors = selector.split(",").map((s) => s.trim());
39459
+ const scopedSelectors = selectors.map((sel) => scopeSingleSelector(sel, scopeClass));
39460
+ return `${prefix}${scopedSelectors.join(", ")} ${declarations}`;
39461
+ });
39462
+ return processedRules.join("\n");
39463
+ };
39464
+ var fixURLPathAndScope = (file_content, basePath, isAppCss, scopeOptions) => {
39465
+ const urlFixed = fixURLPath(file_content, basePath, isAppCss);
39466
+ return scopeCssUnderWmApp(urlFixed, scopeOptions);
39467
+ };
39290
39468
  var htmlElements = [
39291
39469
  "header",
39292
39470
  "footer",
@@ -39327,8 +39505,30 @@ var htmlElements = [
39327
39505
  // src/transpile/bind.ex.transformer.ts
39328
39506
  var FORMAT_CONTEXT = "{formatContext:''}";
39329
39507
  var FORMAT_CONTEXT_REGEX = /\{formatContext:''\}/g;
39330
- var FRAGMENT_SCOPED_NAMES = ["appLocale", "Variables"];
39508
+ var FRAGMENT_SCOPED_NAMES = ["appLocale", "Variables", "App"];
39331
39509
  var LIST_SCOPE_VARS = /* @__PURE__ */ new Set(["currentItemWidgets"]);
39510
+ var JS_GLOBALS = /* @__PURE__ */ new Set([
39511
+ "Number",
39512
+ "String",
39513
+ "Boolean",
39514
+ "Array",
39515
+ "Object",
39516
+ "Date",
39517
+ "Math",
39518
+ "JSON",
39519
+ "RegExp",
39520
+ "Promise",
39521
+ "Symbol",
39522
+ "BigInt",
39523
+ "parseInt",
39524
+ "parseFloat",
39525
+ "isNaN",
39526
+ "isFinite",
39527
+ "encodeURIComponent",
39528
+ "decodeURIComponent",
39529
+ "encodeURI",
39530
+ "decodeURI"
39531
+ ]);
39332
39532
  var ExpressionTransformer = class {
39333
39533
  constructor(ctx = "this", mode = "attr") {
39334
39534
  this.ctx = ctx;
@@ -39358,14 +39558,14 @@ var ExpressionTransformer = class {
39358
39558
  if (this.mode === "event" && ast.receiver instanceof ImplicitReceiver && ast.name === "$event") {
39359
39559
  return "$event";
39360
39560
  }
39361
- if (ast.receiver instanceof ImplicitReceiver && LIST_SCOPE_VARS.has(ast.name)) {
39561
+ if (ast.receiver instanceof ImplicitReceiver && (LIST_SCOPE_VARS.has(ast.name) || JS_GLOBALS.has(ast.name))) {
39362
39562
  return ast.name;
39363
39563
  }
39364
39564
  const r = this.build(ast.receiver);
39365
39565
  return `${r}.${ast.name}`;
39366
39566
  }
39367
39567
  processSafePropertyRead(ast) {
39368
- if (ast.receiver instanceof ImplicitReceiver && LIST_SCOPE_VARS.has(ast.name)) {
39568
+ if (ast.receiver instanceof ImplicitReceiver && (LIST_SCOPE_VARS.has(ast.name) || JS_GLOBALS.has(ast.name))) {
39369
39569
  return ast.name;
39370
39570
  }
39371
39571
  const r = this.build(ast.receiver);
@@ -39413,16 +39613,23 @@ var ExpressionTransformer = class {
39413
39613
  const rhs = this.build(ast.value);
39414
39614
  return `${lhs} = ${rhs}`;
39415
39615
  }
39416
- processMethodCall(ast) {
39616
+ buildCallArgs(args) {
39417
39617
  const _args = [];
39418
- for (const arg of ast.args) {
39618
+ for (const arg of args) {
39419
39619
  let argExp = this.build(arg);
39420
- const fragmentScoped = typeof argExp === "string" && FRAGMENT_SCOPED_NAMES.some((name) => argExp.includes(name));
39620
+ const fragmentScoped = typeof argExp === "string" && FRAGMENT_SCOPED_NAMES.some((name) => name !== this.ctx && argExp.includes(name));
39421
39621
  if (this.mode === "event" && !fragmentScoped && argExp.replace) {
39422
39622
  argExp = argExp.replace(`${this.ctx}.`, "");
39423
39623
  }
39424
39624
  _args.push(argExp);
39425
39625
  }
39626
+ return _args;
39627
+ }
39628
+ processMethodCall(ast) {
39629
+ const _args = this.buildCallArgs(ast.args);
39630
+ if (ast.receiver instanceof ImplicitReceiver && JS_GLOBALS.has(ast.name)) {
39631
+ return `${ast.name}(${_args.join(",")})`;
39632
+ }
39426
39633
  const fn2 = this.build(ast.receiver);
39427
39634
  if (_args.includes("currentItemWidgets")) {
39428
39635
  _args.forEach((arg, index) => {
@@ -39434,14 +39641,9 @@ var ExpressionTransformer = class {
39434
39641
  return `${fn2}?.${ast.name}?.(${_args.join(",")})`;
39435
39642
  }
39436
39643
  processSafeMethodCall(ast) {
39437
- const _args = [];
39438
- for (const arg of ast.args) {
39439
- let argExp = this.build(arg);
39440
- const fragmentScoped = typeof argExp === "string" && FRAGMENT_SCOPED_NAMES.some((name) => argExp.includes(name));
39441
- if (this.mode === "event" && !fragmentScoped && argExp.replace) {
39442
- argExp = argExp.replace(`${this.ctx}.`, "");
39443
- }
39444
- _args.push(argExp);
39644
+ const _args = this.buildCallArgs(ast.args);
39645
+ if (ast.receiver instanceof ImplicitReceiver && JS_GLOBALS.has(ast.name)) {
39646
+ return `${ast.name}(${_args.join(",")})`;
39445
39647
  }
39446
39648
  const fn2 = this.build(ast.receiver);
39447
39649
  return `${fn2}?.${ast.name}?.(${_args.join(",")})`;
@@ -40662,7 +40864,10 @@ var style_transformer_default = (element, isStyleProperty) => {
40662
40864
  StyleProps.forEach((parser, k) => {
40663
40865
  if (!!element.hasAttribute(k) && isStyleProperty && isStyleProperty(k)) {
40664
40866
  const value = element.getAttribute(k);
40665
- element.removeAttribute(k);
40867
+ const isFillDimension = (k === "width" || k === "height") && value === "fill";
40868
+ if (!isFillDimension) {
40869
+ element.removeAttribute(k);
40870
+ }
40666
40871
  if (value) {
40667
40872
  if (value.startsWith("bind:")) {
40668
40873
  if (k === "backgroundimage" && value.startsWith('bind:"') && value.endsWith('"')) {
@@ -40933,6 +41138,7 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
40933
41138
  ["wm-progress-circle", /* @__PURE__ */ new Map([["datavalue", NUMERIC_PARSER]])],
40934
41139
  ["wm-video", /* @__PURE__ */ new Map([["controls", BOOLEAN_PARSER]])],
40935
41140
  ["wm-chips", /* @__PURE__ */ new Map([["searchable", BOOLEAN_PARSER]])],
41141
+ ["wm-table-row", /* @__PURE__ */ new Map([["columnwidth", UNIT_PARSER]])],
40936
41142
  [
40937
41143
  "wm-table",
40938
41144
  /* @__PURE__ */ new Map([
@@ -41066,6 +41272,7 @@ var ALIGNMENT_MATRIX = {
41066
41272
  center: { justifyContent: "space-between", alignItems: "center" },
41067
41273
  end: { justifyContent: "space-between", alignItems: "flex-end" }
41068
41274
  };
41275
+ var AUTOLAYOUT_CLASS_PREFIX = "wm-";
41069
41276
  var CSS_PROP_PREFIX = {
41070
41277
  display: "d",
41071
41278
  "flex-direction": "fd",
@@ -41206,7 +41413,7 @@ var AUTOLAYOUT_WIDGET_TAGS = /* @__PURE__ */ new Set([
41206
41413
  "wm-page-content"
41207
41414
  ]);
41208
41415
  var STYLE_OVERLAPPING_LAYOUT_ATTRS = ["overflow", "zindex", "clipcontent"];
41209
- var PREDEFINED_CLASS_NAMES = [
41416
+ var PREDEFINED_CLASS_SUFFIXES = [
41210
41417
  "d-flex",
41211
41418
  "fd-row",
41212
41419
  "fd-column",
@@ -41238,6 +41445,9 @@ var PREDEFINED_CLASS_NAMES = [
41238
41445
  "pos-sticky",
41239
41446
  "pos-fixed"
41240
41447
  ];
41448
+ var PREDEFINED_CLASS_NAMES = PREDEFINED_CLASS_SUFFIXES.map(
41449
+ (cls) => `${AUTOLAYOUT_CLASS_PREFIX}${cls}`
41450
+ );
41241
41451
 
41242
41452
  // src/transpile/style/split-css-shorthand.ts
41243
41453
  function splitCssShorthandOnSpaces(value) {
@@ -41288,7 +41498,10 @@ function splitCssShorthandOnSpaces(value) {
41288
41498
 
41289
41499
  // src/transpile/widget-inline-style-processor.ts
41290
41500
  var isBind = (v) => !!(v && (v.startsWith("bind:") || v.startsWith("{")));
41291
- var hasValidDir = (v) => v === "row" || v === "column";
41501
+ var hasValidDir = (v) => {
41502
+ const d = v == null ? void 0 : v.trim();
41503
+ return d === "row" || d === "column";
41504
+ };
41292
41505
  var isAuto = (v) => v === "auto";
41293
41506
  var normalizeGap = (v) => v != null && v !== "" && !isAuto(v) ? v : null;
41294
41507
  function parseDimensionValue(value, element) {
@@ -41342,7 +41555,7 @@ function sanitizeValue(value) {
41342
41555
  }
41343
41556
  function cssToClassName(property, value) {
41344
41557
  const prefix = CSS_PROP_PREFIX[property] || property.replace(/-/g, "");
41345
- return `${prefix}-${sanitizeValue(value)}`;
41558
+ return `${AUTOLAYOUT_CLASS_PREFIX}${prefix}-${sanitizeValue(value)}`;
41346
41559
  }
41347
41560
  function stripBalancedOuterParens(expr) {
41348
41561
  let e = expr;
@@ -41478,7 +41691,7 @@ function computeLayoutCssProperties(props) {
41478
41691
  var _a;
41479
41692
  const css = {};
41480
41693
  if (hasValidDir(props.direction)) {
41481
- const direction = props.direction;
41694
+ const direction = props.direction.trim();
41482
41695
  const hasAlignment = !!props.alignment;
41483
41696
  const alignment = props.alignment || "top-left";
41484
41697
  const wrap2 = direction === "column" ? false : (_a = props.wrap) != null ? _a : false;
@@ -41632,7 +41845,7 @@ var AutolayoutCodegen = class {
41632
41845
  if (tagName === "wm-list") return null;
41633
41846
  const parent = element.parentNode;
41634
41847
  const dir = ((_c = parent == null ? void 0 : parent.getAttribute) == null ? void 0 : _c.call(parent, "direction")) || null;
41635
- return dir && hasValidDir(dir) ? dir : null;
41848
+ return dir && hasValidDir(dir) ? dir.trim() : null;
41636
41849
  }
41637
41850
  // Collect flex props for a single dimension, axis-aware to avoid cross-axis conflicts.
41638
41851
  collectSizeFlexProps(element, key, val, flexProps) {
@@ -41719,7 +41932,9 @@ var AutolayoutCodegen = class {
41719
41932
  }
41720
41933
  this.collectSizeFlexProps(element, dimKey, raw, flexProps);
41721
41934
  classNames.push(...this.registerSizeClass(element, dimKey, raw));
41722
- element.removeAttribute(dimKey);
41935
+ if (raw !== "fill") {
41936
+ element.removeAttribute(dimKey);
41937
+ }
41723
41938
  }
41724
41939
  for (const [prop, value] of Object.entries(flexProps)) {
41725
41940
  classNames.push(this.registerClass(prop, value));
@@ -41935,6 +42150,65 @@ function convertActionToClickHandler(actionAttr, tableName, liveTableName) {
41935
42150
  ${converted.join("\n ")}
41936
42151
  }}`;
41937
42152
  }
42153
+ function isRowBoundExpression(value) {
42154
+ if (!value || typeof value !== "string") return false;
42155
+ const exp = value.startsWith("bind:") ? value.substring(5).trim() : value;
42156
+ return /fragment\??\.row/.test(exp) || /\brow\./.test(exp) || /\brow\[/.test(exp);
42157
+ }
42158
+ function transformTableRowPropExpression(expression) {
42159
+ if (!expression) return "";
42160
+ let transformed = expression.replace(/fragment\??\.row/g, "row");
42161
+ transformed = transformed.replace(/\brow\./g, "row?.");
42162
+ transformed = transformed.replace(/\brow\[/g, "row?.[");
42163
+ transformed = addOptionalChaining(transformed);
42164
+ transformed = transformed.replace(/row\?\?\./g, "row?.");
42165
+ transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
42166
+ return transformed;
42167
+ }
42168
+ function transformTableRowCurrentItemExpression(expression) {
42169
+ if (!expression) return "";
42170
+ const raw = expression.startsWith("bind:") ? expression.substring(5).trim() : expression;
42171
+ let transformed = raw.replace(/fragment\??\.row/g, "currentItem");
42172
+ transformed = transformed.replace(/\brow\./g, "currentItem?.");
42173
+ transformed = transformed.replace(/\brow\[/g, "currentItem?.[");
42174
+ transformed = addOptionalChaining(transformed);
42175
+ transformed = transformed.replace(/currentItem\?\?\./g, "currentItem?.");
42176
+ transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
42177
+ return transformed;
42178
+ }
42179
+ var TABLE_ROW_PROPS_SKIP_ATTRS = /* @__PURE__ */ new Set([
42180
+ "name",
42181
+ "class",
42182
+ "className",
42183
+ "content",
42184
+ "widget-type",
42185
+ "display-name",
42186
+ "displayName",
42187
+ "rowType",
42188
+ "is-table-row",
42189
+ "data-widget-id",
42190
+ "styles",
42191
+ "style"
42192
+ ]);
42193
+ function buildTableRowProps(element) {
42194
+ const parts = [];
42195
+ const toRemove = [];
42196
+ for (const name of Object.keys(element.attributes)) {
42197
+ if (TABLE_ROW_PROPS_SKIP_ATTRS.has(name)) continue;
42198
+ const value = element.attributes[name];
42199
+ if (!isRowBoundExpression(value)) continue;
42200
+ const exp = transformTableRowPropExpression(value.substring(5).trim());
42201
+ if (name === "show") {
42202
+ parts.push(`show: (${exp} || false)`);
42203
+ } else {
42204
+ parts.push(`${name}: ${exp}`);
42205
+ }
42206
+ toRemove.push(name);
42207
+ }
42208
+ toRemove.forEach((attr) => element.removeAttribute(attr));
42209
+ if (parts.length === 0) return "";
42210
+ return `tableRowProps={(row: any) => ({${parts.join(", ")}})}`;
42211
+ }
41938
42212
  function transformTableColumnClassExpression(expression) {
41939
42213
  if (!expression) return "";
41940
42214
  let transformed = expression.replace(/fragment\??\.row/g, "rowData");
@@ -42772,7 +43046,7 @@ var _Transpiler = class _Transpiler {
42772
43046
  if (name === "conditionalclass") {
42773
43047
  return "";
42774
43048
  }
42775
- } else if (name === "width" || name === "height") {
43049
+ } else if ((name === "width" || name === "height") && value != "fill") {
42776
43050
  `${value.substring(5)}`;
42777
43051
  value = `{${value}}`;
42778
43052
  } else {
@@ -43447,6 +43721,8 @@ function buildPartialMarkup(element, context, componentName) {
43447
43721
  }
43448
43722
  const watch = [];
43449
43723
  const typedParams = /* @__PURE__ */ new Set();
43724
+ const rowBoundParamParts = [];
43725
+ const isTableRow = element.hasAttribute("is-table-row");
43450
43726
  element.childNodes.filter((node) => isHTMLElement(node) && node.tagName === "WM-PARAM").forEach((node) => {
43451
43727
  const e = node;
43452
43728
  const name2 = e.getAttribute("name") || "";
@@ -43458,7 +43734,11 @@ function buildPartialMarkup(element, context, componentName) {
43458
43734
  value = `bind:${match[0]}`;
43459
43735
  }
43460
43736
  }
43461
- params[name2] = value;
43737
+ if (isTableRow && isRowBoundExpression(value)) {
43738
+ rowBoundParamParts.push(`${name2}={${transformTableRowCurrentItemExpression(value)}}`);
43739
+ } else {
43740
+ params[name2] = value;
43741
+ }
43462
43742
  if (type && ["string", "boolean", "number"].includes(type)) {
43463
43743
  typedParams.add(name2);
43464
43744
  }
@@ -43477,6 +43757,9 @@ function buildPartialMarkup(element, context, componentName) {
43477
43757
  context,
43478
43758
  typeAwareInfer
43479
43759
  );
43760
+ if (rowBoundParamParts.length > 0) {
43761
+ paramStr += ` ${rowBoundParamParts.join(" ")}`;
43762
+ }
43480
43763
  paramStr += ` content={props.content}`;
43481
43764
  if (context.isPartOfPrefab) {
43482
43765
  paramStr += " prefab={fragment.prefab}";
@@ -44295,6 +44578,7 @@ var getWidgetMarkup = (widgetType, widgetName, commonFields, element) => {
44295
44578
  const timeconfirmationtitle = isDateTimeTag && element.getAttribute("timeconfirmationtitle") ? `timeconfirmationtitle="${(_f = element.getAttribute("timeconfirmationtitle")) == null ? void 0 : _f.replace(/"/g, "&quot;")}"` : "";
44296
44579
  const timecanceltitle = isDateTimeTag && element.getAttribute("timecanceltitle") ? `timecanceltitle="${(_g = element.getAttribute("timecanceltitle")) == null ? void 0 : _g.replace(/"/g, "&quot;")}"` : "";
44297
44580
  const outputformat = element.getAttribute("outputformat") ? `outputformat="${(_h = element.getAttribute("outputformat")) == null ? void 0 : _h.replace(/"/g, "&quot;")}"` : ``;
44581
+ const hyphenatedToComponentName = (str) => str.split("-").map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join("") || "";
44298
44582
  switch (widgetType) {
44299
44583
  case "text":
44300
44584
  case "password":
@@ -44479,6 +44763,13 @@ var getWidgetMarkup = (widgetType, widgetName, commonFields, element) => {
44479
44763
  ${floatinglabel}>
44480
44764
  </wm-colorpicker>`;
44481
44765
  break;
44766
+ default:
44767
+ if (widgetType.toLowerCase().includes("wmx")) {
44768
+ const fromAttr = widgetType == null ? void 0 : widgetType.split("-").at(-1);
44769
+ const componentName = hyphenatedToComponentName((fromAttr || "customwidget").trim()) || "Customwidget";
44770
+ tmpl = `<wmx-component componentname="${componentName}" ${commonFields} ${displayExp}></wmx-component>`;
44771
+ }
44772
+ break;
44482
44773
  }
44483
44774
  return tmpl;
44484
44775
  };
@@ -44514,7 +44805,8 @@ var form_field_transformer_default = {
44514
44805
  element.setAttribute("key", strippedKey);
44515
44806
  }
44516
44807
  }
44517
- if (DATASET_WIDGETS.includes(widgetType)) {
44808
+ const usesDatasetBindings = DATASET_WIDGETS.includes(widgetType) || widgetType.toLowerCase().includes("wmx");
44809
+ if (usesDatasetBindings) {
44518
44810
  if (element.attrs["primary-key"]) {
44519
44811
  element.setAttribute("primaryKey", element.attrs["primary-key"]);
44520
44812
  }
@@ -44886,22 +45178,27 @@ var imports36 = [
44886
45178
  var dialog_transformer_default = {
44887
45179
  pre: (element, context) => {
44888
45180
  element.getAttribute("name");
44889
- const content = new HTMLElement(
44890
- "wm-dialogbody",
44891
- {},
44892
- null,
44893
- element,
44894
- [0, 41]
45181
+ const hasExplicitBody = element.childNodes.some(
45182
+ (e) => isHTMLElement(e) && ["wm-dialogcontent", "wm-dialogbody"].includes(e.tagName.toLowerCase())
44895
45183
  );
44896
- content.nodeType = NodeType.ELEMENT_NODE;
44897
- const actionsIndex = element.childNodes.findIndex(
44898
- (e) => isHTMLElement(e) && e.tagName.toLowerCase() === "wm-dialogactions"
44899
- );
44900
- content.childNodes = element.childNodes;
44901
- element.childNodes = [content];
44902
- if (actionsIndex >= 0) {
44903
- const actions = content.childNodes.splice(actionsIndex, 1);
44904
- actions && element.childNodes.push(actions[0]);
45184
+ if (!hasExplicitBody) {
45185
+ const content = new HTMLElement(
45186
+ "wm-dialogbody",
45187
+ {},
45188
+ null,
45189
+ element,
45190
+ [0, 41]
45191
+ );
45192
+ content.nodeType = NodeType.ELEMENT_NODE;
45193
+ const actionsIndex = element.childNodes.findIndex(
45194
+ (e) => isHTMLElement(e) && e.tagName.toLowerCase() === "wm-dialogactions"
45195
+ );
45196
+ content.childNodes = element.childNodes;
45197
+ element.childNodes = [content];
45198
+ if (actionsIndex >= 0) {
45199
+ const actions = content.childNodes.splice(actionsIndex, 1);
45200
+ actions && element.childNodes.push(actions[0]);
45201
+ }
44905
45202
  }
44906
45203
  return `<WmDialog listener={fragment} ${transformAttrs(element, context)}>`;
44907
45204
  },
@@ -46131,7 +46428,7 @@ function getNearestWizardType(element) {
46131
46428
  while (current) {
46132
46429
  current = current.parentNode;
46133
46430
  if (!current) break;
46134
- if (((_a = current.tagName) == null ? void 0 : _a.toLowerCase()) === "wm-wizard") {
46431
+ if (((_a = current == null ? void 0 : current.tagName) == null ? void 0 : _a.toLowerCase()) === "wm-wizard") {
46135
46432
  const type = current.getAttribute("type");
46136
46433
  if (type) {
46137
46434
  return type;
@@ -46176,7 +46473,7 @@ var imports87 = [
46176
46473
  function getNearestWizardName(element) {
46177
46474
  var _a;
46178
46475
  let current = element.parentNode || null;
46179
- if (((_a = current.tagName) == null ? void 0 : _a.toLowerCase()) === "wm-wizard") {
46476
+ if (((_a = current == null ? void 0 : current.tagName) == null ? void 0 : _a.toLowerCase()) === "wm-wizard") {
46180
46477
  const n = current.getAttribute("name");
46181
46478
  if (n) {
46182
46479
  return n;
@@ -46186,8 +46483,7 @@ function getNearestWizardName(element) {
46186
46483
  }
46187
46484
  function prefixWizardApiReferences(root, wizardRefName) {
46188
46485
  const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
46189
- const wizardApiNames = [
46190
- // primary actions
46486
+ const wizardActionApiNames = [
46191
46487
  "done",
46192
46488
  "next",
46193
46489
  "previous",
@@ -46199,8 +46495,9 @@ function prefixWizardApiReferences(root, wizardRefName) {
46199
46495
  "disableDone",
46200
46496
  "hasNextStep",
46201
46497
  "hasPreviousStep",
46202
- "hasNoNextStep",
46203
- // configurable properties
46498
+ "hasNoNextStep"
46499
+ ];
46500
+ const wizardConfigApiNames = [
46204
46501
  "cancelable",
46205
46502
  "skippable",
46206
46503
  "nextbtnlabel",
@@ -46209,33 +46506,36 @@ function prefixWizardApiReferences(root, wizardRefName) {
46209
46506
  "cancelbtnlabel",
46210
46507
  "actionsalignment"
46211
46508
  ];
46212
- const wizardApiPart = wizardApiNames.map(escapeRe).join("|");
46213
- const reOptional = new RegExp(`fragment\\?\\.(${wizardApiPart})\\b`, "g");
46214
- const rePlain = new RegExp(`fragment\\.(${wizardApiPart})\\b`, "g");
46215
- const reBind = new RegExp(`bind:fragment\\.(${wizardApiPart})\\b`, "g");
46509
+ const actionApiPart = wizardActionApiNames.map(escapeRe).join("|");
46510
+ const configApiPart = wizardConfigApiNames.map(escapeRe).join("|");
46511
+ const reActionOptional = new RegExp(`fragment\\?\\.(${actionApiPart})\\b`, "g");
46512
+ const reActionPlain = new RegExp(`fragment\\.(${actionApiPart})\\b`, "g");
46513
+ const reActionBind = new RegExp(`bind:fragment\\.(${actionApiPart})\\b`, "g");
46514
+ const reConfigOptional = new RegExp(`fragment\\?\\.(${configApiPart})\\b`, "g");
46515
+ const reConfigPlain = new RegExp(`fragment\\.(${configApiPart})\\b`, "g");
46516
+ const reConfigBind = new RegExp(`bind:fragment\\.(${configApiPart})\\b`, "g");
46216
46517
  const rewrite = (val) => {
46217
46518
  if (!val) return val;
46218
46519
  let v = val;
46219
- v = v.replace(reOptional, `fragment?.Widgets?.${wizardRefName}?.$1`);
46220
- v = v.replace(rePlain, `fragment?.Widgets?.${wizardRefName}?.$1`);
46221
- v = v.replace(reBind, `bind:fragment?.Widgets?.${wizardRefName}?.$1`);
46222
- const basePathRe = new RegExp(
46520
+ v = v.replace(reActionBind, "bind:actions?.$1");
46521
+ v = v.replace(reActionOptional, "actions?.$1");
46522
+ v = v.replace(reActionPlain, "actions.$1");
46523
+ v = v.replace(reConfigBind, `bind:fragment?.Widgets?.${wizardRefName}?.$1`);
46524
+ v = v.replace(reConfigOptional, `fragment?.Widgets?.${wizardRefName}?.$1`);
46525
+ v = v.replace(reConfigPlain, `fragment?.Widgets?.${wizardRefName}?.$1`);
46526
+ const actionsPathRe = /(actions)\.([a-zA-Z_$][\w$]*)\(/g;
46527
+ v = v.replace(actionsPathRe, (_m, base, method2) => {
46528
+ return `${base}?.${method2}?.(`;
46529
+ });
46530
+ const widgetPathRe = new RegExp(
46223
46531
  `(fragment\\?\\.Widgets\\?\\.${escapeRe(wizardRefName)})\\.([a-zA-Z_$][\\w$]*)\\(`,
46224
46532
  "g"
46225
46533
  );
46226
- v = v.replace(basePathRe, (_m, base, method2) => {
46534
+ v = v.replace(widgetPathRe, (_m, base, method2) => {
46227
46535
  return `${base}?.${method2}?.(`;
46228
46536
  });
46229
46537
  const method = v.split("?.");
46230
- if (method && method[3] && [
46231
- "cancelable",
46232
- "skippable",
46233
- "nextbtnlabel",
46234
- "previousbtnlabel",
46235
- "donebtnlabel",
46236
- "cancelbtnlabel",
46237
- "actionsalignment"
46238
- ].includes(method[3])) {
46538
+ if (method && method[3] && wizardConfigApiNames.includes(method[3])) {
46239
46539
  return v.slice(0, v.lastIndexOf("?"));
46240
46540
  }
46241
46541
  return v;
@@ -46549,7 +46849,8 @@ var table_row_transformer_default = {
46549
46849
  partial = partialAttr;
46550
46850
  element.removeAttribute("is-table-row");
46551
46851
  }
46552
- return `<WmTableRow listener={fragment} widgetType="${widgetType}" ${transformAttrs(element, context)} ${partial}`;
46852
+ const tableRowProps = buildTableRowProps(element);
46853
+ return `<WmTableRow listener={fragment} widgetType="${widgetType}" ${transformAttrs(element, context)} ${tableRowProps} ${partial}`;
46553
46854
  },
46554
46855
  post: (element, context) => "/>",
46555
46856
  imports: (element, context) => imports91.concat(getPartialImports(element, context))
@@ -46742,7 +47043,7 @@ var extractField2 = (element, context, filterElement) => {
46742
47043
  getAttribute(filterElement, "filterdata"),
46743
47044
  false
46744
47045
  );
46745
- if (widgetType === "number" && isRange) {
47046
+ if (isRange) {
46746
47047
  const maxField = getFilterWidgetTemplate(
46747
47048
  widgetType,
46748
47049
  widgetName,
@@ -46780,8 +47081,9 @@ var getFilterWidgetTemplate = (widgetType, widgetName, element, filterDataVariab
46780
47081
  if (onTap) {
46781
47082
  element.removeAttribute("on-tap");
46782
47083
  }
46783
- const placeholder = getAttribute(element, "placeholder");
46784
- if (placeholder) {
47084
+ const placeholderAttr = isMaxWidget ? "maxplaceholder" : "placeholder";
47085
+ const placeholder = getAttribute(element, placeholderAttr);
47086
+ if (placeholder && !isMaxWidget) {
46785
47087
  element.removeAttribute("placeholder");
46786
47088
  }
46787
47089
  const filterfieldName = getAttribute(element, "name");
@@ -47016,6 +47318,14 @@ var getWidgetMarkup2 = (widgetType, widgetName, commonFields, element) => {
47016
47318
  ${floatinglabel}>
47017
47319
  </wm-colorpicker>`;
47018
47320
  break;
47321
+ default:
47322
+ if (widgetType.toLowerCase().includes("wmx")) {
47323
+ const fromAttr = widgetType == null ? void 0 : widgetType.split("-").at(-1);
47324
+ const hyphenatedToComponentName = (str) => str.split("-").map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join("") || "";
47325
+ const componentName = hyphenatedToComponentName((fromAttr || "customwidget").trim()) || "Customwidget";
47326
+ tmpl = `<wmx-component componentname="${componentName}" ${commonFields} ${displayExp}></wmx-component>`;
47327
+ }
47328
+ break;
47019
47329
  }
47020
47330
  return tmpl;
47021
47331
  };
@@ -47036,7 +47346,7 @@ var live_filter_field_transformer_default = {
47036
47346
  } else {
47037
47347
  filterName = currentNode.getAttribute("name");
47038
47348
  }
47039
- if (DATASET_WIDGETS.includes(widgetType)) {
47349
+ if (DATASET_WIDGETS.includes(widgetType) || widgetType.toLowerCase().includes("wmx")) {
47040
47350
  if (element.attrs["primary-key"]) {
47041
47351
  element.setAttribute("primaryKey", element.attrs["primary-key"]);
47042
47352
  }
@@ -47156,27 +47466,21 @@ var linear_layout_item_default = {
47156
47466
  };
47157
47467
 
47158
47468
  // src/transpile/components/wmx-component/wmx-component.transformer.ts
47159
- var capitalize4 = (str) => {
47160
- return str ? str.split("-").map((s) => s.charAt(0).toUpperCase() + s.substring(1)).join("") : str;
47161
- };
47162
47469
  var wmx_component_transformer_default = {
47163
47470
  pre: (element, context) => {
47164
- const componentName = capitalize4(element.getAttribute("componentname"));
47165
- return `<Wmx${componentName} ${transformAttrs(element, context, inferTypeAndParseProperty)}>`;
47166
- },
47167
- post: (element, context) => {
47168
- const componentName = capitalize4(element.getAttribute("componentname"));
47169
- return `</Wmx${componentName}>`;
47170
- },
47171
- imports: (element, context) => {
47172
- const componentName = capitalize4(element.getAttribute("componentname"));
47173
- return [
47174
- {
47175
- name: `{Wmx${componentName}}`,
47176
- from: `@wavemaker-ai/wmx-components`
47177
- }
47178
- ];
47471
+ const isFormField = element.getAttribute("formfield") === "true";
47472
+ if (isFormField) {
47473
+ element.removeAttribute("formfield");
47474
+ }
47475
+ return `<WmxRenderer listener={fragment} ${transformAttrs(element, context, inferTypeAndParseProperty)} ${isFormField ? " {...$formField}" : ""}/>`;
47179
47476
  },
47477
+ post: () => "",
47478
+ imports: () => [
47479
+ {
47480
+ name: `WmxRenderer`,
47481
+ from: `@wavemaker-ai/react-runtime/components/wmx/WmxRenderer`
47482
+ }
47483
+ ],
47180
47484
  wmxcomponents: (element, context) => [
47181
47485
  element.getAttribute("componentname")
47182
47486
  ]
@@ -47264,6 +47568,7 @@ var transform_register_default = () => {
47264
47568
  registerTransformer("wm-dialog", dialog_transformer_default);
47265
47569
  registerTransformer("wm-dialogactions", dialog_actions_transformer_default);
47266
47570
  registerTransformer("wm-dialogbody", dialog_body_transformer_default);
47571
+ registerTransformer("wm-dialogcontent", dialog_body_transformer_default);
47267
47572
  registerTransformer("wm-logindialog", login_dialog_transformer_default);
47268
47573
  registerTransformer("wm-list", list_transformer_default);
47269
47574
  registerTransformer("wm-listtemplate", list_template_transformer_default);
@@ -47977,6 +48282,6 @@ he/he.js:
47977
48282
  *)
47978
48283
  */
47979
48284
 
47980
- export { serializeVariablesToCode, bind_ex_transformer_default as transformEx, transformMarkup, variable_transformer_default as transformVariable, transpileVariableDefinitions };
48285
+ export { buildCssScopeClass, fixURLPathAndScope, scopeCssUnderWmApp, serializeVariablesToCode, bind_ex_transformer_default as transformEx, transformMarkup, variable_transformer_default as transformVariable, transpileVariableDefinitions };
47981
48286
  //# sourceMappingURL=index.mjs.map
47982
48287
  //# sourceMappingURL=index.mjs.map