ngx-kit 7.1.0 → 7.3.0

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.
Files changed (73) hide show
  1. package/angle-selector/README.md +34 -34
  2. package/box-shadow/README.md +33 -33
  3. package/color-picker/README.md +52 -52
  4. package/{shared → core}/README.md +117 -117
  5. package/data-table/README.md +120 -120
  6. package/date-picker/README.md +74 -74
  7. package/dialog/README.md +122 -92
  8. package/drag-resize/README.md +53 -55
  9. package/fesm2022/ngx-kit-angle-selector.mjs +9 -26
  10. package/fesm2022/ngx-kit-angle-selector.mjs.map +1 -1
  11. package/fesm2022/ngx-kit-box-shadow.mjs +330 -356
  12. package/fesm2022/ngx-kit-box-shadow.mjs.map +1 -1
  13. package/fesm2022/ngx-kit-color-picker.mjs +132 -272
  14. package/fesm2022/ngx-kit-color-picker.mjs.map +1 -1
  15. package/fesm2022/{ngx-kit-shared.mjs → ngx-kit-core.mjs} +908 -277
  16. package/fesm2022/ngx-kit-core.mjs.map +1 -0
  17. package/fesm2022/ngx-kit-data-table.mjs +1 -1
  18. package/fesm2022/ngx-kit-data-table.mjs.map +1 -1
  19. package/fesm2022/ngx-kit-date-picker.mjs +34 -22
  20. package/fesm2022/ngx-kit-date-picker.mjs.map +1 -1
  21. package/fesm2022/ngx-kit-dialog.mjs +430 -331
  22. package/fesm2022/ngx-kit-dialog.mjs.map +1 -1
  23. package/fesm2022/ngx-kit-drag-resize.mjs +193 -140
  24. package/fesm2022/ngx-kit-drag-resize.mjs.map +1 -1
  25. package/fesm2022/ngx-kit-drawer-menu.mjs +3 -3
  26. package/fesm2022/ngx-kit-drawer-menu.mjs.map +1 -1
  27. package/fesm2022/ngx-kit-dropzone.mjs.map +1 -1
  28. package/fesm2022/ngx-kit-form-field.mjs +9 -3
  29. package/fesm2022/ngx-kit-form-field.mjs.map +1 -1
  30. package/fesm2022/ngx-kit-gallery.mjs +3 -3
  31. package/fesm2022/ngx-kit-gallery.mjs.map +1 -1
  32. package/fesm2022/ngx-kit-gradient-picker.mjs +20 -38
  33. package/fesm2022/ngx-kit-gradient-picker.mjs.map +1 -1
  34. package/fesm2022/ngx-kit-grid-layout.mjs +32 -30
  35. package/fesm2022/ngx-kit-grid-layout.mjs.map +1 -1
  36. package/fesm2022/ngx-kit-image-editor.mjs +3 -3
  37. package/fesm2022/ngx-kit-image-editor.mjs.map +1 -1
  38. package/fesm2022/ngx-kit-menu.mjs +1 -1
  39. package/fesm2022/ngx-kit-menu.mjs.map +1 -1
  40. package/fesm2022/ngx-kit-message.mjs +2 -2
  41. package/fesm2022/ngx-kit-message.mjs.map +1 -1
  42. package/fesm2022/ngx-kit-notify.mjs +1 -1
  43. package/fesm2022/ngx-kit-notify.mjs.map +1 -1
  44. package/fesm2022/ngx-kit-time-picker.mjs +1 -1
  45. package/fesm2022/ngx-kit-time-picker.mjs.map +1 -1
  46. package/fesm2022/ngx-kit-virtual-scroll.mjs +2 -2
  47. package/fesm2022/ngx-kit-virtual-scroll.mjs.map +1 -1
  48. package/gallery/README.md +71 -71
  49. package/gradient-picker/README.md +41 -41
  50. package/grid-layout/README.md +64 -64
  51. package/image-editor/README.md +44 -44
  52. package/menu/README.md +85 -85
  53. package/message/README.md +70 -70
  54. package/notify/README.md +56 -56
  55. package/package.json +5 -9
  56. package/time-picker/README.md +89 -89
  57. package/types/ngx-kit-angle-selector.d.ts +13 -16
  58. package/types/ngx-kit-box-shadow.d.ts +37 -95
  59. package/types/ngx-kit-color-picker.d.ts +61 -58
  60. package/types/{ngx-kit-shared.d.ts → ngx-kit-core.d.ts} +194 -34
  61. package/types/ngx-kit-data-table.d.ts +2 -2
  62. package/types/ngx-kit-date-picker.d.ts +15 -12
  63. package/types/ngx-kit-dialog.d.ts +208 -107
  64. package/types/ngx-kit-drag-resize.d.ts +74 -47
  65. package/types/ngx-kit-form-field.d.ts +26 -23
  66. package/types/ngx-kit-gradient-picker.d.ts +4 -7
  67. package/types/ngx-kit-menu.d.ts +1 -1
  68. package/types/ngx-kit-time-picker.d.ts +1 -1
  69. package/virtual-scroll/README.md +199 -199
  70. package/fesm2022/ngx-kit-shared.mjs.map +0 -1
  71. package/fesm2022/ngx-kit-webflow.mjs +0 -709
  72. package/fesm2022/ngx-kit-webflow.mjs.map +0 -1
  73. package/types/ngx-kit-webflow.d.ts +0 -286
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, EventEmitter, Injectable, InjectionToken, Directive, inject, Output, Input, HostListener } from '@angular/core';
2
+ import { signal, EventEmitter, Injectable, InjectionToken, Directive, inject, Output, Input, model, input, output, effect, HostListener } from '@angular/core';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
 
