@wavemaker-ai/react-codegen 1.0.0-rc.322 → 1.0.0-rc.326

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 (54) hide show
  1. package/dist/transpiler/index.d.mts +16 -1
  2. package/dist/transpiler/index.mjs +369 -55
  3. package/dist/transpiler/index.mjs.map +1 -1
  4. package/dist/transpiler/wm-styles.css +150 -35
  5. package/package-lock.json +102 -113
  6. package/package.json +1 -1
  7. package/src/app.generator.js +16 -1
  8. package/src/app.generator.js.map +1 -1
  9. package/src/transpile/bind.ex.transformer.js +12 -4
  10. package/src/transpile/bind.ex.transformer.js.map +1 -1
  11. package/src/transpile/components/container/wizardaction.transformer.js +26 -25
  12. package/src/transpile/components/container/wizardaction.transformer.js.map +1 -1
  13. package/src/transpile/components/data/form/form-action.transformer.js +8 -3
  14. package/src/transpile/components/data/form/form-action.transformer.js.map +1 -1
  15. package/src/transpile/components/data/form/form-field.transformer.js +8 -5
  16. package/src/transpile/components/data/form/form-field.transformer.js.map +1 -1
  17. package/src/transpile/components/data/list/list-transformer.js +1 -1
  18. package/src/transpile/components/data/list/list-transformer.js.map +1 -1
  19. package/src/transpile/components/data/live-filter-field.transformer.js +5 -4
  20. package/src/transpile/components/data/live-filter-field.transformer.js.map +1 -1
  21. package/src/transpile/components/data/table/table-row.transformer.js +3 -1
  22. package/src/transpile/components/data/table/table-row.transformer.js.map +1 -1
  23. package/src/transpile/components/data/table/table.transformer.js +20 -10
  24. package/src/transpile/components/data/table/table.transformer.js.map +1 -1
  25. package/src/transpile/components/data/table/utils.js +70 -0
  26. package/src/transpile/components/data/table/utils.js.map +1 -1
  27. package/src/transpile/components/dialogs/dialog-actions.transformer.js +1 -1
  28. package/src/transpile/components/dialogs/dialog-actions.transformer.js.map +1 -1
  29. package/src/transpile/components/input/chips.transformer.js +1 -0
  30. package/src/transpile/components/input/chips.transformer.js.map +1 -1
  31. package/src/transpile/components/page/build-partial-markup.js +24 -2
  32. package/src/transpile/components/page/build-partial-markup.js.map +1 -1
  33. package/src/transpile/components/utils.js +9 -4
  34. package/src/transpile/components/utils.js.map +1 -1
  35. package/src/transpile/property/property-parser.js +3 -0
  36. package/src/transpile/property/property-parser.js.map +1 -1
  37. package/src/transpile/transpile.js +44 -4
  38. package/src/transpile/transpile.js.map +1 -1
  39. package/src/transpile/transpiler.js +5 -1
  40. package/src/transpile/transpiler.js.map +1 -1
  41. package/src/transpile/widget-inline-style-constants.js +5 -2
  42. package/src/transpile/widget-inline-style-constants.js.map +1 -1
  43. package/src/transpile/widget-inline-style-processor.js +7 -4
  44. package/src/transpile/widget-inline-style-processor.js.map +1 -1
  45. package/src/utils.browser.js +92 -42
  46. package/src/utils.browser.js.map +1 -1
  47. package/src/utils.js +5 -158
  48. package/src/utils.js.map +1 -1
  49. package/templates/component/component.hbs +1 -0
  50. package/templates/component/partial.hbs +1 -0
  51. package/templates/project/app/autoLayout.css +31 -30
  52. package/templates/project/app/components.css +110 -0
  53. package/templates/project/app/widgetInlineStylesOverride.css +9 -5
  54. package/templates/project/package.json +4 -4
@@ -39249,6 +39249,22 @@ var addOptionalChaining = (bindPath, options = {}) => {
39249
39249
  }
39250
39250
  return result;
39251
39251
  };
