igniteui-webcomponents 5.3.0-beta.0 → 5.3.0-beta.1

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.
@@ -13,6 +13,8 @@ class TileManagerSerializer {
13
13
  return {
14
14
  colSpan: tile.colSpan,
15
15
  colStart: tile.colStart,
16
+ disableFullscreen: tile.disableFullscreen,
17
+ disableMaximize: tile.disableMaximize,
16
18
  disableResize: tile.disableResize,
17
19
  gridColumn,
18
20
  gridRow,
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../../src/components/tile-manager/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAmBzD,MAAM,qBAAqB;IAGzB,YAAY,WAAoC;QAC9C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEO,mBAAmB,CAAC,IAAsB;QAEhD,OAAO,IAAI,CAAC,kBAAkB,CAAE,CAAC;IACnC,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACzC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACvD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YAEnE,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,UAAU;gBACV,OAAO;gBACP,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ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ClC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAEM,YAAY,CAAC,IAAY;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB,CAAC,IAA6B;IAC5D,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { asNumber, omit, pick } from '../common/util.js';\nimport type IgcTileManagerComponent from './tile-manager.js';\nimport type IgcTileComponent from './tile.js';\n\nexport interface SerializedTile {\n colSpan: number;\n colStart: number | null;\n disableResize: boolean;\n gridColumn: string;\n gridRow: string;\n maximized: boolean;\n position: number;\n rowSpan: number;\n rowStart: number | null;\n tileId: string | null;\n width: number | null;\n height: number | null;\n}\n\nclass TileManagerSerializer {\n public tileManager: IgcTileManagerComponent;\n\n constructor(tileManager: IgcTileManagerComponent) {\n this.tileManager = tileManager;\n }\n\n private _getResizeContainer(tile: IgcTileComponent) {\n // biome-ignore lint/complexity/useLiteralKeys: Until we migrate to a symbol\n return tile['_resizeContainer']!;\n }\n\n public save(): SerializedTile[] {\n return this.tileManager.tiles.map((tile) => {\n const { gridColumn, gridRow } = getComputedStyle(tile);\n const { width, height } = this._getResizeContainer(tile).getSize();\n\n return {\n colSpan: tile.colSpan,\n colStart: tile.colStart,\n disableResize: tile.disableResize,\n gridColumn,\n gridRow,\n maximized: tile.maximized,\n position: tile.position,\n rowSpan: tile.rowSpan,\n rowStart: tile.rowStart,\n tileId: tile.tileId,\n width: asNumber(width) || null,\n height: asNumber(height) || null,\n };\n });\n }\n\n public saveAsJSON(): string {\n return JSON.stringify(this.save());\n }\n\n public load(tiles: SerializedTile[]): void {\n const mapped = new Map(tiles.map((tile) => [tile.tileId, tile]));\n const keys: (keyof SerializedTile)[] = [\n 'gridColumn',\n 'gridRow',\n 'width',\n 'height',\n ];\n\n for (const tile of this.tileManager.tiles) {\n if (!mapped.has(tile.tileId)) {\n continue;\n }\n\n const serialized = mapped.get(tile.tileId)!;\n const properties = omit(serialized, ...keys);\n const styles = pick(serialized, 'gridColumn', 'gridRow');\n const { width, height } = pick(serialized, 'width', 'height');\n\n Object.assign(tile, properties);\n Object.assign(tile.style, styles);\n this._getResizeContainer(tile).setSize(width, height);\n }\n }\n\n public loadFromJSON(data: string): void {\n this.load(JSON.parse(data));\n }\n}\n\nexport function createSerializer(host: IgcTileManagerComponent) {\n return new TileManagerSerializer(host);\n}\n"]}
1
+ {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../../src/components/tile-manager/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAqBzD,MAAM,qBAAqB;IAGzB,YAAY,WAAoC;QAC9C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEO,mBAAmB,CAAC,IAAsB;QAEhD,OAAO,IAAI,CAAC,kBAAkB,CAAE,CAAC;IACnC,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACzC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACvD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YAEnE,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;gBACzC,eAAe,EAAE,IAAI,CAAC,eAAe;gBACrC,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,UAA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AC;YAE9D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAClC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAEM,YAAY,CAAC,IAAY;QAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB,CAAC,IAA6B;IAC5D,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { asNumber, omit, pick } from '../common/util.js';\nimport type IgcTileManagerComponent from './tile-manager.js';\nimport type IgcTileComponent from './tile.js';\n\nexport interface SerializedTile {\n colSpan: number;\n colStart: number | null;\n disableFullscreen: boolean;\n disableMaximize: boolean;\n disableResize: boolean;\n gridColumn: string;\n gridRow: string;\n maximized: boolean;\n position: number;\n rowSpan: number;\n rowStart: number | null;\n tileId: string | null;\n width: number | null;\n height: number | null;\n}\n\nclass TileManagerSerializer {\n public tileManager: IgcTileManagerComponent;\n\n constructor(tileManager: IgcTileManagerComponent) {\n this.tileManager = tileManager;\n }\n\n private _getResizeContainer(tile: IgcTileComponent) {\n // biome-ignore lint/complexity/useLiteralKeys: Until we migrate to a symbol\n return tile['_resizeContainer']!;\n }\n\n public save(): SerializedTile[] {\n return this.tileManager.tiles.map((tile) => {\n const { gridColumn, gridRow } = getComputedStyle(tile);\n const { width, height } = this._getResizeContainer(tile).getSize();\n\n return {\n colSpan: tile.colSpan,\n colStart: tile.colStart,\n disableFullscreen: tile.disableFullscreen,\n disableMaximize: tile.disableMaximize,\n disableResize: tile.disableResize,\n gridColumn,\n gridRow,\n maximized: tile.maximized,\n position: tile.position,\n rowSpan: tile.rowSpan,\n rowStart: tile.rowStart,\n tileId: tile.tileId,\n width: asNumber(width) || null,\n height: asNumber(height) || null,\n };\n });\n }\n\n public saveAsJSON(): string {\n return JSON.stringify(this.save());\n }\n\n public load(tiles: SerializedTile[]): void {\n const mapped = new Map(tiles.map((tile) => [tile.tileId, tile]));\n const keys: (keyof SerializedTile)[] = [\n 'gridColumn',\n 'gridRow',\n 'width',\n 'height',\n ];\n\n for (const tile of this.tileManager.tiles) {\n if (!mapped.has(tile.tileId)) {\n continue;\n }\n\n const serialized = mapped.get(tile.tileId)!;\n const properties = omit(serialized, ...keys);\n const styles = pick(serialized, 'gridColumn', 'gridRow');\n const { width, height } = pick(serialized, 'width', 'height');\n\n Object.assign(tile, properties);\n Object.assign(tile.style, styles);\n this._getResizeContainer(tile).setSize(width, height);\n }\n }\n\n public loadFromJSON(data: string): void {\n this.load(JSON.parse(data));\n }\n}\n\nexport function createSerializer(host: IgcTileManagerComponent) {\n return new TileManagerSerializer(host);\n}\n"]}
@@ -56,6 +56,13 @@ class TileResizeState {
56
56
  entries: [],
57
57
  minSize: 0,
58
58
  };
59
+ this.resizedDimensions = {
60
+ width: null,
61
+ height: null,
62
+ };
63
+ }
64
+ get emptyResizeDimensions() {
65
+ return { width: null, height: null };
59
66
  }
60
67
  get gap() {
61
68
  return this._gap;
@@ -1 +1 @@
1
- {"version":3,"file":"tile-util.js","sourceRoot":"","sources":["../../../src/components/tile-manager/tile-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAcpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAI3D,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,+CAA+C,CAAC,CAAC;AAE9E,SAAS,iBAAiB,CAAC,IAAsB;IAC/C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,QAAQ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AAC,CAAC;IAEpB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;QACzB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,GAAG,KAAK,IAAI;QACnB,MAAM,EAAE,GAAG,MAAM,IAAI;QACrB,OAAO,EAAE,GAAG;QACZ,UAAU,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,EAAE;QAC/D,MAAM,EAAE,aAAa,QAAQ,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,EAAE;QACxE,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;QAC1D,SAAS,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,EAAE;QAC7D,MAAM,EAAE,IAAI;QACZ,kBAAkB,EAAE,oBAAoB;KACzC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;QAC3B,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,+BAA+B;QAC3C,MAAM,EAAE,+BAA+B;QACvC,YAAY,EAAE,sBAAsB;QACpC,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { asNumber, first } from '../common/util.js';\nimport type { ResizeState } from '../resize-container/types.js';\nimport type IgcTileComponent from './tile.js';\n\ntype TilePosition = {\n start: number;\n span: number;\n};\n\ntype TileGridPosition = {\n column: TilePosition;\n row: TilePosition;\n};\n\nexport const DraggedTileAttribute = 'data-drag-ghost-tile';\n\ntype TileGridDimension = { count: number; entries: number[]; minSize: number };\n\nconst CssValues = new RegExp(/(?<start>\\d+)?\\s*\\/?\\s*span\\s*(?<span>\\d+)?/gi);\n\nfunction parseTileGridRect(tile: IgcTileComponent): TileGridPosition {\n const computed = getComputedStyle(tile);\n const { gridColumn, gridRow } = computed;\n\n const [column, row] = [\n first(Array.from(gridColumn.matchAll(CssValues))).groups!,\n first(Array.from(gridRow.matchAll(CssValues))).groups!,\n ];\n\n return {\n column: {\n start: asNumber(column.start, -1),\n span: asNumber(column.span, -1),\n },\n row: { start: asNumber(row.start, -1), span: asNumber(row.span, -1) },\n };\n}\n\nfunction parseTileParentGrid(gridContainer: HTMLElement) {\n const computed = getComputedStyle(gridContainer);\n const { gap, gridTemplateColumns, gridTemplateRows } = computed;\n\n const columns = gridTemplateColumns.split(' ').map(asNumber);\n const rows = gridTemplateRows.split(' ').map(asNumber);\n\n return {\n gap: asNumber(gap),\n columns: {\n count: columns.length,\n entries: columns,\n minSize: asNumber(computed.getPropertyValue('--ig-min-col-width')),\n },\n rows: {\n count: rows.length,\n entries: rows,\n minSize: asNumber(computed.getPropertyValue('--ig-min-row-height')),\n },\n };\n}\n\nclass TileResizeState {\n private _initialPosition!: TileGridPosition;\n\n protected _gap = 0;\n protected _prevDeltaX = 0;\n protected _prevDeltaY = 0;\n\n protected _prevSnappedWidth = 0;\n protected _prevSnappedHeight = 0;\n\n protected _position: TileGridPosition = {\n column: { start: 0, span: 0 },\n row: { start: 0, span: 0 },\n };\n\n protected _columns: TileGridDimension = {\n count: 0,\n entries: [],\n minSize: 0,\n };\n\n protected _rows: TileGridDimension = {\n count: 0,\n entries: [],\n minSize: 0,\n };\n\n public get gap(): number {\n return this._gap;\n }\n\n public get position(): TileGridPosition {\n return structuredClone(this._position);\n }\n\n public get columns(): TileGridDimension {\n return structuredClone(this._columns);\n }\n\n public get rows(): TileGridDimension {\n return structuredClone(this._rows);\n }\n\n public calculateSnappedWidth(state: ResizeState): number {\n const result = this.calculateSnappedDimension(\n state.current.width,\n state.deltaX,\n this._prevDeltaX,\n this._columns.entries,\n this._position.column.start,\n this._prevSnappedWidth,\n this._columns.minSize\n );\n\n this._prevDeltaX = result.newDelta;\n this._prevSnappedWidth = result.snapped;\n return result.snapped;\n }\n\n public calculateSnappedHeight(state: ResizeState): number {\n const result = this.calculateSnappedDimension(\n state.current.height,\n state.deltaY,\n this._prevDeltaY,\n this._rows.entries,\n this._position.row.start,\n this._prevSnappedHeight,\n this._rows.minSize\n );\n\n this._prevDeltaY = result.newDelta;\n this._prevSnappedHeight = result.snapped;\n return result.snapped;\n }\n\n public updateState(\n tileRect: DOMRect,\n tile: IgcTileComponent,\n grid: HTMLElement\n ): void {\n this.initState(grid, tile);\n this.calculateTileStartPosition(grid, tileRect);\n }\n\n /**\n * Calculates and returns the CSS column and row properties of a tile after resizing,\n * based on its new dimensions and starting position.\n */\n public getResizedPosition(rect: DOMRect) {\n const { column, row } = this._initialPosition;\n\n // REVIEW pass col minSize and allowOverflow?\n this._position.column.span = this.calculateResizedSpan(\n rect.width,\n this._position.column,\n this._columns.entries\n );\n\n this._position.row.span = this.calculateResizedSpan(\n rect.height,\n this._position.row,\n this._rows.entries,\n this._rows.minSize,\n true\n );\n\n const cssColumn = `${column.start < 0 ? 'auto' : column.start} / span ${this._position.column.span}`;\n const cssRow = `${row.start < 0 ? 'auto' : row.start} / span ${this._position.row.span}`;\n\n return { column: cssColumn, row: cssRow };\n }\n\n public calculateResizedSize(grid: HTMLElement) {\n const { columns, rows } = parseTileParentGrid(grid);\n\n const width = this.calculateSizeFromEntries(columns.entries);\n const height = this.calculateSizeFromEntries(rows.entries, true);\n\n return { width, height };\n }\n\n /**\n * Checks and adjusts tile spans based on the column count of the tile manager.\n */\n // REVIEW once we decide how to handle empty columns.\n public adjustTileGridPosition(tiles: IgcTileComponent[]): void {\n const columnCount = this.columns.count;\n\n for (const tile of tiles) {\n const colStart = tile.colStart || 0;\n const colSpan = tile.colSpan || 0;\n\n if (colStart > columnCount) {\n //Prioritize span over start?\n tile.colSpan = 1;\n tile.colStart = columnCount;\n continue;\n }\n\n if (colStart + colSpan - 1 > columnCount) {\n tile.colSpan = columnCount - colStart + 1;\n }\n }\n }\n\n private calculateSnappedDimension(\n currentSize: number,\n currentDelta: number,\n prevDelta: number,\n gridEntries: number[],\n startIndex: number,\n prevSnapped: number,\n minSize: number\n ): { snapped: number; newDelta: number } {\n const effectiveDelta = currentDelta - prevDelta;\n let snapped = currentSize;\n\n // If current size is below minimum, force to the size of the starting cell.\n if (Math.trunc(currentSize) < minSize) {\n return { snapped: gridEntries[startIndex], newDelta: currentDelta };\n }\n\n // If no change in delta and we have a snapped value, reuse it.\n if (effectiveDelta === 0 && prevSnapped) {\n return { snapped: prevSnapped, newDelta: currentDelta };\n }\n\n let accumulated = 0;\n for (let i = startIndex - 1; i < gridEntries.length; i++) {\n const currentEntry = gridEntries[i];\n const nextEntry = gridEntries[i + 1] ?? currentEntry;\n const prevEntry = i > 0 ? gridEntries[i - 1] : currentEntry;\n\n // Thresholds for snapping to the next or previous tile boundary.\n const halfwayExpand =\n accumulated + currentEntry + this.gap + nextEntry / 2;\n const halfwayShrink = accumulated + prevEntry / 2;\n const entryEnd = accumulated + currentEntry + this.gap;\n\n if (effectiveDelta > 0) {\n // Expanding: snap when passing the halfway threshold.\n if (\n currentSize >= halfwayExpand &&\n currentSize <= entryEnd + nextEntry\n ) {\n snapped = entryEnd + nextEntry;\n }\n } else if (effectiveDelta < 0) {\n // Shrinking: snap when falling below the halfway threshold.\n if (currentSize <= halfwayShrink && currentSize > accumulated) {\n snapped = accumulated - this.gap;\n }\n }\n\n accumulated += currentEntry + this.gap;\n }\n\n return { snapped, newDelta: currentDelta };\n }\n\n private calculateResizedSpan(\n targetSize: number,\n tilePosition: TilePosition,\n sizes: number[],\n minSize = 0,\n allowOverflow = false\n ): number {\n let accumulatedSize = 0;\n let newSpan = tilePosition.span;\n\n const sizesAfterStart = sizes.slice(tilePosition.start - 1);\n const availableSize =\n sizesAfterStart.reduce((sum, s) => sum + s, 0) +\n (sizes.length - 1) * this.gap;\n\n if (targetSize <= sizes[0] + this.gap) {\n return 1;\n }\n\n if (targetSize > availableSize) {\n const remainingSize = targetSize - availableSize;\n return this.calculateAdditionalSpan(\n remainingSize,\n sizesAfterStart.length,\n minSize,\n allowOverflow\n );\n }\n\n for (let i = tilePosition.start - 1; i < sizes.length; i++) {\n const currentSize = sizes[i];\n const nextSize = sizes[i + 1] ?? currentSize;\n\n const halfwayPoint =\n accumulatedSize + currentSize + this.gap + nextSize / 2;\n\n if (targetSize > halfwayPoint) {\n newSpan = i + 3 - tilePosition.start;\n } else {\n break;\n }\n\n accumulatedSize += currentSize + this.gap;\n }\n\n return newSpan;\n }\n\n private initState(grid: HTMLElement, tile: IgcTileComponent): void {\n const { gap, columns, rows } = parseTileParentGrid(grid);\n\n this._initialPosition = parseTileGridRect(tile);\n this._position = structuredClone(this._initialPosition);\n\n this._gap = gap;\n this._columns = columns;\n this._rows = rows;\n this._prevDeltaX = 0;\n this._prevDeltaY = 0;\n this._prevSnappedWidth = 0;\n this._prevSnappedHeight = 0;\n }\n\n private calculateTileStartPosition(\n grid: HTMLElement,\n tileRect: DOMRect\n ): void {\n if (this._position.column.start < 0) {\n const offsetX = this.getGridOffset(grid, 'horizontal');\n\n this._position.column.start = this.calculatePosition(\n tileRect.left + window.scrollX + grid.scrollLeft - offsetX,\n this._columns.entries\n );\n }\n\n if (this._position.row.start < 0) {\n const offsetY = this.getGridOffset(grid, 'vertical');\n\n this._position.row.start = this.calculatePosition(\n tileRect.top + window.scrollY - offsetY,\n this._rows.entries\n );\n }\n }\n\n private calculatePosition(targetPosition: number, sizes: number[]): number {\n const gap = this.gap;\n let accumulatedSize = 0;\n\n for (const [i, size] of sizes.entries()) {\n accumulatedSize += size + gap;\n\n if (Math.trunc(targetPosition) < Math.trunc(accumulatedSize - gap)) {\n return i + 1;\n }\n }\n\n return 1;\n }\n\n private calculateAdditionalSpan(\n remainingSize: number,\n currentSpan: number,\n minSize: number,\n allowOverflow: boolean\n ) {\n if (allowOverflow) {\n const additionalSpan = Math.ceil(remainingSize / (minSize + this.gap));\n return currentSpan + additionalSpan;\n }\n\n return currentSpan;\n }\n\n private calculateSizeFromEntries(entries: number[], isRow = false) {\n const start = isRow ? this.position.row.start : this.position.column.start;\n const span = isRow ? this.position.row.span : this.position.column.span;\n\n let accumulatedSize = 0;\n\n for (let i = 0; i < span; i++) {\n const gap = i > 0 ? this.gap : 0;\n accumulatedSize += entries[start - 1 + i] + gap;\n }\n\n return accumulatedSize;\n }\n\n private getGridOffset(\n grid: HTMLElement,\n axis: 'horizontal' | 'vertical'\n ): number {\n const gridRect = grid.getBoundingClientRect();\n const computed = getComputedStyle(grid);\n\n return axis === 'horizontal'\n ? gridRect.left +\n window.scrollX +\n grid.scrollLeft +\n Number.parseFloat(computed.paddingLeft)\n : gridRect.top + window.scrollY + Number.parseFloat(computed.paddingTop);\n }\n}\n\nexport function createTileResizeState(): TileResizeState {\n return new TileResizeState();\n}\n\nexport function createTileDragGhost(tile: IgcTileComponent): IgcTileComponent {\n const clone = tile.cloneNode(true) as IgcTileComponent;\n const computed = getComputedStyle(tile);\n\n const { width, height } = tile.getBoundingClientRect();\n\n clone.removeAttribute('id');\n clone.setAttribute(DraggedTileAttribute, '');\n clone.inert = true;\n clone.position = -1;\n\n Object.assign(clone.style, {\n position: 'absolute',\n contain: 'strict',\n top: 0,\n left: 0,\n width: `${width}px`,\n height: `${height}px`,\n opacity: 0.6,\n background: `${computed.getPropertyValue('--tile-background')}`,\n border: `1px solid ${computed.getPropertyValue('--hover-border-color')}`,\n borderRadius: computed.getPropertyValue('--border-radius'),\n boxShadow: `${computed.getPropertyValue('--drag-elevation')}`,\n zIndex: 1000,\n viewTransitionName: 'dragged-tile-ghost',\n });\n\n return clone;\n}\n\nexport function createTileGhost(): HTMLElement {\n const element = document.createElement('div');\n\n Object.assign(element.style, {\n position: 'absolute',\n contain: 'strict',\n top: 0,\n left: 0,\n zIndex: 1000,\n background: 'var(--placeholder-background)',\n border: '1px solid var(--ghost-border)',\n borderRadius: 'var(--border-radius)',\n width: '100%',\n height: '100%',\n });\n\n return element;\n}\n"]}
1
+ {"version":3,"file":"tile-util.js","sourceRoot":"","sources":["../../../src/components/tile-manager/tile-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAgBpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAI3D,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,+CAA+C,CAAC,CAAC;AAE9E,SAAS,iBAAiB,CAAC,IAAsB;IAC/C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAEzC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QACpB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAO;QACzD,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAO;KACvD,CAAC;IAEF,OAAO;QACL,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACjC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SAChC;QACD,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE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gB,CAAC,iBAAiB,CAAC;QAC1D,SAAS,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,EAAE;QAC7D,MAAM,EAAE,IAAI;QACZ,kBAAkB,EAAE,oBAAoB;KACzC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;QAC3B,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,+BAA+B;QAC3C,MAAM,EAAE,+BAA+B;QACvC,YAAY,EAAE,sBAAsB;QACpC,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { asNumber, first } from '../common/util.js';\nimport type { ResizeState } from '../resize-container/types.js';\nimport type IgcTileComponent from './tile.js';\n\ntype TilePosition = {\n start: number;\n span: number;\n};\n\ntype TileGridPosition = {\n column: TilePosition;\n row: TilePosition;\n};\n\ntype TileResizeDimensions = { width: number | null; height: number | null };\n\nexport const DraggedTileAttribute = 'data-drag-ghost-tile';\n\ntype TileGridDimension = { count: number; entries: number[]; minSize: number };\n\nconst CssValues = new RegExp(/(?<start>\\d+)?\\s*\\/?\\s*span\\s*(?<span>\\d+)?/gi);\n\nfunction parseTileGridRect(tile: IgcTileComponent): TileGridPosition {\n const computed = getComputedStyle(tile);\n const { gridColumn, gridRow } = computed;\n\n const [column, row] = [\n first(Array.from(gridColumn.matchAll(CssValues))).groups!,\n first(Array.from(gridRow.matchAll(CssValues))).groups!,\n ];\n\n return {\n column: {\n start: asNumber(column.start, -1),\n span: asNumber(column.span, -1),\n },\n row: { start: asNumber(row.start, -1), span: asNumber(row.span, -1) },\n };\n}\n\nfunction parseTileParentGrid(gridContainer: HTMLElement) {\n const computed = getComputedStyle(gridContainer);\n const { gap, gridTemplateColumns, gridTemplateRows } = computed;\n\n const columns = gridTemplateColumns.split(' ').map(asNumber);\n const rows = gridTemplateRows.split(' ').map(asNumber);\n\n return {\n gap: asNumber(gap),\n columns: {\n count: columns.length,\n entries: columns,\n minSize: asNumber(computed.getPropertyValue('--ig-min-col-width')),\n },\n rows: {\n count: rows.length,\n entries: rows,\n minSize: asNumber(computed.getPropertyValue('--ig-min-row-height')),\n },\n };\n}\n\nclass TileResizeState {\n private _initialPosition!: TileGridPosition;\n\n protected _gap = 0;\n protected _prevDeltaX = 0;\n protected _prevDeltaY = 0;\n\n protected _prevSnappedWidth = 0;\n protected _prevSnappedHeight = 0;\n\n protected _position: TileGridPosition = {\n column: { start: 0, span: 0 },\n row: { start: 0, span: 0 },\n };\n\n protected _columns: TileGridDimension = {\n count: 0,\n entries: [],\n minSize: 0,\n };\n\n protected _rows: TileGridDimension = {\n count: 0,\n entries: [],\n minSize: 0,\n };\n\n public resizedDimensions: TileResizeDimensions = {\n width: null,\n height: null,\n };\n\n public get emptyResizeDimensions(): TileResizeDimensions {\n return { width: null, height: null };\n }\n\n public get gap(): number {\n return this._gap;\n }\n\n public get position(): TileGridPosition {\n return structuredClone(this._position);\n }\n\n public get columns(): TileGridDimension {\n return structuredClone(this._columns);\n }\n\n public get rows(): TileGridDimension {\n return structuredClone(this._rows);\n }\n\n public calculateSnappedWidth(state: ResizeState): number {\n const result = this.calculateSnappedDimension(\n state.current.width,\n state.deltaX,\n this._prevDeltaX,\n this._columns.entries,\n this._position.column.start,\n this._prevSnappedWidth,\n this._columns.minSize\n );\n\n this._prevDeltaX = result.newDelta;\n this._prevSnappedWidth = result.snapped;\n return result.snapped;\n }\n\n public calculateSnappedHeight(state: ResizeState): number {\n const result = this.calculateSnappedDimension(\n state.current.height,\n state.deltaY,\n this._prevDeltaY,\n this._rows.entries,\n this._position.row.start,\n this._prevSnappedHeight,\n this._rows.minSize\n );\n\n this._prevDeltaY = result.newDelta;\n this._prevSnappedHeight = result.snapped;\n return result.snapped;\n }\n\n public updateState(\n tileRect: DOMRect,\n tile: IgcTileComponent,\n grid: HTMLElement\n ): void {\n this.initState(grid, tile);\n this.calculateTileStartPosition(grid, tileRect);\n }\n\n /**\n * Calculates and returns the CSS column and row properties of a tile after resizing,\n * based on its new dimensions and starting position.\n */\n public getResizedPosition(rect: DOMRect) {\n const { column, row } = this._initialPosition;\n\n // REVIEW pass col minSize and allowOverflow?\n this._position.column.span = this.calculateResizedSpan(\n rect.width,\n this._position.column,\n this._columns.entries\n );\n\n this._position.row.span = this.calculateResizedSpan(\n rect.height,\n this._position.row,\n this._rows.entries,\n this._rows.minSize,\n true\n );\n\n const cssColumn = `${column.start < 0 ? 'auto' : column.start} / span ${this._position.column.span}`;\n const cssRow = `${row.start < 0 ? 'auto' : row.start} / span ${this._position.row.span}`;\n\n return { column: cssColumn, row: cssRow };\n }\n\n public calculateResizedSize(grid: HTMLElement) {\n const { columns, rows } = parseTileParentGrid(grid);\n\n const width = this.calculateSizeFromEntries(columns.entries);\n const height = this.calculateSizeFromEntries(rows.entries, true);\n\n return { width, height };\n }\n\n /**\n * Checks and adjusts tile spans based on the column count of the tile manager.\n */\n // REVIEW once we decide how to handle empty columns.\n public adjustTileGridPosition(tiles: IgcTileComponent[]): void {\n const columnCount = this.columns.count;\n\n for (const tile of tiles) {\n const colStart = tile.colStart || 0;\n const colSpan = tile.colSpan || 0;\n\n if (colStart > columnCount) {\n //Prioritize span over start?\n tile.colSpan = 1;\n tile.colStart = columnCount;\n continue;\n }\n\n if (colStart + colSpan - 1 > columnCount) {\n tile.colSpan = columnCount - colStart + 1;\n }\n }\n }\n\n private calculateSnappedDimension(\n currentSize: number,\n currentDelta: number,\n prevDelta: number,\n gridEntries: number[],\n startIndex: number,\n prevSnapped: number,\n minSize: number\n ): { snapped: number; newDelta: number } {\n const effectiveDelta = currentDelta - prevDelta;\n let snapped = currentSize;\n\n // If current size is below minimum, force to the size of the starting cell.\n if (Math.trunc(currentSize) < minSize) {\n return { snapped: gridEntries[startIndex], newDelta: currentDelta };\n }\n\n // If no change in delta and we have a snapped value, reuse it.\n if (effectiveDelta === 0 && prevSnapped) {\n return { snapped: prevSnapped, newDelta: currentDelta };\n }\n\n let accumulated = 0;\n for (let i = startIndex - 1; i < gridEntries.length; i++) {\n const currentEntry = gridEntries[i];\n const nextEntry = gridEntries[i + 1] ?? currentEntry;\n const prevEntry = i > 0 ? gridEntries[i - 1] : currentEntry;\n\n // Thresholds for snapping to the next or previous tile boundary.\n const halfwayExpand =\n accumulated + currentEntry + this.gap + nextEntry / 2;\n const halfwayShrink = accumulated + prevEntry / 2;\n const entryEnd = accumulated + currentEntry + this.gap;\n\n if (effectiveDelta > 0) {\n // Expanding: snap when passing the halfway threshold.\n if (\n currentSize >= halfwayExpand &&\n currentSize <= entryEnd + nextEntry\n ) {\n snapped = entryEnd + nextEntry;\n }\n } else if (effectiveDelta < 0) {\n // Shrinking: snap when falling below the halfway threshold.\n if (currentSize <= halfwayShrink && currentSize > accumulated) {\n snapped = accumulated - this.gap;\n }\n }\n\n accumulated += currentEntry + this.gap;\n }\n\n return { snapped, newDelta: currentDelta };\n }\n\n private calculateResizedSpan(\n targetSize: number,\n tilePosition: TilePosition,\n sizes: number[],\n minSize = 0,\n allowOverflow = false\n ): number {\n let accumulatedSize = 0;\n let newSpan = tilePosition.span;\n\n const sizesAfterStart = sizes.slice(tilePosition.start - 1);\n const availableSize =\n sizesAfterStart.reduce((sum, s) => sum + s, 0) +\n (sizes.length - 1) * this.gap;\n\n if (targetSize <= sizes[0] + this.gap) {\n return 1;\n }\n\n if (targetSize > availableSize) {\n const remainingSize = targetSize - availableSize;\n return this.calculateAdditionalSpan(\n remainingSize,\n sizesAfterStart.length,\n minSize,\n allowOverflow\n );\n }\n\n for (let i = tilePosition.start - 1; i < sizes.length; i++) {\n const currentSize = sizes[i];\n const nextSize = sizes[i + 1] ?? currentSize;\n\n const halfwayPoint =\n accumulatedSize + currentSize + this.gap + nextSize / 2;\n\n if (targetSize > halfwayPoint) {\n newSpan = i + 3 - tilePosition.start;\n } else {\n break;\n }\n\n accumulatedSize += currentSize + this.gap;\n }\n\n return newSpan;\n }\n\n private initState(grid: HTMLElement, tile: IgcTileComponent): void {\n const { gap, columns, rows } = parseTileParentGrid(grid);\n\n this._initialPosition = parseTileGridRect(tile);\n this._position = structuredClone(this._initialPosition);\n\n this._gap = gap;\n this._columns = columns;\n this._rows = rows;\n this._prevDeltaX = 0;\n this._prevDeltaY = 0;\n this._prevSnappedWidth = 0;\n this._prevSnappedHeight = 0;\n }\n\n private calculateTileStartPosition(\n grid: HTMLElement,\n tileRect: DOMRect\n ): void {\n if (this._position.column.start < 0) {\n const offsetX = this.getGridOffset(grid, 'horizontal');\n\n this._position.column.start = this.calculatePosition(\n tileRect.left + window.scrollX + grid.scrollLeft - offsetX,\n this._columns.entries\n );\n }\n\n if (this._position.row.start < 0) {\n const offsetY = this.getGridOffset(grid, 'vertical');\n\n this._position.row.start = this.calculatePosition(\n tileRect.top + window.scrollY - offsetY,\n this._rows.entries\n );\n }\n }\n\n private calculatePosition(targetPosition: number, sizes: number[]): number {\n const gap = this.gap;\n let accumulatedSize = 0;\n\n for (const [i, size] of sizes.entries()) {\n accumulatedSize += size + gap;\n\n if (Math.trunc(targetPosition) < Math.trunc(accumulatedSize - gap)) {\n return i + 1;\n }\n }\n\n return 1;\n }\n\n private calculateAdditionalSpan(\n remainingSize: number,\n currentSpan: number,\n minSize: number,\n allowOverflow: boolean\n ) {\n if (allowOverflow) {\n const additionalSpan = Math.ceil(remainingSize / (minSize + this.gap));\n return currentSpan + additionalSpan;\n }\n\n return currentSpan;\n }\n\n private calculateSizeFromEntries(entries: number[], isRow = false) {\n const start = isRow ? this.position.row.start : this.position.column.start;\n const span = isRow ? this.position.row.span : this.position.column.span;\n\n let accumulatedSize = 0;\n\n for (let i = 0; i < span; i++) {\n const gap = i > 0 ? this.gap : 0;\n accumulatedSize += entries[start - 1 + i] + gap;\n }\n\n return accumulatedSize;\n }\n\n private getGridOffset(\n grid: HTMLElement,\n axis: 'horizontal' | 'vertical'\n ): number {\n const gridRect = grid.getBoundingClientRect();\n const computed = getComputedStyle(grid);\n\n return axis === 'horizontal'\n ? gridRect.left +\n window.scrollX +\n grid.scrollLeft +\n Number.parseFloat(computed.paddingLeft)\n : gridRect.top + window.scrollY + Number.parseFloat(computed.paddingTop);\n }\n}\n\nexport function createTileResizeState(): TileResizeState {\n return new TileResizeState();\n}\n\nexport function createTileDragGhost(tile: IgcTileComponent): IgcTileComponent {\n const clone = tile.cloneNode(true) as IgcTileComponent;\n const computed = getComputedStyle(tile);\n\n const { width, height } = tile.getBoundingClientRect();\n\n clone.removeAttribute('id');\n clone.setAttribute(DraggedTileAttribute, '');\n clone.inert = true;\n clone.position = -1;\n\n Object.assign(clone.style, {\n position: 'absolute',\n contain: 'strict',\n top: 0,\n left: 0,\n width: `${width}px`,\n height: `${height}px`,\n opacity: 0.6,\n background: `${computed.getPropertyValue('--tile-background')}`,\n border: `1px solid ${computed.getPropertyValue('--hover-border-color')}`,\n borderRadius: computed.getPropertyValue('--border-radius'),\n boxShadow: `${computed.getPropertyValue('--drag-elevation')}`,\n zIndex: 1000,\n viewTransitionName: 'dragged-tile-ghost',\n });\n\n return clone;\n}\n\nexport function createTileGhost(): HTMLElement {\n const element = document.createElement('div');\n\n Object.assign(element.style, {\n position: 'absolute',\n contain: 'strict',\n top: 0,\n left: 0,\n zIndex: 1000,\n background: 'var(--placeholder-background)',\n border: '1px solid var(--ghost-border)',\n borderRadius: 'var(--border-radius)',\n width: '100%',\n height: '100%',\n });\n\n return element;\n}\n"]}
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  var IgcTileComponent_1;
8
8
  import { LitElement, html, nothing } from 'lit';
9
- import { property, query, state } from 'lit/decorators.js';
9
+ import { property, query, queryAssignedElements, state, } from 'lit/decorators.js';
10
10
  import { createRef, ref } from 'lit/directives/ref.js';
11
11
  import { styleMap } from 'lit/directives/style-map.js';
12
12
  import { startViewTransition } from '../../animations/player.js';
@@ -18,7 +18,7 @@ import { addDragController, } from '../common/controllers/drag.js';
18
18
  import { addFullscreenController } from '../common/controllers/fullscreen.js';
19
19
  import { registerComponent } from '../common/definitions/register.js';
20
20
  import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
21
- import { asNumber, createCounter, findElementFromEventPath, getCenterPoint, partNameMap, } from '../common/util.js';
21
+ import { asNumber, createCounter, findElementFromEventPath, getCenterPoint, isEmpty, partNameMap, } from '../common/util.js';
22
22
  import IgcDividerComponent from '../divider/divider.js';
23
23
  import IgcResizeContainerComponent from '../resize-container/resize-container.js';
24
24
  import { createTileDragStack, swapTiles } from './position.js';
@@ -48,6 +48,11 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
48
48
  this._position = -1;
49
49
  this._resizeState = createTileResizeState();
50
50
  this._dragStack = createTileDragStack();
51
+ this._customAdorners = new Map(Object.entries({
52
+ side: false,
53
+ corner: false,
54
+ bottom: false,
55
+ }));
51
56
  this._setDragConfiguration = ({ instance: { dragMode }, }) => {
52
57
  this._dragController.set({
53
58
  enabled: dragMode !== 'none',
@@ -63,11 +68,6 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
63
68
  this.disableResize = false;
64
69
  this.disableFullscreen = false;
65
70
  this.disableMaximize = false;
66
- this._customAdorners = new Map(Object.entries({
67
- side: false,
68
- corner: false,
69
- bottom: false,
70
- }));
71
71
  }
72
72
  static register() {
73
73
  registerComponent(IgcTileComponent_1, IgcIconButtonComponent, IgcDividerComponent, IgcResizeContainerComponent);
@@ -90,15 +90,6 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
90
90
  this.fullscreen ||
91
91
  this._resizeMode === 'none');
92
92
  }
93
- get _shouldHideHeader() {
94
- const hasTitle = this._headerRef.value
95
- ?.querySelector('slot[name="title"]')
96
- ?.assignedNodes().length;
97
- const hasActions = this.shadowRoot
98
- ?.querySelector('slot[name="actions"]')
99
- ?.assignedNodes().length;
100
- return (!hasTitle && !hasActions && this.disableMaximize && this.disableFullscreen);
101
- }
102
93
  set colSpan(value) {
103
94
  this._colSpan = Math.max(1, asNumber(value));
104
95
  this.style.setProperty('--ig-col-span', this._colSpan.toString());
@@ -152,6 +143,11 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
152
143
  this.style.viewTransitionName =
153
144
  this.style.viewTransitionName || `tile-transition-${this.tileId}`;
154
145
  }
146
+ createRenderRoot() {
147
+ const root = super.createRenderRoot();
148
+ root.addEventListener('slotchange', () => this.requestUpdate());
149
+ return root;
150
+ }
155
151
  _setDragState(state = true) {
156
152
  this._isDragging = state;
157
153
  this._tileContent.style.opacity = state ? '0' : '1';
@@ -240,8 +236,9 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
240
236
  this.style.setProperty('grid-row', row);
241
237
  this.style.setProperty('grid-column', column);
242
238
  });
243
- await transition?.finished;
239
+ await transition?.updateCallbackDone;
244
240
  const { width, height } = this._resizeState.calculateResizedSize(this._cssContainer);
241
+ this._resizeState.resizedDimensions = { width, height };
245
242
  this._resizeContainer?.setSize(width, height);
246
243
  this._setResizeState(false);
247
244
  }
@@ -249,6 +246,10 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
249
246
  this._setResizeState(false);
250
247
  }
251
248
  _handleFullscreen() {
249
+ const { width, height } = !this.fullscreen
250
+ ? this._resizeState.emptyResizeDimensions
251
+ : this._resizeState.resizedDimensions;
252
+ this._resizeContainer?.setSize(width, height);
252
253
  this._fullscreenController.setState(!this.fullscreen);
253
254
  }
254
255
  _handleMaximize() {
@@ -292,10 +293,14 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
292
293
  `;
293
294
  }
294
295
  _renderHeader() {
296
+ const hideHeader = isEmpty(this._titleElements) &&
297
+ isEmpty(this._actionsElements) &&
298
+ this.disableMaximize &&
299
+ this.disableFullscreen;
295
300
  return html `
296
- <section part="header" ?hidden=${this._shouldHideHeader}>
301
+ <section part="header" ?hidden=${hideHeader}>
297
302
  <header part="title" ${ref(this._headerRef)}>
298
- <slot name="title" @slotchange=${this.requestUpdate}></slot>
303
+ <slot name="title"></slot>
299
304
  </header>
300
305
  <section id="tile-actions" part="actions">
301
306
  ${!this.disableMaximize
@@ -309,7 +314,7 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
309
314
  >`
310
315
  : nothing}
311
316
 
312
- <slot name="actions" @slotchange=${this.requestUpdate}></slot>
317
+ <slot name="actions"></slot>
313
318
  </section>
314
319
  </section>
315
320
  <igc-divider></igc-divider>
@@ -340,11 +345,6 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
340
345
  </div>
341
346
  `;
342
347
  }
343
- createRenderRoot() {
344
- const root = super.createRenderRoot();
345
- root.addEventListener('slotchange', () => this.requestUpdate());
346
- return root;
347
- }
348
348
  _renderAdornerSlot(name) {
349
349
  return html `
350
350
  <slot
@@ -357,6 +357,10 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
357
357
  `;
358
358
  }
359
359
  render() {
360
+ const { width, height } = this.fullscreen || this.maximized
361
+ ? this._resizeState.emptyResizeDimensions
362
+ : this._resizeState.resizedDimensions;
363
+ this._resizeContainer?.setSize(width, height);
360
364
  return html `
361
365
  <igc-resize
362
366
  part=${partNameMap({
@@ -384,6 +388,12 @@ let IgcTileComponent = IgcTileComponent_1 = class IgcTileComponent extends Event
384
388
  IgcTileComponent.tagName = 'igc-tile';
385
389
  IgcTileComponent.styles = [styles, shared];
386
390
  IgcTileComponent.increment = createCounter();
391
+ __decorate([
392
+ queryAssignedElements({ slot: 'title' })
393
+ ], IgcTileComponent.prototype, "_titleElements", void 0);
394
+ __decorate([
395
+ queryAssignedElements({ slot: 'actions' })
396
+ ], IgcTileComponent.prototype, "_actionsElements", void 0);
387
397
  __decorate([
388
398
  query(IgcResizeContainerComponent.tagName)
389
399
  ], IgcTileComponent.prototype, "_resizeContainer", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"tile.js","sourceRoot":"","sources":["../../../src/components/tile-manager/tile.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAEL,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAEL,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,2BAA2B,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MA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AAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAC5B;AAWpC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;+CAIjD;AAeD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;+CAIjD;AAYD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;gDAOlD;AAYD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;gDAOlD;AAqBD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAO1C;AAWM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;uDAC3C;AAOtB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;2DAC3C;AAO1B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;yDAC3C;AAU/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAI1B;AApQkB,gBAAgB;IADpC,MAAM,CAAC,GAAG,CAAC;GACS,gBAAgB,CA+jBpC;eA/jBoB,gBAAgB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { startViewTransition } from '../../animations/player.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport IgcIconButtonComponent from '../button/icon-button.js';\nimport {\n type TileManagerContext,\n tileManagerContext,\n} from '../common/context.js';\nimport { createAsyncContext } from '../common/controllers/async-consumer.js';\nimport {\n type DragCallbackParameters,\n addDragController,\n} from '../common/controllers/drag.js';\nimport { addFullscreenController } from '../common/controllers/fullscreen.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport {\n asNumber,\n createCounter,\n findElementFromEventPath,\n getCenterPoint,\n partNameMap,\n} from '../common/util.js';\nimport IgcDividerComponent from '../divider/divider.js';\nimport IgcResizeContainerComponent from '../resize-container/resize-container.js';\nimport type { ResizeCallbackParams } from '../resize-container/types.js';\nimport { createTileDragStack, swapTiles } from './position.js';\nimport { styles as shared } from './themes/shared/tile/tile.common.css.js';\nimport { styles } from './themes/tile.base.css.js';\nimport { all } from './themes/tile.js';\nimport {\n createTileDragGhost,\n createTileGhost,\n createTileResizeState,\n} from './tile-util.js';\n\ntype IgcTileChangeState = {\n tile: IgcTileComponent;\n state: boolean;\n};\n\ntype AdornerType = 'side' | 'corner' | 'bottom';\n\n// REVIEW: Decide whether to re-emit the events from the manager of leave them up to bubble naturally\nexport interface IgcTileComponentEventMap {\n igcTileFullscreen: CustomEvent<IgcTileChangeState>;\n igcTileMaximize: CustomEvent<IgcTileChangeState>;\n tileDragStart: CustomEvent<IgcTileComponent>;\n tileDragEnd: CustomEvent<IgcTileComponent>;\n igcResizeStart: CustomEvent<IgcTileComponent>;\n igcResizeMove: CustomEvent<IgcTileComponent>;\n igcResizeEnd: CustomEvent<IgcTileComponent>;\n}\n\n/**\n * The tile component is used within the `igc-tile-manager` as a container\n * for displaying various types of information.\n *\n * @element igc-tile\n *\n * @fires igcTileFullscreen - Fired when tile fullscreen state changes.\n * @fires igcTileMaximize - Fired when tile maximize state changes.\n * @fires igcResizeStart - Fired when tile begins resizing.\n * @fires igcResizeMove - Fired when tile is being resized.\n * @fires igcResizeEnd - Fired when tile finishes resizing.\n *\n * @slot title - Renders the title of the tile header.\n * @slot maximize-action - Renders the maximize action element.\n * @slot fullscreen-action - Renders the fullscreen action element.\n * @slot actions - Renders items after the default actions.\n * @slot Default slot for the tile's content.\n * @slot side-adorner - Renders the side resize handle.\n * @slot corner-adorner - Renders the corner resize handle.\n * @slot bottom-adorner - Renders the bottom resize handle.\n *\n * @csspart base - The wrapper for the entire tile.\n * @csspart header - The container for the header, including title and actions.\n * @csspart title - The title container.\n * @csspart actions - The actions container.\n * @csspart content-container - The container wrapping the tile’s main content.\n */\n@themes(all)\nexport default class IgcTileComponent extends EventEmitterMixin<\n IgcTileComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-tile';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register() {\n registerComponent(\n IgcTileComponent,\n IgcIconButtonComponent,\n IgcDividerComponent,\n IgcResizeContainerComponent\n );\n }\n\n private static readonly increment = createCounter();\n\n private _dragController = addDragController(this, {\n skip: this._skipDrag,\n ghost: this._createDragGhost,\n start: this._handleDragStart,\n move: this._handleDragMove,\n end: this._handleDragEnd,\n cancel: this._handleDragCancel,\n });\n\n private _fullscreenController = addFullscreenController(this, {\n enter: this.emitFullScreenEvent,\n exit: this.emitFullScreenEvent,\n });\n\n private _colSpan = 1;\n private _rowSpan = 1;\n private _colStart: number | null = null;\n private _rowStart: number | null = null;\n private _position = -1;\n private _resizeState = createTileResizeState();\n private _dragStack = createTileDragStack();\n\n // Tile manager context properties and helpers\n\n /**\n * Context consumer callback that sets the updated configuration of the internal drag controller\n * based on the passed tile manager properties.\n */\n private _setDragConfiguration = ({\n instance: { dragMode },\n }: TileManagerContext) => {\n this._dragController.set({\n enabled: dragMode !== 'none',\n trigger:\n dragMode === 'tile-header' ? () => this._headerRef.value! : undefined,\n });\n };\n\n private _context = createAsyncContext(\n this,\n tileManagerContext,\n this._setDragConfiguration\n );\n\n /** Returns the parent tile manager context. */\n private get _tileManagerCtx(): TileManagerContext | undefined {\n return this._context.value;\n }\n\n private get _tileManager() {\n return this._tileManagerCtx?.instance;\n }\n\n /** Returns the tile manager internal CSS grid container. */\n private get _cssContainer(): HTMLElement {\n return this._tileManagerCtx?.grid.value!;\n }\n\n /** Returns the tile manager current resize mode. */\n private get _resizeMode() {\n return this._tileManager?.resizeMode ?? 'none';\n }\n\n protected _headerRef = createRef<HTMLSlotElement>();\n\n @query(IgcResizeContainerComponent.tagName)\n protected _resizeContainer?: IgcResizeContainerComponent;\n\n @query('[part~=\"base\"]', true)\n public _tileContent!: HTMLElement;\n\n @state()\n private _maximized = false;\n\n @state()\n private _isDragging = false;\n\n @state()\n private _isResizing = false;\n\n /** Whether to render the resize container based on tile and tile manager configuration. */\n private get _resizeDisabled(): boolean {\n return (\n this.disableResize ||\n this.maximized ||\n this.fullscreen ||\n this._resizeMode === 'none'\n );\n }\n\n protected get _shouldHideHeader() {\n const hasTitle = this._headerRef.value\n ?.querySelector<HTMLSlotElement>('slot[name=\"title\"]')\n ?.assignedNodes().length;\n const hasActions = this.shadowRoot\n ?.querySelector<HTMLSlotElement>('slot[name=\"actions\"]')\n ?.assignedNodes().length;\n\n return (\n !hasTitle && !hasActions && this.disableMaximize && this.disableFullscreen\n );\n }\n\n /**\n * The unique identifier of the tile.\n * @attr tile-id\n */\n @property({ attribute: 'tile-id', type: String, reflect: true })\n public tileId: string | null = null;\n\n /**\n * The number of columns the tile will span.\n *\n * @remarks\n * Values <= 1 will be coerced to 1.\n *\n * @attr col-span\n */\n @property({ type: Number, attribute: 'col-span' })\n public set colSpan(value: number) {\n this._colSpan = Math.max(1, asNumber(value));\n this.style.setProperty('--ig-col-span', this._colSpan.toString());\n }\n\n public get colSpan(): number {\n return this._colSpan;\n }\n\n /**\n * The number of rows the tile will span.\n *\n * @remarks\n * Values <= 1 will be coerced to 1.\n *\n * @attr row-span\n */\n @property({ type: Number, attribute: 'row-span' })\n public set rowSpan(value: number) {\n this._rowSpan = Math.max(1, asNumber(value));\n this.style.setProperty('--ig-row-span', this._rowSpan.toString());\n }\n\n public get rowSpan(): number {\n return this._rowSpan;\n }\n\n /**\n * The starting column for the tile.\n *\n * @attr col-start\n */\n @property({ type: Number, attribute: 'col-start' })\n public set colStart(value: number | null) {\n this._colStart = Math.max(0, asNumber(value)) || null;\n this.style.setProperty(\n '--ig-col-start',\n this._colStart ? this._colStart.toString() : null\n );\n }\n\n public get colStart(): number | null {\n return this._colStart;\n }\n\n /**\n * The starting row for the tile.\n *\n * @attr row-start\n */\n @property({ type: Number, attribute: 'row-start' })\n public set rowStart(value: number | null) {\n this._rowStart = Math.max(0, asNumber(value)) || null;\n this.style.setProperty(\n '--ig-row-start',\n this._rowStart ? this._rowStart.toString() : null\n );\n }\n\n public get rowStart(): number | null {\n return this._rowStart;\n }\n\n /**\n * Indicates whether the tile occupies the whole screen.\n *\n * @property\n */\n public get fullscreen(): boolean {\n return this._fullscreenController.fullscreen;\n }\n\n /**\n * Indicates whether the tile occupies all available space within the layout.\n *\n * @attr maximized\n */\n @property({ type: Boolean, reflect: true })\n public set maximized(value: boolean) {\n this._maximized = value;\n\n if (this._tileManagerCtx) {\n this._tileManagerCtx.instance.requestUpdate();\n }\n }\n\n public get maximized(): boolean {\n return this._maximized;\n }\n\n /**\n * Indicates whether the tile can be resized.\n * @attr disable-resize\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-resize' })\n public disableResize = false;\n\n /**\n * Indicates whether the fullscreen action is displayed.\n * @attr disable-fullscreen\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-fullscreen' })\n public disableFullscreen = false;\n\n /**\n * Indicates whether the maximize action is displayed.\n * @attr disable-maximize\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-maximize' })\n public disableMaximize = false;\n\n /**\n * Gets/sets the tile's visual position in the layout.\n *\n * Corresponds to the CSS order property.\n *\n * @attr position\n */\n @property({ type: Number })\n public set position(value: number) {\n this._position = asNumber(value);\n this.style.order = this._position.toString();\n }\n\n public get position(): number {\n return this._position;\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.tileId = this.tileId || `tile-${IgcTileComponent.increment()}`;\n\n this.style.viewTransitionName =\n this.style.viewTransitionName || `tile-transition-${this.tileId}`;\n }\n\n private _setDragState(state = true) {\n this._isDragging = state;\n this._tileContent.style.opacity = state ? '0' : '1';\n this.style.pointerEvents = state ? 'none' : '';\n this.part.toggle('dragging', state);\n }\n\n private _handleDragStart() {\n this.emitEvent('tileDragStart', { detail: this });\n this._setDragState();\n this._dragStack.push(this);\n }\n\n private _handleDragMove({\n event: { clientX, clientY },\n }: DragCallbackParameters) {\n const match = document\n .elementsFromPoint(clientX, clientY)\n .find(this._match);\n\n if (!match) {\n return;\n }\n\n if (this._dragStack.peek() === match) {\n const { x, y } = getCenterPoint(match);\n\n const shouldSwap =\n this.position <= match.position\n ? clientX > x || clientY > y\n : clientX < x || clientY < y;\n\n if (shouldSwap) {\n this._dragStack.pop();\n this._dragStack.push(match);\n\n startViewTransition(() => {\n swapTiles(this, match);\n });\n }\n\n return;\n }\n\n this._dragStack.push(match);\n\n startViewTransition(() => {\n swapTiles(this, match);\n });\n }\n\n private _handleDragCancel() {\n startViewTransition(() => {\n this._dragStack.restore();\n this._dragStack.reset();\n });\n\n this._dragController.dispose();\n this._setDragState(false);\n }\n\n private _handleDragEnd() {\n this.emitEvent('tileDragEnd', { detail: this });\n this._setDragState(false);\n this._dragStack.reset();\n }\n\n private _skipDrag(event: PointerEvent): boolean {\n if (this._maximized || this.fullscreen) {\n return true;\n }\n\n return Boolean(\n findElementFromEventPath(\n (e) => e.matches('[part*=trigger]') || e.matches('#tile-actions'),\n event\n )\n );\n }\n\n private _match(element: Element): element is IgcTileComponent {\n return element !== this && IgcTileComponent.tagName === element.localName;\n }\n\n private _createDragGhost(): IgcTileComponent {\n return createTileDragGhost(this);\n }\n\n private _setResizeState(state = true) {\n this._isResizing = state;\n this.style.zIndex = state ? '1' : '';\n this.part.toggle('resizing', state);\n }\n\n private _handleResizeStart({\n detail: { state },\n }: CustomEvent<ResizeCallbackParams>) {\n this._resizeState.updateState(state.initial, this, this._cssContainer);\n this._setResizeState();\n }\n\n private _handleResize({\n detail: { state },\n }: CustomEvent<ResizeCallbackParams>) {\n const trigger = state.trigger!;\n\n const isWidthResize = trigger.matches('[part*=\"side\"], [part=\"trigger\"]');\n const isHeightResize = trigger.matches(\n '[part*=\"bottom\"], [part=\"trigger\"]'\n );\n\n if (isWidthResize) {\n state.current.width = this._resizeState.calculateSnappedWidth(state);\n }\n\n if (isHeightResize) {\n state.current.height = this._resizeState.calculateSnappedHeight(state);\n }\n }\n\n private async _handleResizeEnd({\n detail: { state },\n }: CustomEvent<ResizeCallbackParams>) {\n const { column, row } = this._resizeState.getResizedPosition(state.current);\n\n const { transition } = startViewTransition(() => {\n this.style.setProperty('grid-row', row);\n this.style.setProperty('grid-column', column);\n });\n\n await transition?.finished;\n\n const { width, height } = this._resizeState.calculateResizedSize(\n this._cssContainer\n );\n\n this._resizeContainer?.setSize(width, height);\n this._setResizeState(false);\n }\n\n private _handleResizeCancel() {\n this._setResizeState(false);\n }\n\n private _handleFullscreen() {\n this._fullscreenController.setState(!this.fullscreen);\n }\n\n private _handleMaximize() {\n if (!this.emitMaximizedEvent()) {\n return;\n }\n\n this.maximized = !this.maximized;\n }\n\n private emitFullScreenEvent(state: boolean) {\n this.requestUpdate();\n\n return this.emitEvent('igcTileFullscreen', {\n detail: { tile: this, state },\n cancelable: true,\n });\n }\n\n private emitMaximizedEvent() {\n return this.emitEvent('igcTileMaximize', {\n detail: { tile: this, state: !this.maximized },\n cancelable: true,\n });\n }\n\n protected _renderDefaultAction(type: 'maximize' | 'fullscreen') {\n const [icon, listener] =\n type === 'fullscreen'\n ? [\n this.fullscreen ? 'fullscreen_exit' : 'fullscreen',\n this._handleFullscreen,\n ]\n : [\n this._maximized ? 'collapse_content' : 'expand_content',\n this._handleMaximize,\n ];\n\n return html`\n <igc-icon-button\n variant=\"flat\"\n collection=\"default\"\n exportparts=\"icon\"\n name=${icon}\n aria-label=${icon}\n @click=${listener}\n ></igc-icon-button>\n `;\n }\n\n protected _renderHeader() {\n return html`\n <section part=\"header\" ?hidden=${this._shouldHideHeader}>\n <header part=\"title\" ${ref(this._headerRef)}>\n <slot name=\"title\" @slotchange=${this.requestUpdate}></slot>\n </header>\n <section id=\"tile-actions\" part=\"actions\">\n ${!this.disableMaximize\n ? html`<slot name=\"maximize-action\"\n >${this._renderDefaultAction('maximize')}</slot\n >`\n : nothing}\n ${!this.disableFullscreen\n ? html`<slot name=\"fullscreen-action\"\n >${this._renderDefaultAction('fullscreen')}</slot\n >`\n : nothing}\n\n <slot name=\"actions\" @slotchange=${this.requestUpdate}></slot>\n </section>\n </section>\n <igc-divider></igc-divider>\n `;\n }\n\n protected _renderContent() {\n const parts = partNameMap({\n base: true,\n draggable: this._tileManager?.dragMode !== 'none',\n fullscreen: this.fullscreen,\n dragging: this._isDragging,\n resizable:\n !this.disableResize && this._tileManager?.resizeMode !== 'none',\n resizing: this._isResizing,\n maximized: this.maximized,\n });\n\n const styles = {\n '--ig-col-span': this._colSpan,\n '--ig-row-span': this._rowSpan,\n '--ig-col-start': this._colStart,\n '--ig-row-start': this._rowStart,\n };\n\n return html`\n <div part=${parts} style=${styleMap(styles)}>\n ${this._renderHeader()}\n <div part=\"content-container\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n\n protected override createRenderRoot() {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', () => this.requestUpdate());\n return root;\n }\n\n private _customAdorners = new Map<string, boolean>(\n Object.entries({\n side: false,\n corner: false,\n bottom: false,\n })\n );\n\n private _renderAdornerSlot(name: AdornerType) {\n return html`\n <slot\n @slotchange=${() => this._customAdorners.set(name, true)}\n name=\"${name}-adorner\"\n slot=\"${name}-adorner\"\n >\n <div part=\"adorner-indicator\"></div>\n </slot>\n `;\n }\n\n protected override render() {\n return html`\n <igc-resize\n part=${partNameMap({\n resize: true,\n 'side-adorner': this._customAdorners.get('side')!,\n 'corner-adorner': this._customAdorners.get('corner')!,\n 'bottom-adorner': this._customAdorners.get('bottom')!,\n })}\n mode=\"deferred\"\n .enabled=${!this._resizeDisabled}\n ?active=${this._resizeMode === 'always'}\n .ghostFactory=${createTileGhost}\n @igcResizeStart=${this._handleResizeStart}\n @igcResize=${this._handleResize}\n @igcResizeEnd=${this._handleResizeEnd}\n @igcResizeCancel=${this._handleResizeCancel}\n >\n ${this._renderContent()} ${this._renderAdornerSlot('side')}\n ${this._renderAdornerSlot('corner')}\n ${this._renderAdornerSlot('bottom')}\n </igc-resize>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tile': IgcTileComponent;\n }\n}\n"]}
1
+ {"version":3,"file":"tile.js","sourceRoot":"","sources":["../../../src/components/tile-manager/tile.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAEL,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAEL,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAA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,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;uDAC3C;AAOtB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;2DAC3C;AAO1B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;yDAC3C;AAU/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAI1B;AArQkB,gBAAgB;IADpC,MAAM,CAAC,GAAG,CAAC;GACS,gBAAgB,CA2kBpC;eA3kBoB,gBAAgB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { startViewTransition } from '../../animations/player.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport IgcIconButtonComponent from '../button/icon-button.js';\nimport {\n type TileManagerContext,\n tileManagerContext,\n} from '../common/context.js';\nimport { createAsyncContext } from '../common/controllers/async-consumer.js';\nimport {\n type DragCallbackParameters,\n addDragController,\n} from '../common/controllers/drag.js';\nimport { addFullscreenController } from '../common/controllers/fullscreen.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport {\n asNumber,\n createCounter,\n findElementFromEventPath,\n getCenterPoint,\n isEmpty,\n partNameMap,\n} from '../common/util.js';\nimport IgcDividerComponent from '../divider/divider.js';\nimport IgcResizeContainerComponent from '../resize-container/resize-container.js';\nimport type { ResizeCallbackParams } from '../resize-container/types.js';\nimport { createTileDragStack, swapTiles } from './position.js';\nimport { styles as shared } from './themes/shared/tile/tile.common.css.js';\nimport { styles } from './themes/tile.base.css.js';\nimport { all } from './themes/tile.js';\nimport {\n createTileDragGhost,\n createTileGhost,\n createTileResizeState,\n} from './tile-util.js';\n\ntype IgcTileChangeState = {\n tile: IgcTileComponent;\n state: boolean;\n};\n\ntype AdornerType = 'side' | 'corner' | 'bottom';\n\n// REVIEW: Decide whether to re-emit the events from the manager of leave them up to bubble naturally\nexport interface IgcTileComponentEventMap {\n igcTileFullscreen: CustomEvent<IgcTileChangeState>;\n igcTileMaximize: CustomEvent<IgcTileChangeState>;\n tileDragStart: CustomEvent<IgcTileComponent>;\n tileDragEnd: CustomEvent<IgcTileComponent>;\n igcResizeStart: CustomEvent<IgcTileComponent>;\n igcResizeMove: CustomEvent<IgcTileComponent>;\n igcResizeEnd: CustomEvent<IgcTileComponent>;\n}\n\n/**\n * The tile component is used within the `igc-tile-manager` as a container\n * for displaying various types of information.\n *\n * @element igc-tile\n *\n * @fires igcTileFullscreen - Fired when tile fullscreen state changes.\n * @fires igcTileMaximize - Fired when tile maximize state changes.\n * @fires igcResizeStart - Fired when tile begins resizing.\n * @fires igcResizeMove - Fired when tile is being resized.\n * @fires igcResizeEnd - Fired when tile finishes resizing.\n *\n * @slot title - Renders the title of the tile header.\n * @slot maximize-action - Renders the maximize action element.\n * @slot fullscreen-action - Renders the fullscreen action element.\n * @slot actions - Renders items after the default actions.\n * @slot Default slot for the tile's content.\n * @slot side-adorner - Renders the side resize handle.\n * @slot corner-adorner - Renders the corner resize handle.\n * @slot bottom-adorner - Renders the bottom resize handle.\n *\n * @csspart base - The wrapper for the entire tile.\n * @csspart header - The container for the header, including title and actions.\n * @csspart title - The title container.\n * @csspart actions - The actions container.\n * @csspart content-container - The container wrapping the tile’s main content.\n */\n@themes(all)\nexport default class IgcTileComponent extends EventEmitterMixin<\n IgcTileComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-tile';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register() {\n registerComponent(\n IgcTileComponent,\n IgcIconButtonComponent,\n IgcDividerComponent,\n IgcResizeContainerComponent\n );\n }\n\n private static readonly increment = createCounter();\n\n private _dragController = addDragController(this, {\n skip: this._skipDrag,\n ghost: this._createDragGhost,\n start: this._handleDragStart,\n move: this._handleDragMove,\n end: this._handleDragEnd,\n cancel: this._handleDragCancel,\n });\n\n private _fullscreenController = addFullscreenController(this, {\n enter: this.emitFullScreenEvent,\n exit: this.emitFullScreenEvent,\n });\n\n private _colSpan = 1;\n private _rowSpan = 1;\n private _colStart: number | null = null;\n private _rowStart: number | null = null;\n private _position = -1;\n private _resizeState = createTileResizeState();\n private _dragStack = createTileDragStack();\n\n private _customAdorners = new Map<string, boolean>(\n Object.entries({\n side: false,\n corner: false,\n bottom: false,\n })\n );\n\n // Tile manager context properties and helpers\n\n /**\n * Context consumer callback that sets the updated configuration of the internal drag controller\n * based on the passed tile manager properties.\n */\n private _setDragConfiguration = ({\n instance: { dragMode },\n }: TileManagerContext) => {\n this._dragController.set({\n enabled: dragMode !== 'none',\n trigger:\n dragMode === 'tile-header' ? () => this._headerRef.value! : undefined,\n });\n };\n\n private _context = createAsyncContext(\n this,\n tileManagerContext,\n this._setDragConfiguration\n );\n\n /** Returns the parent tile manager context. */\n private get _tileManagerCtx(): TileManagerContext | undefined {\n return this._context.value;\n }\n\n private get _tileManager() {\n return this._tileManagerCtx?.instance;\n }\n\n /** Returns the tile manager internal CSS grid container. */\n private get _cssContainer(): HTMLElement {\n return this._tileManagerCtx?.grid.value!;\n }\n\n /** Returns the tile manager current resize mode. */\n private get _resizeMode() {\n return this._tileManager?.resizeMode ?? 'none';\n }\n\n protected _headerRef = createRef<HTMLSlotElement>();\n\n @queryAssignedElements({ slot: 'title' })\n private _titleElements!: HTMLElement[];\n\n @queryAssignedElements({ slot: 'actions' })\n private _actionsElements!: HTMLElement[];\n\n @query(IgcResizeContainerComponent.tagName)\n protected _resizeContainer?: IgcResizeContainerComponent;\n\n @query('[part~=\"base\"]', true)\n public _tileContent!: HTMLElement;\n\n @state()\n private _maximized = false;\n\n @state()\n private _isDragging = false;\n\n @state()\n private _isResizing = false;\n\n /** Whether to render the resize container based on tile and tile manager configuration. */\n private get _resizeDisabled(): boolean {\n return (\n this.disableResize ||\n this.maximized ||\n this.fullscreen ||\n this._resizeMode === 'none'\n );\n }\n\n /**\n * The unique identifier of the tile.\n * @attr tile-id\n */\n @property({ attribute: 'tile-id', type: String, reflect: true })\n public tileId: string | null = null;\n\n /**\n * The number of columns the tile will span.\n *\n * @remarks\n * Values <= 1 will be coerced to 1.\n *\n * @attr col-span\n */\n @property({ type: Number, attribute: 'col-span' })\n public set colSpan(value: number) {\n this._colSpan = Math.max(1, asNumber(value));\n this.style.setProperty('--ig-col-span', this._colSpan.toString());\n }\n\n public get colSpan(): number {\n return this._colSpan;\n }\n\n /**\n * The number of rows the tile will span.\n *\n * @remarks\n * Values <= 1 will be coerced to 1.\n *\n * @attr row-span\n */\n @property({ type: Number, attribute: 'row-span' })\n public set rowSpan(value: number) {\n this._rowSpan = Math.max(1, asNumber(value));\n this.style.setProperty('--ig-row-span', this._rowSpan.toString());\n }\n\n public get rowSpan(): number {\n return this._rowSpan;\n }\n\n /**\n * The starting column for the tile.\n *\n * @attr col-start\n */\n @property({ type: Number, attribute: 'col-start' })\n public set colStart(value: number | null) {\n this._colStart = Math.max(0, asNumber(value)) || null;\n this.style.setProperty(\n '--ig-col-start',\n this._colStart ? this._colStart.toString() : null\n );\n }\n\n public get colStart(): number | null {\n return this._colStart;\n }\n\n /**\n * The starting row for the tile.\n *\n * @attr row-start\n */\n @property({ type: Number, attribute: 'row-start' })\n public set rowStart(value: number | null) {\n this._rowStart = Math.max(0, asNumber(value)) || null;\n this.style.setProperty(\n '--ig-row-start',\n this._rowStart ? this._rowStart.toString() : null\n );\n }\n\n public get rowStart(): number | null {\n return this._rowStart;\n }\n\n /**\n * Indicates whether the tile occupies the whole screen.\n *\n * @property\n */\n public get fullscreen(): boolean {\n return this._fullscreenController.fullscreen;\n }\n\n /**\n * Indicates whether the tile occupies all available space within the layout.\n *\n * @attr maximized\n */\n @property({ type: Boolean, reflect: true })\n public set maximized(value: boolean) {\n this._maximized = value;\n\n if (this._tileManagerCtx) {\n this._tileManagerCtx.instance.requestUpdate();\n }\n }\n\n public get maximized(): boolean {\n return this._maximized;\n }\n\n /**\n * Indicates whether the tile can be resized.\n * @attr disable-resize\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-resize' })\n public disableResize = false;\n\n /**\n * Indicates whether the fullscreen action is displayed.\n * @attr disable-fullscreen\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-fullscreen' })\n public disableFullscreen = false;\n\n /**\n * Indicates whether the maximize action is displayed.\n * @attr disable-maximize\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-maximize' })\n public disableMaximize = false;\n\n /**\n * Gets/sets the tile's visual position in the layout.\n *\n * Corresponds to the CSS order property.\n *\n * @attr position\n */\n @property({ type: Number })\n public set position(value: number) {\n this._position = asNumber(value);\n this.style.order = this._position.toString();\n }\n\n public get position(): number {\n return this._position;\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.tileId = this.tileId || `tile-${IgcTileComponent.increment()}`;\n\n this.style.viewTransitionName =\n this.style.viewTransitionName || `tile-transition-${this.tileId}`;\n }\n\n protected override createRenderRoot() {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', () => this.requestUpdate());\n return root;\n }\n\n private _setDragState(state = true) {\n this._isDragging = state;\n this._tileContent.style.opacity = state ? '0' : '1';\n this.style.pointerEvents = state ? 'none' : '';\n this.part.toggle('dragging', state);\n }\n\n private _handleDragStart() {\n this.emitEvent('tileDragStart', { detail: this });\n this._setDragState();\n this._dragStack.push(this);\n }\n\n private _handleDragMove({\n event: { clientX, clientY },\n }: DragCallbackParameters) {\n const match = document\n .elementsFromPoint(clientX, clientY)\n .find(this._match);\n\n if (!match) {\n return;\n }\n\n if (this._dragStack.peek() === match) {\n const { x, y } = getCenterPoint(match);\n\n const shouldSwap =\n this.position <= match.position\n ? clientX > x || clientY > y\n : clientX < x || clientY < y;\n\n if (shouldSwap) {\n this._dragStack.pop();\n this._dragStack.push(match);\n\n startViewTransition(() => {\n swapTiles(this, match);\n });\n }\n\n return;\n }\n\n this._dragStack.push(match);\n\n startViewTransition(() => {\n swapTiles(this, match);\n });\n }\n\n private _handleDragCancel() {\n startViewTransition(() => {\n this._dragStack.restore();\n this._dragStack.reset();\n });\n\n this._dragController.dispose();\n this._setDragState(false);\n }\n\n private _handleDragEnd() {\n this.emitEvent('tileDragEnd', { detail: this });\n this._setDragState(false);\n this._dragStack.reset();\n }\n\n private _skipDrag(event: PointerEvent): boolean {\n if (this._maximized || this.fullscreen) {\n return true;\n }\n\n return Boolean(\n findElementFromEventPath(\n (e) => e.matches('[part*=trigger]') || e.matches('#tile-actions'),\n event\n )\n );\n }\n\n private _match(element: Element): element is IgcTileComponent {\n return element !== this && IgcTileComponent.tagName === element.localName;\n }\n\n private _createDragGhost(): IgcTileComponent {\n return createTileDragGhost(this);\n }\n\n private _setResizeState(state = true) {\n this._isResizing = state;\n this.style.zIndex = state ? '1' : '';\n this.part.toggle('resizing', state);\n }\n\n private _handleResizeStart({\n detail: { state },\n }: CustomEvent<ResizeCallbackParams>) {\n this._resizeState.updateState(state.initial, this, this._cssContainer);\n this._setResizeState();\n }\n\n private _handleResize({\n detail: { state },\n }: CustomEvent<ResizeCallbackParams>) {\n const trigger = state.trigger!;\n\n const isWidthResize = trigger.matches('[part*=\"side\"], [part=\"trigger\"]');\n const isHeightResize = trigger.matches(\n '[part*=\"bottom\"], [part=\"trigger\"]'\n );\n\n if (isWidthResize) {\n state.current.width = this._resizeState.calculateSnappedWidth(state);\n }\n\n if (isHeightResize) {\n state.current.height = this._resizeState.calculateSnappedHeight(state);\n }\n }\n\n private async _handleResizeEnd({\n detail: { state },\n }: CustomEvent<ResizeCallbackParams>) {\n const { column, row } = this._resizeState.getResizedPosition(state.current);\n\n const { transition } = startViewTransition(() => {\n this.style.setProperty('grid-row', row);\n this.style.setProperty('grid-column', column);\n });\n\n await transition?.updateCallbackDone;\n\n const { width, height } = this._resizeState.calculateResizedSize(\n this._cssContainer\n );\n\n this._resizeState.resizedDimensions = { width, height };\n this._resizeContainer?.setSize(width, height);\n this._setResizeState(false);\n }\n\n private _handleResizeCancel() {\n this._setResizeState(false);\n }\n\n private _handleFullscreen() {\n const { width, height } = !this.fullscreen\n ? this._resizeState.emptyResizeDimensions\n : this._resizeState.resizedDimensions;\n\n this._resizeContainer?.setSize(width, height);\n this._fullscreenController.setState(!this.fullscreen);\n }\n\n private _handleMaximize() {\n if (!this.emitMaximizedEvent()) {\n return;\n }\n\n this.maximized = !this.maximized;\n }\n\n private emitFullScreenEvent(state: boolean) {\n this.requestUpdate();\n\n return this.emitEvent('igcTileFullscreen', {\n detail: { tile: this, state },\n cancelable: true,\n });\n }\n\n private emitMaximizedEvent() {\n return this.emitEvent('igcTileMaximize', {\n detail: { tile: this, state: !this.maximized },\n cancelable: true,\n });\n }\n\n protected _renderDefaultAction(type: 'maximize' | 'fullscreen') {\n const [icon, listener] =\n type === 'fullscreen'\n ? [\n this.fullscreen ? 'fullscreen_exit' : 'fullscreen',\n this._handleFullscreen,\n ]\n : [\n this._maximized ? 'collapse_content' : 'expand_content',\n this._handleMaximize,\n ];\n\n return html`\n <igc-icon-button\n variant=\"flat\"\n collection=\"default\"\n exportparts=\"icon\"\n name=${icon}\n aria-label=${icon}\n @click=${listener}\n ></igc-icon-button>\n `;\n }\n\n protected _renderHeader() {\n const hideHeader =\n isEmpty(this._titleElements) &&\n isEmpty(this._actionsElements) &&\n this.disableMaximize &&\n this.disableFullscreen;\n\n return html`\n <section part=\"header\" ?hidden=${hideHeader}>\n <header part=\"title\" ${ref(this._headerRef)}>\n <slot name=\"title\"></slot>\n </header>\n <section id=\"tile-actions\" part=\"actions\">\n ${!this.disableMaximize\n ? html`<slot name=\"maximize-action\"\n >${this._renderDefaultAction('maximize')}</slot\n >`\n : nothing}\n ${!this.disableFullscreen\n ? html`<slot name=\"fullscreen-action\"\n >${this._renderDefaultAction('fullscreen')}</slot\n >`\n : nothing}\n\n <slot name=\"actions\"></slot>\n </section>\n </section>\n <igc-divider></igc-divider>\n `;\n }\n\n protected _renderContent() {\n const parts = partNameMap({\n base: true,\n draggable: this._tileManager?.dragMode !== 'none',\n fullscreen: this.fullscreen,\n dragging: this._isDragging,\n resizable:\n !this.disableResize && this._tileManager?.resizeMode !== 'none',\n resizing: this._isResizing,\n maximized: this.maximized,\n });\n\n const styles = {\n '--ig-col-span': this._colSpan,\n '--ig-row-span': this._rowSpan,\n '--ig-col-start': this._colStart,\n '--ig-row-start': this._rowStart,\n };\n\n return html`\n <div part=${parts} style=${styleMap(styles)}>\n ${this._renderHeader()}\n <div part=\"content-container\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n\n private _renderAdornerSlot(name: AdornerType) {\n return html`\n <slot\n @slotchange=${() => this._customAdorners.set(name, true)}\n name=\"${name}-adorner\"\n slot=\"${name}-adorner\"\n >\n <div part=\"adorner-indicator\"></div>\n </slot>\n `;\n }\n\n protected override render() {\n const { width, height } =\n this.fullscreen || this.maximized\n ? this._resizeState.emptyResizeDimensions\n : this._resizeState.resizedDimensions;\n\n this._resizeContainer?.setSize(width, height);\n\n return html`\n <igc-resize\n part=${partNameMap({\n resize: true,\n 'side-adorner': this._customAdorners.get('side')!,\n 'corner-adorner': this._customAdorners.get('corner')!,\n 'bottom-adorner': this._customAdorners.get('bottom')!,\n })}\n mode=\"deferred\"\n .enabled=${!this._resizeDisabled}\n ?active=${this._resizeMode === 'always'}\n .ghostFactory=${createTileGhost}\n @igcResizeStart=${this._handleResizeStart}\n @igcResize=${this._handleResize}\n @igcResizeEnd=${this._handleResizeEnd}\n @igcResizeCancel=${this._handleResizeCancel}\n >\n ${this._renderContent()} ${this._renderAdornerSlot('side')}\n ${this._renderAdornerSlot('corner')}\n ${this._renderAdornerSlot('bottom')}\n </igc-resize>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tile': IgcTileComponent;\n }\n}\n"]}
@@ -11843,6 +11843,12 @@
11843
11843
  "name": "_dragStack",
11844
11844
  "privacy": "private"
11845
11845
  },
11846
+ {
11847
+ "kind": "field",
11848
+ "name": "_customAdorners",
11849
+ "privacy": "private",
11850
+ "default": "new Map<string, boolean>( Object.entries({ side: false, corner: false, bottom: false, }) )"
11851
+ },
11846
11852
  {
11847
11853
  "kind": "field",
11848
11854
  "name": "_setDragConfiguration",
@@ -11892,6 +11898,22 @@
11892
11898
  "name": "_headerRef",
11893
11899
  "privacy": "protected"
11894
11900
  },
11901
+ {
11902
+ "kind": "field",
11903
+ "name": "_titleElements",
11904
+ "type": {
11905
+ "text": "HTMLElement[]"
11906
+ },
11907
+ "privacy": "private"
11908
+ },
11909
+ {
11910
+ "kind": "field",
11911
+ "name": "_actionsElements",
11912
+ "type": {
11913
+ "text": "HTMLElement[]"
11914
+ },
11915
+ "privacy": "private"
11916
+ },
11895
11917
  {
11896
11918
  "kind": "field",
11897
11919
  "name": "_resizeContainer",
@@ -11945,12 +11967,6 @@
11945
11967
  "description": "Whether to render the resize container based on tile and tile manager configuration.",
11946
11968
  "readonly": true
11947
11969
  },
11948
- {
11949
- "kind": "field",
11950
- "name": "_shouldHideHeader",
11951
- "privacy": "protected",
11952
- "readonly": true
11953
- },
11954
11970
  {
11955
11971
  "kind": "field",
11956
11972
  "name": "tileId",
@@ -12261,12 +12277,6 @@
12261
12277
  "name": "_renderContent",
12262
12278
  "privacy": "protected"
12263
12279
  },
12264
- {
12265
- "kind": "field",
12266
- "name": "_customAdorners",
12267
- "privacy": "private",
12268
- "default": "new Map<string, boolean>( Object.entries({ side: false, corner: false, bottom: false, }) )"
12269
- },
12270
12280
  {
12271
12281
  "kind": "method",
12272
12282
  "name": "_renderAdornerSlot",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-webcomponents",
3
- "version": "5.3.0-beta.0",
3
+ "version": "5.3.0-beta.1",
4
4
  "description": "Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.",
5
5
  "author": "Infragistics",
6
6
  "license": "SEE LICENSE IN LICENSE",