ngx-kit 7.1.0 → 7.2.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.
- package/fesm2022/ngx-kit-date-picker.mjs +7 -1
- package/fesm2022/ngx-kit-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-drag-resize.mjs +76 -104
- package/fesm2022/ngx-kit-drag-resize.mjs.map +1 -1
- package/fesm2022/ngx-kit-drawer-menu.mjs +1 -1
- package/fesm2022/ngx-kit-drawer-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-form-field.mjs +9 -3
- package/fesm2022/ngx-kit-form-field.mjs.map +1 -1
- package/fesm2022/ngx-kit-grid-layout.mjs +18 -16
- package/fesm2022/ngx-kit-grid-layout.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +1 -1
- package/fesm2022/ngx-kit-message.mjs.map +1 -1
- package/fesm2022/ngx-kit-shared.mjs +64 -1
- package/fesm2022/ngx-kit-shared.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-kit-date-picker.d.ts +14 -11
- package/types/ngx-kit-drag-resize.d.ts +44 -44
- package/types/ngx-kit-form-field.d.ts +26 -23
- package/types/ngx-kit-shared.d.ts +39 -1
|
@@ -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, HostListener } from '@angular/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -970,26 +970,34 @@ const DEFAULT_KEYBOARD_STEP = 8;
|
|
|
970
970
|
class NgxDraggable {
|
|
971
971
|
host;
|
|
972
972
|
renderer;
|
|
973
|
-
disabled = false
|
|
973
|
+
disabled = model(false, /* @ts-ignore */
|
|
974
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
974
975
|
/** Element whose rect constrains the drag. Now actually enforced. */
|
|
975
|
-
boundary
|
|
976
|
-
|
|
976
|
+
boundary = input(/* @ts-ignore */
|
|
977
|
+
...(ngDevMode ? [undefined, { debugName: "boundary" }] : /* istanbul ignore next */ []));
|
|
978
|
+
dragRootElement = input('', /* @ts-ignore */
|
|
979
|
+
...(ngDevMode ? [{ debugName: "dragRootElement" }] : /* istanbul ignore next */ []));
|
|
977
980
|
/** CSS selector for a drag handle. When set, only pointerdowns inside it start a drag. */
|
|
978
|
-
dragHandle = ''
|
|
981
|
+
dragHandle = input('', /* @ts-ignore */
|
|
982
|
+
...(ngDevMode ? [{ debugName: "dragHandle" }] : /* istanbul ignore next */ []));
|
|
979
983
|
/** Restrict movement to a single axis. */
|
|
980
|
-
lockAxis
|
|
984
|
+
lockAxis = input(/* @ts-ignore */
|
|
985
|
+
...(ngDevMode ? [undefined, { debugName: "lockAxis" }] : /* istanbul ignore next */ []));
|
|
981
986
|
/** Minimum pointer travel (px) before a drag starts, so clicks still register normally. */
|
|
982
|
-
dragThreshold = 3
|
|
987
|
+
dragThreshold = input(3, /* @ts-ignore */
|
|
988
|
+
...(ngDevMode ? [{ debugName: "dragThreshold" }] : /* istanbul ignore next */ []));
|
|
983
989
|
/** Pixel step used when dragging via the keyboard (arrow keys, focus required). */
|
|
984
|
-
keyboardStep = DEFAULT_KEYBOARD_STEP
|
|
990
|
+
keyboardStep = input(DEFAULT_KEYBOARD_STEP, /* @ts-ignore */
|
|
991
|
+
...(ngDevMode ? [{ debugName: "keyboardStep" }] : /* istanbul ignore next */ []));
|
|
985
992
|
/** Auto-scroll the nearest scrollable ancestor while dragging near its edge. */
|
|
986
|
-
autoScroll = true
|
|
993
|
+
autoScroll = input(true, /* @ts-ignore */
|
|
994
|
+
...(ngDevMode ? [{ debugName: "autoScroll" }] : /* istanbul ignore next */ []));
|
|
987
995
|
set data(v) {
|
|
988
996
|
this._ref.data = v;
|
|
989
997
|
}
|
|
990
|
-
dragStart =
|
|
991
|
-
dragMove =
|
|
992
|
-
dragEnd =
|
|
998
|
+
dragStart = output();
|
|
999
|
+
dragMove = output();
|
|
1000
|
+
dragEnd = output();
|
|
993
1001
|
_ref = new DragRef();
|
|
994
1002
|
dragging = signal(false, /* @ts-ignore */
|
|
995
1003
|
...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
|
|
@@ -1011,11 +1019,11 @@ class NgxDraggable {
|
|
|
1011
1019
|
this.renderer = renderer;
|
|
1012
1020
|
}
|
|
1013
1021
|
ngOnInit() {
|
|
1014
|
-
this._ref.el = this.dragRootElement
|
|
1015
|
-
? (this.host.nativeElement.closest(this.dragRootElement) ?? this.host.nativeElement)
|
|
1022
|
+
this._ref.el = this.dragRootElement()
|
|
1023
|
+
? (this.host.nativeElement.closest(this.dragRootElement()) ?? this.host.nativeElement)
|
|
1016
1024
|
: this.host.nativeElement;
|
|
1017
|
-
this._ref.boundary = this.boundary;
|
|
1018
|
-
this._ref.lockAxis = this.lockAxis;
|
|
1025
|
+
this._ref.boundary = this.boundary();
|
|
1026
|
+
this._ref.lockAxis = this.lockAxis();
|
|
1019
1027
|
this._ref.dropListGroup = this.group?._ref;
|
|
1020
1028
|
this._ref.init();
|
|
1021
1029
|
this._ref.withDropList(this.list?._ref ?? null);
|
|
@@ -1034,7 +1042,7 @@ class NgxDraggable {
|
|
|
1034
1042
|
this._ref.dropList?.removeItem(this._ref);
|
|
1035
1043
|
}
|
|
1036
1044
|
pointerDown(e) {
|
|
1037
|
-
if (this.disabled ||
|
|
1045
|
+
if (this.disabled() ||
|
|
1038
1046
|
e.button !== 0 ||
|
|
1039
1047
|
// this.isInteractive(e.target) ||
|
|
1040
1048
|
!this.isOnHandle(e.target))
|
|
@@ -1043,8 +1051,8 @@ class NgxDraggable {
|
|
|
1043
1051
|
this.down = true;
|
|
1044
1052
|
this.pointerId = e.pointerId;
|
|
1045
1053
|
this.start = { x: e.clientX, y: e.clientY };
|
|
1046
|
-
this._ref.boundary = this.boundary;
|
|
1047
|
-
this._ref.lockAxis = this.lockAxis;
|
|
1054
|
+
this._ref.boundary = this.boundary();
|
|
1055
|
+
this._ref.lockAxis = this.lockAxis();
|
|
1048
1056
|
this._ref.pointerDown(this.start);
|
|
1049
1057
|
this.removeMove = this.renderer.listen(this.doc, 'pointermove', (ev) => this.pointerMove(ev));
|
|
1050
1058
|
this.removeUp = this.renderer.listen(this.doc, 'pointerup', (ev) => this.pointerUp(ev));
|
|
@@ -1057,13 +1065,14 @@ class NgxDraggable {
|
|
|
1057
1065
|
if (!this.down || e.pointerId !== this.pointerId)
|
|
1058
1066
|
return;
|
|
1059
1067
|
const p = { x: e.clientX, y: e.clientY };
|
|
1060
|
-
if (!this.dragging() &&
|
|
1068
|
+
if (!this.dragging() &&
|
|
1069
|
+
Math.hypot(p.x - this.start.x, p.y - this.start.y) < this.dragThreshold())
|
|
1061
1070
|
return;
|
|
1062
1071
|
if (!this.dragging()) {
|
|
1063
1072
|
this._ref.startDrag(p);
|
|
1064
1073
|
this.dragging.set(true);
|
|
1065
1074
|
this.service.begin(this._ref);
|
|
1066
|
-
if (this.autoScroll)
|
|
1075
|
+
if (this.autoScroll())
|
|
1067
1076
|
this.scroller.start(this._ref.el);
|
|
1068
1077
|
this.dragStart.emit(p);
|
|
1069
1078
|
}
|
|
@@ -1075,19 +1084,19 @@ class NgxDraggable {
|
|
|
1075
1084
|
if (target) {
|
|
1076
1085
|
this._ref.withDropList(target);
|
|
1077
1086
|
target.createPlaceholder(this._ref);
|
|
1078
|
-
if (this.autoScroll) {
|
|
1087
|
+
if (this.autoScroll()) {
|
|
1079
1088
|
this.scroller.stop();
|
|
1080
1089
|
this.scroller.start(target.el);
|
|
1081
1090
|
}
|
|
1082
1091
|
}
|
|
1083
|
-
else if (this.autoScroll) {
|
|
1092
|
+
else if (this.autoScroll()) {
|
|
1084
1093
|
this.scroller.stop();
|
|
1085
1094
|
}
|
|
1086
1095
|
}
|
|
1087
1096
|
// Sorting uses the pointer against the currently active list. Its geometry
|
|
1088
1097
|
// is read live, so the placeholder and auto-scroll are both reflected.
|
|
1089
1098
|
this._ref.dropList?.sortItem(this._ref, p);
|
|
1090
|
-
if (this.autoScroll)
|
|
1099
|
+
if (this.autoScroll())
|
|
1091
1100
|
this.scroller.update(p.x, p.y);
|
|
1092
1101
|
this.dragMove.emit(p);
|
|
1093
1102
|
}
|
|
@@ -1119,9 +1128,9 @@ class NgxDraggable {
|
|
|
1119
1128
|
}
|
|
1120
1129
|
/** Arrow-key movement for keyboard/assistive-tech users. Shift multiplies the step by 4. */
|
|
1121
1130
|
keyDown(e) {
|
|
1122
|
-
if (this.disabled)
|
|
1131
|
+
if (this.disabled())
|
|
1123
1132
|
return;
|
|
1124
|
-
const step = this.keyboardStep * (e.shiftKey ? 4 : 1);
|
|
1133
|
+
const step = this.keyboardStep() * (e.shiftKey ? 4 : 1);
|
|
1125
1134
|
const deltas = {
|
|
1126
1135
|
ArrowLeft: { x: -step, y: 0 },
|
|
1127
1136
|
ArrowRight: { x: step, y: 0 },
|
|
@@ -1133,8 +1142,8 @@ class NgxDraggable {
|
|
|
1133
1142
|
e.preventDefault();
|
|
1134
1143
|
if (!this.dragging()) {
|
|
1135
1144
|
this._ref.pointerDown({ x: 0, y: 0 });
|
|
1136
|
-
this._ref.boundary = this.boundary;
|
|
1137
|
-
this._ref.lockAxis = this.lockAxis;
|
|
1145
|
+
this._ref.boundary = this.boundary();
|
|
1146
|
+
this._ref.lockAxis = this.lockAxis();
|
|
1138
1147
|
this._ref.startDrag({ x: 0, y: 0 });
|
|
1139
1148
|
this.dragging.set(true);
|
|
1140
1149
|
this.service.begin(this._ref);
|
|
@@ -1159,16 +1168,16 @@ class NgxDraggable {
|
|
|
1159
1168
|
}
|
|
1160
1169
|
}
|
|
1161
1170
|
isOnHandle(target) {
|
|
1162
|
-
if (!this.dragHandle)
|
|
1171
|
+
if (!this.dragHandle())
|
|
1163
1172
|
return true;
|
|
1164
|
-
return target instanceof HTMLElement && !!target.closest(this.dragHandle);
|
|
1173
|
+
return target instanceof HTMLElement && !!target.closest(this.dragHandle());
|
|
1165
1174
|
}
|
|
1166
1175
|
isInteractive(target) {
|
|
1167
1176
|
return (target instanceof HTMLElement &&
|
|
1168
1177
|
!!target.closest('button,a,input,textarea,select,[data-no-drag]'));
|
|
1169
1178
|
}
|
|
1170
1179
|
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: "
|
|
1180
|
+
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", 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 });
|
|
1172
1181
|
}
|
|
1173
1182
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxDraggable, decorators: [{
|
|
1174
1183
|
type: Directive,
|
|
@@ -1177,56 +1186,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
1177
1186
|
providers: [{ provide: NGX_DRAGGABLE, useExisting: NgxDraggable }],
|
|
1178
1187
|
host: {
|
|
1179
1188
|
'[style.touch-action]': '"none"',
|
|
1180
|
-
'[attr.tabindex]': 'disabled ? null : 0',
|
|
1189
|
+
'[attr.tabindex]': 'disabled() ? null : 0',
|
|
1181
1190
|
'[attr.aria-grabbed]': 'dragging()',
|
|
1182
1191
|
class: 'ngx-draggable',
|
|
1183
1192
|
},
|
|
1184
1193
|
}]
|
|
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: [{
|
|
1194
|
+
}], 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 }] }], dragHandle: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragHandle", required: false }] }], 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
1195
|
type: Input,
|
|
1203
1196
|
args: ['data']
|
|
1204
|
-
}], dragStart: [{
|
|
1205
|
-
type: Output
|
|
1206
|
-
}], dragMove: [{
|
|
1207
|
-
type: Output
|
|
1208
|
-
}], dragEnd: [{
|
|
1209
|
-
type: Output
|
|
1210
|
-
}] } });
|
|
1197
|
+
}], dragStart: [{ type: i0.Output, args: ["dragStart"] }], dragMove: [{ type: i0.Output, args: ["dragMove"] }], dragEnd: [{ type: i0.Output, args: ["dragEnd"] }] } });
|
|
1211
1198
|
|
|
1212
1199
|
const ALL_DIRECTIONS = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'];
|
|
1213
1200
|
const KEYBOARD_STEP = 8;
|
|
1214
1201
|
class NgxResizable {
|
|
1215
1202
|
el;
|
|
1216
|
-
disabled = false
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1203
|
+
disabled = model(false, /* @ts-ignore */
|
|
1204
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1205
|
+
minWidth = model(20, /* @ts-ignore */
|
|
1206
|
+
...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
1207
|
+
minHeight = model(20, /* @ts-ignore */
|
|
1208
|
+
...(ngDevMode ? [{ debugName: "minHeight" }] : /* istanbul ignore next */ []));
|
|
1209
|
+
maxWidth = model(Infinity, /* @ts-ignore */
|
|
1210
|
+
...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
1211
|
+
maxHeight = model(Infinity, /* @ts-ignore */
|
|
1212
|
+
...(ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []));
|
|
1213
|
+
directions = input([...ALL_DIRECTIONS], /* @ts-ignore */
|
|
1214
|
+
...(ngDevMode ? [{ debugName: "directions" }] : /* istanbul ignore next */ []));
|
|
1215
|
+
grid = input(/* @ts-ignore */
|
|
1216
|
+
...(ngDevMode ? [undefined, { debugName: "grid" }] : /* istanbul ignore next */ []));
|
|
1223
1217
|
/** Element whose rect constrains the resize. Previously accepted nowhere on this directive. */
|
|
1224
|
-
boundary
|
|
1218
|
+
boundary = input(/* @ts-ignore */
|
|
1219
|
+
...(ngDevMode ? [undefined, { debugName: "boundary" }] : /* istanbul ignore next */ []));
|
|
1225
1220
|
/** Pixel step used when resizing via the keyboard (arrow keys, focus required). */
|
|
1226
|
-
keyboardStep = KEYBOARD_STEP
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1221
|
+
keyboardStep = input(KEYBOARD_STEP, /* @ts-ignore */
|
|
1222
|
+
...(ngDevMode ? [{ debugName: "keyboardStep" }] : /* istanbul ignore next */ []));
|
|
1223
|
+
resizeStart = output();
|
|
1224
|
+
resizeMove = output();
|
|
1225
|
+
resizeEnd = output();
|
|
1230
1226
|
resizing = signal(false, /* @ts-ignore */
|
|
1231
1227
|
...(ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []));
|
|
1232
1228
|
direction = 'se';
|
|
@@ -1244,7 +1240,7 @@ class NgxResizable {
|
|
|
1244
1240
|
this.el = el;
|
|
1245
1241
|
}
|
|
1246
1242
|
onPointerDown(e) {
|
|
1247
|
-
if (this.disabled || e.button !== 0) {
|
|
1243
|
+
if (this.disabled() || e.button !== 0) {
|
|
1248
1244
|
return;
|
|
1249
1245
|
}
|
|
1250
1246
|
const dir = this.hitDirection(e);
|
|
@@ -1313,11 +1309,11 @@ class NgxResizable {
|
|
|
1313
1309
|
this.finish();
|
|
1314
1310
|
}
|
|
1315
1311
|
onHandleKeyDown(e) {
|
|
1316
|
-
if (this.disabled) {
|
|
1312
|
+
if (this.disabled()) {
|
|
1317
1313
|
return;
|
|
1318
1314
|
}
|
|
1319
1315
|
const rtl = isRtl(this.el.nativeElement);
|
|
1320
|
-
const step = this.keyboardStep * (e.shiftKey ? 4 : 1);
|
|
1316
|
+
const step = this.keyboardStep() * (e.shiftKey ? 4 : 1);
|
|
1321
1317
|
let dw = 0;
|
|
1322
1318
|
let dh = 0;
|
|
1323
1319
|
if (e.key === 'ArrowRight') {
|
|
@@ -1337,8 +1333,8 @@ class NgxResizable {
|
|
|
1337
1333
|
}
|
|
1338
1334
|
e.preventDefault();
|
|
1339
1335
|
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');
|
|
1336
|
+
const width = this.clampGrid(Math.max(this.minWidth(), Math.min(this.maxWidth(), rect.width + dw)), 'x');
|
|
1337
|
+
const height = this.clampGrid(Math.max(this.minHeight(), Math.min(this.maxHeight(), rect.height + dh)), 'y');
|
|
1342
1338
|
this.el.nativeElement.style.width = `${width}px`;
|
|
1343
1339
|
this.el.nativeElement.style.height = `${height}px`;
|
|
1344
1340
|
const out = {
|
|
@@ -1382,8 +1378,8 @@ class NgxResizable {
|
|
|
1382
1378
|
if (this.direction.includes('n')) {
|
|
1383
1379
|
height -= dy;
|
|
1384
1380
|
}
|
|
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');
|
|
1381
|
+
width = this.clampGrid(Math.max(this.minWidth(), Math.min(this.maxWidth(), width)), 'x');
|
|
1382
|
+
height = this.clampGrid(Math.max(this.minHeight(), Math.min(this.maxHeight(), height)), 'y');
|
|
1387
1383
|
/**
|
|
1388
1384
|
* Calculate the intended visual position.
|
|
1389
1385
|
*
|
|
@@ -1404,7 +1400,7 @@ class NgxResizable {
|
|
|
1404
1400
|
* Boundary constraint.
|
|
1405
1401
|
*/
|
|
1406
1402
|
if (this.boundary) {
|
|
1407
|
-
const clamped = clampResizeWithinBoundary(this.boundary
|
|
1403
|
+
const clamped = clampResizeWithinBoundary(this.boundary()?.getBoundingClientRect(), this.start, width, height, moveLeft, moveTop);
|
|
1408
1404
|
width = clamped.width;
|
|
1409
1405
|
height = clamped.height;
|
|
1410
1406
|
moveLeft = clamped.left;
|
|
@@ -1473,7 +1469,7 @@ class NgxResizable {
|
|
|
1473
1469
|
`${baseTransform}translate3d(` + `${correctionX}px, ` + `${correctionY}px, 0)`;
|
|
1474
1470
|
}
|
|
1475
1471
|
clampGrid(value, axis) {
|
|
1476
|
-
const grid = typeof this.grid === 'number' ? this.grid : this.grid?.[axis];
|
|
1472
|
+
const grid = typeof this.grid() === 'number' ? this.grid : this.grid()?.[axis];
|
|
1477
1473
|
if (!grid || grid <= 0) {
|
|
1478
1474
|
return value;
|
|
1479
1475
|
}
|
|
@@ -1488,7 +1484,7 @@ class NgxResizable {
|
|
|
1488
1484
|
resolvedDirections() {
|
|
1489
1485
|
const rtl = isRtl(this.el.nativeElement);
|
|
1490
1486
|
const set = new Set();
|
|
1491
|
-
for (const direction of this.directions) {
|
|
1487
|
+
for (const direction of this.directions()) {
|
|
1492
1488
|
set.add(resolveLogicalDirection(direction, rtl));
|
|
1493
1489
|
}
|
|
1494
1490
|
return [...set];
|
|
@@ -1547,7 +1543,7 @@ class NgxResizable {
|
|
|
1547
1543
|
return this.resolvedDirections().includes(direction) ? direction : null;
|
|
1548
1544
|
}
|
|
1549
1545
|
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: "
|
|
1546
|
+
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
1547
|
}
|
|
1552
1548
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxResizable, decorators: [{
|
|
1553
1549
|
type: Directive,
|
|
@@ -1558,31 +1554,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
1558
1554
|
class: 'ngx-resizable',
|
|
1559
1555
|
},
|
|
1560
1556
|
}]
|
|
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: [{
|
|
1557
|
+
}], 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
1558
|
type: HostListener,
|
|
1587
1559
|
args: ['pointerdown', ['$event']]
|
|
1588
1560
|
}], onPointerMove: [{
|