5
5
  /**
@@ -124,6 +124,7 @@ class DragRef {
124
124
  previousZIndex = '';
125
125
  moveDx = 0;
126
126
  moveDy = 0;
127
+ scrollCompensation = { x: 0, y: 0 };
127
128
  preview;
128
129
  previewOffsetX = 0;
129
130
  previewOffsetY = 0;
@@ -155,6 +156,7 @@ class DragRef {
155
156
  this.lastPointer = { ...pointer };
156
157
  this.moveDx = 0;
157
158
  this.moveDy = 0;
159
+ this.scrollCompensation = { x: 0, y: 0 };
158
160
  this.originDropList = this.dropList;
159
161
  this.originIndex = this.dropList?.getItemIndex(this) ?? -1;
160
162
  this.previousTransform = getComputedStyle(this.el).getPropertyValue('transform');
@@ -261,6 +263,7 @@ class DragRef {
261
263
  this.el.style.transform = this.previousTransform;
262
264
  this.el.style.visibility = this.sourceVisibility;
263
265
  this.el.style.pointerEvents = this.sourcePointerEvents;
266
+ this.scrollCompensation = { x: 0, y: 0 };
264
267
  this.endDrag();
265
268
  }
266
269
  get x() {
@@ -278,11 +281,32 @@ class DragRef {
278
281
  getPlaceholderElement() {
279
282
  return this.placeholder?.element;
280
283
  }
284
+ /**
285
+ * صدا زده می‌شود هر بار که container یا window در حین درگ اسکرول شود
286
+ * (چه توسط auto-scroll خودمان، چه با wheel/اسکرول‌بار دستی کاربر).
287
+ * transform را فوراً تصحیح می‌کند تا عنصر زیر پوینتر بماند.
288
+ */
289
+ notifyScroll(dx, dy) {
290
+ if (!this.isDragging())
291
+ return;
292
+ this.scrollCompensation = {
293
+ x: this.scrollCompensation.x + dx,
294
+ y: this.scrollCompensation.y + dy,
295
+ };
296
+ if (this.dropList) {
297
+ this.updatePreview();
298
+ }
299
+ else {
300
+ this.applyTransform();
301
+ }
302
+ }
281
303
  applyTransform() {
282
304
  const base = this.previousTransform && this.previousTransform !== 'none'
283
305
  ? this.previousTransform + ' '
284
306
  : '';
285
- this.el.style.transform = `${base}translate3d(${this.moveDx}px, ${this.moveDy}px, 0)`;
307
+ const tx = this.moveDx + this.scrollCompensation.x;
308
+ const ty = this.moveDy + this.scrollCompensation.y;
309
+ this.el.style.transform = `${base}translate3d(${tx}px, ${ty}px, 0)`;
286
310
  }
