@ship-ui/core 0.22.10 → 0.22.11
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/assets/mcp/components.json +5001 -4
- package/bin/ship-fg-scanner +0 -0
- package/fesm2022/ship-ui-core-ship-list.mjs +2 -2
- package/fesm2022/ship-ui-core-ship-list.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-sortable.mjs +238 -5
- package/fesm2022/ship-ui-core-ship-sortable.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-tree.mjs +238 -0
- package/fesm2022/ship-ui-core-ship-tree.mjs.map +1 -0
- package/package.json +5 -1
- package/styles/index.scss +1 -1
- package/types/ship-ui-core-ship-sortable.d.ts +27 -3
- package/types/ship-ui-core-ship-tree.d.ts +67 -0
package/bin/ship-fg-scanner
CHANGED
|
Binary file
|
|
@@ -5,13 +5,13 @@ class ShipList {
|
|
|
5
5
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipList, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6
6
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.0", type: ShipList, isStandalone: true, selector: "sh-list", ngImport: i0, template: `
|
|
7
7
|
<ng-content />
|
|
8
|
-
`, isInline: true, styles: ["sh-list{--list-s: var(--shape-2);--list-active-bg: var(--base-1);--list-color: var(--base-9);--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid --list-active-bg;--list-p: 1.25rem 1rem;--list-item-p: .5rem .75rem;--list-item-gap: .5rem;width:100%;padding:var(--list-p);gap:.5rem;display:flex;flex-direction:column}sh-list.base-1{--list-active-bg: var(--base-1);--list-active-bs: var(--box-shadow-20)}sh-list.outlined{--list-active-bg: transparent;--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid var(--primary-8)}sh-list.type-b{--list-p: 0;--list-item-p: .625rem .75rem;--list-item-gap: .75rem;--list-s: var(--shape-2)}sh-list.type-b>[action],sh-list.type-b>[item]{color:var(--base-10)}sh-list.type-b>[action].active,sh-list.type-b>[action].selected,sh-list.type-b>[item].active,sh-list.type-b>[item].selected{background:rgb(from var(--base-3) r g b/90%);color:var(--base-12)}sh-list.type-b>[action].active sh-icon:first-child,sh-list.type-b>[action].selected sh-icon:first-child,sh-list.type-b>[item].active sh-icon:first-child,sh-list.type-b>[item].selected sh-icon:first-child{color:var(--primary-8)}sh-list.type-b>[action].active .description,sh-list.type-b>[action].selected .description,sh-list.type-b>[item].active .description,sh-list.type-b>[item].selected .description{color:var(--base-9)}sh-list.type-b>[action] sh-icon:first-child,sh-list.type-b>[item] sh-icon:first-child{font-size:1.125rem;color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .text-group,sh-list.type-b>[item] .text-group{display:flex;flex-direction:column;flex:1}sh-list.type-b>[action] .label,sh-list.type-b>[item] .label{font:var(--paragraph-30B)}sh-list.type-b>[action] .description,sh-list.type-b>[item] .description{font:var(--paragraph-40);color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .shortcut,sh-list.type-b>[item] .shortcut{display:flex;gap:.25rem}sh-list.type-b>[action] .shortcut kbd,sh-list.type-b>[item] .shortcut kbd{font-family:inherit;background:rgb(from var(--base-3) r g b/80%);border:1px solid rgb(from var(--base-4) r g b/60%);color:var(--base-8);border-radius:var(--shape-1);padding:.125rem .375rem;font-size:.6875rem;line-height:1;box-shadow:0 1px #0000001a}sh-list:empty{padding:0}sh-list>[title]{color:var(--base-8);margin:0 .75rem;font:var(--paragraph-30);line-height:1.5rem}sh-list[shsortable] [item]:active{transform:scale(1)}sh-list>[action],sh-list>[item]{border-radius:var(--list-s);padding:var(--list-item-p);font:var(--paragraph-30B);color:var(--list-color);border:var(--list-item-b);display:flex;align-items:center;gap:var(--list-item-gap);width:100%;-webkit-user-select:none;user-select:none;appearance:none;border:0;text-align:left;text-wrap:balance;background-color:transparent;text-decoration:none;transition:transform 125ms linear,box-shadow 125ms linear;transform:scale(1)}sh-list>[action]:active,sh-list>[item]:active{--list-active-bs: var(--box-shadow-10);transform:scale(.98)}sh-list>[action]:focus,sh-list>[item]:focus{outline:none}sh-list>[action]:focus-visible,sh-list>[item]:focus-visible{outline:2px solid var(--primary-8);outline-offset:2px}sh-list>[action] [suffix],sh-list>[item] [suffix]{margin-left:auto;color:var(--base-8)}sh-list :has(input),sh-list>[action]{cursor:pointer}sh-list>[item]:has(input:checked),sh-list>[action]:has(input:checked),sh-list>[action].active,sh-list>[action].selected{--list-color: var(--base-12);background-color:var(--list-active-bg);box-shadow:var(--list-active-bs);border:var(--list-item-active-b)}sh-list.primary>[item]:has(input:checked) sh-icon:first-child,sh-list.primary>[action]:has(input:checked) sh-icon:first-child,sh-list.primary>[action].active sh-icon:first-child,sh-list.primary>[action].selected sh-icon:first-child{color:var(--primary-8)}sh-list.accent>[item]:has(input:checked) sh-icon:first-child,sh-list.accent>[action]:has(input:checked) sh-icon:first-child,sh-list.accent>[action].active sh-icon:first-child,sh-list.accent>[action].selected sh-icon:first-child{color:var(--accent-8)}sh-list.warn>[item]:has(input:checked) sh-icon:first-child,sh-list.warn>[action]:has(input:checked) sh-icon:first-child,sh-list.warn>[action].active sh-icon:first-child,sh-list.warn>[action].selected sh-icon:first-child{color:var(--warn-8)}sh-list.error>[item]:has(input:checked) sh-icon:first-child,sh-list.error>[action]:has(input:checked) sh-icon:first-child,sh-list.error>[action].active sh-icon:first-child,sh-list.error>[action].selected sh-icon:first-child{color:var(--error-8)}sh-list.success>[item]:has(input:checked) sh-icon:first-child,sh-list.success>[action]:has(input:checked) sh-icon:first-child,sh-list.success>[action].active sh-icon:first-child,sh-list.success>[action].selected sh-icon:first-child{color:var(--success-8)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
8
|
+
`, isInline: true, styles: [".sh-sortable{position:relative}.sh-sortable.dragging [draggable],.sh-sortable.dragging .sortable-ghost{cursor:grabbing;transition:transform 40ms linear}.sh-sortable [draggable]{transform:translate(0);transition:none;z-index:2;-webkit-user-select:none;user-select:none}.sh-sortable:not(.sh-sortable-tree) [draggable]{background:var(--base-1)}.sh-sortable:not(.sh-sortable-tree) [draggable]:not(:has([sort-handle])){cursor:grab}.sh-sortable .sortable-ghost{opacity:.5;z-index:10}.sh-sortable.item-dragged-out .sortable-ghost{display:none}.sh-sortable [sort-handle]{cursor:grab}.sh-sortable.sh-sortable-tree [draggable]{transform:none!important;transition:none!important}.sh-sortable.sh-sortable-tree .drop-inside{background:var(--primary-3)!important;outline:2px solid var(--primary-8)!important;outline-offset:-2px;border-radius:var(--shape-1, 4px)}.sh-sortable.sh-sortable-tree .drop-inside .node-icon,.sh-sortable.sh-sortable-tree .drop-inside sh-tree-node .sh-tree-node-left sh-icon{color:var(--primary-8)!important}.sh-sortable.sh-sortable-tree .drop-before{position:relative;z-index:20}.sh-sortable.sh-sortable-tree .drop-before:before{content:\"\";position:absolute;top:-2px;left:calc(var(--tree-padding-left, 12px) + var(--tree-depth, 0) * var(--tree-indent-step, 12px));right:var(--tree-padding-right, 6px);height:6px;background-image:radial-gradient(circle at 3px 3px,var(--primary-8) 3px,transparent 3px),linear-gradient(to right,var(--primary-8),var(--primary-8));background-repeat:no-repeat,no-repeat;background-position:left center,6px center;background-size:6px 6px,100% 2px;z-index:10;pointer-events:none}.sh-sortable.sh-sortable-tree .drop-after{position:relative;z-index:20}.sh-sortable.sh-sortable-tree .drop-after:after{content:\"\";position:absolute;bottom:-2px;left:calc(var(--tree-padding-left, 12px) + var(--tree-depth, 0) * var(--tree-indent-step, 12px));right:var(--tree-padding-right, 6px);height:6px;background-image:radial-gradient(circle at 3px 3px,var(--primary-8) 3px,transparent 3px),linear-gradient(to right,var(--primary-8),var(--primary-8));background-repeat:no-repeat,no-repeat;background-position:left center,6px center;background-size:6px 6px,100% 2px;z-index:10;pointer-events:none}sh-list{--list-s: var(--shape-2);--list-active-bg: var(--base-1);--list-color: var(--base-9);--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid --list-active-bg;--list-p: 1.25rem 1rem;--list-item-p: .5rem .75rem;--list-item-gap: .5rem;width:100%;padding:var(--list-p);gap:.5rem;display:flex;flex-direction:column}sh-list.base-1{--list-active-bg: var(--base-1);--list-active-bs: var(--box-shadow-20)}sh-list.outlined{--list-active-bg: transparent;--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid var(--primary-8)}sh-list.type-b{--list-p: 0;--list-item-p: .625rem .75rem;--list-item-gap: .75rem;--list-s: var(--shape-2)}sh-list.type-b>[action],sh-list.type-b>[item]{color:var(--base-10)}sh-list.type-b>[action].active,sh-list.type-b>[action].selected,sh-list.type-b>[item].active,sh-list.type-b>[item].selected{background:rgb(from var(--base-3) r g b/90%);color:var(--base-12)}sh-list.type-b>[action].active sh-icon:first-child,sh-list.type-b>[action].selected sh-icon:first-child,sh-list.type-b>[item].active sh-icon:first-child,sh-list.type-b>[item].selected sh-icon:first-child{color:var(--primary-8)}sh-list.type-b>[action].active .description,sh-list.type-b>[action].selected .description,sh-list.type-b>[item].active .description,sh-list.type-b>[item].selected .description{color:var(--base-9)}sh-list.type-b>[action] sh-icon:first-child,sh-list.type-b>[item] sh-icon:first-child{font-size:1.125rem;color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .text-group,sh-list.type-b>[item] .text-group{display:flex;flex-direction:column;flex:1}sh-list.type-b>[action] .label,sh-list.type-b>[item] .label{font:var(--paragraph-30B)}sh-list.type-b>[action] .description,sh-list.type-b>[item] .description{font:var(--paragraph-40);color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .shortcut,sh-list.type-b>[item] .shortcut{display:flex;gap:.25rem}sh-list.type-b>[action] .shortcut kbd,sh-list.type-b>[item] .shortcut kbd{font-family:inherit;background:rgb(from var(--base-3) r g b/80%);border:1px solid rgb(from var(--base-4) r g b/60%);color:var(--base-8);border-radius:var(--shape-1);padding:.125rem .375rem;font-size:.6875rem;line-height:1;box-shadow:0 1px #0000001a}sh-list:empty{padding:0}sh-list>[title]{color:var(--base-8);margin:0 .75rem;font:var(--paragraph-30);line-height:1.5rem}sh-list[shsortable] [item]:active{transform:scale(1)}sh-list>[action],sh-list>[item]{border-radius:var(--list-s);padding:var(--list-item-p);font:var(--paragraph-30B);color:var(--list-color);border:var(--list-item-b);display:flex;align-items:center;gap:var(--list-item-gap);width:100%;-webkit-user-select:none;user-select:none;appearance:none;border:0;text-align:left;text-wrap:balance;background-color:transparent;text-decoration:none;transition:transform 125ms linear,box-shadow 125ms linear;transform:scale(1)}sh-list>[action]:active,sh-list>[item]:active{--list-active-bs: var(--box-shadow-10);transform:scale(.98)}sh-list>[action]:focus,sh-list>[item]:focus{outline:none}sh-list>[action]:focus-visible,sh-list>[item]:focus-visible{outline:2px solid var(--primary-8);outline-offset:2px}sh-list>[action] [suffix],sh-list>[item] [suffix]{margin-left:auto;color:var(--base-8)}sh-list :has(input),sh-list>[action]{cursor:pointer}sh-list>[item]:has(input:checked),sh-list>[action]:has(input:checked),sh-list>[action].active,sh-list>[action].selected{--list-color: var(--base-12);background-color:var(--list-active-bg);box-shadow:var(--list-active-bs);border:var(--list-item-active-b)}sh-list.primary>[item]:has(input:checked) sh-icon:first-child,sh-list.primary>[action]:has(input:checked) sh-icon:first-child,sh-list.primary>[action].active sh-icon:first-child,sh-list.primary>[action].selected sh-icon:first-child{color:var(--primary-8)}sh-list.accent>[item]:has(input:checked) sh-icon:first-child,sh-list.accent>[action]:has(input:checked) sh-icon:first-child,sh-list.accent>[action].active sh-icon:first-child,sh-list.accent>[action].selected sh-icon:first-child{color:var(--accent-8)}sh-list.warn>[item]:has(input:checked) sh-icon:first-child,sh-list.warn>[action]:has(input:checked) sh-icon:first-child,sh-list.warn>[action].active sh-icon:first-child,sh-list.warn>[action].selected sh-icon:first-child{color:var(--warn-8)}sh-list.error>[item]:has(input:checked) sh-icon:first-child,sh-list.error>[action]:has(input:checked) sh-icon:first-child,sh-list.error>[action].active sh-icon:first-child,sh-list.error>[action].selected sh-icon:first-child{color:var(--error-8)}sh-list.success>[item]:has(input:checked) sh-icon:first-child,sh-list.success>[action]:has(input:checked) sh-icon:first-child,sh-list.success>[action].active sh-icon:first-child,sh-list.success>[action].selected sh-icon:first-child{color:var(--success-8)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
9
9
|
}
|
|
10
10
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipList, decorators: [{
|
|
11
11
|
type: Component,
|
|
12
12
|
args: [{ selector: 'sh-list', encapsulation: ViewEncapsulation.None, imports: [], template: `
|
|
13
13
|
<ng-content />
|
|
14
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["sh-list{--list-s: var(--shape-2);--list-active-bg: var(--base-1);--list-color: var(--base-9);--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid --list-active-bg;--list-p: 1.25rem 1rem;--list-item-p: .5rem .75rem;--list-item-gap: .5rem;width:100%;padding:var(--list-p);gap:.5rem;display:flex;flex-direction:column}sh-list.base-1{--list-active-bg: var(--base-1);--list-active-bs: var(--box-shadow-20)}sh-list.outlined{--list-active-bg: transparent;--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid var(--primary-8)}sh-list.type-b{--list-p: 0;--list-item-p: .625rem .75rem;--list-item-gap: .75rem;--list-s: var(--shape-2)}sh-list.type-b>[action],sh-list.type-b>[item]{color:var(--base-10)}sh-list.type-b>[action].active,sh-list.type-b>[action].selected,sh-list.type-b>[item].active,sh-list.type-b>[item].selected{background:rgb(from var(--base-3) r g b/90%);color:var(--base-12)}sh-list.type-b>[action].active sh-icon:first-child,sh-list.type-b>[action].selected sh-icon:first-child,sh-list.type-b>[item].active sh-icon:first-child,sh-list.type-b>[item].selected sh-icon:first-child{color:var(--primary-8)}sh-list.type-b>[action].active .description,sh-list.type-b>[action].selected .description,sh-list.type-b>[item].active .description,sh-list.type-b>[item].selected .description{color:var(--base-9)}sh-list.type-b>[action] sh-icon:first-child,sh-list.type-b>[item] sh-icon:first-child{font-size:1.125rem;color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .text-group,sh-list.type-b>[item] .text-group{display:flex;flex-direction:column;flex:1}sh-list.type-b>[action] .label,sh-list.type-b>[item] .label{font:var(--paragraph-30B)}sh-list.type-b>[action] .description,sh-list.type-b>[item] .description{font:var(--paragraph-40);color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .shortcut,sh-list.type-b>[item] .shortcut{display:flex;gap:.25rem}sh-list.type-b>[action] .shortcut kbd,sh-list.type-b>[item] .shortcut kbd{font-family:inherit;background:rgb(from var(--base-3) r g b/80%);border:1px solid rgb(from var(--base-4) r g b/60%);color:var(--base-8);border-radius:var(--shape-1);padding:.125rem .375rem;font-size:.6875rem;line-height:1;box-shadow:0 1px #0000001a}sh-list:empty{padding:0}sh-list>[title]{color:var(--base-8);margin:0 .75rem;font:var(--paragraph-30);line-height:1.5rem}sh-list[shsortable] [item]:active{transform:scale(1)}sh-list>[action],sh-list>[item]{border-radius:var(--list-s);padding:var(--list-item-p);font:var(--paragraph-30B);color:var(--list-color);border:var(--list-item-b);display:flex;align-items:center;gap:var(--list-item-gap);width:100%;-webkit-user-select:none;user-select:none;appearance:none;border:0;text-align:left;text-wrap:balance;background-color:transparent;text-decoration:none;transition:transform 125ms linear,box-shadow 125ms linear;transform:scale(1)}sh-list>[action]:active,sh-list>[item]:active{--list-active-bs: var(--box-shadow-10);transform:scale(.98)}sh-list>[action]:focus,sh-list>[item]:focus{outline:none}sh-list>[action]:focus-visible,sh-list>[item]:focus-visible{outline:2px solid var(--primary-8);outline-offset:2px}sh-list>[action] [suffix],sh-list>[item] [suffix]{margin-left:auto;color:var(--base-8)}sh-list :has(input),sh-list>[action]{cursor:pointer}sh-list>[item]:has(input:checked),sh-list>[action]:has(input:checked),sh-list>[action].active,sh-list>[action].selected{--list-color: var(--base-12);background-color:var(--list-active-bg);box-shadow:var(--list-active-bs);border:var(--list-item-active-b)}sh-list.primary>[item]:has(input:checked) sh-icon:first-child,sh-list.primary>[action]:has(input:checked) sh-icon:first-child,sh-list.primary>[action].active sh-icon:first-child,sh-list.primary>[action].selected sh-icon:first-child{color:var(--primary-8)}sh-list.accent>[item]:has(input:checked) sh-icon:first-child,sh-list.accent>[action]:has(input:checked) sh-icon:first-child,sh-list.accent>[action].active sh-icon:first-child,sh-list.accent>[action].selected sh-icon:first-child{color:var(--accent-8)}sh-list.warn>[item]:has(input:checked) sh-icon:first-child,sh-list.warn>[action]:has(input:checked) sh-icon:first-child,sh-list.warn>[action].active sh-icon:first-child,sh-list.warn>[action].selected sh-icon:first-child{color:var(--warn-8)}sh-list.error>[item]:has(input:checked) sh-icon:first-child,sh-list.error>[action]:has(input:checked) sh-icon:first-child,sh-list.error>[action].active sh-icon:first-child,sh-list.error>[action].selected sh-icon:first-child{color:var(--error-8)}sh-list.success>[item]:has(input:checked) sh-icon:first-child,sh-list.success>[action]:has(input:checked) sh-icon:first-child,sh-list.success>[action].active sh-icon:first-child,sh-list.success>[action].selected sh-icon:first-child{color:var(--success-8)}\n"] }]
|
|
14
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".sh-sortable{position:relative}.sh-sortable.dragging [draggable],.sh-sortable.dragging .sortable-ghost{cursor:grabbing;transition:transform 40ms linear}.sh-sortable [draggable]{transform:translate(0);transition:none;z-index:2;-webkit-user-select:none;user-select:none}.sh-sortable:not(.sh-sortable-tree) [draggable]{background:var(--base-1)}.sh-sortable:not(.sh-sortable-tree) [draggable]:not(:has([sort-handle])){cursor:grab}.sh-sortable .sortable-ghost{opacity:.5;z-index:10}.sh-sortable.item-dragged-out .sortable-ghost{display:none}.sh-sortable [sort-handle]{cursor:grab}.sh-sortable.sh-sortable-tree [draggable]{transform:none!important;transition:none!important}.sh-sortable.sh-sortable-tree .drop-inside{background:var(--primary-3)!important;outline:2px solid var(--primary-8)!important;outline-offset:-2px;border-radius:var(--shape-1, 4px)}.sh-sortable.sh-sortable-tree .drop-inside .node-icon,.sh-sortable.sh-sortable-tree .drop-inside sh-tree-node .sh-tree-node-left sh-icon{color:var(--primary-8)!important}.sh-sortable.sh-sortable-tree .drop-before{position:relative;z-index:20}.sh-sortable.sh-sortable-tree .drop-before:before{content:\"\";position:absolute;top:-2px;left:calc(var(--tree-padding-left, 12px) + var(--tree-depth, 0) * var(--tree-indent-step, 12px));right:var(--tree-padding-right, 6px);height:6px;background-image:radial-gradient(circle at 3px 3px,var(--primary-8) 3px,transparent 3px),linear-gradient(to right,var(--primary-8),var(--primary-8));background-repeat:no-repeat,no-repeat;background-position:left center,6px center;background-size:6px 6px,100% 2px;z-index:10;pointer-events:none}.sh-sortable.sh-sortable-tree .drop-after{position:relative;z-index:20}.sh-sortable.sh-sortable-tree .drop-after:after{content:\"\";position:absolute;bottom:-2px;left:calc(var(--tree-padding-left, 12px) + var(--tree-depth, 0) * var(--tree-indent-step, 12px));right:var(--tree-padding-right, 6px);height:6px;background-image:radial-gradient(circle at 3px 3px,var(--primary-8) 3px,transparent 3px),linear-gradient(to right,var(--primary-8),var(--primary-8));background-repeat:no-repeat,no-repeat;background-position:left center,6px center;background-size:6px 6px,100% 2px;z-index:10;pointer-events:none}sh-list{--list-s: var(--shape-2);--list-active-bg: var(--base-1);--list-color: var(--base-9);--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid --list-active-bg;--list-p: 1.25rem 1rem;--list-item-p: .5rem .75rem;--list-item-gap: .5rem;width:100%;padding:var(--list-p);gap:.5rem;display:flex;flex-direction:column}sh-list.base-1{--list-active-bg: var(--base-1);--list-active-bs: var(--box-shadow-20)}sh-list.outlined{--list-active-bg: transparent;--list-active-bs: none;--list-item-b: 1px solid transparent;--list-item-active-b: 1px solid var(--primary-8)}sh-list.type-b{--list-p: 0;--list-item-p: .625rem .75rem;--list-item-gap: .75rem;--list-s: var(--shape-2)}sh-list.type-b>[action],sh-list.type-b>[item]{color:var(--base-10)}sh-list.type-b>[action].active,sh-list.type-b>[action].selected,sh-list.type-b>[item].active,sh-list.type-b>[item].selected{background:rgb(from var(--base-3) r g b/90%);color:var(--base-12)}sh-list.type-b>[action].active sh-icon:first-child,sh-list.type-b>[action].selected sh-icon:first-child,sh-list.type-b>[item].active sh-icon:first-child,sh-list.type-b>[item].selected sh-icon:first-child{color:var(--primary-8)}sh-list.type-b>[action].active .description,sh-list.type-b>[action].selected .description,sh-list.type-b>[item].active .description,sh-list.type-b>[item].selected .description{color:var(--base-9)}sh-list.type-b>[action] sh-icon:first-child,sh-list.type-b>[item] sh-icon:first-child{font-size:1.125rem;color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .text-group,sh-list.type-b>[item] .text-group{display:flex;flex-direction:column;flex:1}sh-list.type-b>[action] .label,sh-list.type-b>[item] .label{font:var(--paragraph-30B)}sh-list.type-b>[action] .description,sh-list.type-b>[item] .description{font:var(--paragraph-40);color:var(--base-7);transition:color .15s ease}sh-list.type-b>[action] .shortcut,sh-list.type-b>[item] .shortcut{display:flex;gap:.25rem}sh-list.type-b>[action] .shortcut kbd,sh-list.type-b>[item] .shortcut kbd{font-family:inherit;background:rgb(from var(--base-3) r g b/80%);border:1px solid rgb(from var(--base-4) r g b/60%);color:var(--base-8);border-radius:var(--shape-1);padding:.125rem .375rem;font-size:.6875rem;line-height:1;box-shadow:0 1px #0000001a}sh-list:empty{padding:0}sh-list>[title]{color:var(--base-8);margin:0 .75rem;font:var(--paragraph-30);line-height:1.5rem}sh-list[shsortable] [item]:active{transform:scale(1)}sh-list>[action],sh-list>[item]{border-radius:var(--list-s);padding:var(--list-item-p);font:var(--paragraph-30B);color:var(--list-color);border:var(--list-item-b);display:flex;align-items:center;gap:var(--list-item-gap);width:100%;-webkit-user-select:none;user-select:none;appearance:none;border:0;text-align:left;text-wrap:balance;background-color:transparent;text-decoration:none;transition:transform 125ms linear,box-shadow 125ms linear;transform:scale(1)}sh-list>[action]:active,sh-list>[item]:active{--list-active-bs: var(--box-shadow-10);transform:scale(.98)}sh-list>[action]:focus,sh-list>[item]:focus{outline:none}sh-list>[action]:focus-visible,sh-list>[item]:focus-visible{outline:2px solid var(--primary-8);outline-offset:2px}sh-list>[action] [suffix],sh-list>[item] [suffix]{margin-left:auto;color:var(--base-8)}sh-list :has(input),sh-list>[action]{cursor:pointer}sh-list>[item]:has(input:checked),sh-list>[action]:has(input:checked),sh-list>[action].active,sh-list>[action].selected{--list-color: var(--base-12);background-color:var(--list-active-bg);box-shadow:var(--list-active-bs);border:var(--list-item-active-b)}sh-list.primary>[item]:has(input:checked) sh-icon:first-child,sh-list.primary>[action]:has(input:checked) sh-icon:first-child,sh-list.primary>[action].active sh-icon:first-child,sh-list.primary>[action].selected sh-icon:first-child{color:var(--primary-8)}sh-list.accent>[item]:has(input:checked) sh-icon:first-child,sh-list.accent>[action]:has(input:checked) sh-icon:first-child,sh-list.accent>[action].active sh-icon:first-child,sh-list.accent>[action].selected sh-icon:first-child{color:var(--accent-8)}sh-list.warn>[item]:has(input:checked) sh-icon:first-child,sh-list.warn>[action]:has(input:checked) sh-icon:first-child,sh-list.warn>[action].active sh-icon:first-child,sh-list.warn>[action].selected sh-icon:first-child{color:var(--warn-8)}sh-list.error>[item]:has(input:checked) sh-icon:first-child,sh-list.error>[action]:has(input:checked) sh-icon:first-child,sh-list.error>[action].active sh-icon:first-child,sh-list.error>[action].selected sh-icon:first-child{color:var(--error-8)}sh-list.success>[item]:has(input:checked) sh-icon:first-child,sh-list.success>[action]:has(input:checked) sh-icon:first-child,sh-list.success>[action].active sh-icon:first-child,sh-list.success>[action].selected sh-icon:first-child{color:var(--success-8)}\n"] }]
|
|
15
15
|
}] });
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-ui-core-ship-list.mjs","sources":["../../../projects/ship-ui/ship-list/ship-list.ts","../../../projects/ship-ui/ship-list/ship-ui-core-ship-list.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'sh-list',\n styleUrl: './ship-list.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [],\n template: `\n <ng-content />\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ShipList {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAYa,QAAQ,CAAA;8GAAR,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAR,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAQ,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EALT;;AAET,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"ship-ui-core-ship-list.mjs","sources":["../../../projects/ship-ui/ship-list/ship-list.ts","../../../projects/ship-ui/ship-list/ship-ui-core-ship-list.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'sh-list',\n styleUrl: './ship-list.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [],\n template: `\n <ng-content />\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ShipList {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAYa,QAAQ,CAAA;8GAAR,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAR,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAQ,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EALT;;AAET,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,o5NAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FAGU,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAVpB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,SAAS,iBAEJ,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,EAAE,EAAA,QAAA,EACD;;GAET,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,o5NAAA,CAAA,EAAA;;;ACVjD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, DOCUMENT, ElementRef, Renderer2, signal, input, output, effect, HostListener, Directive } from '@angular/core';
|
|
2
|
+
import { inject, DOCUMENT, ElementRef, Renderer2, signal, input, model, output, effect, HostListener, Directive, computed } from '@angular/core';
|
|
3
3
|
import { isObservable, firstValueFrom } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
var _a;
|
|
@@ -75,13 +75,22 @@ class ShipSortable {
|
|
|
75
75
|
...(ngDevMode ? [undefined, { debugName: "shSortable" }] : /* istanbul ignore next */ []));
|
|
76
76
|
this.sortableGroup = input(/* @ts-ignore */
|
|
77
77
|
...(ngDevMode ? [undefined, { debugName: "sortableGroup" }] : /* istanbul ignore next */ []));
|
|
78
|
+
this.sortingMode = input('list', /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "sortingMode" }] : /* istanbul ignore next */ []));
|
|
80
|
+
this.treeItems = model([], /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "treeItems" }] : /* istanbul ignore next */ []));
|
|
78
82
|
this.sortDrop = output();
|
|
79
83
|
this.afterDrop = output();
|
|
80
84
|
this.crossDrop = output();
|
|
85
|
+
this.treeDrop = output();
|
|
81
86
|
this.dragStartIndex = signal(-1, /* @ts-ignore */
|
|
82
87
|
...(ngDevMode ? [{ debugName: "dragStartIndex" }] : /* istanbul ignore next */ []));
|
|
83
88
|
this.dragToIndex = signal(-1, /* @ts-ignore */
|
|
84
89
|
...(ngDevMode ? [{ debugName: "dragToIndex" }] : /* istanbul ignore next */ []));
|
|
90
|
+
this.treeHoverIndex = signal(-1, /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "treeHoverIndex" }] : /* istanbul ignore next */ []));
|
|
92
|
+
this.treeHoverPosition = signal(null, /* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [{ debugName: "treeHoverPosition" }] : /* istanbul ignore next */ []));
|
|
85
94
|
this.initialPositions = signal([], /* @ts-ignore */
|
|
86
95
|
...(ngDevMode ? [{ debugName: "initialPositions" }] : /* istanbul ignore next */ []));
|
|
87
96
|
this.dragables = signal([], /* @ts-ignore */
|
|
@@ -90,6 +99,9 @@ class ShipSortable {
|
|
|
90
99
|
this.isDropping = false;
|
|
91
100
|
this.isCrossTarget = false;
|
|
92
101
|
this.draggingEffect = effect(() => {
|
|
102
|
+
if (this.sortingMode() === 'tree') {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
93
105
|
const currentDragPosIndex = this.dragToIndex();
|
|
94
106
|
const startIndex = this.dragStartIndex();
|
|
95
107
|
const dragables = this.dragables();
|
|
@@ -217,7 +229,22 @@ class ShipSortable {
|
|
|
217
229
|
const rect = draggedElement.getBoundingClientRect();
|
|
218
230
|
const dragOffsetX = Math.max(0, e.clientX - rect.left);
|
|
219
231
|
const dragOffsetY = Math.max(0, e.clientY - rect.top);
|
|
220
|
-
|
|
232
|
+
if (this.sortingMode() === 'tree') {
|
|
233
|
+
const clone = draggedElement.cloneNode(true);
|
|
234
|
+
clone.querySelector('.node-icon')?.remove();
|
|
235
|
+
clone.querySelector('.caret-container')?.remove();
|
|
236
|
+
clone.style.opacity = '0.8';
|
|
237
|
+
clone.style.width = `${rect.width}px`;
|
|
238
|
+
clone.style.position = 'absolute';
|
|
239
|
+
clone.style.top = '-9999px';
|
|
240
|
+
clone.style.left = '-9999px';
|
|
241
|
+
this.#document.body.appendChild(clone);
|
|
242
|
+
e.dataTransfer.setDragImage(clone, -12, -30);
|
|
243
|
+
setTimeout(() => this.#document.body.removeChild(clone), 0);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
e.dataTransfer.setDragImage(draggedElement, dragOffsetX, dragOffsetY);
|
|
247
|
+
}
|
|
221
248
|
const draggedElementIndex = this.getIndexOfElement(draggedElement);
|
|
222
249
|
this.dragStartIndex.set(draggedElementIndex);
|
|
223
250
|
this.dragToIndex.set(draggedElementIndex);
|
|
@@ -305,6 +332,56 @@ class ShipSortable {
|
|
|
305
332
|
e.dataTransfer.dropEffect = 'move';
|
|
306
333
|
if (_a.activeTarget !== this)
|
|
307
334
|
return;
|
|
335
|
+
if (this.sortingMode() === 'tree') {
|
|
336
|
+
const targetElement = e.target;
|
|
337
|
+
const hoveredDraggable = targetElement.closest('[draggable]');
|
|
338
|
+
if (hoveredDraggable && this.#selfEl.nativeElement.contains(hoveredDraggable)) {
|
|
339
|
+
const targetIdx = this.getIndexOfElement(hoveredDraggable);
|
|
340
|
+
if (targetIdx !== -1) {
|
|
341
|
+
const rect = hoveredDraggable.getBoundingClientRect();
|
|
342
|
+
const relativeY = (e.clientY - rect.top) / rect.height;
|
|
343
|
+
const isFolder = hoveredDraggable.hasAttribute('sortable-folder') ||
|
|
344
|
+
hoveredDraggable.getAttribute('sortable-folder') === 'true' ||
|
|
345
|
+
hoveredDraggable.hasAttribute('sortable-dir') ||
|
|
346
|
+
hoveredDraggable.getAttribute('sortable-dir') === 'true';
|
|
347
|
+
let position;
|
|
348
|
+
if (isFolder) {
|
|
349
|
+
if (relativeY < 0.25) {
|
|
350
|
+
position = 'before';
|
|
351
|
+
}
|
|
352
|
+
else if (relativeY > 0.75) {
|
|
353
|
+
position = 'after';
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
position = 'inside';
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
if (relativeY < 0.5) {
|
|
361
|
+
position = 'before';
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
position = 'after';
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (this.treeHoverIndex() !== targetIdx || this.treeHoverPosition() !== position) {
|
|
368
|
+
this.#clearTreeHoverClasses();
|
|
369
|
+
this.treeHoverIndex.set(targetIdx);
|
|
370
|
+
this.treeHoverPosition.set(position);
|
|
371
|
+
this.#renderer.addClass(hoveredDraggable, `drop-${position}`);
|
|
372
|
+
}
|
|
373
|
+
if (this.dragToIndex() !== targetIdx) {
|
|
374
|
+
this.dragToIndex.set(targetIdx);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
this.#clearTreeHoverClasses();
|
|
380
|
+
this.treeHoverIndex.set(-1);
|
|
381
|
+
this.treeHoverPosition.set(null);
|
|
382
|
+
}
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
308
385
|
const container = this.#selfEl.nativeElement;
|
|
309
386
|
const containerRect = container.getBoundingClientRect();
|
|
310
387
|
// Convert viewport coordinates to container-relative coordinate space
|
|
@@ -327,6 +404,14 @@ class ShipSortable {
|
|
|
327
404
|
this.dragToIndex.set(closestSlotIndex);
|
|
328
405
|
}
|
|
329
406
|
}
|
|
407
|
+
#clearTreeHoverClasses() {
|
|
408
|
+
const dragables = this.dragables();
|
|
409
|
+
for (const el of dragables) {
|
|
410
|
+
this.#renderer.removeClass(el, 'drop-before');
|
|
411
|
+
this.#renderer.removeClass(el, 'drop-after');
|
|
412
|
+
this.#renderer.removeClass(el, 'drop-inside');
|
|
413
|
+
}
|
|
414
|
+
}
|
|
330
415
|
getVisualIndexOfElement(i) {
|
|
331
416
|
const startIndex = this.dragStartIndex();
|
|
332
417
|
const currentDragPosIndex = this.dragToIndex();
|
|
@@ -352,6 +437,34 @@ class ShipSortable {
|
|
|
352
437
|
// Immediately kill drag transitions before any signal updates
|
|
353
438
|
this.#renderer.removeClass(_a.activeSource.#selfEl.nativeElement, 'dragging');
|
|
354
439
|
this.#renderer.removeClass(this.#selfEl.nativeElement, 'dragging');
|
|
440
|
+
if (this.sortingMode() === 'tree') {
|
|
441
|
+
this.isDropping = true;
|
|
442
|
+
if (_a.activeSource !== this) {
|
|
443
|
+
_a.activeSource.isDropping = true;
|
|
444
|
+
}
|
|
445
|
+
const prevIdx = _a.activeSource.dragStartIndex();
|
|
446
|
+
const currIdx = this.dragToIndex();
|
|
447
|
+
const pos = this.treeHoverPosition();
|
|
448
|
+
if (prevIdx !== -1 && currIdx !== -1 && pos) {
|
|
449
|
+
const event = {
|
|
450
|
+
previousIndex: prevIdx,
|
|
451
|
+
currentIndex: currIdx,
|
|
452
|
+
position: pos,
|
|
453
|
+
};
|
|
454
|
+
const manager = this.shSortable();
|
|
455
|
+
if (manager && typeof manager.drop === 'function') {
|
|
456
|
+
manager.drop(event, this.treeItems());
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.treeDrop.emit(event);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
this.#cleanupDragState();
|
|
463
|
+
if (_a.activeSource !== this) {
|
|
464
|
+
_a.activeSource.#cleanupDragState();
|
|
465
|
+
}
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
355
468
|
if (_a.activeSource === this) {
|
|
356
469
|
// Internal Drop
|
|
357
470
|
if (this.dragStartIndex() !== -1 && this.dragToIndex() !== -1 && this.dragStartIndex() !== this.dragToIndex()) {
|
|
@@ -417,8 +530,11 @@ class ShipSortable {
|
|
|
417
530
|
this.#crossSpacerEl.set(null);
|
|
418
531
|
}
|
|
419
532
|
this.#resetStyles();
|
|
533
|
+
this.#clearTreeHoverClasses();
|
|
420
534
|
this.dragStartIndex.set(-1);
|
|
421
535
|
this.dragToIndex.set(-1);
|
|
536
|
+
this.treeHoverIndex.set(-1);
|
|
537
|
+
this.treeHoverPosition.set(null);
|
|
422
538
|
this.isCrossTarget = false;
|
|
423
539
|
}
|
|
424
540
|
#resetStyles() {
|
|
@@ -426,6 +542,9 @@ class ShipSortable {
|
|
|
426
542
|
for (const el of dragables) {
|
|
427
543
|
this.#renderer.setStyle(el, 'transform', '');
|
|
428
544
|
this.#renderer.removeClass(el, 'sortable-ghost');
|
|
545
|
+
this.#renderer.removeClass(el, 'drop-before');
|
|
546
|
+
this.#renderer.removeClass(el, 'drop-after');
|
|
547
|
+
this.#renderer.removeClass(el, 'drop-inside');
|
|
429
548
|
}
|
|
430
549
|
}
|
|
431
550
|
#dragableObserver;
|
|
@@ -434,7 +553,7 @@ class ShipSortable {
|
|
|
434
553
|
this.abortController?.abort();
|
|
435
554
|
}
|
|
436
555
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipSortable, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
437
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.0", type: ShipSortable, isStandalone: true, selector: "[shSortable]", inputs: { shSortable: { classPropertyName: "shSortable", publicName: "shSortable", isSignal: true, isRequired: false, transformFunction: null }, sortableGroup: { classPropertyName: "sortableGroup", publicName: "sortableGroup", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sortDrop: "sortDrop", afterDrop: "afterDrop", crossDrop: "crossDrop" }, host: { listeners: { "dragenter": "dragEnter($event)", "dragleave": "dragLeave($event)", "dragover": "dragOver($event)", "drop": "drop()" }, classAttribute: "sh-sortable" }, ngImport: i0 }); }
|
|
556
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.0", type: ShipSortable, isStandalone: true, selector: "[shSortable]", inputs: { shSortable: { classPropertyName: "shSortable", publicName: "shSortable", isSignal: true, isRequired: false, transformFunction: null }, sortableGroup: { classPropertyName: "sortableGroup", publicName: "sortableGroup", isSignal: true, isRequired: false, transformFunction: null }, sortingMode: { classPropertyName: "sortingMode", publicName: "sortingMode", isSignal: true, isRequired: false, transformFunction: null }, treeItems: { classPropertyName: "treeItems", publicName: "treeItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { treeItems: "treeItemsChange", sortDrop: "sortDrop", afterDrop: "afterDrop", crossDrop: "crossDrop", treeDrop: "treeDrop" }, host: { listeners: { "dragenter": "dragEnter($event)", "dragleave": "dragLeave($event)", "dragover": "dragOver($event)", "drop": "drop()" }, properties: { "class.sh-sortable-tree": "sortingMode() === 'tree'" }, classAttribute: "sh-sortable" }, ngImport: i0 }); }
|
|
438
557
|
}
|
|
439
558
|
_a = ShipSortable;
|
|
440
559
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipSortable, decorators: [{
|
|
@@ -444,9 +563,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
|
|
|
444
563
|
standalone: true,
|
|
445
564
|
host: {
|
|
446
565
|
class: 'sh-sortable',
|
|
566
|
+
'[class.sh-sortable-tree]': "sortingMode() === 'tree'",
|
|
447
567
|
},
|
|
448
568
|
}]
|
|
449
|
-
}], propDecorators: { shSortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "shSortable", required: false }] }], sortableGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortableGroup", required: false }] }], sortDrop: [{ type: i0.Output, args: ["sortDrop"] }], afterDrop: [{ type: i0.Output, args: ["afterDrop"] }], crossDrop: [{ type: i0.Output, args: ["crossDrop"] }], dragEnter: [{
|
|
569
|
+
}], propDecorators: { shSortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "shSortable", required: false }] }], sortableGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortableGroup", required: false }] }], sortingMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortingMode", required: false }] }], treeItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "treeItems", required: false }] }, { type: i0.Output, args: ["treeItemsChange"] }], sortDrop: [{ type: i0.Output, args: ["sortDrop"] }], afterDrop: [{ type: i0.Output, args: ["afterDrop"] }], crossDrop: [{ type: i0.Output, args: ["crossDrop"] }], treeDrop: [{ type: i0.Output, args: ["treeDrop"] }], dragEnter: [{
|
|
450
570
|
type: HostListener,
|
|
451
571
|
args: ['dragenter', ['$event']]
|
|
452
572
|
}], dragLeave: [{
|
|
@@ -476,10 +596,123 @@ function transferArrayItem(currentArray, targetArray, currentIndex, targetIndex)
|
|
|
476
596
|
targetArray.splice(targetIndex, 0, item);
|
|
477
597
|
}
|
|
478
598
|
}
|
|
599
|
+
function createTreeSortableManager(nodesSignal, config) {
|
|
600
|
+
const getId = config?.getId || ((item) => item.id);
|
|
601
|
+
const getParentId = config?.getParentId || ((item) => item.parentId);
|
|
602
|
+
const setParentId = config?.setParentId || ((item, pid) => (item.parentId = pid));
|
|
603
|
+
const isFolder = config?.isFolder || ((item) => item.type === 'dir');
|
|
604
|
+
const getIsOpen = config?.isOpen || ((item) => !!item.isOpen);
|
|
605
|
+
const setIsOpen = config?.setIsOpen ||
|
|
606
|
+
((item, open) => {
|
|
607
|
+
item.isOpen = open;
|
|
608
|
+
});
|
|
609
|
+
const isDescendant = (parentId, childId, list) => {
|
|
610
|
+
let current = list.find((n) => getId(n) === childId);
|
|
611
|
+
while (current && getParentId(current) !== null) {
|
|
612
|
+
if (getParentId(current) === parentId) {
|
|
613
|
+
return true;
|
|
614
|
+
}
|
|
615
|
+
const pid = getParentId(current);
|
|
616
|
+
current = list.find((n) => getId(n) === pid);
|
|
617
|
+
}
|
|
618
|
+
return false;
|
|
619
|
+
};
|
|
620
|
+
const getSubtree = (rootId, list) => {
|
|
621
|
+
const queue = [rootId];
|
|
622
|
+
const rootItem = list.find((n) => getId(n) === rootId);
|
|
623
|
+
if (!rootItem)
|
|
624
|
+
return [];
|
|
625
|
+
let index = 0;
|
|
626
|
+
while (index < queue.length) {
|
|
627
|
+
const parentId = queue[index++];
|
|
628
|
+
const children = list.filter((n) => getParentId(n) === parentId);
|
|
629
|
+
for (const child of children) {
|
|
630
|
+
const cid = getId(child);
|
|
631
|
+
if (!queue.includes(cid)) {
|
|
632
|
+
queue.push(cid);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
return list.filter((n) => queue.includes(getId(n)));
|
|
637
|
+
};
|
|
638
|
+
const visibleNodes = computed(() => {
|
|
639
|
+
const list = nodesSignal();
|
|
640
|
+
const visible = [];
|
|
641
|
+
const isNodeVisible = (node) => {
|
|
642
|
+
let currentParentId = getParentId(node);
|
|
643
|
+
while (currentParentId !== null && currentParentId !== undefined) {
|
|
644
|
+
const parent = list.find((n) => getId(n) === currentParentId);
|
|
645
|
+
if (!parent || !getIsOpen(parent)) {
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
currentParentId = getParentId(parent);
|
|
649
|
+
}
|
|
650
|
+
return true;
|
|
651
|
+
};
|
|
652
|
+
for (const node of list) {
|
|
653
|
+
const parentId = getParentId(node);
|
|
654
|
+
if (parentId === null || parentId === undefined || isNodeVisible(node)) {
|
|
655
|
+
visible.push(node);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return visible;
|
|
659
|
+
}, /* @ts-ignore */
|
|
660
|
+
...(ngDevMode ? [{ debugName: "visibleNodes" }] : /* istanbul ignore next */ []));
|
|
661
|
+
return {
|
|
662
|
+
visibleNodes,
|
|
663
|
+
drop(event, visibleNodesList) {
|
|
664
|
+
const draggedItem = visibleNodesList[event.previousIndex];
|
|
665
|
+
const targetItem = visibleNodesList[event.currentIndex];
|
|
666
|
+
if (!draggedItem || !targetItem || getId(draggedItem) === getId(targetItem))
|
|
667
|
+
return;
|
|
668
|
+
nodesSignal.update((allNodes) => {
|
|
669
|
+
// Prevent dropping inside itself or its descendants
|
|
670
|
+
if (isDescendant(getId(draggedItem), getId(targetItem), allNodes)) {
|
|
671
|
+
return allNodes;
|
|
672
|
+
}
|
|
673
|
+
const draggedSubtree = getSubtree(getId(draggedItem), allNodes);
|
|
674
|
+
const draggedIds = new Set(draggedSubtree.map((n) => getId(n)));
|
|
675
|
+
const filteredNodes = allNodes.filter((n) => !draggedIds.has(getId(n)));
|
|
676
|
+
const targetIdxInFiltered = filteredNodes.findIndex((n) => getId(n) === getId(targetItem));
|
|
677
|
+
if (targetIdxInFiltered === -1)
|
|
678
|
+
return allNodes;
|
|
679
|
+
let newParentId = null;
|
|
680
|
+
if (event.position === 'inside') {
|
|
681
|
+
newParentId = getId(targetItem);
|
|
682
|
+
const targetInMain = filteredNodes.find((n) => getId(n) === getId(targetItem));
|
|
683
|
+
if (targetInMain)
|
|
684
|
+
setIsOpen(targetInMain, true);
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
newParentId = getParentId(targetItem);
|
|
688
|
+
}
|
|
689
|
+
const updatedDraggedSubtree = draggedSubtree.map((node) => {
|
|
690
|
+
const updatedNode = { ...node };
|
|
691
|
+
if (getId(updatedNode) === getId(draggedItem)) {
|
|
692
|
+
setParentId(updatedNode, newParentId);
|
|
693
|
+
}
|
|
694
|
+
return updatedNode;
|
|
695
|
+
});
|
|
696
|
+
if (event.position === 'before') {
|
|
697
|
+
filteredNodes.splice(targetIdxInFiltered, 0, ...updatedDraggedSubtree);
|
|
698
|
+
}
|
|
699
|
+
else if (event.position === 'after') {
|
|
700
|
+
const targetSubtree = getSubtree(getId(targetItem), filteredNodes);
|
|
701
|
+
const insertAt = targetIdxInFiltered + targetSubtree.length;
|
|
702
|
+
filteredNodes.splice(insertAt, 0, ...updatedDraggedSubtree);
|
|
703
|
+
}
|
|
704
|
+
else if (event.position === 'inside') {
|
|
705
|
+
filteredNodes.splice(targetIdxInFiltered + 1, 0, ...updatedDraggedSubtree);
|
|
706
|
+
}
|
|
707
|
+
return filteredNodes;
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
};
|
|
711
|
+
}
|
|
479
712
|
|
|
480
713
|
/**
|
|
481
714
|
* Generated bundle index. Do not edit.
|
|
482
715
|
*/
|
|
483
716
|
|
|
484
|
-
export { ShipSortable, createSortableManager, moveIndex, transferArrayItem };
|
|
717
|
+
export { ShipSortable, createSortableManager, createTreeSortableManager, moveIndex, transferArrayItem };
|
|
485
718
|
//# sourceMappingURL=ship-ui-core-ship-sortable.mjs.map
|