@akcelik/strct 4.20.0 → 4.21.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/akcelik-strct.mjs +342 -29
- package/fesm2022/akcelik-strct.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/_base.scss +41 -0
- package/types/akcelik-strct.d.ts +127 -4
|
@@ -20753,6 +20753,22 @@ class StrctSplitter {
|
|
|
20753
20753
|
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
20754
20754
|
max = input(85, /* @ts-ignore */
|
|
20755
20755
|
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
20756
|
+
/**
|
|
20757
|
+
* What `split`, `minSize` and `maxSize` are measured in. A sidebar is 280px,
|
|
20758
|
+
* not 22%, so `px` sizes the start pane in pixels and drags it in pixels.
|
|
20759
|
+
*/
|
|
20760
|
+
unit = input('percent', /* @ts-ignore */
|
|
20761
|
+
...(ngDevMode ? [{ debugName: "unit" }] : /* istanbul ignore next */ []));
|
|
20762
|
+
/** Bounds in `unit` for the start pane; they win over `min` / `max`. */
|
|
20763
|
+
minSize = input(null, /* @ts-ignore */
|
|
20764
|
+
...(ngDevMode ? [{ debugName: "minSize" }] : /* istanbul ignore next */ []));
|
|
20765
|
+
maxSize = input(null, /* @ts-ignore */
|
|
20766
|
+
...(ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []));
|
|
20767
|
+
/** The start pane can be collapsed to nothing (Enter on the gutter). */
|
|
20768
|
+
collapsible = input(false, { ...(ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
20769
|
+
/** Whether it is collapsed (two-way). */
|
|
20770
|
+
collapsed = model(false, /* @ts-ignore */
|
|
20771
|
+
...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
|
|
20756
20772
|
/** Stack panes vertically (gutter drags up/down). */
|
|
20757
20773
|
vertical = input(false, { ...(ngDevMode ? { debugName: "vertical" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
20758
20774
|
/** Accessible name of the separator (localizable). */
|
|
@@ -20761,8 +20777,20 @@ class StrctSplitter {
|
|
|
20761
20777
|
/** Keyboard nudge step in percent. */
|
|
20762
20778
|
step = input(3, /* @ts-ignore */
|
|
20763
20779
|
...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
20764
|
-
|
|
20780
|
+
/** The effective bounds, in whichever unit the splitter is measured in. */
|
|
20781
|
+
lowerBound = computed(() => this.minSize() ?? (this.unit() === 'px' ? 0 : this.min()), /* @ts-ignore */
|
|
20782
|
+
...(ngDevMode ? [{ debugName: "lowerBound" }] : /* istanbul ignore next */ []));
|
|
20783
|
+
upperBound = computed(() => this.maxSize() ?? (this.unit() === 'px' ? Number.POSITIVE_INFINITY : this.max()), /* @ts-ignore */
|
|
20784
|
+
...(ngDevMode ? [{ debugName: "upperBound" }] : /* istanbul ignore next */ []));
|
|
20785
|
+
clamped = computed(() => Math.min(this.upperBound(), Math.max(this.lowerBound(), this.split())), /* @ts-ignore */
|
|
20765
20786
|
...(ngDevMode ? [{ debugName: "clamped" }] : /* istanbul ignore next */ []));
|
|
20787
|
+
/** The start pane's flex-basis: its size, or nothing while collapsed. */
|
|
20788
|
+
startBasis = computed(() => {
|
|
20789
|
+
if (this.collapsed())
|
|
20790
|
+
return '0px';
|
|
20791
|
+
return this.unit() === 'px' ? `${this.clamped()}px` : `${this.clamped()}%`;
|
|
20792
|
+
}, /* @ts-ignore */
|
|
20793
|
+
...(ngDevMode ? [{ debugName: "startBasis" }] : /* istanbul ignore next */ []));
|
|
20766
20794
|
dragging = signal(false, /* @ts-ignore */
|
|
20767
20795
|
...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
|
|
20768
20796
|
moveHandler = (e) => this.onDragMove(e);
|
|
@@ -20788,7 +20816,11 @@ class StrctSplitter {
|
|
|
20788
20816
|
: (event.clientX - rect.left) / rect.width;
|
|
20789
20817
|
if (!this.vertical() && this.isRtl())
|
|
20790
20818
|
ratio = 1 - ratio;
|
|
20791
|
-
|
|
20819
|
+
const span = this.vertical() ? rect.height : rect.width;
|
|
20820
|
+
const next = this.unit() === 'px' ? Math.round(ratio * span) : Math.round(ratio * 100);
|
|
20821
|
+
if (this.collapsed())
|
|
20822
|
+
this.collapsed.set(false);
|
|
20823
|
+
this.split.set(Math.min(this.upperBound(), Math.max(this.lowerBound(), next)));
|
|
20792
20824
|
}
|
|
20793
20825
|
onDragEnd() {
|
|
20794
20826
|
this.dragging.set(false);
|
|
@@ -20809,23 +20841,36 @@ class StrctSplitter {
|
|
|
20809
20841
|
// RTL: the start pane extends to the left, so Left grows and Right shrinks.
|
|
20810
20842
|
if (!this.vertical() && this.isRtl())
|
|
20811
20843
|
[dec, inc] = [inc, dec];
|
|
20844
|
+
// Enter collapses a collapsible pane, and restores it.
|
|
20845
|
+
if (this.collapsible() && (event.key === 'Enter' || event.key === ' ')) {
|
|
20846
|
+
event.preventDefault();
|
|
20847
|
+
this.collapsed.update((v) => !v);
|
|
20848
|
+
return;
|
|
20849
|
+
}
|
|
20850
|
+
const step = this.unit() === 'px' ? this.step() * 8 : this.step();
|
|
20812
20851
|
let next = null;
|
|
20813
20852
|
if (event.key === dec)
|
|
20814
|
-
next = this.clamped() -
|
|
20853
|
+
next = this.clamped() - step;
|
|
20815
20854
|
else if (event.key === inc)
|
|
20816
|
-
next = this.clamped() +
|
|
20855
|
+
next = this.clamped() + step;
|
|
20817
20856
|
else if (event.key === 'Home')
|
|
20818
|
-
next = this.
|
|
20857
|
+
next = this.lowerBound();
|
|
20819
20858
|
else if (event.key === 'End')
|
|
20820
|
-
next = this.
|
|
20859
|
+
next = Number.isFinite(this.upperBound()) ? this.upperBound() : this.clamped() + step * 4;
|
|
20821
20860
|
if (next == null)
|
|
20822
20861
|
return;
|
|
20823
20862
|
event.preventDefault();
|
|
20824
|
-
|
|
20863
|
+
if (this.collapsed())
|
|
20864
|
+
this.collapsed.set(false);
|
|
20865
|
+
this.split.set(Math.min(this.upperBound(), Math.max(this.lowerBound(), next)));
|
|
20825
20866
|
}
|
|
20826
20867
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctSplitter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20827
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: StrctSplitter, isStandalone: true, selector: "strct-splitter", inputs: { split: { classPropertyName: "split", publicName: "split", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, vertical: { classPropertyName: "vertical", publicName: "vertical", isSignal: true, isRequired: false, transformFunction: null }, gutterLabel: { classPropertyName: "gutterLabel", publicName: "gutterLabel", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { split: "splitChange" }, host: { properties: { "class.strct-split--vertical": "vertical()", "class.strct-split--dragging": "dragging()" }, classAttribute: "strct-split" }, ngImport: i0, template: `
|
|
20828
|
-
<div
|
|
20868
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: StrctSplitter, isStandalone: true, selector: "strct-splitter", inputs: { split: { classPropertyName: "split", publicName: "split", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, unit: { classPropertyName: "unit", publicName: "unit", isSignal: true, isRequired: false, transformFunction: null }, minSize: { classPropertyName: "minSize", publicName: "minSize", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, vertical: { classPropertyName: "vertical", publicName: "vertical", isSignal: true, isRequired: false, transformFunction: null }, gutterLabel: { classPropertyName: "gutterLabel", publicName: "gutterLabel", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { split: "splitChange", collapsed: "collapsedChange" }, host: { properties: { "class.strct-split--vertical": "vertical()", "class.strct-split--dragging": "dragging()" }, classAttribute: "strct-split" }, ngImport: i0, template: `
|
|
20869
|
+
<div
|
|
20870
|
+
class="strct-split__pane"
|
|
20871
|
+
[class.strct-split__pane--collapsed]="collapsed()"
|
|
20872
|
+
[style.flex-basis]="startBasis()"
|
|
20873
|
+
>
|
|
20829
20874
|
<ng-content select="[strctPaneStart]" />
|
|
20830
20875
|
</div>
|
|
20831
20876
|
<div
|
|
@@ -20834,9 +20879,10 @@ class StrctSplitter {
|
|
|
20834
20879
|
tabindex="0"
|
|
20835
20880
|
[attr.aria-label]="gutterLabel()"
|
|
20836
20881
|
[attr.aria-orientation]="vertical() ? 'horizontal' : 'vertical'"
|
|
20837
|
-
[attr.aria-valuenow]="clamped()"
|
|
20838
|
-
[attr.aria-valuemin]="
|
|
20839
|
-
[attr.aria-valuemax]="
|
|
20882
|
+
[attr.aria-valuenow]="collapsed() ? 0 : clamped()"
|
|
20883
|
+
[attr.aria-valuemin]="lowerBound()"
|
|
20884
|
+
[attr.aria-valuemax]="upperBound()"
|
|
20885
|
+
[attr.aria-expanded]="collapsible() ? !collapsed() : null"
|
|
20840
20886
|
(pointerdown)="onDragStart($event)"
|
|
20841
20887
|
(keydown)="onKeydown($event)"
|
|
20842
20888
|
>
|
|
@@ -20845,12 +20891,16 @@ class StrctSplitter {
|
|
|
20845
20891
|
<div class="strct-split__pane strct-split__pane--end">
|
|
20846
20892
|
<ng-content select="[strctPaneEnd]" />
|
|
20847
20893
|
</div>
|
|
20848
|
-
`, isInline: true, styles: [".strct-split{display:flex;width:100%;min-height:0}.strct-split--vertical{flex-direction:column}.strct-split__pane{flex-grow:0;flex-shrink:0;overflow:auto;min-width:0;min-height:0}.strct-split__pane--end{flex:1 1 0}.strct-split__gutter{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:7px;cursor:col-resize;background:transparent;touch-action:none}.strct-split--vertical>.strct-split__gutter{width:auto;height:7px;cursor:row-resize}.strct-split__gutter:hover,.strct-split--dragging>.strct-split__gutter{background:var(--acc18)}.strct-split__gutter:focus-visible{outline:2px solid var(--acc50);outline-offset:-2px}.strct-split__grip{width:1.5px;height:26px;border-radius:1px;background:var(--b2)}.strct-split--vertical .strct-split__grip{width:26px;height:1.5px}.strct-split--dragging{-webkit-user-select:none;user-select:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
20894
|
+
`, isInline: true, styles: [".strct-split{display:flex;width:100%;min-height:0}.strct-split--vertical{flex-direction:column}.strct-split__pane--collapsed{overflow:hidden}.strct-split__pane{flex-grow:0;flex-shrink:0;overflow:auto;min-width:0;min-height:0}.strct-split__pane--end{flex:1 1 0}.strct-split__gutter{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:7px;cursor:col-resize;background:transparent;touch-action:none}.strct-split--vertical>.strct-split__gutter{width:auto;height:7px;cursor:row-resize}.strct-split__gutter:hover,.strct-split--dragging>.strct-split__gutter{background:var(--acc18)}.strct-split__gutter:focus-visible{outline:2px solid var(--acc50);outline-offset:-2px}.strct-split__grip{width:1.5px;height:26px;border-radius:1px;background:var(--b2)}.strct-split--vertical .strct-split__grip{width:26px;height:1.5px}.strct-split--dragging{-webkit-user-select:none;user-select:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
20849
20895
|
}
|
|
20850
20896
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctSplitter, decorators: [{
|
|
20851
20897
|
type: Component,
|
|
20852
20898
|
args: [{ selector: 'strct-splitter', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: `
|
|
20853
|
-
<div
|
|
20899
|
+
<div
|
|
20900
|
+
class="strct-split__pane"
|
|
20901
|
+
[class.strct-split__pane--collapsed]="collapsed()"
|
|
20902
|
+
[style.flex-basis]="startBasis()"
|
|
20903
|
+
>
|
|
20854
20904
|
<ng-content select="[strctPaneStart]" />
|
|
20855
20905
|
</div>
|
|
20856
20906
|
<div
|
|
@@ -20859,9 +20909,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
|
|
|
20859
20909
|
tabindex="0"
|
|
20860
20910
|
[attr.aria-label]="gutterLabel()"
|
|
20861
20911
|
[attr.aria-orientation]="vertical() ? 'horizontal' : 'vertical'"
|
|
20862
|
-
[attr.aria-valuenow]="clamped()"
|
|
20863
|
-
[attr.aria-valuemin]="
|
|
20864
|
-
[attr.aria-valuemax]="
|
|
20912
|
+
[attr.aria-valuenow]="collapsed() ? 0 : clamped()"
|
|
20913
|
+
[attr.aria-valuemin]="lowerBound()"
|
|
20914
|
+
[attr.aria-valuemax]="upperBound()"
|
|
20915
|
+
[attr.aria-expanded]="collapsible() ? !collapsed() : null"
|
|
20865
20916
|
(pointerdown)="onDragStart($event)"
|
|
20866
20917
|
(keydown)="onKeydown($event)"
|
|
20867
20918
|
>
|
|
@@ -20874,8 +20925,143 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
|
|
|
20874
20925
|
class: 'strct-split',
|
|
20875
20926
|
'[class.strct-split--vertical]': 'vertical()',
|
|
20876
20927
|
'[class.strct-split--dragging]': 'dragging()',
|
|
20877
|
-
}, styles: [".strct-split{display:flex;width:100%;min-height:0}.strct-split--vertical{flex-direction:column}.strct-split__pane{flex-grow:0;flex-shrink:0;overflow:auto;min-width:0;min-height:0}.strct-split__pane--end{flex:1 1 0}.strct-split__gutter{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:7px;cursor:col-resize;background:transparent;touch-action:none}.strct-split--vertical>.strct-split__gutter{width:auto;height:7px;cursor:row-resize}.strct-split__gutter:hover,.strct-split--dragging>.strct-split__gutter{background:var(--acc18)}.strct-split__gutter:focus-visible{outline:2px solid var(--acc50);outline-offset:-2px}.strct-split__grip{width:1.5px;height:26px;border-radius:1px;background:var(--b2)}.strct-split--vertical .strct-split__grip{width:26px;height:1.5px}.strct-split--dragging{-webkit-user-select:none;user-select:none}\n"] }]
|
|
20878
|
-
}], ctorParameters: () => [], propDecorators: { split: [{ type: i0.Input, args: [{ isSignal: true, alias: "split", required: false }] }, { type: i0.Output, args: ["splitChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], vertical: [{ type: i0.Input, args: [{ isSignal: true, alias: "vertical", required: false }] }], gutterLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "gutterLabel", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }] } });
|
|
20928
|
+
}, styles: [".strct-split{display:flex;width:100%;min-height:0}.strct-split--vertical{flex-direction:column}.strct-split__pane--collapsed{overflow:hidden}.strct-split__pane{flex-grow:0;flex-shrink:0;overflow:auto;min-width:0;min-height:0}.strct-split__pane--end{flex:1 1 0}.strct-split__gutter{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:7px;cursor:col-resize;background:transparent;touch-action:none}.strct-split--vertical>.strct-split__gutter{width:auto;height:7px;cursor:row-resize}.strct-split__gutter:hover,.strct-split--dragging>.strct-split__gutter{background:var(--acc18)}.strct-split__gutter:focus-visible{outline:2px solid var(--acc50);outline-offset:-2px}.strct-split__grip{width:1.5px;height:26px;border-radius:1px;background:var(--b2)}.strct-split--vertical .strct-split__grip{width:26px;height:1.5px}.strct-split--dragging{-webkit-user-select:none;user-select:none}\n"] }]
|
|
20929
|
+
}], ctorParameters: () => [], propDecorators: { split: [{ type: i0.Input, args: [{ isSignal: true, alias: "split", required: false }] }, { type: i0.Output, args: ["splitChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], unit: [{ type: i0.Input, args: [{ isSignal: true, alias: "unit", required: false }] }], minSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "minSize", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], vertical: [{ type: i0.Input, args: [{ isSignal: true, alias: "vertical", required: false }] }], gutterLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "gutterLabel", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }] } });
|
|
20930
|
+
|
|
20931
|
+
/**
|
|
20932
|
+
* The splitter's gutter, for layouts the splitter does not own — a shell grid,
|
|
20933
|
+
* a docked panel. It draws the library's grip and brings the separator
|
|
20934
|
+
* semantics with it: `role="separator"`, a tab stop, arrows that step, Home and
|
|
20935
|
+
* End for the bounds, and Enter to collapse when `collapsible`.
|
|
20936
|
+
*
|
|
20937
|
+
* <div [strctResizeHandle]="'y'" [(size)]="panelHeight" [min]="120" [max]="600"
|
|
20938
|
+
* aria-label="Resize the task panel"></div>
|
|
20939
|
+
*
|
|
20940
|
+
* The consumer owns the size — the handle only reports it, so the value can be
|
|
20941
|
+
* persisted, clamped or animated as the layout needs.
|
|
20942
|
+
*/
|
|
20943
|
+
class StrctResizeHandle {
|
|
20944
|
+
/** Which axis the handle resizes along: `'x'` (default) or `'y'`. */
|
|
20945
|
+
axis = input('x', { ...(ngDevMode ? { debugName: "axis" } : /* istanbul ignore next */ {}), alias: 'strctResizeHandle' });
|
|
20946
|
+
/** The size being dragged, in px (two-way). */
|
|
20947
|
+
size = model(240, /* @ts-ignore */
|
|
20948
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
20949
|
+
/** Bounds, in px. */
|
|
20950
|
+
min = input(0, /* @ts-ignore */
|
|
20951
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
20952
|
+
max = input(Number.POSITIVE_INFINITY, /* @ts-ignore */
|
|
20953
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
20954
|
+
/** Arrow-key step in px; Shift multiplies it by four. */
|
|
20955
|
+
step = input(16, /* @ts-ignore */
|
|
20956
|
+
...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
20957
|
+
/** Enter collapses the pane the handle sizes. */
|
|
20958
|
+
collapsible = input(false, { ...(ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
20959
|
+
/** Whether it is collapsed (two-way). */
|
|
20960
|
+
collapsed = model(false, /* @ts-ignore */
|
|
20961
|
+
...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
|
|
20962
|
+
/**
|
|
20963
|
+
* Which side of the handle the sized pane is on. `'before'` (default) grows
|
|
20964
|
+
* the pane as the pointer moves toward the inline/block end.
|
|
20965
|
+
*/
|
|
20966
|
+
side = input('before', /* @ts-ignore */
|
|
20967
|
+
...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
|
|
20968
|
+
el = inject(ElementRef);
|
|
20969
|
+
dragging = signal(false, /* @ts-ignore */
|
|
20970
|
+
...(ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []));
|
|
20971
|
+
origin = 0;
|
|
20972
|
+
originSize = 0;
|
|
20973
|
+
rtl = computed(() => getComputedStyle(this.el.nativeElement).direction === 'rtl', /* @ts-ignore */
|
|
20974
|
+
...(ngDevMode ? [{ debugName: "rtl" }] : /* istanbul ignore next */ []));
|
|
20975
|
+
move = (e) => this.onMove(e);
|
|
20976
|
+
up = () => this.onUp();
|
|
20977
|
+
constructor() {
|
|
20978
|
+
inject(DestroyRef).onDestroy(() => this.detach());
|
|
20979
|
+
}
|
|
20980
|
+
onDown(event) {
|
|
20981
|
+
event.preventDefault();
|
|
20982
|
+
this.el.nativeElement.setPointerCapture?.(event.pointerId);
|
|
20983
|
+
this.origin = this.axis() === 'y' ? event.clientY : event.clientX;
|
|
20984
|
+
this.originSize = this.size();
|
|
20985
|
+
this.dragging.set(true);
|
|
20986
|
+
document.addEventListener('pointermove', this.move);
|
|
20987
|
+
document.addEventListener('pointerup', this.up);
|
|
20988
|
+
document.addEventListener('pointercancel', this.up);
|
|
20989
|
+
}
|
|
20990
|
+
onMove(event) {
|
|
20991
|
+
let delta = (this.axis() === 'y' ? event.clientY : event.clientX) - this.origin;
|
|
20992
|
+
// Pointer coordinates are physical; the pane is logical.
|
|
20993
|
+
if (this.axis() === 'x' && this.rtl())
|
|
20994
|
+
delta = -delta;
|
|
20995
|
+
if (this.side() === 'after')
|
|
20996
|
+
delta = -delta;
|
|
20997
|
+
if (this.collapsed())
|
|
20998
|
+
this.collapsed.set(false);
|
|
20999
|
+
this.commit(this.originSize + delta);
|
|
21000
|
+
}
|
|
21001
|
+
onUp() {
|
|
21002
|
+
this.dragging.set(false);
|
|
21003
|
+
this.detach();
|
|
21004
|
+
}
|
|
21005
|
+
detach() {
|
|
21006
|
+
document.removeEventListener('pointermove', this.move);
|
|
21007
|
+
document.removeEventListener('pointerup', this.up);
|
|
21008
|
+
document.removeEventListener('pointercancel', this.up);
|
|
21009
|
+
}
|
|
21010
|
+
onKeydown(event) {
|
|
21011
|
+
if (this.collapsible() && (event.key === 'Enter' || event.key === ' ')) {
|
|
21012
|
+
event.preventDefault();
|
|
21013
|
+
this.collapsed.update((v) => !v);
|
|
21014
|
+
return;
|
|
21015
|
+
}
|
|
21016
|
+
let dec = this.axis() === 'y' ? 'ArrowUp' : 'ArrowLeft';
|
|
21017
|
+
let inc = this.axis() === 'y' ? 'ArrowDown' : 'ArrowRight';
|
|
21018
|
+
if (this.axis() === 'x' && this.rtl())
|
|
21019
|
+
[dec, inc] = [inc, dec];
|
|
21020
|
+
if (this.side() === 'after')
|
|
21021
|
+
[dec, inc] = [inc, dec];
|
|
21022
|
+
const step = this.step() * (event.shiftKey ? 4 : 1);
|
|
21023
|
+
let next = null;
|
|
21024
|
+
if (event.key === dec)
|
|
21025
|
+
next = this.size() - step;
|
|
21026
|
+
else if (event.key === inc)
|
|
21027
|
+
next = this.size() + step;
|
|
21028
|
+
else if (event.key === 'Home')
|
|
21029
|
+
next = this.min();
|
|
21030
|
+
else if (event.key === 'End')
|
|
21031
|
+
next = Number.isFinite(this.max()) ? this.max() : this.size() + step * 4;
|
|
21032
|
+
if (next == null)
|
|
21033
|
+
return;
|
|
21034
|
+
event.preventDefault();
|
|
21035
|
+
if (this.collapsed())
|
|
21036
|
+
this.collapsed.set(false);
|
|
21037
|
+
this.commit(next);
|
|
21038
|
+
}
|
|
21039
|
+
commit(value) {
|
|
21040
|
+
this.size.set(Math.round(Math.min(this.max(), Math.max(this.min(), value))));
|
|
21041
|
+
}
|
|
21042
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctResizeHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21043
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: StrctResizeHandle, isStandalone: true, selector: "[strctResizeHandle]", inputs: { axis: { classPropertyName: "axis", publicName: "strctResizeHandle", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange", collapsed: "collapsedChange" }, host: { attributes: { "role": "separator", "tabindex": "0" }, listeners: { "pointerdown": "onDown($event)", "keydown": "onKeydown($event)" }, properties: { "class.strct-resize--y": "axis() === 'y'", "class.strct-resize--dragging": "dragging()", "attr.aria-orientation": "axis() === 'y' ? 'horizontal' : 'vertical'", "attr.aria-valuenow": "size()", "attr.aria-valuemin": "min()", "attr.aria-valuemax": "max()", "attr.aria-expanded": "collapsible() ? !collapsed() : null" }, classAttribute: "strct-resize" }, ngImport: i0 });
|
|
21044
|
+
}
|
|
21045
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctResizeHandle, decorators: [{
|
|
21046
|
+
type: Directive,
|
|
21047
|
+
args: [{
|
|
21048
|
+
selector: '[strctResizeHandle]',
|
|
21049
|
+
host: {
|
|
21050
|
+
class: 'strct-resize',
|
|
21051
|
+
role: 'separator',
|
|
21052
|
+
tabindex: '0',
|
|
21053
|
+
'[class.strct-resize--y]': "axis() === 'y'",
|
|
21054
|
+
'[class.strct-resize--dragging]': 'dragging()',
|
|
21055
|
+
'[attr.aria-orientation]': "axis() === 'y' ? 'horizontal' : 'vertical'",
|
|
21056
|
+
'[attr.aria-valuenow]': 'size()',
|
|
21057
|
+
'[attr.aria-valuemin]': 'min()',
|
|
21058
|
+
'[attr.aria-valuemax]': 'max()',
|
|
21059
|
+
'[attr.aria-expanded]': 'collapsible() ? !collapsed() : null',
|
|
21060
|
+
'(pointerdown)': 'onDown($event)',
|
|
21061
|
+
'(keydown)': 'onKeydown($event)',
|
|
21062
|
+
},
|
|
21063
|
+
}]
|
|
21064
|
+
}], ctorParameters: () => [], propDecorators: { axis: [{ type: i0.Input, args: [{ isSignal: true, alias: "strctResizeHandle", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }] } });
|
|
20879
21065
|
|
|
20880
21066
|
/**
|
|
20881
21067
|
* Dual-list transfer (picklist) — "assign hosts to the cluster": all items on
|
|
@@ -22271,6 +22457,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
|
|
|
22271
22457
|
args: ['document:keydown.escape', ['$event']]
|
|
22272
22458
|
}] } });
|
|
22273
22459
|
|
|
22460
|
+
/**
|
|
22461
|
+
* Connects several `[strctReorder]` lists, so a card can move between the
|
|
22462
|
+
* columns of a board — by its handle, or with Alt+ArrowLeft / Alt+ArrowRight.
|
|
22463
|
+
* Moves within one list stay on that list's `reordered`; moves across lists
|
|
22464
|
+
* come out here.
|
|
22465
|
+
*/
|
|
22466
|
+
class StrctReorderGroup {
|
|
22467
|
+
/** A card moved from one list to another. */
|
|
22468
|
+
moved = output();
|
|
22469
|
+
/** Every list in this group, in DOM order. */
|
|
22470
|
+
lists = signal([], /* @ts-ignore */
|
|
22471
|
+
...(ngDevMode ? [{ debugName: "lists" }] : /* istanbul ignore next */ []));
|
|
22472
|
+
/** Where the current drag started, so a drop elsewhere knows its origin. */
|
|
22473
|
+
source = signal(null, /* @ts-ignore */
|
|
22474
|
+
...(ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []));
|
|
22475
|
+
register(list) {
|
|
22476
|
+
this.lists.update((ls) => [...ls, list]);
|
|
22477
|
+
}
|
|
22478
|
+
unregister(list) {
|
|
22479
|
+
this.lists.update((ls) => ls.filter((l) => l !== list));
|
|
22480
|
+
}
|
|
22481
|
+
/** The list next to `list` in the given direction, or null at the ends. */
|
|
22482
|
+
neighbour(list, dir) {
|
|
22483
|
+
const ordered = this.ordered();
|
|
22484
|
+
const i = ordered.indexOf(list);
|
|
22485
|
+
return ordered[i + dir] ?? null;
|
|
22486
|
+
}
|
|
22487
|
+
/** DOM order, not registration order — columns read left to right. */
|
|
22488
|
+
ordered() {
|
|
22489
|
+
return [...this.lists()].sort((a, b) => a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
22490
|
+
}
|
|
22491
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorderGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
22492
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: StrctReorderGroup, isStandalone: true, selector: "[strctReorderGroup]", outputs: { moved: "moved" }, ngImport: i0 });
|
|
22493
|
+
}
|
|
22494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorderGroup, decorators: [{
|
|
22495
|
+
type: Directive,
|
|
22496
|
+
args: [{ selector: '[strctReorderGroup]' }]
|
|
22497
|
+
}], propDecorators: { moved: [{ type: i0.Output, args: ["moved"] }] } });
|
|
22274
22498
|
let reorderCounter = 0;
|
|
22275
22499
|
/**
|
|
22276
22500
|
* List drag-reorder primitive — the consumer owns the array:
|
|
@@ -22293,6 +22517,8 @@ let reorderCounter = 0;
|
|
|
22293
22517
|
*/
|
|
22294
22518
|
class StrctReorder {
|
|
22295
22519
|
host = inject(ElementRef);
|
|
22520
|
+
/** The group this list belongs to, when it is one of several. */
|
|
22521
|
+
group = inject(StrctReorderGroup, { optional: true });
|
|
22296
22522
|
renderer = inject(Renderer2);
|
|
22297
22523
|
doc = inject(DOCUMENT);
|
|
22298
22524
|
announcer = inject(StrctAnnouncer);
|
|
@@ -22312,6 +22538,12 @@ class StrctReorder {
|
|
|
22312
22538
|
*/
|
|
22313
22539
|
announcement = input((label, position, total) => `Moved ${label} to position ${position} of ${total}`, /* @ts-ignore */
|
|
22314
22540
|
...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
|
|
22541
|
+
/** This list's name inside a `[strctReorderGroup]`. */
|
|
22542
|
+
listId = input('', /* @ts-ignore */
|
|
22543
|
+
...(ngDevMode ? [{ debugName: "listId" }] : /* istanbul ignore next */ []));
|
|
22544
|
+
/** What a move between lists says (localizable). */
|
|
22545
|
+
moveAnnouncement = input((label, list, position, total) => `Moved ${label} to ${list}, position ${position} of ${total}`, /* @ts-ignore */
|
|
22546
|
+
...(ngDevMode ? [{ debugName: "moveAnnouncement" }] : /* istanbul ignore next */ []));
|
|
22315
22547
|
dragIndex = signal(null, /* @ts-ignore */
|
|
22316
22548
|
...(ngDevMode ? [{ debugName: "dragIndex" }] : /* istanbul ignore next */ []));
|
|
22317
22549
|
overIndex = signal(null, /* @ts-ignore */
|
|
@@ -22319,7 +22551,31 @@ class StrctReorder {
|
|
|
22319
22551
|
/** Id of the sr-only instructions element the items point to. */
|
|
22320
22552
|
instructionsId = `strct-reorder-hint-${++reorderCounter}`;
|
|
22321
22553
|
hint = null;
|
|
22554
|
+
/** The container element — the group orders its lists by DOM position. */
|
|
22555
|
+
element() {
|
|
22556
|
+
return this.host.nativeElement;
|
|
22557
|
+
}
|
|
22558
|
+
/** Move an item into this list at `index`, and say so. */
|
|
22559
|
+
acceptFrom(from, fromIndex, index) {
|
|
22560
|
+
const item = from.items()[fromIndex];
|
|
22561
|
+
if (!item)
|
|
22562
|
+
return;
|
|
22563
|
+
const label = item.textContent?.trim() ?? '';
|
|
22564
|
+
const toIndex = Math.max(0, Math.min(index, this.items().length));
|
|
22565
|
+
from.dragIndex.set(null);
|
|
22566
|
+
this.overIndex.set(null);
|
|
22567
|
+
this.group?.source.set(null);
|
|
22568
|
+
this.group?.moved.emit({
|
|
22569
|
+
item,
|
|
22570
|
+
fromList: from.listId(),
|
|
22571
|
+
toList: this.listId(),
|
|
22572
|
+
fromIndex,
|
|
22573
|
+
toIndex,
|
|
22574
|
+
});
|
|
22575
|
+
this.announcer.announce(this.moveAnnouncement()(label, this.listId(), toIndex + 1, this.items().length + 1));
|
|
22576
|
+
}
|
|
22322
22577
|
constructor() {
|
|
22578
|
+
this.group?.register(this);
|
|
22323
22579
|
// Keep the sr-only instructions element in sync with the input.
|
|
22324
22580
|
effect(() => {
|
|
22325
22581
|
const text = this.instructions();
|
|
@@ -22352,18 +22608,24 @@ class StrctReorder {
|
|
|
22352
22608
|
onContainerDragOver(event) {
|
|
22353
22609
|
// Only the container's own empty space (below the last item); drags over
|
|
22354
22610
|
// items are handled by the items themselves.
|
|
22355
|
-
if (this.dragIndex() == null)
|
|
22611
|
+
if (this.dragIndex() == null && !this.group?.source())
|
|
22356
22612
|
return;
|
|
22357
22613
|
if (event.target.closest('[strctReorderItem]'))
|
|
22358
22614
|
return;
|
|
22359
22615
|
event.preventDefault();
|
|
22360
22616
|
}
|
|
22361
22617
|
onContainerDrop(event) {
|
|
22618
|
+
if (event.target.closest('[strctReorderItem]'))
|
|
22619
|
+
return;
|
|
22620
|
+
const source = this.group?.source();
|
|
22621
|
+
if (source && source.list !== this) {
|
|
22622
|
+
event.preventDefault();
|
|
22623
|
+
this.acceptFrom(source.list, source.index, this.items().length);
|
|
22624
|
+
return;
|
|
22625
|
+
}
|
|
22362
22626
|
const from = this.dragIndex();
|
|
22363
22627
|
if (from == null)
|
|
22364
22628
|
return; // an item already consumed this drop
|
|
22365
|
-
if (event.target.closest('[strctReorderItem]'))
|
|
22366
|
-
return;
|
|
22367
22629
|
event.preventDefault();
|
|
22368
22630
|
// Drop into empty space moves the item to the end.
|
|
22369
22631
|
this.commit(from, this.items().length - 1);
|
|
@@ -22377,18 +22639,19 @@ class StrctReorder {
|
|
|
22377
22639
|
this.overIndex.set(null);
|
|
22378
22640
|
}
|
|
22379
22641
|
ngOnDestroy() {
|
|
22642
|
+
this.group?.unregister(this);
|
|
22380
22643
|
if (this.hint) {
|
|
22381
22644
|
this.renderer.removeChild(this.doc.body, this.hint);
|
|
22382
22645
|
this.hint = null;
|
|
22383
22646
|
}
|
|
22384
22647
|
}
|
|
22385
22648
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorder, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
22386
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: StrctReorder, isStandalone: true, selector: "[strctReorder]", inputs: { reorderDisabled: { classPropertyName: "reorderDisabled", publicName: "reorderDisabled", isSignal: true, isRequired: false, transformFunction: null }, instructions: { classPropertyName: "instructions", publicName: "instructions", isSignal: true, isRequired: false, transformFunction: null }, announcement: { classPropertyName: "announcement", publicName: "announcement", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reordered: "reordered" }, host: { listeners: { "dragover": "onContainerDragOver($event)", "drop": "onContainerDrop($event)", "dragleave": "onDragLeave($event)" } }, ngImport: i0 });
|
|
22649
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: StrctReorder, isStandalone: true, selector: "[strctReorder]", inputs: { reorderDisabled: { classPropertyName: "reorderDisabled", publicName: "reorderDisabled", isSignal: true, isRequired: false, transformFunction: null }, instructions: { classPropertyName: "instructions", publicName: "instructions", isSignal: true, isRequired: false, transformFunction: null }, announcement: { classPropertyName: "announcement", publicName: "announcement", isSignal: true, isRequired: false, transformFunction: null }, listId: { classPropertyName: "listId", publicName: "listId", isSignal: true, isRequired: false, transformFunction: null }, moveAnnouncement: { classPropertyName: "moveAnnouncement", publicName: "moveAnnouncement", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reordered: "reordered" }, host: { listeners: { "dragover": "onContainerDragOver($event)", "drop": "onContainerDrop($event)", "dragleave": "onDragLeave($event)" } }, ngImport: i0 });
|
|
22387
22650
|
}
|
|
22388
22651
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorder, decorators: [{
|
|
22389
22652
|
type: Directive,
|
|
22390
22653
|
args: [{ selector: '[strctReorder]' }]
|
|
22391
|
-
}], ctorParameters: () => [], propDecorators: { reordered: [{ type: i0.Output, args: ["reordered"] }], reorderDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderDisabled", required: false }] }], instructions: [{ type: i0.Input, args: [{ isSignal: true, alias: "instructions", required: false }] }], announcement: [{ type: i0.Input, args: [{ isSignal: true, alias: "announcement", required: false }] }], onContainerDragOver: [{
|
|
22654
|
+
}], ctorParameters: () => [], propDecorators: { reordered: [{ type: i0.Output, args: ["reordered"] }], reorderDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderDisabled", required: false }] }], instructions: [{ type: i0.Input, args: [{ isSignal: true, alias: "instructions", required: false }] }], announcement: [{ type: i0.Input, args: [{ isSignal: true, alias: "announcement", required: false }] }], listId: [{ type: i0.Input, args: [{ isSignal: true, alias: "listId", required: false }] }], moveAnnouncement: [{ type: i0.Input, args: [{ isSignal: true, alias: "moveAnnouncement", required: false }] }], onContainerDragOver: [{
|
|
22392
22655
|
type: HostListener,
|
|
22393
22656
|
args: ['dragover', ['$event']]
|
|
22394
22657
|
}], onContainerDrop: [{
|
|
@@ -22398,6 +22661,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
|
|
|
22398
22661
|
type: HostListener,
|
|
22399
22662
|
args: ['dragleave', ['$event']]
|
|
22400
22663
|
}] } });
|
|
22664
|
+
/**
|
|
22665
|
+
* The only place a drag may start from, when an item has one. Content that is
|
|
22666
|
+
* itself draggable — text selection, a chart brush — must not start a move.
|
|
22667
|
+
*/
|
|
22668
|
+
class StrctReorderHandle {
|
|
22669
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorderHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
22670
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: StrctReorderHandle, isStandalone: true, selector: "[strctReorderHandle]", host: { classAttribute: "strct-reorder__handle" }, ngImport: i0 });
|
|
22671
|
+
}
|
|
22672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorderHandle, decorators: [{
|
|
22673
|
+
type: Directive,
|
|
22674
|
+
args: [{ selector: '[strctReorderHandle]', host: { class: 'strct-reorder__handle' } }]
|
|
22675
|
+
}] });
|
|
22401
22676
|
/** One draggable row inside a `[strctReorder]` container. */
|
|
22402
22677
|
class StrctReorderItem {
|
|
22403
22678
|
list = inject(StrctReorder);
|
|
@@ -22407,6 +22682,12 @@ class StrctReorderItem {
|
|
|
22407
22682
|
hostTabindex() {
|
|
22408
22683
|
return this.hadOwnTabindex ? null : 0;
|
|
22409
22684
|
}
|
|
22685
|
+
/** The keys that apply: the sideways pair only when there is somewhere to go. */
|
|
22686
|
+
shortcuts() {
|
|
22687
|
+
return this.list.group
|
|
22688
|
+
? 'Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight'
|
|
22689
|
+
: 'Alt+ArrowUp Alt+ArrowDown';
|
|
22690
|
+
}
|
|
22410
22691
|
isDragging() {
|
|
22411
22692
|
return this.list.dragIndex() === this.index();
|
|
22412
22693
|
}
|
|
@@ -22416,22 +22697,38 @@ class StrctReorderItem {
|
|
|
22416
22697
|
index() {
|
|
22417
22698
|
return this.list.indexOf(this.el.nativeElement);
|
|
22418
22699
|
}
|
|
22700
|
+
/** Where the last pointerdown landed — a drag may only start on a handle. */
|
|
22701
|
+
fromHandle = false;
|
|
22702
|
+
onPointerDown(event) {
|
|
22703
|
+
this.fromHandle = !!event.target.closest('[strctReorderHandle]');
|
|
22704
|
+
}
|
|
22419
22705
|
onDragStart(event) {
|
|
22420
22706
|
if (this.list.reorderDisabled())
|
|
22421
22707
|
return;
|
|
22708
|
+
// With a handle present, only the handle starts a move.
|
|
22709
|
+
if (this.el.nativeElement.querySelector('[strctReorderHandle]') && !this.fromHandle) {
|
|
22710
|
+
event.preventDefault();
|
|
22711
|
+
return;
|
|
22712
|
+
}
|
|
22422
22713
|
this.list.dragIndex.set(this.index());
|
|
22714
|
+
this.list.group?.source.set({ list: this.list, index: this.index() });
|
|
22423
22715
|
event.dataTransfer?.setData('text/plain', String(this.index()));
|
|
22424
22716
|
if (event.dataTransfer)
|
|
22425
22717
|
event.dataTransfer.effectAllowed = 'move';
|
|
22426
22718
|
}
|
|
22427
22719
|
onDragOver(event) {
|
|
22428
|
-
if (this.list.dragIndex() == null)
|
|
22720
|
+
if (this.list.dragIndex() == null && !this.list.group?.source())
|
|
22429
22721
|
return;
|
|
22430
22722
|
event.preventDefault();
|
|
22431
22723
|
this.list.overIndex.set(this.index());
|
|
22432
22724
|
}
|
|
22433
22725
|
onDrop(event) {
|
|
22434
22726
|
event.preventDefault();
|
|
22727
|
+
const source = this.list.group?.source();
|
|
22728
|
+
if (source && source.list !== this.list) {
|
|
22729
|
+
this.list.acceptFrom(source.list, source.index, this.index());
|
|
22730
|
+
return;
|
|
22731
|
+
}
|
|
22435
22732
|
const from = this.list.dragIndex();
|
|
22436
22733
|
if (from == null)
|
|
22437
22734
|
return;
|
|
@@ -22440,10 +22737,23 @@ class StrctReorderItem {
|
|
|
22440
22737
|
onDragEnd() {
|
|
22441
22738
|
this.list.dragIndex.set(null);
|
|
22442
22739
|
this.list.overIndex.set(null);
|
|
22740
|
+
this.list.group?.source.set(null);
|
|
22443
22741
|
}
|
|
22444
22742
|
onKeydown(event) {
|
|
22445
22743
|
if (this.list.reorderDisabled() || !event.altKey)
|
|
22446
22744
|
return;
|
|
22745
|
+
const group = this.list.group;
|
|
22746
|
+
// Alt+Left / Alt+Right move to the neighbouring list at the same index.
|
|
22747
|
+
if (group && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
22748
|
+
const target = group.neighbour(this.list, event.key === 'ArrowLeft' ? -1 : 1);
|
|
22749
|
+
if (!target)
|
|
22750
|
+
return;
|
|
22751
|
+
event.preventDefault();
|
|
22752
|
+
const index = this.index();
|
|
22753
|
+
target.acceptFrom(this.list, index, index);
|
|
22754
|
+
setTimeout(() => target.items()[Math.min(index, target.items().length - 1)]?.focus());
|
|
22755
|
+
return;
|
|
22756
|
+
}
|
|
22447
22757
|
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown')
|
|
22448
22758
|
return;
|
|
22449
22759
|
event.preventDefault();
|
|
@@ -22456,7 +22766,7 @@ class StrctReorderItem {
|
|
|
22456
22766
|
setTimeout(() => this.list.items()[to]?.focus());
|
|
22457
22767
|
}
|
|
22458
22768
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorderItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
22459
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: StrctReorderItem, isStandalone: true, selector: "[strctReorderItem]", host: { listeners: { "dragstart": "onDragStart($event)", "dragover": "onDragOver($event)", "drop": "onDrop($event)", "dragend": "onDragEnd()", "keydown": "onKeydown($event)" }, properties: { "attr.draggable": "!list.reorderDisabled()", "attr.tabindex": "hostTabindex()", "class.strct-reorder--dragging": "isDragging()", "class.strct-reorder--over": "isOver()", "attr.aria-roledescription": "'sortable'", "attr.aria-keyshortcuts": "
|
|
22769
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: StrctReorderItem, isStandalone: true, selector: "[strctReorderItem]", host: { listeners: { "pointerdown": "onPointerDown($event)", "dragstart": "onDragStart($event)", "dragover": "onDragOver($event)", "drop": "onDrop($event)", "dragend": "onDragEnd()", "keydown": "onKeydown($event)" }, properties: { "attr.draggable": "!list.reorderDisabled()", "attr.tabindex": "hostTabindex()", "class.strct-reorder--dragging": "isDragging()", "class.strct-reorder--over": "isOver()", "attr.aria-roledescription": "'sortable'", "attr.aria-keyshortcuts": "shortcuts()", "attr.aria-posinset": "index() + 1", "attr.aria-setsize": "list.items().length", "attr.aria-describedby": "list.instructions() ? list.instructionsId : null" } }, ngImport: i0 });
|
|
22460
22770
|
}
|
|
22461
22771
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: StrctReorderItem, decorators: [{
|
|
22462
22772
|
type: Directive,
|
|
@@ -22468,13 +22778,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
|
|
|
22468
22778
|
'[class.strct-reorder--dragging]': 'isDragging()',
|
|
22469
22779
|
'[class.strct-reorder--over]': 'isOver()',
|
|
22470
22780
|
'[attr.aria-roledescription]': "'sortable'",
|
|
22471
|
-
'[attr.aria-keyshortcuts]':
|
|
22781
|
+
'[attr.aria-keyshortcuts]': 'shortcuts()',
|
|
22472
22782
|
'[attr.aria-posinset]': 'index() + 1',
|
|
22473
22783
|
'[attr.aria-setsize]': 'list.items().length',
|
|
22474
22784
|
'[attr.aria-describedby]': 'list.instructions() ? list.instructionsId : null',
|
|
22475
22785
|
},
|
|
22476
22786
|
}]
|
|
22477
|
-
}], propDecorators: {
|
|
22787
|
+
}], propDecorators: { onPointerDown: [{
|
|
22788
|
+
type: HostListener,
|
|
22789
|
+
args: ['pointerdown', ['$event']]
|
|
22790
|
+
}], onDragStart: [{
|
|
22478
22791
|
type: HostListener,
|
|
22479
22792
|
args: ['dragstart', ['$event']]
|
|
22480
22793
|
}], onDragOver: [{
|
|
@@ -24864,5 +25177,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
|
|
|
24864
25177
|
* Generated bundle index. Do not edit.
|
|
24865
25178
|
*/
|
|
24866
25179
|
|
|
24867
|
-
export { FOCUSABLE_SELECTOR, STRCT_DP_DOW, STRCT_DP_DOW_FULL, STRCT_DP_MONTHS, STRCT_ICONS, STRCT_ICON_GROUPS, STRCT_ICON_NAMES, STRCT_MASKS, STRCT_NOTIFICATION_HISTORY_LIMIT, STRCT_PALETTES, STRCT_RAW_ICONS, STRCT_TIME_RANGE_PRESETS, STRCT_WIZARD_DEFAULTS, StrctAccordion, StrctAccordionPanel, StrctAlert, StrctAnnouncer, StrctAvatar, StrctBadge, StrctBreadcrumb, StrctBreadcrumbItem, StrctButton, StrctButtonGroup, StrctBytesPipe, StrctCard, StrctCardBlock, StrctCardFooter, StrctCardHeader, StrctCardHeaderActions, StrctCardHeaderMeta, StrctCardHeaderNote, StrctCascadeColumn, StrctCascadeHost, StrctCascadeSelect, StrctCellDef, StrctCellStatus, StrctChange, StrctChart, StrctCheckbox, StrctChips, StrctCode, StrctCodeInline, StrctColorPicker, StrctCombobox, StrctCommandPalette, StrctConfirmOutlet, StrctConfirmService, StrctContextMenu, StrctContextMenuTrigger, StrctControlDescription, StrctCopy, StrctDatagrid, StrctDatagridActionBar, StrctDatagridActionBarCaption, StrctDatepicker, StrctDatetimePicker, StrctDesc, StrctDescriptionList, StrctDiff, StrctDivider, StrctDonut, StrctDrawer, StrctDrawerFooter, StrctDropdown, StrctDropdownDivider, StrctDropdownItem, StrctDropdownItemAction, StrctDropdownTrigger, StrctDurationPipe, StrctEmptyState, StrctField, StrctFieldGroup, StrctFieldHint, StrctFieldPrefix, StrctFieldSuffix, StrctFile, StrctFilterBar, StrctFlow, StrctFlowNodeTemplate, StrctFooter, StrctGauge, StrctHeader, StrctHeatmap, StrctHero, StrctHotkeysHelp, StrctHotkeysService, StrctIcon, StrctInlineEdit, StrctInput, StrctInputMask, StrctInputOtp, StrctKbd, StrctKnob, StrctLegend, StrctList, StrctListItem, StrctListItemDescription, StrctListItemLeading, StrctListItemMeta, StrctListItemTrailing, StrctLiveIndicator, StrctLogViewer, StrctLogin, StrctMediaFrame, StrctMenuPanel, StrctMenuService, StrctMenubar, StrctMetricTile, StrctModal, StrctModalContent, StrctNav, StrctNavItem, StrctNotificationCenter, StrctNumber, StrctOverlay, StrctPageHeader, StrctPageHeaderActions, StrctPageHeaderCrumbs, StrctPageHeaderTitleMeta, StrctPagination, StrctPassword, StrctPopover, StrctPopoverTrigger, StrctProgress, StrctRadio, StrctRadioGroup, StrctRail, StrctRange, StrctRatePipe, StrctRating, StrctReorder, StrctReorderItem, StrctRowDetailDef, StrctSearchbox, StrctSectionHeader, StrctSectionHeaderActions, StrctSectionHeaderMeta, StrctSectionMenu, StrctSegmented, StrctSelect, StrctShell, StrctShellService, StrctSiPipe, StrctSignpost, StrctSignpostTrigger, StrctSkeleton, StrctSparkline, StrctSpeedDial, StrctSpinner, StrctSplitButton, StrctSplitter, StrctStack, StrctStackItem, StrctStatusDot, StrctStep, StrctStepAction, StrctSteps, StrctSubmenu, StrctTab, StrctTable, StrctTabs, StrctTag, StrctTagLeading, StrctThemeService, StrctThemeSwitcher, StrctTimeRangePicker, StrctTimeline, StrctTimelineItem, StrctToastOutlet, StrctToastService, StrctToggle, StrctToolbar, StrctToolbarCaption, StrctToolbarSpacer, StrctTooltip, StrctTour, StrctTransfer, StrctTree, StrctTreeNode, StrctTreeSelect, StrctVerticalNav, StrctWatermark, StrctWizard, StrctWizardAside, focusFirstIn, keepTabInside, lockBodyScroll, parseAnsi, provideStrctWizardDefaults, registerStrctIcon, restoreFocus, saveFocusedElement, strctComputeDiff, strctDpPad, strctFormatBytes, strctFormatDuration, strctFormatRate, strctFormatSi, strctValidationIcon, strctValidationTone, unlockBodyScroll };
|
|
25180
|
+
export { FOCUSABLE_SELECTOR, STRCT_DP_DOW, STRCT_DP_DOW_FULL, STRCT_DP_MONTHS, STRCT_ICONS, STRCT_ICON_GROUPS, STRCT_ICON_NAMES, STRCT_MASKS, STRCT_NOTIFICATION_HISTORY_LIMIT, STRCT_PALETTES, STRCT_RAW_ICONS, STRCT_TIME_RANGE_PRESETS, STRCT_WIZARD_DEFAULTS, StrctAccordion, StrctAccordionPanel, StrctAlert, StrctAnnouncer, StrctAvatar, StrctBadge, StrctBreadcrumb, StrctBreadcrumbItem, StrctButton, StrctButtonGroup, StrctBytesPipe, StrctCard, StrctCardBlock, StrctCardFooter, StrctCardHeader, StrctCardHeaderActions, StrctCardHeaderMeta, StrctCardHeaderNote, StrctCascadeColumn, StrctCascadeHost, StrctCascadeSelect, StrctCellDef, StrctCellStatus, StrctChange, StrctChart, StrctCheckbox, StrctChips, StrctCode, StrctCodeInline, StrctColorPicker, StrctCombobox, StrctCommandPalette, StrctConfirmOutlet, StrctConfirmService, StrctContextMenu, StrctContextMenuTrigger, StrctControlDescription, StrctCopy, StrctDatagrid, StrctDatagridActionBar, StrctDatagridActionBarCaption, StrctDatepicker, StrctDatetimePicker, StrctDesc, StrctDescriptionList, StrctDiff, StrctDivider, StrctDonut, StrctDrawer, StrctDrawerFooter, StrctDropdown, StrctDropdownDivider, StrctDropdownItem, StrctDropdownItemAction, StrctDropdownTrigger, StrctDurationPipe, StrctEmptyState, StrctField, StrctFieldGroup, StrctFieldHint, StrctFieldPrefix, StrctFieldSuffix, StrctFile, StrctFilterBar, StrctFlow, StrctFlowNodeTemplate, StrctFooter, StrctGauge, StrctHeader, StrctHeatmap, StrctHero, StrctHotkeysHelp, StrctHotkeysService, StrctIcon, StrctInlineEdit, StrctInput, StrctInputMask, StrctInputOtp, StrctKbd, StrctKnob, StrctLegend, StrctList, StrctListItem, StrctListItemDescription, StrctListItemLeading, StrctListItemMeta, StrctListItemTrailing, StrctLiveIndicator, StrctLogViewer, StrctLogin, StrctMediaFrame, StrctMenuPanel, StrctMenuService, StrctMenubar, StrctMetricTile, StrctModal, StrctModalContent, StrctNav, StrctNavItem, StrctNotificationCenter, StrctNumber, StrctOverlay, StrctPageHeader, StrctPageHeaderActions, StrctPageHeaderCrumbs, StrctPageHeaderTitleMeta, StrctPagination, StrctPassword, StrctPopover, StrctPopoverTrigger, StrctProgress, StrctRadio, StrctRadioGroup, StrctRail, StrctRange, StrctRatePipe, StrctRating, StrctReorder, StrctReorderGroup, StrctReorderHandle, StrctReorderItem, StrctResizeHandle, StrctRowDetailDef, StrctSearchbox, StrctSectionHeader, StrctSectionHeaderActions, StrctSectionHeaderMeta, StrctSectionMenu, StrctSegmented, StrctSelect, StrctShell, StrctShellService, StrctSiPipe, StrctSignpost, StrctSignpostTrigger, StrctSkeleton, StrctSparkline, StrctSpeedDial, StrctSpinner, StrctSplitButton, StrctSplitter, StrctStack, StrctStackItem, StrctStatusDot, StrctStep, StrctStepAction, StrctSteps, StrctSubmenu, StrctTab, StrctTable, StrctTabs, StrctTag, StrctTagLeading, StrctThemeService, StrctThemeSwitcher, StrctTimeRangePicker, StrctTimeline, StrctTimelineItem, StrctToastOutlet, StrctToastService, StrctToggle, StrctToolbar, StrctToolbarCaption, StrctToolbarSpacer, StrctTooltip, StrctTour, StrctTransfer, StrctTree, StrctTreeNode, StrctTreeSelect, StrctVerticalNav, StrctWatermark, StrctWizard, StrctWizardAside, focusFirstIn, keepTabInside, lockBodyScroll, parseAnsi, provideStrctWizardDefaults, registerStrctIcon, restoreFocus, saveFocusedElement, strctComputeDiff, strctDpPad, strctFormatBytes, strctFormatDuration, strctFormatRate, strctFormatSi, strctValidationIcon, strctValidationTone, unlockBodyScroll };
|
|
24868
25181
|
//# sourceMappingURL=akcelik-strct.mjs.map
|