ngx-pk-ui 1.0.5 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -669,12 +669,7 @@ class PkDgRowsDirective {
669
669
  this.datagrid.pagination.updatePagination();
670
670
  }
671
671
  this.datagrid.updateDisplayedItems();
672
- this._lastVersion = this.datagrid.displayedItemsVersion;
673
- // Render immediately on first bind; do not wait for a user event.
674
- this.renderItems();
675
- return;
676
672
  }
677
- this.renderItems();
678
673
  }
679
674
  renderItems() {
680
675
  this.viewContainer.clear();
@@ -874,9 +869,6 @@ class PkDatagridComponent {
874
869
  }
875
870
  this._initColumnWidths();
876
871
  this.updateDisplayedItems();
877
- // In zoneless mode, async callbacks do not automatically trigger a render pass.
878
- // Run one explicit change detection so initial pagination is reflected immediately.
879
- this.cdr.detectChanges();
880
872
  }, 0);
881
873
  }
882
874
  updateDisplayedItems() {
@@ -1046,7 +1038,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1046
1038
  args: [PkDgHeaderComponent]
1047
1039
  }], pagination: [{
1048
1040
  type: ContentChild,
1049
- args: [PkDgPaginationComponent, { descendants: true }]
1041
+ args: [PkDgPaginationComponent]
1050
1042
  }], rowDetails: [{
1051
1043
  type: ContentChildren,
1052
1044
  args: [PkDgRowExpandComponent, { descendants: true }]
@@ -1127,8 +1119,7 @@ class PkDatagridModule {
1127
1119
  PkDgActionComponent,
1128
1120
  PkDgRowsDirective,
1129
1121
  PkDgRowIsExpandDirective,
1130
- NowrapDirective,
1131
- PkIcon] });
1122
+ NowrapDirective] });
1132
1123
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: PkDatagridModule, imports: [CommonModule,
1133
1124
  FormsModule] });
1134
1125
  }
@@ -1166,8 +1157,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1166
1157
  PkDgActionComponent,
1167
1158
  PkDgRowsDirective,
1168
1159
  PkDgRowIsExpandDirective,
1169
- NowrapDirective,
1170
- PkIcon
1160
+ NowrapDirective
1171
1161
  ]
1172
1162
  }]
1173
1163
  }] });
