angular-three 2.0.0-beta.287 → 2.0.0-beta.289
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.
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import { afterNextRender, booleanAttribute,
|
|
1
|
+
import { afterNextRender, booleanAttribute, Directive, ElementRef, inject, input, signal, untracked, } from '@angular/core';
|
|
2
2
|
import { injectAutoEffect } from 'ngxtension/auto-effect';
|
|
3
|
-
import { Group } from 'three';
|
|
4
3
|
import { getLocalState } from '../instance';
|
|
5
|
-
import { extend } from '../renderer';
|
|
6
|
-
import { NgtObjectEvents, NgtObjectEventsHostDirective } from '../utils/object-events';
|
|
7
4
|
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "../utils/object-events";
|
|
9
5
|
export class NgtSelection {
|
|
10
6
|
constructor() {
|
|
11
7
|
this.enabled = input(true, { alias: 'ngtSelection', transform: booleanAttribute });
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
|
|
15
|
-
select(...objects) {
|
|
16
|
-
this.selection.update((prev) => [...prev, ...objects]);
|
|
17
|
-
}
|
|
18
|
-
unselect(...objects) {
|
|
19
|
-
this.selection.update((prev) => prev.filter((selected) => !objects.includes(selected)));
|
|
8
|
+
this.source = signal([]);
|
|
9
|
+
this.selected = this.source.asReadonly();
|
|
10
|
+
this.update = this.source.update.bind(this.source);
|
|
20
11
|
}
|
|
21
12
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
22
13
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.3", type: NgtSelection, isStandalone: true, selector: "[ngtSelection]", inputs: { enabled: { classPropertyName: "enabled", publicName: "ngtSelection", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
@@ -27,60 +18,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImpor
|
|
|
27
18
|
}] });
|
|
28
19
|
export class NgtSelect {
|
|
29
20
|
constructor() {
|
|
30
|
-
this.enabled = input(false, { transform: booleanAttribute });
|
|
31
|
-
|
|
32
|
-
this.groupRef = viewChild.required('group');
|
|
33
|
-
extend({ Group });
|
|
34
|
-
const objectEvents = inject(NgtObjectEvents, { host: true });
|
|
21
|
+
this.enabled = input(false, { transform: booleanAttribute, alias: 'ngtSelect' });
|
|
22
|
+
const elementRef = inject(ElementRef);
|
|
35
23
|
const selection = inject(NgtSelection);
|
|
36
24
|
const autoEffect = injectAutoEffect();
|
|
37
25
|
afterNextRender(() => {
|
|
38
|
-
objectEvents.ngtObjectEvents.set(this.groupRef());
|
|
39
26
|
autoEffect(() => {
|
|
40
|
-
const
|
|
41
|
-
|
|
27
|
+
const host = elementRef.nativeElement;
|
|
28
|
+
if (!host)
|
|
29
|
+
return;
|
|
30
|
+
const localState = getLocalState(host);
|
|
42
31
|
if (!localState)
|
|
43
32
|
return;
|
|
44
33
|
const enabled = this.enabled();
|
|
45
34
|
if (!enabled)
|
|
46
35
|
return;
|
|
47
|
-
|
|
36
|
+
// ngt-mesh[ngtSelect]
|
|
37
|
+
if (host.type === 'Mesh') {
|
|
38
|
+
selection.update((prev) => [...prev, host]);
|
|
39
|
+
return () => selection.update((prev) => prev.filter((el) => el !== host));
|
|
40
|
+
}
|
|
41
|
+
const [collection] = [untracked(selection.selected), localState.objects()];
|
|
48
42
|
let changed = false;
|
|
49
43
|
const current = [];
|
|
50
|
-
|
|
44
|
+
host.traverse((child) => {
|
|
51
45
|
child.type === 'Mesh' && current.push(child);
|
|
52
46
|
if (collection.indexOf(child) === -1)
|
|
53
47
|
changed = true;
|
|
54
48
|
});
|
|
55
49
|
if (!changed)
|
|
56
50
|
return;
|
|
57
|
-
selection.
|
|
51
|
+
selection.update((prev) => [...prev, ...current]);
|
|
58
52
|
return () => {
|
|
59
|
-
selection.
|
|
53
|
+
selection.update((prev) => prev.filter((el) => !current.includes(el)));
|
|
60
54
|
};
|
|
61
55
|
}, { allowSignalWrites: true });
|
|
62
56
|
});
|
|
63
57
|
}
|
|
64
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelect, deps: [], target: i0.ɵɵFactoryTarget.
|
|
65
|
-
static { this.ɵ
|
|
66
|
-
<ngt-group #group [parameters]="options()">
|
|
67
|
-
<ng-content />
|
|
68
|
-
</ngt-group>
|
|
69
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
58
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
59
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.3", type: NgtSelect, isStandalone: true, selector: "ngt-group[ngtSelect], ngt-mesh[ngtSelect]", inputs: { enabled: { classPropertyName: "enabled", publicName: "ngtSelect", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
70
60
|
}
|
|
71
61
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelect, decorators: [{
|
|
72
|
-
type:
|
|
73
|
-
args: [{
|
|
74
|
-
selector: 'ngt-select',
|
|
75
|
-
standalone: true,
|
|
76
|
-
template: `
|
|
77
|
-
<ngt-group #group [parameters]="options()">
|
|
78
|
-
<ng-content />
|
|
79
|
-
</ngt-group>
|
|
80
|
-
`,
|
|
81
|
-
hostDirectives: [NgtObjectEventsHostDirective],
|
|
82
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
83
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
84
|
-
}]
|
|
62
|
+
type: Directive,
|
|
63
|
+
args: [{ standalone: true, selector: 'ngt-group[ngtSelect], ngt-mesh[ngtSelect]' }]
|
|
85
64
|
}], ctorParameters: () => [] });
|
|
86
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
65
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3NyYy9saWIvZGlyZWN0aXZlcy9zZWxlY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNOLGVBQWUsRUFDZixnQkFBZ0IsRUFDaEIsU0FBUyxFQUNULFVBQVUsRUFDVixNQUFNLEVBQ04sS0FBSyxFQUNMLE1BQU0sRUFDTixTQUFTLEdBQ1QsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFMUQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGFBQWEsQ0FBQzs7QUFHNUMsTUFBTSxPQUFPLFlBQVk7SUFEekI7UUFFQyxZQUFPLEdBQUcsS0FBSyxDQUFDLElBQUksRUFBRSxFQUFFLEtBQUssRUFBRSxjQUFjLEVBQUUsU0FBUyxFQUFFLGdCQUFnQixFQUFFLENBQUMsQ0FBQztRQUN0RSxXQUFNLEdBQUcsTUFBTSxDQUF5QyxFQUFFLENBQUMsQ0FBQztRQUNwRSxhQUFRLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxVQUFVLEVBQUUsQ0FBQztRQUNwQyxXQUFNLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQztLQUM5Qzs4R0FMWSxZQUFZO2tHQUFaLFlBQVk7OzJGQUFaLFlBQVk7a0JBRHhCLFN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3QzRCkpKTtcblx0XHRcdFx0XHR9O1xuXHRcdFx0XHR9LFxuXHRcdFx0XHR7IGFsbG93U2lnbmFsV3JpdGVzOiB0cnVlIH0sXG5cdFx0XHQpO1xuXHRcdH0pO1xuXHR9XG59XG4iXX0=
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { untracked, computed, signal, ElementRef, input, inject, ViewContainerRef, NgZone, TemplateRef, afterNextRender, DestroyRef, Directive, effect, InjectionToken, getDebugNode, RendererFactory2, Injectable, makeEnvironmentProviders, Component, EnvironmentInjector, Injector, booleanAttribute, output, viewChild, createEnvironmentInjector, ChangeDetectionStrategy,
|
|
2
|
+
import { untracked, computed, signal, ElementRef, input, inject, ViewContainerRef, NgZone, TemplateRef, afterNextRender, DestroyRef, Directive, effect, InjectionToken, getDebugNode, RendererFactory2, Injectable, makeEnvironmentProviders, Component, EnvironmentInjector, Injector, booleanAttribute, output, viewChild, createEnvironmentInjector, ChangeDetectionStrategy, Pipe, CUSTOM_ELEMENTS_SCHEMA, contentChild, model, Renderer2 } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { injectAutoEffect } from 'ngxtension/auto-effect';
|
|
5
5
|
import { provideResizeOptions, NgxResize } from 'ngxtension/resize';
|
|
6
|
-
import { MathUtils, WebGLRenderer, OrthographicCamera, PerspectiveCamera, Vector3, Vector2, Clock, Layers, Color, ColorManagement, Texture, RGBAFormat, UnsignedByteType, Raycaster, Scene, PCFSoftShadowMap, BasicShadowMap, PCFShadowMap, VSMShadowMap, NoToneMapping, ACESFilmicToneMapping,
|
|
6
|
+
import { MathUtils, WebGLRenderer, OrthographicCamera, PerspectiveCamera, Vector3, Vector2, Clock, Layers, Color, ColorManagement, Texture, RGBAFormat, UnsignedByteType, Raycaster, Scene, PCFSoftShadowMap, BasicShadowMap, PCFShadowMap, VSMShadowMap, NoToneMapping, ACESFilmicToneMapping, Vector4 } from 'three';
|
|
7
7
|
import { DOCUMENT } from '@angular/common';
|
|
8
8
|
import { Subject, filter } from 'rxjs';
|
|
9
9
|
import { createInjectionToken } from 'ngxtension/create-injection-token';
|
|
@@ -2515,111 +2515,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImpor
|
|
|
2515
2515
|
}]
|
|
2516
2516
|
}], ctorParameters: () => [] });
|
|
2517
2517
|
|
|
2518
|
-
function resolveRef(ref) {
|
|
2519
|
-
if (is.ref(ref)) {
|
|
2520
|
-
return ref.nativeElement;
|
|
2521
|
-
}
|
|
2522
|
-
return ref;
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2525
|
-
class NgtObjectEvents {
|
|
2526
|
-
constructor() {
|
|
2527
|
-
this.click = output();
|
|
2528
|
-
this.dblclick = output();
|
|
2529
|
-
this.contextmenu = output();
|
|
2530
|
-
this.pointerup = output();
|
|
2531
|
-
this.pointerdown = output();
|
|
2532
|
-
this.pointerover = output();
|
|
2533
|
-
this.pointerout = output();
|
|
2534
|
-
this.pointerenter = output();
|
|
2535
|
-
this.pointerleave = output();
|
|
2536
|
-
this.pointermove = output();
|
|
2537
|
-
this.pointermissed = output();
|
|
2538
|
-
this.pointercancel = output();
|
|
2539
|
-
this.wheel = output();
|
|
2540
|
-
// NOTE: we use model here to allow for the hostDirective host to set this value
|
|
2541
|
-
this.ngtObjectEvents = model();
|
|
2542
|
-
const injector = inject(Injector);
|
|
2543
|
-
afterNextRender(() => {
|
|
2544
|
-
injectObjectEvents(this.ngtObjectEvents, {
|
|
2545
|
-
click: (event) => this.click.emit(event),
|
|
2546
|
-
dblclick: (event) => this.dblclick.emit(event),
|
|
2547
|
-
contextmenu: (event) => this.contextmenu.emit(event),
|
|
2548
|
-
pointerup: (event) => this.pointerup.emit(event),
|
|
2549
|
-
pointerdown: (event) => this.pointerdown.emit(event),
|
|
2550
|
-
pointerover: (event) => this.pointerover.emit(event),
|
|
2551
|
-
pointerout: (event) => this.pointerout.emit(event),
|
|
2552
|
-
pointerenter: (event) => this.pointerenter.emit(event),
|
|
2553
|
-
pointerleave: (event) => this.pointerleave.emit(event),
|
|
2554
|
-
pointermove: (event) => this.pointermove.emit(event),
|
|
2555
|
-
pointermissed: (event) => this.pointermissed.emit(event),
|
|
2556
|
-
pointercancel: (event) => this.pointercancel.emit(event),
|
|
2557
|
-
wheel: (event) => this.wheel.emit(event),
|
|
2558
|
-
}, { injector });
|
|
2559
|
-
});
|
|
2560
|
-
}
|
|
2561
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtObjectEvents, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2562
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.3", type: NgtObjectEvents, isStandalone: true, selector: "[ngtObjectEvents]", inputs: { ngtObjectEvents: { classPropertyName: "ngtObjectEvents", publicName: "ngtObjectEvents", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { click: "click", dblclick: "dblclick", contextmenu: "contextmenu", pointerup: "pointerup", pointerdown: "pointerdown", pointerover: "pointerover", pointerout: "pointerout", pointerenter: "pointerenter", pointerleave: "pointerleave", pointermove: "pointermove", pointermissed: "pointermissed", pointercancel: "pointercancel", wheel: "wheel", ngtObjectEvents: "ngtObjectEventsChange" }, ngImport: i0 }); }
|
|
2563
|
-
}
|
|
2564
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtObjectEvents, decorators: [{
|
|
2565
|
-
type: Directive,
|
|
2566
|
-
args: [{ standalone: true, selector: '[ngtObjectEvents]' }]
|
|
2567
|
-
}], ctorParameters: () => [] });
|
|
2568
|
-
const NgtObjectEventsHostDirective = {
|
|
2569
|
-
directive: NgtObjectEvents,
|
|
2570
|
-
inputs: ['ngtObjectEvents'],
|
|
2571
|
-
outputs: [
|
|
2572
|
-
'click',
|
|
2573
|
-
'dblclick',
|
|
2574
|
-
'contextmenu',
|
|
2575
|
-
'pointerup',
|
|
2576
|
-
'pointerdown',
|
|
2577
|
-
'pointerover',
|
|
2578
|
-
'pointerout',
|
|
2579
|
-
'pointerenter',
|
|
2580
|
-
'pointerleave',
|
|
2581
|
-
'pointermove',
|
|
2582
|
-
'pointermissed',
|
|
2583
|
-
'pointercancel',
|
|
2584
|
-
'wheel',
|
|
2585
|
-
],
|
|
2586
|
-
};
|
|
2587
|
-
function injectObjectEvents(target, events, { injector } = {}) {
|
|
2588
|
-
return assertInjector(injectObjectEvents, injector, () => {
|
|
2589
|
-
const autoEffect = injectAutoEffect();
|
|
2590
|
-
const renderer = inject(Renderer2);
|
|
2591
|
-
const cleanUps = [];
|
|
2592
|
-
afterNextRender(() => {
|
|
2593
|
-
autoEffect(() => {
|
|
2594
|
-
const targetRef = resolveRef(target());
|
|
2595
|
-
if (!targetRef)
|
|
2596
|
-
return;
|
|
2597
|
-
Object.entries(events).forEach(([eventName, eventHandler]) => {
|
|
2598
|
-
cleanUps.push(renderer.listen(targetRef, eventName, eventHandler));
|
|
2599
|
-
});
|
|
2600
|
-
return () => {
|
|
2601
|
-
cleanUps.forEach((cleanUp) => cleanUp());
|
|
2602
|
-
};
|
|
2603
|
-
});
|
|
2604
|
-
});
|
|
2605
|
-
inject(DestroyRef).onDestroy(() => {
|
|
2606
|
-
cleanUps.forEach((cleanUp) => cleanUp());
|
|
2607
|
-
});
|
|
2608
|
-
return cleanUps;
|
|
2609
|
-
});
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
2518
|
class NgtSelection {
|
|
2613
2519
|
constructor() {
|
|
2614
2520
|
this.enabled = input(true, { alias: 'ngtSelection', transform: booleanAttribute });
|
|
2615
|
-
this.
|
|
2616
|
-
this.
|
|
2617
|
-
|
|
2618
|
-
select(...objects) {
|
|
2619
|
-
this.selection.update((prev) => [...prev, ...objects]);
|
|
2620
|
-
}
|
|
2621
|
-
unselect(...objects) {
|
|
2622
|
-
this.selection.update((prev) => prev.filter((selected) => !objects.includes(selected)));
|
|
2521
|
+
this.source = signal([]);
|
|
2522
|
+
this.selected = this.source.asReadonly();
|
|
2523
|
+
this.update = this.source.update.bind(this.source);
|
|
2623
2524
|
}
|
|
2624
2525
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2625
2526
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.3", type: NgtSelection, isStandalone: true, selector: "[ngtSelection]", inputs: { enabled: { classPropertyName: "enabled", publicName: "ngtSelection", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
@@ -2630,61 +2531,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImpor
|
|
|
2630
2531
|
}] });
|
|
2631
2532
|
class NgtSelect {
|
|
2632
2533
|
constructor() {
|
|
2633
|
-
this.enabled = input(false, { transform: booleanAttribute });
|
|
2634
|
-
|
|
2635
|
-
this.groupRef = viewChild.required('group');
|
|
2636
|
-
extend({ Group });
|
|
2637
|
-
const objectEvents = inject(NgtObjectEvents, { host: true });
|
|
2534
|
+
this.enabled = input(false, { transform: booleanAttribute, alias: 'ngtSelect' });
|
|
2535
|
+
const elementRef = inject(ElementRef);
|
|
2638
2536
|
const selection = inject(NgtSelection);
|
|
2639
2537
|
const autoEffect = injectAutoEffect();
|
|
2640
2538
|
afterNextRender(() => {
|
|
2641
|
-
objectEvents.ngtObjectEvents.set(this.groupRef());
|
|
2642
2539
|
autoEffect(() => {
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2540
|
+
const host = elementRef.nativeElement;
|
|
2541
|
+
if (!host)
|
|
2542
|
+
return;
|
|
2543
|
+
const localState = getLocalState(host);
|
|
2645
2544
|
if (!localState)
|
|
2646
2545
|
return;
|
|
2647
2546
|
const enabled = this.enabled();
|
|
2648
2547
|
if (!enabled)
|
|
2649
2548
|
return;
|
|
2650
|
-
|
|
2549
|
+
// ngt-mesh[ngtSelect]
|
|
2550
|
+
if (host.type === 'Mesh') {
|
|
2551
|
+
selection.update((prev) => [...prev, host]);
|
|
2552
|
+
return () => selection.update((prev) => prev.filter((el) => el !== host));
|
|
2553
|
+
}
|
|
2554
|
+
const [collection] = [untracked(selection.selected), localState.objects()];
|
|
2651
2555
|
let changed = false;
|
|
2652
2556
|
const current = [];
|
|
2653
|
-
|
|
2557
|
+
host.traverse((child) => {
|
|
2654
2558
|
child.type === 'Mesh' && current.push(child);
|
|
2655
2559
|
if (collection.indexOf(child) === -1)
|
|
2656
2560
|
changed = true;
|
|
2657
2561
|
});
|
|
2658
2562
|
if (!changed)
|
|
2659
2563
|
return;
|
|
2660
|
-
selection.
|
|
2564
|
+
selection.update((prev) => [...prev, ...current]);
|
|
2661
2565
|
return () => {
|
|
2662
|
-
selection.
|
|
2566
|
+
selection.update((prev) => prev.filter((el) => !current.includes(el)));
|
|
2663
2567
|
};
|
|
2664
2568
|
}, { allowSignalWrites: true });
|
|
2665
2569
|
});
|
|
2666
2570
|
}
|
|
2667
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelect, deps: [], target: i0.ɵɵFactoryTarget.
|
|
2668
|
-
static { this.ɵ
|
|
2669
|
-
<ngt-group #group [parameters]="options()">
|
|
2670
|
-
<ng-content />
|
|
2671
|
-
</ngt-group>
|
|
2672
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2571
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2572
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.3", type: NgtSelect, isStandalone: true, selector: "ngt-group[ngtSelect], ngt-mesh[ngtSelect]", inputs: { enabled: { classPropertyName: "enabled", publicName: "ngtSelect", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
2673
2573
|
}
|
|
2674
2574
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtSelect, decorators: [{
|
|
2675
|
-
type:
|
|
2676
|
-
args: [{
|
|
2677
|
-
selector: 'ngt-select',
|
|
2678
|
-
standalone: true,
|
|
2679
|
-
template: `
|
|
2680
|
-
<ngt-group #group [parameters]="options()">
|
|
2681
|
-
<ng-content />
|
|
2682
|
-
</ngt-group>
|
|
2683
|
-
`,
|
|
2684
|
-
hostDirectives: [NgtObjectEventsHostDirective],
|
|
2685
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
2686
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2687
|
-
}]
|
|
2575
|
+
type: Directive,
|
|
2576
|
+
args: [{ standalone: true, selector: 'ngt-group[ngtSelect], ngt-mesh[ngtSelect]' }]
|
|
2688
2577
|
}], ctorParameters: () => [] });
|
|
2689
2578
|
|
|
2690
2579
|
var _a;
|
|
@@ -3096,6 +2985,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImpor
|
|
|
3096
2985
|
}]
|
|
3097
2986
|
}], ctorParameters: () => [] });
|
|
3098
2987
|
|
|
2988
|
+
function resolveRef(ref) {
|
|
2989
|
+
if (is.ref(ref)) {
|
|
2990
|
+
return ref.nativeElement;
|
|
2991
|
+
}
|
|
2992
|
+
return ref;
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
class NgtObjectEvents {
|
|
2996
|
+
constructor() {
|
|
2997
|
+
this.click = output();
|
|
2998
|
+
this.dblclick = output();
|
|
2999
|
+
this.contextmenu = output();
|
|
3000
|
+
this.pointerup = output();
|
|
3001
|
+
this.pointerdown = output();
|
|
3002
|
+
this.pointerover = output();
|
|
3003
|
+
this.pointerout = output();
|
|
3004
|
+
this.pointerenter = output();
|
|
3005
|
+
this.pointerleave = output();
|
|
3006
|
+
this.pointermove = output();
|
|
3007
|
+
this.pointermissed = output();
|
|
3008
|
+
this.pointercancel = output();
|
|
3009
|
+
this.wheel = output();
|
|
3010
|
+
// NOTE: we use model here to allow for the hostDirective host to set this value
|
|
3011
|
+
this.ngtObjectEvents = model();
|
|
3012
|
+
const injector = inject(Injector);
|
|
3013
|
+
afterNextRender(() => {
|
|
3014
|
+
injectObjectEvents(this.ngtObjectEvents, {
|
|
3015
|
+
click: (event) => this.click.emit(event),
|
|
3016
|
+
dblclick: (event) => this.dblclick.emit(event),
|
|
3017
|
+
contextmenu: (event) => this.contextmenu.emit(event),
|
|
3018
|
+
pointerup: (event) => this.pointerup.emit(event),
|
|
3019
|
+
pointerdown: (event) => this.pointerdown.emit(event),
|
|
3020
|
+
pointerover: (event) => this.pointerover.emit(event),
|
|
3021
|
+
pointerout: (event) => this.pointerout.emit(event),
|
|
3022
|
+
pointerenter: (event) => this.pointerenter.emit(event),
|
|
3023
|
+
pointerleave: (event) => this.pointerleave.emit(event),
|
|
3024
|
+
pointermove: (event) => this.pointermove.emit(event),
|
|
3025
|
+
pointermissed: (event) => this.pointermissed.emit(event),
|
|
3026
|
+
pointercancel: (event) => this.pointercancel.emit(event),
|
|
3027
|
+
wheel: (event) => this.wheel.emit(event),
|
|
3028
|
+
}, { injector });
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtObjectEvents, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3032
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.3", type: NgtObjectEvents, isStandalone: true, selector: "[ngtObjectEvents]", inputs: { ngtObjectEvents: { classPropertyName: "ngtObjectEvents", publicName: "ngtObjectEvents", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { click: "click", dblclick: "dblclick", contextmenu: "contextmenu", pointerup: "pointerup", pointerdown: "pointerdown", pointerover: "pointerover", pointerout: "pointerout", pointerenter: "pointerenter", pointerleave: "pointerleave", pointermove: "pointermove", pointermissed: "pointermissed", pointercancel: "pointercancel", wheel: "wheel", ngtObjectEvents: "ngtObjectEventsChange" }, ngImport: i0 }); }
|
|
3033
|
+
}
|
|
3034
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: NgtObjectEvents, decorators: [{
|
|
3035
|
+
type: Directive,
|
|
3036
|
+
args: [{ standalone: true, selector: '[ngtObjectEvents]' }]
|
|
3037
|
+
}], ctorParameters: () => [] });
|
|
3038
|
+
const NgtObjectEventsHostDirective = {
|
|
3039
|
+
directive: NgtObjectEvents,
|
|
3040
|
+
inputs: ['ngtObjectEvents'],
|
|
3041
|
+
outputs: [
|
|
3042
|
+
'click',
|
|
3043
|
+
'dblclick',
|
|
3044
|
+
'contextmenu',
|
|
3045
|
+
'pointerup',
|
|
3046
|
+
'pointerdown',
|
|
3047
|
+
'pointerover',
|
|
3048
|
+
'pointerout',
|
|
3049
|
+
'pointerenter',
|
|
3050
|
+
'pointerleave',
|
|
3051
|
+
'pointermove',
|
|
3052
|
+
'pointermissed',
|
|
3053
|
+
'pointercancel',
|
|
3054
|
+
'wheel',
|
|
3055
|
+
],
|
|
3056
|
+
};
|
|
3057
|
+
function injectObjectEvents(target, events, { injector } = {}) {
|
|
3058
|
+
return assertInjector(injectObjectEvents, injector, () => {
|
|
3059
|
+
const autoEffect = injectAutoEffect();
|
|
3060
|
+
const renderer = inject(Renderer2);
|
|
3061
|
+
const cleanUps = [];
|
|
3062
|
+
afterNextRender(() => {
|
|
3063
|
+
autoEffect(() => {
|
|
3064
|
+
const targetRef = resolveRef(target());
|
|
3065
|
+
if (!targetRef)
|
|
3066
|
+
return;
|
|
3067
|
+
Object.entries(events).forEach(([eventName, eventHandler]) => {
|
|
3068
|
+
cleanUps.push(renderer.listen(targetRef, eventName, eventHandler));
|
|
3069
|
+
});
|
|
3070
|
+
return () => {
|
|
3071
|
+
cleanUps.forEach((cleanUp) => cleanUp());
|
|
3072
|
+
};
|
|
3073
|
+
});
|
|
3074
|
+
});
|
|
3075
|
+
inject(DestroyRef).onDestroy(() => {
|
|
3076
|
+
cleanUps.forEach((cleanUp) => cleanUp());
|
|
3077
|
+
});
|
|
3078
|
+
return cleanUps;
|
|
3079
|
+
});
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3099
3082
|
function omit(objFn, keysToOmit) {
|
|
3100
3083
|
return computed(() => {
|
|
3101
3084
|
const obj = objFn();
|