@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 { Injectable, Directive, Optional, 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
 
@@ -1592,18 +1592,235 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1592
1592
  args: ['keydown', ['$event']]
1593
1593
  }] } });
1594
1594
 
1595
+ /**
1596
+ * @hidden
1597
+ */
1598
+ const shouldTogglePrev = (keyCode, prev, next) => {
1599
+ const leftArrow = keyCode === Keys.ArrowLeft;
1600
+ const upArrow = keyCode === Keys.ArrowUp;
1601
+ const collapsePrev = !prev.collapsed && !next.collapsed && (leftArrow || upArrow);
1602
+ const expandPrev = prev.collapsed && !(leftArrow || upArrow);
1603
+ return collapsePrev || expandPrev;
1604
+ };
1605
+ /**
1606
+ * @hidden
1607
+ */
1608
+ const shouldToggleNext = (keyCode, prev, next) => {
1609
+ const leftArrow = keyCode === Keys.ArrowLeft;
1610
+ const upArrow = keyCode === Keys.ArrowUp;
1611
+ const collapseNext = !next.collapsed && !prev.collapsed && !(leftArrow || upArrow);
1612
+ const expandNext = next.collapsed && (leftArrow || upArrow);
1613
+ return collapseNext || expandNext;
1614
+ };
1615
+ /**
1616
+ * @hidden
1617
+ */
1618
+ const shouldToggleOrResize = (keyCode, orientation) => {
1619
+ const isHorizontal = orientation === 'horizontal';
1620
+ const isHorizontalChange = isHorizontal && (keyCode === Keys.ArrowLeft || keyCode === Keys.ArrowRight);
1621
+ const isVerticalChange = !isHorizontal && (keyCode === Keys.ArrowUp || keyCode === Keys.ArrowDown);
1622
+ return isHorizontalChange || isVerticalChange;
1623
+ };
1624
+
1625
+ const MAX_PANE_HEIGHT = 33554400;
1626
+ /**
1627
+ * @hidden
1628
+ */
1629
+ class SplitterService {
1630
+ constructor(zone) {
1631
+ this.zone = zone;
1632
+ this.layoutChange = new EventEmitter();
1633
+ this.resizeStep = 10;
1634
+ this.containerSize = () => { };
1635
+ }
1636
+ tryToggle(paneIndex) {
1637
+ const pane = this.pane(paneIndex);
1638
+ if (pane.collapsible) {
1639
+ pane.collapsed = !pane.collapsed;
1640
+ pane.collapsedChange.emit(pane.collapsed);
1641
+ this.emit(this.layoutChange, {});
1642
+ if (pane.collapsed) {
1643
+ pane.detectChanges();
1644
+ }
1645
+ }
1646
+ const notCollapsed = this.panes.filter(p => !p.collapsed);
1647
+ const allHaveFixedSize = notCollapsed.every(p => p.fixedSize);
1648
+ notCollapsed.filter(p => p.fixedSize).forEach(pane => {
1649
+ pane.forceExpand = allHaveFixedSize ? true : false;
1650
+ });
1651
+ return pane.collapsible;
1652
+ }
1653
+ togglePane(keyCode, index) {
1654
+ const prev = this.pane(index);
1655
+ const next = this.pane(index + 1);
1656
+ if (shouldTogglePrev(keyCode, prev, next)) {
1657
+ this.tryToggle(index);
1658
+ }
1659
+ else if (shouldToggleNext(keyCode, prev, next)) {
1660
+ this.tryToggle(index + 1);
1661
+ }
1662
+ }
1663
+ resizePane(keyCode, index) {
1664
+ const state = this.dragState(index);
1665
+ const direction = keyCode === Keys.ArrowLeft || keyCode === (this.rtl ? Keys.ArrowDown : Keys.ArrowUp);
1666
+ let step = direction ? (-this.resizeStep) : this.resizeStep;
1667
+ if (this.rtl) {
1668
+ step = -step;
1669
+ }
1670
+ this.setSize(state, step);
1671
+ }
1672
+ toggleContentOverlay(index, show) {
1673
+ this.pane(index).toggleOverlay(show);
1674
+ this.pane(index + 1).toggleOverlay(show);
1675
+ }
1676
+ dragState(splitbarIndex) {
1677
+ const prev = this.pane(splitbarIndex);
1678
+ const next = this.pane(splitbarIndex + 1);
1679
+ const total = prev.computedSize + next.computedSize;
1680
+ const px = s => this.toPixels(s);
1681
+ return {
1682
+ prev: {
1683
+ index: splitbarIndex,
1684
+ initialSize: prev.computedSize,
1685
+ min: px(prev.min) || total - px(next.max) || 0,
1686
+ max: px(prev.max) || total - px(next.min) || total
1687
+ },
1688
+ next: {
1689
+ index: splitbarIndex + 1,
1690
+ initialSize: next.computedSize,
1691
+ min: px(next.min) || total - px(prev.max) || 0,
1692
+ max: px(next.max) || total - px(prev.min) || total
1693
+ }
1694
+ };
1695
+ }
1696
+ setSize(state, delta) {
1697
+ const clamp = (min, max, v) => Math.min(max, Math.max(min, v));
1698
+ const resize = (paneState, change, modifyMax = false) => {
1699
+ const pane = this.pane(paneState.index);
1700
+ const splitterSize = this.containerSize();
1701
+ const newSize = clamp(paneState.min, modifyMax ? MAX_PANE_HEIGHT : paneState.max, paneState.initialSize + change);
1702
+ let size = "";
1703
+ if (this.isPercent(pane.size)) {
1704
+ size = (100 * newSize / splitterSize) + "%";
1705
+ }
1706
+ else {
1707
+ size = newSize + "px";
1708
+ }
1709
+ pane.size = size;
1710
+ pane.isResized = true;
1711
+ this.emit(pane.sizeChange, size);
1712
+ };
1713
+ const prevPane = this.pane(state.prev.index);
1714
+ const nextPane = this.pane(state.next.index);
1715
+ const canResizeBothPanes = this.panes.length > 2;
1716
+ const modifyPrevMax = prevPane.orientation === 'vertical' && !this.fixedHeight && !prevPane.max;
1717
+ const modifyNextMax = prevPane.orientation === 'vertical' && !this.fixedHeight && !nextPane.max;
1718
+ if (prevPane.fixedSize && nextPane.fixedSize || canResizeBothPanes) {
1719
+ const bothVertical = prevPane.orientation === 'vertical' && nextPane.orientation === 'vertical';
1720
+ if (bothVertical) {
1721
+ if (modifyNextMax) {
1722
+ resize(state.prev, delta, modifyPrevMax);
1723
+ }
1724
+ else if (modifyPrevMax) {
1725
+ resize(state.next, -delta, modifyNextMax);
1726
+ }
1727
+ else {
1728
+ resize(state.prev, delta, modifyNextMax);
1729
+ resize(state.next, -delta, modifyPrevMax);
1730
+ }
1731
+ }
1732
+ else {
1733
+ resize(state.prev, delta);
1734
+ resize(state.next, -delta);
1735
+ }
1736
+ }
1737
+ else if (nextPane.fixedSize || nextPane.collapsible) {
1738
+ resize(state.next, -delta, modifyNextMax);
1739
+ }
1740
+ else {
1741
+ resize(state.prev, delta, modifyPrevMax);
1742
+ }
1743
+ this.emit(this.layoutChange, {});
1744
+ }
1745
+ isDraggable(splitBarIndex) {
1746
+ const prev = this.pane(splitBarIndex);
1747
+ const next = this.pane(splitBarIndex + 1);
1748
+ const betweenResizablePanes = prev.resizable && next.resizable;
1749
+ const nearCollapsedPane = prev.collapsed || next.collapsed;
1750
+ return betweenResizablePanes && !nearCollapsedPane;
1751
+ }
1752
+ isStatic(splitBarIndex) {
1753
+ const prev = this.pane(splitBarIndex);
1754
+ const next = this.pane(splitBarIndex + 1);
1755
+ const betweenResizablePanes = prev.resizable && next.resizable;
1756
+ const nearCollapsiblePane = prev.collapsible || next.collapsible;
1757
+ return !betweenResizablePanes && !nearCollapsiblePane;
1758
+ }
1759
+ pane(index) {
1760
+ if (!this.panes) {
1761
+ throw new Error("Panes not initialized");
1762
+ }
1763
+ if (index < 0 || index >= this.panes.length) {
1764
+ throw new Error("Index out of range");
1765
+ }
1766
+ return this.panes[index];
1767
+ }
1768
+ paneByIndex(pane) {
1769
+ if (!this.panes) {
1770
+ return -1;
1771
+ }
1772
+ return this.panes.findIndex(splitterPane => splitterPane === pane);
1773
+ }
1774
+ getPaneSplitterBar(pane) {
1775
+ if (!this.splitterBars) {
1776
+ return;
1777
+ }
1778
+ const paneIndex = this.paneByIndex(pane);
1779
+ if (paneIndex < 0 || paneIndex >= this.splitterBars.length) {
1780
+ return null;
1781
+ }
1782
+ return this.splitterBars[paneIndex];
1783
+ }
1784
+ configure({ panes, orientation, containerSize, direction }) {
1785
+ this.panes = panes;
1786
+ this.panes.forEach((pane, index) => {
1787
+ pane.order = index * 2;
1788
+ pane.orientation = orientation;
1789
+ });
1790
+ this.containerSize = containerSize;
1791
+ this.rtl = direction === 'rtl';
1792
+ }
1793
+ isPercent(size) {
1794
+ return /%$/.test(size);
1795
+ }
1796
+ toPixels(size) {
1797
+ let result = parseFloat(size);
1798
+ if (this.isPercent(size)) {
1799
+ result = (this.containerSize() * result / 100);
1800
+ }
1801
+ return result;
1802
+ }
1803
+ emit(emitter, args) {
1804
+ if (emitter.observers.length) {
1805
+ this.zone.run(() => emitter.emit(args));
1806
+ }
1807
+ }
1808
+ }
1809
+ SplitterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
1810
+ SplitterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService });
1811
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, decorators: [{
1812
+ type: Injectable
1813
+ }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
1814
+
1595
1815
  /**
1596
1816
  * Represents the pane component of the Splitter.
1597
1817
  */
1598
1818
  class SplitterPaneComponent {
1599
- constructor(element, renderer, cdr) {
1819
+ constructor(element, renderer, cdr, splitterService) {
1600
1820
  this.element = element;
1601
1821
  this.renderer = renderer;
1602
1822
  this.cdr = cdr;
1603
- /**
1604
- * The value of the aria-label attribute of the auxiliary separator.
1605
- */
1606
- this.separatorLabel = 'Splitter pane';
1823
+ this.splitterService = splitterService;
1607
1824
  /**
1608
1825
  * Specifies if the user is allowed to resize the pane and provide space for other panes.
1609
1826
  */
@@ -1668,29 +1885,42 @@ class SplitterPaneComponent {
1668
1885
  */
1669
1886
  set size(newSize) {
1670
1887
  this._size = newSize;
1671
- const element = this.element.nativeElement;
1672
- this.renderer.setStyle(element, '-ms-flex-preferred-size', newSize);
1673
- this.renderer.setStyle(element, 'flex-basis', newSize);
1888
+ this.renderer.setStyle(this.nativeElement, '-ms-flex-preferred-size', newSize);
1889
+ this.renderer.setStyle(this.nativeElement, 'flex-basis', newSize);
1674
1890
  if (this.staticPaneClass) {
1675
- this.renderer.addClass(element, 'k-pane-static');
1891
+ this.renderer.addClass(this.nativeElement, 'k-pane-static');
1676
1892
  }
1677
1893
  else {
1678
- this.renderer.removeClass(element, 'k-pane-static');
1894
+ this.renderer.removeClass(this.nativeElement, 'k-pane-static');
1679
1895
  }
1680
1896
  }
1681
1897
  get size() {
1682
1898
  return this._size;
1683
1899
  }
1900
+ /**
1901
+ * Sets the HTML attributes of the splitter bar.
1902
+ * The property accepts string key-value based pairs.
1903
+ * Attributes which are essential for certain functionalities cannot be changed.
1904
+ */
1905
+ set splitterBarAttributes(attributes) {
1906
+ this._splitterBarAttributes = attributes;
1907
+ const splitterBar = this.splitterService.getPaneSplitterBar(this);
1908
+ if (splitterBar) {
1909
+ splitterBar.htmlAttributes = attributes;
1910
+ }
1911
+ }
1912
+ get splitterBarAttributes() {
1913
+ return this._splitterBarAttributes;
1914
+ }
1684
1915
  /**
1685
1916
  * @hidden
1686
1917
  */
1687
1918
  set containsSplitter(value) {
1688
- const element = this.element.nativeElement;
1689
1919
  if (value) {
1690
- this.renderer.addClass(element, 'k-pane-flex');
1920
+ this.renderer.addClass(this.nativeElement, 'k-pane-flex');
1691
1921
  }
1692
1922
  else {
1693
- this.renderer.removeClass(element, 'k-pane-flex');
1923
+ this.renderer.removeClass(this.nativeElement, 'k-pane-flex');
1694
1924
  }
1695
1925
  }
1696
1926
  get isHidden() {
@@ -1709,14 +1939,13 @@ class SplitterPaneComponent {
1709
1939
  return this.size && this.size.length > 0;
1710
1940
  }
1711
1941
  ngAfterViewChecked() {
1712
- const element = this.element.nativeElement;
1713
1942
  if (this.isHidden) {
1714
- this.renderer.addClass(element, 'k-hidden');
1715
- this.renderer.addClass(element, 'hidden');
1943
+ this.renderer.addClass(this.nativeElement, 'k-hidden');
1944
+ this.renderer.addClass(this.nativeElement, 'hidden');
1716
1945
  }
1717
1946
  else {
1718
- this.renderer.removeClass(element, 'k-hidden');
1719
- this.renderer.removeClass(element, 'hidden');
1947
+ this.renderer.removeClass(this.nativeElement, 'k-hidden');
1948
+ this.renderer.removeClass(this.nativeElement, 'hidden');
1720
1949
  }
1721
1950
  }
1722
1951
  /**
@@ -1724,12 +1953,18 @@ class SplitterPaneComponent {
1724
1953
  */
1725
1954
  get computedSize() {
1726
1955
  if (this.orientation === 'vertical') {
1727
- return this.element.nativeElement.offsetHeight;
1956
+ return this.nativeElement.offsetHeight;
1728
1957
  }
1729
1958
  else {
1730
- return this.element.nativeElement.offsetWidth;
1959
+ return this.nativeElement.offsetWidth;
1731
1960
  }
1732
1961
  }
1962
+ /**
1963
+ * @hidden
1964
+ */
1965
+ get nativeElement() {
1966
+ return this.element.nativeElement;
1967
+ }
1733
1968
  /**
1734
1969
  * @hidden
1735
1970
  */
@@ -1744,13 +1979,12 @@ class SplitterPaneComponent {
1744
1979
  this.cdr.detectChanges();
1745
1980
  }
1746
1981
  setOrderStyles() {
1747
- const element = this.element.nativeElement;
1748
- this.renderer.setStyle(element, '-ms-flex-order', this.order);
1749
- this.renderer.setStyle(element, 'order', this.order);
1982
+ this.renderer.setStyle(this.nativeElement, '-ms-flex-order', this.order);
1983
+ this.renderer.setStyle(this.nativeElement, 'order', this.order);
1750
1984
  }
1751
1985
  }
1752
- 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 });
1753
- 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: `
1986
+ 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 });
1987
+ 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: `
1754
1988
  <ng-container *ngIf="!collapsed"><ng-content></ng-content></ng-container>
1755
1989
  <div *ngIf="overlayContent" class="k-splitter-overlay k-overlay"></div>
1756
1990
  `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
@@ -1766,11 +2000,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1766
2000
  standalone: true,
1767
2001
  imports: [NgIf]
1768
2002
  }]
1769
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { order: [{
2003
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: SplitterService }]; }, propDecorators: { order: [{
1770
2004
  type: Input
1771
2005
  }], size: [{
1772
2006
  type: Input
1773
- }], separatorLabel: [{
2007
+ }], splitterBarAttributes: [{
2008
+ type: Input
2009
+ }], splitterBarClass: [{
1774
2010
  type: Input
1775
2011
  }], min: [{
1776
2012
  type: Input
@@ -1808,193 +2044,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1808
2044
  args: ['class.k-scrollable']
1809
2045
  }] } });
1810
2046
 
1811
- /**
1812
- * @hidden
1813
- */
1814
- const shouldTogglePrev = (keyCode, prev, next) => {
1815
- const leftArrow = keyCode === Keys.ArrowLeft;
1816
- const upArrow = keyCode === Keys.ArrowUp;
1817
- const collapsePrev = !prev.collapsed && !next.collapsed && (leftArrow || upArrow);
1818
- const expandPrev = prev.collapsed && !(leftArrow || upArrow);
1819
- return collapsePrev || expandPrev;
1820
- };
1821
- /**
1822
- * @hidden
1823
- */
1824
- const shouldToggleNext = (keyCode, prev, next) => {
1825
- const leftArrow = keyCode === Keys.ArrowLeft;
1826
- const upArrow = keyCode === Keys.ArrowUp;
1827
- const collapseNext = !next.collapsed && !prev.collapsed && !(leftArrow || upArrow);
1828
- const expandNext = next.collapsed && (leftArrow || upArrow);
1829
- return collapseNext || expandNext;
1830
- };
1831
- /**
1832
- * @hidden
1833
- */
1834
- const shouldToggleOrResize = (keyCode, orientation) => {
1835
- const isHorizontal = orientation === 'horizontal';
1836
- const isHorizontalChange = isHorizontal && (keyCode === Keys.ArrowLeft || keyCode === Keys.ArrowRight);
1837
- const isVerticalChange = !isHorizontal && (keyCode === Keys.ArrowUp || keyCode === Keys.ArrowDown);
1838
- return isHorizontalChange || isVerticalChange;
1839
- };
1840
-
1841
- const SIZING_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/layout/splitter/panes/#toc-size';
1842
- /**
1843
- * @hidden
1844
- */
1845
- class SplitterService {
1846
- constructor(zone) {
1847
- this.zone = zone;
1848
- this.layoutChange = new EventEmitter();
1849
- this.resizeStep = 10;
1850
- this.containerSize = () => { };
1851
- }
1852
- tryToggle(paneIndex) {
1853
- const pane = this.pane(paneIndex);
1854
- if (pane.collapsible) {
1855
- pane.collapsed = !pane.collapsed;
1856
- pane.collapsedChange.emit(pane.collapsed);
1857
- this.emit(this.layoutChange, {});
1858
- if (pane.collapsed) {
1859
- pane.detectChanges();
1860
- }
1861
- }
1862
- const notCollapsed = this.panes.filter(p => !p.collapsed);
1863
- const allHaveFixedSize = notCollapsed.every(p => p.fixedSize);
1864
- notCollapsed.filter(p => p.fixedSize).forEach(pane => {
1865
- pane.forceExpand = allHaveFixedSize ? true : false;
1866
- });
1867
- return pane.collapsible;
1868
- }
1869
- togglePane(keyCode, index) {
1870
- const prev = this.pane(index);
1871
- const next = this.pane(index + 1);
1872
- if (shouldTogglePrev(keyCode, prev, next)) {
1873
- this.tryToggle(index);
1874
- }
1875
- else if (shouldToggleNext(keyCode, prev, next)) {
1876
- this.tryToggle(index + 1);
1877
- }
1878
- }
1879
- resizePane(keyCode, index) {
1880
- const state = this.dragState(index);
1881
- const direction = keyCode === Keys.ArrowLeft || keyCode === (this.rtl ? Keys.ArrowDown : Keys.ArrowUp);
1882
- let step = direction ? (-this.resizeStep) : this.resizeStep;
1883
- if (this.rtl) {
1884
- step = -step;
1885
- }
1886
- this.setSize(state, step);
1887
- }
1888
- toggleContentOverlay(index, show) {
1889
- this.pane(index).toggleOverlay(show);
1890
- this.pane(index + 1).toggleOverlay(show);
1891
- }
1892
- dragState(splitbarIndex) {
1893
- const prev = this.pane(splitbarIndex);
1894
- const next = this.pane(splitbarIndex + 1);
1895
- const total = prev.computedSize + next.computedSize;
1896
- const px = s => this.toPixels(s);
1897
- return {
1898
- prev: {
1899
- index: splitbarIndex,
1900
- initialSize: prev.computedSize,
1901
- min: px(prev.min) || total - px(next.max) || 0,
1902
- max: px(prev.max) || total - px(next.min) || total
1903
- },
1904
- next: {
1905
- index: splitbarIndex + 1,
1906
- initialSize: next.computedSize,
1907
- min: px(next.min) || total - px(prev.max) || 0,
1908
- max: px(next.max) || total - px(prev.min) || total
1909
- }
1910
- };
1911
- }
1912
- setSize(state, delta) {
1913
- const clamp = (min, max, v) => Math.min(max, Math.max(min, v));
1914
- const resize = (paneState, change) => {
1915
- const pane = this.pane(paneState.index);
1916
- const splitterSize = this.containerSize();
1917
- const newSize = clamp(paneState.min, paneState.max, paneState.initialSize + change);
1918
- let size = "";
1919
- if (this.isPercent(pane.size)) {
1920
- size = (100 * newSize / splitterSize) + "%";
1921
- }
1922
- else {
1923
- size = newSize + "px";
1924
- }
1925
- pane.size = size;
1926
- pane.isResized = true;
1927
- this.emit(pane.sizeChange, size);
1928
- };
1929
- // resizing both panes
1930
- resize(state.prev, delta);
1931
- resize(state.next, -delta);
1932
- this.emit(this.layoutChange, {});
1933
- }
1934
- isDraggable(splitBarIndex) {
1935
- const prev = this.pane(splitBarIndex);
1936
- const next = this.pane(splitBarIndex + 1);
1937
- const betweenResizablePanes = prev.resizable && next.resizable;
1938
- const nearCollapsedPane = prev.collapsed || next.collapsed;
1939
- return betweenResizablePanes && !nearCollapsedPane;
1940
- }
1941
- isStatic(splitBarIndex) {
1942
- const prev = this.pane(splitBarIndex);
1943
- const next = this.pane(splitBarIndex + 1);
1944
- const betweenResizablePanes = prev.resizable && next.resizable;
1945
- const nearCollapsiblePane = prev.collapsible || next.collapsible;
1946
- return !betweenResizablePanes && !nearCollapsiblePane;
1947
- }
1948
- pane(index) {
1949
- if (!this.panes) {
1950
- throw new Error("Panes not initialized");
1951
- }
1952
- if (index < 0 || index >= this.panes.length) {
1953
- throw new Error("Index out of range");
1954
- }
1955
- return this.panes[index];
1956
- }
1957
- configure({ panes, orientation, containerSize, direction }) {
1958
- this.panes = panes;
1959
- this.panes.forEach((pane, index) => {
1960
- pane.order = index * 2;
1961
- pane.orientation = orientation;
1962
- });
1963
- if (isDevMode()) {
1964
- const allPanesWithSize = panes.length && !panes.some(pane => !pane.fixedSize);
1965
- const hasResizedPane = panes.length && panes.some(pane => pane.isResized);
1966
- if (allPanesWithSize && !hasResizedPane) {
1967
- throw new Error(`
1968
- The Splitter should have at least one pane without a set size.
1969
- See ${SIZING_DOC_LINK} for more information.
1970
- `);
1971
- }
1972
- }
1973
- this.containerSize = containerSize;
1974
- this.rtl = direction === 'rtl';
1975
- }
1976
- isPercent(size) {
1977
- return /%$/.test(size);
1978
- }
1979
- toPixels(size) {
1980
- let result = parseFloat(size);
1981
- if (this.isPercent(size)) {
1982
- result = (this.containerSize() * result / 100);
1983
- }
1984
- return result;
1985
- }
1986
- emit(emitter, args) {
1987
- if (emitter.observers.length) {
1988
- this.zone.run(() => emitter.emit(args));
1989
- }
1990
- }
1991
- }
1992
- SplitterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
1993
- SplitterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService });
1994
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterService, decorators: [{
1995
- type: Injectable
1996
- }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
1997
-
1998
2047
  /* eslint-disable @typescript-eslint/no-explicit-any */
1999
2048
  const stopPropagation = ({ originalEvent: event }) => {
2000
2049
  event.stopPropagation();
@@ -2021,10 +2070,12 @@ class SplitterBarComponent {
2021
2070
  this.renderer = renderer;
2022
2071
  this.cdr = cdr;
2023
2072
  this.ariaRole = 'separator';
2073
+ this.ariaLabel = 'Splitter pane';
2024
2074
  this.focused = false;
2025
2075
  this.orientation = 'horizontal';
2026
2076
  this.index = 0;
2027
2077
  this.subscriptions = new Subscription();
2078
+ this.parsedAttributes = {};
2028
2079
  }
2029
2080
  get hostOrientation() {
2030
2081
  return this.orientation === 'horizontal' ? 'vertical' : 'horizontal';
@@ -2051,6 +2102,28 @@ class SplitterBarComponent {
2051
2102
  get order() {
2052
2103
  return 2 * this.index + 1;
2053
2104
  }
2105
+ set htmlAttributes(attributes) {
2106
+ if (isObjectPresent(this.parsedAttributes)) {
2107
+ removeHTMLAttributes(this.parsedAttributes, this.renderer, this.element.nativeElement);
2108
+ }
2109
+ this._htmlAttributes = attributes;
2110
+ this.parsedAttributes = this.htmlAttributes ?
2111
+ parseAttributes(this.htmlAttributes, this.defaultAttributes) :
2112
+ this.htmlAttributes;
2113
+ this.setHtmlAttributes();
2114
+ }
2115
+ get htmlAttributes() {
2116
+ return this._htmlAttributes;
2117
+ }
2118
+ get defaultAttributes() {
2119
+ return {
2120
+ 'aria-orientation': this.hostOrientation,
2121
+ role: this.ariaRole
2122
+ };
2123
+ }
2124
+ get mutableAttributes() {
2125
+ return { 'tabindex': this.tabIndex };
2126
+ }
2054
2127
  ngOnInit() {
2055
2128
  let state;
2056
2129
  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 }) => {
@@ -2197,9 +2270,13 @@ class SplitterBarComponent {
2197
2270
  this.splitterService.tryToggle(next);
2198
2271
  }
2199
2272
  }
2273
+ setHtmlAttributes() {
2274
+ const attributesToRender = { ...this.mutableAttributes, ...this.parsedAttributes };
2275
+ setHTMLAttributes(attributesToRender, this.renderer, this.element.nativeElement);
2276
+ }
2200
2277
  }
2201
2278
  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 });
2202
- 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: `
2279
+ 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: `
2203
2280
  <div *ngIf="shouldShowIcon('prev')" class="k-collapse-prev" (click)="togglePrevious()">
2204
2281
  <kendo-icon-wrapper
2205
2282
  size="xsmall"
@@ -2245,6 +2322,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2245
2322
  }] }, { type: i1.LocalizationService }, { type: SplitterService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { ariaRole: [{
2246
2323
  type: HostBinding,
2247
2324
  args: ['attr.role']
2325
+ }], ariaLabel: [{
2326
+ type: HostBinding,
2327
+ args: ['attr.aria-label']
2248
2328
  }], focused: [{
2249
2329
  type: HostBinding,
2250
2330
  args: ['class.k-focus']
@@ -2267,8 +2347,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2267
2347
  type: Input
2268
2348
  }], index: [{
2269
2349
  type: Input
2350
+ }], htmlAttributes: [{
2351
+ type: Input
2270
2352
  }] } });
2271
2353
 
2354
+ const SIZING_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/layout/splitter/panes/#toc-size';
2272
2355
  /**
2273
2356
  * Represents the [Kendo UI Splitter component for Angular]({% slug overview_splitter %}).
2274
2357
  *
@@ -2305,11 +2388,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2305
2388
  * ```
2306
2389
  */
2307
2390
  class SplitterComponent {
2308
- constructor(element, splitterService, localization, renderer, enclosingPane) {
2391
+ constructor(element, splitterService, localization, renderer, ngZone, enclosingPane) {
2309
2392
  this.element = element;
2310
2393
  this.splitterService = splitterService;
2311
2394
  this.localization = localization;
2312
2395
  this.renderer = renderer;
2396
+ this.ngZone = ngZone;
2313
2397
  this.enclosingPane = enclosingPane;
2314
2398
  /**
2315
2399
  * Specifies the orientation of the panes within the Splitter.
@@ -2349,6 +2433,7 @@ class SplitterComponent {
2349
2433
  return this.direction;
2350
2434
  }
2351
2435
  set splitbars(splitbars) {
2436
+ this.splitterService.splitterBars = splitbars ? splitbars.toArray() : [];
2352
2437
  if (!isPresent(splitbars) || !isPresent(this.panes)) {
2353
2438
  return;
2354
2439
  }
@@ -2361,15 +2446,29 @@ class SplitterComponent {
2361
2446
  .sort((a, b) => a.order - b.order);
2362
2447
  const elements = components.map(component => component.element.nativeElement);
2363
2448
  panesArray.forEach((pane, i) => {
2364
- if (splitBarsArray[i] && pane.separatorLabel) {
2365
- const splitbar = splitBarsArray[i].element.nativeElement;
2366
- this.renderer.setAttribute(splitbar, 'aria-label', pane.separatorLabel);
2449
+ const splitbar = splitBarsArray[i];
2450
+ if (splitbar && pane.splitterBarAttributes) {
2451
+ splitbar.htmlAttributes = pane.splitterBarAttributes;
2367
2452
  }
2368
2453
  });
2369
2454
  elements.forEach(element => this.renderer.appendChild(this.element.nativeElement, element));
2370
2455
  }
2371
2456
  ngAfterContentInit() {
2372
2457
  this.reconfigure();
2458
+ this.setFixedHeight();
2459
+ const allHaveFixedSize = this.panes.length && Array.from(this.panes).every(p => p.fixedSize);
2460
+ if (allHaveFixedSize && isDevMode()) {
2461
+ throw new Error(`
2462
+ The Splitter should have at least one pane without a set size.
2463
+ See ${SIZING_DOC_LINK} for more information.
2464
+ `);
2465
+ }
2466
+ this._styleObserver = new MutationObserver(() => {
2467
+ this.ngZone.runOutsideAngular(() => {
2468
+ this.setFixedHeight();
2469
+ });
2470
+ });
2471
+ this._styleObserver.observe(this.element.nativeElement, { attributeFilter: ['style'] });
2373
2472
  }
2374
2473
  ngOnChanges(changes) {
2375
2474
  if (changes.orientation && !changes.orientation.isFirstChange()) {
@@ -2380,6 +2479,10 @@ class SplitterComponent {
2380
2479
  if (this.enclosingPane) {
2381
2480
  this.enclosingPane.containsSplitter = false;
2382
2481
  }
2482
+ if (this._styleObserver) {
2483
+ this._styleObserver.disconnect();
2484
+ this._styleObserver = null;
2485
+ }
2383
2486
  this.unsubscribeChanges();
2384
2487
  }
2385
2488
  reconfigure() {
@@ -2411,9 +2514,12 @@ class SplitterComponent {
2411
2514
  get direction() {
2412
2515
  return this.localization.rtl ? 'rtl' : 'ltr';
2413
2516
  }
2517
+ setFixedHeight() {
2518
+ this.splitterService.fixedHeight = getComputedStyle(this.element.nativeElement).getPropertyValue('height') !== 'auto';
2519
+ }
2414
2520
  }
2415
- 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 });
2416
- 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: [
2521
+ 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 });
2522
+ 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: [
2417
2523
  SplitterService,
2418
2524
  LocalizationService,
2419
2525
  {
@@ -2432,13 +2538,14 @@ SplitterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
2432
2538
  *ngIf="!last"
2433
2539
  [index]="index"
2434
2540
  [orientation]="orientation"
2541
+ [ngClass]="pane.splitterBarClass || splitterBarClass"
2435
2542
  [ngStyle]="{
2436
2543
  width: orientation === 'horizontal' ? splitbarWidth + 'px' : undefined,
2437
2544
  height: orientation === 'vertical' ? splitbarWidth + 'px' : undefined
2438
2545
  }">
2439
2546
  </kendo-splitter-bar>
2440
2547
  </ng-container>
2441
- `, 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"] }] });
2548
+ `, 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"] }] });
2442
2549
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SplitterComponent, decorators: [{
2443
2550
  type: Component,
2444
2551
  args: [{
@@ -2464,6 +2571,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2464
2571
  *ngIf="!last"
2465
2572
  [index]="index"
2466
2573
  [orientation]="orientation"
2574
+ [ngClass]="pane.splitterBarClass || splitterBarClass"
2467
2575
  [ngStyle]="{
2468
2576
  width: orientation === 'horizontal' ? splitbarWidth + 'px' : undefined,
2469
2577
  height: orientation === 'vertical' ? splitbarWidth + 'px' : undefined
@@ -2472,9 +2580,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2472
2580
  </ng-container>
2473
2581
  `,
2474
2582
  standalone: true,
2475
- imports: [NgFor, NgIf, SplitterBarComponent, DraggableDirective, NgStyle]
2583
+ imports: [NgFor, NgIf, SplitterBarComponent, DraggableDirective, NgStyle, NgClass]
2476
2584
  }]
2477
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SplitterService }, { type: i1.LocalizationService }, { type: i0.Renderer2 }, { type: SplitterPaneComponent, decorators: [{
2585
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: SplitterService }, { type: i1.LocalizationService }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: SplitterPaneComponent, decorators: [{
2478
2586
  type: Optional
2479
2587
  }, {
2480
2588
  type: Host
@@ -2487,6 +2595,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2487
2595
  type: Input
2488
2596
  }], resizeStep: [{
2489
2597
  type: Input
2598
+ }], splitterBarClass: [{
2599
+ type: Input
2490
2600
  }], layoutChange: [{
2491
2601
  type: Output
2492
2602
  }], hostClasses: [{