@progress/kendo-angular-layout 17.0.0-develop.10 → 17.0.0-develop.12

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.
@@ -7,7 +7,7 @@ import { Directive, Optional, Injectable, isDevMode, Component, SkipSelf, Host,
7
7
  import * as i1 from '@progress/kendo-angular-l10n';
8
8
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
9
9
  import * as i1$1 from '@progress/kendo-angular-common';
10
- import { Keys, shouldShowValidationUI, WatermarkOverlayComponent, isDocumentAvailable, DraggableDirective, PreventableEvent as PreventableEvent$1, guid, ResizeSensorComponent, hasObservers, isPresent as isPresent$1, focusableSelector, isChanged } from '@progress/kendo-angular-common';
10
+ import { Keys, shouldShowValidationUI, WatermarkOverlayComponent, isObjectPresent, removeHTMLAttributes, parseAttributes, setHTMLAttributes, isDocumentAvailable, DraggableDirective, PreventableEvent as PreventableEvent$1, guid, ResizeSensorComponent, hasObservers, isPresent as isPresent$1, focusableSelector, isChanged } from '@progress/kendo-angular-common';
11
11
  import { validatePackage } from '@progress/kendo-licensing';
12
12
  import * as i1$2 from '@angular/animations';
13
13
  import { trigger, state, style, transition, animate, AUTO_STYLE } from '@angular/animations';
@@ -28,8 +28,8 @@ const packageMetadata = {
28
28
  name: '@progress/kendo-angular-layout',
29
29
  productName: 'Kendo UI for Angular',
30
30
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
31
- publishDate: 1729175986,
32
- version: '17.0.0-develop.10',
31
+ publishDate: 1729256670,
32
+ version: '17.0.0-develop.12',
33
33
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
34
34
  };
35
35
 
@@ -1598,18 +1598,235 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1598
1598
  args: ['keydown', ['$event']]
1599
1599
  }] } });
1600
1600
 