287
311
  updatePreview() {
288
312
  if (!this.preview)
@@ -397,9 +421,7 @@ class PositionalSortStrategy {
397
421
  for (const node of Array.from(this.container.children)) {
398
422
  if (node === placeholder)
399
423
  return position;
400
- if (node instanceof HTMLElement &&
401
- itemElements.has(node) &&
402
- node !== this.dragging?.el) {
424
+ if (node instanceof HTMLElement && itemElements.has(node) && node !== this.dragging?.el) {
403
425
  position++;
404
426
  }
405
427
  }
@@ -519,8 +541,7 @@ class PositionalSortStrategy {
519
541
  }
520
542
  }
521
543
  const target = best.rect;
522
- const sameRow = y >= target.top - target.height * 0.35 &&
523
- y <= target.bottom + target.height * 0.35;
544
+ const sameRow = y >= target.top - target.height * 0.35 && y <= target.bottom + target.height * 0.35;
524
545
  const before = sameRow
525
546
  ? this.rtl
526
547
  ? x > target.left + target.width / 2
@@ -790,27 +811,22 @@ class DragDropService {
790
811
  this.activeDrag.set(null);
791
812
  }
792
813
  findDropList(point, current) {
793
- const candidates = this.dropLists()
794
- .filter((list) => {
814
+ const candidates = this.dropLists().filter((list) => {
795
815
  const r = list.el?.getBoundingClientRect();
796
- return (!!r &&
797
- point.x >= r.left &&
798
- point.x <= r.right &&
799
- point.y >= r.top &&
800
- point.y <= r.bottom);
816
+ return (!!r && point.x >= r.left && point.x <= r.right && point.y >= r.top && point.y <= r.bottom);
801
817
  });
802
818
  // Staying over the current list should always win.
803
819
  if (current && candidates.includes(current))
804
820
  return current;
805
821
  // Never jump into an unrelated list just because it overlaps the pointer.
806
822
  // Prefer the smallest matching connected container (useful for nested lists).
807
- return candidates
823
+ return (candidates
808
824
  .filter((list) => !current || current.isConnectedTo(list))
809
825
  .sort((a, b) => {
810
826
  const ra = a.el.getBoundingClientRect();
811
827
  const rb = b.el.getBoundingClientRect();
812
828
  return ra.width * ra.height - rb.width * rb.height;
813
- })[0] ?? null;
829
+ })[0] ?? null);
814
830
  }
815
831
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: DragDropService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
816
832
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: DragDropService, providedIn: 'root' });
@@ -899,16 +915,22 @@ class AutoScroller {
899
915
  raf = 0;
900
916
  container = window;
901
917
  speed = { x: 0, y: 0 };
918
+ onTick;
902
919
  edge;
903
920
  maxSpeed;
904
921
  constructor(edge = 56, maxSpeed = 18) {
905
922
  this.edge = edge;
906
923
  this.maxSpeed = maxSpeed;
907
924
  }
908
- start(fromEl) {
925
+ /** onTick اجرا می‌شود بعد از هر گام اسکرول، تا با آخرین موقعیت pointer، sort/placeholder به‌روز شود. */
926
+ start(fromEl, onTick) {
927
+ this.container = findScrollableAncestor(fromEl);
928
+ this.onTick = onTick;
929
+ }
930
+ /** فقط container را عوض می‌کند بدون قطع حلقه‌ی در حال اجرا یا صفر کردن speed. */
931
+ retarget(fromEl) {
909
932
  this.container = findScrollableAncestor(fromEl);
910
933
  }
911
- /** Call on every pointermove with the current client coordinates. */
912
934
  update(clientX, clientY) {
913
935
  const rect = getScrollRect(this.container);
914
936
  this.speed = {
@@ -924,6 +946,7 @@ class AutoScroller {
924
946
  cancelAnimationFrame(this.raf);
925
947
  this.raf = 0;
926
948
  this.speed = { x: 0, y: 0 };
949
+ this.onTick = undefined;
927
950
  }
928
951
  tick = () => {
929
952
  if (!this.speed.x && !this.speed.y) {
@@ -937,6 +960,9 @@ class AutoScroller {
937
960
  this.container.scrollLeft += this.speed.x;
938
961
  this.container.scrollTop += this.speed.y;
939
962
  }
963
+ // pointer ثابت مونده ولی محتوای زیرش اسکرول شده — پس sort/placeholder را
964
+ // دوباره با آخرین موقعیت شناخته‌شده اجرا کن.
965
+ this.onTick?.();
940
966
  this.raf = requestAnimationFrame(this.tick);
941
967
  };
942
968
  }
@@ -964,32 +990,46 @@ function findScrollableAncestor(el) {
964
990
  }
965
991
  return window;
966
992
  }
993
+ function getScrollPosition(container) {
994
+ if (container instanceof Window) {
995
+ return { left: window.scrollX, top: window.scrollY };
996
+ }
997
+ return { left: container.scrollLeft, top: container.scrollTop };
998
+ }
967
999
 
968
1000
  const NGX_DRAGGABLE = new InjectionToken('ngx-draggable');
969
1001
  const DEFAULT_KEYBOARD_STEP = 8;
970
1002
  class NgxDraggable {
971
1003
  host;
972
1004
  renderer;
973
- disabled = false;
1005
+ disabled = model(false, /* @ts-ignore */
1006
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
974
1007
  /** Element whose rect constrains the drag. Now actually enforced. */
975
- boundary;
976
- dragRootElement = '';
1008
+ boundary = input(/* @ts-ignore */
1009
+ ...(ngDevMode ? [undefined, { debugName: "boundary" }] : /* istanbul ignore next */ []));
1010
+ dragRootElement = model('', /* @ts-ignore */
1011
+ ...(ngDevMode ? [{ debugName: "dragRootElement" }] : /* istanbul ignore next */ []));
977
1012
  /** CSS selector for a drag handle. When set, only pointerdowns inside it start a drag. */
978
- dragHandle = '';
1013
+ dragHandle = model('', /* @ts-ignore */
1014
+ ...(ngDevMode ? [{ debugName: "dragHandle" }] : /* istanbul ignore next */ []));
979
1015
  /** Restrict movement to a single axis. */
980
- lockAxis;
1016
+ lockAxis = input(/* @ts-ignore */
1017
+ ...(ngDevMode ? [undefined, { debugName: "lockAxis" }] : /* istanbul ignore next */ []));
981
1018
  /** Minimum pointer travel (px) before a drag starts, so clicks still register normally. */
982
- dragThreshold = 3;
1019
+ dragThreshold = input(3, /* @ts-ignore */
1020
+ ...(ngDevMode ? [{ debugName: "dragThreshold" }] : /* istanbul ignore next */ []));
983
1021
  /** Pixel step used when dragging via the keyboard (arrow keys, focus required). */
984
- keyboardStep = DEFAULT_KEYBOARD_STEP;
1022
+ keyboardStep = input(DEFAULT_KEYBOARD_STEP, /* @ts-ignore */
1023
+ ...(ngDevMode ? [{ debugName: "keyboardStep" }] : /* istanbul ignore next */ []));
985
1024
  /** Auto-scroll the nearest scrollable ancestor while dragging near its edge. */
986
- autoScroll = true;
1025
+ autoScroll = input(true, /* @ts-ignore */
1026
+ ...(ngDevMode ? [{ debugName: "autoScroll" }] : /* istanbul ignore next */ []));
987
1027
  set data(v) {
988
1028
  this._ref.data = v;
989
1029
  }
990
- dragStart = new EventEmitter();
991
- dragMove = new EventEmitter();
992
- dragEnd = new EventEmitter();
1030
+ dragStart = output();
1031
+ dragMove = output();
1032
+ dragEnd = output();
993
1033
  _ref = new DragRef();
994
1034
  dragging = signal(false, /* @ts-ignore */
995
1035
  ...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
@@ -1001,21 +1041,32 @@ class NgxDraggable {
1001
1041
  down = false;
1002
1042
  start = { x: 0, y: 0 };
1003
1043
  pointerId = -1;
1044
+ lastPointer = { x: 0, y: 0 };
1004
1045
  removeDown;
1005
1046
  removeMove;
1006
1047
  removeUp;
1007
1048
  removeKeydown;
1008
1049
  removeEscape;
1050
+ scrollTarget = window;
1051
+ lastScroll = { left: 0, top: 0 };
1052
+ lastWindowScroll = { left: 0, top: 0 };
1053
+ removeContainerScroll;
1054
+ removeWindowScroll;
1009
1055
  constructor(host, renderer) {
1010
1056
  this.host = host;
1011
1057
  this.renderer = renderer;
1058
+ effect(() => {
1059
+ this._ref.el = this.dragRootElement()
1060
+ ? (this.host.nativeElement.closest(this.dragRootElement()) ?? this.host.nativeElement)
1061
+ : this.host.nativeElement;
1062
+ });
1012
1063
  }
1013
1064
  ngOnInit() {
1014
- this._ref.el = this.dragRootElement
1015
- ? (this.host.nativeElement.closest(this.dragRootElement) ?? this.host.nativeElement)
1065
+ this._ref.el = this.dragRootElement()
1066
+ ? (this.host.nativeElement.closest(this.dragRootElement()) ?? this.host.nativeElement)
1016
1067
  : this.host.nativeElement;
1017
- this._ref.boundary = this.boundary;
1018
- this._ref.lockAxis = this.lockAxis;
1068
+ this._ref.boundary = this.boundary();
1069
+ this._ref.lockAxis = this.lockAxis();
1019
1070
  this._ref.dropListGroup = this.group?._ref;
1020
1071
  this._ref.init();
1021
1072
  this._ref.withDropList(this.list?._ref ?? null);
@@ -1034,7 +1085,7 @@ class NgxDraggable {
1034
1085
  this._ref.dropList?.removeItem(this._ref);
1035
1086
  }
1036
1087
  pointerDown(e) {
1037
- if (this.disabled ||
1088
+ if (this.disabled() ||
1038
1089
  e.button !== 0 ||
1039
1090
  // this.isInteractive(e.target) ||
1040
1091
  !this.isOnHandle(e.target))
@@ -1043,8 +1094,8 @@ class NgxDraggable {
1043
1094
  this.down = true;
1044
1095
  this.pointerId = e.pointerId;
1045
1096
  this.start = { x: e.clientX, y: e.clientY };
1046
- this._ref.boundary = this.boundary;
1047
- this._ref.lockAxis = this.lockAxis;
1097
+ this._ref.boundary = this.boundary();
1098
+ this._ref.lockAxis = this.lockAxis();
1048
1099
  this._ref.pointerDown(this.start);
1049
1100
  this.removeMove = this.renderer.listen(this.doc, 'pointermove', (ev) => this.pointerMove(ev));
1050
1101
  this.removeUp = this.renderer.listen(this.doc, 'pointerup', (ev) => this.pointerUp(ev));
@@ -1053,20 +1104,7 @@ class NgxDraggable {
1053
1104
  this.cancel();
1054
1105
  });
1055
1106
  }
1056
- pointerMove(e) {
1057
- if (!this.down || e.pointerId !== this.pointerId)
1058
- return;
1059
- const p = { x: e.clientX, y: e.clientY };
1060
- if (!this.dragging() && Math.hypot(p.x - this.start.x, p.y - this.start.y) < this.dragThreshold)
1061
- return;
1062
- if (!this.dragging()) {
1063
- this._ref.startDrag(p);
1064
- this.dragging.set(true);
1065
- this.service.begin(this._ref);
1066
- if (this.autoScroll)
1067
- this.scroller.start(this._ref.el);
1068
- this.dragStart.emit(p);
1069
- }
1107
+ applyDragUpdate(p) {
1070
1108
  this._ref.dragMove(p);
1071
1109
  const target = this.service.findDropList(p, this._ref.dropList);
1072
1110
  if (target !== this._ref.dropList) {
@@ -1075,22 +1113,70 @@ class NgxDraggable {
1075
1113
  if (target) {
1076
1114
  this._ref.withDropList(target);
1077
1115
  target.createPlaceholder(this._ref);
1078
- if (this.autoScroll) {
1079
- this.scroller.stop();
1080
- this.scroller.start(target.el);
1081
- }
1116
+ if (this.autoScroll())
1117
+ this.scroller.retarget(target.el);
1082
1118
  }
1083
- else if (this.autoScroll) {
1119
+ else if (this.autoScroll()) {
1084
1120
  this.scroller.stop();
1085
1121
  }
1086
1122
  }
1087
- // Sorting uses the pointer against the currently active list. Its geometry
1088
- // is read live, so the placeholder and auto-scroll are both reflected.
1089
1123
  this._ref.dropList?.sortItem(this._ref, p);
1090
- if (this.autoScroll)
1091
- this.scroller.update(p.x, p.y);
1092
1124
  this.dragMove.emit(p);
1093
1125
  }
1126
+ /** فراخوانی می‌شود دقیقاً وقتی drag واقعاً شروع می‌شود (چه با موس، چه با کیبورد). */
1127
+ startScrollTracking() {
1128
+ this.scrollTarget = findScrollableAncestor(this._ref.el);
1129
+ this.lastScroll = getScrollPosition(this.scrollTarget);
1130
+ this.lastWindowScroll = { left: window.scrollX, top: window.scrollY };
1131
+ if (this.scrollTarget !== window) {
1132
+ this.removeContainerScroll = this.renderer.listen(this.scrollTarget, 'scroll', () => this.handleContainerScroll());
1133
+ }
1134
+ // همیشه window رو هم جدا گوش می‌دیم؛ چون ممکنه container محلی نداشته باشیم
1135
+ // ولی خودِ صفحه اسکرول بشه.
1136
+ this.removeWindowScroll = this.renderer.listen('window', 'scroll', () => this.handleWindowScroll());
1137
+ }
1138
+ handleContainerScroll() {
1139
+ const pos = getScrollPosition(this.scrollTarget);
1140
+ const dx = pos.left - this.lastScroll.left;
1141
+ const dy = pos.top - this.lastScroll.top;
1142
+ this.lastScroll = pos;
1143
+ this._ref.notifyScroll(dx, dy);
1144
+ }
1145
+ handleWindowScroll() {
1146
+ const left = window.scrollX;
1147
+ const top = window.scrollY;
1148
+ const dx = left - this.lastWindowScroll.left;
1149
+ const dy = top - this.lastWindowScroll.top;
1150
+ this.lastWindowScroll = { left, top };
1151
+ this._ref.notifyScroll(dx, dy);
1152
+ }
1153
+ stopScrollTracking() {
1154
+ this.removeContainerScroll?.();
1155
+ this.removeWindowScroll?.();
1156
+ this.removeContainerScroll = this.removeWindowScroll = undefined;
1157
+ }
1158
+ pointerMove(e) {
1159
+ if (!this.down || e.pointerId !== this.pointerId)
1160
+ return;
1161
+ const p = { x: e.clientX, y: e.clientY };
1162
+ this.lastPointer = p;
1163
+ if (!this.dragging() &&
1164
+ Math.hypot(p.x - this.start.x, p.y - this.start.y) < this.dragThreshold())
1165
+ return;
1166
+ if (!this.dragging()) {
1167
+ this._ref.startDrag(p);
1168
+ this.dragging.set(true);
1169
+ this.service.begin(this._ref);
1170
+ this.startScrollTracking();
1171
+ if (this.autoScroll()) {
1172
+ this.scroller.start(this._ref.el, () => this.applyDragUpdate(this.lastPointer));
1173
+ }
1174
+ this.dragStart.emit(p);
1175
+ }
1176
+ this.applyDragUpdate(p);
1177
+ if (this.autoScroll())
1178
+ this.scroller.update(p.x, p.y);
1179
+ }
1094
1180
  pointerUp(e) {
1095
1181
  if (!this.down || e.pointerId !== this.pointerId)
1096
1182
  return;
@@ -1112,6 +1198,7 @@ class NgxDraggable {
1112
1198
  this.dragging.set(false);
1113
1199
  this.down = false;
1114
1200
  this.scroller.stop();
1201
+ this.stopScrollTracking();
1115
1202
  this.removeMove?.();
1116
1203
  this.removeUp?.();
1117
1204
  this.removeEscape?.();
@@ -1119,9 +1206,9 @@ class NgxDraggable {
1119
1206
  }
1120
1207
  /** Arrow-key movement for keyboard/assistive-tech users. Shift multiplies the step by 4. */
1121
1208
  keyDown(e) {
1122
- if (this.disabled)
1209
+ if (this.disabled())
1123
1210
  return;
1124
- const step = this.keyboardStep * (e.shiftKey ? 4 : 1);
1211
+ const step = this.keyboardStep() * (e.shiftKey ? 4 : 1);
1125
1212
  const deltas = {
1126
1213
  ArrowLeft: { x: -step, y: 0 },
1127
1214
  ArrowRight: { x: step, y: 0 },
@@ -1133,11 +1220,12 @@ class NgxDraggable {
1133
1220
  e.preventDefault();
1134
1221
  if (!this.dragging()) {
1135
1222
  this._ref.pointerDown({ x: 0, y: 0 });
1136
- this._ref.boundary = this.boundary;
1137
- this._ref.lockAxis = this.lockAxis;
1223
+ this._ref.boundary = this.boundary();
1224
+ this._ref.lockAxis = this.lockAxis();
1138
1225
  this._ref.startDrag({ x: 0, y: 0 });
1139
1226
  this.dragging.set(true);
1140
1227
  this.service.begin(this._ref);
1228
+ this.startScrollTracking();
1141
1229
  this.dragStart.emit({ x: 0, y: 0 });
1142
1230
  }
1143
1231
  this._ref.nudge(delta.x, delta.y);
@@ -1150,6 +1238,7 @@ class NgxDraggable {
1150
1238
  this.service.end(this._ref);
1151
1239
  this.dragEnd.emit(this._ref.pointer);
1152
1240
  this.dragging.set(false);
1241
+ this.stopScrollTracking();
1153
1242
  }
1154
1243
  else if (e.key === 'Escape' && this.dragging()) {
1155
1244
  e.preventDefault();
@@ -1159,16 +1248,16 @@ class NgxDraggable {
1159
1248
  }
1160
1249
  }
1161
1250
  isOnHandle(target) {
1162
- if (!this.dragHandle)
1251
+ if (!this.dragHandle())
1163
1252
  return true;
1164
- return target instanceof HTMLElement && !!target.closest(this.dragHandle);
1253
+ return target instanceof HTMLElement && !!target.closest(this.dragHandle());
1165
1254
  }
1166
1255
  isInteractive(target) {
1167
1256
  return (target instanceof HTMLElement &&
1168
1257
  !!target.closest('button,a,input,textarea,select,[data-no-drag]'));
1169
1258
  }
1170
1259
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxDraggable, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1171
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.4", type: NgxDraggable, isStandalone: true, selector: "[NgxDraggable],[ngxDraggable]", inputs: { disabled: "disabled", boundary: "boundary", dragRootElement: "dragRootElement", dragHandle: "dragHandle", lockAxis: "lockAxis", dragThreshold: "dragThreshold", keyboardStep: "keyboardStep", autoScroll: "autoScroll", data: "data" }, outputs: { dragStart: "dragStart", dragMove: "dragMove", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "\"none\"", "attr.tabindex": "disabled ? null : 0", "attr.aria-grabbed": "dragging()" }, classAttribute: "ngx-draggable" }, providers: [{ provide: NGX_DRAGGABLE, useExisting: NgxDraggable }], ngImport: i0 });
1260
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.4", type: NgxDraggable, isStandalone: true, selector: "[NgxDraggable],[ngxDraggable]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, boundary: { classPropertyName: "boundary", publicName: "boundary", isSignal: true, isRequired: false, transformFunction: null }, dragRootElement: { classPropertyName: "dragRootElement", publicName: "dragRootElement", isSignal: true, isRequired: false, transformFunction: null }, dragHandle: { classPropertyName: "dragHandle", publicName: "dragHandle", isSignal: true, isRequired: false, transformFunction: null }, lockAxis: { classPropertyName: "lockAxis", publicName: "lockAxis", isSignal: true, isRequired: false, transformFunction: null }, dragThreshold: { classPropertyName: "dragThreshold", publicName: "dragThreshold", isSignal: true, isRequired: false, transformFunction: null }, keyboardStep: { classPropertyName: "keyboardStep", publicName: "keyboardStep", isSignal: true, isRequired: false, transformFunction: null }, autoScroll: { classPropertyName: "autoScroll", publicName: "autoScroll", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", dragRootElement: "dragRootElementChange", dragHandle: "dragHandleChange", dragStart: "dragStart", dragMove: "dragMove", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "\"none\"", "attr.tabindex": "disabled() ? null : 0", "attr.aria-grabbed": "dragging()", "class.disable-drag": "disabled()" }, classAttribute: "ngx-draggable" }, providers: [{ provide: NGX_DRAGGABLE, useExisting: NgxDraggable }], ngImport: i0 });
1172
1261
  }
1173
1262
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxDraggable, decorators: [{
1174
1263
  type: Directive,
@@ -1177,56 +1266,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
1177
1266
  providers: [{ provide: NGX_DRAGGABLE, useExisting: NgxDraggable }],
1178
1267
  host: {
1179
1268
  '[style.touch-action]': '"none"',
1180
- '[attr.tabindex]': 'disabled ? null : 0',
1269
+ '[attr.tabindex]': 'disabled() ? null : 0',
1181
1270
  '[attr.aria-grabbed]': 'dragging()',
1182
1271
  class: 'ngx-draggable',
1272
+ '[class.disable-drag]': 'disabled()',
1183
1273
  },
1184
1274
  }]
1185
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { disabled: [{
1186
- type: Input
1187
- }], boundary: [{
1188
- type: Input
1189
- }], dragRootElement: [{
1190
- type: Input
1191
- }], dragHandle: [{
1192
- type: Input
1193
- }], lockAxis: [{
1194
- type: Input
1195
- }], dragThreshold: [{
1196
- type: Input
1197
- }], keyboardStep: [{
1198
- type: Input
1199
- }], autoScroll: [{
1200
- type: Input
1201
- }], data: [{
1275
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], boundary: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundary", required: false }] }], dragRootElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragRootElement", required: false }] }, { type: i0.Output, args: ["dragRootElementChange"] }], dragHandle: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragHandle", required: false }] }, { type: i0.Output, args: ["dragHandleChange"] }], lockAxis: [{ type: i0.Input, args: [{ isSignal: true, alias: "lockAxis", required: false }] }], dragThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragThreshold", required: false }] }], keyboardStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardStep", required: false }] }], autoScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoScroll", required: false }] }], data: [{
1202
1276
  type: Input,
1203
1277
  args: ['data']
1204
- }], dragStart: [{
1205
- type: Output
1206
- }], dragMove: [{
1207
- type: Output
1208
- }], dragEnd: [{
1209
- type: Output
1210
- }] } });
1278
+ }], dragStart: [{ type: i0.Output, args: ["dragStart"] }], dragMove: [{ type: i0.Output, args: ["dragMove"] }], dragEnd: [{ type: i0.Output, args: ["dragEnd"] }] } });
1211
1279
 
