@skyux/lists 5.9.6 → 5.9.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"repeater.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.component.ts","../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,MAAM,EACN,SAAS,EACT,SAAS,GAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;;;;;;AAExD,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB;;GAEG;AAQH,MAAM,OAAO,oBAAoB;IAmF/B,YACU,cAAiC,EACjC,eAAmC,EACnC,cAAyC,EACzC,cAA8B,EAC9B,UAAsB,EACtB,QAAmB;QALnB,mBAAc,GAAd,cAAc,CAAmB;QACjC,oBAAe,GAAf,eAAe,CAAoB;QACnC,mBAAc,GAAd,cAAc,CAA2B;QACzC,mBAAc,GAAd,cAAc,CAAgB;QAC9B,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAW;QApE7B;;;;WAIG;QAEI,gBAAW,GAAG,KAAK,CAAC;QAgC3B;;WAEG;QAEI,sBAAiB,GAAG,IAAI,YAAY,EAAU,CAAC;QAEtD;;;WAGG;QAEI,gBA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M;gBAIA,KAAK;sBADX,eAAe;uBAAC,wBAAwB","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n Output,\n QueryList,\n Renderer2,\n SimpleChanges,\n} from '@angular/core';\n\nimport { DragulaService } from 'ng2-dragula';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyRepeaterAdapterService } from './repeater-adapter.service';\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\nimport { SkyRepeaterService } from './repeater.service';\n\nlet uniqueId = 0;\n\n/**\n * Creates a container to display repeater items.\n */\n@Component({\n selector: 'sky-repeater',\n styleUrls: ['./repeater.component.scss'],\n templateUrl: './repeater.component.html',\n providers: [SkyRepeaterService, SkyRepeaterAdapterService],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyRepeaterComponent\n implements AfterContentInit, OnChanges, OnDestroy\n{\n /**\n * Specifies the index of the repeater item to visually highlight as active.\n * For example, use this property in conjunction with the\n * [split view component](https://developer.blackbaud.com/skyux/components/split-view)\n * to highlight a repeater item while users edit it. Only one item can be active at a time.\n */\n @Input()\n public activeIndex: number;\n\n /**\n * Specifies an ARIA label for the repeater list.\n * This sets the repeater list's `aria-label` attribute\n * [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * @default \"List of items\"\n */\n @Input()\n public ariaLabel: string;\n\n /**\n * Indicates whether users can change the order of items in the repeater list.\n * Each repeater item also has `reorderable` property to indicate whether\n * users can change its order.\n */\n @Input()\n public reorderable = false;\n\n /**\n * Specifies a layout to determine which repeater items are expanded by default and whether\n * repeater items are expandable and collapsible. Collapsed items display titles only.\n * The valid options are `multiple`, `none`, and `single`.\n * - `multiple` loads repeater items in an expanded state unless `isExpanded` is set to\n * `false` for a repeater item. This layout allows users to expand and collapse\n * as many repeater items as necessary. It is best-suited to repeater items where body\n * content is important but users don't always need to see it.\n * - `none` loads all repeater items in an expanded state and does not allow users to\n * collapse them. This default layout provides the quickest access to the details in the\n * repeater items. It is best-suited to repeater items with concise content\n * that users need to view frequently.\n * - `single` loads one repeater item in an expanded state and collapses all others.\n * The expanded repeater item is the first one where `isExpanded` is set to `true`. This layout\n * allows users to expand one item at a time. It provides the most compact view and is\n * best-suited to repeater items where the most important information is in the titles\n * and users only occasionally need to view the body content.\n * @default \"none\"\n */\n @Input()\n public set expandMode(value: string) {\n this.repeaterService.expandMode = value;\n this._expandMode = value;\n this.updateForExpandMode();\n }\n\n public get expandMode(): string {\n return this._expandMode || 'none';\n }\n\n /**\n * Fires when the active repeater item changes.\n */\n @Output()\n public activeIndexChange = new EventEmitter<number>();\n\n /**\n * Fires when users change the order of repeater items.\n * This event emits an ordered array of the `tag` properties that the consumer provides for each repeater item.\n */\n @Output()\n public orderChange = new EventEmitter<any[]>();\n\n @ContentChildren(SkyRepeaterItemComponent)\n public items: QueryList<SkyRepeaterItemComponent>;\n\n public dragulaGroupName: string;\n\n private dragulaUnsubscribe = new Subject<void>();\n\n private ngUnsubscribe = new Subject<void>();\n\n private _expandMode = 'none';\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private repeaterService: SkyRepeaterService,\n private adapterService: SkyRepeaterAdapterService,\n private dragulaService: DragulaService,\n private elementRef: ElementRef,\n private renderer: Renderer2\n ) {\n this.dragulaGroupName = `sky-repeater-dragula-${++uniqueId}`;\n\n this.repeaterService.itemCollapseStateChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((item: SkyRepeaterItemComponent) => {\n if (this.expandMode === 'single' && item.isExpanded) {\n this.items.forEach((otherItem) => {\n if (\n otherItem !== item &&\n otherItem.isExpanded &&\n otherItem.isCollapsible\n ) {\n otherItem.isExpanded = false;\n }\n });\n }\n });\n\n this.repeaterService.activeItemIndexChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((index: number) => {\n if (index !== this.activeIndex) {\n this.activeIndex = index;\n this.activeIndexChange.emit(index);\n }\n });\n\n this.repeaterService.orderChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.emitTags();\n });\n\n this.repeaterService.repeaterGroupId = uniqueId;\n\n this.updateForExpandMode();\n\n this.adapterService.setRepeaterHost(this.elementRef);\n\n this.initializeDragAndDrop();\n }\n\n public ngAfterContentInit(): void {\n // If activeIndex has been set on init, call service to activate the appropriate item.\n setTimeout(() => {\n if (this.activeIndex || this.activeIndex === 0) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n\n if (this.reorderable && !this.everyItemHasTag()) {\n console.warn(\n 'Please supply tag properties for each repeater item when reordering functionality is enabled.'\n );\n }\n });\n\n // HACK: Not updating for expand mode in a timeout causes an error.\n // https://github.com/angular/angular/issues/6005\n this.items.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n setTimeout(() => {\n if (this.items.last) {\n this.updateForExpandMode(this.items.last);\n this.items.last.reorderable = this.reorderable;\n }\n\n if (this.activeIndex !== undefined) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n });\n });\n\n setTimeout(() => {\n this.updateForExpandMode();\n\n this.items.forEach((item) => {\n item.reorderable = this.reorderable;\n });\n }, 0);\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n if (changes['activeIndex']) {\n this.repeaterService.enableActiveState = true;\n if (\n changes['activeIndex'].currentValue !==\n changes['activeIndex'].previousValue\n ) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n }\n\n if (changes.reorderable) {\n if (this.items) {\n this.items.forEach((item) => (item.reorderable = this.reorderable));\n }\n\n this.changeDetector.markForCheck();\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n this.destroyDragAndDrop();\n }\n\n private updateForExpandMode(itemAdded?: SkyRepeaterItemComponent): void {\n if (this.items) {\n let foundExpanded = false;\n const isCollapsible = this.expandMode !== 'none';\n const isSingle = this.expandMode === 'single';\n\n // Keep any newly-added expanded item expanded and collapse the rest.\n if (itemAdded && itemAdded.isExpanded) {\n foundExpanded = true;\n }\n\n this.items.forEach((item) => {\n item.isCollapsible = isCollapsible && !!item.hasItemContent;\n\n if (item !== itemAdded && isSingle && item.isExpanded) {\n if (foundExpanded) {\n item.updateForExpanded(false, false);\n }\n\n foundExpanded = true;\n }\n });\n }\n }\n\n private initializeDragAndDrop(): void {\n /* Sanity check that we haven't already set up dragging abilities */\n /* istanbul ignore else */\n if (!this.dragulaService.find(this.dragulaGroupName)) {\n this.dragulaService.setOptions(this.dragulaGroupName, {\n moves: (\n el: HTMLElement,\n container: HTMLElement,\n handle: HTMLElement\n ) => {\n const target = el.querySelector('.sky-repeater-item-grab-handle');\n return this.reorderable && target && target.contains(handle);\n },\n });\n }\n\n let draggedItemIndex: number;\n\n this.dragulaService.drag\n .pipe(takeUntil(this.dragulaUnsubscribe))\n .subscribe(([groupName, subject]: any[]) => {\n /* istanbul ignore else */\n if (groupName === this.dragulaGroupName) {\n this.renderer.addClass(subject, 'sky-repeater-item-dragging');\n draggedItemIndex = this.adapterService.getRepeaterItemIndex(subject);\n }\n });\n\n this.dragulaService.dragend\n .pipe(takeUntil(this.dragulaUnsubscribe))\n .subscribe(([groupName, subject]: any[]) => {\n /* istanbul ignore else */\n if (groupName === this.dragulaGroupName) {\n this.renderer.removeClass(subject, 'sky-repeater-item-dragging');\n const newItemIndex =\n this.adapterService.getRepeaterItemIndex(subject);\n\n /* sanity check */\n /* istanbul ignore else */\n if (draggedItemIndex >= 0) {\n this.repeaterService.reorderItem(draggedItemIndex, newItemIndex);\n draggedItemIndex = undefined;\n }\n\n this.emitTags();\n }\n });\n }\n\n private destroyDragAndDrop(): void {\n this.dragulaUnsubscribe.next();\n this.dragulaUnsubscribe.complete();\n this.dragulaUnsubscribe = undefined;\n\n /* Sanity check that we have set up dragging abilities */\n /* istanbul ignore else */\n if (this.dragulaService.find(this.dragulaGroupName)) {\n this.dragulaService.destroy(this.dragulaGroupName);\n }\n }\n\n private emitTags(): void {\n const tags = this.repeaterService.items.map((item) => item.tag);\n this.orderChange.emit(tags);\n }\n\n private everyItemHasTag(): boolean {\n /* sanity check */\n /* istanbul ignore if */\n if (!this.items || this.items.length === 0) {\n return false;\n }\n return this.items.toArray().every((item) => {\n return item.tag !== undefined;\n });\n }\n}\n","<ng-container #repeaterHost>\n <div\n class=\"sky-repeater\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel || ('skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n >\n <ng-content></ng-content>\n </div>\n</ng-container>\n"]}
1
+ {"version":3,"file":"repeater.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.component.ts","../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,KAAK,EAIL,MAAM,EACN,SAAS,EACT,SAAS,GAEV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;;;;;;;AAExD,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB;;GAEG;AAQH,MAAM,OAAO,oBAAoB;IAqF/B,YACU,cAAiC,EACjC,eAAmC,EACnC,cAAyC,EACzC,cAA8B,EAC9B,UAAsB,EACtB,QAAmB;QALnB,mBAAc,GAAd,cAAc,CAAmB;QACjC,oBAAe,GAAf,eAAe,CAAoB;QACnC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0CAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACtD,0FAA0F;YAC1F,QAAQ,GAAG,SAAS,CAAC;SACtB;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,mBAC7B,OAAO,CAAC,QAAQ,CAAC,EACpB,CAAC;YACH,IAAI,CAAC,IAAI,GAAG,GAAG,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;SACpC;IACH,CAAC;;kHAzXU,oBAAoB;sGAApB,oBAAoB,8OAHpB,CAAC,kBAAkB,EAAE,yBAAyB,CAAC,gDA2EzC,wBAAwB,kDChH3C,uUAWA;4FD6Ba,oBAAoB;kBAPhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,cAAc;oBACxB,SAAS,EAAE,CAAC,2BAA2B,CAAC;oBACxC,WAAW,EAAE,2BAA2B;oBACxC,SAAS,EAAE,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;oBAC1D,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;+PAWQ,WAAW;sBADjB,KAAK;gBAUC,SAAS;sBADf,KAAK;gBASC,WAAW;sBADjB,KAAK;gBAuBK,UAAU;sBADpB,KAAK;gBAeC,iBAAiB;sBADvB,MAAM;gBAQA,WAAW;sBADjB,MAAM;gBAIA,KAAK;sBADX,eAAe;uBAAC,wBAAwB","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n QueryList,\n Renderer2,\n SimpleChanges,\n} from '@angular/core';\n\nimport { DragulaService } from 'ng2-dragula';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyRepeaterAdapterService } from './repeater-adapter.service';\nimport { SkyRepeaterItemRolesType } from './repeater-item-roles.type';\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\nimport { SkyRepeaterRoleType } from './repeater-role.type';\nimport { SkyRepeaterService } from './repeater.service';\n\nlet uniqueId = 0;\n\n/**\n * Creates a container to display repeater items.\n */\n@Component({\n selector: 'sky-repeater',\n styleUrls: ['./repeater.component.scss'],\n templateUrl: './repeater.component.html',\n providers: [SkyRepeaterService, SkyRepeaterAdapterService],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyRepeaterComponent\n implements AfterContentInit, OnChanges, OnDestroy, OnInit\n{\n /**\n * Specifies the index of the repeater item to visually highlight as active.\n * For example, use this property in conjunction with the\n * [split view component](https://developer.blackbaud.com/skyux/components/split-view)\n * to highlight a repeater item while users edit it. Only one item can be active at a time.\n */\n @Input()\n public activeIndex: number;\n\n /**\n * Specifies an ARIA label for the repeater list.\n * This sets the repeater list's `aria-label` attribute\n * [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * @default \"List of items\"\n */\n @Input()\n public ariaLabel: string;\n\n /**\n * Indicates whether users can change the order of items in the repeater list.\n * Each repeater item also has `reorderable` property to indicate whether\n * users can change its order.\n */\n @Input()\n public reorderable = false;\n\n /**\n * Specifies a layout to determine which repeater items are expanded by default and whether\n * repeater items are expandable and collapsible. Collapsed items display titles only.\n * The valid options are `multiple`, `none`, and `single`.\n * - `multiple` loads repeater items in an expanded state unless `isExpanded` is set to\n * `false` for a repeater item. This layout allows users to expand and collapse\n * as many repeater items as necessary. It is best-suited to repeater items where body\n * content is important but users don't always need to see it.\n * - `none` loads all repeater items in an expanded state and does not allow users to\n * collapse them. This default layout provides the quickest access to the details in the\n * repeater items. It is best-suited to repeater items with concise content\n * that users need to view frequently.\n * - `single` loads one repeater item in an expanded state and collapses all others.\n * The expanded repeater item is the first one where `isExpanded` is set to `true`. This layout\n * allows users to expand one item at a time. It provides the most compact view and is\n * best-suited to repeater items where the most important information is in the titles\n * and users only occasionally need to view the body content.\n * @default \"none\"\n */\n @Input()\n public set expandMode(value: string) {\n this.repeaterService.expandMode = value;\n this._expandMode = value;\n this.updateForExpandMode();\n }\n\n public get expandMode(): string {\n return this._expandMode || 'none';\n }\n\n /**\n * Fires when the active repeater item changes.\n */\n @Output()\n public activeIndexChange = new EventEmitter<number>();\n\n /**\n * Fires when users change the order of repeater items.\n * This event emits an ordered array of the `tag` properties that the consumer provides for each repeater item.\n */\n @Output()\n public orderChange = new EventEmitter<any[]>();\n\n @ContentChildren(SkyRepeaterItemComponent)\n public items: QueryList<SkyRepeaterItemComponent>;\n\n public dragulaGroupName: string;\n\n public role: SkyRepeaterRoleType | undefined;\n\n private dragulaUnsubscribe = new Subject<void>();\n\n private ngUnsubscribe = new Subject<void>();\n\n private _expandMode = 'none';\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private repeaterService: SkyRepeaterService,\n private adapterService: SkyRepeaterAdapterService,\n private dragulaService: DragulaService,\n private elementRef: ElementRef,\n private renderer: Renderer2\n ) {\n this.dragulaGroupName = `sky-repeater-dragula-${++uniqueId}`;\n\n this.repeaterService.itemCollapseStateChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((item: SkyRepeaterItemComponent) => {\n if (this.expandMode === 'single' && item.isExpanded) {\n this.items.forEach((otherItem) => {\n if (\n otherItem !== item &&\n otherItem.isExpanded &&\n otherItem.isCollapsible\n ) {\n otherItem.isExpanded = false;\n }\n });\n }\n });\n\n this.repeaterService.activeItemIndexChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((index: number) => {\n if (index !== this.activeIndex) {\n this.activeIndex = index;\n this.activeIndexChange.emit(index);\n }\n });\n\n this.repeaterService.orderChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.emitTags();\n });\n\n this.repeaterService.repeaterGroupId = uniqueId;\n\n this.updateForExpandMode();\n\n this.adapterService.setRepeaterHost(this.elementRef);\n\n this.initializeDragAndDrop();\n }\n\n public ngAfterContentInit(): void {\n // If activeIndex has been set on init, call service to activate the appropriate item.\n setTimeout(() => {\n if (this.activeIndex || this.activeIndex === 0) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n\n if (this.reorderable && !this.everyItemHasTag()) {\n console.warn(\n 'Please supply tag properties for each repeater item when reordering functionality is enabled.'\n );\n }\n });\n\n // HACK: Not updating for expand mode in a timeout causes an error.\n // https://github.com/angular/angular/issues/6005\n this.items.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n setTimeout(() => {\n if (this.items.last) {\n this.updateForExpandMode(this.items.last);\n this.items.last.reorderable = this.reorderable;\n }\n\n if (this.activeIndex !== undefined) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n\n this.updateRole();\n });\n });\n\n setTimeout(() => {\n this.updateForExpandMode();\n\n this.items.forEach((item) => {\n item.reorderable = this.reorderable;\n });\n\n this.updateRole();\n }, 0);\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n if (changes['activeIndex']) {\n this.repeaterService.enableActiveState = true;\n if (\n changes['activeIndex'].currentValue !==\n changes['activeIndex'].previousValue\n ) {\n this.repeaterService.activateItemByIndex(this.activeIndex);\n }\n }\n\n if (changes.reorderable) {\n if (this.items) {\n this.items.forEach((item) => (item.reorderable = this.reorderable));\n }\n this.updateRole();\n\n this.changeDetector.markForCheck();\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n this.destroyDragAndDrop();\n }\n\n public ngOnInit(): void {\n this.updateRole();\n }\n\n public onCdkObserveContent(): void {\n this.updateRole();\n }\n\n private updateForExpandMode(itemAdded?: SkyRepeaterItemComponent): void {\n if (this.items) {\n let foundExpanded = false;\n const isCollapsible = this.expandMode !== 'none';\n const isSingle = this.expandMode === 'single';\n\n // Keep any newly-added expanded item expanded and collapse the rest.\n if (itemAdded && itemAdded.isExpanded) {\n foundExpanded = true;\n }\n\n this.items.forEach((item) => {\n item.isCollapsible = isCollapsible && !!item.hasItemContent;\n\n if (item !== itemAdded && isSingle && item.isExpanded) {\n if (foundExpanded) {\n item.updateForExpanded(false, false);\n }\n\n foundExpanded = true;\n }\n });\n\n this.updateRole();\n }\n }\n\n private initializeDragAndDrop(): void {\n /* Sanity check that we haven't already set up dragging abilities */\n /* istanbul ignore else */\n if (!this.dragulaService.find(this.dragulaGroupName)) {\n this.dragulaService.setOptions(this.dragulaGroupName, {\n moves: (\n el: HTMLElement,\n container: HTMLElement,\n handle: HTMLElement\n ) => {\n const target = el.querySelector('.sky-repeater-item-grab-handle');\n return this.reorderable && target && target.contains(handle);\n },\n });\n }\n\n let draggedItemIndex: number;\n\n this.dragulaService.drag\n .pipe(takeUntil(this.dragulaUnsubscribe))\n .subscribe(([groupName, subject]: any[]) => {\n /* istanbul ignore else */\n if (groupName === this.dragulaGroupName) {\n this.renderer.addClass(subject, 'sky-repeater-item-dragging');\n draggedItemIndex = this.adapterService.getRepeaterItemIndex(subject);\n }\n });\n\n this.dragulaService.dragend\n .pipe(takeUntil(this.dragulaUnsubscribe))\n .subscribe(([groupName, subject]: any[]) => {\n /* istanbul ignore else */\n if (groupName === this.dragulaGroupName) {\n this.renderer.removeClass(subject, 'sky-repeater-item-dragging');\n const newItemIndex =\n this.adapterService.getRepeaterItemIndex(subject);\n\n /* sanity check */\n /* istanbul ignore else */\n if (draggedItemIndex >= 0) {\n this.repeaterService.reorderItem(draggedItemIndex, newItemIndex);\n draggedItemIndex = undefined;\n }\n\n this.emitTags();\n }\n });\n }\n\n private destroyDragAndDrop(): void {\n this.dragulaUnsubscribe.next();\n this.dragulaUnsubscribe.complete();\n this.dragulaUnsubscribe = undefined;\n\n /* Sanity check that we have set up dragging abilities */\n /* istanbul ignore else */\n if (this.dragulaService.find(this.dragulaGroupName)) {\n this.dragulaService.destroy(this.dragulaGroupName);\n }\n }\n\n private emitTags(): void {\n const tags = this.repeaterService.items.map((item) => item.tag);\n this.orderChange.emit(tags);\n }\n\n private everyItemHasTag(): boolean {\n /* sanity check */\n /* istanbul ignore if */\n if (!this.items || this.items.length === 0) {\n return false;\n }\n return this.items.toArray().every((item) => {\n return item.tag !== undefined;\n });\n }\n\n private updateRole() {\n // Determine a role using a hierarchy based on https://www.w3.org/TR/wai-aria-practices-1.1/\n // 1. If there are one or more interactions in the repeater item projected content, use grid.\n // 2. If there are selectable repeater items and no other interactions, use listbox.\n // 3. If there are no interactions, use list.\n\n // Default to list role.\n let autoRole: SkyRepeaterRoleType = 'list';\n\n const roleMap: Record<SkyRepeaterRoleType, SkyRepeaterItemRolesType> = {\n list: { item: 'listitem', title: undefined, content: undefined },\n listbox: { item: 'option', title: undefined, content: undefined },\n grid: { item: 'row', title: 'rowheader', content: 'gridcell' },\n };\n\n // Based on https://html.spec.whatwg.org/multipage/dom.html#interactive-content\n const interactionSelector = [\n 'a[href]',\n 'audio[controls]',\n 'button',\n 'details',\n 'embed',\n 'iframe',\n 'img[usemap]',\n 'input:not([type=\"hidden\"])',\n 'label',\n 'select',\n 'textarea',\n 'video[controls]',\n '[contenteditable]',\n '.sky-repeater[role=\"grid\"]',\n ]\n .map(\n (selector) =>\n `sky-repeater-item-title ${selector}:not([hidden]), sky-repeater-item-content ${selector}:not([hidden])`\n )\n .concat([`skyux-dropdown`])\n .join(', ');\n\n const hasInteraction =\n this.reorderable ||\n this.items?.some((item) => item.isCollapsible) ||\n !!(this.elementRef.nativeElement as HTMLElement).querySelector(\n interactionSelector\n );\n\n if (hasInteraction) {\n // If the repeater matches interaction selector https://www.w3.org/TR/wai-aria-practices-1.1/#grid\n autoRole = 'grid';\n } else if (this.items?.some((item) => item.selectable)) {\n // If the only interaction is select https://www.w3.org/TR/wai-aria-practices-1.1/#Listbox\n autoRole = 'listbox';\n }\n\n if (this.role !== autoRole) {\n this.repeaterService.itemRole.next({\n ...roleMap[autoRole],\n });\n this.role = `${autoRole}`;\n this.changeDetector.markForCheck();\n }\n }\n}\n","<ng-container #repeaterHost>\n <div\n class=\"sky-repeater\"\n [attr.role]=\"role\"\n [attr.aria-label]=\"ariaLabel || ('skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n (cdkObserveContent)=\"onCdkObserveContent()\"\n >\n <ng-content></ng-content>\n </div>\n</ng-container>\n"]}
@@ -1,3 +1,4 @@
1
+ import { ObserversModule } from '@angular/cdk/observers';
1
2
  import { CommonModule } from '@angular/common';
