ngx-tethys 19.1.0-next.0 → 19.1.0-next.10
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/CHANGELOG.md +126 -0
- package/README.md +0 -1
- package/action/action.component.d.ts +7 -8
- package/affix/affix.component.d.ts +3 -4
- package/arrow-switcher/arrow-switcher.component.d.ts +5 -1
- package/badge/badge.component.d.ts +1 -1
- package/button/button-group.component.d.ts +5 -12
- package/button/button-icon.component.d.ts +14 -28
- package/button/button.component.d.ts +17 -27
- package/color-picker/coordinates.directive.d.ts +1 -2
- package/date-picker/abstract-picker.component.d.ts +50 -52
- package/date-picker/abstract-picker.directive.d.ts +15 -40
- package/date-picker/base-picker.component.d.ts +12 -40
- package/date-picker/date-picker.config.d.ts +3 -0
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +24 -19
- package/date-picker/lib/calendar/calendar-header.component.d.ts +15 -15
- package/date-picker/lib/calendar/calendar-table.component.d.ts +15 -16
- package/date-picker/lib/date/date-table-cell.component.d.ts +6 -3
- package/date-picker/lib/date/date-table.component.d.ts +2 -3
- package/date-picker/lib/date-carousel/date-carousel.component.d.ts +2 -3
- package/date-picker/lib/decade/decade-header.component.d.ts +2 -5
- package/date-picker/lib/decade/decade-table.component.d.ts +3 -5
- package/date-picker/lib/month/month-table.component.d.ts +1 -2
- package/date-picker/lib/popups/date-popup.component.d.ts +33 -34
- package/date-picker/lib/popups/inner-popup.component.d.ts +22 -29
- package/date-picker/lib/quarter/quarter-table.component.d.ts +1 -4
- package/date-picker/lib/year/year-header.component.d.ts +2 -4
- package/date-picker/lib/year/year-table.component.d.ts +2 -4
- package/date-picker/month-picker.component.d.ts +2 -2
- package/date-picker/picker.component.d.ts +31 -36
- package/date-picker/picker.pipes.d.ts +4 -5
- package/date-picker/picker.util.d.ts +5 -5
- package/date-picker/picker.validators.d.ts +4 -8
- package/date-picker/quarter-picker.component.d.ts +2 -3
- package/date-picker/styles/calendar.scss +1 -1
- package/date-picker/styles/range-picker.scss +1 -0
- package/date-picker/styles/week-picker.scss +1 -0
- package/date-picker/week-picker.component.d.ts +0 -1
- package/date-picker/year-picker.component.d.ts +2 -3
- package/dropdown/dropdown-active.directive.d.ts +4 -5
- package/dropdown/dropdown-menu-item.directive.d.ts +7 -15
- package/dropdown/dropdown-menu.component.d.ts +6 -13
- package/dropdown/dropdown-submenu.component.d.ts +2 -4
- package/dropdown/dropdown.directive.d.ts +15 -25
- package/empty/empty.component.d.ts +2 -1
- package/fesm2022/ngx-tethys-action.mjs +15 -16
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +14 -18
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +15 -3
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +4 -4
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-button.mjs +225 -322
- package/fesm2022/ngx-tethys-button.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +1 -0
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +2 -2
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-collapse.mjs +2 -2
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +4 -6
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +2 -2
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +861 -1078
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +5 -5
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +159 -209
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +5 -2
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +68 -88
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +10 -15
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +26 -6
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-icon.mjs +44 -59
- package/fesm2022/ngx-tethys-icon.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +44 -42
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-layout.mjs +291 -334
- package/fesm2022/ngx-tethys-layout.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +183 -217
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +29 -36
- package/fesm2022/ngx-tethys-message.mjs.map +1 -1
- package/fesm2022/ngx-tethys-notify.mjs +33 -41
- package/fesm2022/ngx-tethys-notify.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +7 -11
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +8 -19
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +46 -58
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-rate.mjs +115 -157
- package/fesm2022/ngx-tethys-rate.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +100 -143
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-segment.mjs +84 -103
- package/fesm2022/ngx-tethys-segment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-select.mjs +164 -228
- package/fesm2022/ngx-tethys-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +423 -586
- package/fesm2022/ngx-tethys-shared.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +1 -2
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slide.mjs +37 -56
- package/fesm2022/ngx-tethys-slide.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +2 -8
- package/fesm2022/ngx-tethys-space.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-strength.mjs +52 -66
- package/fesm2022/ngx-tethys-strength.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -2
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-time-picker.mjs +244 -271
- package/fesm2022/ngx-tethys-time-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tooltip.mjs +109 -93
- package/fesm2022/ngx-tethys-tooltip.mjs.map +1 -1
- package/fesm2022/ngx-tethys-transfer.mjs +98 -119
- package/fesm2022/ngx-tethys-transfer.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +216 -284
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree.mjs +281 -401
- package/fesm2022/ngx-tethys-tree.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +2 -2
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-vote.mjs +53 -99
- package/fesm2022/ngx-tethys-vote.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/flexible-text/flexible-text.component.d.ts +9 -15
- package/grid/flex.d.ts +1 -3
- package/grid/thy-row.directive.d.ts +1 -4
- package/i18n/i18n.d.ts +7 -2
- package/i18n/locales/de-de.d.ts +5 -1
- package/i18n/locales/en-us.d.ts +5 -1
- package/i18n/locales/ja-jp.d.ts +5 -1
- package/i18n/locales/zh-hans.d.ts +5 -1
- package/i18n/locales/zh-hant.d.ts +5 -1
- package/icon/icon.component.d.ts +10 -18
- package/image/image.directive.d.ts +10 -13
- package/image/image.token.d.ts +5 -5
- package/image/preview/image-preview.component.d.ts +2 -2
- package/input-number/input-number.component.d.ts +1 -1
- package/layout/header.component.d.ts +15 -19
- package/layout/layout.component.d.ts +3 -2
- package/layout/sidebar-header.component.d.ts +7 -8
- package/layout/sidebar.component.d.ts +32 -62
- package/list/list-item-meta.component.d.ts +7 -9
- package/list/list-item.component.d.ts +0 -2
- package/list/list.component.d.ts +2 -8
- package/list/selection/selection-list.d.ts +33 -46
- package/message/abstract/abstract-message.component.d.ts +2 -3
- package/message/message-container.component.d.ts +0 -1
- package/message/message.component.d.ts +1 -3
- package/notify/notify-container.component.d.ts +0 -1
- package/notify/notify.component.d.ts +7 -12
- package/package.json +1 -1
- package/progress/progress-circle.component.d.ts +3 -5
- package/progress/progress.component.d.ts +2 -4
- package/property/properties.component.d.ts +0 -2
- package/property/property-item.component.d.ts +3 -10
- package/radio/group/radio-group.component.d.ts +5 -9
- package/rate/rate-item.component.d.ts +8 -11
- package/rate/rate.component.d.ts +18 -29
- package/resizable/resizable.directive.d.ts +20 -32
- package/resizable/resize-handle.component.d.ts +6 -7
- package/resizable/resize-handles.component.d.ts +5 -9
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/segment-item.component.d.ts +9 -15
- package/segment/segment.component.d.ts +11 -15
- package/segment/segment.token.d.ts +4 -3
- package/select/custom-select/custom-select.component.d.ts +33 -56
- package/select/native-select/native-select.component.d.ts +7 -13
- package/shared/base-form-check.component.d.ts +6 -8
- package/shared/directives/string-or-template-outlet.directive.d.ts +5 -6
- package/shared/directives/thy-autofocus.directive.d.ts +4 -6
- package/shared/directives/thy-contextmenu.directive.d.ts +2 -2
- package/shared/directives/thy-ctrl-enter.directive.d.ts +2 -2
- package/shared/directives/thy-enter.directive.d.ts +2 -2
- package/shared/directives/thy-scroll.directive.d.ts +5 -8
- package/shared/directives/thy-show.d.ts +5 -6
- package/shared/directives/thy-stop-propagation.directive.d.ts +4 -4
- package/shared/directives/view-outlet.directive.d.ts +6 -7
- package/shared/ng-transclude.directive.d.ts +2 -3
- package/shared/option/group/option-group.component.d.ts +5 -9
- package/shared/option/list-option/list-option.component.d.ts +9 -13
- package/shared/option/option.component.d.ts +10 -17
- package/shared/option/option.token.d.ts +4 -3
- package/shared/option/options-container.component.d.ts +1 -1
- package/shared/select/select-control/select-control.component.d.ts +38 -53
- package/slide/slide-body/slide-body-section.component.d.ts +2 -6
- package/slide/slide-header/slide-header.component.d.ts +6 -9
- package/space/space.component.d.ts +5 -11
- package/stepper/stepper.component.d.ts +1 -1
- package/strength/strength.component.d.ts +8 -13
- package/table/table-column.component.d.ts +15 -5
- package/time-picker/inner/inner-time-picker.class.d.ts +15 -13
- package/time-picker/inner/inner-time-picker.component.d.ts +26 -26
- package/time-picker/time-picker-panel.component.d.ts +18 -20
- package/time-picker/time-picker.component.d.ts +22 -30
- package/tooltip/tooltip.directive.d.ts +20 -22
- package/transfer/transfer-list.component.d.ts +15 -15
- package/transfer/transfer.component.d.ts +20 -23
- package/tree/tree-abstract.d.ts +5 -5
- package/tree/tree-node.component.d.ts +24 -37
- package/tree/tree.class.d.ts +4 -4
- package/tree/tree.component.d.ts +47 -75
- package/tree/tree.service.d.ts +3 -4
- package/tree-select/tree-select.component.d.ts +54 -71
- package/vote/vote.component.d.ts +13 -33
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, NgZone, Injectable, ElementRef, Renderer2,
|
|
2
|
+
import { inject, NgZone, Injectable, ElementRef, Renderer2, input, numberAttribute, output, signal, DestroyRef, Directive, ChangeDetectionStrategy, Component, computed, NgModule } from '@angular/core';
|
|
3
3
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
4
4
|
import { isTouchEvent, coerceBooleanProperty } from 'ngx-tethys/util';
|
|
5
5
|
import { Subject, fromEvent, merge } from 'rxjs';
|
|
@@ -89,105 +89,112 @@ function setCompatibleStyle(element, key, value) {
|
|
|
89
89
|
* @name thyResizable
|
|
90
90
|
*/
|
|
91
91
|
class ThyResizableDirective {
|
|
92
|
+
get nativeElement() {
|
|
93
|
+
return this.elementRef.nativeElement;
|
|
94
|
+
}
|
|
92
95
|
constructor() {
|
|
93
96
|
this.elementRef = inject(ElementRef);
|
|
94
97
|
this.renderer = inject(Renderer2);
|
|
95
98
|
this.platform = inject(Platform);
|
|
96
99
|
this.ngZone = inject(NgZone);
|
|
97
100
|
this.thyResizableService = inject(ThyResizableService);
|
|
98
|
-
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
99
101
|
/**
|
|
100
102
|
* 调整尺寸的边界
|
|
101
103
|
* @default parent
|
|
102
104
|
* @type 'window' | 'parent' | ElementRef<HTMLElement>
|
|
103
105
|
*/
|
|
104
|
-
this.thyBounds = 'parent';
|
|
106
|
+
this.thyBounds = input('parent');
|
|
107
|
+
/**
|
|
108
|
+
* 最大高度(超过边界部分忽略)
|
|
109
|
+
*/
|
|
110
|
+
this.thyMaxHeight = input(undefined, { transform: numberAttribute });
|
|
111
|
+
/**
|
|
112
|
+
* 最大宽度(超过边界部分忽略)
|
|
113
|
+
*/
|
|
114
|
+
this.thyMaxWidth = input(undefined, { transform: numberAttribute });
|
|
105
115
|
/**
|
|
106
116
|
* 最小高度
|
|
107
117
|
*/
|
|
108
|
-
this.thyMinHeight = 40;
|
|
118
|
+
this.thyMinHeight = input(40, { transform: numberAttribute });
|
|
109
119
|
/**
|
|
110
120
|
* 最小宽度
|
|
111
121
|
*/
|
|
112
|
-
this.thyMinWidth = 40;
|
|
122
|
+
this.thyMinWidth = input(40, { transform: numberAttribute });
|
|
113
123
|
/**
|
|
114
124
|
* 栅格列数(-1 为不栅格)
|
|
115
125
|
*/
|
|
116
|
-
this.thyGridColumnCount = -1;
|
|
126
|
+
this.thyGridColumnCount = input(-1, { transform: numberAttribute });
|
|
117
127
|
/**
|
|
118
128
|
* 栅格最大列数
|
|
119
129
|
*/
|
|
120
|
-
this.thyMaxColumn = -1;
|
|
130
|
+
this.thyMaxColumn = input(-1, { transform: numberAttribute });
|
|
121
131
|
/**
|
|
122
132
|
* 栅格最小列数
|
|
123
133
|
*/
|
|
124
|
-
this.thyMinColumn = -1;
|
|
134
|
+
this.thyMinColumn = input(-1, { transform: numberAttribute });
|
|
125
135
|
/**
|
|
126
136
|
* 锁定宽高比
|
|
127
137
|
*/
|
|
128
|
-
this.thyLockAspectRatio = false;
|
|
138
|
+
this.thyLockAspectRatio = input(false, { transform: coerceBooleanProperty });
|
|
129
139
|
/**
|
|
130
140
|
* 是否预览模式
|
|
131
141
|
*/
|
|
132
|
-
this.thyPreview = false;
|
|
142
|
+
this.thyPreview = input(false, { transform: coerceBooleanProperty });
|
|
133
143
|
/**
|
|
134
144
|
* 是否禁用调整大小
|
|
135
145
|
*/
|
|
136
|
-
this.thyDisabled = false;
|
|
146
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
137
147
|
/**
|
|
138
148
|
* 调整尺寸时的事件
|
|
139
149
|
*/
|
|
140
|
-
this.thyResize =
|
|
150
|
+
this.thyResize = output();
|
|
141
151
|
/**
|
|
142
152
|
* 开始调整尺寸时的事件
|
|
143
153
|
*/
|
|
144
|
-
this.thyResizeStart =
|
|
154
|
+
this.thyResizeStart = output();
|
|
145
155
|
/**
|
|
146
156
|
* 结束调整尺寸时的事件
|
|
147
157
|
*/
|
|
148
|
-
this.thyResizeEnd =
|
|
149
|
-
this.resizing = false;
|
|
158
|
+
this.thyResizeEnd = output();
|
|
159
|
+
this.resizing = signal(false);
|
|
150
160
|
this.sizeCache = null;
|
|
151
161
|
this.ghostElement = null;
|
|
152
162
|
this.currentHandleEvent = null;
|
|
153
163
|
this.destroyRef = inject(DestroyRef);
|
|
154
164
|
this.thyResizableService.handleMouseDownOutsideAngular$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(event => {
|
|
155
|
-
if (this.thyDisabled) {
|
|
165
|
+
if (this.thyDisabled()) {
|
|
156
166
|
return;
|
|
157
167
|
}
|
|
158
|
-
this.resizing
|
|
168
|
+
this.resizing.set(true);
|
|
159
169
|
const { mouseEvent } = event;
|
|
160
170
|
this.thyResizableService.startResizing(mouseEvent);
|
|
161
171
|
this.currentHandleEvent = event;
|
|
162
172
|
this.setCursor();
|
|
163
173
|
// Re-enter the Angular zone and run the change detection only if there're any `thyResizeStart` listeners,
|
|
164
174
|
// e.g.: `<div thyResizable (thyResizeStart)="..."></div>`.
|
|
165
|
-
|
|
166
|
-
this.ngZone.run(() => this.thyResizeStart.emit({ mouseEvent }));
|
|
167
|
-
}
|
|
175
|
+
this.ngZone.run(() => this.thyResizeStart.emit({ mouseEvent }));
|
|
168
176
|
this.nativeElementRect = this.nativeElement.getBoundingClientRect();
|
|
169
177
|
});
|
|
170
178
|
this.thyResizableService.documentMouseUpOutsideAngular$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(event => {
|
|
171
|
-
if (this.resizing) {
|
|
179
|
+
if (this.resizing()) {
|
|
172
180
|
this.ngZone.run(() => {
|
|
173
|
-
this.resizing
|
|
174
|
-
this.changeDetectorRef.markForCheck();
|
|
181
|
+
this.resizing.set(false);
|
|
175
182
|
});
|
|
176
183
|
this.thyResizableService.documentMouseUpOutsideAngular$.next(event);
|
|
177
184
|
this.endResize(event);
|
|
178
185
|
}
|
|
179
186
|
});
|
|
180
187
|
this.thyResizableService.documentMouseMoveOutsideAngular$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(event => {
|
|
181
|
-
if (this.resizing) {
|
|
188
|
+
if (this.resizing()) {
|
|
182
189
|
this.resize(event);
|
|
183
190
|
}
|
|
184
191
|
});
|
|
192
|
+
this.bindMouseEnterAndLeaveEvents();
|
|
185
193
|
}
|
|
186
|
-
|
|
194
|
+
bindMouseEnterAndLeaveEvents() {
|
|
187
195
|
if (!this.platform.isBrowser) {
|
|
188
196
|
return;
|
|
189
197
|
}
|
|
190
|
-
this.nativeElement = this.elementRef.nativeElement;
|
|
191
198
|
this.ngZone.runOutsideAngular(() => {
|
|
192
199
|
fromEvent(this.nativeElement, 'mouseenter')
|
|
193
200
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
@@ -234,14 +241,12 @@ class ThyResizableDirective {
|
|
|
234
241
|
};
|
|
235
242
|
// Re-enter the Angular zone and run the change detection only if there're any `thyResizeEnd` listeners,
|
|
236
243
|
// e.g.: `<div thyResizable (thyResizeEnd)="..."></div>`.
|
|
237
|
-
|
|
238
|
-
this.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
mouseEvent: event
|
|
242
|
-
});
|
|
244
|
+
this.ngZone.run(() => {
|
|
245
|
+
this.thyResizeEnd.emit({
|
|
246
|
+
...size,
|
|
247
|
+
mouseEvent: event
|
|
243
248
|
});
|
|
244
|
-
}
|
|
249
|
+
});
|
|
245
250
|
this.sizeCache = null;
|
|
246
251
|
this.currentHandleEvent = null;
|
|
247
252
|
}
|
|
@@ -251,7 +256,7 @@ class ThyResizableDirective {
|
|
|
251
256
|
const handleEvent = getEventWithPoint(this.currentHandleEvent.mouseEvent);
|
|
252
257
|
let width = nativeElementRect.width;
|
|
253
258
|
let height = nativeElementRect.height;
|
|
254
|
-
const ratio = this.thyLockAspectRatio ? width / height : -1;
|
|
259
|
+
const ratio = this.thyLockAspectRatio() ? width / height : -1;
|
|
255
260
|
switch (this.currentHandleEvent.direction) {
|
|
256
261
|
case 'bottomRight':
|
|
257
262
|
width = resizeEvent.clientX - nativeElementRect.left;
|
|
@@ -285,15 +290,13 @@ class ThyResizableDirective {
|
|
|
285
290
|
this.sizeCache = { ...size };
|
|
286
291
|
// Re-enter the Angular zone and run the change detection only if there're any `thyResize` listeners,
|
|
287
292
|
// e.g.: `<div thyResizable (thyResize)="..."></div>`.
|
|
288
|
-
|
|
289
|
-
this.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
mouseEvent: event
|
|
293
|
-
});
|
|
293
|
+
this.ngZone.run(() => {
|
|
294
|
+
this.thyResize.emit({
|
|
295
|
+
...size,
|
|
296
|
+
mouseEvent: event
|
|
294
297
|
});
|
|
295
|
-
}
|
|
296
|
-
if (this.thyPreview) {
|
|
298
|
+
});
|
|
299
|
+
if (this.thyPreview()) {
|
|
297
300
|
this.previewResize(size);
|
|
298
301
|
}
|
|
299
302
|
}
|
|
@@ -304,10 +307,11 @@ class ThyResizableDirective {
|
|
|
304
307
|
let maxHeight;
|
|
305
308
|
let col = 0;
|
|
306
309
|
let spanWidth = 0;
|
|
307
|
-
let minWidth = this.thyMinWidth;
|
|
310
|
+
let minWidth = this.thyMinWidth();
|
|
308
311
|
let boundWidth = Infinity;
|
|
309
312
|
let boundHeight = Infinity;
|
|
310
|
-
|
|
313
|
+
const bounds = this.thyBounds();
|
|
314
|
+
if (bounds === 'parent') {
|
|
311
315
|
const parent = this.renderer.parentNode(this.nativeElement);
|
|
312
316
|
if (parent instanceof HTMLElement) {
|
|
313
317
|
const parentRect = parent.getBoundingClientRect();
|
|
@@ -315,45 +319,49 @@ class ThyResizableDirective {
|
|
|
315
319
|
boundHeight = parentRect.height;
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
|
-
else if (
|
|
322
|
+
else if (bounds === 'window') {
|
|
319
323
|
if (typeof window !== 'undefined') {
|
|
320
324
|
boundWidth = window.innerWidth;
|
|
321
325
|
boundHeight = window.innerHeight;
|
|
322
326
|
}
|
|
323
327
|
}
|
|
324
|
-
else if (
|
|
325
|
-
const boundsRect =
|
|
328
|
+
else if (bounds && bounds.nativeElement && bounds.nativeElement instanceof HTMLElement) {
|
|
329
|
+
const boundsRect = bounds.nativeElement.getBoundingClientRect();
|
|
326
330
|
boundWidth = boundsRect.width;
|
|
327
331
|
boundHeight = boundsRect.height;
|
|
328
332
|
}
|
|
329
|
-
maxWidth = ensureInBounds(this.thyMaxWidth, boundWidth);
|
|
330
|
-
maxHeight = ensureInBounds(this.thyMaxHeight, boundHeight);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
maxWidth = ensureInBounds(this.thyMaxWidth(), boundWidth);
|
|
334
|
+
maxHeight = ensureInBounds(this.thyMaxHeight(), boundHeight);
|
|
335
|
+
const gridColumnCount = this.thyGridColumnCount();
|
|
336
|
+
if (gridColumnCount !== -1) {
|
|
337
|
+
spanWidth = maxWidth / gridColumnCount;
|
|
338
|
+
const minColumn = this.thyMinColumn();
|
|
339
|
+
minWidth = minColumn !== -1 ? spanWidth * minColumn : minWidth;
|
|
340
|
+
const maxColumn = this.thyMaxColumn();
|
|
341
|
+
maxWidth = maxColumn !== -1 ? spanWidth * maxColumn : maxWidth;
|
|
335
342
|
}
|
|
343
|
+
const minHeight = this.thyMinHeight();
|
|
336
344
|
if (ratio !== -1) {
|
|
337
345
|
if (/(left|right)/i.test(this.currentHandleEvent.direction)) {
|
|
338
346
|
newWidth = Math.min(Math.max(width, minWidth), maxWidth);
|
|
339
|
-
newHeight = Math.min(Math.max(newWidth / ratio,
|
|
340
|
-
if (newHeight >= maxHeight || newHeight <=
|
|
347
|
+
newHeight = Math.min(Math.max(newWidth / ratio, minHeight), maxHeight);
|
|
348
|
+
if (newHeight >= maxHeight || newHeight <= minHeight) {
|
|
341
349
|
newWidth = Math.min(Math.max(newHeight * ratio, minWidth), maxWidth);
|
|
342
350
|
}
|
|
343
351
|
}
|
|
344
352
|
else {
|
|
345
|
-
newHeight = Math.min(Math.max(height,
|
|
353
|
+
newHeight = Math.min(Math.max(height, minHeight), maxHeight);
|
|
346
354
|
newWidth = Math.min(Math.max(newHeight * ratio, minWidth), maxWidth);
|
|
347
355
|
if (newWidth >= maxWidth || newWidth <= minWidth) {
|
|
348
|
-
newHeight = Math.min(Math.max(newWidth / ratio,
|
|
356
|
+
newHeight = Math.min(Math.max(newWidth / ratio, minHeight), maxHeight);
|
|
349
357
|
}
|
|
350
358
|
}
|
|
351
359
|
}
|
|
352
360
|
else {
|
|
353
361
|
newWidth = Math.min(Math.max(width, minWidth), maxWidth);
|
|
354
|
-
newHeight = Math.min(Math.max(height,
|
|
362
|
+
newHeight = Math.min(Math.max(height, minHeight), maxHeight);
|
|
355
363
|
}
|
|
356
|
-
if (
|
|
364
|
+
if (gridColumnCount !== -1) {
|
|
357
365
|
col = Math.round(newWidth / spanWidth);
|
|
358
366
|
newWidth = col * spanWidth;
|
|
359
367
|
}
|
|
@@ -385,7 +393,7 @@ class ThyResizableDirective {
|
|
|
385
393
|
this.sizeCache = null;
|
|
386
394
|
}
|
|
387
395
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyResizableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
388
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
396
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyResizableDirective, isStandalone: true, selector: "[thyResizable]", inputs: { thyBounds: { classPropertyName: "thyBounds", publicName: "thyBounds", isSignal: true, isRequired: false, transformFunction: null }, thyMaxHeight: { classPropertyName: "thyMaxHeight", publicName: "thyMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, thyMaxWidth: { classPropertyName: "thyMaxWidth", publicName: "thyMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, thyMinHeight: { classPropertyName: "thyMinHeight", publicName: "thyMinHeight", isSignal: true, isRequired: false, transformFunction: null }, thyMinWidth: { classPropertyName: "thyMinWidth", publicName: "thyMinWidth", isSignal: true, isRequired: false, transformFunction: null }, thyGridColumnCount: { classPropertyName: "thyGridColumnCount", publicName: "thyGridColumnCount", isSignal: true, isRequired: false, transformFunction: null }, thyMaxColumn: { classPropertyName: "thyMaxColumn", publicName: "thyMaxColumn", isSignal: true, isRequired: false, transformFunction: null }, thyMinColumn: { classPropertyName: "thyMinColumn", publicName: "thyMinColumn", isSignal: true, isRequired: false, transformFunction: null }, thyLockAspectRatio: { classPropertyName: "thyLockAspectRatio", publicName: "thyLockAspectRatio", isSignal: true, isRequired: false, transformFunction: null }, thyPreview: { classPropertyName: "thyPreview", publicName: "thyPreview", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyResize: "thyResize", thyResizeStart: "thyResizeStart", thyResizeEnd: "thyResizeEnd" }, host: { properties: { "class.thy-resizable-resizing": "resizing()", "class.thy-resizable-disabled": "thyDisabled()" }, classAttribute: "thy-resizable" }, providers: [ThyResizableService], ngImport: i0 }); }
|
|
389
397
|
}
|
|
390
398
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyResizableDirective, decorators: [{
|
|
391
399
|
type: Directive,
|
|
@@ -394,49 +402,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
394
402
|
providers: [ThyResizableService],
|
|
395
403
|
host: {
|
|
396
404
|
class: 'thy-resizable',
|
|
397
|
-
'[class.thy-resizable-resizing]': 'resizing',
|
|
398
|
-
'[class.thy-resizable-disabled]': 'thyDisabled'
|
|
405
|
+
'[class.thy-resizable-resizing]': 'resizing()',
|
|
406
|
+
'[class.thy-resizable-disabled]': 'thyDisabled()'
|
|
399
407
|
}
|
|
400
408
|
}]
|
|
401
|
-
}], ctorParameters: () => []
|
|
402
|
-
type: Input
|
|
403
|
-
}], thyMaxHeight: [{
|
|
404
|
-
type: Input,
|
|
405
|
-
args: [{ transform: numberAttribute }]
|
|
406
|
-
}], thyMaxWidth: [{
|
|
407
|
-
type: Input,
|
|
408
|
-
args: [{ transform: numberAttribute }]
|
|
409
|
-
}], thyMinHeight: [{
|
|
410
|
-
type: Input,
|
|
411
|
-
args: [{ transform: numberAttribute }]
|
|
412
|
-
}], thyMinWidth: [{
|
|
413
|
-
type: Input,
|
|
414
|
-
args: [{ transform: numberAttribute }]
|
|
415
|
-
}], thyGridColumnCount: [{
|
|
416
|
-
type: Input,
|
|
417
|
-
args: [{ transform: numberAttribute }]
|
|
418
|
-
}], thyMaxColumn: [{
|
|
419
|
-
type: Input,
|
|
420
|
-
args: [{ transform: numberAttribute }]
|
|
421
|
-
}], thyMinColumn: [{
|
|
422
|
-
type: Input,
|
|
423
|
-
args: [{ transform: numberAttribute }]
|
|
424
|
-
}], thyLockAspectRatio: [{
|
|
425
|
-
type: Input,
|
|
426
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
427
|
-
}], thyPreview: [{
|
|
428
|
-
type: Input,
|
|
429
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
430
|
-
}], thyDisabled: [{
|
|
431
|
-
type: Input,
|
|
432
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
433
|
-
}], thyResize: [{
|
|
434
|
-
type: Output
|
|
435
|
-
}], thyResizeStart: [{
|
|
436
|
-
type: Output
|
|
437
|
-
}], thyResizeEnd: [{
|
|
438
|
-
type: Output
|
|
439
|
-
}] } });
|
|
409
|
+
}], ctorParameters: () => [] });
|
|
440
410
|
|
|
441
411
|
class ThyResizeHandleMouseDownEvent {
|
|
442
412
|
constructor(direction, mouseEvent) {
|
|
@@ -459,15 +429,16 @@ class ThyResizeHandle {
|
|
|
459
429
|
* 调整方向
|
|
460
430
|
* @type top | right | bottom | left | topRight | bottomRight | bottomLeft | topLeft
|
|
461
431
|
*/
|
|
462
|
-
this.thyDirection = 'bottomRight';
|
|
432
|
+
this.thyDirection = input('bottomRight');
|
|
463
433
|
/**
|
|
464
434
|
* 是否展示拖拽线
|
|
435
|
+
* @type boolean
|
|
465
436
|
*/
|
|
466
|
-
this.thyLine = false;
|
|
437
|
+
this.thyLine = input(false, { transform: coerceBooleanProperty });
|
|
467
438
|
/**
|
|
468
439
|
* MouseDown 回调事件
|
|
469
440
|
*/
|
|
470
|
-
this.thyMouseDown =
|
|
441
|
+
this.thyMouseDown = output();
|
|
471
442
|
this.hostRenderer = useHostRenderer();
|
|
472
443
|
this.destroyRef = inject(DestroyRef);
|
|
473
444
|
}
|
|
@@ -487,14 +458,14 @@ class ThyResizeHandle {
|
|
|
487
458
|
merge(fromEvent(this.host.nativeElement, 'mousedown', passiveEventListenerOptions), fromEvent(this.host.nativeElement, 'touchstart', passiveEventListenerOptions))
|
|
488
459
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
489
460
|
.subscribe((event) => {
|
|
490
|
-
this.thyResizableService.handleMouseDownOutsideAngular$.next(new ThyResizeHandleMouseDownEvent(this.thyDirection, event));
|
|
461
|
+
this.thyResizableService.handleMouseDownOutsideAngular$.next(new ThyResizeHandleMouseDownEvent(this.thyDirection(), event));
|
|
491
462
|
});
|
|
492
463
|
});
|
|
493
464
|
}
|
|
494
465
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyResizeHandle, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
495
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyResizeHandle, isStandalone: true, selector: "thy-resize-handle, [thy-resize-handle]", inputs: { thyDirection: "thyDirection", thyLine:
|
|
466
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyResizeHandle, isStandalone: true, selector: "thy-resize-handle, [thy-resize-handle]", inputs: { thyDirection: { classPropertyName: "thyDirection", publicName: "thyDirection", isSignal: true, isRequired: false, transformFunction: null }, thyLine: { classPropertyName: "thyLine", publicName: "thyLine", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyMouseDown: "thyMouseDown" }, host: { properties: { "class.thy-resizable-handle-top": "thyDirection() === 'top'", "class.thy-resizable-handle-right": "thyDirection() === 'right'", "class.thy-resizable-handle-bottom": "thyDirection() === 'bottom'", "class.thy-resizable-handle-left": "thyDirection() === 'left'", "class.thy-resizable-handle-topRight": "thyDirection() === 'topRight'", "class.thy-resizable-handle-bottomRight": "thyDirection() === 'bottomRight'", "class.thy-resizable-handle-bottomLeft": "thyDirection() === 'bottomLeft'", "class.thy-resizable-handle-topLeft": "thyDirection() === 'topLeft'", "class.thy-resizable-handle-box-hover": "entered" }, classAttribute: "thy-resizable-handle" }, exportAs: ["thyResizeHandle"], ngImport: i0, template: `
|
|
496
467
|
<ng-content></ng-content>
|
|
497
|
-
@if (thyLine) {
|
|
468
|
+
@if (thyLine()) {
|
|
498
469
|
<div class="thy-resizable-handle-line"></div>
|
|
499
470
|
}
|
|
500
471
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
@@ -506,33 +477,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
506
477
|
exportAs: 'thyResizeHandle',
|
|
507
478
|
template: `
|
|
508
479
|
<ng-content></ng-content>
|
|
509
|
-
@if (thyLine) {
|
|
480
|
+
@if (thyLine()) {
|
|
510
481
|
<div class="thy-resizable-handle-line"></div>
|
|
511
482
|
}
|
|
512
483
|
`,
|
|
513
484
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
514
485
|
host: {
|
|
515
486
|
class: 'thy-resizable-handle',
|
|
516
|
-
'[class.thy-resizable-handle-top]': `thyDirection === 'top'`,
|
|
517
|
-
'[class.thy-resizable-handle-right]': `thyDirection === 'right'`,
|
|
518
|
-
'[class.thy-resizable-handle-bottom]': `thyDirection === 'bottom'`,
|
|
519
|
-
'[class.thy-resizable-handle-left]': `thyDirection === 'left'`,
|
|
520
|
-
'[class.thy-resizable-handle-topRight]': `thyDirection === 'topRight'`,
|
|
521
|
-
'[class.thy-resizable-handle-bottomRight]': `thyDirection === 'bottomRight'`,
|
|
522
|
-
'[class.thy-resizable-handle-bottomLeft]': `thyDirection === 'bottomLeft'`,
|
|
523
|
-
'[class.thy-resizable-handle-topLeft]': `thyDirection === 'topLeft'`,
|
|
487
|
+
'[class.thy-resizable-handle-top]': `thyDirection() === 'top'`,
|
|
488
|
+
'[class.thy-resizable-handle-right]': `thyDirection() === 'right'`,
|
|
489
|
+
'[class.thy-resizable-handle-bottom]': `thyDirection() === 'bottom'`,
|
|
490
|
+
'[class.thy-resizable-handle-left]': `thyDirection() === 'left'`,
|
|
491
|
+
'[class.thy-resizable-handle-topRight]': `thyDirection() === 'topRight'`,
|
|
492
|
+
'[class.thy-resizable-handle-bottomRight]': `thyDirection() === 'bottomRight'`,
|
|
493
|
+
'[class.thy-resizable-handle-bottomLeft]': `thyDirection() === 'bottomLeft'`,
|
|
494
|
+
'[class.thy-resizable-handle-topLeft]': `thyDirection() === 'topLeft'`,
|
|
524
495
|
'[class.thy-resizable-handle-box-hover]': 'entered'
|
|
525
496
|
},
|
|
526
497
|
imports: []
|
|
527
498
|
}]
|
|
528
|
-
}]
|
|
529
|
-
type: Input
|
|
530
|
-
}], thyLine: [{
|
|
531
|
-
type: Input,
|
|
532
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
533
|
-
}], thyMouseDown: [{
|
|
534
|
-
type: Output
|
|
535
|
-
}] } });
|
|
499
|
+
}] });
|
|
536
500
|
|
|
537
501
|
const DEFAULT_RESIZE_DIRECTION = [
|
|
538
502
|
'bottomRight',
|
|
@@ -554,22 +518,20 @@ class ThyResizeHandles {
|
|
|
554
518
|
* 定义调整手柄的方向
|
|
555
519
|
* @type ThyResizeDirection[]
|
|
556
520
|
*/
|
|
557
|
-
this.thyDirections = DEFAULT_RESIZE_DIRECTION;
|
|
521
|
+
this.thyDirections = input(DEFAULT_RESIZE_DIRECTION);
|
|
558
522
|
/**
|
|
559
523
|
* 是否展示拖拽线
|
|
560
524
|
*/
|
|
561
|
-
this.thyLine = false;
|
|
562
|
-
this.directions =
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
this.directions = new Set(changes.thyDirections.currentValue);
|
|
567
|
-
}
|
|
525
|
+
this.thyLine = input(false, { transform: coerceBooleanProperty });
|
|
526
|
+
this.directions = computed(() => {
|
|
527
|
+
const directions = this.thyDirections();
|
|
528
|
+
return new Set(directions);
|
|
529
|
+
});
|
|
568
530
|
}
|
|
569
531
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyResizeHandles, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
570
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyResizeHandles, isStandalone: true, selector: "thy-resize-handles", inputs: { thyDirections: "thyDirections", thyLine:
|
|
571
|
-
@for (dir of directions; track $index) {
|
|
572
|
-
<thy-resize-handle [thyLine]="thyLine" [thyDirection]="dir"></thy-resize-handle>
|
|
532
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyResizeHandles, isStandalone: true, selector: "thy-resize-handles", inputs: { thyDirections: { classPropertyName: "thyDirections", publicName: "thyDirections", isSignal: true, isRequired: false, transformFunction: null }, thyLine: { classPropertyName: "thyLine", publicName: "thyLine", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["thyResizeHandles"], ngImport: i0, template: `
|
|
533
|
+
@for (dir of directions(); track $index) {
|
|
534
|
+
<thy-resize-handle [thyLine]="thyLine()" [thyDirection]="dir"></thy-resize-handle>
|
|
573
535
|
}
|
|
574
536
|
`, isInline: true, dependencies: [{ kind: "component", type: ThyResizeHandle, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection", "thyLine"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
575
537
|
}
|
|
@@ -579,19 +541,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
579
541
|
selector: 'thy-resize-handles',
|
|
580
542
|
exportAs: 'thyResizeHandles',
|
|
581
543
|
template: `
|
|
582
|
-
@for (dir of directions; track $index) {
|
|
583
|
-
<thy-resize-handle [thyLine]="thyLine" [thyDirection]="dir"></thy-resize-handle>
|
|
544
|
+
@for (dir of directions(); track $index) {
|
|
545
|
+
<thy-resize-handle [thyLine]="thyLine()" [thyDirection]="dir"></thy-resize-handle>
|
|
584
546
|
}
|
|
585
547
|
`,
|
|
586
548
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
587
549
|
imports: [ThyResizeHandle]
|
|
588
550
|
}]
|
|
589
|
-
}]
|
|
590
|
-
type: Input
|
|
591
|
-
}], thyLine: [{
|
|
592
|
-
type: Input,
|
|
593
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
594
|
-
}] } });
|
|
551
|
+
}] });
|
|
595
552
|
|
|
596
553
|
class ThyResizableModule {
|
|
597
554
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyResizableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|