@nova-ui/bits 12.0.2 → 12.0.4-3486
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.
- package/bundles/nova-ui-bits.umd.js +63 -33
- package/bundles/nova-ui-bits.umd.js.map +1 -1
- package/esm2015/lib/docs/example-code/example-code.component.js +2 -1
- package/esm2015/lib/repeat/repeat-item/repeat-item.component.js +6 -4
- package/esm2015/lib/repeat/repeat.component.js +56 -32
- package/esm2015/lib/repeat/types.js +1 -1
- package/fesm2015/nova-ui-bits.js +59 -33
- package/fesm2015/nova-ui-bits.js.map +1 -1
- package/lib/docs/example-code/example-code.component.d.ts +1 -0
- package/lib/repeat/repeat-item/repeat-item.component.d.ts +2 -0
- package/lib/repeat/repeat.component.d.ts +11 -3
- package/nova-ui-bits.metadata.json +1 -1
- package/package.json +1 -1
- package/sdk/atoms/components/repeat/repeat.atom.d.ts +3 -0
- package/sdk/atoms/components/repeat/repeat.atom.js +20 -7
- package/sdk/atoms/components/repeat/repeat.atom.js.map +1 -1
package/fesm2015/nova-ui-bits.js
CHANGED
|
@@ -12555,13 +12555,14 @@ class RepeatItemComponent {
|
|
|
12555
12555
|
this.nowrap = false;
|
|
12556
12556
|
this.selected = false;
|
|
12557
12557
|
this.selectable = false;
|
|
12558
|
+
this.rowClicked = new EventEmitter();
|
|
12558
12559
|
}
|
|
12559
12560
|
get role() { return this.selectable ? "option" : "listitem"; }
|
|
12560
12561
|
}
|
|
12561
12562
|
RepeatItemComponent.decorators = [
|
|
12562
12563
|
{ type: Component, args: [{
|
|
12563
12564
|
selector: "nui-repeat-item",
|
|
12564
|
-
template: "<li class=\"nui-repeat-item\"\n [
|
|
12565
|
+
template: "<li class=\"nui-repeat-item\"\n [class.nui-repeat-item--selected]=\"selected\"\n [class.text-nowrap]=\"nowrap\"\n [class.nui-repeat-item--clickable]=\"clickable\"\n (click)=\"clickable ? rowClicked.emit($event) : null\"\n tabindex=\"-1\">\n <div class=\"nui-repeat-item__content\">\n <ng-content></ng-content>\n </div>\n</li>\n",
|
|
12565
12566
|
encapsulation: ViewEncapsulation.None,
|
|
12566
12567
|
host: { "[attr.role]": "role" },
|
|
12567
12568
|
styles: ["body>nui-repeat-item.cdk-drag-preview .nui-repeat-item{list-style-type:none}body>nui-repeat-item.cdk-drag-preview .nui-repeat-item__controls-drag-handle{display:none}.nui .nui-repeat-item:active,.nui .nui-repeat-item:focus{outline:none}.nui .nui-repeat-item:hover{background-color:var(--nui-color-bg-secondary,#fafafa)}.nui .nui-repeat-item__content{display:flex}.nui .nui-repeat-item__controls-drag-handle{height:16px}.nui .nui-repeat-item__controls-drag-handle .nui-dnd-handle:hover{cursor:move}.nui .nui-repeat-item__controls-container{padding-left:3px}.nui .nui-repeat-item__controls-container .nui-repeat-item__checkbox .nui-checkbox{display:flex;justify-content:center;width:30px;height:30px}.nui .nui-repeat-item__controls-container .nui-repeat-item__checkbox .nui-checkbox__label:hover{background-color:transparent}.nui .nui-repeat-item__controls-container .nui-repeat-item__checkbox .nui-checkbox__transclude{margin-left:0}.nui .nui-repeat-item__content-container{min-height:30px;flex-grow:1;display:flex;align-items:center;margin-left:5px;margin-right:10px;min-width:0}.nui .nui-repeat-item__actions-container{margin-left:5px;display:flex;align-items:flex-start}.nui .nui-repeat-item__actions-container .btn-action:focus{background-color:transparent}.nui .nui-repeat-item.nui-repeat-item--clickable:not(.nui-repeat-item--selected):hover{background-color:var(--nui-color-bg-secondary,#fafafa)}.nui .nui-repeat-item.nui-repeat-item--selected{background-color:var(--nui-color-selected,rgba(0, 196, 210, .1));color:var(--nui-color-text-default,#111)}.nui .nui-repeat-item.nui-repeat-item--selected.nui-repeat-item--clickable:hover{background-color:var(--nui-color-selected-hover,rgba(0, 196, 210, .2))}\n"]
|
|
@@ -12571,7 +12572,8 @@ RepeatItemComponent.propDecorators = {
|
|
|
12571
12572
|
clickable: [{ type: Input }],
|
|
12572
12573
|
nowrap: [{ type: Input }],
|
|
12573
12574
|
selected: [{ type: Input }],
|
|
12574
|
-
selectable: [{ type: Input }]
|
|
12575
|
+
selectable: [{ type: Input }],
|
|
12576
|
+
rowClicked: [{ type: Output }]
|
|
12575
12577
|
};
|
|
12576
12578
|
|
|
12577
12579
|
/**
|
|
@@ -12593,6 +12595,10 @@ class RepeatComponent {
|
|
|
12593
12595
|
* This will stretch repeat items full width
|
|
12594
12596
|
*/
|
|
12595
12597
|
this.width = "100%";
|
|
12598
|
+
/**
|
|
12599
|
+
* Prevent item bodies from capturing clicks
|
|
12600
|
+
*/
|
|
12601
|
+
this.preventRowClick = false;
|
|
12596
12602
|
/**
|
|
12597
12603
|
* Drag preview class that is applied on the previewed item
|
|
12598
12604
|
*
|
|
@@ -12625,8 +12631,6 @@ class RepeatComponent {
|
|
|
12625
12631
|
*/
|
|
12626
12632
|
this.selectionChange = new EventEmitter();
|
|
12627
12633
|
this.mousedOver = [];
|
|
12628
|
-
// Note: workaround to be able to use enum values in template
|
|
12629
|
-
this.repeatSelectionMode = RepeatSelectionMode;
|
|
12630
12634
|
this.selectionHasChanged = false;
|
|
12631
12635
|
/** Emits when the drop list has been destroyed. */
|
|
12632
12636
|
this.dropListDestroyed = new Subject();
|
|
@@ -12683,11 +12687,18 @@ class RepeatComponent {
|
|
|
12683
12687
|
return this._viewportRef;
|
|
12684
12688
|
}
|
|
12685
12689
|
get role() {
|
|
12686
|
-
return this.selectionMode !==
|
|
12690
|
+
return this.selectionMode !== RepeatSelectionMode.none
|
|
12691
|
+
? "listbox"
|
|
12692
|
+
: "list";
|
|
12693
|
+
}
|
|
12694
|
+
get ariaMultiselectable() {
|
|
12695
|
+
return this.isModeMulti() || null;
|
|
12687
12696
|
}
|
|
12688
12697
|
ngOnInit() {
|
|
12689
12698
|
this.intersectionObserver = new IntersectionObserver(this.intersectionObserverCallback);
|
|
12690
|
-
|
|
12699
|
+
if (this.elRef.nativeElement instanceof Element) {
|
|
12700
|
+
this.intersectionObserver.observe(this.elRef.nativeElement);
|
|
12701
|
+
}
|
|
12691
12702
|
if (this.dragPreviewTemplateRef ||
|
|
12692
12703
|
this.dragHandleTemplateRef ||
|
|
12693
12704
|
this._reorderable === true) {
|
|
@@ -12775,32 +12786,33 @@ class RepeatComponent {
|
|
|
12775
12786
|
this.isItemDisabled(item)) {
|
|
12776
12787
|
return;
|
|
12777
12788
|
}
|
|
12778
|
-
|
|
12779
|
-
|
|
12789
|
+
// prevent handling both from row and input
|
|
12790
|
+
event.stopImmediatePropagation();
|
|
12791
|
+
event.stopPropagation();
|
|
12792
|
+
event.preventDefault();
|
|
12793
|
+
if (this.isModeMulti()) {
|
|
12780
12794
|
this.selectionHasChanged = true;
|
|
12781
12795
|
this.multiSelectionChanged(item);
|
|
12796
|
+
return;
|
|
12782
12797
|
}
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12798
|
+
if (this.selectionMode ===
|
|
12799
|
+
RepeatSelectionMode.singleWithRequiredSelection ||
|
|
12800
|
+
this.selectionMode === RepeatSelectionMode.radio) {
|
|
12801
|
+
this.selection = [item];
|
|
12802
|
+
}
|
|
12803
|
+
if (this.selectionMode === RepeatSelectionMode.single ||
|
|
12804
|
+
this.selectionMode ===
|
|
12805
|
+
RepeatSelectionMode.radioWithNonRequiredSelection) {
|
|
12806
|
+
if (this.selection.indexOf(item) !== -1) {
|
|
12807
|
+
this.selection = [];
|
|
12788
12808
|
}
|
|
12789
|
-
|
|
12790
|
-
this.
|
|
12791
|
-
RepeatSelectionMode.radioWithNonRequiredSelection) {
|
|
12792
|
-
if (this.selection.indexOf(item) !== -1) {
|
|
12793
|
-
this.selection = [];
|
|
12794
|
-
}
|
|
12795
|
-
else {
|
|
12796
|
-
this.selection = [item];
|
|
12797
|
-
}
|
|
12809
|
+
else {
|
|
12810
|
+
this.selection = [item];
|
|
12798
12811
|
}
|
|
12799
|
-
this.changeDetector.markForCheck();
|
|
12800
|
-
this.selectionHasChanged = true;
|
|
12801
|
-
this.selectionChange.emit(this.selection);
|
|
12802
|
-
return;
|
|
12803
12812
|
}
|
|
12813
|
+
this.changeDetector.markForCheck();
|
|
12814
|
+
this.selectionHasChanged = true;
|
|
12815
|
+
this.selectionChange.emit(this.selection);
|
|
12804
12816
|
}
|
|
12805
12817
|
/**
|
|
12806
12818
|
* nui-repeat-item selection change handler
|
|
@@ -12815,12 +12827,25 @@ class RepeatComponent {
|
|
|
12815
12827
|
}
|
|
12816
12828
|
this.selectionChange.emit(this.selection);
|
|
12817
12829
|
}
|
|
12830
|
+
isModeMulti() {
|
|
12831
|
+
return this.selectionMode === RepeatSelectionMode.multi;
|
|
12832
|
+
}
|
|
12833
|
+
isModeRadio() {
|
|
12834
|
+
return [
|
|
12835
|
+
RepeatSelectionMode.radio,
|
|
12836
|
+
RepeatSelectionMode.radioWithNonRequiredSelection,
|
|
12837
|
+
].includes(this.selectionMode);
|
|
12838
|
+
}
|
|
12818
12839
|
/* START - ITEM BEHAVIOUR DECIDERS */
|
|
12840
|
+
isItemClickable(item) {
|
|
12841
|
+
return !this.preventRowClick && !this.isItemDisabled(item);
|
|
12842
|
+
}
|
|
12843
|
+
isItemSelectable(item) {
|
|
12844
|
+
return !this.isItemDisabled(item);
|
|
12845
|
+
}
|
|
12819
12846
|
isItemDisabled(item) {
|
|
12820
|
-
var _a, _b;
|
|
12821
|
-
return item.
|
|
12822
|
-
? item.disabled
|
|
12823
|
-
: !!((_b = (_a = this.itemConfig) === null || _a === void 0 ? void 0 : _a.isDisabled) === null || _b === void 0 ? void 0 : _b.call(_a, item));
|
|
12847
|
+
var _a, _b, _c;
|
|
12848
|
+
return ((_a = item.disabled) !== null && _a !== void 0 ? _a : !!((_c = (_b = this.itemConfig) === null || _b === void 0 ? void 0 : _b.isDisabled) === null || _c === void 0 ? void 0 : _c.call(_b, item)));
|
|
12824
12849
|
}
|
|
12825
12850
|
isItemDraggable(item) {
|
|
12826
12851
|
var _a, _b, _c;
|
|
@@ -12889,15 +12914,15 @@ class RepeatComponent {
|
|
|
12889
12914
|
RepeatComponent.decorators = [
|
|
12890
12915
|
{ type: Component, args: [{
|
|
12891
12916
|
selector: "nui-repeat",
|
|
12892
|
-
template: "<ng-template #repeatItems let-item=\"item\" let-itemIndex=\"itemIndex\">\n <nui-repeat-item
|
|
12917
|
+
template: "<ng-template #repeatItems let-item=\"item\" let-itemIndex=\"itemIndex\">\n <nui-repeat-item\n class=\"repeat-group-item\"\n #drag=\"cdkDrag\"\n cdkDrag\n [cdkDragData]=\"item\"\n [cdkDragPreviewClass]=\"dragPreviewClass\"\n [cdkDragDisabled]=\"!isItemDraggable(item)\"\n (rowClicked)=\"itemClicked($event, item)\"\n [clickable]=\"isItemClickable(item)\"\n [selectable]=\"isItemSelectable(item)\"\n [selected]=\"isItemSelected(item) && !isItemDisabled(item)\"\n [class.repeat-group-item--disabled]=\"isItemDisabled(item)\"\n [class.nui-dnd-without-drag-handle]=\"\n isItemDraggable(item) && !dragHandleTemplateRef\n \"\n [class.nui-dnd-raised-state]=\"\n isItemDraggable(item) && mousedOver[itemIndex]\n \"\n >\n <div\n *ngIf=\"dragHandleTemplateRef && !virtualScroll\"\n [class.hide]=\"!draggable\"\n [class.invisible]=\"!isItemDraggable(item)\"\n class=\"nui-repeat-item__controls-drag-handle align-self-center\"\n >\n <div\n cdkDragHandle\n (mouseover)=\"mousedOver[itemIndex] = true\"\n (mouseout)=\"mousedOver[itemIndex] = false\"\n [class.nui-dnd-handle]=\"!drag.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"dragHandleTemplateRef\"\n [ngTemplateOutletContext]=\"{ item: item }\"\n ></ng-container>\n </div>\n </div>\n <div\n *ngIf=\"dragPreviewTemplateRef && !virtualScroll\"\n class=\"nui-repeat-item__controls-drag-handle\"\n >\n <div\n *cdkDragPreview\n [class.nui-dnd-preview]=\"!isItemDisabled(item)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"dragPreviewTemplateRef\"\n [ngTemplateOutletContext]=\"{ item: item }\"\n ></ng-container>\n </div>\n </div>\n <div class=\"nui-repeat-item__controls-container\">\n <nui-checkbox\n *ngIf=\"isModeMulti()\"\n class=\"nui-repeat-item__checkbox\"\n [value]=\"item\"\n [checked]=\"isItemSelected(item)\"\n [disabled]=\"isItemDisabled(item)\"\n (valueChange)=\"itemClicked($event, item)\"\n >\n </nui-checkbox>\n <nui-radio\n *ngIf=\"isModeRadio()\"\n class=\"nui-repeat-item__radio\"\n [value]=\"item\"\n [checked]=\"isItemSelected(item)\"\n [disabled]=\"isItemDisabled(item)\"\n (click)=\"itemClicked($event, item)\"\n >\n </nui-radio>\n </div>\n <div class=\"nui-repeat-item__content-container\">\n <ng-container\n [ngTemplateOutlet]=\"repeatItemTemplateRef\"\n [ngTemplateOutletContext]=\"{ item: item }\"\n ></ng-container>\n </div>\n <div\n class=\"nui-repeat-item__actions-container\"\n *ngIf=\"actionsTemplateRef\"\n >\n <ng-container\n [ngTemplateOutlet]=\"actionsTemplateRef\"\n [ngTemplateOutletContext]=\"{ item: item }\"\n >\n </ng-container>\n </div>\n </nui-repeat-item>\n</ng-template>\n\n<div class=\"nui-repeat nui-repeat__{{ paddingSize }}\">\n <div class=\"nui-repeat-header\">\n <ng-content select=\"[repeatHeaderTemplate]\"></ng-content>\n </div>\n <ul #dropListArea class=\"repeat-group\" aria-dropeffect=\"move\">\n <div *ngIf=\"!virtualScroll\">\n <ng-container\n *ngFor=\"\n let sourceItem of itemsSource;\n trackBy: itemConfig?.trackBy;\n let itemIndex = index\n \"\n [ngTemplateOutlet]=\"repeatItems\"\n [ngTemplateOutletContext]=\"{\n item: sourceItem,\n itemIndex: itemIndex\n }\"\n ></ng-container>\n </div>\n <cdk-virtual-scroll-viewport\n [itemSize]=\"itemSize\"\n *ngIf=\"virtualScroll && itemSize\"\n >\n <ng-container\n *cdkVirtualFor=\"\n let sourceItem of itemsSource;\n templateCacheSize: 0\n \"\n >\n <ng-container\n [ngTemplateOutlet]=\"repeatItems\"\n [ngTemplateOutletContext]=\"{ item: sourceItem }\"\n ></ng-container>\n </ng-container>\n </cdk-virtual-scroll-viewport>\n </ul>\n</div>\n",
|
|
12893
12918
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12894
12919
|
encapsulation: ViewEncapsulation.None,
|
|
12895
12920
|
host: {
|
|
12896
12921
|
"[class.virtual-scroll-viewport]": "virtualScroll",
|
|
12897
12922
|
"[attr.role]": "role",
|
|
12898
|
-
"[attr.aria-multiselectable]": "
|
|
12923
|
+
"[attr.aria-multiselectable]": "ariaMultiselectable",
|
|
12899
12924
|
},
|
|
12900
|
-
styles: [".nui .nui-repeat{height:inherit}.nui .nui-repeat__normal .nui-repeat-item{padding-top:5px;padding-bottom:5px}.nui .nui-repeat__compact .nui-repeat-item{padding-top:0;padding-bottom:0}.nui .nui-repeat-header{color:var(--nui-color-text-default,#111);background-color:var(--nui-color-bg-light,#fff)}.nui .nui-repeat .repeat-group .nui-
|
|
12925
|
+
styles: [".nui .nui-repeat{height:inherit}.nui .nui-repeat__normal .nui-repeat-item{padding-top:5px;padding-bottom:5px}.nui .nui-repeat>ul>cdk-virtual-scroll-viewport{height:100%}.nui .nui-repeat__compact .nui-repeat-item{padding-top:0;padding-bottom:0}.nui .nui-repeat-header{color:var(--nui-color-text-default,#111);background-color:var(--nui-color-bg-light,#fff)}.nui .nui-repeat .repeat-group .nui-repeat-item{cursor:auto}.nui .nui-repeat .repeat-group .nui-repeat-item.nui-repeat-item--clickable{cursor:pointer}.nui .nui-repeat .repeat-group .nui-repeat-item.nui-repeat-item--clickable:hover:not(.nui-repeat-item--selected){border-color:var(--nui-color-line-default,#d9d9d9)}.nui .nui-repeat .repeat-group-item:first-child .nui-repeat-item{border-top:solid 1px;border-top-color:var(--nui-color-line-default,#d9d9d9)}.nui .nui-repeat .repeat-group{margin-bottom:0;padding-left:0;margin-left:0;height:inherit}.nui .nui-repeat .repeat-group-item{position:relative;display:block;color:var(--nui-color-text-default,#111);background-color:var(--nui-color-bg-light,#fff);transition:box-shadow .4s}.nui .nui-repeat .repeat-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.nui .nui-repeat .repeat-group-item:last-child{margin-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.nui .nui-repeat .repeat-group-item:hover{cursor:pointer}.nui .nui-repeat .repeat-group-item:hover.nui-dnd-without-drag-handle:not(.cdk-drag-disabled){cursor:move;z-index:1;box-sizing:border-box;box-shadow:0 2px 10px 0 var(--nui-shadow-color, rgba(17, 17, 17, .3))}.nui .nui-repeat .repeat-group-item--disabled{color:var(--nui-color-text-disabled,rgba(17, 17, 17, .3))}.nui .nui-repeat .repeat-group-item--disabled:hover{cursor:not-allowed}.nui .nui-repeat .nui-repeat-item{border-bottom:solid 1px;border-bottom-color:var(--nui-color-line-default,#d9d9d9)}@supports (-ms-ime-align: auto){.nui .nui-repeat .nui-repeat-item{margin-bottom:.5px}}\n"]
|
|
12901
12926
|
},] }
|
|
12902
12927
|
];
|
|
12903
12928
|
RepeatComponent.ctorParameters = () => [
|
|
@@ -12913,6 +12938,7 @@ RepeatComponent.propDecorators = {
|
|
|
12913
12938
|
draggableChange: [{ type: Output }],
|
|
12914
12939
|
reorderableChange: [{ type: Output }],
|
|
12915
12940
|
width: [{ type: HostBinding, args: ["style.width",] }],
|
|
12941
|
+
preventRowClick: [{ type: Input }],
|
|
12916
12942
|
repeatItemTemplateRef: [{ type: Input }],
|
|
12917
12943
|
dragHandleTemplateRef: [{ type: Input }],
|
|
12918
12944
|
dragPreviewClass: [{ type: Input }],
|