@ship-ui/core 0.22.9 → 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-dialog.mjs +2 -2
- package/fesm2022/ship-ui-core-ship-dialog.mjs.map +1 -1
- 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-spotlight.mjs +3 -2
- package/fesm2022/ship-ui-core-ship-spotlight.mjs.map +1 -1
- package/fesm2022/ship-ui-core-ship-theme-toggle.mjs +2 -2
- package/fesm2022/ship-ui-core-ship-theme-toggle.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-dialog.d.ts +2 -2
- package/types/ship-ui-core-ship-sortable.d.ts +27 -3
- package/types/ship-ui-core-ship-spotlight.d.ts +2 -1
- package/types/ship-ui-core-ship-tree.d.ts +67 -0
package/bin/ship-fg-scanner
CHANGED
|
Binary file
|
|
@@ -91,7 +91,7 @@ class ShipDialog {
|
|
|
91
91
|
}
|
|
92
92
|
</dialog>
|
|
93
93
|
}
|
|
94
|
-
`, isInline: true, styles: ["dialog[shDialog]{--dialog-p: 1rem;--dialog-g: .5rem;--dialog-bg: var(--base-1);--dialog-s: var(--shape-2);--dialog-inner-s: var(--shape-2);border:var(--border-10);background:transparent;border-radius:var(--dialog-s);box-shadow:var(--box-shadow-40);color:var(--base-8);font:var(--paragraph-30);padding:0;margin:auto;z-index:0;display:flex;flex-direction:column}dialog[shDialog]:focus-visible{outline:none}dialog[shDialog].type-b{--dialog-s: 1.625rem;--dialog-inner-s: 1.25rem;background:var(--base-3);padding:.5rem;outline:var(--border-10);outline-offset:-1px;overflow:hidden}dialog[shDialog].type-b::backdrop{background:rgb(from var(--base-1) r g b/30%);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}dialog[shDialog].type-b>.content{border:1px solid rgb(from var(--base-4) r g b/70%)}dialog[shDialog]>.content{position:relative;border-radius:var(--dialog-inner-s);background-color:var(--dialog-bg);z-index:2;max-width:initial;overflow:auto}dialog[shDialog] .closeable-overlay{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog]:focus{outline:none}dialog[shDialog] .dialog-content{position:relative;z-index:2}dialog[shDialog] .dialog-backdrop{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog] [header],dialog[shDialog] [content],dialog[shDialog] [footer]{width:100%}dialog[shDialog] [header]{display:grid;grid-template-areas:\"title actions\" \"description actions\";grid-template-columns:1fr min-content;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [header] h1,dialog[shDialog] [header] h2,dialog[shDialog] [header] h3,dialog[shDialog] [header] h4,dialog[shDialog] [header] [title]{grid-area:title;font:var(--title-20)}dialog[shDialog] [header] p,dialog[shDialog] [header] [description]{grid-area:description;font:var(--paragraph-30)}dialog[shDialog] [header] button,dialog[shDialog] [header] [actions]{grid-area:actions}dialog[shDialog] [header].sticky{background-color:var(--dialog-bg);border-bottom:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;top:0;z-index:100}dialog[shDialog] [content]{padding:0 var(--dialog-p)}dialog[shDialog] [content]:not(:has(~[footer])){padding-bottom:var(--dialog-p)}dialog[shDialog] [footer]{display:flex;align-items:center;justify-content:flex-end;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [footer].sticky{background-color:var(--dialog-bg);border-top:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;bottom:0;z-index:100}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
94
|
+
`, isInline: true, styles: ["dialog[shDialog]{--dialog-p: 1rem;--dialog-g: .5rem;--dialog-bg: var(--base-1);--dialog-s: var(--shape-2);--dialog-inner-s: var(--shape-2);border:var(--border-10);background:transparent;border-radius:var(--dialog-s);box-shadow:var(--box-shadow-40);color:var(--base-8);font:var(--paragraph-30);padding:0;margin:auto;z-index:0;display:flex;flex-direction:column}dialog[shDialog]:focus-visible{outline:none}dialog[shDialog].type-b{--dialog-s: 1.625rem;--dialog-inner-s: 1.25rem;background:var(--base-3);padding:.5rem;outline:var(--border-10);outline-offset:-1px;overflow:hidden}dialog[shDialog].type-b::backdrop{background:rgb(from var(--base-1) r g b/30%);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}dialog[shDialog].type-b>.content{border:1px solid rgb(from var(--base-4) r g b/70%)}dialog[shDialog].type-c::backdrop{background:rgb(from var(--base-1) r g b/30%);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}dialog[shDialog]>.content{position:relative;border-radius:var(--dialog-inner-s);background-color:var(--dialog-bg);z-index:2;max-width:initial;overflow:auto}dialog[shDialog] .closeable-overlay{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog]:focus{outline:none}dialog[shDialog] .dialog-content{position:relative;z-index:2}dialog[shDialog] .dialog-backdrop{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog] [header],dialog[shDialog] [content],dialog[shDialog] [footer]{width:100%}dialog[shDialog] [header]{display:grid;grid-template-areas:\"title actions\" \"description actions\";grid-template-columns:1fr min-content;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [header] h1,dialog[shDialog] [header] h2,dialog[shDialog] [header] h3,dialog[shDialog] [header] h4,dialog[shDialog] [header] [title]{grid-area:title;font:var(--title-20)}dialog[shDialog] [header] p,dialog[shDialog] [header] [description]{grid-area:description;font:var(--paragraph-30)}dialog[shDialog] [header] button,dialog[shDialog] [header] [actions]{grid-area:actions}dialog[shDialog] [header].sticky{background-color:var(--dialog-bg);border-bottom:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;top:0;z-index:100}dialog[shDialog] [content]{padding:0 var(--dialog-p)}dialog[shDialog] [content]:not(:has(~[footer])){padding-bottom:var(--dialog-p)}dialog[shDialog] [footer]{display:flex;align-items:center;justify-content:flex-end;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [footer].sticky{background-color:var(--dialog-bg);border-top:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;bottom:0;z-index:100}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
95
95
|
}
|
|
96
96
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: ShipDialog, decorators: [{
|
|
97
97
|
type: Component,
|
|
@@ -116,7 +116,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImpor
|
|
|
116
116
|
}
|
|
117
117
|
</dialog>
|
|
118
118
|
}
|
|
119
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["dialog[shDialog]{--dialog-p: 1rem;--dialog-g: .5rem;--dialog-bg: var(--base-1);--dialog-s: var(--shape-2);--dialog-inner-s: var(--shape-2);border:var(--border-10);background:transparent;border-radius:var(--dialog-s);box-shadow:var(--box-shadow-40);color:var(--base-8);font:var(--paragraph-30);padding:0;margin:auto;z-index:0;display:flex;flex-direction:column}dialog[shDialog]:focus-visible{outline:none}dialog[shDialog].type-b{--dialog-s: 1.625rem;--dialog-inner-s: 1.25rem;background:var(--base-3);padding:.5rem;outline:var(--border-10);outline-offset:-1px;overflow:hidden}dialog[shDialog].type-b::backdrop{background:rgb(from var(--base-1) r g b/30%);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}dialog[shDialog].type-b>.content{border:1px solid rgb(from var(--base-4) r g b/70%)}dialog[shDialog]>.content{position:relative;border-radius:var(--dialog-inner-s);background-color:var(--dialog-bg);z-index:2;max-width:initial;overflow:auto}dialog[shDialog] .closeable-overlay{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog]:focus{outline:none}dialog[shDialog] .dialog-content{position:relative;z-index:2}dialog[shDialog] .dialog-backdrop{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog] [header],dialog[shDialog] [content],dialog[shDialog] [footer]{width:100%}dialog[shDialog] [header]{display:grid;grid-template-areas:\"title actions\" \"description actions\";grid-template-columns:1fr min-content;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [header] h1,dialog[shDialog] [header] h2,dialog[shDialog] [header] h3,dialog[shDialog] [header] h4,dialog[shDialog] [header] [title]{grid-area:title;font:var(--title-20)}dialog[shDialog] [header] p,dialog[shDialog] [header] [description]{grid-area:description;font:var(--paragraph-30)}dialog[shDialog] [header] button,dialog[shDialog] [header] [actions]{grid-area:actions}dialog[shDialog] [header].sticky{background-color:var(--dialog-bg);border-bottom:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;top:0;z-index:100}dialog[shDialog] [content]{padding:0 var(--dialog-p)}dialog[shDialog] [content]:not(:has(~[footer])){padding-bottom:var(--dialog-p)}dialog[shDialog] [footer]{display:flex;align-items:center;justify-content:flex-end;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [footer].sticky{background-color:var(--dialog-bg);border-top:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;bottom:0;z-index:100}\n"] }]
|
|
119
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["dialog[shDialog]{--dialog-p: 1rem;--dialog-g: .5rem;--dialog-bg: var(--base-1);--dialog-s: var(--shape-2);--dialog-inner-s: var(--shape-2);border:var(--border-10);background:transparent;border-radius:var(--dialog-s);box-shadow:var(--box-shadow-40);color:var(--base-8);font:var(--paragraph-30);padding:0;margin:auto;z-index:0;display:flex;flex-direction:column}dialog[shDialog]:focus-visible{outline:none}dialog[shDialog].type-b{--dialog-s: 1.625rem;--dialog-inner-s: 1.25rem;background:var(--base-3);padding:.5rem;outline:var(--border-10);outline-offset:-1px;overflow:hidden}dialog[shDialog].type-b::backdrop{background:rgb(from var(--base-1) r g b/30%);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}dialog[shDialog].type-b>.content{border:1px solid rgb(from var(--base-4) r g b/70%)}dialog[shDialog].type-c::backdrop{background:rgb(from var(--base-1) r g b/30%);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}dialog[shDialog]>.content{position:relative;border-radius:var(--dialog-inner-s);background-color:var(--dialog-bg);z-index:2;max-width:initial;overflow:auto}dialog[shDialog] .closeable-overlay{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog]:focus{outline:none}dialog[shDialog] .dialog-content{position:relative;z-index:2}dialog[shDialog] .dialog-backdrop{position:fixed;inset:0;opacity:0;z-index:1}dialog[shDialog] [header],dialog[shDialog] [content],dialog[shDialog] [footer]{width:100%}dialog[shDialog] [header]{display:grid;grid-template-areas:\"title actions\" \"description actions\";grid-template-columns:1fr min-content;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [header] h1,dialog[shDialog] [header] h2,dialog[shDialog] [header] h3,dialog[shDialog] [header] h4,dialog[shDialog] [header] [title]{grid-area:title;font:var(--title-20)}dialog[shDialog] [header] p,dialog[shDialog] [header] [description]{grid-area:description;font:var(--paragraph-30)}dialog[shDialog] [header] button,dialog[shDialog] [header] [actions]{grid-area:actions}dialog[shDialog] [header].sticky{background-color:var(--dialog-bg);border-bottom:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;top:0;z-index:100}dialog[shDialog] [content]{padding:0 var(--dialog-p)}dialog[shDialog] [content]:not(:has(~[footer])){padding-bottom:var(--dialog-p)}dialog[shDialog] [footer]{display:flex;align-items:center;justify-content:flex-end;padding:var(--dialog-p);gap:var(--dialog-g)}dialog[shDialog] [footer].sticky{background-color:var(--dialog-bg);border-top:var(--border-10);box-shadow:var(--box-shadow-35);position:sticky;bottom:0;z-index:100}\n"] }]
|
|
120
120
|
}], propDecorators: { dialogRef: [{ type: i0.ViewChild, args: ['dialogRef', { isSignal: true }] }], isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }, { type: i0.Output, args: ["isOpenChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
121
121
|
|
|
122
122
|
class ShipDialogService {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-ui-core-ship-dialog.mjs","sources":["../../../projects/ship-ui/ship-dialog/ship-dialog.ts","../../../projects/ship-ui/ship-dialog/ship-dialog.service.ts","../../../projects/ship-ui/ship-dialog/ship-ui-core-ship-dialog.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, DOCUMENT, effect, ElementRef, inject, input, model, output, viewChild, ViewEncapsulation } from '@angular/core';\nimport { SHIP_CONFIG } from '@ship-ui/core';\n\nexport type ShipDialogOptions = {\n class?: 'default' | 'type-b' | string;\n width?: string;\n maxWidth?: string;\n height?: string;\n maxHeight?: string;\n closeOnButton?: boolean;\n closeOnEsc?: boolean;\n closeOnOutsideClick?: boolean;\n};\n\nconst DEFAULT_OPTIONS: ShipDialogOptions = {\n class: 'default',\n width: undefined,\n maxWidth: undefined,\n height: undefined,\n maxHeight: undefined,\n closeOnButton: true,\n closeOnEsc: true,\n closeOnOutsideClick: true,\n};\n\n@Component({\n selector: 'sh-dialog',\n styleUrl: './ship-dialog.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [],\n template: `\n @let options = this.defaultOptionMerge();\n\n @if (isOpen()) {\n <dialog\n shDialog\n #dialogRef\n [class]=\"options.class\"\n [style.width]=\"options.width ?? ''\"\n [style.max-width]=\"options.maxWidth ?? ''\"\n [style.max-height]=\"options.maxHeight ?? ''\"\n [style.height]=\"options.height ?? ''\">\n <div class=\"content\">\n <ng-content />\n </div>\n\n @if (this.defaultOptionMerge().closeOnOutsideClick) {\n <div class=\"closeable-overlay\" (click)=\"isOpen.set(false)\"></div>\n }\n </dialog>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ShipDialog {\n #document = inject(DOCUMENT);\n #shConfig = inject(SHIP_CONFIG, { optional: true });\n dialogRef = viewChild<ElementRef<HTMLDialogElement>>('dialogRef');\n isOpen = model<boolean>(false);\n options = input<Partial<ShipDialogOptions>>();\n closed = output<void>();\n\n defaultOptionMerge = computed(() => ({\n ...DEFAULT_OPTIONS,\n ...{ class: this.#shConfig?.dialogType ?? 'default' },\n ...this.options(),\n }));\n\n abortController: AbortController | null = null;\n isOpenEffect = effect(() => {\n const dialogEl = this.dialogRef()?.nativeElement;\n\n if (!dialogEl) return;\n if (this.abortController) {\n this.abortController.abort();\n }\n\n this.abortController = new AbortController();\n\n if (this.isOpen()) {\n dialogEl.showModal();\n dialogEl.addEventListener(\n 'close',\n () => {\n this.isOpen.set(false);\n this.closed.emit();\n },\n {\n signal: this.abortController?.signal,\n }\n );\n\n this.#document.addEventListener(\n 'keydown',\n (e) => {\n if (e.key === 'Escape' && !this.defaultOptionMerge().closeOnEsc) {\n e.preventDefault();\n }\n\n if (e.key === 'Escape' && this.defaultOptionMerge().closeOnEsc) {\n this.isOpen.set(false);\n }\n },\n {\n signal: this.abortController?.signal,\n }\n );\n } else {\n dialogEl.close();\n\n queueMicrotask(() => this.closed.emit());\n }\n });\n\n ngOnDestroy() {\n this.abortController?.abort();\n }\n}\n","import {\n ApplicationRef,\n ComponentRef,\n createComponent,\n DOCUMENT,\n EmbeddedViewRef,\n inject,\n Injectable,\n InputSignal,\n isSignal,\n OutputEmitterRef,\n OutputRefSubscription,\n TemplateRef,\n Type,\n} from '@angular/core';\nimport { ShipDialog, ShipDialogOptions } from './ship-dialog';\n\nexport type Exact<T, U> = U extends T ? (keyof U extends keyof T ? U : never) : never;\nexport type ComponentDataType<T> = T extends TemplateRef<infer C>\n ? (C extends { $implicit: infer K } ? K : unknown) & Partial<Omit<C, 'close' | '$implicit'>> extends infer R\n ? keyof R extends never\n ? void\n : R\n : void\n : T extends { data: InputSignal<infer K> }\n ? K\n : void;\nexport type ComponentClosedType<T> = T extends TemplateRef<infer C>\n ? C extends { close: (res?: infer U) => void }\n ? U\n : undefined\n : T extends { closed: OutputEmitterRef<infer U> }\n ? U\n : undefined;\n\nexport interface ShipDialogServiceOptions<TData = any, TResult = undefined> extends ShipDialogOptions {\n data?: TData extends void ? void : TData & Exact<TData, TData>;\n closed?: (res: TResult) => void;\n}\n\nexport type ShipDialogInstance<T> = {\n component: T;\n close: (res?: ComponentClosedType<T>) => void;\n closed: OutputEmitterRef<ComponentClosedType<T>>;\n};\n\nexport type ShipDialogTemplateInstance<T> = {\n component: undefined;\n close: (res?: ComponentClosedType<T>) => void;\n closed: OutputEmitterRef<ComponentClosedType<T>>;\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ShipDialogService {\n #document = inject(DOCUMENT);\n #bodyEl = this.#document.querySelector('body');\n #appRef = inject(ApplicationRef);\n\n compRef: ComponentRef<ShipDialog> | null = null;\n insertedCompRef: ComponentRef<unknown> | null = null;\n insertedTemplateRef: EmbeddedViewRef<unknown> | null = null;\n\n closedFieldSub: OutputRefSubscription | null = null;\n compClosedSub: OutputRefSubscription | null = null;\n\n open<\n I,\n K = ComponentDataType<I>,\n U = ComponentClosedType<I>,\n _Options extends ShipDialogServiceOptions<K, U> = ShipDialogServiceOptions<K, U>,\n >(\n componentOrTemplate: Type<I> | (I extends TemplateRef<any> ? I : never),\n options?: _Options\n ): I extends TemplateRef<any> ? ShipDialogTemplateInstance<I> : ShipDialogInstance<I>;\n open<T = any, K = ComponentDataType<T>, U = ComponentClosedType<T>>(\n componentOrTemplate: Type<T> | TemplateRef<any>,\n options?: any\n ): ShipDialogInstance<any> {\n const environmentInjector = this.#appRef.injector;\n const hostElement = this.#createEl();\n let closingCalled = false;\n let closedField: OutputEmitterRef<U | undefined> | undefined;\n\n const { data, closed, ...rest } = options || {};\n\n if (this.compRef) {\n this.#cleanupRefs(true);\n }\n\n const _self = this;\n\n function closeAction(arg: U | undefined = undefined) {\n _self.#cleanupRefs();\n\n if (closingCalled) return;\n\n closingCalled = true;\n\n if (closedField && closedField instanceof OutputEmitterRef) {\n closedField.emit(arg as any);\n }\n\n closed?.(arg as U);\n }\n\n let projectableNodes: any[][] = [];\n\n if (componentOrTemplate instanceof TemplateRef) {\n this.insertedTemplateRef = componentOrTemplate.createEmbeddedView({\n $implicit: data,\n close: (res?: any) => closeAction(res),\n });\n projectableNodes = [this.insertedTemplateRef.rootNodes];\n } else {\n this.insertedCompRef = createComponent<T>(componentOrTemplate, {\n environmentInjector,\n });\n projectableNodes = [[this.insertedCompRef.location.nativeElement]];\n\n const insertedInstance = this.insertedCompRef.instance as T;\n const dataField = (insertedInstance as any).data as InputSignal<K>;\n closedField = (insertedInstance as any).closed as OutputEmitterRef<U | undefined>;\n\n if (data) {\n if (isSignal(dataField)) {\n this.insertedCompRef.setInput('data', data);\n } else if (!isSignal(dataField)) {\n throw new Error('data is not an input signal on the passed component');\n }\n }\n\n if (closedField && closedField instanceof OutputEmitterRef) {\n this.closedFieldSub = closedField.subscribe((arg: U | undefined) => {\n this.#cleanupRefs();\n\n if (closingCalled) return;\n\n closingCalled = true;\n\n closed?.(arg as U);\n\n (this.compRef?.instance.closed as OutputEmitterRef<U | undefined>).emit(arg);\n });\n }\n }\n\n this.compRef = createComponent(ShipDialog, {\n hostElement,\n environmentInjector,\n projectableNodes,\n });\n\n if (this.insertedCompRef) {\n this.#appRef.attachView(this.insertedCompRef.hostView);\n this.insertedCompRef.changeDetectorRef.detectChanges();\n }\n\n if (this.insertedTemplateRef) {\n this.#appRef.attachView(this.insertedTemplateRef);\n this.insertedTemplateRef.detectChanges();\n }\n\n this.#appRef.attachView(this.compRef.hostView);\n\n this.compRef.changeDetectorRef.detectChanges();\n this.compRef.instance.isOpen.set(true);\n this.compRef.setInput('options', rest);\n\n this.compClosedSub = this.compRef.instance.closed.subscribe(() => closeAction());\n\n return {\n component: this.insertedCompRef?.instance as T | undefined,\n close: closeAction,\n closed: this.compRef.instance.closed as OutputEmitterRef<U | undefined>,\n } as ShipDialogInstance<T>;\n }\n\n #createEl(): Element {\n const wrapperEl = this.#document.createElement('sh-dialog-ref');\n wrapperEl.id = 'sh-dialog-ref';\n\n if (!this.#document.getElementById('sh-dialog-ref')) {\n this.#bodyEl?.append(wrapperEl);\n }\n\n return this.#document.getElementById('sh-dialog-ref')!;\n }\n\n #cleanupRefs(instant = false) {\n const _self = this;\n\n instant ? cleanup : queueMicrotask(() => cleanup());\n\n function cleanup() {\n if (_self.insertedCompRef) {\n _self.#appRef.detachView(_self.insertedCompRef.hostView);\n _self.closedFieldSub?.unsubscribe();\n _self.insertedCompRef.destroy();\n _self.insertedCompRef = null;\n }\n\n if (_self.insertedTemplateRef) {\n _self.#appRef.detachView(_self.insertedTemplateRef);\n _self.insertedTemplateRef.destroy();\n _self.insertedTemplateRef = null;\n }\n\n if (!_self.compRef) return;\n\n _self.#appRef.detachView(_self.compRef.hostView);\n _self.compClosedSub?.unsubscribe();\n _self.compRef.destroy();\n }\n }\n\n ngOnDestroy() {\n this.#cleanupRefs(true);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAcA,MAAM,eAAe,GAAsB;AACzC,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,QAAQ,EAAE,SAAS;AACnB,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,mBAAmB,EAAE,IAAI;CAC1B;MA+BY,UAAU,CAAA;AA7BvB,IAAA,WAAA,GAAA;AA8BE,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC5B,IAAA,CAAA,SAAS,GA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,GAAG,IAAI;YAClC;YAEA,IAAI,CAAC,KAAK,CAAC,OAAO;gBAAE;YAEpB,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;AAChD,YAAA,KAAK,CAAC,aAAa,EAAE,WAAW,EAAE;AAClC,YAAA,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;QACzB;IACF;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;IACzB;8GApKW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,cAFhB,MAAM,EAAA,CAAA,CAAA;;2FAEP,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAH7B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACtDD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ship-ui-core-ship-dialog.mjs","sources":["../../../projects/ship-ui/ship-dialog/ship-dialog.ts","../../../projects/ship-ui/ship-dialog/ship-dialog.service.ts","../../../projects/ship-ui/ship-dialog/ship-ui-core-ship-dialog.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, DOCUMENT, effect, ElementRef, inject, input, model, output, viewChild, ViewEncapsulation } from '@angular/core';\nimport { SHIP_CONFIG } from '@ship-ui/core';\n\nexport type ShipDialogOptions = {\n class?: 'default' | 'type-b' | 'type-c' | string;\n width?: string;\n maxWidth?: string;\n height?: string;\n maxHeight?: string;\n closeOnButton?: boolean;\n closeOnEsc?: boolean;\n closeOnOutsideClick?: boolean;\n};\n\nconst DEFAULT_OPTIONS: ShipDialogOptions = {\n class: 'default',\n width: undefined,\n maxWidth: undefined,\n height: undefined,\n maxHeight: undefined,\n closeOnButton: true,\n closeOnEsc: true,\n closeOnOutsideClick: true,\n};\n\n@Component({\n selector: 'sh-dialog',\n styleUrl: './ship-dialog.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [],\n template: `\n @let options = this.defaultOptionMerge();\n\n @if (isOpen()) {\n <dialog\n shDialog\n #dialogRef\n [class]=\"options.class\"\n [style.width]=\"options.width ?? ''\"\n [style.max-width]=\"options.maxWidth ?? ''\"\n [style.max-height]=\"options.maxHeight ?? ''\"\n [style.height]=\"options.height ?? ''\">\n <div class=\"content\">\n <ng-content />\n </div>\n\n @if (this.defaultOptionMerge().closeOnOutsideClick) {\n <div class=\"closeable-overlay\" (click)=\"isOpen.set(false)\"></div>\n }\n </dialog>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ShipDialog {\n #document = inject(DOCUMENT);\n #shConfig = inject(SHIP_CONFIG, { optional: true });\n dialogRef = viewChild<ElementRef<HTMLDialogElement>>('dialogRef');\n isOpen = model<boolean>(false);\n options = input<Partial<ShipDialogOptions>>();\n closed = output<void>();\n\n defaultOptionMerge = computed(() => ({\n ...DEFAULT_OPTIONS,\n ...{ class: this.#shConfig?.dialogType ?? 'default' },\n ...this.options(),\n }));\n\n abortController: AbortController | null = null;\n isOpenEffect = effect(() => {\n const dialogEl = this.dialogRef()?.nativeElement;\n\n if (!dialogEl) return;\n if (this.abortController) {\n this.abortController.abort();\n }\n\n this.abortController = new AbortController();\n\n if (this.isOpen()) {\n dialogEl.showModal();\n dialogEl.addEventListener(\n 'close',\n () => {\n this.isOpen.set(false);\n this.closed.emit();\n },\n {\n signal: this.abortController?.signal,\n }\n );\n\n this.#document.addEventListener(\n 'keydown',\n (e) => {\n if (e.key === 'Escape' && !this.defaultOptionMerge().closeOnEsc) {\n e.preventDefault();\n }\n\n if (e.key === 'Escape' && this.defaultOptionMerge().closeOnEsc) {\n this.isOpen.set(false);\n }\n },\n {\n signal: this.abortController?.signal,\n }\n );\n } else {\n dialogEl.close();\n\n queueMicrotask(() => this.closed.emit());\n }\n });\n\n ngOnDestroy() {\n this.abortController?.abort();\n }\n}\n","import {\n ApplicationRef,\n ComponentRef,\n createComponent,\n DOCUMENT,\n EmbeddedViewRef,\n inject,\n Injectable,\n InputSignal,\n isSignal,\n OutputEmitterRef,\n OutputRefSubscription,\n TemplateRef,\n Type,\n} from '@angular/core';\nimport { ShipDialog, ShipDialogOptions } from './ship-dialog';\n\nexport type Exact<T, U> = U extends T ? (keyof U extends keyof T ? U : never) : never;\nexport type ComponentDataType<T> = T extends TemplateRef<infer C>\n ? (C extends { $implicit: infer K } ? K : unknown) & Partial<Omit<C, 'close' | '$implicit'>> extends infer R\n ? keyof R extends never\n ? void\n : R\n : void\n : T extends { data: InputSignal<infer K> }\n ? K\n : void;\nexport type ComponentClosedType<T> = T extends TemplateRef<infer C>\n ? C extends { close: (res?: infer U) => void }\n ? U\n : undefined\n : T extends { closed: OutputEmitterRef<infer U> }\n ? U\n : undefined;\n\nexport interface ShipDialogServiceOptions<TData = any, TResult = undefined> extends ShipDialogOptions {\n data?: TData extends void ? void : TData & Exact<TData, TData>;\n closed?: (res: TResult) => void;\n}\n\nexport type ShipDialogInstance<T> = {\n component: T;\n close: (res?: ComponentClosedType<T>) => void;\n closed: OutputEmitterRef<ComponentClosedType<T>>;\n};\n\nexport type ShipDialogTemplateInstance<T> = {\n component: undefined;\n close: (res?: ComponentClosedType<T>) => void;\n closed: OutputEmitterRef<ComponentClosedType<T>>;\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ShipDialogService {\n #document = inject(DOCUMENT);\n #bodyEl = this.#document.querySelector('body');\n #appRef = inject(ApplicationRef);\n\n compRef: ComponentRef<ShipDialog> | null = null;\n insertedCompRef: ComponentRef<unknown> | null = null;\n insertedTemplateRef: EmbeddedViewRef<unknown> | null = null;\n\n closedFieldSub: OutputRefSubscription | null = null;\n compClosedSub: OutputRefSubscription | null = null;\n\n open<\n I,\n K = ComponentDataType<I>,\n U = ComponentClosedType<I>,\n _Options extends ShipDialogServiceOptions<K, U> = ShipDialogServiceOptions<K, U>,\n >(\n componentOrTemplate: Type<I> | (I extends TemplateRef<any> ? I : never),\n options?: _Options\n ): I extends TemplateRef<any> ? ShipDialogTemplateInstance<I> : ShipDialogInstance<I>;\n open<T = any, K = ComponentDataType<T>, U = ComponentClosedType<T>>(\n componentOrTemplate: Type<T> | TemplateRef<any>,\n options?: any\n ): ShipDialogInstance<any> {\n const environmentInjector = this.#appRef.injector;\n const hostElement = this.#createEl();\n let closingCalled = false;\n let closedField: OutputEmitterRef<U | undefined> | undefined;\n\n const { data, closed, ...rest } = options || {};\n\n if (this.compRef) {\n this.#cleanupRefs(true);\n }\n\n const _self = this;\n\n function closeAction(arg: U | undefined = undefined) {\n _self.#cleanupRefs();\n\n if (closingCalled) return;\n\n closingCalled = true;\n\n if (closedField && closedField instanceof OutputEmitterRef) {\n closedField.emit(arg as any);\n }\n\n closed?.(arg as U);\n }\n\n let projectableNodes: any[][] = [];\n\n if (componentOrTemplate instanceof TemplateRef) {\n this.insertedTemplateRef = componentOrTemplate.createEmbeddedView({\n $implicit: data,\n close: (res?: any) => closeAction(res),\n });\n projectableNodes = [this.insertedTemplateRef.rootNodes];\n } else {\n this.insertedCompRef = createComponent<T>(componentOrTemplate, {\n environmentInjector,\n });\n projectableNodes = [[this.insertedCompRef.location.nativeElement]];\n\n const insertedInstance = this.insertedCompRef.instance as T;\n const dataField = (insertedInstance as any).data as InputSignal<K>;\n closedField = (insertedInstance as any).closed as OutputEmitterRef<U | undefined>;\n\n if (data) {\n if (isSignal(dataField)) {\n this.insertedCompRef.setInput('data', data);\n } else if (!isSignal(dataField)) {\n throw new Error('data is not an input signal on the passed component');\n }\n }\n\n if (closedField && closedField instanceof OutputEmitterRef) {\n this.closedFieldSub = closedField.subscribe((arg: U | undefined) => {\n this.#cleanupRefs();\n\n if (closingCalled) return;\n\n closingCalled = true;\n\n closed?.(arg as U);\n\n (this.compRef?.instance.closed as OutputEmitterRef<U | undefined>).emit(arg);\n });\n }\n }\n\n this.compRef = createComponent(ShipDialog, {\n hostElement,\n environmentInjector,\n projectableNodes,\n });\n\n if (this.insertedCompRef) {\n this.#appRef.attachView(this.insertedCompRef.hostView);\n this.insertedCompRef.changeDetectorRef.detectChanges();\n }\n\n if (this.insertedTemplateRef) {\n this.#appRef.attachView(this.insertedTemplateRef);\n this.insertedTemplateRef.detectChanges();\n }\n\n this.#appRef.attachView(this.compRef.hostView);\n\n this.compRef.changeDetectorRef.detectChanges();\n this.compRef.instance.isOpen.set(true);\n this.compRef.setInput('options', rest);\n\n this.compClosedSub = this.compRef.instance.closed.subscribe(() => closeAction());\n\n return {\n component: this.insertedCompRef?.instance as T | undefined,\n close: closeAction,\n closed: this.compRef.instance.closed as OutputEmitterRef<U | undefined>,\n } as ShipDialogInstance<T>;\n }\n\n #createEl(): Element {\n const wrapperEl = this.#document.createElement('sh-dialog-ref');\n wrapperEl.id = 'sh-dialog-ref';\n\n if (!this.#document.getElementById('sh-dialog-ref')) {\n this.#bodyEl?.append(wrapperEl);\n }\n\n return this.#document.getElementById('sh-dialog-ref')!;\n }\n\n #cleanupRefs(instant = false) {\n const _self = this;\n\n instant ? cleanup : queueMicrotask(() => cleanup());\n\n function cleanup() {\n if (_self.insertedCompRef) {\n _self.#appRef.detachView(_self.insertedCompRef.hostView);\n _self.closedFieldSub?.unsubscribe();\n _self.insertedCompRef.destroy();\n _self.insertedCompRef = null;\n }\n\n if (_self.insertedTemplateRef) {\n _self.#appRef.detachView(_self.insertedTemplateRef);\n _self.insertedTemplateRef.destroy();\n _self.insertedTemplateRef = null;\n }\n\n if (!_self.compRef) return;\n\n _self.#appRef.detachView(_self.compRef.hostView);\n _self.compClosedSub?.unsubscribe();\n _self.compRef.destroy();\n }\n }\n\n ngOnDestroy() {\n this.#cleanupRefs(true);\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nB,iBAAA;;;ACtDD;;AAEG;;;;"}
|
|
@@ -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
|