1212
1280
  const ALL_DIRECTIONS = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'];
1213
1281
  const KEYBOARD_STEP = 8;
1214
1282
  class NgxResizable {
1215
1283
  el;
1216
- disabled = false;
1217
- minWidth = 20;
1218
- minHeight = 20;
1219
- maxWidth = Infinity;
1220
- maxHeight = Infinity;
1221
- directions = [...ALL_DIRECTIONS];
1222
- grid;
1284
+ disabled = model(false, /* @ts-ignore */
1285
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1286
+ minWidth = model(20, /* @ts-ignore */
1287
+ ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
1288
+ minHeight = model(20, /* @ts-ignore */
1289
+ ...(ngDevMode ? [{ debugName: "minHeight" }] : /* istanbul ignore next */ []));
1290
+ maxWidth = model(Infinity, /* @ts-ignore */
1291
+ ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
1292
+ maxHeight = model(Infinity, /* @ts-ignore */
1293
+ ...(ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []));
1294
+ directions = input([...ALL_DIRECTIONS], /* @ts-ignore */
1295
+ ...(ngDevMode ? [{ debugName: "directions" }] : /* istanbul ignore next */ []));
1296
+ grid = input(/* @ts-ignore */
1297
+ ...(ngDevMode ? [undefined, { debugName: "grid" }] : /* istanbul ignore next */ []));
1223
1298
  /** Element whose rect constrains the resize. Previously accepted nowhere on this directive. */
1224
- boundary;
1299
+ boundary = input(/* @ts-ignore */
1300
+ ...(ngDevMode ? [undefined, { debugName: "boundary" }] : /* istanbul ignore next */ []));
1225
1301
  /** Pixel step used when resizing via the keyboard (arrow keys, focus required). */
1226
- keyboardStep = KEYBOARD_STEP;
1227
- resizeStart = new EventEmitter();
1228
- resizeMove = new EventEmitter();
1229
- resizeEnd = new EventEmitter();
1302
+ keyboardStep = input(KEYBOARD_STEP, /* @ts-ignore */
1303
+ ...(ngDevMode ? [{ debugName: "keyboardStep" }] : /* istanbul ignore next */ []));
1304
+ resizeStart = output();
1305
+ resizeMove = output();
1306
+ resizeEnd = output();
1230
1307
  resizing = signal(false, /* @ts-ignore */
1231
1308
  ...(ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []));
1232
1309
  direction = 'se';
@@ -1244,7 +1321,7 @@ class NgxResizable {
1244
1321
  this.el = el;
1245
1322
  }
1246
1323
  onPointerDown(e) {
1247
- if (this.disabled || e.button !== 0) {
1324
+ if (this.disabled() || e.button !== 0) {
1248
1325
  return;
1249
1326
  }
1250
1327
  const dir = this.hitDirection(e);
@@ -1313,11 +1390,11 @@ class NgxResizable {
1313
1390
  this.finish();
1314
1391
  }
1315
1392
  onHandleKeyDown(e) {
1316
- if (this.disabled) {
1393
+ if (this.disabled()) {
1317
1394
  return;
1318
1395
  }
1319
1396
  const rtl = isRtl(this.el.nativeElement);
1320
- const step = this.keyboardStep * (e.shiftKey ? 4 : 1);
1397
+ const step = this.keyboardStep() * (e.shiftKey ? 4 : 1);
1321
1398
  let dw = 0;
1322
1399
  let dh = 0;
1323
1400
  if (e.key === 'ArrowRight') {
@@ -1337,8 +1414,8 @@ class NgxResizable {
1337
1414
  }
1338
1415
  e.preventDefault();
1339
1416
  const rect = this.el.nativeElement.getBoundingClientRect();
1340
- const width = this.clampGrid(Math.max(this.minWidth, Math.min(this.maxWidth, rect.width + dw)), 'x');
1341
- const height = this.clampGrid(Math.max(this.minHeight, Math.min(this.maxHeight, rect.height + dh)), 'y');
1417
+ const width = this.clampGrid(Math.max(this.minWidth(), Math.min(this.maxWidth(), rect.width + dw)), 'x');
1418
+ const height = this.clampGrid(Math.max(this.minHeight(), Math.min(this.maxHeight(), rect.height + dh)), 'y');
1342
1419
  this.el.nativeElement.style.width = `${width}px`;
1343
1420
  this.el.nativeElement.style.height = `${height}px`;
1344
1421
  const out = {
@@ -1382,8 +1459,8 @@ class NgxResizable {
1382
1459
  if (this.direction.includes('n')) {
1383
1460
  height -= dy;
1384
1461
  }
1385
- width = this.clampGrid(Math.max(this.minWidth, Math.min(this.maxWidth, width)), 'x');
1386
- height = this.clampGrid(Math.max(this.minHeight, Math.min(this.maxHeight, height)), 'y');
1462
+ width = this.clampGrid(Math.max(this.minWidth(), Math.min(this.maxWidth(), width)), 'x');
1463
+ height = this.clampGrid(Math.max(this.minHeight(), Math.min(this.maxHeight(), height)), 'y');
1387
1464
  /**
1388
1465
  * Calculate the intended visual position.
1389
1466
  *
@@ -1404,7 +1481,7 @@ class NgxResizable {
1404
1481
  * Boundary constraint.
1405
1482
  */
1406
1483
  if (this.boundary) {
1407
- const clamped = clampResizeWithinBoundary(this.boundary.getBoundingClientRect(), this.start, width, height, moveLeft, moveTop);
1484
+ const clamped = clampResizeWithinBoundary(this.boundary()?.getBoundingClientRect(), this.start, width, height, moveLeft, moveTop);
1408
1485
  width = clamped.width;
1409
1486
  height = clamped.height;
1410
1487
  moveLeft = clamped.left;
@@ -1473,7 +1550,7 @@ class NgxResizable {
1473
1550
  `${baseTransform}translate3d(` + `${correctionX}px, ` + `${correctionY}px, 0)`;
1474
1551
  }
1475
1552
  clampGrid(value, axis) {
1476
- const grid = typeof this.grid === 'number' ? this.grid : this.grid?.[axis];
1553
+ const grid = typeof this.grid() === 'number' ? this.grid : this.grid()?.[axis];
1477
1554
  if (!grid || grid <= 0) {
1478
1555
  return value;
1479
1556
  }
@@ -1488,7 +1565,7 @@ class NgxResizable {
1488
1565
  resolvedDirections() {
1489
1566
  const rtl = isRtl(this.el.nativeElement);
1490
1567
  const set = new Set();
1491
- for (const direction of this.directions) {
1568
+ for (const direction of this.directions()) {
1492
1569
  set.add(resolveLogicalDirection(direction, rtl));
1493
1570
  }
1494
1571
  return [...set];
@@ -1547,7 +1624,7 @@ class NgxResizable {
1547
1624
  return this.resolvedDirections().includes(direction) ? direction : null;
1548
1625
  }
1549
1626
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxResizable, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1550
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.4", type: NgxResizable, isStandalone: true, selector: "[NgxResizable],[ngxResizable]", inputs: { disabled: "disabled", minWidth: "minWidth", minHeight: "minHeight", maxWidth: "maxWidth", maxHeight: "maxHeight", directions: "directions", grid: "grid", boundary: "boundary", keyboardStep: "keyboardStep" }, outputs: { resizeStart: "resizeStart", resizeMove: "resizeMove", resizeEnd: "resizeEnd" }, host: { listeners: { "pointerdown": "onPointerDown($event)", "document:pointermove": "onPointerMove($event)", "document:pointerup": "onPointerUp($event)", "document:keydown": "onDocumentKeyDown($event)", "keydown": "onHandleKeyDown($event)" }, properties: { "style.touch-action": "\"none\"" }, classAttribute: "ngx-resizable" }, ngImport: i0 });
1627
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.4", type: NgxResizable, isStandalone: true, selector: "[NgxResizable],[ngxResizable]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, directions: { classPropertyName: "directions", publicName: "directions", isSignal: true, isRequired: false, transformFunction: null }, grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: false, transformFunction: null }, boundary: { classPropertyName: "boundary", publicName: "boundary", isSignal: true, isRequired: false, transformFunction: null }, keyboardStep: { classPropertyName: "keyboardStep", publicName: "keyboardStep", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", minWidth: "minWidthChange", minHeight: "minHeightChange", maxWidth: "maxWidthChange", maxHeight: "maxHeightChange", resizeStart: "resizeStart", resizeMove: "resizeMove", resizeEnd: "resizeEnd" }, host: { listeners: { "pointerdown": "onPointerDown($event)", "document:pointermove": "onPointerMove($event)", "document:pointerup": "onPointerUp($event)", "document:keydown": "onDocumentKeyDown($event)", "keydown": "onHandleKeyDown($event)" }, properties: { "style.touch-action": "\"none\"" }, classAttribute: "ngx-resizable" }, ngImport: i0 });
1551
1628
  }
1552
1629
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxResizable, decorators: [{
1553
1630
  type: Directive,
@@ -1558,31 +1635,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
1558
1635
  class: 'ngx-resizable',
1559
1636
  },
1560
1637
  }]
1561
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { disabled: [{
1562
- type: Input
1563
- }], minWidth: [{
1564
- type: Input
1565
- }], minHeight: [{
1566
- type: Input
1567
- }], maxWidth: [{
1568
- type: Input
1569
- }], maxHeight: [{
1570
- type: Input
1571
- }], directions: [{
1572
- type: Input
1573
- }], grid: [{
1574
- type: Input
1575
- }], boundary: [{
1576
- type: Input
1577
- }], keyboardStep: [{
1578
- type: Input
1579
- }], resizeStart: [{
1580
- type: Output
1581
- }], resizeMove: [{
1582
- type: Output
1583
- }], resizeEnd: [{
1584
- type: Output
1585
- }], onPointerDown: [{
1638
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }, { type: i0.Output, args: ["minWidthChange"] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }, { type: i0.Output, args: ["minHeightChange"] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }, { type: i0.Output, args: ["maxWidthChange"] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }, { type: i0.Output, args: ["maxHeightChange"] }], directions: [{ type: i0.Input, args: [{ isSignal: true, alias: "directions", required: false }] }], grid: [{ type: i0.Input, args: [{ isSignal: true, alias: "grid", required: false }] }], boundary: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundary", required: false }] }], keyboardStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardStep", required: false }] }], resizeStart: [{ type: i0.Output, args: ["resizeStart"] }], resizeMove: [{ type: i0.Output, args: ["resizeMove"] }], resizeEnd: [{ type: i0.Output, args: ["resizeEnd"] }], onPointerDown: [{
1586
1639
  type: HostListener,
1587
1640
  args: ['pointerdown', ['$event']]
1588
1641
  }], onPointerMove: [{
@@ -1660,5 +1713,5 @@ function clamp(v, max) {
1660
1713
  * Generated bundle index. Do not edit.
1661
1714
  */
1662
1715
 
1663
- export { AutoScroller, DragDropService, DragRef, DropListGroupRef, DropListRef, NGX_DRAGGABLE, NGX_DROPLIST, NGX_DROPLIST_GROUP, NGX_PLACEHOLDER, NgxDraggable, NgxDropList, NgxDropListGroup, NgxPlaceholder, NgxResizable, PlaceHolderRef, adjustForZoom, checkBoundX, checkBoundY, clampResizeWithinBoundary, copyArrayItem, getPageZoom, isRtl, moveItemInArray, resolveLogicalDirection, transferArrayItem };
1716
+ export { AutoScroller, DragDropService, DragRef, DropListGroupRef, DropListRef, NGX_DRAGGABLE, NGX_DROPLIST, NGX_DROPLIST_GROUP, NGX_PLACEHOLDER, NgxDraggable, NgxDropList, NgxDropListGroup, NgxPlaceholder, NgxResizable, PlaceHolderRef, adjustForZoom, checkBoundX, checkBoundY, clampResizeWithinBoundary, copyArrayItem, findScrollableAncestor, getPageZoom, getScrollPosition, isRtl, moveItemInArray, resolveLogicalDirection, transferArrayItem };
1664
1717
  //# sourceMappingURL=ngx-kit-drag-resize.mjs.map