39252
+ var fixURLPath = (file_content, basePath, isAppCss) => {
39253
+ let updatedContent = file_content.replace(
39254
+ /url\((['"]?)resources/g,
39255
+ `url($1${basePath || ""}/resources`
39256
+ );
39257
+ if (isAppCss) {
39258
+ updatedContent = updatedContent.replace(
39259
+ /url\((['"])(?!\/|http|data:)([^'"]+)\1\)/g,
39260
+ (match, quote, url) => {
39261
+ const fixedUrl = url.startsWith("/") ? url : `/${url}`;
39262
+ return `url(${quote}${fixedUrl}${quote})`;
39263
+ }
39264
+ );
39265
+ }
39266
+ return updatedContent;
39267
+ };
39252
39268
  var transformAppLocale = (exp) => {
39253
39269
  if (exp.startsWith("fragment?.Prefab") || exp.startsWith("fragment.Prefab")) {
39254
39270
  exp = exp.replace("fragment?.Prefab", "fragment");
@@ -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",
@@ -39328,6 +39506,7 @@ var htmlElements = [
39328
39506
  var FORMAT_CONTEXT = "{formatContext:''}";
39329
39507
  var FORMAT_CONTEXT_REGEX = /\{formatContext:''\}/g;
39330
39508
  var FRAGMENT_SCOPED_NAMES = ["appLocale", "Variables"];
39509
+ var LIST_SCOPE_VARS = /* @__PURE__ */ new Set(["currentItemWidgets"]);
39331
39510
  var ExpressionTransformer = class {
39332
39511
  constructor(ctx = "this", mode = "attr") {
39333
39512
  this.ctx = ctx;
@@ -39357,10 +39536,16 @@ var ExpressionTransformer = class {
39357
39536
  if (this.mode === "event" && ast.receiver instanceof ImplicitReceiver && ast.name === "$event") {
39358
39537
  return "$event";
39359
39538
  }
39539
+ if (ast.receiver instanceof ImplicitReceiver && LIST_SCOPE_VARS.has(ast.name)) {
39540
+ return ast.name;
39541
+ }
39360
39542
  const r = this.build(ast.receiver);
39361
39543
  return `${r}.${ast.name}`;
39362
39544
  }
39363
39545
  processSafePropertyRead(ast) {
39546
+ if (ast.receiver instanceof ImplicitReceiver && LIST_SCOPE_VARS.has(ast.name)) {
39547
+ return ast.name;
39548
+ }
39364
39549
  const r = this.build(ast.receiver);
39365
39550
  return `${r}?.${ast.name}`;
39366
39551
  }
@@ -40399,14 +40584,16 @@ var transformRepeatChildAttr = (element, replace2, replaceWith) => {
40399
40584
  if (isList) {
40400
40585
  return;
40401
40586
  }
40402
- let value = element.attributes[name];
40403
- value = removeOptionChaining(value);
40587
+ const value = element.attributes[name];
40404
40588
  const regex = new RegExp(
40405
40589
  replace2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "(?![a-zA-Z_$0-9])",
40406
40590
  "g"
40407
40591
  );
40408
- value = value.replace(regex, replaceWith);
40409
- element.setAttribute(name, value);
40592
+ const stripped = removeOptionChaining(value);
40593
+ const replaced = stripped.replace(regex, replaceWith);
40594
+ if (replaced !== stripped) {
40595
+ element.setAttribute(name, replaced);
40596
+ }
40410
40597
  });
40411
40598
  element.childNodes.forEach((c) => {
40412
40599
  if (isHTMLElement(c)) {
@@ -40806,6 +40993,7 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
40806
40993
  ["flexshrink", NUMERIC_PARSER],
40807
40994
  ["hastwowaybinding", BOOLEAN_PARSER],
40808
40995
  ["headernavigation", BOOLEAN_PARSER],
40996
+ ["hidden", BOOLEAN_PARSER],
40809
40997
  ["hideclose", BOOLEAN_PARSER],
40810
40998
  ["iconsize", STRING_PARSER],
40811
40999
  ["imageheight", STRING_PARSER],
@@ -40889,7 +41077,8 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
40889
41077
  ["fastload", BOOLEAN_PARSER],
40890
41078
  ["enablescroll", BOOLEAN_PARSER],
40891
41079
  ["showactions", BOOLEAN_PARSER],
40892
- ["popoverarrow", BOOLEAN_PARSER]
41080
+ ["popoverarrow", BOOLEAN_PARSER],
41081
+ ["enablefullscreen", BOOLEAN_PARSER]
40893
41082
  ])
40894
41083
  ],
40895
41084
  [
@@ -40922,6 +41111,7 @@ var PARSER_MAP = /* @__PURE__ */ new Map([
40922
41111
  ["wm-progress-circle", /* @__PURE__ */ new Map([["datavalue", NUMERIC_PARSER]])],
40923
41112
  ["wm-video", /* @__PURE__ */ new Map([["controls", BOOLEAN_PARSER]])],
40924
41113
  ["wm-chips", /* @__PURE__ */ new Map([["searchable", BOOLEAN_PARSER]])],
41114
+ ["wm-table-row", /* @__PURE__ */ new Map([["columnwidth", UNIT_PARSER]])],
40925
41115
  [
40926
41116
  "wm-table",
40927
41117
  /* @__PURE__ */ new Map([
@@ -41055,6 +41245,7 @@ var ALIGNMENT_MATRIX = {
41055
41245
  center: { justifyContent: "space-between", alignItems: "center" },
41056
41246
  end: { justifyContent: "space-between", alignItems: "flex-end" }
41057
41247
  };
41248
+ var AUTOLAYOUT_CLASS_PREFIX = "wm-";
41058
41249
  var CSS_PROP_PREFIX = {
41059
41250
  display: "d",
41060
41251
  "flex-direction": "fd",
@@ -41195,7 +41386,7 @@ var AUTOLAYOUT_WIDGET_TAGS = /* @__PURE__ */ new Set([
41195
41386
  "wm-page-content"
41196
41387
  ]);
41197
41388
  var STYLE_OVERLAPPING_LAYOUT_ATTRS = ["overflow", "zindex", "clipcontent"];
41198
- var PREDEFINED_CLASS_NAMES = [
41389
+ var PREDEFINED_CLASS_SUFFIXES = [
41199
41390
  "d-flex",
41200
41391
  "fd-row",
41201
41392
  "fd-column",
@@ -41227,6 +41418,9 @@ var PREDEFINED_CLASS_NAMES = [
41227
41418
  "pos-sticky",
41228
41419
  "pos-fixed"
41229
41420
  ];
41421
+ var PREDEFINED_CLASS_NAMES = PREDEFINED_CLASS_SUFFIXES.map(
41422
+ (cls) => `${AUTOLAYOUT_CLASS_PREFIX}${cls}`
41423
+ );
41230
41424
 
41231
41425
  // src/transpile/style/split-css-shorthand.ts
41232
41426
  function splitCssShorthandOnSpaces(value) {
@@ -41277,7 +41471,10 @@ function splitCssShorthandOnSpaces(value) {
41277
41471
 
41278
41472
  // src/transpile/widget-inline-style-processor.ts
41279
41473
  var isBind = (v) => !!(v && (v.startsWith("bind:") || v.startsWith("{")));
41280
- var hasValidDir = (v) => v === "row" || v === "column";
41474
+ var hasValidDir = (v) => {
41475
+ const d = v == null ? void 0 : v.trim();
41476
+ return d === "row" || d === "column";
41477
+ };
41281
41478
  var isAuto = (v) => v === "auto";
41282
41479
  var normalizeGap = (v) => v != null && v !== "" && !isAuto(v) ? v : null;
41283
41480
  function parseDimensionValue(value, element) {
@@ -41331,7 +41528,7 @@ function sanitizeValue(value) {
41331
41528
  }
41332
41529
  function cssToClassName(property, value) {
41333
41530
  const prefix = CSS_PROP_PREFIX[property] || property.replace(/-/g, "");
41334
- return `${prefix}-${sanitizeValue(value)}`;
41531
+ return `${AUTOLAYOUT_CLASS_PREFIX}${prefix}-${sanitizeValue(value)}`;
41335
41532
  }
41336
41533
  function stripBalancedOuterParens(expr) {
41337
41534
  let e = expr;
@@ -41467,7 +41664,7 @@ function computeLayoutCssProperties(props) {
41467
41664
  var _a;
41468
41665
  const css = {};
41469
41666
  if (hasValidDir(props.direction)) {
41470
- const direction = props.direction;
41667
+ const direction = props.direction.trim();
41471
41668
  const hasAlignment = !!props.alignment;
41472
41669
  const alignment = props.alignment || "top-left";
41473
41670
  const wrap2 = direction === "column" ? false : (_a = props.wrap) != null ? _a : false;
@@ -41621,7 +41818,7 @@ var AutolayoutCodegen = class {
41621
41818
  if (tagName === "wm-list") return null;
41622
41819
  const parent = element.parentNode;
41623
41820
  const dir = ((_c = parent == null ? void 0 : parent.getAttribute) == null ? void 0 : _c.call(parent, "direction")) || null;
41624
- return dir && hasValidDir(dir) ? dir : null;
41821
+ return dir && hasValidDir(dir) ? dir.trim() : null;
41625
41822
  }
41626
41823
  // Collect flex props for a single dimension, axis-aware to avoid cross-axis conflicts.
41627
41824
  collectSizeFlexProps(element, key, val, flexProps) {
@@ -41924,6 +42121,65 @@ function convertActionToClickHandler(actionAttr, tableName, liveTableName) {
41924
42121
  ${converted.join("\n ")}
41925
42122
  }}`;
41926
42123
  }
42124
+ function isRowBoundExpression(value) {
42125
+ if (!value || typeof value !== "string") return false;
42126
+ const exp = value.startsWith("bind:") ? value.substring(5).trim() : value;
42127
+ return /fragment\??\.row/.test(exp) || /\brow\./.test(exp) || /\brow\[/.test(exp);
42128
+ }
42129
+ function transformTableRowPropExpression(expression) {
42130
+ if (!expression) return "";
42131
+ let transformed = expression.replace(/fragment\??\.row/g, "row");
42132
+ transformed = transformed.replace(/\brow\./g, "row?.");
42133
+ transformed = transformed.replace(/\brow\[/g, "row?.[");
42134
+ transformed = addOptionalChaining(transformed);
42135
+ transformed = transformed.replace(/row\?\?\./g, "row?.");
42136
+ transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
42137
+ return transformed;
42138
+ }
42139
+ function transformTableRowCurrentItemExpression(expression) {
42140
+ if (!expression) return "";
42141
+ const raw = expression.startsWith("bind:") ? expression.substring(5).trim() : expression;
42142
+ let transformed = raw.replace(/fragment\??\.row/g, "currentItem");
42143
+ transformed = transformed.replace(/\brow\./g, "currentItem?.");
42144
+ transformed = transformed.replace(/\brow\[/g, "currentItem?.[");
42145
+ transformed = addOptionalChaining(transformed);
42146
+ transformed = transformed.replace(/currentItem\?\?\./g, "currentItem?.");
42147
+ transformed = transformed.replace(/(\w+)\?\.\s*\(/g, "$1(");
42148
+ return transformed;
42149
+ }
42150
+ var TABLE_ROW_PROPS_SKIP_ATTRS = /* @__PURE__ */ new Set([
42151
+ "name",
42152
+ "class",
42153
+ "className",
42154
+ "content",
42155
+ "widget-type",
42156
+ "display-name",
42157
+ "displayName",
42158
+ "rowType",
42159
+ "is-table-row",
42160
+ "data-widget-id",
42161
+ "styles",
42162
+ "style"
42163
+ ]);
42164
+ function buildTableRowProps(element) {
42165
+ const parts = [];
42166
+ const toRemove = [];
42167
+ for (const name of Object.keys(element.attributes)) {
42168
+ if (TABLE_ROW_PROPS_SKIP_ATTRS.has(name)) continue;
42169
+ const value = element.attributes[name];
42170
+ if (!isRowBoundExpression(value)) continue;
42171
+ const exp = transformTableRowPropExpression(value.substring(5).trim());
42172
+ if (name === "show") {
42173
+ parts.push(`show: (${exp} || false)`);
42174
+ } else {
42175
+ parts.push(`${name}: ${exp}`);
42176
+ }
42177
+ toRemove.push(name);
42178
+ }
42179
+ toRemove.forEach((attr) => element.removeAttribute(attr));
42180
+ if (parts.length === 0) return "";
42181
+ return `tableRowProps={(row: any) => ({${parts.join(", ")}})}`;
42182
+ }
41927
42183
  function transformTableColumnClassExpression(expression) {
41928
42184
  if (!expression) return "";
41929
42185
  let transformed = expression.replace(/fragment\??\.row/g, "rowData");
@@ -42017,6 +42273,18 @@ function extractVariableNamesFromElement(e) {
42017
42273
  });
42018
42274
  return Array.from(vars);
42019
42275
  }
42276
+ function extractActivePageDeps(source) {
42277
+ const deps = /* @__PURE__ */ new Set();
42278
+ const pattern = /fragment(?:\?\.|\.)App(?:\?\.|\.)activePage((?:(?:\?\.|\.)[a-zA-Z0-9_$]+)+)/g;
42279
+ for (const m of source.matchAll(pattern)) {
42280
+ const path = m[1].replace(/\?\./g, ".").replace(/^\./, "");
42281
+ if (path) {
42282
+ deps.add(path);
42283
+ }
42284
+ }
42285
+ const all = Array.from(deps);
42286
+ return all.filter((path) => !all.some((other) => other !== path && other.startsWith(`${path}.`)));
42287
+ }
42020
42288
  var EVENT_NAME_MAP = {
42021
42289
  "on-dblclick": "on-doubleClick",
42022
42290
  "on-mouseenter": "on-mouseEnter",
@@ -42354,7 +42622,8 @@ var _Transpiler = class _Transpiler {
42354
42622
  transformStyles(e, context) {
42355
42623
  var _a, _b;
42356
42624
  let rawStylesObj = {};
42357
- const rawStyles = e.getAttribute("styles");
42625
+ const style_attr = e.getAttribute("style");
42626
+ const rawStyles = e.getAttribute("styles") || style_attr;
42358
42627
  if (rawStyles && !rawStyles.startsWith("bind:") && !rawStyles.startsWith("{")) {
42359
42628
  rawStyles.split(";").forEach((rule) => {
42360
42629
  const colonIdx = rule.indexOf(":");
@@ -42368,6 +42637,9 @@ var _Transpiler = class _Transpiler {
42368
42637
  }
42369
42638
  });
42370
42639
  e.removeAttribute("styles");
42640
+ if (style_attr) {
42641
+ e.removeAttribute("style");
42642
+ }
42371
42643
  }
42372
42644
  const hasConditionalStyles = e.getAttribute("conditionalstyle");
42373
42645
  if (hasConditionalStyles) {
@@ -42866,7 +43138,9 @@ _Transpiler.SKELETON_ATTR_RENAME = {
42866
43138
  _Transpiler.FRAGMENT_CALLEE_REF = /^fragment(?:\??\.[a-zA-Z_$][\w$]*|(?:\?\.)?\[[^\]]*\])*$/;
42867
43139
  // Callee paths rooted at runtime instance objects (Actions, Variables) whose methods
42868
43140
  // (invoke, navigate, setData, …) rely on `this` and must not be emitted as detached refs.
42869
- _Transpiler.INSTANCE_BOUND_CALLEE = /(?:\?\.|\.)(?:Actions|Variables)(?:\?\.|\.|\[|$)/;
43141
+ // Anchored to `fragment` so `fragment?.myService?.Actions?.run` (custom object that happens
43142
+ // to have an Actions property) is NOT incorrectly forced into an arrow wrapper.
43143
+ _Transpiler.INSTANCE_BOUND_CALLEE = /^fragment(?:\?\.|\.)(?:Actions|Variables)(?:\?\.|\.|\[|$)/;
42870
43144
  var Transpiler = _Transpiler;
42871
43145
  var transpiler = new Transpiler();
42872
43146
  var registerTransformer = transpiler.registerTransformer.bind(transpiler);
@@ -42928,6 +43202,8 @@ var transpileMarkup = (markup, isPartOfPrefab, splitCode, variables, preview, in
42928
43202
  }
42929
43203
  });
42930
43204
  finalResult.autolayoutCss = autolayoutCodegen.getDynamicCssRules();
43205
+ const generatedSource = [finalResult.markup, ...Object.values(finalResult.components)].join("\n");
43206
+ finalResult.activePageDeps = extractActivePageDeps(generatedSource);
42931
43207
  return finalResult;
42932
43208
  };
42933
43209
  var transformAttrs = transpiler.transformAttrs.bind(transpiler);
@@ -42974,7 +43250,7 @@ var createExpression = (element, attrName) => {
42974
43250
  }
42975
43251
  displayexpression = displayexpression.replace(
42976
43252
  /fragment\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g,
42977
- "$item.$1"
43253
+ (match, name) => FRAGMENT_SCOPED_NAMES.includes(name) ? match : `$item.${name}`
42978
43254
  );
42979
43255
  displayexpression = addOptionalChaining(displayexpression);
42980
43256
  const exp = (0, import_lodash5.includes)(displayexpression, "(") ? `${displayexpression}` : displayexpression;
@@ -43415,26 +43691,46 @@ function buildPartialMarkup(element, context, componentName) {
43415
43691
  });
43416
43692
  }
43417
43693
  const watch = [];
43694
+ const typedParams = /* @__PURE__ */ new Set();
43695
+ const rowBoundParamParts = [];
43696
+ const isTableRow = element.hasAttribute("is-table-row");
43418
43697
  element.childNodes.filter((node) => isHTMLElement(node) && node.tagName === "WM-PARAM").forEach((node) => {
43419
43698
  const e = node;
43420
43699
  const name2 = e.getAttribute("name") || "";
43421
43700
  let value = e.getAttribute("value") || "";
43701
+ const type = e.getAttribute("type") || "";
43422
43702
  if (value.includes("currentItem")) {
43423
43703
  const match = value.match(/currentItem\..+/);
43424
43704
  if (match) {
43425
43705
  value = `bind:${match[0]}`;
43426
43706
  }
43427
43707
  }
43428
- params[name2] = value;
43708
+ if (isTableRow && isRowBoundExpression(value)) {
43709
+ rowBoundParamParts.push(`${name2}={${transformTableRowCurrentItemExpression(value)}}`);
43710
+ } else {
43711
+ params[name2] = value;
43712
+ }
43713
+ if (type && ["string", "boolean", "number"].includes(type)) {
43714
+ typedParams.add(name2);
43715
+ }
43429
43716
  watch.push(name2);
43430
43717
  });
43431
43718
  const syntheticTag = componentName.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
43432
43719
  let paramStr = Object.keys(params).filter((k) => k !== "on-load").map((k) => `${k}="${(0, import_html_entities.encode)(params[k])}"`).join(" ");
43720
+ const typeAwareInfer = (name2, valWithQuotes) => {
43721
+ if (typedParams.has(name2)) {
43722
+ return valWithQuotes;
43723
+ }
43724
+ return inferTypeAndParseProperty(name2, valWithQuotes);
43725
+ };
43433
43726
  paramStr = transformAttrs(
43434
43727
  parse5(`<${syntheticTag} ${paramStr}/>`).firstChild,
43435
43728
  context,
43436
- inferTypeAndParseProperty
43729
+ typeAwareInfer
43437
43730
  );
43731
+ if (rowBoundParamParts.length > 0) {
43732
+ paramStr += ` ${rowBoundParamParts.join(" ")}`;
43733
+ }
43438
43734
  paramStr += ` content={props.content}`;
43439
43735
  if (context.isPartOfPrefab) {
43440
43736
  paramStr += " prefab={fragment.prefab}";
@@ -43854,7 +44150,7 @@ var buildItemAttrsFromListTemplate = (template, context) => {
43854
44150
  if (autoLayoutResult && autolayout) {
43855
44151
  parts.push(`layoutClassName: ${autolayout.buildItemAttrsClassName(autoLayoutResult)}`);
43856
44152
  }
43857
- const skipAttrs = /* @__PURE__ */ new Set(["name", "data-widget-id", "item-id"]);
44153
+ const skipAttrs = /* @__PURE__ */ new Set(["name", "data-widget-id", "item-id", "layout"]);
43858
44154
  if (autoLayoutResult) {
43859
44155
  for (const name of LAYOUT_ATTR_NAMES) skipAttrs.add(name);
43860
44156
  }
@@ -44177,13 +44473,15 @@ var getFormWidgetTemplate = (widgetType, widgetName, element, formDataVariable)
44177
44473
  widgetName = widgetName.replace(".", "_");
44178
44474
  (_b = (_a = getAttribute(element, "key")) == null ? void 0 : _a.split(".")) == null ? void 0 : _b.at(-1);
44179
44475
  const formfieldName = getAttribute(element, "name");
44180
- var labelMarkup = getAttribute(element, "displayname") ? `<wm-label
44476
+ const displayname = getAttribute(element, "displayname");
44477
+ var labelMarkup = `<wm-label
44181
44478
  required="bind:$formField.required"
44182
44479
  htmlFor="${formfieldName}_formWidget"
44183
44480
  caption="bind:$formField.displayname"
44184
44481
  class="app-label control-label formfield-label"
44185
44482
  conditionalclass="bind:$formField.captionCls + ' ' + $formField.invalidCls"
44186
- name="${widgetName}_formLabel"></wm-label>` : "";
44483
+ name="${widgetName}_formLabel"
44484
+ ${!displayname ? 'hidden="true"' : ""}></wm-label>`;
44187
44485
  const onFocus = getAttribute(element, "on-focus");
44188
44486
  if (onFocus) {
44189
44487
  element.removeAttribute("on-focus");
@@ -44312,6 +44610,7 @@ var getWidgetMarkup = (widgetType, widgetName, commonFields, element) => {
44312
44610
  ></wm-search>`;
44313
44611
  break;
44314
44612
  case "chips":
44613
+ const chipsDatasource = getDatasourceExpr(element);
44315
44614
  const chipsKeyAttribute = element.getAttribute("key");
44316
44615
  if (chipsKeyAttribute) {
44317
44616
  element.setAttribute("searchkey", chipsKeyAttribute);
@@ -44325,6 +44624,7 @@ var getWidgetMarkup = (widgetType, widgetName, commonFields, element) => {
44325
44624
  dataset="bind:$formField.dataset || 'Option 1, Option 2, Option 3'"
44326
44625
  displayfield="bind:$formField.displayfield"
44327
44626
  datafield="bind:$formField.datafield"
44627
+ ${chipsDatasource ? `datasource="${chipsDatasource}"` : ""}
44328
44628
  ></wm-chips>`;
44329
44629
  break;
44330
44630
  case "checkbox":
@@ -44452,7 +44752,8 @@ var form_field_transformer_default = {
44452
44752
  formName = currentNode.getAttribute("dynamicForm");
44453
44753
  formScope = `formScope={() => fragment?.Widgets?.${formName}}`;
44454
44754
  } else {
44455
- formName = currentNode == null ? void 0 : currentNode.getAttribute("name");
44755
+ const itemId = currentNode == null ? void 0 : currentNode.getAttribute("item-id");
44756
+ formName = itemId || (currentNode == null ? void 0 : currentNode.getAttribute("name"));
44456
44757
  }
44457
44758
  const formdataPrefix = currentNode == null ? void 0 : currentNode.getAttribute("formdataprefix");
44458
44759
  if (formdataPrefix) {
@@ -44748,13 +45049,16 @@ var form_action_transformer_default = {
44748
45049
  formName = formName.replace("bind:", "");
44749
45050
  isDynamicFormName = true;
44750
45051
  }
44751
- const actionType = element.getAttribute("type");
45052
+ const actionType = element.getAttribute("type") || "button";
45053
+ if (!element.getAttribute("type")) {
45054
+ element.setAttribute("type", "button");
45055
+ }
44752
45056
  const name = element.getAttribute("name");
44753
45057
  let action = element.getAttribute("action");
44754
- let btnClass = "btn-default";
44755
45058
  const listPrefix = "list.itemWidgets[$index]";
44756
45059
  const fragmentPrefix = "fragment?.Widgets";
44757
45060
  const widgetsPrefix = "Widgets";
45061
+ let btnClass = "btn-default";
44758
45062
  if (actionType === "submit") {
44759
45063
  btnClass = "btn-primary";
44760
45064
  action = listName ? getWidgetAccessor(listPrefix, formName, "?.submit();", isDynamicFormName) + (action || "") : getWidgetAccessor(widgetsPrefix, formName, "?.submit();", isDynamicFormName) + (action || "");
@@ -44795,7 +45099,9 @@ var form_action_transformer_default = {
44795
45099
  }
44796
45100
  }).join(";");
44797
45101
  }
44798
- element.setAttribute("btnClass", btnClass);
45102
+ if (!element.hasAttribute("class")) {
45103
+ element.setAttribute("class", btnClass);
45104
+ }
44799
45105
  element.removeAttribute("formKey");
44800
45106
  element.removeAttribute("action");
44801
45107
  element.setAttribute("name", name || key || formName);
@@ -44888,7 +45194,7 @@ var dialog_actions_transformer_default = {
44888
45194
  applyAttr(
44889
45195
  element,
44890
45196
  new RegExp("closeDialog(\\?\\.)?\\(\\)", "g"),
44891
- `Widgets?.${widgetName}?.close()`
45197
+ `Widgets?.${widgetName}?.close?.()`
44892
45198
  );
44893
45199
  }
44894
45200
  return `<WmDialogActions ${transformAttrs(element, context)}>`;
@@ -45912,6 +46218,7 @@ var chips_transformer_default = {
45912
46218
  if (getDisplayExpression2) {
45913
46219
  element.removeAttribute("displayexpression");
45914
46220
  }
46221
+ getDatasourceExpr(element);
45915
46222
  return `<WmChips listener={fragment} ${isFormField ? " {...$formField}" : ""} ${getDisplayExpression2 ? `displayexpression=${getDisplayExpression2}` : ""} ${extractDatasetInfo(element)} ${transformAttrs(element, context)}>`;
45916
46223
  },
45917
46224
  post: (element, context) => "</WmChips>",
@@ -46133,8 +46440,7 @@ function getNearestWizardName(element) {
46133
46440
  }
46134
46441
  function prefixWizardApiReferences(root, wizardRefName) {
46135
46442
  const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
46136
- const wizardApiNames = [
46137
- // primary actions
46443
+ const wizardActionApiNames = [
46138
46444
  "done",
46139
46445
  "next",
46140
46446
  "previous",
@@ -46146,8 +46452,9 @@ function prefixWizardApiReferences(root, wizardRefName) {
46146
46452
  "disableDone",
46147
46453
  "hasNextStep",
46148
46454
  "hasPreviousStep",
46149
- "hasNoNextStep",
46150
- // configurable properties
46455
+ "hasNoNextStep"
46456
+ ];
46457
+ const wizardConfigApiNames = [
46151
46458
  "cancelable",
46152
46459
  "skippable",
46153
46460
  "nextbtnlabel",
@@ -46156,33 +46463,36 @@ function prefixWizardApiReferences(root, wizardRefName) {
46156
46463
  "cancelbtnlabel",
46157
46464
  "actionsalignment"
46158
46465
  ];
46159
- const wizardApiPart = wizardApiNames.map(escapeRe).join("|");
46160
- const reOptional = new RegExp(`fragment\\?\\.(${wizardApiPart})\\b`, "g");
46161
- const rePlain = new RegExp(`fragment\\.(${wizardApiPart})\\b`, "g");
46162
- const reBind = new RegExp(`bind:fragment\\.(${wizardApiPart})\\b`, "g");
46466
+ const actionApiPart = wizardActionApiNames.map(escapeRe).join("|");
46467
+ const configApiPart = wizardConfigApiNames.map(escapeRe).join("|");
46468
+ const reActionOptional = new RegExp(`fragment\\?\\.(${actionApiPart})\\b`, "g");
46469
+ const reActionPlain = new RegExp(`fragment\\.(${actionApiPart})\\b`, "g");
46470
+ const reActionBind = new RegExp(`bind:fragment\\.(${actionApiPart})\\b`, "g");
46471
+ const reConfigOptional = new RegExp(`fragment\\?\\.(${configApiPart})\\b`, "g");
46472
+ const reConfigPlain = new RegExp(`fragment\\.(${configApiPart})\\b`, "g");
46473
+ const reConfigBind = new RegExp(`bind:fragment\\.(${configApiPart})\\b`, "g");
46163
46474
  const rewrite = (val) => {
46164
46475
  if (!val) return val;
46165
46476
  let v = val;
46166
- v = v.replace(reOptional, `fragment?.Widgets?.${wizardRefName}?.$1`);
46167
- v = v.replace(rePlain, `fragment?.Widgets?.${wizardRefName}?.$1`);
46168
- v = v.replace(reBind, `bind:fragment?.Widgets?.${wizardRefName}?.$1`);
46169
- const basePathRe = new RegExp(
46477
+ v = v.replace(reActionBind, "bind:actions?.$1");
46478
+ v = v.replace(reActionOptional, "actions?.$1");
46479
+ v = v.replace(reActionPlain, "actions.$1");
46480
+ v = v.replace(reConfigBind, `bind:fragment?.Widgets?.${wizardRefName}?.$1`);
46481
+ v = v.replace(reConfigOptional, `fragment?.Widgets?.${wizardRefName}?.$1`);
46482
+ v = v.replace(reConfigPlain, `fragment?.Widgets?.${wizardRefName}?.$1`);
46483
+ const actionsPathRe = /(actions)\.([a-zA-Z_$][\w$]*)\(/g;
46484
+ v = v.replace(actionsPathRe, (_m, base, method2) => {
46485
+ return `${base}?.${method2}?.(`;
46486
+ });
46487
+ const widgetPathRe = new RegExp(
46170
46488
  `(fragment\\?\\.Widgets\\?\\.${escapeRe(wizardRefName)})\\.([a-zA-Z_$][\\w$]*)\\(`,
46171
46489
  "g"
46172
46490
  );
46173
- v = v.replace(basePathRe, (_m, base, method2) => {
46491
+ v = v.replace(widgetPathRe, (_m, base, method2) => {
46174
46492
  return `${base}?.${method2}?.(`;
46175
46493
  });
46176
46494
  const method = v.split("?.");
46177
- if (method && method[3] && [
46178
- "cancelable",
46179
- "skippable",
46180
- "nextbtnlabel",
46181
- "previousbtnlabel",
46182
- "donebtnlabel",
46183
- "cancelbtnlabel",
46184
- "actionsalignment"
46185
- ].includes(method[3])) {
46495
+ if (method && method[3] && wizardConfigApiNames.includes(method[3])) {
46186
46496
  return v.slice(0, v.lastIndexOf("?"));
46187
46497
  }
46188
46498
  return v;
@@ -46496,7 +46806,8 @@ var table_row_transformer_default = {
46496
46806
  partial = partialAttr;
46497
46807
  element.removeAttribute("is-table-row");
46498
46808
  }
46499
- return `<WmTableRow listener={fragment} widgetType="${widgetType}" ${transformAttrs(element, context)} ${partial}`;
46809
+ const tableRowProps = buildTableRowProps(element);
46810
+ return `<WmTableRow listener={fragment} widgetType="${widgetType}" ${transformAttrs(element, context)} ${tableRowProps} ${partial}`;
46500
46811
  },
46501
46812
  post: (element, context) => "/>",
46502
46813
  imports: (element, context) => imports91.concat(getPartialImports(element, context))
@@ -46591,18 +46902,20 @@ var table_transformer_default = {
46591
46902
  const datasetAttr = element.getAttribute("dataset");
46592
46903
  const datasourceAttr = element.getAttribute("datasource");
46593
46904
  const binddatasetAttr = element.getAttribute("binddataset");
46594
- if (datasetAttr && datasetAttr.startsWith("bind:fragment.Variables.") && datasetAttr.includes(".dataSet")) {
46905
+ if (datasetAttr && datasetAttr.includes(".dataSet")) {
46595
46906
  const match = datasetAttr.match(
46596
- /^bind:fragment\.Variables\.([^.]+)\.dataSet(?=[^A-Za-z0-9_]|$)/
46907
+ /^bind:fragment\.((?:App\.activePage\.|App\.)?Variables)\.([^.]+)\.dataSet(?=[^A-Za-z0-9_]|$)/
46597
46908
  );
46598
46909
  if (match) {
46599
- const variableName = match[1];
46910
+ const scopePath = match[1];
46911
+ const variableName = match[2];
46600
46912
  context.set("tableDatasetVariableName", variableName);
46601
46913
  if (!datasourceAttr) {
46602
- element.setAttribute("datasource", `{fragment?.Variables?.${variableName}}`);
46914
+ const datasourceExpr = `fragment.${scopePath}.${variableName}`.split(".").join("?.");
46915
+ element.setAttribute("datasource", `{${datasourceExpr}}`);
46603
46916
  }
46604
46917
  if (!binddatasetAttr) {
46605
- element.setAttribute("binddataset", `Variables.${variableName}.dataSet`);
46918
+ element.setAttribute("binddataset", `${scopePath}.${variableName}.dataSet`);
46606
46919
  }
46607
46920
  }
46608
46921
  }
@@ -46687,7 +47000,7 @@ var extractField2 = (element, context, filterElement) => {
46687
47000
  getAttribute(filterElement, "filterdata"),
46688
47001
  false
46689
47002
  );
46690
- if (widgetType === "number" && isRange) {
47003
+ if (isRange) {
46691
47004
  const maxField = getFilterWidgetTemplate(
46692
47005
  widgetType,
46693
47006
  widgetName,
@@ -46725,8 +47038,9 @@ var getFilterWidgetTemplate = (widgetType, widgetName, element, filterDataVariab
46725
47038
  if (onTap) {
46726
47039
  element.removeAttribute("on-tap");
46727
47040
  }
46728
- const placeholder = getAttribute(element, "placeholder");
46729
- if (placeholder) {
47041
+ const placeholderAttr = isMaxWidget ? "maxplaceholder" : "placeholder";
47042
+ const placeholder = getAttribute(element, placeholderAttr);
47043
+ if (placeholder && !isMaxWidget) {
46730
47044
  element.removeAttribute("placeholder");
46731
47045
  }
46732
47046
  const filterfieldName = getAttribute(element, "name");
@@ -47922,6 +48236,6 @@ he/he.js:
47922
48236
  *)
47923
48237
  */
47924
48238
 
47925
- export { serializeVariablesToCode, bind_ex_transformer_default as transformEx, transformMarkup, variable_transformer_default as transformVariable, transpileVariableDefinitions };
48239
+ export { buildCssScopeClass, fixURLPathAndScope, scopeCssUnderWmApp, serializeVariablesToCode, bind_ex_transformer_default as transformEx, transformMarkup, variable_transformer_default as transformVariable, transpileVariableDefinitions };
47926
48240
  //# sourceMappingURL=index.mjs.map
47927
48241
  //# sourceMappingURL=index.mjs.map