2
3
  import { NgModule } from '@angular/core';
3
4
  import { SkyCheckboxModule } from '@skyux/forms';
@@ -20,6 +21,7 @@ SkyRepeaterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versi
20
21
  SkyRepeaterItemContextMenuComponent,
21
22
  SkyRepeaterItemTitleComponent], imports: [CommonModule,
22
23
  DragulaModule,
24
+ ObserversModule,
23
25
  SkyChevronModule,
24
26
  SkyCheckboxModule,
25
27
  SkyIconModule,
@@ -32,6 +34,7 @@ SkyRepeaterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versi
32
34
  SkyRepeaterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterModule, imports: [[
33
35
  CommonModule,
34
36
  DragulaModule,
37
+ ObserversModule,
35
38
  SkyChevronModule,
36
39
  SkyCheckboxModule,
37
40
  SkyIconModule,
@@ -51,6 +54,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
51
54
  imports: [
52
55
  CommonModule,
53
56
  DragulaModule,
57
+ ObserversModule,
54
58
  SkyChevronModule,
55
59
  SkyCheckboxModule,
56
60
  SkyIconModule,
@@ -1 +1 @@
1
- {"version":3,"file":"repeater.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC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;oBACD,OAAO,EAAE;wBACP,oBAAoB;wBACpB,wBAAwB;wBACxB,+BAA+B;wBAC/B,mCAAmC;wBACnC,6BAA6B;qBAC9B;iBACF","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SkyCheckboxModule } from '@skyux/forms';\nimport { SkyChevronModule, SkyIconModule } from '@skyux/indicators';\nimport { SkyInlineFormModule } from '@skyux/inline-form';\n\nimport { DragulaModule } from 'ng2-dragula';\n\nimport { SkyListsResourcesModule } from '../shared/sky-lists-resources.module';\n\nimport { SkyRepeaterItemContentComponent } from './repeater-item-content.component';\nimport { SkyRepeaterItemContextMenuComponent } from './repeater-item-context-menu.component';\nimport { SkyRepeaterItemTitleComponent } from './repeater-item-title.component';\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\nimport { SkyRepeaterComponent } from './repeater.component';\n\n@NgModule({\n declarations: [\n SkyRepeaterComponent,\n SkyRepeaterItemComponent,\n SkyRepeaterItemContentComponent,\n SkyRepeaterItemContextMenuComponent,\n SkyRepeaterItemTitleComponent,\n ],\n imports: [\n CommonModule,\n DragulaModule,\n SkyChevronModule,\n SkyCheckboxModule,\n SkyIconModule,\n SkyInlineFormModule,\n SkyListsResourcesModule,\n ],\n exports: [\n SkyRepeaterComponent,\n SkyRepeaterItemComponent,\n SkyRepeaterItemContentComponent,\n SkyRepeaterItemContextMenuComponent,\n SkyRepeaterItemTitleComponent,\n ],\n})\nexport class SkyRepeaterModule {}\n"]}
1
+ {"version":3,"file":"repeater.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,O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wBACP,oBAAoB;wBACpB,wBAAwB;wBACxB,+BAA+B;wBAC/B,mCAAmC;wBACnC,6BAA6B;qBAC9B;iBACF","sourcesContent":["import { ObserversModule } from '@angular/cdk/observers';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SkyCheckboxModule } from '@skyux/forms';\nimport { SkyChevronModule, SkyIconModule } from '@skyux/indicators';\nimport { SkyInlineFormModule } from '@skyux/inline-form';\n\nimport { DragulaModule } from 'ng2-dragula';\n\nimport { SkyListsResourcesModule } from '../shared/sky-lists-resources.module';\n\nimport { SkyRepeaterItemContentComponent } from './repeater-item-content.component';\nimport { SkyRepeaterItemContextMenuComponent } from './repeater-item-context-menu.component';\nimport { SkyRepeaterItemTitleComponent } from './repeater-item-title.component';\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\nimport { SkyRepeaterComponent } from './repeater.component';\n\n@NgModule({\n declarations: [\n SkyRepeaterComponent,\n SkyRepeaterItemComponent,\n SkyRepeaterItemContentComponent,\n SkyRepeaterItemContextMenuComponent,\n SkyRepeaterItemTitleComponent,\n ],\n imports: [\n CommonModule,\n DragulaModule,\n ObserversModule,\n SkyChevronModule,\n SkyCheckboxModule,\n SkyIconModule,\n SkyInlineFormModule,\n SkyListsResourcesModule,\n ],\n exports: [\n SkyRepeaterComponent,\n SkyRepeaterItemComponent,\n SkyRepeaterItemContentComponent,\n SkyRepeaterItemContextMenuComponent,\n SkyRepeaterItemTitleComponent,\n ],\n})\nexport class SkyRepeaterModule {}\n"]}
@@ -11,6 +11,11 @@ export class SkyRepeaterService {
11
11
  this.enableActiveState = false;
12
12
  this.itemCollapseStateChange = new EventEmitter();
13
13
  this.items = [];
14
+ this.itemRole = new BehaviorSubject({
15
+ content: undefined,
16
+ item: undefined,
17
+ title: undefined,
18
+ });
14
19
  this.orderChange = new BehaviorSubject(undefined);
15
20
  }
16
21
  ngOnDestroy() {
@@ -21,7 +26,7 @@ export class SkyRepeaterService {
21
26
  activateItem(item) {
22
27
  if (this.enableActiveState) {
23
28
  /* istanbul ignore else */
24
- if (item) {
29
+ if (item && !item.disabled) {
25
30
  const index = this.items.findIndex((i) => i === item);
26
31
  this.activeItemIndexChange.next(index);
27
32
  this.activeItemChange.next(item);
@@ -36,7 +41,7 @@ export class SkyRepeaterService {
36
41
  }
37
42
  else {
38
43
  const activeItem = this.items[index];
39
- if (activeItem) {
44
+ if (activeItem && !activeItem.disabled) {
40
45
  this.activeItemChange.next(activeItem);
41
46
  }
42
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"repeater.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;;AAIvC;;GAEG;AAEH,MAAM,OAAO,kBAAkB;IAD/B;QAES,qBAAgB,GAAG,IAAI,eAAe,CAC3C,SAAS,CACV,CAAC;QAEK,0BAAqB,GAAG,IAAI,eAAe,CAAS,SAAS,CAAC,CAAC;QAE/D,sBAAiB,GAAG,KAAK,CAAC;QAI1B,4BAAuB,GAAG,IAAI,YAAY,EAA4B,CAAC;QAEvE,UAAK,GAA+B,EAAE,CAAC;QAEvC,gBAAW,GAAG,IAAI,eAAe,CAAO,SAAS,CAAC,CAAC;KA6D3D;IAzDQ,WAAW;QAChB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QACjC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,CAAC;QACxC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAEM,YAAY,CAAC,IAA8B;QAChD,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,0BAA0B;YAC1B,IAAI,IAAI,EAAE;gBACR,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,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AAgB;QACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;;gHA3EU,kBAAkB;oHAAlB,kBAAkB;4FAAlB,kBAAkB;kBAD9B,UAAU","sourcesContent":["import { EventEmitter, Injectable, OnDestroy } from '@angular/core';\n\nimport { BehaviorSubject } from 'rxjs';\n\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyRepeaterService implements OnDestroy {\n public activeItemChange = new BehaviorSubject<SkyRepeaterItemComponent>(\n undefined\n );\n\n public activeItemIndexChange = new BehaviorSubject<number>(undefined);\n\n public enableActiveState = false;\n\n public expandMode: string;\n\n public itemCollapseStateChange = new EventEmitter<SkyRepeaterItemComponent>();\n\n public items: SkyRepeaterItemComponent[] = [];\n\n public orderChange = new BehaviorSubject<void>(undefined);\n\n public repeaterGroupId: number;\n\n public ngOnDestroy(): void {\n this.activeItemChange.complete();\n this.itemCollapseStateChange.complete();\n this.orderChange.complete();\n }\n\n public activateItem(item: SkyRepeaterItemComponent): void {\n if (this.enableActiveState) {\n /* istanbul ignore else */\n if (item) {\n const index = this.items.findIndex((i) => i === item);\n this.activeItemIndexChange.next(index);\n this.activeItemChange.next(item);\n }\n }\n }\n\n public activateItemByIndex(index: number): void {\n /* istanbul ignore else */\n if (this.enableActiveState) {\n if (index === undefined) {\n this.activeItemChange.next(undefined);\n } else {\n const activeItem = this.items[index];\n if (activeItem) {\n this.activeItemChange.next(activeItem);\n }\n }\n }\n }\n\n public registerItem(item: SkyRepeaterItemComponent): void {\n this.items.push(item);\n }\n\n public unregisterItem(item: SkyRepeaterItemComponent): void {\n const indexOfDestroyedItem = this.items.indexOf(item);\n if (indexOfDestroyedItem > -1) {\n this.items.splice(indexOfDestroyedItem, 1);\n }\n }\n\n public onItemCollapseStateChange(item: SkyRepeaterItemComponent): void {\n this.itemCollapseStateChange.emit(item);\n }\n\n public getItemIndex(item: SkyRepeaterItemComponent): number {\n return this.items.indexOf(item);\n }\n\n public registerOrderChange(): void {\n this.orderChange.next();\n }\n\n public reorderItem(oldIndex: number, newIndex: number): void {\n this.items.splice(newIndex, 0, this.items.splice(oldIndex, 1)[0]);\n }\n}\n"]}
1
+ {"version":3,"file":"repeater.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lists/src/lib/modules/repeater/repeater.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;;AAKvC;;GAEG;AAEH,MAAM,OAAO,kBAAkB;IAD/B;QAES,qBAAgB,GAAG,IAAI,eAAe,CAC3C,SAAS,CACV,CAAC;QAEK,0BAAqB,GAAG,IAAI,eAAe,CAAS,SAAS,CAAC,CAAC;QAE/D,sBAAiB,GAAG,KAAK,CAAC;QAI1B,4BAAuB,GAAG,IAAI,YAAY,EAA4B,CAAC;QAEvE,UAAK,GAA+B,EAAE,CAAC;QAE9B,aAAQ,GAAG,IAAI,eAAe,CAA2B;YACvE,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QAEI,gBAAW,GAAG,IAAI,eAAe,CAAO,SAAS,CAAC,CAAC;KA6D3D;IAzDQ,WAAW;QAChB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QACjC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,CAAC;QACxC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAEM,YAAY,CAAC,IAA8B;QAChD,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,0BAA0B;YAC1B,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAA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C,CAAC;IAEM,mBAAmB;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEM,WAAW,CAAC,QAAgB,EAAE,QAAgB;QACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;;gHAjFU,kBAAkB;oHAAlB,kBAAkB;4FAAlB,kBAAkB;kBAD9B,UAAU","sourcesContent":["import { EventEmitter, Injectable, OnDestroy } from '@angular/core';\n\nimport { BehaviorSubject } from 'rxjs';\n\nimport { SkyRepeaterItemRolesType } from './repeater-item-roles.type';\nimport { SkyRepeaterItemComponent } from './repeater-item.component';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyRepeaterService implements OnDestroy {\n public activeItemChange = new BehaviorSubject<SkyRepeaterItemComponent>(\n undefined\n );\n\n public activeItemIndexChange = new BehaviorSubject<number>(undefined);\n\n public enableActiveState = false;\n\n public expandMode: string;\n\n public itemCollapseStateChange = new EventEmitter<SkyRepeaterItemComponent>();\n\n public items: SkyRepeaterItemComponent[] = [];\n\n public readonly itemRole = new BehaviorSubject<SkyRepeaterItemRolesType>({\n content: undefined,\n item: undefined,\n title: undefined,\n });\n\n public orderChange = new BehaviorSubject<void>(undefined);\n\n public repeaterGroupId: number;\n\n public ngOnDestroy(): void {\n this.activeItemChange.complete();\n this.itemCollapseStateChange.complete();\n this.orderChange.complete();\n }\n\n public activateItem(item: SkyRepeaterItemComponent): void {\n if (this.enableActiveState) {\n /* istanbul ignore else */\n if (item && !item.disabled) {\n const index = this.items.findIndex((i) => i === item);\n this.activeItemIndexChange.next(index);\n this.activeItemChange.next(item);\n }\n }\n }\n\n public activateItemByIndex(index: number): void {\n /* istanbul ignore else */\n if (this.enableActiveState) {\n if (index === undefined) {\n this.activeItemChange.next(undefined);\n } else {\n const activeItem = this.items[index];\n if (activeItem && !activeItem.disabled) {\n this.activeItemChange.next(activeItem);\n }\n }\n }\n }\n\n public registerItem(item: SkyRepeaterItemComponent): void {\n this.items.push(item);\n }\n\n public unregisterItem(item: SkyRepeaterItemComponent): void {\n const indexOfDestroyedItem = this.items.indexOf(item);\n if (indexOfDestroyedItem > -1) {\n this.items.splice(indexOfDestroyedItem, 1);\n }\n }\n\n public onItemCollapseStateChange(item: SkyRepeaterItemComponent): void {\n this.itemCollapseStateChange.emit(item);\n }\n\n public getItemIndex(item: SkyRepeaterItemComponent): number {\n return this.items.indexOf(item);\n }\n\n public registerOrderChange(): void {\n this.orderChange.next();\n }\n\n public reorderItem(oldIndex: number, newIndex: number): void {\n this.items.splice(newIndex, 0, this.items.splice(oldIndex, 1)[0]);\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import * as i2 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { NgModule, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, Injectable, ElementRef, ViewEncapsulation, ContentChild, HostBinding, ViewChild, ContentChildren } from '@angular/core';
4
+ import { NgModule, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, Injectable, ElementRef, ViewEncapsulation, HostBinding, ContentChild, ViewChild, ContentChildren, HostListener } from '@angular/core';
5
5
  import * as i1 from '@skyux/indicators';
6
6
  import { SkyIconModule, SkyTokensModule, SkyWaitModule, SkyChevronModule } from '@skyux/indicators';
7
7
  import * as i3 from '@skyux/theme';
@@ -12,6 +12,8 @@ import { Subject, fromEvent, BehaviorSubject, forkJoin } from 'rxjs';
12
12
  import { takeUntil, filter, map } from 'rxjs/operators';
13
13
  import * as i1$1 from '@skyux/core';
14
14
  import { SkyIdModule } from '@skyux/core';
15
+ import * as i4$2 from '@angular/cdk/observers';
16
+ import { ObserversModule } from '@angular/cdk/observers';
15
17
  import * as i6 from '@skyux/forms';
16
18
  import { SkyCheckboxModule } from '@skyux/forms';
17
19
  import * as i4$1 from '@skyux/inline-form';
@@ -719,6 +721,11 @@ class SkyRepeaterService {
719
721
  this.enableActiveState = false;
720
722
  this.itemCollapseStateChange = new EventEmitter();
721
723
  this.items = [];
724
+ this.itemRole = new BehaviorSubject({
725
+ content: undefined,
726
+ item: undefined,
727
+ title: undefined,
728
+ });
722
729
  this.orderChange = new BehaviorSubject(undefined);
723
730
  }
724
731
  ngOnDestroy() {
@@ -729,7 +736,7 @@ class SkyRepeaterService {
729
736
  activateItem(item) {
730
737
  if (this.enableActiveState) {
731
738
  /* istanbul ignore else */
732
- if (item) {
739
+ if (item && !item.disabled) {
733
740
  const index = this.items.findIndex((i) => i === item);
734
741
  this.activeItemIndexChange.next(index);
735
742
  this.activeItemChange.next(item);
@@ -744,7 +751,7 @@ class SkyRepeaterService {
744
751
  }
745
752
  else {
746
753
  const activeItem = this.items[index];
747
- if (activeItem) {
754
+ if (activeItem && !activeItem.disabled) {
748
755
  this.activeItemChange.next(activeItem);
749
756
  }
750
757
  }
@@ -891,6 +898,7 @@ class SkyRepeaterItemComponent {
891
898
  this.keyboardReorderingEnabled = false;
892
899
  this.ngUnsubscribe = new Subject();
893
900
  this._isCollapsible = true;
901
+ this._isDisabled = false;
894
902
  this._isExpanded = true;
895
903
  this._isSelected = false;
896
904
  this.slideForExpanded(false);
@@ -908,6 +916,42 @@ class SkyRepeaterItemComponent {
908
916
  this.reorderMovedText = translatedStrings[4];
909
917
  this.reorderButtonLabel = this.reorderInstructions;
910
918
  });
919
+ this.itemRole$ = this.repeaterService.itemRole.asObservable();
920
+ }
921
+ /**
922
+ * Make the first, non-disabled item tab-focusable.
923
+ * - Disabled items should not be focusable per [W3C](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_disabled_controls).
924
+ * - One item per list/grid/listbox should be tab focusable per [W3C](https://www.w3.org/TR/wai-aria-practices-1.1/#grid).
925
+ */
926
+ get tabindex() {
927
+ return this.repeaterService.items.filter((item) => !item.disabled)[0] ===
928
+ this
929
+ ? 0
930
+ : -1;
931
+ }
932
+ /**
933
+ * Whether to exclude an item when cycling through.
934
+ */
935
+ set disabled(value) {
936
+ if (this._isDisabled !== value) {
937
+ if (value) {
938
+ this.isSelected = false;
939
+ this._isDisabled = true;
940
+ }
941
+ else {
942
+ this._isDisabled = false;
943
+ }
944
+ if (this.isActive) {
945
+ this.repeaterService.activateItemByIndex(undefined);
946
+ }
947
+ if (this.elementRef.nativeElement.matches(':focus-within')) {
948
+ this.elementRef.nativeElement.ownerDocument.activeElement.blur();
949
+ }
950
+ this.changeDetector.markForCheck();
951
+ }
952
+ }
953
+ get disabled() {
954
+ return this._isDisabled;
911
955
  }
912
956
  /**
913
957
  * Indicates whether the repeater item is expanded.
@@ -925,7 +969,7 @@ class SkyRepeaterItemComponent {
925
969
  * @default false
926
970
  */
927
971
  set isSelected(value) {
928
- if (value !== this._isSelected) {
972
+ if (!this.disabled && value !== this._isSelected) {
929
973
  this._isSelected = value;
930
974
  this.isSelectedChange.emit(this._isSelected);
931
975
  }
@@ -974,6 +1018,73 @@ class SkyRepeaterItemComponent {
974
1018
  this.ngUnsubscribe.complete();
975
1019
  this.repeaterService.unregisterItem(this);
976
1020
  }
1021
+ onKeydown($event) {
1022
+ if ([' ', 'Enter', 'Home', 'End', 'ArrowUp', 'ArrowDown'].includes($event.key)) {
1023
+ if ($event.target.matches('input, textarea, select, option, [contenteditable], [contenteditable] *')) {
1024
+ return;
1025
+ }
1026
+ $event.preventDefault();
1027
+ $event.stopPropagation();
1028
+ let activateItem = undefined;
1029
+ /* istanbul ignore else */
1030
+ if ([' ', 'Enter'].includes($event.key)) {
1031
+ if (this.selectable) {
1032
+ this.isSelected = !this.isSelected;
1033
+ }
1034
+ activateItem = this;
1035
+ }
1036
+ /* istanbul ignore else */
1037
+ if (['Home', 'End'].includes($event.key)) {
1038
+ const items = this.repeaterService.items.filter((item) => !item.disabled);
1039
+ if ($event.key === 'Home') {
1040
+ activateItem = items.shift();
1041
+ }
1042
+ else {
1043
+ activateItem = items.pop();
1044
+ }
1045
+ }
1046
+ /* istanbul ignore else */
1047
+ if (['ArrowUp', 'ArrowDown'].includes($event.key)) {
1048
+ const currentIndex = this.repeaterService.items.findIndex((item) => item === this);
1049
+ let sliceFrom;
1050
+ let sliceTo;
1051
+ if ($event.key === 'ArrowUp') {
1052
+ sliceFrom = 0;
1053
+ sliceTo = currentIndex;
1054
+ }
1055
+ else {
1056
+ sliceFrom = currentIndex + 1;
1057
+ sliceTo = undefined;
1058
+ }
1059
+ const items = this.repeaterService.items
1060
+ .slice(sliceFrom, sliceTo)
1061
+ .filter((item) => !item.disabled);
1062
+ activateItem = $event.key === 'ArrowUp' ? items.pop() : items.shift();
1063
+ if (!activateItem) {
1064
+ // Wrap around.
1065
+ if ($event.key === 'ArrowDown') {
1066
+ sliceFrom = 0;
1067
+ sliceTo = currentIndex;
1068
+ }
1069
+ else {
1070
+ sliceFrom = currentIndex + 1;
1071
+ sliceTo = undefined;
1072
+ }
1073
+ const items = this.repeaterService.items
1074
+ .slice(sliceFrom, sliceTo)
1075
+ .filter((item) => !item.disabled);
1076
+ activateItem = $event.key === 'ArrowUp' ? items.pop() : items.shift();
1077
+ }
1078
+ }
1079
+ /* istanbul ignore else */
1080
+ if (activateItem && !activateItem.isActive) {
1081
+ this.repeaterService.activateItem(activateItem);
1082
+ if (!activateItem.elementRef.nativeElement.matches(':focus-within')) {
1083
+ activateItem.elementRef.nativeElement.focus();
1084
+ }
1085
+ }
1086
+ }
1087
+ }
977
1088
  headerClick() {
978
1089
  if (this.isCollapsible) {
979
1090
  this.updateForExpanded(!this.isExpanded, true);
@@ -1081,29 +1192,6 @@ class SkyRepeaterItemComponent {
1081
1192
  this.reorderButtonLabel = this.reorderInstructions;
1082
1193
  this.reorderState = undefined;
1083
1194
  }
1084
- onItemKeyDown(event) {
1085
- /*istanbul ignore else */
1086
- if (event.key) {
1087
- switch (event.key.toLowerCase()) {
1088
- case ' ':
1089
- case 'enter':
1090
- /* istanbul ignore else */
1091
- /* Sanity check */
1092
- // Space/enter should never execute unless focused on the parent item element.
1093
- if (event.target === this.itemRef.nativeElement) {
1094
- if (this.selectable) {
1095
- this.isSelected = !this.isSelected;
1096
- }
1097
- this.repeaterService.activateItem(this);
1098
- event.preventDefault();
1099
- }
1100
- break;
1101
- /* istanbul ignore next */
1102
- default:
1103
- break;
1104
- }
1105
- }
1106
- }
1107
1195
  slideForExpanded(animate) {
1108
1196
  this.slideDirection = this.isExpanded ? 'down' : 'up';
1109
1197
  }
@@ -1156,7 +1244,7 @@ class SkyRepeaterItemComponent {
1156
1244
  }
1157
1245
  }
1158
1246
  SkyRepeaterItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterItemComponent, deps: [{ token: SkyRepeaterService }, { token: i0.ChangeDetectorRef }, { token: SkyRepeaterAdapterService }, { token: i0.ElementRef }, { token: i4.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Component });
1159
- SkyRepeaterItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRepeaterItemComponent, selector: "sky-repeater-item", inputs: { itemName: "itemName", inlineFormConfig: "inlineFormConfig", inlineFormTemplate: "inlineFormTemplate", isExpanded: "isExpanded", isSelected: "isSelected", reorderable: "reorderable", selectable: "selectable", showInlineForm: "showInlineForm", tag: "tag" }, outputs: { collapse: "collapse", expand: "expand", inlineFormClose: "inlineFormClose", isSelectedChange: "isSelectedChange" }, host: { properties: { "class": "this.repeaterGroupClass" } }, queries: [{ propertyName: "contextMenu", first: true, predicate: SkyRepeaterItemContextMenuComponent, descendants: true, read: ElementRef }, { propertyName: "repeaterItemContentComponents", predicate: SkyRepeaterItemContentComponent }], viewQueries: [{ propertyName: "grabHandle", first: true, predicate: ["grabHandle"], descendants: true, read: ElementRef }, { propertyName: "itemContentRef", first: true, predicate: ["itemContentRef"], descendants: true, read: ElementRef }, { propertyName: "itemHeaderRef", first: true, predicate: ["itemHeaderRef"], descendants: true, read: ElementRef }, { propertyName: "itemRef", first: true, predicate: ["itemRef"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n class=\"sky-repeater-item sky-padding-even-default\"\n role=\"option\"\n [attr.aria-label]=\"itemName\"\n [attr.aria-selected]=\"selectable ? isSelected : null\"\n [ngClass]=\"{\n 'sky-repeater-item-active': isActive,\n 'sky-repeater-item-collapsible': isCollapsible,\n 'sky-repeater-item-selected': isSelected\n }\"\n (click)=\"onRepeaterItemClick($event)\"\n (keydown)=\"onItemKeyDown($event)\"\n #itemRef\n>\n <div #inlineDelete>\n <ng-content select=\"sky-inline-delete\"></ng-content>\n </div>\n\n <ng-container *ngIf=\"inlineFormTemplate\">\n <sky-inline-form\n [config]=\"inlineFormConfig\"\n [showForm]=\"showInlineForm\"\n [template]=\"inlineFormTemplate\"\n (close)=\"onInlineFormClose($event)\"\n >\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemLeft\"></ng-container>\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemRight\"></ng-container>\n </sky-inline-form>\n </ng-container>\n\n <ng-container *ngIf=\"!inlineFormTemplate\">\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemLeft\"></ng-container>\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemRight\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #skyRepeaterItemLeft>\n <div class=\"sky-repeater-item-left\">\n <ng-container *ngIf=\"reorderable\">\n <span\n aria-live=\"assertive\"\n class=\"sky-screen-reader-only\"\n [id]=\"contentId + '-reorder-state'\"\n >\n {{ reorderState }}\n </span>\n <span\n class=\"sky-screen-reader-only\"\n [id]=\"contentId + '-reorder-instructions'\"\n >{{ reorderButtonLabel }}</span\n >\n <button\n class=\"sky-btn sky-tile-tools-control sky-repeater-item-grab-handle\"\n type=\"button\"\n [attr.aria-describedby]=\"contentId + '-reorder-instructions'\"\n [attr.aria-label]=\"\n itemName\n ? ('skyux_repeater_item_reorder_label' | skyLibResources: itemName)\n : ('skyux_repeater_item_reorder_label_default' | skyLibResources)\n \"\n (blur)=\"onReorderHandleBlur($event)\"\n (keydown)=\"onReorderHandleKeyDown($event)\"\n #grabHandle\n >\n <sky-icon icon=\"arrows-v\"></sky-icon>\n </button>\n </ng-container>\n <sky-checkbox\n *ngIf=\"selectable\"\n class=\"sky-repeater-item-checkbox\"\n [checked]=\"isSelected\"\n [label]=\"\n itemName\n ? ('skyux_repeater_item_checkbox_label' | skyLibResources: itemName)\n : ('skyux_repeater_item_checkbox_label_default' | skyLibResources)\n \"\n (change)=\"onCheckboxChange($event)\"\n >\n </sky-checkbox>\n <div\n class=\"sky-repeater-item-context-menu\"\n [hidden]=\"contextMenuEl.children.length === 0\"\n #contextMenuEl\n >\n <ng-content select=\"sky-repeater-item-context-menu\"></ng-content>\n </div>\n </div>\n</ng-template>\n\n<ng-template #skyRepeaterItemRight>\n <div class=\"sky-repeater-item-right\" #itemHeaderRef>\n <div\n class=\"sky-repeater-item-header\"\n [hidden]=\"titleRef.children.length === 0\"\n (click)=\"headerClick()\"\n >\n <div class=\"sky-repeater-item-title sky-emphasized\" #titleRef>\n <ng-content select=\"sky-repeater-item-title\"></ng-content>\n </div>\n <button\n *ngIf=\"reorderable\"\n class=\"sky-btn sky-btn-link sky-repeater-item-reorder-top\"\n type=\"button\"\n [attr.aria-label]=\"\n itemName\n ? ('skyux_repeater_item_reorder_top_label'\n | skyLibResources: itemName)\n : ('skyux_repeater_item_reorder_top_label_default'\n | skyLibResources)\n \"\n (click)=\"moveToTop($event)\"\n >\n <sky-icon icon=\"arrow-circle-up\"></sky-icon>\n {{ 'skyux_repeater_item_reorder_top' | skyLibResources }}\n </button>\n <div *ngIf=\"isCollapsible\" class=\"sky-repeater-item-chevron\">\n <sky-chevron\n [ariaControls]=\"contentId\"\n [ariaLabel]=\"\n itemName\n ? ('skyux_repeater_item_expand' | skyLibResources: itemName)\n : ('skyux_repeater_item_expand_default' | skyLibResources)\n \"\n [direction]=\"isExpanded ? 'up' : 'down'\"\n (directionChange)=\"chevronDirectionChange($event)\"\n >\n </sky-chevron>\n </div>\n <!-- Used for when the chevron is hidden to ensure that the right side is the same height as the left.-->\n <div\n *ngIf=\"!isCollapsible && !contextMenu\"\n class=\"sky-repeater-item-chevron-placeholder\"\n ></div>\n <!-- Used to ensure that the right side is the same height as the left.-->\n <div\n *ngIf=\"contextMenu\"\n class=\"sky-repeater-item-chevron-placeholder-with-context\"\n ></div>\n </div>\n <div\n class=\"sky-repeater-item-content\"\n [id]=\"contentId\"\n [@skyAnimationSlide]=\"slideDirection\"\n #itemContentRef\n >\n <ng-content select=\"sky-repeater-item-content\"></ng-content>\n </div>\n </div>\n</ng-template>\n", styles: ["sky-repeater-item .sky-repeater-item{display:flex;border-bottom:1px dotted #cdcfd2;padding-top:0;position:relative;transition:box-shadow .15s;align-items:flex-start}sky-repeater-item .sky-repeater-item sky-inline-form{display:block;width:100%}sky-repeater-item .sky-repeater-item sky-inline-form>:first-child,sky-repeater-item .sky-repeater-item sky-inline-form .sky-slide-dissolve-first,sky-repeater-item .sky-repeater-item sky-inline-form .sky-slide-dissolve-last{display:flex;flex:1 0 auto;width:100%}sky-repeater-item .sky-repeater-item sky-inline-form .sky-slide-dissolve-last{padding-top:10px}sky-repeater-item .sky-repeater-item.sky-repeater-item-active{background-color:#eeeeef;color:#212327;padding-left:6px;border-left:4px solid #00b4f1}sky-repeater-item .sky-repeater-item.sky-repeater-item-active .sky-inline-delete{margin-left:-4px;width:calc(100% + 4px)}sky-repeater-item .sky-repeater-item-left{display:flex;padding-top:10px;align-items:center}sky-repeater-item .sky-repeater-item-left sky-checkbox{display:flex}sky-repeater-item .sky-repeater-item-right{max-width:100%;flex-grow:1;align-self:center}sky-repeater-item .sky-repeater-item-header{align-items:center;display:flex;padding-top:10px}sky-repeater-item .sky-repeater-item-chevron{margin-left:10px}sky-repeater-item .sky-repeater-item-chevron-placeholder{height:24px}sky-repeater-item .sky-repeater-item-chevron-placeholder-with-context{height:29px}sky-repeater-item .sky-repeater-item-context-menu{padding:0 10px 0 0}sky-repeater-item .sky-repeater-item-checkbox{padding:0 5px 0 0}sky-repeater-item .sky-repeater-item-selected{background-color:#f1eef6;transition:background-color .15s}sky-repeater-item .sky-repeater-item-title{margin:0;flex-grow:1;line-height:1.1;color:#212327}sky-repeater-item sky-repeater-item-content{display:block;margin:10px 0 0}sky-repeater-item .sky-repeater-item-collapsible .sky-repeater-item-header{cursor:pointer}sky-repeater-item .sky-repeater-item-collapsible .sky-repeater-item-content{padding-right:34px}sky-repeater-item .sky-repeater-item-collapsed .sky-repeater-item-content{display:none}sky-repeater-item .sky-repeater-item-grab-handle{color:#cdcfd2;cursor:pointer;border:0;width:24px;height:24px;cursor:grab;cursor:-moz-grab;padding:0;margin-right:10px}sky-repeater-item .sky-repeater-item-grab-handle:hover{color:#979ba2;transition:color .15s}sky-repeater-item.sky-repeater-item-dragging.gu-mirror{opacity:initial;-ms-filter:initial;filter:initial;background-color:#fff;box-shadow:0 0 5px #0000004d}sky-repeater-item.sky-repeater-item-dragging.gu-transit .sky-repeater-item{background-color:#d8d8d8}sky-repeater-item.sky-repeater-item-dragging.gu-transit .sky-repeater-item .sky-repeater-item-left,sky-repeater-item.sky-repeater-item-dragging.gu-transit .sky-repeater-item .sky-repeater-item-right{visibility:hidden}sky-repeater-item.sky-repeater-item-dragging .sky-repeater-item-grab-handle{cursor:grabbing;cursor:-webkit-grabbing}.sky-theme-modern sky-repeater-item .sky-repeater-item{padding-bottom:20px}.sky-theme-modern sky-repeater-item .sky-repeater-item.sky-repeater-item-active{background-color:transparent;border-left-color:#1870b8}.sky-theme-modern sky-repeater-item .sky-repeater-item:focus,.sky-theme-modern sky-repeater-item .sky-repeater-item:active:focus{outline:solid 2px #1870B8;outline-offset:-2px}.sky-theme-modern sky-repeater-item .sky-repeater-item:focus:not(:active){box-shadow:0 1px 8px #0000004d}.sky-theme-modern sky-repeater-item .sky-repeater-item-header[hidden]+.sky-repeater-item-content sky-repeater-item-content{margin:20px 0 0}.sky-theme-modern sky-repeater-item .sky-repeater-item-header,.sky-theme-modern sky-repeater-item .sky-repeater-item-left{padding-top:20px}.sky-theme-modern sky-repeater-item sky-inline-form .sky-slide-dissolve-last{padding-top:20px}.sky-theme-modern.sky-theme-mode-dark sky-repeater-item .sky-repeater-item{border-bottom-color:#686c73}.sky-theme-modern.sky-theme-mode-dark sky-repeater-item .sky-repeater-item.sky-repeater-item-active{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark sky-repeater-item .sky-repeater-item-title{color:#fbfcfe}\n"], components: [{ type: i4$1.λ1, selector: "sky-inline-form", inputs: ["config", "template", "showForm"], outputs: ["close"] }, { type: i1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i1.λ2, selector: "sky-chevron", inputs: ["ariaControls", "ariaLabel", "direction", "disabled"], outputs: ["directionChange"] }], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i4.SkyLibResourcesPipe }, animations: [skyAnimationSlide], encapsulation: i0.ViewEncapsulation.None });
1247
+ SkyRepeaterItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRepeaterItemComponent, selector: "sky-repeater-item", inputs: { disabled: "disabled", itemName: "itemName", inlineFormConfig: "inlineFormConfig", inlineFormTemplate: "inlineFormTemplate", isExpanded: "isExpanded", isSelected: "isSelected", reorderable: "reorderable", selectable: "selectable", showInlineForm: "showInlineForm", tag: "tag" }, outputs: { collapse: "collapse", expand: "expand", inlineFormClose: "inlineFormClose", isSelectedChange: "isSelectedChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "tabindex": "this.tabindex", "class": "this.repeaterGroupClass" } }, queries: [{ propertyName: "contextMenu", first: true, predicate: SkyRepeaterItemContextMenuComponent, descendants: true, read: ElementRef }, { propertyName: "repeaterItemContentComponents", predicate: SkyRepeaterItemContentComponent }], viewQueries: [{ propertyName: "grabHandle", first: true, predicate: ["grabHandle"], descendants: true, read: ElementRef }, { propertyName: "itemContentRef", first: true, predicate: ["itemContentRef"], descendants: true, read: ElementRef }, { propertyName: "itemHeaderRef", first: true, predicate: ["itemHeaderRef"], descendants: true, read: ElementRef }, { propertyName: "itemRef", first: true, predicate: ["itemRef"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n class=\"sky-repeater-item sky-padding-even-default\"\n [attr.aria-label]=\"itemName\"\n [attr.aria-selected]=\"selectable ? isSelected : undefined\"\n [attr.role]=\"(itemRole$ | async).item\"\n [ngClass]=\"{\n 'sky-repeater-item-active': isActive,\n 'sky-repeater-item-collapsible': isCollapsible,\n 'sky-repeater-item-selected': isSelected\n }\"\n (click)=\"onRepeaterItemClick($event)\"\n #itemRef\n>\n <div #inlineDelete>\n <ng-content select=\"sky-inline-delete\"></ng-content>\n </div>\n\n <ng-container *ngIf=\"inlineFormTemplate\">\n <sky-inline-form\n [config]=\"inlineFormConfig\"\n [showForm]=\"showInlineForm\"\n [template]=\"inlineFormTemplate\"\n (close)=\"onInlineFormClose($event)\"\n >\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemLeft\"></ng-container>\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemRight\"></ng-container>\n </sky-inline-form>\n </ng-container>\n\n <ng-container *ngIf=\"!inlineFormTemplate\">\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemLeft\"></ng-container>\n <ng-container *ngTemplateOutlet=\"skyRepeaterItemRight\"></ng-container>\n </ng-container>\n</div>\n\n<ng-template #skyRepeaterItemLeft>\n <div class=\"sky-repeater-item-left\">\n <ng-container *ngIf=\"reorderable\">\n <span\n aria-live=\"assertive\"\n class=\"sky-screen-reader-only\"\n [id]=\"contentId + '-reorder-state'\"\n >\n {{ reorderState }}\n </span>\n <span\n class=\"sky-screen-reader-only\"\n [id]=\"contentId + '-reorder-instructions'\"\n >{{ reorderButtonLabel }}</span\n >\n <button\n class=\"sky-btn sky-tile-tools-control sky-repeater-item-grab-handle\"\n type=\"button\"\n [attr.aria-describedby]=\"contentId + '-reorder-instructions'\"\n [attr.aria-label]=\"\n itemName\n ? ('skyux_repeater_item_reorder_label' | skyLibResources: itemName)\n : ('skyux_repeater_item_reorder_label_default' | skyLibResources)\n \"\n (blur)=\"onReorderHandleBlur($event)\"\n (keydown)=\"onReorderHandleKeyDown($event)\"\n #grabHandle\n >\n <sky-icon icon=\"arrows-v\"></sky-icon>\n </button>\n </ng-container>\n <sky-checkbox\n *ngIf=\"selectable\"\n class=\"sky-repeater-item-checkbox\"\n [checked]=\"isSelected\"\n [label]=\"\n itemName\n ? ('skyux_repeater_item_checkbox_label' | skyLibResources: itemName)\n : ('skyux_repeater_item_checkbox_label_default' | skyLibResources)\n \"\n (change)=\"onCheckboxChange($event)\"\n >\n </sky-checkbox>\n <div\n class=\"sky-repeater-item-context-menu\"\n [hidden]=\"contextMenuEl.children.length === 0\"\n #contextMenuEl\n >\n <ng-content select=\"sky-repeater-item-context-menu\"></ng-content>\n </div>\n </div>\n</ng-template>\n\n<ng-template #skyRepeaterItemRight>\n <div class=\"sky-repeater-item-right\" #itemHeaderRef>\n <div\n class=\"sky-repeater-item-header\"\n [hidden]=\"titleRef.children.length === 0\"\n (click)=\"headerClick()\"\n >\n <div\n class=\"sky-repeater-item-title sky-emphasized\"\n #titleRef\n [attr.role]=\"(itemRole$ | async).title\"\n >\n <ng-content select=\"sky-repeater-item-title\"></ng-content>\n </div>\n <button\n *ngIf=\"reorderable\"\n class=\"sky-btn sky-btn-link sky-repeater-item-reorder-top\"\n type=\"button\"\n [attr.aria-label]=\"\n itemName\n ? ('skyux_repeater_item_reorder_top_label'\n | skyLibResources: itemName)\n : ('skyux_repeater_item_reorder_top_label_default'\n | skyLibResources)\n \"\n (click)=\"moveToTop($event)\"\n >\n <sky-icon icon=\"arrow-circle-up\"></sky-icon>\n {{ 'skyux_repeater_item_reorder_top' | skyLibResources }}\n </button>\n <div *ngIf=\"isCollapsible\" class=\"sky-repeater-item-chevron\">\n <sky-chevron\n [ariaControls]=\"contentId\"\n [ariaLabel]=\"\n itemName\n ? ('skyux_repeater_item_expand' | skyLibResources: itemName)\n : ('skyux_repeater_item_expand_default' | skyLibResources)\n \"\n [direction]=\"isExpanded ? 'up' : 'down'\"\n (directionChange)=\"chevronDirectionChange($event)\"\n >\n </sky-chevron>\n </div>\n <!-- Used for when the chevron is hidden to ensure that the right side is the same height as the left.-->\n <div\n *ngIf=\"!isCollapsible && !contextMenu\"\n class=\"sky-repeater-item-chevron-placeholder\"\n ></div>\n <!-- Used to ensure that the right side is the same height as the left.-->\n <div\n *ngIf=\"contextMenu\"\n class=\"sky-repeater-item-chevron-placeholder-with-context\"\n ></div>\n </div>\n <div\n class=\"sky-repeater-item-content\"\n [id]=\"contentId\"\n [@skyAnimationSlide]=\"slideDirection\"\n #itemContentRef\n [attr.role]=\"(itemRole$ | async).content\"\n >\n <ng-content select=\"sky-repeater-item-content\"></ng-content>\n </div>\n </div>\n</ng-template>\n", styles: ["sky-repeater-item .sky-repeater-item{display:flex;border-bottom:1px dotted #cdcfd2;padding-top:0;position:relative;transition:box-shadow .15s;align-items:flex-start}sky-repeater-item .sky-repeater-item sky-inline-form{display:block;width:100%}sky-repeater-item .sky-repeater-item sky-inline-form>:first-child,sky-repeater-item .sky-repeater-item sky-inline-form .sky-slide-dissolve-first,sky-repeater-item .sky-repeater-item sky-inline-form .sky-slide-dissolve-last{display:flex;flex:1 0 auto;width:100%}sky-repeater-item .sky-repeater-item sky-inline-form .sky-slide-dissolve-last{padding-top:10px}sky-repeater-item .sky-repeater-item.sky-repeater-item-active{background-color:#eeeeef;color:#212327;padding-left:6px;border-left:4px solid #00b4f1}sky-repeater-item .sky-repeater-item.sky-repeater-item-active .sky-inline-delete{margin-left:-4px;width:calc(100% + 4px)}sky-repeater-item .sky-repeater-item-left{display:flex;padding-top:10px;align-items:center}sky-repeater-item .sky-repeater-item-left sky-checkbox{display:flex}sky-repeater-item .sky-repeater-item-right{max-width:100%;flex-grow:1;align-self:center}sky-repeater-item .sky-repeater-item-header{align-items:center;display:flex;padding-top:10px}sky-repeater-item .sky-repeater-item-chevron{margin-left:10px}sky-repeater-item .sky-repeater-item-chevron-placeholder{height:24px}sky-repeater-item .sky-repeater-item-chevron-placeholder-with-context{height:29px}sky-repeater-item .sky-repeater-item-context-menu{padding:0 10px 0 0}sky-repeater-item .sky-repeater-item-checkbox{padding:0 5px 0 0}sky-repeater-item .sky-repeater-item-selected{background-color:#f1eef6;transition:background-color .15s}sky-repeater-item .sky-repeater-item-title{margin:0;flex-grow:1;line-height:1.1;color:#212327}sky-repeater-item sky-repeater-item-content{display:block;margin:10px 0 0}sky-repeater-item .sky-repeater-item-collapsible .sky-repeater-item-header{cursor:pointer}sky-repeater-item .sky-repeater-item-collapsible .sky-repeater-item-content{padding-right:34px}sky-repeater-item .sky-repeater-item-collapsed .sky-repeater-item-content{display:none}sky-repeater-item .sky-repeater-item-grab-handle{color:#cdcfd2;cursor:pointer;border:0;width:24px;height:24px;cursor:grab;cursor:-moz-grab;padding:0;margin-right:10px}sky-repeater-item .sky-repeater-item-grab-handle:hover{color:#979ba2;transition:color .15s}sky-repeater-item.sky-repeater-item-dragging.gu-mirror{opacity:initial;-ms-filter:initial;filter:initial;background-color:#fff;box-shadow:0 0 5px #0000004d}sky-repeater-item.sky-repeater-item-dragging.gu-transit .sky-repeater-item{background-color:#d8d8d8}sky-repeater-item.sky-repeater-item-dragging.gu-transit .sky-repeater-item .sky-repeater-item-left,sky-repeater-item.sky-repeater-item-dragging.gu-transit .sky-repeater-item .sky-repeater-item-right{visibility:hidden}sky-repeater-item.sky-repeater-item-dragging .sky-repeater-item-grab-handle{cursor:grabbing;cursor:-webkit-grabbing}.sky-theme-modern sky-repeater-item .sky-repeater-item{padding-bottom:20px}.sky-theme-modern sky-repeater-item .sky-repeater-item.sky-repeater-item-active{background-color:transparent;border-left-color:#1870b8}.sky-theme-modern sky-repeater-item .sky-repeater-item:focus,.sky-theme-modern sky-repeater-item .sky-repeater-item:active:focus{outline:solid 2px #1870B8;outline-offset:-2px}.sky-theme-modern sky-repeater-item .sky-repeater-item:focus:not(:active){box-shadow:0 1px 8px #0000004d}.sky-theme-modern sky-repeater-item .sky-repeater-item-header[hidden]+.sky-repeater-item-content sky-repeater-item-content{margin:20px 0 0}.sky-theme-modern sky-repeater-item .sky-repeater-item-header,.sky-theme-modern sky-repeater-item .sky-repeater-item-left{padding-top:20px}.sky-theme-modern sky-repeater-item sky-inline-form .sky-slide-dissolve-last{padding-top:20px}.sky-theme-modern.sky-theme-mode-dark sky-repeater-item .sky-repeater-item{border-bottom-color:#686c73}.sky-theme-modern.sky-theme-mode-dark sky-repeater-item .sky-repeater-item.sky-repeater-item-active{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark sky-repeater-item .sky-repeater-item-title{color:#fbfcfe}\n"], components: [{ type: i4$1.λ1, selector: "sky-inline-form", inputs: ["config", "template", "showForm"], outputs: ["close"] }, { type: i1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { type: i6.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i1.λ2, selector: "sky-chevron", inputs: ["ariaControls", "ariaLabel", "direction", "disabled"], outputs: ["directionChange"] }], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i2.AsyncPipe, "skyLibResources": i4.SkyLibResourcesPipe }, animations: [skyAnimationSlide], encapsulation: i0.ViewEncapsulation.None });
1160
1248
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterItemComponent, decorators: [{
1161
1249
  type: Component,
1162
1250
  args: [{
@@ -1166,7 +1254,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1166
1254
  animations: [skyAnimationSlide],
1167
1255
  encapsulation: ViewEncapsulation.None,
1168
1256
  }]
1169
- }], ctorParameters: function () { return [{ type: SkyRepeaterService }, { type: i0.ChangeDetectorRef }, { type: SkyRepeaterAdapterService }, { type: i0.ElementRef }, { type: i4.SkyLibResourcesService }]; }, propDecorators: { itemName: [{
1257
+ }], ctorParameters: function () { return [{ type: SkyRepeaterService }, { type: i0.ChangeDetectorRef }, { type: SkyRepeaterAdapterService }, { type: i0.ElementRef }, { type: i4.SkyLibResourcesService }]; }, propDecorators: { tabindex: [{
1258
+ type: HostBinding
1259
+ }], disabled: [{
1260
+ type: Input
1261
+ }], itemName: [{
1170
1262
  type: Input
1171
1263
  }], inlineFormConfig: [{
1172
1264
  type: Input
@@ -1213,6 +1305,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1213
1305
  }], repeaterItemContentComponents: [{
1214
1306
  type: ContentChildren,
1215
1307
  args: [SkyRepeaterItemContentComponent]
1308
+ }], onKeydown: [{
1309
+ type: HostListener,
1310
+ args: ['keydown', ['$event']]
1216
1311
  }] } });
1217
1312
 
1218
1313
  let uniqueId = 0;
@@ -1325,6 +1420,7 @@ class SkyRepeaterComponent {
1325
1420
  if (this.activeIndex !== undefined) {
1326
1421
  this.repeaterService.activateItemByIndex(this.activeIndex);
1327
1422
  }
1423
+ this.updateRole();
1328
1424
  });
1329
1425
  });
1330
1426
  setTimeout(() => {
@@ -1332,6 +1428,7 @@ class SkyRepeaterComponent {
1332
1428
  this.items.forEach((item) => {
1333
1429
  item.reorderable = this.reorderable;
1334
1430
  });
1431
+ this.updateRole();
1335
1432
  }, 0);
1336
1433
  }
1337
1434
  ngOnChanges(changes) {
@@ -1346,6 +1443,7 @@ class SkyRepeaterComponent {
1346
1443
  if (this.items) {
1347
1444
  this.items.forEach((item) => (item.reorderable = this.reorderable));
1348
1445
  }
1446
+ this.updateRole();
1349
1447
  this.changeDetector.markForCheck();
1350
1448
  }
1351
1449
  }
@@ -1354,6 +1452,12 @@ class SkyRepeaterComponent {
1354
1452
  this.ngUnsubscribe.complete();
1355
1453
  this.destroyDragAndDrop();
1356
1454
  }
1455
+ ngOnInit() {
1456
+ this.updateRole();
1457
+ }
1458
+ onCdkObserveContent() {
1459
+ this.updateRole();
1460
+ }
1357
1461
  updateForExpandMode(itemAdded) {
1358
1462
  if (this.items) {
1359
1463
  let foundExpanded = false;
@@ -1372,6 +1476,7 @@ class SkyRepeaterComponent {
1372
1476
  foundExpanded = true;
1373
1477
  }
1374
1478
  });
1479
+ this.updateRole();
1375
1480
  }
1376
1481
  }
1377
1482
  initializeDragAndDrop() {
@@ -1436,9 +1541,59 @@ class SkyRepeaterComponent {
1436
1541
  return item.tag !== undefined;
1437
1542
  });
1438
1543
  }
1544
+ updateRole() {
1545
+ // Determine a role using a hierarchy based on https://www.w3.org/TR/wai-aria-practices-1.1/
1546
+ // 1. If there are one or more interactions in the repeater item projected content, use grid.
1547
+ // 2. If there are selectable repeater items and no other interactions, use listbox.
1548
+ // 3. If there are no interactions, use list.
1549
+ var _a, _b;
1550
+ // Default to list role.
1551
+ let autoRole = 'list';
1552
+ const roleMap = {
1553
+ list: { item: 'listitem', title: undefined, content: undefined },
1554
+ listbox: { item: 'option', title: undefined, content: undefined },
1555
+ grid: { item: 'row', title: 'rowheader', content: 'gridcell' },
1556
+ };
1557
+ // Based on https://html.spec.whatwg.org/multipage/dom.html#interactive-content
1558
+ const interactionSelector = [
1559
+ 'a[href]',
1560
+ 'audio[controls]',
1561
+ 'button',
1562
+ 'details',
1563
+ 'embed',
1564
+ 'iframe',
1565
+ 'img[usemap]',
1566
+ 'input:not([type="hidden"])',
1567
+ 'label',
1568
+ 'select',
1569
+ 'textarea',
1570
+ 'video[controls]',
1571
+ '[contenteditable]',
1572
+ '.sky-repeater[role="grid"]',
1573
+ ]
1574
+ .map((selector) => `sky-repeater-item-title ${selector}:not([hidden]), sky-repeater-item-content ${selector}:not([hidden])`)
1575
+ .concat([`skyux-dropdown`])
1576
+ .join(', ');
1577
+ const hasInteraction = this.reorderable ||
1578
+ ((_a = this.items) === null || _a === void 0 ? void 0 : _a.some((item) => item.isCollapsible)) ||
1579
+ !!this.elementRef.nativeElement.querySelector(interactionSelector);
1580
+ if (hasInteraction) {
1581
+ // If the repeater matches interaction selector https://www.w3.org/TR/wai-aria-practices-1.1/#grid
1582
+ autoRole = 'grid';
1583
+ }
1584
+ else if ((_b = this.items) === null || _b === void 0 ? void 0 : _b.some((item) => item.selectable)) {
1585
+ // If the only interaction is select https://www.w3.org/TR/wai-aria-practices-1.1/#Listbox
1586
+ autoRole = 'listbox';
1587
+ }
1588
+ if (this.role !== autoRole) {
1589
+ this.repeaterService.itemRole.next(Object.assign({}, roleMap[autoRole]));
1590
+ this.role = `${autoRole}`;
1591
+ this.changeDetector.markForCheck();
1592
+ }
1593
+ }
1439
1594
  }
1440
1595
  SkyRepeaterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkyRepeaterService }, { token: SkyRepeaterAdapterService }, { token: i3$1.DragulaService }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1441
- SkyRepeaterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRepeaterComponent, selector: "sky-repeater", inputs: { activeIndex: "activeIndex", ariaLabel: "ariaLabel", reorderable: "reorderable", expandMode: "expandMode" }, outputs: { activeIndexChange: "activeIndexChange", orderChange: "orderChange" }, providers: [SkyRepeaterService, SkyRepeaterAdapterService], queries: [{ propertyName: "items", predicate: SkyRepeaterItemComponent }], usesOnChanges: true, ngImport: i0, template: "<ng-container #repeaterHost>\n <div\n class=\"sky-repeater\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel || ('skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n >\n <ng-content></ng-content>\n </div>\n</ng-container>\n", styles: [".sky-repeater{padding:0}\n"], directives: [{ type: i3$1.DragulaDirective, selector: "[dragula]", inputs: ["dragula", "dragulaModel", "dragulaOptions"] }], pipes: { "skyLibResources": i4.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1596
+ SkyRepeaterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyRepeaterComponent, selector: "sky-repeater", inputs: { activeIndex: "activeIndex", ariaLabel: "ariaLabel", reorderable: "reorderable", expandMode: "expandMode" }, outputs: { activeIndexChange: "activeIndexChange", orderChange: "orderChange" }, providers: [SkyRepeaterService, SkyRepeaterAdapterService], queries: [{ propertyName: "items", predicate: SkyRepeaterItemComponent }], usesOnChanges: true, ngImport: i0, template: "<ng-container #repeaterHost>\n <div\n class=\"sky-repeater\"\n [attr.role]=\"role\"\n [attr.aria-label]=\"ariaLabel || ('skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n (cdkObserveContent)=\"onCdkObserveContent()\"\n >\n <ng-content></ng-content>\n </div>\n</ng-container>\n", styles: [".sky-repeater{padding:0}\n"], directives: [{ type: i3$1.DragulaDirective, selector: "[dragula]", inputs: ["dragula", "dragulaModel", "dragulaOptions"] }, { type: i4$2.CdkObserveContent, selector: "[cdkObserveContent]", inputs: ["cdkObserveContentDisabled", "debounce"], outputs: ["cdkObserveContent"], exportAs: ["cdkObserveContent"] }], pipes: { "skyLibResources": i4.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1442
1597
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterComponent, decorators: [{
1443
1598
  type: Component,
1444
1599
  args: [{
@@ -1474,6 +1629,7 @@ SkyRepeaterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versi
1474
1629
  SkyRepeaterItemContextMenuComponent,
1475
1630
  SkyRepeaterItemTitleComponent], imports: [CommonModule,
1476
1631
  DragulaModule,
1632
+ ObserversModule,
1477
1633
  SkyChevronModule,
1478
1634
  SkyCheckboxModule,
1479
1635
  SkyIconModule,
@@ -1486,6 +1642,7 @@ SkyRepeaterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versi
1486
1642
  SkyRepeaterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRepeaterModule, imports: [[
1487
1643
  CommonModule,
1488
1644
  DragulaModule,
1645
+ ObserversModule,
1489
1646
  SkyChevronModule,
1490
1647
  SkyCheckboxModule,
1491
1648
  SkyIconModule,
@@ -1505,6 +1662,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
1505
1662
  imports: [
1506
1663
  CommonModule,
1507
1664
  DragulaModule,
1665
+ ObserversModule,
1508
1666
  SkyChevronModule,
1509
1667
  SkyCheckboxModule,
1510
1668
  SkyIconModule,