@wavemaker-ai/app-ng-runtime 1.0.0-rc.326 → 1.0.0-rc.330

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.
@@ -5445,25 +5445,33 @@
5445
5445
  const element = target[0];
5446
5446
  const parent = element?.parentElement;
5447
5447
  const parentStyle = parent ? getComputedStyle(parent) : null;
5448
- const isParentFlex = parentStyle && ['flex', 'inline-flex'].includes(parentStyle.display);
5449
- let isMainAxis = false;
5448
+ const isLayoutWrapper = parent && (parent.classList.contains('app-page-content') || parent.classList.contains('app-content-column'));
5449
+ const isParentFlex = !isLayoutWrapper && parentStyle && ['flex', 'inline-flex'].includes(parentStyle.display);
5450
+ let isWidthMainAxis = false;
5451
+ let isHeightMainAxis = false;
5450
5452
  if (isParentFlex) {
5451
5453
  const flexDir = parentStyle.flexDirection;
5452
5454
  const isRow = ['row', 'row-reverse'].includes(flexDir);
5453
- isMainAxis = (key === 'width' && isRow) || (key === 'height' && !isRow);
5455
+ isWidthMainAxis = (key === 'width' && isRow); // Parent is a row, so width is the main axis
5456
+ isHeightMainAxis = (key === 'height' && !isRow); // Parent is a column, so height is the main axis
5454
5457
  }
5455
5458
  if (nv === 'fill') {
5456
5459
  if (!isParentFlex) {
5460
+ // Not a flex parent: just take the full size.
5457
5461
  styles[key] = '100%';
5458
5462
  }
5459
5463
  else {
5460
5464
  styles[key] = '';
5461
- if (isMainAxis) {
5465
+ // flex properties are set based on the main axis which is determined by the parent's direction
5466
+ if (isWidthMainAxis || isHeightMainAxis) {
5462
5467
  styles['flex-grow'] = '1';
5463
- styles['flex-shrink'] = '';
5468
+ styles['flex-shrink'] = '0';
5469
+ // flex-basis applies only when width is the main axis (row layout) and width is set to fill
5470
+ styles['flex-basis'] = isHeightMainAxis ? '' : '0';
5464
5471
  styles[minKey] = '0';
5465
5472
  }
5466
5473
  else {
5474
+ // Fill in the other direction: just stretch to the parent's size.
5467
5475
  styles['align-self'] = 'stretch';
5468
5476
  }
5469
5477
  }
@@ -5472,8 +5480,9 @@
5472
5480
  if (nv === 'hug')
5473
5481
  styles[key] = 'fit-content';
5474
5482
  if (isParentFlex) {
5475
- if (isMainAxis) {
5476
- styles['flex-grow'] = '';
5483
+ if (isWidthMainAxis || isHeightMainAxis) {
5484
+ // Reset flex properties when width or height is configured as hug.
5485
+ styles['flex-basis'] = '';
5477
5486
  styles['flex-shrink'] = '0'; // intentional — don't shrink fixed sizes
5478
5487
  styles[minKey] = ''; // Need this because flex items default to min-height: auto, meaning they won't shrink smaller than their content.
5479
5488
  }
@@ -5484,6 +5493,8 @@
5484
5493
  else {
5485
5494
  styles['flex-grow'] = '';
5486
5495
  styles['flex-shrink'] = '0';
5496
+ styles['flex-basis'] = '';
5497
+ styles['flex-basis'] = '';
5487
5498
  styles['align-self'] = '';
5488
5499
  styles[minKey] = '';
5489
5500
  }
@@ -5446,25 +5446,33 @@ function AutoLayout(options = {}) {
5446
5446
  const element = target[0];
5447
5447
  const parent = element?.parentElement;
5448
5448
  const parentStyle = parent ? getComputedStyle(parent) : null;
5449
- const isParentFlex = parentStyle && ['flex', 'inline-flex'].includes(parentStyle.display);
5450
- let isMainAxis = false;
5449
+ const isLayoutWrapper = parent && (parent.classList.contains('app-page-content') || parent.classList.contains('app-content-column'));
5450
+ const isParentFlex = !isLayoutWrapper && parentStyle && ['flex', 'inline-flex'].includes(parentStyle.display);
5451
+ let isWidthMainAxis = false;
5452
+ let isHeightMainAxis = false;
5451
5453
  if (isParentFlex) {
5452
5454
  const flexDir = parentStyle.flexDirection;
5453
5455
  const isRow = ['row', 'row-reverse'].includes(flexDir);
5454
- isMainAxis = (key === 'width' && isRow) || (key === 'height' && !isRow);
5456
+ isWidthMainAxis = (key === 'width' && isRow); // Parent is a row, so width is the main axis
5457
+ isHeightMainAxis = (key === 'height' && !isRow); // Parent is a column, so height is the main axis
5455
5458
  }
5456
5459
  if (nv === 'fill') {
5457
5460
  if (!isParentFlex) {
5461
+ // Not a flex parent: just take the full size.
5458
5462
  styles[key] = '100%';
5459
5463
  }
5460
5464
  else {
5461
5465
  styles[key] = '';
5462
- if (isMainAxis) {
5466
+ // flex properties are set based on the main axis which is determined by the parent's direction
5467
+ if (isWidthMainAxis || isHeightMainAxis) {
5463
5468
  styles['flex-grow'] = '1';
5464
- styles['flex-shrink'] = '';
5469
+ styles['flex-shrink'] = '0';
5470
+ // flex-basis applies only when width is the main axis (row layout) and width is set to fill
5471
+ styles['flex-basis'] = isHeightMainAxis ? '' : '0';
5465
5472
  styles[minKey] = '0';
5466
5473
  }
5467
5474
  else {
5475
+ // Fill in the other direction: just stretch to the parent's size.
5468
5476
  styles['align-self'] = 'stretch';
5469
5477
  }
5470
5478
  }
@@ -5473,8 +5481,9 @@ function AutoLayout(options = {}) {
5473
5481
  if (nv === 'hug')
5474
5482
  styles[key] = 'fit-content';
5475
5483
  if (isParentFlex) {
5476
- if (isMainAxis) {
5477
- styles['flex-grow'] = '';
5484
+ if (isWidthMainAxis || isHeightMainAxis) {
5485
+ // Reset flex properties when width or height is configured as hug.
5486
+ styles['flex-basis'] = '';
5478
5487
  styles['flex-shrink'] = '0'; // intentional — don't shrink fixed sizes
5479
5488
  styles[minKey] = ''; // Need this because flex items default to min-height: auto, meaning they won't shrink smaller than their content.
5480
5489
  }
@@ -5485,6 +5494,8 @@ function AutoLayout(options = {}) {
5485
5494
  else {
5486
5495
  styles['flex-grow'] = '';
5487
5496
  styles['flex-shrink'] = '0';
5497
+ styles['flex-basis'] = '';
5498
+ styles['flex-basis'] = '';
5488
5499
  styles['align-self'] = '';
5489
5500
  styles[minKey] = '';
5490
5501
  }