1601
+ /**
1602
+ * @hidden
1603
+ */
1604
+ const shouldTogglePrev = (keyCode, prev, next) => {
1605
+ const leftArrow = keyCode === Keys.ArrowLeft;
1606
+ const upArrow = keyCode === Keys.ArrowUp;
1607
+ const collapsePrev = !prev.collapsed && !next.collapsed && (leftArrow || upArrow);
1608
+ const expandPrev = prev.collapsed && !(leftArrow || upArrow);
1609
+ return collapsePrev || expandPrev;
1610
+ };
1611
+ /**
1612
+ * @hidden
1613
+ */
1614
+ const shouldToggleNext = (keyCode, prev, next) => {
1615
+ const leftArrow = keyCode === Keys.ArrowLeft;
1616
+ const upArrow = keyCode === Keys.ArrowUp;
1617
+ const collapseNext = !next.collapsed && !prev.collapsed && !(leftArrow || upArrow);
1618
+ const expandNext = next.collapsed && (leftArrow || upArrow);
1619
+ return collapseNext || expandNext;
1620
+ };
1621
+ /**
1622
+ * @hidden
1623
+ */
1624
+ const shouldToggleOrResize = (keyCode, orientation) => {
1625
+ const isHorizontal = orientation === 'horizontal';
1626
+ const isHorizontalChange = isHorizontal && (keyCode === Keys.ArrowLeft || keyCode === Keys.ArrowRight);
1627
+ const isVerticalChange = !isHorizontal && (keyCode === Keys.ArrowUp || keyCode === Keys.ArrowDown);
1628
+ return isHorizontalChange || isVerticalChange;
1629
+ };
1630
+
1631
+ const MAX_PANE_HEIGHT = 33554400;
1632
+ /**
1633
+ * @hidden
1634
+ */
1635
+ class SplitterService {
1636
+ constructor(zone) {
1637
+ this.zone = zone;
1638
+ this.layoutChange = new EventEmitter();
1639
+ this.resizeStep = 10;
1640
+ this.containerSize = () => { };
1641
+ }
1642
+ tryToggle(paneIndex) {
1643
+ const pane = this.pane(paneIndex);
1644
+ if (pane.collapsible) {
1645
+ pane.collapsed = !pane.collapsed;
1646
+ pane.collapsedChange.emit(pane.collapsed);
1647
+ this.emit(this.layoutChange, {});
1648
+ if (pane.collapsed) {
1649
+ pane.detectChanges();
1650
+ }
1651
+ }
1652
+ const notCollapsed = this.panes.filter(p => !p.collapsed);
1653
+ const allHaveFixedSize = notCollapsed.every(p => p.fixedSize);
1654
+ notCollapsed.filter(p => p.fixedSize).forEach(pane => {
1655
+ pane.forceExpand = allHaveFixedSize ? true : false;
1656
+ });
1657
+ return pane.collapsible;
1658
+ }
1659
+ togglePane(keyCode, index) {
1660
+ const prev = this.pane(index);
1661
+ const next = this.pane(index + 1);
1662
+ if (shouldTogglePrev(keyCode, prev, next)) {
1663
+ this.tryToggle(index);
1664
+ }
1665
+ else if (shouldToggleNext(keyCode, prev, next)) {
1666
+ this.tryToggle(index + 1);
1667
+ }
1668
+ }
1669
+ resizePane(keyCode, index) {
1670
+ const state = this.dragState(index);
1671
+ const direction = keyCode === Keys.ArrowLeft || keyCode === (this.rtl ? Keys.ArrowDown : Keys.ArrowUp);
1672
+ let step = direction ? (-this.resizeStep) : this.resizeStep;
1673
+ if (this.rtl) {
1674
+ step = -step;
1675
+ }
1676
+ this.setSize(state, step);
1677
+ }
1678
+ toggleContentOverlay(index, show) {
1679
+ this.pane(index).toggleOverlay(show);
1680
+ this.pane(index + 1).toggleOverlay(show);
1681
+ }
1682
+ dragState(splitbarIndex) {
1683
+ const prev = this.pane(splitbarIndex);
1684
+ const next = this.pane(splitbarIndex + 1);
1685
+ const total = prev.computedSize + next.computedSize;
1686
+ const px = s => this.toPixels(s);
1687
+ return {
1688
+ prev: {
1689
+ index: splitbarIndex,
1690
+ initialSize: prev.computedSize,
1691
+ min: px(prev.min) || total - px(next.max) || 0,
1692
+ max: px(prev.max) || total - px(next.min) || total
1693
+ },
1694
+ next: {
1695
+ index: splitbarIndex + 1,
1696
+ initialSize: next.computedSize,
1697
+ min: px(next.min) || total - px(prev.max) || 0,
1698
+ max: px(next.max) || total - px(prev.min) || total
1699
+ }
1700
+ };
1701
+ }
1702
+ setSize(state, delta) {
1703
+ const clamp = (min, max, v) => Math.min(max, Math.max(min, v));
1704
+ const resize = (paneState, change, modifyMax = false) => {
1705
+ const pane = this.pane(paneState.index);
1706
+ const splitterSize = this.containerSize();
1707
+ const newSize = clamp(paneState.min, modifyMax ? MAX_PANE_HEIGHT : paneState.max, paneState.initialSize + change);
1708
+ let size = "";
1709
+ if (this.isPercent(pane.size)) {
1710
+ size = (100 * newSize / splitterSize) + "%";
1711
+ }
1712
+ else {
1713
+ size = newSize + "px";
1714
+ }
1715
+ pane.size = size;
1716
+ pane.isResized = true;
1717
+ this.emit(pane.sizeChange, size);
1718
+ };
1719
+ const prevPane = this.pane(state.prev.index);
1720
+ const nextPane = this.pane(state.next.index);
1721
+ const canResizeBothPanes = this.panes.length > 2;
1722
+ const modifyPrevMax = prevPane.orientation === 'vertical' && !this.fixedHeight && !prevPane.max;
1723
+ const modifyNextMax = prevPane.orientation === 'vertical' && !this.fixedHeight && !nextPane.max;
1724
+ if (prevPane.fixedSize && nextPane.fixedSize || canResizeBothPanes) {
1725
+ const bothVertical = prevPane.orientation === 'vertical' && nextPane.orientation === 'vertical';
1726
+ if (bothVertical) {
1727
+ if (modifyNextMax) {
1728
+ resize(state.prev, delta, modifyPrevMax);
1729
+ }
1730
+ else if (modifyPrevMax) {
1731
+ resize(state.next, -delta, modifyNextMax);
1732
+ }
1733
+ else {
1734
+ resize(state.prev, delta, modifyNextMax);
1735
+ resize(state.next, -delta, modifyPrevMax);
1736
+ }
1737
+ }
1738
+ else {
1739
+ resize(state.prev, delta);
1740
+ resize(state.next, -delta);
1741
+ }
1742
+ }
1743
+ else if (nextPane.fixedSize || nextPane.collapsible) {
1744
+ resize(state.next, -delta, modifyNextMax);
1745
+ }
1746
+ else {
1747
+ resize(state.prev, delta, modifyPrevMax);
1748
+ }
1749
+ this.emit(this.layoutChange, {});
1750
+ }
1751
+ isDraggable(splitBarIndex) {
1752
+ const prev = this.pane(splitBarIndex);
1753
+ const next = this.pane(splitBarIndex + 1);
1754
+ const betweenResizablePanes = prev.resizable && next.resizable;
1755
+ const nearCollapsedPane = prev.collapsed || next.collapsed;
1756
+ return betweenResizablePanes && !nearCollapsedPane;
1757
+ }
1758
+ isStatic(splitBarIndex) {
1759
+ const prev = this.pane(splitBarIndex);
1760
+ const next = this.pane(splitBarIndex + 1);
1761
+ const betweenResizablePanes = prev.resizable && next.resizable;
1762
+ const nearCollapsiblePane = prev.collapsible || next.collapsible;
1763
+ return !betweenResizablePanes && !nearCollapsiblePane;
1764
+ }
1765
+ pane(index) {
1766
+ if (!this.panes) {
1767
+ throw new Error("Panes not initialized");
1768
+ }
1769
+ if (index < 0 || index >= this.panes.length) {
1770
+ throw new Error("Index out of range");
1771
+ }
1772
+ return this.panes[index];
1773
+ }
1774
+ paneByIndex(pane) {
1775
+ if (!this.panes) {
1776
+ return -1;
1777
+ }
1778
+ return this.panes.findIndex(splitterPane => splitterPane === pane);
1779
+ }
1780
+ getPaneSplitterBar(pane) {
1781
+ if (!this.splitterBars) {
1782
+ return;
1783
+ }
1784
+ const paneIndex = this.paneByIndex(pane);
1785
+ if (paneIndex < 0 || paneIndex >= this.splitterBars.length) {
1786
+ return null;
1787
+ }
1788
+ return this.splitterBars[paneIndex];
1789
+ }
1790
+ configure({ panes, orientation, containerSize, direction }) {
1791
+ this.panes = panes;
1792
+ this.panes.forEach((pane, index) => {
1793
+ pane.order = index * 2;
1794
+ pane.orientation = orientation;
1795
+ });
1796
+ this.containerSize = containerSize;
1797
+ this.rtl = direction === 'rtl';
1798
+ }
1799
+ isPercent(size) {
1800
+ return /%$/.test(size);
1801
+ }
1802
+ toPixels(size) {
1803
+ let result = parseFloat(size);
1804
+ if (this.isPercent(size)) {
1805
+ result = (this.containerSize() * result / 100);
1806
+ }
1807
+ return result;
1808
+ }
1809
+ emit(emitter, args) {
1810
+ if (emitter.observers.length) {
1811
+ this.zone.run(() => emitter.emit(args));
1812
+ }
1813
+ }
1814
+ }
1815
+ SplitterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
1816
+ SplitterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService });
1817
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, decorators: [{
1818
+ type: Injectable
1819
+ }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
1820
+
1601
1821
  /**
1602
1822
  * Represents the pane component of the Splitter.
1603
1823
  */
1604
1824
  class SplitterPaneComponent {
1605
- constructor(element, renderer, cdr) {
1825
+ constructor(element, renderer, cdr, splitterService) {
1606
1826
  this.element = element;
1607
1827
  this.renderer = renderer;
1608
1828
  this.cdr = cdr;
1609
- /**
1610
- * The value of the aria-label attribute of the auxiliary separator.
1611
- */
1612
- this.separatorLabel = 'Splitter pane';
1829
+ this.splitterService = splitterService;
1613
1830
  /**
1614
1831
  * Specifies if the user is allowed to resize the pane and provide space for other panes.
1615
1832
  */
@@ -1674,29 +1891,42 @@ class SplitterPaneComponent {
1674
1891
  */
1675
1892
  set size(newSize) {
1676
1893
  this._size = newSize;
1677
- const element = this.element.nativeElement;
1678
- this.renderer.setStyle(element, '-ms-flex-preferred-size', newSize);
1679
- this.renderer.setStyle(element, 'flex-basis', newSize);
1894
+ this.renderer.setStyle(this.nativeElement, '-ms-flex-preferred-size', newSize);
1895
+ this.renderer.setStyle(this.nativeElement, 'flex-basis', newSize);
1680
1896
  if (this.staticPaneClass) {
1681
- this.renderer.addClass(element, 'k-pane-static');
1897
+ this.renderer.addClass(this.nativeElement, 'k-pane-static');
1682
1898
  }
1683
1899
  else {
1684
- this.renderer.removeClass(element, 'k-pane-static');
1900
+ this.renderer.removeClass(this.nativeElement, 'k-pane-static');
1685
1901
  }
1686
1902
  }
1687
1903
  get size() {
1688
1904
  return this._size;
1689
1905
  }
1906
+ /**
1907
+ * Sets the HTML attributes of the splitter bar.
1908
+ * The property accepts string key-value based pairs.
1909
+ * Attributes which are essential for certain functionalities cannot be changed.
1910
+ */
1911
+ set splitterBarAttributes(attributes) {
1912
+ this._splitterBarAttributes = attributes;
1913
+ const splitterBar = this.splitterService.getPaneSplitterBar(this);
1914
+ if (splitterBar) {
1915
+ splitterBar.htmlAttributes = attributes;
1916
+ }
1917
+ }
1918
+ get splitterBarAttributes() {
1919
+ return this._splitterBarAttributes;
1920
+ }
1690
1921
  /**
1691
1922
  * @hidden
1692
1923
  */
1693
1924
  set containsSplitter(value) {
1694
- const element = this.element.nativeElement;
1695
1925
  if (value) {
1696
- this.renderer.addClass(element, 'k-pane-flex');
1926
+ this.renderer.addClass(this.nativeElement, 'k-pane-flex');
1697
1927
  }
1698
1928
  else {
1699
- this.renderer.removeClass(element, 'k-pane-flex');
1929
+ this.renderer.removeClass(this.nativeElement, 'k-pane-flex');
1700
1930
  }
1701
1931
  }
1702
1932
  get isHidden() {
@@ -1715,14 +1945,13 @@ class SplitterPaneComponent {
1715
1945
  return this.size && this.size.length > 0;
1716
1946
  }
1717
1947
  ngAfterViewChecked() {
1718
- const element = this.element.nativeElement;
1719
1948
  if (this.isHidden) {
1720
- this.renderer.addClass(element, 'k-hidden');
1721
- this.renderer.addClass(element, 'hidden');
1949
+ this.renderer.addClass(this.nativeElement, 'k-hidden');
1950
+ this.renderer.addClass(this.nativeElement, 'hidden');
1722
1951
  }
1723
1952
  else {
1724
- this.renderer.removeClass(element, 'k-hidden');
1725
- this.renderer.removeClass(element, 'hidden');
1953
+ this.renderer.removeClass(this.nativeElement, 'k-hidden');
1954
+ this.renderer.removeClass(this.nativeElement, 'hidden');
1726
1955
  }
1727
1956
  }
1728
1957
  /**
@@ -1730,12 +1959,18 @@ class SplitterPaneComponent {
1730
1959
  */
1731
1960
  get computedSize() {
1732
1961
  if (this.orientation === 'vertical') {
1733
- return this.element.nativeElement.offsetHeight;
1962
+ return this.nativeElement.offsetHeight;
1734
1963
  }
1735
1964
  else {
1736
- return this.element.nativeElement.offsetWidth;
1965
+ return this.nativeElement.offsetWidth;
1737
1966
  }
1738
1967
  }
1968
+ /**
1969
+ * @hidden
1970
+ */
1971
+ get nativeElement() {
1972
+ return this.element.nativeElement;
1973
+ }
1739
1974
  /**
1740
1975
  * @hidden
1741
1976
  */
@@ -1750,13 +1985,12 @@ class SplitterPaneComponent {
1750
1985
  this.cdr.detectChanges();
1751
1986
  }
1752
1987
  setOrderStyles() {
1753
- const element = this.element.nativeElement;
1754
- this.renderer.setStyle(element, '-ms-flex-order', this.order);
1755
- this.renderer.setStyle(element, 'order', this.order);
1988
+ this.renderer.setStyle(this.nativeElement, '-ms-flex-order', this.order);
1989
+ this.renderer.setStyle(this.nativeElement, 'order', this.order);
1756
1990
  }
1757
1991
  }
1758
- SplitterPaneComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterPaneComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1759
- SplitterPaneComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SplitterPaneComponent, isStandalone: true, selector: "kendo-splitter-pane", inputs: { order: "order", size: "size", separatorLabel: "separatorLabel", min: "min", max: "max", resizable: "resizable", collapsible: "collapsible", scrollable: "scrollable", collapsed: "collapsed", orientation: "orientation", containsSplitter: "containsSplitter", overlayContent: "overlayContent" }, outputs: { sizeChange: "sizeChange", collapsedChange: "collapsedChange" }, host: { properties: { "attr.role": "this.ariaRole", "class.k-pane": "this.hostClass", "class.k-pane-static": "this.staticPaneClass", "class.k-scrollable": "this.scrollablePaneClass" } }, exportAs: ["kendoSplitterPane"], ngImport: i0, template: `
1992
+ SplitterPaneComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterPaneComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: SplitterService }], target: i0.ɵɵFactoryTarget.Component });
1993
+ SplitterPaneComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SplitterPaneComponent, isStandalone: true, selector: "kendo-splitter-pane", inputs: { order: "order", size: "size", splitterBarAttributes: "splitterBarAttributes", splitterBarClass: "splitterBarClass", min: "min", max: "max", resizable: "resizable", collapsible: "collapsible", scrollable: "scrollable", collapsed: "collapsed", orientation: "orientation", containsSplitter: "containsSplitter", overlayContent: "overlayContent" }, outputs: { sizeChange: "sizeChange", collapsedChange: "collapsedChange" }, host: { properties: { "attr.role": "this.ariaRole", "class.k-pane": "this.hostClass", "class.k-pane-static": "this.staticPaneClass", "class.k-scrollable": "this.scrollablePaneClass" } }, exportAs: ["kendoSplitterPane"], ngImport: i0, template: `
1760
1994
  <ng-container *ngIf="!collapsed"><ng-content></ng-content></ng-container>
1761
1995
  <div *ngIf="overlayContent" class="k-splitter-overlay k-overlay"></div>
1762
1996
  `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
@@ -1772,11 +2006,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1772
2006
  standalone: true,
1773
2007
  imports: [NgIf]
1774
2008
  }]
1775
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { order: [{
2009
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: SplitterService }]; }, propDecorators: { order: [{
1776
2010
  type: Input
1777
2011
  }], size: [{
1778
2012
  type: Input
1779
- }], separatorLabel: [{
2013
+ }], splitterBarAttributes: [{
2014
+ type: Input
2015
+ }], splitterBarClass: [{
1780
2016
  type: Input
1781
2017
  }], min: [{
1782
2018
  type: Input
@@ -1814,193 +2050,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1814
2050
  args: ['class.k-scrollable']
1815
2051
  }] } });
1816
2052
 
1817
- /**
1818
- * @hidden
1819
- */
1820
- const shouldTogglePrev = (keyCode, prev, next) => {
1821
- const leftArrow = keyCode === Keys.ArrowLeft;
1822
- const upArrow = keyCode === Keys.ArrowUp;
1823
- const collapsePrev = !prev.collapsed && !next.collapsed && (leftArrow || upArrow);
1824
- const expandPrev = prev.collapsed && !(leftArrow || upArrow);
1825
- return collapsePrev || expandPrev;
1826
- };
1827
- /**
1828
- * @hidden
1829
- */
1830
- const shouldToggleNext = (keyCode, prev, next) => {
1831
- const leftArrow = keyCode === Keys.ArrowLeft;
1832
- const upArrow = keyCode === Keys.ArrowUp;
1833
- const collapseNext = !next.collapsed && !prev.collapsed && !(leftArrow || upArrow);
1834
- const expandNext = next.collapsed && (leftArrow || upArrow);
1835
- return collapseNext || expandNext;
1836
- };
1837
- /**
1838
- * @hidden
1839
- */
1840
- const shouldToggleOrResize = (keyCode, orientation) => {
1841
- const isHorizontal = orientation === 'horizontal';
1842
- const isHorizontalChange = isHorizontal && (keyCode === Keys.ArrowLeft || keyCode === Keys.ArrowRight);
1843
- const isVerticalChange = !isHorizontal && (keyCode === Keys.ArrowUp || keyCode === Keys.ArrowDown);
1844
- return isHorizontalChange || isVerticalChange;
1845
- };
1846
-
1847
- const SIZING_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/layout/splitter/panes/#toc-size';
1848
- /**
1849
- * @hidden
1850
- */
1851
- class SplitterService {
1852
- constructor(zone) {
1853
- this.zone = zone;
1854
- this.layoutChange = new EventEmitter();
1855
- this.resizeStep = 10;
1856
- this.containerSize = () => { };
1857
- }
1858
- tryToggle(paneIndex) {
1859
- const pane = this.pane(paneIndex);
1860
- if (pane.collapsible) {
1861
- pane.collapsed = !pane.collapsed;
1862
- pane.collapsedChange.emit(pane.collapsed);
1863
- this.emit(this.layoutChange, {});
1864
- if (pane.collapsed) {
1865
- pane.detectChanges();
1866
- }
1867
- }
1868
- const notCollapsed = this.panes.filter(p => !p.collapsed);
1869
- const allHaveFixedSize = notCollapsed.every(p => p.fixedSize);
1870
- notCollapsed.filter(p => p.fixedSize).forEach(pane => {
1871
- pane.forceExpand = allHaveFixedSize ? true : false;
1872
- });
1873
- return pane.collapsible;
1874
- }
1875
- togglePane(keyCode, index) {
1876
- const prev = this.pane(index);
1877
- const next = this.pane(index + 1);
1878
- if (shouldTogglePrev(keyCode, prev, next)) {
1879
- this.tryToggle(index);
1880
- }
1881
- else if (shouldToggleNext(keyCode, prev, next)) {
1882
- this.tryToggle(index + 1);
1883
- }
1884
- }
1885
- resizePane(keyCode, index) {
1886
- const state = this.dragState(index);
1887
- const direction = keyCode === Keys.ArrowLeft || keyCode === (this.rtl ? Keys.ArrowDown : Keys.ArrowUp);
1888
- let step = direction ? (-this.resizeStep) : this.resizeStep;
1889
- if (this.rtl) {
1890
- step = -step;
1891
- }
1892
- this.setSize(state, step);
1893
- }
1894
- toggleContentOverlay(index, show) {
1895
- this.pane(index).toggleOverlay(show);
1896
- this.pane(index + 1).toggleOverlay(show);
1897
- }
1898
- dragState(splitbarIndex) {
1899
- const prev = this.pane(splitbarIndex);
1900
- const next = this.pane(splitbarIndex + 1);
1901
- const total = prev.computedSize + next.computedSize;
1902
- const px = s => this.toPixels(s);
1903
- return {
1904
- prev: {
1905
- index: splitbarIndex,
1906
- initialSize: prev.computedSize,
1907
- min: px(prev.min) || total - px(next.max) || 0,
1908
- max: px(prev.max) || total - px(next.min) || total
1909
- },
1910
- next: {
1911
- index: splitbarIndex + 1,
1912
- initialSize: next.computedSize,
1913
- min: px(next.min) || total - px(prev.max) || 0,
1914
- max: px(next.max) || total - px(prev.min) || total
1915
- }
1916
- };
1917
- }
1918
- setSize(state, delta) {
1919
- const clamp = (min, max, v) => Math.min(max, Math.max(min, v));
1920
- const resize = (paneState, change) => {
1921
- const pane = this.pane(paneState.index);
1922
- const splitterSize = this.containerSize();
1923
- const newSize = clamp(paneState.min, paneState.max, paneState.initialSize + change);
1924
- let size = "";
1925
- if (this.isPercent(pane.size)) {
1926
- size = (100 * newSize / splitterSize) + "%";
1927
- }
1928
- else {
1929
- size = newSize + "px";
1930
- }
1931
- pane.size = size;
1932
- pane.isResized = true;
1933
- this.emit(pane.sizeChange, size);
1934
- };
1935
- // resizing both panes
1936
- resize(state.prev, delta);
1937
- resize(state.next, -delta);
1938
- this.emit(this.layoutChange, {});
1939
- }
1940
- isDraggable(splitBarIndex) {
1941
- const prev = this.pane(splitBarIndex);
1942
- const next = this.pane(splitBarIndex + 1);
1943
- const betweenResizablePanes = prev.resizable && next.resizable;
1944
- const nearCollapsedPane = prev.collapsed || next.collapsed;
1945
- return betweenResizablePanes && !nearCollapsedPane;
1946
- }
1947
- isStatic(splitBarIndex) {
1948
- const prev = this.pane(splitBarIndex);
1949
- const next = this.pane(splitBarIndex + 1);
1950
- const betweenResizablePanes = prev.resizable && next.resizable;
1951
- const nearCollapsiblePane = prev.collapsible || next.collapsible;
1952
- return !betweenResizablePanes && !nearCollapsiblePane;
1953
- }
1954
- pane(index) {
1955
- if (!this.panes) {
1956
- throw new Error("Panes not initialized");
1957
- }
1958
- if (index < 0 || index >= this.panes.length) {
1959
- throw new Error("Index out of range");
1960
- }
1961
- return this.panes[index];
1962
- }
1963
- configure({ panes, orientation, containerSize, direction }) {
1964
- this.panes = panes;
1965
- this.panes.forEach((pane, index) => {
1966
- pane.order = index * 2;
1967
- pane.orientation = orientation;
1968
- });
1969
- if (isDevMode()) {
1970
- const allPanesWithSize = panes.length && !panes.some(pane => !pane.fixedSize);
1971
- const hasResizedPane = panes.length && panes.some(pane => pane.isResized);
1972
- if (allPanesWithSize && !hasResizedPane) {
1973
- throw new Error(`
1974
- The Splitter should have at least one pane without a set size.
1975
- See ${SIZING_DOC_LINK} for more information.
1976
- `);
1977
- }
1978
- }
1979
- this.containerSize = containerSize;
1980
- this.rtl = direction === 'rtl';
1981
- }
1982
- isPercent(size) {
1983
- return /%$/.test(size);
1984
- }
1985
- toPixels(size) {
1986
- let result = parseFloat(size);
1987
- if (this.isPercent(size)) {
1988
- result = (this.containerSize() * result / 100);
1989
- }
1990
- return result;
1991
- }
1992
- emit(emitter, args) {
1993
- if (emitter.observers.length) {
1994
- this.zone.run(() => emitter.emit(args));
1995
- }
1996
- }
1997
- }
1998
- SplitterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
1999
- SplitterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService });
2000
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, decorators: [{
2001
- type: Injectable
2002
- }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
2003
-
2004
2053
  /* eslint-disable @typescript-eslint/no-explicit-any */
2005
2054
  const stopPropagation = ({ originalEvent: event }) => {
2006
2055
  event.stopPropagation();
@@ -2027,10 +2076,12 @@ class SplitterBarComponent {
2027
2076
  this.renderer = renderer;
2028
2077
  this.cdr = cdr;
2029
2078
  this.ariaRole = 'separator';
2079
+ this.ariaLabel = 'Splitter pane';
2030
2080
  this.focused = false;
2031
2081
  this.orientation = 'horizontal';
2032
2082
  this.index = 0;
2033
2083
  this.subscriptions = new Subscription();
2084
+ this.parsedAttributes = {};
2034
2085
  }
2035
2086
  get hostOrientation() {
2036
2087
  return this.orientation === 'horizontal' ? 'vertical' : 'horizontal';
@@ -2057,6 +2108,28 @@ class SplitterBarComponent {
2057
2108
  get order() {
2058
2109
  return 2 * this.index + 1;
2059
2110
  }
2111
+ set htmlAttributes(attributes) {
2112
+ if (isObjectPresent(this.parsedAttributes)) {
2113
+ removeHTMLAttributes(this.parsedAttributes, this.renderer, this.element.nativeElement);
2114
+ }
2115
+ this._htmlAttributes = attributes;
2116
+ this.parsedAttributes = this.htmlAttributes ?
2117
+ parseAttributes(this.htmlAttributes, this.defaultAttributes) :
2118
+ this.htmlAttributes;
2119
+ this.setHtmlAttributes();
2120
+ }
2121
+ get htmlAttributes() {
2122
+ return this._htmlAttributes;
2123
+ }
2124
+ get defaultAttributes() {
2125
+ return {
2126
+ 'aria-orientation': this.hostOrientation,
2127
+ role: this.ariaRole
2128
+ };
2129
+ }
2130
+ get mutableAttributes() {
2131
+ return { 'tabindex': this.tabIndex };
2132
+ }
2060
2133
  ngOnInit() {
2061
2134
  let state;
2062
2135
  const listener = this.draggable.kendoPress.pipe(tap(stopPropagation), filter(() => this.splitterService.isDraggable(this.index)), tap(() => state = this.splitterService.dragState(this.index)), tap(() => this.splitterService.toggleContentOverlay(this.index, true)), switchMap(preventOnDblClick(this.draggable.kendoRelease)), switchMap(createMoveStream(this.draggable))).subscribe(({ pageX, pageY, originalX, originalY }) => {
@@ -2203,9 +2276,13 @@ class SplitterBarComponent {
2203
2276
  this.splitterService.tryToggle(next);
2204
2277
  }
2205
2278
  }
2279
+ setHtmlAttributes() {
2280
+ const attributesToRender = Object.assign(Object.assign({}, this.mutableAttributes), this.parsedAttributes);
2281
+ setHTMLAttributes(attributesToRender, this.renderer, this.element.nativeElement);
2282
+ }
2206
2283
  }
2207
2284
  SplitterBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterBarComponent, deps: [{ token: i1$1.DraggableDirective, host: true }, { token: i1.LocalizationService }, { token: SplitterService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2208
- SplitterBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SplitterBarComponent, isStandalone: true, selector: "kendo-splitter-bar", inputs: { orientation: "orientation", index: "index" }, host: { properties: { "attr.role": "this.ariaRole", "class.k-focus": "this.focused", "attr.aria-orientation": "this.hostOrientation", "attr.tabindex": "this.tabIndex", "class": "this.hostClasses", "style.-ms-flex-order": "this.order", "style.order": "this.order" } }, ngImport: i0, template: `
2285
+ SplitterBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SplitterBarComponent, isStandalone: true, selector: "kendo-splitter-bar", inputs: { orientation: "orientation", index: "index", htmlAttributes: "htmlAttributes" }, host: { properties: { "attr.role": "this.ariaRole", "attr.aria-label": "this.ariaLabel", "class.k-focus": "this.focused", "attr.aria-orientation": "this.hostOrientation", "attr.tabindex": "this.tabIndex", "class": "this.hostClasses", "style.-ms-flex-order": "this.order", "style.order": "this.order" } }, ngImport: i0, template: `
2209
2286
  <div *ngIf="shouldShowIcon('prev')" class="k-collapse-prev" (click)="togglePrevious()">
2210
2287
  <kendo-icon-wrapper
2211
2288
  size="xsmall"
@@ -2253,6 +2330,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2253
2330
  }, propDecorators: { ariaRole: [{
2254
2331
  type: HostBinding,
2255
2332
  args: ['attr.role']
2333
+ }], ariaLabel: [{
2334
+ type: HostBinding,
2335
+ args: ['attr.aria-label']
2256
2336
  }], focused: [{
2257
2337
  type: HostBinding,
2258
2338
  args: ['class.k-focus']
@@ -2275,8 +2355,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2275
2355
  type: Input
2276
2356
  }], index: [{
2277
2357
  type: Input
2358
+ }], htmlAttributes: [{
2359
+ type: Input
2278
2360
  }] } });
2279
2361
 
2362
+ const SIZING_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/layout/splitter/panes/#toc-size';
2280
2363
  /**
2281
2364
  * Represents the [Kendo UI Splitter component for Angular]({% slug overview_splitter %}).
2282
2365
  *
@@ -2313,11 +2396,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2313
2396
  * ```
2314
2397
  */
2315
2398
  class SplitterComponent {
2316
- constructor(element, splitterService, localization, renderer, enclosingPane) {
2399
+ constructor(element, splitterService, localization, renderer, ngZone, enclosingPane) {
2317
2400
  this.element = element;
2318
2401
  this.splitterService = splitterService;
2319
2402
  this.localization = localization;
2320
2403
  this.renderer = renderer;
2404
+ this.ngZone = ngZone;
2321
2405
  this.enclosingPane = enclosingPane;
2322
2406
  /**
2323
2407
  * Specifies the orientation of the panes within the Splitter.
@@ -2357,6 +2441,7 @@ class SplitterComponent {
2357
2441
  return this.direction;
2358
2442
  }
2359
2443
  set splitbars(splitbars) {
2444
+ this.splitterService.splitterBars = splitbars ? splitbars.toArray() : [];
2360
2445
  if (!isPresent(splitbars) || !isPresent(this.panes)) {
2361
2446
  return;
2362
2447
  }
@@ -2369,15 +2454,29 @@ class SplitterComponent {
2369
2454
  .sort((a, b) => a.order - b.order);
2370
2455
  const elements = components.map(component => component.element.nativeElement);
2371
2456
  panesArray.forEach((pane, i) => {
2372
- if (splitBarsArray[i] && pane.separatorLabel) {
2373
- const splitbar = splitBarsArray[i].element.nativeElement;
2374
- this.renderer.setAttribute(splitbar, 'aria-label', pane.separatorLabel);
2457
+ const splitbar = splitBarsArray[i];
2458
+ if (splitbar && pane.splitterBarAttributes) {
2459
+ splitbar.htmlAttributes = pane.splitterBarAttributes;
2375
2460
  }
2376
2461
  });
2377
2462
  elements.forEach(element => this.renderer.appendChild(this.element.nativeElement, element));
2378
2463
  }
2379
2464
  ngAfterContentInit() {
2380
2465
  this.reconfigure();
2466
+ this.setFixedHeight();
2467
+ const allHaveFixedSize = this.panes.length && Array.from(this.panes).every(p => p.fixedSize);
2468
+ if (allHaveFixedSize && isDevMode()) {
2469
+ throw new Error(`
2470
+ The Splitter should have at least one pane without a set size.
2471
+ See ${SIZING_DOC_LINK} for more information.
2472
+ `);
2473
+ }
2474
+ this._styleObserver = new MutationObserver(() => {
2475
+ this.ngZone.runOutsideAngular(() => {
2476
+ this.setFixedHeight();
2477
+ });
2478
+ });
2479
+ this._styleObserver.observe(this.element.nativeElement, { attributeFilter: ['style'] });
2381
2480
  }
2382
2481
  ngOnChanges(changes) {
2383
2482
  if (changes.orientation && !changes.orientation.isFirstChange()) {
@@ -2388,6 +2487,10 @@ class SplitterComponent {
2388
2487
  if (this.enclosingPane) {
2389
2488
  this.enclosingPane.containsSplitter = false;
2390
2489
  }
2490
+ if (this._styleObserver) {
2491
+ this._styleObserver.disconnect();
2492
+ this._styleObserver = null;
2493
+ }
2391
2494
  this.unsubscribeChanges();
2392
2495
  }
2393
2496
  reconfigure() {
@@ -2419,9 +2522,12 @@ class SplitterComponent {
2419
2522
  get direction() {
2420
2523
  return this.localization.rtl ? 'rtl' : 'ltr';
2421
2524
  }
2525
+ setFixedHeight() {
2526
+ this.splitterService.fixedHeight = getComputedStyle(this.element.nativeElement).getPropertyValue('height') !== 'auto';
2527
+ }
2422
2528
  }
2423
- SplitterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterComponent, deps: [{ token: i0.ElementRef }, { token: SplitterService }, { token: i1.LocalizationService }, { token: i0.Renderer2 }, { token: SplitterPaneComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2424
- SplitterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SplitterComponent, isStandalone: true, selector: "kendo-splitter", inputs: { orientation: "orientation", splitbarWidth: "splitbarWidth", resizeStep: "resizeStep" }, outputs: { layoutChange: "layoutChange" }, host: { properties: { "class.k-splitter": "this.hostClasses", "class.k-splitter-flex": "this.hostClasses", "class.k-splitter-horizontal": "this.horizontalHostClasses", "class.k-splitter-vertical": "this.verticalHostClasses", "attr.dir": "this.dir" } }, providers: [
2529
+ SplitterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterComponent, deps: [{ token: i0.ElementRef }, { token: SplitterService }, { token: i1.LocalizationService }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: SplitterPaneComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2530
+ SplitterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SplitterComponent, isStandalone: true, selector: "kendo-splitter", inputs: { orientation: "orientation", splitbarWidth: "splitbarWidth", resizeStep: "resizeStep", splitterBarClass: "splitterBarClass" }, outputs: { layoutChange: "layoutChange" }, host: { properties: { "class.k-splitter": "this.hostClasses", "class.k-splitter-flex": "this.hostClasses", "class.k-splitter-horizontal": "this.horizontalHostClasses", "class.k-splitter-vertical": "this.verticalHostClasses", "attr.dir": "this.dir" } }, providers: [
2425
2531
  SplitterService,
2426
2532
  LocalizationService,
2427
2533
  {
@@ -2440,13 +2546,14 @@ SplitterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
2440
2546
  *ngIf="!last"
2441
2547
  [index]="index"
2442
2548
  [orientation]="orientation"
2549
+ [ngClass]="pane.splitterBarClass || splitterBarClass"
2443
2550
  [ngStyle]="{
2444
2551
  width: orientation === 'horizontal' ? splitbarWidth + 'px' : undefined,
2445
2552
  height: orientation === 'vertical' ? splitbarWidth + 'px' : undefined
2446
2553
  }">
2447
2554
  </kendo-splitter-bar>
2448
2555
  </ng-container>
2449
- `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SplitterBarComponent, selector: "kendo-splitter-bar", inputs: ["orientation", "index"] }, { kind: "directive", type: DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
2556
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SplitterBarComponent, selector: "kendo-splitter-bar", inputs: ["orientation", "index", "htmlAttributes"] }, { kind: "directive", type: DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
2450
2557
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterComponent, decorators: [{
2451
2558
  type: Component,
2452
2559
  args: [{
@@ -2472,6 +2579,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2472
2579
  *ngIf="!last"
2473
2580
  [index]="index"
2474
2581
  [orientation]="orientation"
2582
+ [ngClass]="pane.splitterBarClass || splitterBarClass"
2475
2583
  [ngStyle]="{
2476
2584
  width: orientation === 'horizontal' ? splitbarWidth + 'px' : undefined,
2477
2585
  height: orientation === 'vertical' ? splitbarWidth + 'px' : undefined
@@ -2480,10 +2588,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2480
2588
  </ng-container>
2481
2589
  `,
2482
2590
  standalone: true,
2483
- imports: [NgFor, NgIf, SplitterBarComponent, DraggableDirective, NgStyle]
2591
+ imports: [NgFor, NgIf, SplitterBarComponent, DraggableDirective, NgStyle, NgClass]
2484
2592
  }]
2485
2593
  }], ctorParameters: function () {
2486
- return [{ type: i0.ElementRef }, { type: SplitterService }, { type: i1.LocalizationService }, { type: i0.Renderer2 }, { type: SplitterPaneComponent, decorators: [{
2594
+ return [{ type: i0.ElementRef }, { type: SplitterService }, { type: i1.LocalizationService }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: SplitterPaneComponent, decorators: [{
2487
2595
  type: Optional
2488
2596
  }, {
2489
2597
  type: Host
@@ -2497,6 +2605,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2497
2605
  type: Input
2498
2606
  }], resizeStep: [{
2499
2607
  type: Input
2608
+ }], splitterBarClass: [{
2609
+ type: Input
2500
2610
  }], layoutChange: [{
2501
2611
  type: Output
2502
2612
  }], hostClasses: [{