@spartan-ng/brain 0.0.1-alpha.535 → 0.0.1-alpha.537
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/spartan-ng-brain-input-otp.mjs +5 -7
- package/fesm2022/spartan-ng-brain-input-otp.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-resizable.mjs +430 -0
- package/fesm2022/spartan-ng-brain-resizable.mjs.map +1 -0
- package/hlm-tailwind-preset.css +7 -7
- package/input-otp/lib/brn-input-otp.d.ts +1 -3
- package/package.json +5 -1
- package/resizable/README.md +3 -0
- package/resizable/index.d.ts +3 -0
- package/resizable/lib/brn-resizable-group.d.ts +37 -0
- package/resizable/lib/brn-resizable-handle.d.ts +26 -0
- package/resizable/lib/brn-resizable-panel.d.ts +39 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, forwardRef, signal, input, booleanAttribute, numberAttribute, model, output, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, forwardRef, signal, input, booleanAttribute, linkedSignal, numberAttribute, model, output, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
5
5
|
|
|
@@ -29,6 +29,7 @@ class BrnInputOtp {
|
|
|
29
29
|
disabled = input(false, {
|
|
30
30
|
transform: booleanAttribute,
|
|
31
31
|
});
|
|
32
|
+
_disabled = linkedSignal(this.disabled);
|
|
32
33
|
/** The number of slots. */
|
|
33
34
|
maxLength = input.required({ transform: numberAttribute });
|
|
34
35
|
/** Virtual keyboard appearance on mobile */
|
|
@@ -63,9 +64,6 @@ class BrnInputOtp {
|
|
|
63
64
|
});
|
|
64
65
|
/** Emitted when the input is complete, triggered through input or paste. */
|
|
65
66
|
completed = output();
|
|
66
|
-
_state = computed(() => ({
|
|
67
|
-
disabled: signal(this.disabled()),
|
|
68
|
-
}));
|
|
69
67
|
_onChange;
|
|
70
68
|
_onTouched;
|
|
71
69
|
onInputChange(event) {
|
|
@@ -99,7 +97,7 @@ class BrnInputOtp {
|
|
|
99
97
|
this._onTouched = fn;
|
|
100
98
|
}
|
|
101
99
|
setDisabledState(isDisabled) {
|
|
102
|
-
this.
|
|
100
|
+
this._disabled.set(isDisabled);
|
|
103
101
|
}
|
|
104
102
|
isCompleted(newValue, previousValue, maxLength) {
|
|
105
103
|
return newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;
|
|
@@ -121,7 +119,7 @@ class BrnInputOtp {
|
|
|
121
119
|
autocomplete="one-time-code"
|
|
122
120
|
data-slot="input-otp"
|
|
123
121
|
[style]="inputStyles()"
|
|
124
|
-
[disabled]="
|
|
122
|
+
[disabled]="_disabled()"
|
|
125
123
|
[inputMode]="inputMode()"
|
|
126
124
|
[ngModel]="value()"
|
|
127
125
|
(input)="onInputChange($event)"
|
|
@@ -145,7 +143,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
145
143
|
autocomplete="one-time-code"
|
|
146
144
|
data-slot="input-otp"
|
|
147
145
|
[style]="inputStyles()"
|
|
148
|
-
[disabled]="
|
|
146
|
+
[disabled]="_disabled()"
|
|
149
147
|
[inputMode]="inputMode()"
|
|
150
148
|
[ngModel]="value()"
|
|
151
149
|
(input)="onInputChange($event)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-input-otp.mjs","sources":["../../../../libs/brain/input-otp/src/lib/brn-input-otp.token.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp-slot.ts","../../../../libs/brain/input-otp/src/index.ts","../../../../libs/brain/input-otp/src/spartan-ng-brain-input-otp.ts"],"sourcesContent":["import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnInputOtp } from './brn-input-otp';\n\nexport const BrnInputOtpToken = new InjectionToken<BrnInputOtp>('BrnInputOtpToken');\n\nexport function injectBrnInputOtp(): BrnInputOtp {\n\treturn inject(BrnInputOtpToken) as BrnInputOtp;\n}\n\nexport function provideBrnInputOtp(inputOtp: Type<BrnInputOtp>): ExistingProvider {\n\treturn { provide: BrnInputOtpToken, useExisting: inputOtp };\n}\n","import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tforwardRef,\n\tinput,\n\tmodel,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n} from '@angular/core';\nimport { type ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport type { ClassValue } from 'clsx';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n@Component({\n\tselector: 'brn-input-otp',\n\timports: [FormsModule],\n\ttemplate: `\n\t\t<ng-content />\n\t\t<div [style]=\"containerStyles()\">\n\t\t\t<input\n\t\t\t\t[class]=\"inputClass()\"\n\t\t\t\tautocomplete=\"one-time-code\"\n\t\t\t\tdata-slot=\"input-otp\"\n\t\t\t\t[style]=\"inputStyles()\"\n\t\t\t\t[disabled]=\"_state().disabled()\"\n\t\t\t\t[inputMode]=\"inputMode()\"\n\t\t\t\t[ngModel]=\"value()\"\n\t\t\t\t(input)=\"onInputChange($event)\"\n\t\t\t\t(paste)=\"onPaste($event)\"\n\t\t\t\t(focus)=\"_focused.set(true)\"\n\t\t\t\t(blur)=\"_focused.set(false)\"\n\t\t\t/>\n\t\t</div>\n\t`,\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\t/** Whether the input has focus. */\n\tprotected readonly _focused = signal<boolean>(false);\n\n\t/** Styles applied to the host element. */\n\tpublic readonly hostStyles = input<string>(\n\t\t'position: relative; cursor: text; user-select: none; pointer-events: none;',\n\t);\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string>(\n\t\t'position: absolute; inset: 0; width: 100%; height: 100%; display: flex; textAlign: left; opacity: 1; color: transparent; pointerEvents: all; background: transparent; caret-color: transparent; border: 0px solid transparent; outline: transparent solid 0px; box-shadow: none; line-height: 1; letter-spacing: -0.5em; font-family: monospace; font-variant-numeric: tabular-nums;',\n\t);\n\n\t/** Styles applied to the container element. */\n\tpublic readonly containerStyles = input<string>('position: absolute; inset: 0; pointer-events: none;');\n\n\t/** Determine if the date picker is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** The number of slots. */\n\tpublic readonly maxLength = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\tpublic readonly inputClass = input<ClassValue>('');\n\n\t/**\n\t * Defines how the pasted text should be transformed before saving to model/form.\n\t * Allows pasting text which contains extra characters like spaces, dashes, etc. and are longer than the maxLength.\n\t *\n\t * \"XXX-XXX\": (pastedText) => pastedText.replaceAll('-', '')\n\t * \"XXX XXX\": (pastedText) => pastedText.replaceAll(/\\s+/g, '')\n\t */\n\tpublic readonly transformPaste = input<(pastedText: string, maxLength: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly value = model<string | null>(null);\n\n\t/** Emits when the value changes. */\n\tpublic readonly valueChange = output<string>();\n\n\tpublic readonly context = computed(() => {\n\t\tconst value = this.value() ?? '';\n\t\tconst focused = this._focused();\n\t\tconst maxLength = this.maxLength();\n\t\tconst slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive =\n\t\t\t\tfocused && (value.length === slotIndex || (value.length === maxLength && slotIndex === maxLength - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tisActive,\n\t\t\t\thasFakeCaret: isActive && value.length === slotIndex,\n\t\t\t};\n\t\t});\n\n\t\treturn slots;\n\t});\n\n\t/** Emitted when the input is complete, triggered through input or paste. */\n\tpublic readonly completed = output<string>();\n\n\tprotected readonly _state = computed(() => ({\n\t\tdisabled: signal(this.disabled()),\n\t}));\n\n\tprotected _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\tprotected onInputChange(event: Event) {\n\t\tlet newValue = (event.target as HTMLInputElement).value;\n\t\tconst maxLength = this.maxLength();\n\n\t\tif (newValue.length > maxLength) {\n\t\t\t// Replace the last character when max length is exceeded\n\t\t\tnewValue = newValue.slice(0, maxLength - 1) + newValue.slice(-1);\n\t\t}\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent) {\n\t\tevent.preventDefault();\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\n\t\tconst maxLength = this.maxLength();\n\n\t\tconst content = this.transformPaste()(clipboardData, maxLength);\n\t\tconst newValue = content.slice(0, maxLength);\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\tthis.value.set(value);\n\t\tif (value?.length === this.maxLength()) {\n\t\t\tthis.completed.emit(value ?? '');\n\t\t}\n\t}\n\n\tregisterOnChange(fn: ChangeFn<string>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._state().disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, maxLength: number) {\n\t\treturn newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;\n\t}\n\n\tprivate updateValue(newValue: string, maxLength: number) {\n\t\tconst previousValue = this.value() ?? '';\n\n\t\tthis.value.set(newValue);\n\t\tthis._onChange?.(newValue);\n\n\t\tif (this.isCompleted(newValue, previousValue, maxLength)) {\n\t\t\tthis.completed.emit(newValue);\n\t\t}\n\t}\n}\n","import type { NumberInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, computed, input, numberAttribute } from '@angular/core';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\n@Component({\n\tselector: 'brn-input-otp-slot',\n\ttemplate: `\n\t\t{{ _slot().char }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t},\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtpSlot {\n\t/** Access the input-otp component */\n\tprotected readonly _inputOtp = injectBrnInputOtp();\n\n\t/** The index of the slot to render the char or a fake caret */\n\tpublic readonly index = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\tprotected readonly _slot = computed(() => this._inputOtp.context()[this.index()]);\n}\n","import { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-slot';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpSlot] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGO,MAAM,gBAAgB,GAAG,IAAI,cAAc,CA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A,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,kBAAA,EAAA,kBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAZjB;;;;;;AAMT,CAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAMW,eAAe,EAAA,UAAA,EAAA,CAAA;kBAd3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,QAAQ,EAAE;;;;;;AAMT,CAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACL,wBAAA,oBAAoB,EAAE,kBAAkB;AACxC,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,iBAAA;;;MCXY,kBAAkB,GAAG,CAAC,WAAW,EAAE,eAAe;;ACN/D;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-input-otp.mjs","sources":["../../../../libs/brain/input-otp/src/lib/brn-input-otp.token.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp.ts","../../../../libs/brain/input-otp/src/lib/brn-input-otp-slot.ts","../../../../libs/brain/input-otp/src/index.ts","../../../../libs/brain/input-otp/src/spartan-ng-brain-input-otp.ts"],"sourcesContent":["import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnInputOtp } from './brn-input-otp';\n\nexport const BrnInputOtpToken = new InjectionToken<BrnInputOtp>('BrnInputOtpToken');\n\nexport function injectBrnInputOtp(): BrnInputOtp {\n\treturn inject(BrnInputOtpToken) as BrnInputOtp;\n}\n\nexport function provideBrnInputOtp(inputOtp: Type<BrnInputOtp>): ExistingProvider {\n\treturn { provide: BrnInputOtpToken, useExisting: inputOtp };\n}\n","import type { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tComponent,\n\tcomputed,\n\tforwardRef,\n\tinput,\n\tlinkedSignal,\n\tmodel,\n\tnumberAttribute,\n\toutput,\n\tsignal,\n} from '@angular/core';\nimport { type ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';\nimport type { ClassValue } from 'clsx';\nimport { provideBrnInputOtp } from './brn-input-otp.token';\n\nexport const BRN_INPUT_OTP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnInputOtp),\n\tmulti: true,\n};\n\nexport type InputMode = 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n@Component({\n\tselector: 'brn-input-otp',\n\timports: [FormsModule],\n\ttemplate: `\n\t\t<ng-content />\n\t\t<div [style]=\"containerStyles()\">\n\t\t\t<input\n\t\t\t\t[class]=\"inputClass()\"\n\t\t\t\tautocomplete=\"one-time-code\"\n\t\t\t\tdata-slot=\"input-otp\"\n\t\t\t\t[style]=\"inputStyles()\"\n\t\t\t\t[disabled]=\"_disabled()\"\n\t\t\t\t[inputMode]=\"inputMode()\"\n\t\t\t\t[ngModel]=\"value()\"\n\t\t\t\t(input)=\"onInputChange($event)\"\n\t\t\t\t(paste)=\"onPaste($event)\"\n\t\t\t\t(focus)=\"_focused.set(true)\"\n\t\t\t\t(blur)=\"_focused.set(false)\"\n\t\t\t/>\n\t\t</div>\n\t`,\n\thost: {\n\t\t'[style]': 'hostStyles()',\n\t\t'data-input-otp-container': 'true',\n\t},\n\tproviders: [BRN_INPUT_OTP_VALUE_ACCESSOR, provideBrnInputOtp(BrnInputOtp)],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtp implements ControlValueAccessor {\n\t/** Whether the input has focus. */\n\tprotected readonly _focused = signal<boolean>(false);\n\n\t/** Styles applied to the host element. */\n\tpublic readonly hostStyles = input<string>(\n\t\t'position: relative; cursor: text; user-select: none; pointer-events: none;',\n\t);\n\n\t/** Styles applied to the input element to make it invisible and clickable. */\n\tpublic readonly inputStyles = input<string>(\n\t\t'position: absolute; inset: 0; width: 100%; height: 100%; display: flex; textAlign: left; opacity: 1; color: transparent; pointerEvents: all; background: transparent; caret-color: transparent; border: 0px solid transparent; outline: transparent solid 0px; box-shadow: none; line-height: 1; letter-spacing: -0.5em; font-family: monospace; font-variant-numeric: tabular-nums;',\n\t);\n\n\t/** Styles applied to the container element. */\n\tpublic readonly containerStyles = input<string>('position: absolute; inset: 0; pointer-events: none;');\n\n\t/** Determine if the date picker is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\tprotected readonly _disabled = linkedSignal(this.disabled);\n\n\t/** The number of slots. */\n\tpublic readonly maxLength = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\t/** Virtual keyboard appearance on mobile */\n\tpublic readonly inputMode = input<InputMode>('numeric');\n\n\tpublic readonly inputClass = input<ClassValue>('');\n\n\t/**\n\t * Defines how the pasted text should be transformed before saving to model/form.\n\t * Allows pasting text which contains extra characters like spaces, dashes, etc. and are longer than the maxLength.\n\t *\n\t * \"XXX-XXX\": (pastedText) => pastedText.replaceAll('-', '')\n\t * \"XXX XXX\": (pastedText) => pastedText.replaceAll(/\\s+/g, '')\n\t */\n\tpublic readonly transformPaste = input<(pastedText: string, maxLength: number) => string>((text) => text);\n\n\t/** The value controlling the input */\n\tpublic readonly value = model<string | null>(null);\n\n\t/** Emits when the value changes. */\n\tpublic readonly valueChange = output<string>();\n\n\tpublic readonly context = computed(() => {\n\t\tconst value = this.value() ?? '';\n\t\tconst focused = this._focused();\n\t\tconst maxLength = this.maxLength();\n\t\tconst slots = Array.from({ length: this.maxLength() }).map((_, slotIndex) => {\n\t\t\tconst char = value[slotIndex] !== undefined ? value[slotIndex] : null;\n\n\t\t\tconst isActive =\n\t\t\t\tfocused && (value.length === slotIndex || (value.length === maxLength && slotIndex === maxLength - 1));\n\n\t\t\treturn {\n\t\t\t\tchar,\n\t\t\t\tisActive,\n\t\t\t\thasFakeCaret: isActive && value.length === slotIndex,\n\t\t\t};\n\t\t});\n\n\t\treturn slots;\n\t});\n\n\t/** Emitted when the input is complete, triggered through input or paste. */\n\tpublic readonly completed = output<string>();\n\n\tprotected _onChange?: ChangeFn<string>;\n\tprotected _onTouched?: TouchFn;\n\n\tprotected onInputChange(event: Event) {\n\t\tlet newValue = (event.target as HTMLInputElement).value;\n\t\tconst maxLength = this.maxLength();\n\n\t\tif (newValue.length > maxLength) {\n\t\t\t// Replace the last character when max length is exceeded\n\t\t\tnewValue = newValue.slice(0, maxLength - 1) + newValue.slice(-1);\n\t\t}\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\tprotected onPaste(event: ClipboardEvent) {\n\t\tevent.preventDefault();\n\t\tconst clipboardData = event.clipboardData?.getData('text/plain') || '';\n\n\t\tconst maxLength = this.maxLength();\n\n\t\tconst content = this.transformPaste()(clipboardData, maxLength);\n\t\tconst newValue = content.slice(0, maxLength);\n\n\t\tthis.updateValue(newValue, maxLength);\n\t}\n\n\t/** CONTROL VALUE ACCESSOR */\n\twriteValue(value: string | null): void {\n\t\tthis.value.set(value);\n\t\tif (value?.length === this.maxLength()) {\n\t\t\tthis.completed.emit(value ?? '');\n\t\t}\n\t}\n\n\tregisterOnChange(fn: ChangeFn<string>): void {\n\t\tthis._onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: TouchFn): void {\n\t\tthis._onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis._disabled.set(isDisabled);\n\t}\n\n\tprivate isCompleted(newValue: string, previousValue: string, maxLength: number) {\n\t\treturn newValue !== previousValue && previousValue.length < maxLength && newValue.length === maxLength;\n\t}\n\n\tprivate updateValue(newValue: string, maxLength: number) {\n\t\tconst previousValue = this.value() ?? '';\n\n\t\tthis.value.set(newValue);\n\t\tthis._onChange?.(newValue);\n\n\t\tif (this.isCompleted(newValue, previousValue, maxLength)) {\n\t\t\tthis.completed.emit(newValue);\n\t\t}\n\t}\n}\n","import type { NumberInput } from '@angular/cdk/coercion';\nimport { ChangeDetectionStrategy, Component, computed, input, numberAttribute } from '@angular/core';\nimport { injectBrnInputOtp } from './brn-input-otp.token';\n\n@Component({\n\tselector: 'brn-input-otp-slot',\n\ttemplate: `\n\t\t{{ _slot().char }}\n\n\t\t@if (_slot().hasFakeCaret) {\n\t\t\t<ng-content />\n\t\t}\n\t`,\n\thost: {\n\t\t'[attr.data-active]': '_slot().isActive',\n\t},\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BrnInputOtpSlot {\n\t/** Access the input-otp component */\n\tprotected readonly _inputOtp = injectBrnInputOtp();\n\n\t/** The index of the slot to render the char or a fake caret */\n\tpublic readonly index = input.required<number, NumberInput>({ transform: numberAttribute });\n\n\tprotected readonly _slot = computed(() => this._inputOtp.context()[this.index()]);\n}\n","import { BrnInputOtp } from './lib/brn-input-otp';\nimport { BrnInputOtpSlot } from './lib/brn-input-otp-slot';\n\nexport * from './lib/brn-input-otp';\nexport * from './lib/brn-input-otp-slot';\n\nexport const BrnInputOtpImports = [BrnInputOtp, BrnInputOtpSlot] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGO,MAAM,gBAAgB,GAAG,IAAI,cAAc,CAAc,kBAAkB,CAAC;SAEnE,iBAAiB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,gBAAgB,CAAgB;AAC/C;AAEM,SAAU,kBAAkB,CAAC,QAA2B,EAAA;IAC7D,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW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A,EAAA,EAAA,EAAA,QAAA,EAZjB;;;;;;AAMT,CAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAMW,eAAe,EAAA,UAAA,EAAA,CAAA;kBAd3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,QAAQ,EAAE;;;;;;AAMT,CAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACL,wBAAA,oBAAoB,EAAE,kBAAkB;AACxC,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,iBAAA;;;MCXY,kBAAkB,GAAG,CAAC,WAAW,EAAE,eAAe;;ACN/D;;AAEG;;;;"}
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, inject, ElementRef, numberAttribute, booleanAttribute, signal, computed, Directive, contentChildren, output, model, NgZone, afterNextRender } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
let nextId$1 = 0;
|
|
6
|
+
class BrnResizablePanel {
|
|
7
|
+
/** Unique ID for the panel. */
|
|
8
|
+
id = input(`brn-resizable-panel-${++nextId$1}`);
|
|
9
|
+
/** Reference to the parent {@link BrnResizableGroup}. */
|
|
10
|
+
_panelGroup = inject(BrnResizableGroup);
|
|
11
|
+
/** Host DOM element reference. */
|
|
12
|
+
el = inject((ElementRef));
|
|
13
|
+
/**
|
|
14
|
+
* The default size of the panel (percentage of container space).
|
|
15
|
+
* - `undefined` → group decides initial size.
|
|
16
|
+
* - Number → interpreted as percentage (0–100).
|
|
17
|
+
*/
|
|
18
|
+
defaultSize = input(undefined, { transform: numberAttribute });
|
|
19
|
+
/** The minimum size this panel can shrink to (percentage). */
|
|
20
|
+
minSize = input(0, { transform: numberAttribute });
|
|
21
|
+
/** The maximum size this panel can grow to (percentage). */
|
|
22
|
+
maxSize = input(100, { transform: numberAttribute });
|
|
23
|
+
/** Whether this panel can be collapsed entirely. */
|
|
24
|
+
collapsible = input(true, { transform: booleanAttribute });
|
|
25
|
+
/** Reactive signal holding the current size of the panel. */
|
|
26
|
+
_panelSize = signal(100);
|
|
27
|
+
/**
|
|
28
|
+
* CSS flex style for this panel, derived from its current size.
|
|
29
|
+
* Format: `"flex-grow flex-shrink flex-basis"`.
|
|
30
|
+
*
|
|
31
|
+
* Example: `"25 1 0"` means 25% width (or height in vertical layout).
|
|
32
|
+
*/
|
|
33
|
+
_flex = computed(() => `${this._panelSize()} 1 0`);
|
|
34
|
+
/**
|
|
35
|
+
* Sets the size of the panel.
|
|
36
|
+
* @param size New size (percentage of container space).
|
|
37
|
+
*/
|
|
38
|
+
setSize(size) {
|
|
39
|
+
this._panelSize.set(size);
|
|
40
|
+
}
|
|
41
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnResizablePanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
42
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnResizablePanel, isStandalone: true, selector: "brn-resizable-panel, [brnResizablePanel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, defaultSize: { classPropertyName: "defaultSize", publicName: "defaultSize", isSignal: true, isRequired: false, transformFunction: null }, minSize: { classPropertyName: "minSize", publicName: "minSize", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-panel": "", "data-slot": "resizable-panel" }, properties: { "attr.data-panel-group-id": "_panelGroup.id()", "attr.data-panel-id": "id()", "attr.data-panel-size": "_panelSize()", "id": "id()", "style.flex": "_flex()", "style.overflow": "\"hidden\"" } }, exportAs: ["brnResizablePanel"], ngImport: i0 });
|
|
43
|
+
}
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnResizablePanel, decorators: [{
|
|
45
|
+
type: Directive,
|
|
46
|
+
args: [{
|
|
47
|
+
selector: 'brn-resizable-panel, [brnResizablePanel]',
|
|
48
|
+
exportAs: 'brnResizablePanel',
|
|
49
|
+
host: {
|
|
50
|
+
'[attr.data-panel-group-id]': '_panelGroup.id()',
|
|
51
|
+
'[attr.data-panel-id]': 'id()',
|
|
52
|
+
'[attr.data-panel-size]': '_panelSize()',
|
|
53
|
+
'[id]': 'id()',
|
|
54
|
+
'[style.flex]': '_flex()',
|
|
55
|
+
'[style.overflow]': '"hidden"',
|
|
56
|
+
'data-panel': '',
|
|
57
|
+
'data-slot': 'resizable-panel',
|
|
58
|
+
},
|
|
59
|
+
}]
|
|
60
|
+
}] });
|
|
61
|
+
|
|
62
|
+
let nextId = 0;
|
|
63
|
+
class BrnResizableGroup {
|
|
64
|
+
/** The id of the BrnResizableGroup */
|
|
65
|
+
id = input(`brn-resizable-group-${++nextId}`);
|
|
66
|
+
/** Host element reference. */
|
|
67
|
+
_el = inject((ElementRef));
|
|
68
|
+
/** Group orientation */
|
|
69
|
+
direction = input('horizontal');
|
|
70
|
+
/** @internal Access all the panels within the group */
|
|
71
|
+
panels = contentChildren(BrnResizablePanel);
|
|
72
|
+
/** event when resize starts */
|
|
73
|
+
dragStart = output();
|
|
74
|
+
/** event when resize ends */
|
|
75
|
+
dragEnd = output();
|
|
76
|
+
/** Resize panel group to the specified layout ([1 - 100, ...]). */
|
|
77
|
+
layout = model([]);
|
|
78
|
+
/** Called when group layout changes */
|
|
79
|
+
layoutChanged = output();
|
|
80
|
+
_document = inject(DOCUMENT);
|
|
81
|
+
_zone = inject(NgZone);
|
|
82
|
+
_resizeRaf = null;
|
|
83
|
+
_pendingSizes = null;
|
|
84
|
+
constructor() {
|
|
85
|
+
afterNextRender(() => {
|
|
86
|
+
this._initializePanelSizes();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
_initializePanelSizes() {
|
|
90
|
+
const panels = this.panels();
|
|
91
|
+
const totalPanels = panels.length;
|
|
92
|
+
if (totalPanels === 0)
|
|
93
|
+
return;
|
|
94
|
+
const sizes = [];
|
|
95
|
+
panels.forEach((panel, index) => {
|
|
96
|
+
const defaultSize = panel.defaultSize() ?? this.layout()[index];
|
|
97
|
+
const size = defaultSize !== undefined ? defaultSize : 100 / totalPanels;
|
|
98
|
+
sizes.push(size);
|
|
99
|
+
panel.setSize(size);
|
|
100
|
+
});
|
|
101
|
+
if (this.layout().toString() !== sizes.toString()) {
|
|
102
|
+
this._setLayout(sizes);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
startResize(handleIndex, event) {
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
const cursor = this.direction() === 'vertical' ? 'row-resize' : 'col-resize';
|
|
108
|
+
this._document.body.style.cursor = `${cursor}`;
|
|
109
|
+
const sizes = [...this.layout()];
|
|
110
|
+
this.dragStart.emit();
|
|
111
|
+
const startPosition = this._getEventPosition(event);
|
|
112
|
+
const startSizes = [...sizes];
|
|
113
|
+
const handleMove = (moveEvent) => {
|
|
114
|
+
this._zone.runOutsideAngular(() => {
|
|
115
|
+
this._handleResize(moveEvent, handleIndex, startPosition, startSizes);
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const handleEnd = () => {
|
|
119
|
+
this._zone.run(() => this._endResize());
|
|
120
|
+
this._document.body.style.cursor = 'default';
|
|
121
|
+
this._document.removeEventListener('mousemove', handleMove);
|
|
122
|
+
this._document.removeEventListener('touchmove', handleMove);
|
|
123
|
+
this._document.removeEventListener('mouseup', handleEnd);
|
|
124
|
+
this._document.removeEventListener('touchend', handleEnd);
|
|
125
|
+
};
|
|
126
|
+
this._zone.runOutsideAngular(() => {
|
|
127
|
+
this._document.addEventListener('mousemove', handleMove);
|
|
128
|
+
this._document.addEventListener('touchmove', handleMove);
|
|
129
|
+
this._document.addEventListener('mouseup', handleEnd);
|
|
130
|
+
this._document.addEventListener('touchend', handleEnd);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
_handleResize(event, handleIndex, startPosition, startSizes) {
|
|
134
|
+
const currentPosition = this._getEventPosition(event);
|
|
135
|
+
const delta = currentPosition - startPosition;
|
|
136
|
+
const containerSize = this._getContainerSize();
|
|
137
|
+
const deltaPercentage = (delta / containerSize) * 100;
|
|
138
|
+
const newSizes = [...startSizes];
|
|
139
|
+
const panels = this.panels();
|
|
140
|
+
const leftPanel = panels[handleIndex];
|
|
141
|
+
const rightPanel = panels[handleIndex + 1];
|
|
142
|
+
if (!leftPanel || !rightPanel)
|
|
143
|
+
return;
|
|
144
|
+
const leftMin = leftPanel.minSize();
|
|
145
|
+
const leftMax = leftPanel.maxSize();
|
|
146
|
+
const rightMin = rightPanel.minSize();
|
|
147
|
+
const rightMax = rightPanel.maxSize();
|
|
148
|
+
let newLeftSize = startSizes[handleIndex] + deltaPercentage;
|
|
149
|
+
let newRightSize = startSizes[handleIndex + 1] - deltaPercentage;
|
|
150
|
+
newLeftSize = Math.max(leftMin, Math.min(leftMax, newLeftSize));
|
|
151
|
+
newRightSize = Math.max(rightMin, Math.min(rightMax, newRightSize));
|
|
152
|
+
const totalSize = newLeftSize + newRightSize;
|
|
153
|
+
const originalTotal = startSizes[handleIndex] + startSizes[handleIndex + 1];
|
|
154
|
+
if (Math.abs(totalSize - originalTotal) < 0.01) {
|
|
155
|
+
newSizes[handleIndex] = newLeftSize;
|
|
156
|
+
newSizes[handleIndex + 1] = newRightSize;
|
|
157
|
+
// batch update
|
|
158
|
+
this._queueResize(newSizes);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
_queueResize(sizes) {
|
|
162
|
+
this._pendingSizes = sizes;
|
|
163
|
+
if (this._resizeRaf !== null)
|
|
164
|
+
return;
|
|
165
|
+
this._resizeRaf = requestAnimationFrame(() => {
|
|
166
|
+
this._resizeRaf = null;
|
|
167
|
+
if (this._pendingSizes) {
|
|
168
|
+
this._setLayout(this._pendingSizes);
|
|
169
|
+
this.updatePanelStyles();
|
|
170
|
+
this._pendingSizes = null;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
_endResize() {
|
|
175
|
+
if (this._resizeRaf !== null) {
|
|
176
|
+
cancelAnimationFrame(this._resizeRaf);
|
|
177
|
+
this._resizeRaf = null;
|
|
178
|
+
this._pendingSizes = null;
|
|
179
|
+
}
|
|
180
|
+
this.dragEnd.emit();
|
|
181
|
+
}
|
|
182
|
+
updatePanelStyles() {
|
|
183
|
+
const panels = this.panels();
|
|
184
|
+
const sizes = this.layout();
|
|
185
|
+
panels.forEach((panel, index) => {
|
|
186
|
+
const size = sizes[index];
|
|
187
|
+
if (size !== undefined) {
|
|
188
|
+
panel.setSize(size);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
_getEventPosition(event) {
|
|
193
|
+
const layout = this.direction();
|
|
194
|
+
if (event instanceof MouseEvent) {
|
|
195
|
+
return layout === 'vertical' ? event.clientY : event.clientX;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const touch = event.touches[0];
|
|
199
|
+
return layout === 'vertical' ? touch.clientY : touch.clientX;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
_getContainerSize() {
|
|
203
|
+
const element = this._el.nativeElement;
|
|
204
|
+
const layout = this.direction();
|
|
205
|
+
return layout === 'vertical' ? element.offsetHeight : element.offsetWidth;
|
|
206
|
+
}
|
|
207
|
+
collapsePanel(index) {
|
|
208
|
+
const panels = this.panels();
|
|
209
|
+
const panel = panels[index];
|
|
210
|
+
if (!panel || !panel.collapsible())
|
|
211
|
+
return;
|
|
212
|
+
const sizes = [...this.layout()];
|
|
213
|
+
const isCollapsed = sizes[index] === 0;
|
|
214
|
+
if (isCollapsed) {
|
|
215
|
+
const panelDefaultSize = panel.defaultSize();
|
|
216
|
+
const defaultSize = panelDefaultSize !== undefined ? panelDefaultSize / panels.length : 100 / panels.length;
|
|
217
|
+
sizes[index] = defaultSize;
|
|
218
|
+
const totalOthers = sizes.reduce((sum, size, i) => (i !== index ? sum + size : sum), 0);
|
|
219
|
+
const scale = (100 - defaultSize) / totalOthers;
|
|
220
|
+
sizes.forEach((size, i) => {
|
|
221
|
+
if (i !== index) {
|
|
222
|
+
sizes[i] = size * scale;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
const collapsedSize = sizes[index];
|
|
228
|
+
sizes[index] = 0;
|
|
229
|
+
const totalOthers = sizes.reduce((sum, size, i) => (i !== index ? sum + size : sum), 0);
|
|
230
|
+
const scale = (totalOthers + collapsedSize) / totalOthers;
|
|
231
|
+
sizes.forEach((size, i) => {
|
|
232
|
+
if (i !== index) {
|
|
233
|
+
sizes[i] = size * scale;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
this._setLayout(sizes);
|
|
238
|
+
this.updatePanelStyles();
|
|
239
|
+
}
|
|
240
|
+
_setLayout(sizes) {
|
|
241
|
+
this.layout.set(sizes);
|
|
242
|
+
this.layoutChanged.emit(sizes);
|
|
243
|
+
}
|
|
244
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnResizableGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
245
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnResizableGroup, isStandalone: true, selector: "brn-resizable-group, [brnResizableGroup]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dragStart: "dragStart", dragEnd: "dragEnd", layout: "layoutChange", layoutChanged: "layoutChanged" }, host: { attributes: { "data-panel-group": "", "data-slot": "resizable-panel-group" }, properties: { "attr.data-panel-group-direction": "direction()", "attr.data-panel-group-id": "id()", "id": "id()" } }, queries: [{ propertyName: "panels", predicate: BrnResizablePanel, isSignal: true }], exportAs: ["brnResizableGroup"], ngImport: i0 });
|
|
246
|
+
}
|
|
247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnResizableGroup, decorators: [{
|
|
248
|
+
type: Directive,
|
|
249
|
+
args: [{
|
|
250
|
+
selector: 'brn-resizable-group, [brnResizableGroup]',
|
|
251
|
+
exportAs: 'brnResizableGroup',
|
|
252
|
+
host: {
|
|
253
|
+
'[attr.data-panel-group-direction]': 'direction()',
|
|
254
|
+
'[attr.data-panel-group-id]': 'id()',
|
|
255
|
+
'[id]': 'id()',
|
|
256
|
+
'data-panel-group': '',
|
|
257
|
+
'data-slot': 'resizable-panel-group',
|
|
258
|
+
},
|
|
259
|
+
}]
|
|
260
|
+
}], ctorParameters: () => [] });
|
|
261
|
+
|
|
262
|
+
class BrnResizableHandle {
|
|
263
|
+
/** Parent resizable group. */
|
|
264
|
+
_resizable = inject(BrnResizableGroup);
|
|
265
|
+
/** Host element reference. */
|
|
266
|
+
_el = inject((ElementRef));
|
|
267
|
+
/** Whether a visual handle is rendered inside the separator. */
|
|
268
|
+
withHandle = input(false, { transform: booleanAttribute });
|
|
269
|
+
/** Whether the handle is disabled (not interactive). */
|
|
270
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
271
|
+
/** The direction of the resizable group (`horizontal` or `vertical`). */
|
|
272
|
+
_direction = this._resizable.direction;
|
|
273
|
+
/** Computed layout orientation based on the parent group. */
|
|
274
|
+
_layout = computed(() => this._resizable?.direction() || 'horizontal');
|
|
275
|
+
/** Index of this handle relative to panels in the group. */
|
|
276
|
+
_handleIndex = 0;
|
|
277
|
+
constructor() {
|
|
278
|
+
afterNextRender(() => {
|
|
279
|
+
this._handleIndex = this._getHandleIndex();
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
_getHandleIndex() {
|
|
283
|
+
const host = this._el.nativeElement;
|
|
284
|
+
const parent = host.parentElement;
|
|
285
|
+
if (!parent)
|
|
286
|
+
return -1;
|
|
287
|
+
// Collect all panels under this group
|
|
288
|
+
const panels = Array.from(parent.querySelectorAll('[data-slot="resizable-panel"]'));
|
|
289
|
+
// Find the previous panel (the closest one before this handle)
|
|
290
|
+
const prevPanel = host.previousElementSibling;
|
|
291
|
+
if (!prevPanel)
|
|
292
|
+
return -1;
|
|
293
|
+
// Return its index among all panels
|
|
294
|
+
return panels.indexOf(prevPanel);
|
|
295
|
+
}
|
|
296
|
+
_handleMouseDown(event) {
|
|
297
|
+
if (this.disabled() || !this._resizable)
|
|
298
|
+
return;
|
|
299
|
+
this._resizable.startResize(this._handleIndex, event);
|
|
300
|
+
}
|
|
301
|
+
_handleKeyDown(event) {
|
|
302
|
+
if (this.disabled())
|
|
303
|
+
return;
|
|
304
|
+
const panels = this._resizable.panels();
|
|
305
|
+
const handleIndex = this._handleIndex;
|
|
306
|
+
const layout = this._layout();
|
|
307
|
+
let delta = 0;
|
|
308
|
+
const step = event.shiftKey ? 10 : 1;
|
|
309
|
+
switch (event.key) {
|
|
310
|
+
case 'ArrowLeft':
|
|
311
|
+
if (layout === 'horizontal')
|
|
312
|
+
delta = -step;
|
|
313
|
+
break;
|
|
314
|
+
case 'ArrowRight':
|
|
315
|
+
if (layout === 'horizontal')
|
|
316
|
+
delta = step;
|
|
317
|
+
break;
|
|
318
|
+
case 'ArrowUp':
|
|
319
|
+
if (layout === 'vertical')
|
|
320
|
+
delta = -step;
|
|
321
|
+
break;
|
|
322
|
+
case 'ArrowDown':
|
|
323
|
+
if (layout === 'vertical')
|
|
324
|
+
delta = step;
|
|
325
|
+
break;
|
|
326
|
+
case 'Home':
|
|
327
|
+
event.preventDefault();
|
|
328
|
+
this._moveToExtreme(true);
|
|
329
|
+
return;
|
|
330
|
+
case 'End':
|
|
331
|
+
event.preventDefault();
|
|
332
|
+
this._moveToExtreme(false);
|
|
333
|
+
return;
|
|
334
|
+
case 'Enter':
|
|
335
|
+
case ' ':
|
|
336
|
+
event.preventDefault();
|
|
337
|
+
if (panels[handleIndex]?.collapsible() || panels[handleIndex + 1]?.collapsible()) {
|
|
338
|
+
const collapsibleIndex = panels[handleIndex]?.collapsible() ? handleIndex : handleIndex + 1;
|
|
339
|
+
this._resizable.collapsePanel(collapsibleIndex);
|
|
340
|
+
}
|
|
341
|
+
return;
|
|
342
|
+
default:
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (delta !== 0) {
|
|
346
|
+
event.preventDefault();
|
|
347
|
+
this._adjustSizes(delta);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
_getPanelContext() {
|
|
351
|
+
const panels = this._resizable.panels();
|
|
352
|
+
const li = this._handleIndex;
|
|
353
|
+
const ri = li + 1;
|
|
354
|
+
const left = panels[li];
|
|
355
|
+
const right = panels[ri];
|
|
356
|
+
if (!left || !right)
|
|
357
|
+
return null;
|
|
358
|
+
const sizes = [...this._resizable.layout()];
|
|
359
|
+
return {
|
|
360
|
+
sizes,
|
|
361
|
+
li,
|
|
362
|
+
ri,
|
|
363
|
+
left,
|
|
364
|
+
right,
|
|
365
|
+
leftMin: left.minSize(),
|
|
366
|
+
leftMax: left.maxSize(),
|
|
367
|
+
rightMin: right.minSize(),
|
|
368
|
+
rightMax: right.maxSize(),
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
_adjustSizes(delta) {
|
|
372
|
+
const ctx = this._getPanelContext();
|
|
373
|
+
if (!ctx)
|
|
374
|
+
return;
|
|
375
|
+
let newLeftSize = ctx.sizes[ctx.li] + delta;
|
|
376
|
+
let newRightSize = ctx.sizes[ctx.ri] - delta;
|
|
377
|
+
newLeftSize = Math.max(ctx.leftMin, Math.min(ctx.leftMax, newLeftSize));
|
|
378
|
+
newRightSize = Math.max(ctx.rightMin, Math.min(ctx.rightMax, newRightSize));
|
|
379
|
+
const totalSize = newLeftSize + newRightSize;
|
|
380
|
+
const originalTotal = ctx.sizes[ctx.li] + ctx.sizes[ctx.ri];
|
|
381
|
+
if (Math.abs(totalSize - originalTotal) < 0.01) {
|
|
382
|
+
ctx.sizes[ctx.li] = newLeftSize;
|
|
383
|
+
ctx.sizes[ctx.ri] = newRightSize;
|
|
384
|
+
this._resizable.layout.set(ctx.sizes);
|
|
385
|
+
this._resizable.updatePanelStyles();
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
_moveToExtreme(toMin) {
|
|
389
|
+
const ctx = this._getPanelContext();
|
|
390
|
+
if (!ctx)
|
|
391
|
+
return;
|
|
392
|
+
const totalSize = ctx.sizes[ctx.li] + ctx.sizes[ctx.ri];
|
|
393
|
+
if (toMin) {
|
|
394
|
+
ctx.sizes[ctx.li] = ctx.leftMin;
|
|
395
|
+
ctx.sizes[ctx.ri] = Math.min(totalSize - ctx.leftMin, ctx.rightMax);
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
ctx.sizes[ctx.li] = Math.min(totalSize - ctx.rightMin, ctx.leftMax);
|
|
399
|
+
ctx.sizes[ctx.ri] = ctx.rightMin;
|
|
400
|
+
}
|
|
401
|
+
this._resizable.layout.set(ctx.sizes);
|
|
402
|
+
this._resizable.updatePanelStyles();
|
|
403
|
+
}
|
|
404
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnResizableHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
405
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnResizableHandle, isStandalone: true, selector: "brn-resizable-handle, [brnResizeHandle]", inputs: { withHandle: { classPropertyName: "withHandle", publicName: "withHandle", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mousedown": "_handleMouseDown($event)", "keydown": "_handleKeyDown($event)" }, properties: { "attr.data-layout": "_layout()", "attr.tabindex": "disabled() ? null : 0", "attr.role": "\"separator\"", "attr.data-panel-group-direction": "_direction()", "attr.aria-orientation": "_layout() === \"vertical\" ? \"horizontal\" : \"vertical\"", "attr.aria-disabled": "disabled()" } }, exportAs: ["brnResizableHandle"], ngImport: i0 });
|
|
406
|
+
}
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnResizableHandle, decorators: [{
|
|
408
|
+
type: Directive,
|
|
409
|
+
args: [{
|
|
410
|
+
selector: 'brn-resizable-handle, [brnResizeHandle]',
|
|
411
|
+
exportAs: 'brnResizableHandle',
|
|
412
|
+
host: {
|
|
413
|
+
'[attr.data-layout]': '_layout()',
|
|
414
|
+
'[attr.tabindex]': 'disabled() ? null : 0',
|
|
415
|
+
'[attr.role]': '"separator"',
|
|
416
|
+
'[attr.data-panel-group-direction]': '_direction()',
|
|
417
|
+
'[attr.aria-orientation]': '_layout() === "vertical" ? "horizontal" : "vertical"',
|
|
418
|
+
'[attr.aria-disabled]': 'disabled()',
|
|
419
|
+
'(mousedown)': '_handleMouseDown($event)',
|
|
420
|
+
'(keydown)': '_handleKeyDown($event)',
|
|
421
|
+
},
|
|
422
|
+
}]
|
|
423
|
+
}], ctorParameters: () => [] });
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Generated bundle index. Do not edit.
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
export { BrnResizableGroup, BrnResizableHandle, BrnResizablePanel };
|
|
430
|
+
//# sourceMappingURL=spartan-ng-brain-resizable.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-resizable.mjs","sources":["../../../../libs/brain/resizable/src/lib/brn-resizable-panel.ts","../../../../libs/brain/resizable/src/lib/brn-resizable-group.ts","../../../../libs/brain/resizable/src/lib/brn-resizable-handle.ts","../../../../libs/brain/resizable/src/spartan-ng-brain-resizable.ts"],"sourcesContent":["import {\n\tbooleanAttribute,\n\tcomputed,\n\tDirective,\n\tElementRef,\n\tinject,\n\tinput,\n\tnumberAttribute,\n\tsignal,\n} from '@angular/core';\nimport { BrnResizableGroup } from './brn-resizable-group';\n\nlet nextId = 0;\n\n@Directive({\n\tselector: 'brn-resizable-panel, [brnResizablePanel]',\n\texportAs: 'brnResizablePanel',\n\thost: {\n\t\t'[attr.data-panel-group-id]': '_panelGroup.id()',\n\t\t'[attr.data-panel-id]': 'id()',\n\t\t'[attr.data-panel-size]': '_panelSize()',\n\t\t'[id]': 'id()',\n\t\t'[style.flex]': '_flex()',\n\t\t'[style.overflow]': '\"hidden\"',\n\t\t'data-panel': '',\n\t\t'data-slot': 'resizable-panel',\n\t},\n})\nexport class BrnResizablePanel {\n\t/** Unique ID for the panel. */\n\tpublic readonly id = input<string>(`brn-resizable-panel-${++nextId}`);\n\n\t/** Reference to the parent {@link BrnResizableGroup}. */\n\tprotected readonly _panelGroup = inject(BrnResizableGroup);\n\n\t/** Host DOM element reference. */\n\tpublic readonly el = inject(ElementRef<HTMLElement>);\n\n\t/**\n\t * The default size of the panel (percentage of container space).\n\t * - `undefined` → group decides initial size.\n\t * - Number → interpreted as percentage (0–100).\n\t */\n\tpublic readonly defaultSize = input(undefined, { transform: numberAttribute });\n\n\t/** The minimum size this panel can shrink to (percentage). */\n\n\tpublic readonly minSize = input(0, { transform: numberAttribute });\n\n\t/**\t The maximum size this panel can grow to (percentage). */\n\tpublic readonly maxSize = input(100, { transform: numberAttribute });\n\n\t/** Whether this panel can be collapsed entirely. */\n\tpublic readonly collapsible = input(true, { transform: booleanAttribute });\n\n\t/** Reactive signal holding the current size of the panel. */\n\tprotected readonly _panelSize = signal<number>(100);\n\n\t/**\n\t * CSS flex style for this panel, derived from its current size.\n\t * Format: `\"flex-grow flex-shrink flex-basis\"`.\n\t *\n\t * Example: `\"25 1 0\"` means 25% width (or height in vertical layout).\n\t */\n\tprotected readonly _flex = computed(() => `${this._panelSize()} 1 0`);\n\n\t/**\n\t * Sets the size of the panel.\n\t * @param size New size (percentage of container space).\n\t */\n\tpublic setSize(size: number) {\n\t\tthis._panelSize.set(size);\n\t}\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n\tafterNextRender,\n\tcontentChildren,\n\tDirective,\n\tElementRef,\n\tinject,\n\tinput,\n\tmodel,\n\tNgZone,\n\toutput,\n} from '@angular/core';\nimport { BrnResizablePanel } from './brn-resizable-panel';\n\nlet nextId = 0;\n\n@Directive({\n\tselector: 'brn-resizable-group, [brnResizableGroup]',\n\texportAs: 'brnResizableGroup',\n\thost: {\n\t\t'[attr.data-panel-group-direction]': 'direction()',\n\t\t'[attr.data-panel-group-id]': 'id()',\n\t\t'[id]': 'id()',\n\t\t'data-panel-group': '',\n\t\t'data-slot': 'resizable-panel-group',\n\t},\n})\nexport class BrnResizableGroup {\n\t/** The id of the BrnResizableGroup */\n\tpublic readonly id = input<string>(`brn-resizable-group-${++nextId}`);\n\n\t/** Host element reference. */\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\n\t/** Group orientation */\n\tpublic readonly direction = input<'horizontal' | 'vertical'>('horizontal');\n\n\t/** @internal Access all the panels within the group */\n\tpublic readonly panels = contentChildren(BrnResizablePanel);\n\n\t/** event when resize starts */\n\tpublic readonly dragStart = output<void>();\n\n\t/** event when resize ends */\n\tpublic readonly dragEnd = output<void>();\n\n\t/** Resize panel group to the specified layout ([1 - 100, ...]). */\n\tpublic readonly layout = model<number[]>([]);\n\n\t/** Called when group layout changes */\n\tpublic readonly layoutChanged = output<number[]>();\n\n\tprivate readonly _document = inject(DOCUMENT);\n\n\tprivate readonly _zone = inject(NgZone);\n\n\tprivate _resizeRaf: number | null = null;\n\n\tprivate _pendingSizes: number[] | null = null;\n\n\tconstructor() {\n\t\tafterNextRender(() => {\n\t\t\tthis._initializePanelSizes();\n\t\t});\n\t}\n\n\tprivate _initializePanelSizes(): void {\n\t\tconst panels = this.panels();\n\t\tconst totalPanels = panels.length;\n\n\t\tif (totalPanels === 0) return;\n\n\t\tconst sizes: number[] = [];\n\n\t\tpanels.forEach((panel, index) => {\n\t\t\tconst defaultSize = panel.defaultSize() ?? this.layout()[index];\n\t\t\tconst size = defaultSize !== undefined ? defaultSize : 100 / totalPanels;\n\t\t\tsizes.push(size);\n\t\t\tpanel.setSize(size);\n\t\t});\n\n\t\tif (this.layout().toString() !== sizes.toString()) {\n\t\t\tthis._setLayout(sizes);\n\t\t}\n\t}\n\n\tpublic startResize(handleIndex: number, event: MouseEvent | TouchEvent): void {\n\t\tevent.preventDefault();\n\n\t\tconst cursor = this.direction() === 'vertical' ? 'row-resize' : 'col-resize';\n\t\tthis._document.body.style.cursor = `${cursor}`;\n\t\tconst sizes = [...this.layout()];\n\t\tthis.dragStart.emit();\n\n\t\tconst startPosition = this._getEventPosition(event);\n\t\tconst startSizes = [...sizes];\n\n\t\tconst handleMove = (moveEvent: MouseEvent | TouchEvent) => {\n\t\t\tthis._zone.runOutsideAngular(() => {\n\t\t\t\tthis._handleResize(moveEvent, handleIndex, startPosition, startSizes);\n\t\t\t});\n\t\t};\n\n\t\tconst handleEnd = () => {\n\t\t\tthis._zone.run(() => this._endResize());\n\n\t\t\tthis._document.body.style.cursor = 'default';\n\t\t\tthis._document.removeEventListener('mousemove', handleMove);\n\t\t\tthis._document.removeEventListener('touchmove', handleMove);\n\t\t\tthis._document.removeEventListener('mouseup', handleEnd);\n\t\t\tthis._document.removeEventListener('touchend', handleEnd);\n\t\t};\n\n\t\tthis._zone.runOutsideAngular(() => {\n\t\t\tthis._document.addEventListener('mousemove', handleMove);\n\t\t\tthis._document.addEventListener('touchmove', handleMove);\n\t\t\tthis._document.addEventListener('mouseup', handleEnd);\n\t\t\tthis._document.addEventListener('touchend', handleEnd);\n\t\t});\n\t}\n\n\tprivate _handleResize(\n\t\tevent: MouseEvent | TouchEvent,\n\t\thandleIndex: number,\n\t\tstartPosition: number,\n\t\tstartSizes: number[],\n\t): void {\n\t\tconst currentPosition = this._getEventPosition(event);\n\t\tconst delta = currentPosition - startPosition;\n\t\tconst containerSize = this._getContainerSize();\n\t\tconst deltaPercentage = (delta / containerSize) * 100;\n\n\t\tconst newSizes = [...startSizes];\n\t\tconst panels = this.panels();\n\n\t\tconst leftPanel = panels[handleIndex];\n\t\tconst rightPanel = panels[handleIndex + 1];\n\n\t\tif (!leftPanel || !rightPanel) return;\n\n\t\tconst leftMin = leftPanel.minSize();\n\t\tconst leftMax = leftPanel.maxSize();\n\t\tconst rightMin = rightPanel.minSize();\n\t\tconst rightMax = rightPanel.maxSize();\n\n\t\tlet newLeftSize = startSizes[handleIndex] + deltaPercentage;\n\t\tlet newRightSize = startSizes[handleIndex + 1] - deltaPercentage;\n\n\t\tnewLeftSize = Math.max(leftMin, Math.min(leftMax, newLeftSize));\n\t\tnewRightSize = Math.max(rightMin, Math.min(rightMax, newRightSize));\n\n\t\tconst totalSize = newLeftSize + newRightSize;\n\t\tconst originalTotal = startSizes[handleIndex] + startSizes[handleIndex + 1];\n\n\t\tif (Math.abs(totalSize - originalTotal) < 0.01) {\n\t\t\tnewSizes[handleIndex] = newLeftSize;\n\t\t\tnewSizes[handleIndex + 1] = newRightSize;\n\n\t\t\t// batch update\n\t\t\tthis._queueResize(newSizes);\n\t\t}\n\t}\n\n\tprivate _queueResize(sizes: number[]): void {\n\t\tthis._pendingSizes = sizes;\n\n\t\tif (this._resizeRaf !== null) return;\n\n\t\tthis._resizeRaf = requestAnimationFrame(() => {\n\t\t\tthis._resizeRaf = null;\n\t\t\tif (this._pendingSizes) {\n\t\t\t\tthis._setLayout(this._pendingSizes);\n\t\t\t\tthis.updatePanelStyles();\n\t\t\t\tthis._pendingSizes = null;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _endResize(): void {\n\t\tif (this._resizeRaf !== null) {\n\t\t\tcancelAnimationFrame(this._resizeRaf);\n\t\t\tthis._resizeRaf = null;\n\t\t\tthis._pendingSizes = null;\n\t\t}\n\t\tthis.dragEnd.emit();\n\t}\n\n\tpublic updatePanelStyles(): void {\n\t\tconst panels = this.panels();\n\t\tconst sizes = this.layout();\n\n\t\tpanels.forEach((panel, index) => {\n\t\t\tconst size = sizes[index];\n\t\t\tif (size !== undefined) {\n\t\t\t\tpanel.setSize(size);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _getEventPosition(event: MouseEvent | TouchEvent): number {\n\t\tconst layout = this.direction();\n\t\tif (event instanceof MouseEvent) {\n\t\t\treturn layout === 'vertical' ? event.clientY : event.clientX;\n\t\t} else {\n\t\t\tconst touch = event.touches[0];\n\t\t\treturn layout === 'vertical' ? touch.clientY : touch.clientX;\n\t\t}\n\t}\n\n\tprivate _getContainerSize(): number {\n\t\tconst element = this._el.nativeElement as HTMLElement;\n\t\tconst layout = this.direction();\n\t\treturn layout === 'vertical' ? element.offsetHeight : element.offsetWidth;\n\t}\n\n\tpublic collapsePanel(index: number): void {\n\t\tconst panels = this.panels();\n\t\tconst panel = panels[index];\n\n\t\tif (!panel || !panel.collapsible()) return;\n\n\t\tconst sizes = [...this.layout()];\n\t\tconst isCollapsed = sizes[index] === 0;\n\n\t\tif (isCollapsed) {\n\t\t\tconst panelDefaultSize = panel.defaultSize();\n\t\t\tconst defaultSize = panelDefaultSize !== undefined ? panelDefaultSize / panels.length : 100 / panels.length;\n\t\t\tsizes[index] = defaultSize;\n\n\t\t\tconst totalOthers = sizes.reduce((sum, size, i) => (i !== index ? sum + size : sum), 0);\n\t\t\tconst scale = (100 - defaultSize) / totalOthers;\n\n\t\t\tsizes.forEach((size, i) => {\n\t\t\t\tif (i !== index) {\n\t\t\t\t\tsizes[i] = size * scale;\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tconst collapsedSize = sizes[index];\n\t\t\tsizes[index] = 0;\n\n\t\t\tconst totalOthers = sizes.reduce((sum, size, i) => (i !== index ? sum + size : sum), 0);\n\t\t\tconst scale = (totalOthers + collapsedSize) / totalOthers;\n\n\t\t\tsizes.forEach((size, i) => {\n\t\t\t\tif (i !== index) {\n\t\t\t\t\tsizes[i] = size * scale;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tthis._setLayout(sizes);\n\t\tthis.updatePanelStyles();\n\t}\n\n\tprivate _setLayout(sizes: number[]): void {\n\t\tthis.layout.set(sizes);\n\t\tthis.layoutChanged.emit(sizes);\n\t}\n}\n","import { afterNextRender, booleanAttribute, computed, Directive, ElementRef, inject, input } from '@angular/core';\n\nimport { BrnResizableGroup } from './brn-resizable-group';\n\n@Directive({\n\tselector: 'brn-resizable-handle, [brnResizeHandle]',\n\texportAs: 'brnResizableHandle',\n\thost: {\n\t\t'[attr.data-layout]': '_layout()',\n\t\t'[attr.tabindex]': 'disabled() ? null : 0',\n\t\t'[attr.role]': '\"separator\"',\n\t\t'[attr.data-panel-group-direction]': '_direction()',\n\t\t'[attr.aria-orientation]': '_layout() === \"vertical\" ? \"horizontal\" : \"vertical\"',\n\t\t'[attr.aria-disabled]': 'disabled()',\n\t\t'(mousedown)': '_handleMouseDown($event)',\n\t\t'(keydown)': '_handleKeyDown($event)',\n\t},\n})\nexport class BrnResizableHandle {\n\t/** Parent resizable group. */\n\tprivate readonly _resizable = inject(BrnResizableGroup);\n\n\t/** Host element reference. */\n\tprivate readonly _el = inject(ElementRef<HTMLElement>);\n\n\t/** Whether a visual handle is rendered inside the separator. */\n\tpublic readonly withHandle = input(false, { transform: booleanAttribute });\n\n\t/** Whether the handle is disabled (not interactive). */\n\tpublic readonly disabled = input(false, { transform: booleanAttribute });\n\n\t/** The direction of the resizable group (`horizontal` or `vertical`). */\n\tprotected readonly _direction = this._resizable.direction;\n\n\t/** Computed layout orientation based on the parent group. */\n\tprotected readonly _layout = computed(() => this._resizable?.direction() || 'horizontal');\n\n\t/** Index of this handle relative to panels in the group. */\n\tprivate _handleIndex = 0;\n\n\tconstructor() {\n\t\tafterNextRender(() => {\n\t\t\tthis._handleIndex = this._getHandleIndex();\n\t\t});\n\t}\n\n\tprivate _getHandleIndex(): number {\n\t\tconst host = this._el.nativeElement;\n\t\tconst parent = host.parentElement;\n\t\tif (!parent) return -1;\n\n\t\t// Collect all panels under this group\n\t\tconst panels = Array.from(parent.querySelectorAll('[data-slot=\"resizable-panel\"]'));\n\n\t\t// Find the previous panel (the closest one before this handle)\n\t\tconst prevPanel = host.previousElementSibling;\n\t\tif (!prevPanel) return -1;\n\n\t\t// Return its index among all panels\n\t\treturn panels.indexOf(prevPanel as HTMLElement);\n\t}\n\n\tprotected _handleMouseDown(event: MouseEvent): void {\n\t\tif (this.disabled() || !this._resizable) return;\n\t\tthis._resizable.startResize(this._handleIndex, event);\n\t}\n\n\tprotected _handleKeyDown(event: KeyboardEvent): void {\n\t\tif (this.disabled()) return;\n\n\t\tconst panels = this._resizable.panels();\n\t\tconst handleIndex = this._handleIndex;\n\t\tconst layout = this._layout();\n\n\t\tlet delta = 0;\n\t\tconst step = event.shiftKey ? 10 : 1;\n\n\t\tswitch (event.key) {\n\t\t\tcase 'ArrowLeft':\n\t\t\t\tif (layout === 'horizontal') delta = -step;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowRight':\n\t\t\t\tif (layout === 'horizontal') delta = step;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\tif (layout === 'vertical') delta = -step;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\tif (layout === 'vertical') delta = step;\n\t\t\t\tbreak;\n\t\t\tcase 'Home':\n\t\t\t\tevent.preventDefault();\n\t\t\t\tthis._moveToExtreme(true);\n\t\t\t\treturn;\n\t\t\tcase 'End':\n\t\t\t\tevent.preventDefault();\n\t\t\t\tthis._moveToExtreme(false);\n\t\t\t\treturn;\n\t\t\tcase 'Enter':\n\t\t\tcase ' ':\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif (panels[handleIndex]?.collapsible() || panels[handleIndex + 1]?.collapsible()) {\n\t\t\t\t\tconst collapsibleIndex = panels[handleIndex]?.collapsible() ? handleIndex : handleIndex + 1;\n\t\t\t\t\tthis._resizable.collapsePanel(collapsibleIndex);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\tif (delta !== 0) {\n\t\t\tevent.preventDefault();\n\t\t\tthis._adjustSizes(delta);\n\t\t}\n\t}\n\n\tprivate _getPanelContext() {\n\t\tconst panels = this._resizable.panels();\n\t\tconst li = this._handleIndex;\n\t\tconst ri = li + 1;\n\n\t\tconst left = panels[li];\n\t\tconst right = panels[ri];\n\t\tif (!left || !right) return null;\n\n\t\tconst sizes = [...this._resizable.layout()];\n\n\t\treturn {\n\t\t\tsizes,\n\t\t\tli,\n\t\t\tri,\n\t\t\tleft,\n\t\t\tright,\n\t\t\tleftMin: left.minSize(),\n\t\t\tleftMax: left.maxSize(),\n\t\t\trightMin: right.minSize(),\n\t\t\trightMax: right.maxSize(),\n\t\t};\n\t}\n\n\tprivate _adjustSizes(delta: number): void {\n\t\tconst ctx = this._getPanelContext();\n\t\tif (!ctx) return;\n\n\t\tlet newLeftSize = ctx.sizes[ctx.li] + delta;\n\t\tlet newRightSize = ctx.sizes[ctx.ri] - delta;\n\n\t\tnewLeftSize = Math.max(ctx.leftMin, Math.min(ctx.leftMax, newLeftSize));\n\t\tnewRightSize = Math.max(ctx.rightMin, Math.min(ctx.rightMax, newRightSize));\n\n\t\tconst totalSize = newLeftSize + newRightSize;\n\t\tconst originalTotal = ctx.sizes[ctx.li] + ctx.sizes[ctx.ri];\n\n\t\tif (Math.abs(totalSize - originalTotal) < 0.01) {\n\t\t\tctx.sizes[ctx.li] = newLeftSize;\n\t\t\tctx.sizes[ctx.ri] = newRightSize;\n\n\t\t\tthis._resizable.layout.set(ctx.sizes);\n\t\t\tthis._resizable.updatePanelStyles();\n\t\t}\n\t}\n\n\tprivate _moveToExtreme(toMin: boolean): void {\n\t\tconst ctx = this._getPanelContext();\n\t\tif (!ctx) return;\n\n\t\tconst totalSize = ctx.sizes[ctx.li] + ctx.sizes[ctx.ri];\n\n\t\tif (toMin) {\n\t\t\tctx.sizes[ctx.li] = ctx.leftMin;\n\t\t\tctx.sizes[ctx.ri] = Math.min(totalSize - ctx.leftMin, ctx.rightMax);\n\t\t} else {\n\t\t\tctx.sizes[ctx.li] = Math.min(totalSize - ctx.rightMin, ctx.leftMax);\n\t\t\tctx.sizes[ctx.ri] = ctx.rightMin;\n\t\t}\n\n\t\tthis._resizable.layout.set(ctx.sizes);\n\t\tthis._resizable.updatePanelStyles();\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["nextId"],"mappings":";;;;AAYA,IAAIA,QAAM,GAAG,CAAC;MAgBD,iBAAiB,CAAA;;IAEb,EAAE,GAAG,KAAK,CAAS,CAAA,oBAAA,EAAuB,EAAEA,QAAM,CAAA,CAAE,CAAC;;AAGlD,IAAA,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC;;AAG1C,IAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC;AAEpD;;;;AAIG;IACa,WAAW,GAAG,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;IAI9D,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;IAGlD,OAAO,GAAG,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;IAGpD,WAAW,GAAG,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;;AAGvD,IAAA,UAAU,GAAG,MAAM,CAAS,GAAG,CAAC;AAEnD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AAE,cAAc;AACnD,wBAAA,yBAAyB,EAAE,sDAAsD;AACjF,wBAAA,sBAAsB,EAAE,YAAY;AACpC,wBAAA,aAAa,EAAE,0BAA0B;AACzC,wBAAA,WAAW,EAAE,wBAAwB;AACrC,qBAAA;AACD,iBAAA;;;ACjBD;;AAEG;;;;"}
|
package/hlm-tailwind-preset.css
CHANGED
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
--radius-lg: var(--radius);
|
|
38
38
|
--radius-xl: calc(var(--radius) + 4px);
|
|
39
39
|
--animate-indeterminate: indeterminate 4s ease-in-out infinite;
|
|
40
|
-
}
|
|
41
40
|
|
|
42
|
-
@keyframes indeterminate {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
@keyframes indeterminate {
|
|
42
|
+
0% {
|
|
43
|
+
transform: translateX(-100%) scaleX(0.5);
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
transform: translateX(100%) scaleX(0.5);
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -20,6 +20,7 @@ export declare class BrnInputOtp implements ControlValueAccessor {
|
|
|
20
20
|
readonly containerStyles: import("@angular/core").InputSignal<string>;
|
|
21
21
|
/** Determine if the date picker is disabled. */
|
|
22
22
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
23
|
+
protected readonly _disabled: import("@angular/core").WritableSignal<boolean>;
|
|
23
24
|
/** The number of slots. */
|
|
24
25
|
readonly maxLength: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
|
|
25
26
|
/** Virtual keyboard appearance on mobile */
|
|
@@ -44,9 +45,6 @@ export declare class BrnInputOtp implements ControlValueAccessor {
|
|
|
44
45
|
}[]>;
|
|
45
46
|
/** Emitted when the input is complete, triggered through input or paste. */
|
|
46
47
|
readonly completed: import("@angular/core").OutputEmitterRef<string>;
|
|
47
|
-
protected readonly _state: import("@angular/core").Signal<{
|
|
48
|
-
disabled: import("@angular/core").WritableSignal<boolean>;
|
|
49
|
-
}>;
|
|
50
48
|
protected _onChange?: ChangeFn<string>;
|
|
51
49
|
protected _onTouched?: TouchFn;
|
|
52
50
|
protected onInputChange(event: Event): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spartan-ng/brain",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.537",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./hlm-tailwind-preset": {
|
|
@@ -102,6 +102,10 @@
|
|
|
102
102
|
"types": "./radio-group/index.d.ts",
|
|
103
103
|
"default": "./fesm2022/spartan-ng-brain-radio-group.mjs"
|
|
104
104
|
},
|
|
105
|
+
"./resizable": {
|
|
106
|
+
"types": "./resizable/index.d.ts",
|
|
107
|
+
"default": "./fesm2022/spartan-ng-brain-resizable.mjs"
|
|
108
|
+
},
|
|
105
109
|
"./select": {
|
|
106
110
|
"types": "./select/index.d.ts",
|
|
107
111
|
"default": "./fesm2022/spartan-ng-brain-select.mjs"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BrnResizablePanel } from './brn-resizable-panel';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class BrnResizableGroup {
|
|
4
|
+
/** The id of the BrnResizableGroup */
|
|
5
|
+
readonly id: import("@angular/core").InputSignal<string>;
|
|
6
|
+
/** Host element reference. */
|
|
7
|
+
private readonly _el;
|
|
8
|
+
/** Group orientation */
|
|
9
|
+
readonly direction: import("@angular/core").InputSignal<"horizontal" | "vertical">;
|
|
10
|
+
/** @internal Access all the panels within the group */
|
|
11
|
+
readonly panels: import("@angular/core").Signal<readonly BrnResizablePanel[]>;
|
|
12
|
+
/** event when resize starts */
|
|
13
|
+
readonly dragStart: import("@angular/core").OutputEmitterRef<void>;
|
|
14
|
+
/** event when resize ends */
|
|
15
|
+
readonly dragEnd: import("@angular/core").OutputEmitterRef<void>;
|
|
16
|
+
/** Resize panel group to the specified layout ([1 - 100, ...]). */
|
|
17
|
+
readonly layout: import("@angular/core").ModelSignal<number[]>;
|
|
18
|
+
/** Called when group layout changes */
|
|
19
|
+
readonly layoutChanged: import("@angular/core").OutputEmitterRef<number[]>;
|
|
20
|
+
private readonly _document;
|
|
21
|
+
private readonly _zone;
|
|
22
|
+
private _resizeRaf;
|
|
23
|
+
private _pendingSizes;
|
|
24
|
+
constructor();
|
|
25
|
+
private _initializePanelSizes;
|
|
26
|
+
startResize(handleIndex: number, event: MouseEvent | TouchEvent): void;
|
|
27
|
+
private _handleResize;
|
|
28
|
+
private _queueResize;
|
|
29
|
+
private _endResize;
|
|
30
|
+
updatePanelStyles(): void;
|
|
31
|
+
private _getEventPosition;
|
|
32
|
+
private _getContainerSize;
|
|
33
|
+
collapsePanel(index: number): void;
|
|
34
|
+
private _setLayout;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnResizableGroup, never>;
|
|
36
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnResizableGroup, "brn-resizable-group, [brnResizableGroup]", ["brnResizableGroup"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; }, { "dragStart": "dragStart"; "dragEnd": "dragEnd"; "layout": "layoutChange"; "layoutChanged": "layoutChanged"; }, ["panels"], never, true, never>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class BrnResizableHandle {
|
|
3
|
+
/** Parent resizable group. */
|
|
4
|
+
private readonly _resizable;
|
|
5
|
+
/** Host element reference. */
|
|
6
|
+
private readonly _el;
|
|
7
|
+
/** Whether a visual handle is rendered inside the separator. */
|
|
8
|
+
readonly withHandle: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
9
|
+
/** Whether the handle is disabled (not interactive). */
|
|
10
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
11
|
+
/** The direction of the resizable group (`horizontal` or `vertical`). */
|
|
12
|
+
protected readonly _direction: import("@angular/core").InputSignal<"horizontal" | "vertical">;
|
|
13
|
+
/** Computed layout orientation based on the parent group. */
|
|
14
|
+
protected readonly _layout: import("@angular/core").Signal<"horizontal" | "vertical">;
|
|
15
|
+
/** Index of this handle relative to panels in the group. */
|
|
16
|
+
private _handleIndex;
|
|
17
|
+
constructor();
|
|
18
|
+
private _getHandleIndex;
|
|
19
|
+
protected _handleMouseDown(event: MouseEvent): void;
|
|
20
|
+
protected _handleKeyDown(event: KeyboardEvent): void;
|
|
21
|
+
private _getPanelContext;
|
|
22
|
+
private _adjustSizes;
|
|
23
|
+
private _moveToExtreme;
|
|
24
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnResizableHandle, never>;
|
|
25
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnResizableHandle, "brn-resizable-handle, [brnResizeHandle]", ["brnResizableHandle"], { "withHandle": { "alias": "withHandle"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
2
|
+
import { BrnResizableGroup } from './brn-resizable-group';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class BrnResizablePanel {
|
|
5
|
+
/** Unique ID for the panel. */
|
|
6
|
+
readonly id: import("@angular/core").InputSignal<string>;
|
|
7
|
+
/** Reference to the parent {@link BrnResizableGroup}. */
|
|
8
|
+
protected readonly _panelGroup: BrnResizableGroup;
|
|
9
|
+
/** Host DOM element reference. */
|
|
10
|
+
readonly el: ElementRef<any>;
|
|
11
|
+
/**
|
|
12
|
+
* The default size of the panel (percentage of container space).
|
|
13
|
+
* - `undefined` → group decides initial size.
|
|
14
|
+
* - Number → interpreted as percentage (0–100).
|
|
15
|
+
*/
|
|
16
|
+
readonly defaultSize: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
17
|
+
/** The minimum size this panel can shrink to (percentage). */
|
|
18
|
+
readonly minSize: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
19
|
+
/** The maximum size this panel can grow to (percentage). */
|
|
20
|
+
readonly maxSize: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
21
|
+
/** Whether this panel can be collapsed entirely. */
|
|
22
|
+
readonly collapsible: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
23
|
+
/** Reactive signal holding the current size of the panel. */
|
|
24
|
+
protected readonly _panelSize: import("@angular/core").WritableSignal<number>;
|
|
25
|
+
/**
|
|
26
|
+
* CSS flex style for this panel, derived from its current size.
|
|
27
|
+
* Format: `"flex-grow flex-shrink flex-basis"`.
|
|
28
|
+
*
|
|
29
|
+
* Example: `"25 1 0"` means 25% width (or height in vertical layout).
|
|
30
|
+
*/
|
|
31
|
+
protected readonly _flex: import("@angular/core").Signal<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the size of the panel.
|
|
34
|
+
* @param size New size (percentage of container space).
|
|
35
|
+
*/
|
|
36
|
+
setSize(size: number): void;
|
|
37
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnResizablePanel, never>;
|
|
38
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnResizablePanel, "brn-resizable-panel, [brnResizablePanel]", ["brnResizablePanel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "defaultSize": { "alias": "defaultSize"; "required": false; "isSignal": true; }; "minSize": { "alias": "minSize"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
39
|
+
}
|