@@ -2665,6 +2655,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
2665
2655
  `, styles: [".pk-select-container{position:relative;width:100%}.pk-select-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;background-color:#fff;cursor:pointer;transition:all .2s}.pk-select-trigger:hover:not(.pk-select-trigger-disabled){border-color:#3b82f6}.pk-select-trigger-open{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.pk-select-trigger-disabled{background-color:#f3f4f6;cursor:not-allowed;opacity:.6}.pk-select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pk-select-placeholder{color:#9ca3af}.pk-select-arrow{margin-left:8px;font-size:12px;color:#6b7280;transition:transform .2s}.pk-select-arrow-open{transform:rotate(180deg)}.pk-select-dropdown{position:absolute;top:calc(100% + 4px);left:0;right:0;background-color:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f;z-index:1000;max-height:300px;overflow:hidden;display:flex;flex-direction:column}.pk-select-search{padding:8px;border-bottom:1px solid #e5e7eb}.pk-select-search-input{width:100%;padding:6px 10px;border:1px solid #d1d5db;border-radius:4px;font-size:14px;outline:none}.pk-select-search-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.pk-select-options{overflow-y:auto;max-height:250px}.pk-select-option{display:flex;align-items:center;padding:8px 12px;cursor:pointer;transition:background-color .2s}.pk-select-option:hover:not(.pk-select-option-disabled){background-color:#f3f4f6}.pk-select-option-selected{background-color:#dbeafe;color:#1e40af}.pk-select-option-disabled{opacity:.5;cursor:not-allowed}.pk-select-checkbox{margin-right:8px;cursor:pointer}.pk-select-option-label{flex:1}.pk-select-no-options{padding:16px 12px;text-align:center;color:#9ca3af;font-size:14px}\n"] }]
2666
2656
  }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], labelField: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelField", required: false }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], returnObjects: [{ type: i0.Input, args: [{ isSignal: true, alias: "returnObjects", required: false }] }], customClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "customClass", required: false }] }], customStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "customStyle", required: false }] }], change: [{ type: i0.Output, args: ["change"] }] } });
2667
2657
 
2658
+ class PkTooltip {
2659
+ pkTooltip = input.required(...(ngDevMode ? [{ debugName: "pkTooltip" }] : /* istanbul ignore next */ []));
2660
+ pkTooltipPosition = input('top', ...(ngDevMode ? [{ debugName: "pkTooltipPosition" }] : /* istanbul ignore next */ []));
2661
+ pkTooltipType = input('primary', ...(ngDevMode ? [{ debugName: "pkTooltipType" }] : /* istanbul ignore next */ []));
2662
+ hostEl = inject((ElementRef));
2663
+ tooltipEl = null;
2664
+ onMouseEnter() { this.show(); }
2665
+ onMouseLeave() { this.hide(); }
2666
+ onFocusIn() { this.show(); }
2667
+ onFocusOut() { this.hide(); }
2668
+ ngOnDestroy() {
2669
+ this.hide();
2670
+ }
2671
+ show() {
2672
+ const text = this.pkTooltip();
2673
+ if (!text || this.tooltipEl)
2674
+ return;
2675
+ const tooltip = document.createElement('div');
2676
+ tooltip.className = [
2677
+ 'pk-tooltip-box',
2678
+ `pk-tooltip-box--${this.pkTooltipPosition()}`,
2679
+ `pk-tooltip-box--${this.pkTooltipType()}`,
2680
+ ].join(' ');
2681
+ tooltip.textContent = text;
2682
+ tooltip.style.visibility = 'hidden';
2683
+ document.body.appendChild(tooltip);
2684
+ this.tooltipEl = tooltip;
2685
+ this.reposition();
2686
+ tooltip.style.visibility = '';
2687
+ }
2688
+ reposition() {
2689
+ const tooltip = this.tooltipEl;
2690
+ if (!tooltip)
2691
+ return;
2692
+ const host = this.hostEl.nativeElement.getBoundingClientRect();
2693
+ const tip = tooltip.getBoundingClientRect();
2694
+ const gap = 8;
2695
+ let top;
2696
+ let left;
2697
+ switch (this.pkTooltipPosition()) {
2698
+ case 'bottom':
2699
+ top = host.bottom + gap;
2700
+ left = host.left + (host.width - tip.width) / 2;
2701
+ break;
2702
+ case 'left':
2703
+ top = host.top + (host.height - tip.height) / 2;
2704
+ left = host.left - tip.width - gap;
2705
+ break;
2706
+ case 'right':
2707
+ top = host.top + (host.height - tip.height) / 2;
2708
+ left = host.right + gap;
2709
+ break;
2710
+ default: // top
2711
+ top = host.top - tip.height - gap;
2712
+ left = host.left + (host.width - tip.width) / 2;
2713
+ }
2714
+ tooltip.style.top = `${top}px`;
2715
+ tooltip.style.left = `${left}px`;
2716
+ }
2717
+ hide() {
2718
+ if (this.tooltipEl) {
2719
+ this.tooltipEl.remove();
2720
+ this.tooltipEl = null;
2721
+ }
2722
+ }
2723
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: PkTooltip, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2724
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: PkTooltip, isStandalone: true, selector: "[pkTooltip]", inputs: { pkTooltip: { classPropertyName: "pkTooltip", publicName: "pkTooltip", isSignal: true, isRequired: true, transformFunction: null }, pkTooltipPosition: { classPropertyName: "pkTooltipPosition", publicName: "pkTooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, pkTooltipType: { classPropertyName: "pkTooltipType", publicName: "pkTooltipType", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "focusin": "onFocusIn()", "focusout": "onFocusOut()" } }, ngImport: i0 });
2725
+ }
2726
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: PkTooltip, decorators: [{
2727
+ type: Directive,
2728
+ args: [{
2729
+ selector: '[pkTooltip]',
2730
+ }]
2731
+ }], propDecorators: { pkTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "pkTooltip", required: true }] }], pkTooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "pkTooltipPosition", required: false }] }], pkTooltipType: [{ type: i0.Input, args: [{ isSignal: true, alias: "pkTooltipType", required: false }] }], onMouseEnter: [{
2732
+ type: HostListener,
2733
+ args: ['mouseenter']
2734
+ }], onMouseLeave: [{
2735
+ type: HostListener,
2736
+ args: ['mouseleave']
2737
+ }], onFocusIn: [{
2738
+ type: HostListener,
2739
+ args: ['focusin']
2740
+ }], onFocusOut: [{
2741
+ type: HostListener,
2742
+ args: ['focusout']
2743
+ }] } });
2744
+
2668
2745
  class PkAutocompleteComponent {
2669
2746
  elementRef = inject(ElementRef);
2670
2747
  // Inputs
@@ -3202,5 +3279,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
3202
3279
  * Generated bundle index. Do not edit.
3203
3280
  */
3204
3281
 
3205
- export { DatepickerService, HolidayService, NowrapDirective, PK_ICONS, PkAlert, PkAlertService, PkAutocompleteComponent, PkDatagridComponent, PkDatagridModule, PkDatepickerComponent, PkDgActionComponent, PkDgCellComponent, PkDgFooterComponent, PkDgHeaderComponent, PkDgPageSizeComponent, PkDgPaginationComponent, PkDgRowComponent, PkDgRowExpandComponent, PkDgRowIsExpandDirective, PkDgRowsDirective, PkIcon, PkModal, PkModalBody, PkModalFooter, PkModalHeader, PkProgressComponent, PkSelectComponent, PkTab, PkTabs, PkToastr, PkToastrService, PkTreeviewComponent, PkTreeviewModule, PkTreeviewNodeComponent, PkTypeaheadComponent };
3282
+ export { DatepickerService, HolidayService, NowrapDirective, PK_ICONS, PkAlert, PkAlertService, PkAutocompleteComponent, PkDatagridComponent, PkDatagridModule, PkDatepickerComponent, PkDgActionComponent, PkDgCellComponent, PkDgFooterComponent, PkDgHeaderComponent, PkDgPageSizeComponent, PkDgPaginationComponent, PkDgRowComponent, PkDgRowExpandComponent, PkDgRowIsExpandDirective, PkDgRowsDirective, PkIcon, PkModal, PkModalBody, PkModalFooter, PkModalHeader, PkProgressComponent, PkSelectComponent, PkTab, PkTabs, PkToastr, PkToastrService, PkTooltip, PkTreeviewComponent, PkTreeviewModule, PkTreeviewNodeComponent, PkTypeaheadComponent };
3206
3283
  //# sourceMappingURL=ngx-pk-ui.mjs.map