@radix-ng/primitives 0.39.5 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/src/date-time/formatter.d.ts +1 -1
- package/core/src/date-time/types.d.ts +13 -0
- package/core/src/date-time/useDateField.d.ts +4 -3
- package/core/src/date-time/utils.d.ts +4 -1
- package/date-field/src/date-field-context.token.d.ts +2 -1
- package/date-field/src/date-field-root.directive.d.ts +7 -2
- package/dismissible-layer/README.md +1 -0
- package/dismissible-layer/index.d.ts +1 -0
- package/dismissible-layer/src/utils.d.ts +38 -0
- package/editable/README.md +1 -0
- package/editable/index.d.ts +1 -0
- package/editable/src/editable-root.d.ts +67 -0
- package/fesm2022/radix-ng-primitives-core.mjs +88 -46
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-date-field.mjs +11 -3
- package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dismissible-layer.mjs +211 -0
- package/fesm2022/radix-ng-primitives-dismissible-layer.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-editable.mjs +118 -0
- package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-number-field.mjs +7 -7
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +12 -4
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
- package/hover-card/src/hover-card-root.directive.d.ts +4 -4
- package/package.json +11 -3
- package/popover/src/popover-root.directive.d.ts +4 -4
- package/time-field/src/time-field-context.token.d.ts +2 -1
- package/time-field/src/time-field-root.directive.d.ts +7 -2
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { InjectionToken, inject, input, computed, signal, effect, Directive, ElementRef, model, booleanAttribute, NgModule } from '@angular/core';
|
3
|
-
import { useDateField, getDefaultDate, hasTime, isBefore, createContent, watch, isNullish, createFormatter, initializeSegmentValues, syncSegmentValues, getSegmentElements, ARROW_LEFT, ARROW_RIGHT, isSegmentNavigationKey, provideToken } from '@radix-ng/primitives/core';
|
3
|
+
import { useDateField, normalizeDateStep, getDefaultDate, hasTime, isBefore, createContent, watch, isNullish, createFormatter, normalizeHourCycle, initializeSegmentValues, syncSegmentValues, getSegmentElements, ARROW_LEFT, ARROW_RIGHT, isSegmentNavigationKey, provideToken } from '@radix-ng/primitives/core';
|
4
4
|
|
5
5
|
const DATE_FIELDS_ROOT_CONTEXT = new InjectionToken('DATE_FIELDS_ROOT_CONTEXT');
|
6
6
|
function injectDateFieldsRootContext() {
|
@@ -47,6 +47,7 @@ class RdxDateFieldInputDirective {
|
|
47
47
|
part: this.part(),
|
48
48
|
disabled: this.rootContext.disabled,
|
49
49
|
readonly: this.rootContext.readonly,
|
50
|
+
step: this.rootContext.step$,
|
50
51
|
modelValue: this.rootContext.value,
|
51
52
|
focusNext: this.rootContext.focusNext
|
52
53
|
});
|
@@ -140,6 +141,11 @@ class RdxDateFieldRootDirective {
|
|
140
141
|
* Whether or not the field is readonly.
|
141
142
|
*/
|
142
143
|
this.readonly = input(false, { transform: booleanAttribute });
|
144
|
+
/**
|
145
|
+
* The stepping interval for the time fields. Defaults to 1
|
146
|
+
*/
|
147
|
+
this.step = input();
|
148
|
+
this.step$ = computed(() => normalizeDateStep(this.step()));
|
143
149
|
/**
|
144
150
|
* @ignore
|
145
151
|
*/
|
@@ -260,7 +266,9 @@ class RdxDateFieldRootDirective {
|
|
260
266
|
locale: this.locale()
|
261
267
|
});
|
262
268
|
this.placeholder.set(defDate.copy());
|
263
|
-
this.formatter = createFormatter(this.locale()
|
269
|
+
this.formatter = createFormatter(this.locale(), {
|
270
|
+
hourCycle: normalizeHourCycle(this.hourCycle())
|
271
|
+
});
|
264
272
|
const initialSegments = initializeSegmentValues(this.inferredGranularity());
|
265
273
|
this.segmentValues.set(this.value()
|
266
274
|
? { ...syncSegmentValues({ value: this.value(), formatter: this.formatter }) }
|
@@ -292,7 +300,7 @@ class RdxDateFieldRootDirective {
|
|
292
300
|
this.currentFocusedElement.set(el);
|
293
301
|
}
|
294
302
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxDateFieldRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
295
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxDateFieldRootDirective, isStandalone: true, selector: "[rdxDateFieldRoot]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, hourCycle: { classPropertyName: "hourCycle", publicName: "hourCycle", isSignal: true, isRequired: false, transformFunction: null }, granularity: { classPropertyName: "granularity", publicName: "granularity", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, hideTimeZone: { classPropertyName: "hideTimeZone", publicName: "hideTimeZone", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", placeholder: "placeholderChange" }, host: { attributes: { "role": "group" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.aria-disabled": "disabled() ? \"\" : undefined", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-readonly": "readonly() ? \"\" : undefined", "attr.data-invalid": "isInvalid() ? \"\" : undefined", "attr.dir": "dir()" } }, providers: [provideToken(DATE_FIELDS_ROOT_CONTEXT, RdxDateFieldRootDirective)], exportAs: ["rdxDateFieldRoot"], ngImport: i0 }); }
|
303
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxDateFieldRootDirective, isStandalone: true, selector: "[rdxDateFieldRoot]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, isDateUnavailable: { classPropertyName: "isDateUnavailable", publicName: "isDateUnavailable", isSignal: true, isRequired: false, transformFunction: null }, hourCycle: { classPropertyName: "hourCycle", publicName: "hourCycle", isSignal: true, isRequired: false, transformFunction: null }, granularity: { classPropertyName: "granularity", publicName: "granularity", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, hideTimeZone: { classPropertyName: "hideTimeZone", publicName: "hideTimeZone", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", placeholder: "placeholderChange" }, host: { attributes: { "role": "group" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.aria-disabled": "disabled() ? \"\" : undefined", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-readonly": "readonly() ? \"\" : undefined", "attr.data-invalid": "isInvalid() ? \"\" : undefined", "attr.dir": "dir()" } }, providers: [provideToken(DATE_FIELDS_ROOT_CONTEXT, RdxDateFieldRootDirective)], exportAs: ["rdxDateFieldRoot"], ngImport: i0 }); }
|
296
304
|
}
|
297
305
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxDateFieldRootDirective, decorators: [{
|
298
306
|
type: Directive,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-date-field.mjs","sources":["../../../packages/primitives/date-field/src/date-field-context.token.ts","../../../packages/primitives/date-field/src/date-field-input.directive.ts","../../../packages/primitives/date-field/src/date-field-root.directive.ts","../../../packages/primitives/date-field/index.ts","../../../packages/primitives/date-field/radix-ng-primitives-date-field.ts"],"sourcesContent":["import { inject, InjectionToken, InputSignal, ModelSignal, Signal, WritableSignal } from '@angular/core';\nimport { DateValue } from '@internationalized/date';\nimport { Formatter, HourCycle, SegmentValueObj } from '@radix-ng/primitives/core';\n\nexport interface DateFieldContextToken {\n locale: InputSignal<string>;\n value: ModelSignal<DateValue | undefined>;\n disabled: InputSignal<boolean>;\n readonly: InputSignal<boolean>;\n isInvalid: Signal<boolean>;\n placeholder: ModelSignal<DateValue>;\n hourCycle: InputSignal<HourCycle>;\n formatter: Formatter;\n segmentValues: WritableSignal<SegmentValueObj>;\n focusNext: () => void;\n setFocusedElement: (el: HTMLElement) => void;\n}\n\nexport const DATE_FIELDS_ROOT_CONTEXT = new InjectionToken<DateFieldContextToken>('DATE_FIELDS_ROOT_CONTEXT');\n\nexport function injectDateFieldsRootContext(): DateFieldContextToken {\n return inject(DATE_FIELDS_ROOT_CONTEXT);\n}\n","import { computed, Directive, effect, ElementRef, input, signal } from '@angular/core';\nimport { SegmentPart, useDateField } from '@radix-ng/primitives/core';\nimport { injectDateFieldsRootContext } from './date-field-context.token';\n\n@Directive({\n selector: '[rdxDateFieldInput]',\n host: {\n '[attr.contenteditable]': 'disabled() || readonly() ? false : part() !== \"literal\"',\n '[attr.data-rdx-date-field-segment]': 'part()',\n '[attr.aria-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-invalid]': 'isInvalid() ? \"\" : undefined',\n '[attr.aria-invalid]': 'isInvalid() ? true : undefined',\n\n '(mousedown)': 'part() !== \"literal\" && handleSegmentClick($event)',\n '(keydown)': 'part() !== \"literal\" && handleSegmentKeydown($event)',\n '(focus)': 'part() !== \"literal\" && onFocus($event)',\n '(focusout)': 'part() !== \"literal\" && onFocusOut()'\n }\n})\nexport class RdxDateFieldInputDirective {\n private readonly rootContext = injectDateFieldsRootContext();\n\n /**\n * The part of the date to render\n * `'day' | 'month' | 'year' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'literal' | 'timeZoneName'`\n */\n readonly part = input<SegmentPart>();\n\n /**\n * @ignore\n */\n readonly disabled = computed(() => this.rootContext.disabled());\n\n /**\n * @ignore\n */\n readonly readonly = computed(() => this.rootContext.readonly());\n\n /**\n * @ignore\n */\n readonly isInvalid = computed(() => this.rootContext.isInvalid());\n\n /**\n * @ignore\n */\n readonly hasLeftFocus = signal<boolean>(true);\n\n /**\n * @ignore\n */\n readonly lastKeyZero = signal<boolean>(false);\n\n private readonly fieldData = computed(() => {\n return useDateField({\n hasLeftFocus: this.hasLeftFocus,\n lastKeyZero: this.lastKeyZero,\n placeholder: this.rootContext.placeholder,\n hourCycle: this.rootContext.hourCycle(),\n segmentValues: this.rootContext.segmentValues,\n formatter: this.rootContext.formatter,\n part: <SegmentPart>this.part(),\n disabled: this.rootContext.disabled,\n readonly: this.rootContext.readonly,\n modelValue: this.rootContext.value,\n focusNext: this.rootContext.focusNext\n });\n });\n\n private readonly attributes = computed(() => this.fieldData().attributes());\n\n /**\n * @ignore\n */\n handleSegmentClick: (e: MouseEvent) => void;\n\n /**\n * @ignore\n */\n handleSegmentKeydown: (e: KeyboardEvent) => void;\n\n constructor(private el: ElementRef) {\n effect(() => {\n const { handleSegmentClick, handleSegmentKeydown } = this.fieldData();\n this.handleSegmentKeydown = handleSegmentKeydown;\n this.handleSegmentClick = handleSegmentClick;\n });\n\n effect(() => {\n const attrs = this.attributes();\n Object.entries(attrs).forEach(([attr, value]) => {\n this.el.nativeElement.setAttribute(attr, String(value));\n });\n });\n }\n\n /**\n * @ignore\n */\n onFocus(e: FocusEvent) {\n this.rootContext.setFocusedElement(e.target as HTMLElement);\n }\n\n /**\n * @ignore\n */\n onFocusOut() {\n this.hasLeftFocus.set(true);\n }\n}\n","import { Direction } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n AfterViewInit,\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n OnInit,\n signal\n} from '@angular/core';\nimport { DateValue } from '@internationalized/date';\nimport {\n ARROW_LEFT,\n ARROW_RIGHT,\n createContent,\n createFormatter,\n DateMatcher,\n Formatter,\n getDefaultDate,\n getSegmentElements,\n Granularity,\n hasTime,\n HourCycle,\n initializeSegmentValues,\n isBefore,\n isNullish,\n isSegmentNavigationKey,\n provideToken,\n SegmentValueObj,\n syncSegmentValues,\n watch\n} from '@radix-ng/primitives/core';\nimport { DATE_FIELDS_ROOT_CONTEXT } from './date-field-context.token';\n\n@Directive({\n selector: '[rdxDateFieldRoot]',\n exportAs: 'rdxDateFieldRoot',\n providers: [provideToken(DATE_FIELDS_ROOT_CONTEXT, RdxDateFieldRootDirective)],\n host: {\n role: 'group',\n '[attr.aria-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'readonly() ? \"\" : undefined',\n '[attr.data-invalid]': 'isInvalid() ? \"\" : undefined',\n '[attr.dir]': 'dir()',\n\n '(keydown)': 'onKeydown($event)'\n }\n})\nexport class RdxDateFieldRootDirective implements OnInit, AfterViewInit {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * The controlled checked state of the calendar.\n */\n readonly value = model<DateValue | undefined>();\n\n /**\n * A callback fired when the date field's value is invalid.\n */\n readonly isDateUnavailable = input<DateMatcher | undefined>(undefined);\n\n /**\n * The hour cycle to use for formatting times. Defaults to the locale preference\n */\n readonly hourCycle = input<HourCycle>();\n\n /**\n * The granularity to use for formatting the field. Defaults to 'day' if a CalendarDate is provided, otherwise defaults to 'minute'.\n * The field will render segments for each part of the date up to and including the specified granularity.\n */\n readonly granularity = input<Granularity>();\n\n /**\n * The locale to use for formatting dates.\n */\n readonly locale = input<string>('en');\n\n readonly dir = input<Direction>('ltr');\n\n /**\n * The minimum valid date that can be entered.\n */\n readonly minValue = input<DateValue>();\n\n /**\n * The maximum valid date that can be entered.\n */\n readonly maxValue = input<DateValue>();\n\n /**\n * Whether or not to hide the time zone segment of the field.\n */\n readonly hideTimeZone = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether or not the field is readonly.\n */\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * @ignore\n */\n readonly defaultDate = computed(() =>\n getDefaultDate({\n defaultPlaceholder: undefined,\n granularity: this.granularity(),\n defaultValue: this.value(),\n locale: this.locale()\n })\n );\n\n /**\n * The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view\n */\n readonly placeholder = model<DateValue | undefined>(this.defaultDate().copy());\n\n // Internal state\n\n /**\n * @ignore\n */\n readonly segmentElements = signal<Set<HTMLElement>>(new Set());\n\n /**\n * @ignore\n */\n readonly currentFocusedElement = signal<HTMLElement | null>(null);\n\n /**\n * @ignore\n */\n formatter: Formatter;\n\n /**\n * @ignore\n */\n readonly segmentValues = signal<SegmentValueObj>({\n year: null,\n month: null,\n day: null,\n hour: null,\n minute: null,\n second: null,\n dayPeriod: null\n } as SegmentValueObj);\n\n /**\n * @ignore\n */\n readonly inferredGranularity = computed(() => {\n const placeholder = this.placeholder();\n\n if (this.granularity()) return placeholder && !hasTime(placeholder) ? 'day' : this.granularity();\n\n return placeholder && hasTime(placeholder) ? 'minute' : 'day';\n });\n\n /**\n * @ignore\n */\n readonly isInvalid = computed(() => {\n if (!this.value()) return false;\n\n if (this.isDateUnavailable()?.(<DateValue>this.value())) return true;\n\n if (this.minValue() && isBefore(<DateValue>this.value(), <DateValue>this.minValue())) return true;\n\n if (this.maxValue() && isBefore(<DateValue>this.maxValue(), <DateValue>this.value())) return true;\n\n return false;\n });\n\n /**\n * @ignore\n */\n readonly allSegmentContent = computed(() =>\n createContent({\n granularity: <Granularity>this.inferredGranularity(),\n dateRef: <DateValue>this.placeholder(),\n formatter: this.formatter,\n hideTimeZone: this.hideTimeZone(),\n hourCycle: this.hourCycle(),\n segmentValues: this.segmentValues(),\n locale: this.locale\n })\n );\n\n /**\n * An array of segments that should be readonly, which prevent user input on them.\n */\n readonly segmentContents = computed(() => this.allSegmentContent().arr);\n\n /**\n * @ignore\n */\n readonly currentSegmentIndex = computed(() =>\n Array.from(this.segmentElements()).findIndex(\n (el) =>\n el.getAttribute('data-rdx-date-field-segment') ===\n this.currentFocusedElement()?.getAttribute('data-rdx-date-field-segment')\n )\n );\n\n /**\n * @ignore\n */\n readonly prevFocusableSegment = computed(() => {\n const sign = this.dir() === 'rtl' ? -1 : 1;\n const prevCondition =\n sign > 0 ? this.currentSegmentIndex() < 0 : this.currentSegmentIndex() > this.segmentElements().size - 1;\n if (prevCondition) return null;\n\n const segmentToFocus = Array.from(this.segmentElements())[this.currentSegmentIndex() - sign];\n return segmentToFocus;\n });\n\n /**\n * @ignore\n */\n readonly nextFocusableSegment = computed(() => {\n const sign = this.dir() === 'rtl' ? -1 : 1;\n const nextCondition =\n sign < 0 ? this.currentSegmentIndex() < 0 : this.currentSegmentIndex() > this.segmentElements().size - 1;\n if (nextCondition) return null;\n const segmentToFocus = Array.from(this.segmentElements())[this.currentSegmentIndex() + sign];\n return segmentToFocus;\n });\n\n /**\n * @ignore\n */\n readonly focusNext = () => {\n this.nextFocusableSegment()?.focus();\n };\n\n constructor() {\n watch([this.value], ([modelValue]) => {\n if (!isNullish(modelValue) && this.placeholder()?.compare(modelValue) !== 0) {\n this.placeholder.set(modelValue.copy());\n }\n });\n }\n\n ngOnInit() {\n const defDate = getDefaultDate({\n defaultPlaceholder: undefined,\n granularity: this.granularity(),\n defaultValue: this.value(),\n locale: this.locale()\n });\n\n this.placeholder.set(defDate.copy());\n\n this.formatter = createFormatter(this.locale());\n\n const initialSegments = initializeSegmentValues(this.inferredGranularity()!);\n\n this.segmentValues.set(\n this.value()\n ? { ...syncSegmentValues({ value: <DateValue>this.value(), formatter: this.formatter }) }\n : { ...initialSegments }\n );\n }\n\n ngAfterViewInit() {\n getSegmentElements(this.elementRef.nativeElement).forEach((item) =>\n this.segmentElements().add(item as HTMLElement)\n );\n }\n\n /**\n * @ignore\n */\n onKeydown(event: KeyboardEvent) {\n const code = event.code;\n if ([ARROW_LEFT, ARROW_RIGHT].includes(code)) {\n if (!isSegmentNavigationKey(event.key)) return;\n\n if (code === ARROW_LEFT) {\n this.prevFocusableSegment()?.focus();\n }\n\n if (code === ARROW_RIGHT) {\n this.nextFocusableSegment()?.focus();\n }\n }\n }\n\n /**\n * @ignore\n */\n setFocusedElement(el: HTMLElement) {\n this.currentFocusedElement.set(el);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxDateFieldInputDirective } from './src/date-field-input.directive';\nimport { RdxDateFieldRootDirective } from './src/date-field-root.directive';\n\nexport * from './src/date-field-context.token';\nexport * from './src/date-field-input.directive';\nexport * from './src/date-field-root.directive';\n\nconst _imports = [RdxDateFieldRootDirective, RdxDateFieldInputDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxD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B,EAAE,0BAA0B,CAArD,EAAA,OAAA,EAAA,CAAA,yBAAyB,EAAE,0BAA0B,CAAA,EAAA,CAAA,CAAA;+GAM1D,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACbD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-date-field.mjs","sources":["../../../packages/primitives/date-field/src/date-field-context.token.ts","../../../packages/primitives/date-field/src/date-field-input.directive.ts","../../../packages/primitives/date-field/src/date-field-root.directive.ts","../../../packages/primitives/date-field/index.ts","../../../packages/primitives/date-field/radix-ng-primitives-date-field.ts"],"sourcesContent":["import { inject, InjectionToken, InputSignal, ModelSignal, Signal, WritableSignal } from '@angular/core';\nimport { DateValue } from '@internationalized/date';\nimport { DateStep, Formatter, HourCycle, SegmentValueObj } from '@radix-ng/primitives/core';\n\nexport interface DateFieldContextToken {\n locale: InputSignal<string>;\n value: ModelSignal<DateValue | undefined>;\n disabled: InputSignal<boolean>;\n readonly: InputSignal<boolean>;\n isInvalid: Signal<boolean>;\n placeholder: ModelSignal<DateValue>;\n hourCycle: InputSignal<HourCycle>;\n step$: Signal<DateStep>;\n formatter: Formatter;\n segmentValues: WritableSignal<SegmentValueObj>;\n focusNext: () => void;\n setFocusedElement: (el: HTMLElement) => void;\n}\n\nexport const DATE_FIELDS_ROOT_CONTEXT = new InjectionToken<DateFieldContextToken>('DATE_FIELDS_ROOT_CONTEXT');\n\nexport function injectDateFieldsRootContext(): DateFieldContextToken {\n return inject(DATE_FIELDS_ROOT_CONTEXT);\n}\n","import { computed, Directive, effect, ElementRef, input, signal } from '@angular/core';\nimport { SegmentPart, useDateField } from '@radix-ng/primitives/core';\nimport { injectDateFieldsRootContext } from './date-field-context.token';\n\n@Directive({\n selector: '[rdxDateFieldInput]',\n host: {\n '[attr.contenteditable]': 'disabled() || readonly() ? false : part() !== \"literal\"',\n '[attr.data-rdx-date-field-segment]': 'part()',\n '[attr.aria-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-invalid]': 'isInvalid() ? \"\" : undefined',\n '[attr.aria-invalid]': 'isInvalid() ? true : undefined',\n\n '(mousedown)': 'part() !== \"literal\" && handleSegmentClick($event)',\n '(keydown)': 'part() !== \"literal\" && handleSegmentKeydown($event)',\n '(focus)': 'part() !== \"literal\" && onFocus($event)',\n '(focusout)': 'part() !== \"literal\" && onFocusOut()'\n }\n})\nexport class RdxDateFieldInputDirective {\n private readonly rootContext = injectDateFieldsRootContext();\n\n /**\n * The part of the date to render\n * `'day' | 'month' | 'year' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'literal' | 'timeZoneName'`\n */\n readonly part = input<SegmentPart>();\n\n /**\n * @ignore\n */\n readonly disabled = computed(() => this.rootContext.disabled());\n\n /**\n * @ignore\n */\n readonly readonly = computed(() => this.rootContext.readonly());\n\n /**\n * @ignore\n */\n readonly isInvalid = computed(() => this.rootContext.isInvalid());\n\n /**\n * @ignore\n */\n readonly hasLeftFocus = signal<boolean>(true);\n\n /**\n * @ignore\n */\n readonly lastKeyZero = signal<boolean>(false);\n\n private readonly fieldData = computed(() => {\n return useDateField({\n hasLeftFocus: this.hasLeftFocus,\n lastKeyZero: this.lastKeyZero,\n placeholder: this.rootContext.placeholder,\n hourCycle: this.rootContext.hourCycle(),\n segmentValues: this.rootContext.segmentValues,\n formatter: this.rootContext.formatter,\n part: <SegmentPart>this.part(),\n disabled: this.rootContext.disabled,\n readonly: this.rootContext.readonly,\n step: this.rootContext.step$,\n modelValue: this.rootContext.value,\n focusNext: this.rootContext.focusNext\n });\n });\n\n private readonly attributes = computed(() => this.fieldData().attributes());\n\n /**\n * @ignore\n */\n handleSegmentClick: (e: MouseEvent) => void;\n\n /**\n * @ignore\n */\n handleSegmentKeydown: (e: KeyboardEvent) => void;\n\n constructor(private el: ElementRef) {\n effect(() => {\n const { handleSegmentClick, handleSegmentKeydown } = this.fieldData();\n this.handleSegmentKeydown = handleSegmentKeydown;\n this.handleSegmentClick = handleSegmentClick;\n });\n\n effect(() => {\n const attrs = this.attributes();\n Object.entries(attrs).forEach(([attr, value]) => {\n this.el.nativeElement.setAttribute(attr, String(value));\n });\n });\n }\n\n /**\n * @ignore\n */\n onFocus(e: FocusEvent) {\n this.rootContext.setFocusedElement(e.target as HTMLElement);\n }\n\n /**\n * @ignore\n */\n onFocusOut() {\n this.hasLeftFocus.set(true);\n }\n}\n","import { Direction } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n AfterViewInit,\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n OnInit,\n signal\n} from '@angular/core';\nimport { DateValue } from '@internationalized/date';\nimport {\n ARROW_LEFT,\n ARROW_RIGHT,\n createContent,\n createFormatter,\n DateMatcher,\n DateStep,\n Formatter,\n getDefaultDate,\n getSegmentElements,\n Granularity,\n hasTime,\n HourCycle,\n initializeSegmentValues,\n isBefore,\n isNullish,\n isSegmentNavigationKey,\n normalizeDateStep,\n normalizeHourCycle,\n provideToken,\n SegmentValueObj,\n syncSegmentValues,\n watch\n} from '@radix-ng/primitives/core';\nimport { DATE_FIELDS_ROOT_CONTEXT } from './date-field-context.token';\n\n@Directive({\n selector: '[rdxDateFieldRoot]',\n exportAs: 'rdxDateFieldRoot',\n providers: [provideToken(DATE_FIELDS_ROOT_CONTEXT, RdxDateFieldRootDirective)],\n host: {\n role: 'group',\n '[attr.aria-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-readonly]': 'readonly() ? \"\" : undefined',\n '[attr.data-invalid]': 'isInvalid() ? \"\" : undefined',\n '[attr.dir]': 'dir()',\n\n '(keydown)': 'onKeydown($event)'\n }\n})\nexport class RdxDateFieldRootDirective implements OnInit, AfterViewInit {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * The controlled checked state of the calendar.\n */\n readonly value = model<DateValue | undefined>();\n\n /**\n * A callback fired when the date field's value is invalid.\n */\n readonly isDateUnavailable = input<DateMatcher | undefined>(undefined);\n\n /**\n * The hour cycle to use for formatting times. Defaults to the locale preference\n */\n readonly hourCycle = input<HourCycle>();\n\n /**\n * The granularity to use for formatting the field. Defaults to 'day' if a CalendarDate is provided, otherwise defaults to 'minute'.\n * The field will render segments for each part of the date up to and including the specified granularity.\n */\n readonly granularity = input<Granularity>();\n\n /**\n * The locale to use for formatting dates.\n */\n readonly locale = input<string>('en');\n\n readonly dir = input<Direction>('ltr');\n\n /**\n * The minimum valid date that can be entered.\n */\n readonly minValue = input<DateValue>();\n\n /**\n * The maximum valid date that can be entered.\n */\n readonly maxValue = input<DateValue>();\n\n /**\n * Whether or not to hide the time zone segment of the field.\n */\n readonly hideTimeZone = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Whether or not the field is readonly.\n */\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The stepping interval for the time fields. Defaults to 1\n */\n readonly step = input<DateStep>();\n\n readonly step$ = computed(() => normalizeDateStep(this.step()));\n\n /**\n * @ignore\n */\n readonly defaultDate = computed(() =>\n getDefaultDate({\n defaultPlaceholder: undefined,\n granularity: this.granularity(),\n defaultValue: this.value(),\n locale: this.locale()\n })\n );\n\n /**\n * The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view\n */\n readonly placeholder = model<DateValue | undefined>(this.defaultDate().copy());\n\n // Internal state\n\n /**\n * @ignore\n */\n readonly segmentElements = signal<Set<HTMLElement>>(new Set());\n\n /**\n * @ignore\n */\n readonly currentFocusedElement = signal<HTMLElement | null>(null);\n\n /**\n * @ignore\n */\n formatter: Formatter;\n\n /**\n * @ignore\n */\n readonly segmentValues = signal<SegmentValueObj>({\n year: null,\n month: null,\n day: null,\n hour: null,\n minute: null,\n second: null,\n dayPeriod: null\n } as SegmentValueObj);\n\n /**\n * @ignore\n */\n readonly inferredGranularity = computed(() => {\n const placeholder = this.placeholder();\n\n if (this.granularity()) return placeholder && !hasTime(placeholder) ? 'day' : this.granularity();\n\n return placeholder && hasTime(placeholder) ? 'minute' : 'day';\n });\n\n /**\n * @ignore\n */\n readonly isInvalid = computed(() => {\n if (!this.value()) return false;\n\n if (this.isDateUnavailable()?.(<DateValue>this.value())) return true;\n\n if (this.minValue() && isBefore(<DateValue>this.value(), <DateValue>this.minValue())) return true;\n\n if (this.maxValue() && isBefore(<DateValue>this.maxValue(), <DateValue>this.value())) return true;\n\n return false;\n });\n\n /**\n * @ignore\n */\n readonly allSegmentContent = computed(() =>\n createContent({\n granularity: <Granularity>this.inferredGranularity(),\n dateRef: <DateValue>this.placeholder(),\n formatter: this.formatter,\n hideTimeZone: this.hideTimeZone(),\n hourCycle: this.hourCycle(),\n segmentValues: this.segmentValues(),\n locale: this.locale\n })\n );\n\n /**\n * An array of segments that should be readonly, which prevent user input on them.\n */\n readonly segmentContents = computed(() => this.allSegmentContent().arr);\n\n /**\n * @ignore\n */\n readonly currentSegmentIndex = computed(() =>\n Array.from(this.segmentElements()).findIndex(\n (el) =>\n el.getAttribute('data-rdx-date-field-segment') ===\n this.currentFocusedElement()?.getAttribute('data-rdx-date-field-segment')\n )\n );\n\n /**\n * @ignore\n */\n readonly prevFocusableSegment = computed(() => {\n const sign = this.dir() === 'rtl' ? -1 : 1;\n const prevCondition =\n sign > 0 ? this.currentSegmentIndex() < 0 : this.currentSegmentIndex() > this.segmentElements().size - 1;\n if (prevCondition) return null;\n\n const segmentToFocus = Array.from(this.segmentElements())[this.currentSegmentIndex() - sign];\n return segmentToFocus;\n });\n\n /**\n * @ignore\n */\n readonly nextFocusableSegment = computed(() => {\n const sign = this.dir() === 'rtl' ? -1 : 1;\n const nextCondition =\n sign < 0 ? this.currentSegmentIndex() < 0 : this.currentSegmentIndex() > this.segmentElements().size - 1;\n if (nextCondition) return null;\n const segmentToFocus = Array.from(this.segmentElements())[this.currentSegmentIndex() + sign];\n return segmentToFocus;\n });\n\n /**\n * @ignore\n */\n readonly focusNext = () => {\n this.nextFocusableSegment()?.focus();\n };\n\n constructor() {\n watch([this.value], ([modelValue]) => {\n if (!isNullish(modelValue) && this.placeholder()?.compare(modelValue) !== 0) {\n this.placeholder.set(modelValue.copy());\n }\n });\n }\n\n ngOnInit() {\n const defDate = getDefaultDate({\n defaultPlaceholder: undefined,\n granularity: this.granularity(),\n defaultValue: this.value(),\n locale: this.locale()\n });\n\n this.placeholder.set(defDate.copy());\n\n this.formatter = createFormatter(this.locale(), {\n hourCycle: normalizeHourCycle(this.hourCycle())\n });\n\n const initialSegments = initializeSegmentValues(this.inferredGranularity()!);\n\n this.segmentValues.set(\n this.value()\n ? { ...syncSegmentValues({ value: <DateValue>this.value(), formatter: this.formatter }) }\n : { ...initialSegments }\n );\n }\n\n ngAfterViewInit() {\n getSegmentElements(this.elementRef.nativeElement).forEach((item) =>\n this.segmentElements().add(item as HTMLElement)\n );\n }\n\n /**\n * @ignore\n */\n onKeydown(event: KeyboardEvent) {\n const code = event.code;\n if ([ARROW_LEFT, ARROW_RIGHT].includes(code)) {\n if (!isSegmentNavigationKey(event.key)) return;\n\n if (code === ARROW_LEFT) {\n this.prevFocusableSegment()?.focus();\n }\n\n if (code === ARROW_RIGHT) {\n this.nextFocusableSegment()?.focus();\n }\n }\n }\n\n /**\n * @ignore\n */\n setFocusedElement(el: HTMLElement) {\n this.currentFocusedElement.set(el);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxDateFieldInputDirective } from './src/date-field-input.directive';\nimport { RdxDateFieldRootDirective } from './src/date-field-root.directive';\n\nexport * from './src/date-field-context.token';\nexport * from './src/date-field-input.directive';\nexport * from './src/date-field-root.directive';\n\nconst _imports = [RdxDateFieldRootDirective, RdxDateFieldInputDirective];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxDateFieldModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAmBa,wBAAwB,GAAG,IAAI,cAAc,CAAwB,0BAA0B;SAE5F,2BAA2B,GAAA;AACvC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC;AAC3C;;MCHa,0BAA0B,CAAA;AA+DnC,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAE,CAAA,EAAA,GAAF,EAAE;QA9DL,IAAW,CAAA,WAAA,GAAG,2BAA2B,EAAE;AAE5D;;;AAGG;QACM,IAAI,CAAA,IAAA,GAAG,KAAK,EAAe;AAEpC;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAE/D;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAE/D;;AAEG;AACM,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;AAEjE;;AAEG;AACM,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAU,IAAI,CAAC;AAE7C;;AAEG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAU,KAAK,CAAC;AAE5B,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAK;AACvC,YAAA,OAAO,YAAY,CAAC;gBAChB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;AAC7B,gBAAA,WAAW,EAAE,IAAI,CAAC,WA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AO;AACb,wBAAA,sBAAsB,EAAE,6BAA6B;AACrD,wBAAA,sBAAsB,EAAE,6BAA6B;AACrD,wBAAA,sBAAsB,EAAE,6BAA6B;AACrD,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,YAAY,EAAE,OAAO;AAErB,wBAAA,WAAW,EAAE;AAChB;AACJ,iBAAA;;;AC/CD,MAAM,QAAQ,GAAG,CAAC,yBAAyB,EAAE,0BAA0B,CAAC;MAM3D,kBAAkB,CAAA;8GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YANb,yBAAyB,EAAE,0BAA0B,CAArD,EAAA,OAAA,EAAA,CAAA,yBAAyB,EAAE,0BAA0B,CAAA,EAAA,CAAA,CAAA;+GAM1D,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACbD;;AAEG;;;;"}
|
@@ -0,0 +1,211 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { input, booleanAttribute, linkedSignal, output, signal, inject, ElementRef, effect, Directive } from '@angular/core';
|
3
|
+
|
4
|
+
function isLayerExist(layerElement, targetElement) {
|
5
|
+
const targetLayer = targetElement.closest('[data-dismissable-layer]');
|
6
|
+
const mainLayer = layerElement.dataset['dismissableLayer'] === ''
|
7
|
+
? layerElement
|
8
|
+
: layerElement.querySelector('[data-dismissable-layer]');
|
9
|
+
const nodeList = Array.from(layerElement.ownerDocument.querySelectorAll('[data-dismissable-layer]'));
|
10
|
+
if (targetLayer && (mainLayer === targetLayer || nodeList.indexOf(mainLayer) < nodeList.indexOf(targetLayer))) {
|
11
|
+
return true;
|
12
|
+
}
|
13
|
+
else {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Listens for when focus happens outside a DOM subtree.
|
19
|
+
* Returns props to pass to the root (node) of the subtree we want to check.
|
20
|
+
*/
|
21
|
+
class RdxFocusOutside {
|
22
|
+
#enabled;
|
23
|
+
set enabled(value) {
|
24
|
+
if (this.#enabled() !== value) {
|
25
|
+
this.#enabled.set(value);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
get enabled() {
|
29
|
+
return this.#enabled();
|
30
|
+
}
|
31
|
+
constructor() {
|
32
|
+
this.enabledInput = input(true, { transform: booleanAttribute, alias: 'enabled' });
|
33
|
+
this.#enabled = linkedSignal(() => this.enabledInput());
|
34
|
+
this.focusOutside = output();
|
35
|
+
/*
|
36
|
+
* Flag to indicate if the focus is currently within the DOM subtree
|
37
|
+
*/
|
38
|
+
this.isFocusInsideDOMTree = signal(false);
|
39
|
+
/*
|
40
|
+
* Handles capturing the focus event to mark focus as inside the DOM subtree
|
41
|
+
*/
|
42
|
+
this.focusCaptureHandler = () => {
|
43
|
+
if (!this.enabled)
|
44
|
+
return;
|
45
|
+
this.isFocusInsideDOMTree.set(true);
|
46
|
+
};
|
47
|
+
/*
|
48
|
+
* Handles capturing the blur event to mark focus as outside the DOM subtree
|
49
|
+
*/
|
50
|
+
this.blurCaptureHandler = () => {
|
51
|
+
if (!this.enabled)
|
52
|
+
return;
|
53
|
+
this.isFocusInsideDOMTree.set(false);
|
54
|
+
};
|
55
|
+
const elementRef = inject(ElementRef);
|
56
|
+
effect((onCleanup) => {
|
57
|
+
if (!this.#enabled()) {
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
const ownerDocument = elementRef.nativeElement.ownerDocument ?? globalThis.document;
|
61
|
+
const focusHandler = async (event) => {
|
62
|
+
if (!elementRef?.nativeElement) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
await Promise.resolve();
|
66
|
+
await Promise.resolve();
|
67
|
+
const target = event.target;
|
68
|
+
if (!elementRef.nativeElement || !target || isLayerExist(elementRef.nativeElement, target)) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
if (target && !this.isFocusInsideDOMTree()) {
|
72
|
+
this.focusOutside.emit(event);
|
73
|
+
}
|
74
|
+
};
|
75
|
+
elementRef.nativeElement.addEventListener('focus', this.focusCaptureHandler, {
|
76
|
+
capture: true
|
77
|
+
});
|
78
|
+
elementRef.nativeElement.addEventListener('blur', this.blurCaptureHandler, {
|
79
|
+
capture: true
|
80
|
+
});
|
81
|
+
ownerDocument.addEventListener('focusin', focusHandler);
|
82
|
+
onCleanup(() => {
|
83
|
+
elementRef.nativeElement.removeEventListener('focus', this.focusCaptureHandler, {
|
84
|
+
capture: true
|
85
|
+
});
|
86
|
+
elementRef.nativeElement.removeEventListener('blur', this.blurCaptureHandler, {
|
87
|
+
capture: true
|
88
|
+
});
|
89
|
+
ownerDocument.removeEventListener('focusin', focusHandler);
|
90
|
+
});
|
91
|
+
});
|
92
|
+
}
|
93
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxFocusOutside, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
94
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxFocusOutside, isStandalone: true, selector: "[rdxFocusOutside]", inputs: { enabledInput: { classPropertyName: "enabledInput", publicName: "enabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { focusOutside: "focusOutside" }, exportAs: ["rdxFocusOutside"], ngImport: i0 }); }
|
95
|
+
}
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxFocusOutside, decorators: [{
|
97
|
+
type: Directive,
|
98
|
+
args: [{
|
99
|
+
selector: '[rdxFocusOutside]',
|
100
|
+
exportAs: 'rdxFocusOutside'
|
101
|
+
}]
|
102
|
+
}], ctorParameters: () => [] });
|
103
|
+
/**
|
104
|
+
* Listens for `pointerdown` outside a DOM subtree. We use `pointerdown` rather than `pointerup`
|
105
|
+
* to mimic layer dismissing behavior present in OS.
|
106
|
+
* Returns props to pass to the node we want to check for outside events.
|
107
|
+
*/
|
108
|
+
class RdxPointerDownOutside {
|
109
|
+
#enabled;
|
110
|
+
set enabled(value) {
|
111
|
+
if (this.#enabled() !== value) {
|
112
|
+
this.#enabled.set(value);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
get enabled() {
|
116
|
+
return this.#enabled();
|
117
|
+
}
|
118
|
+
constructor() {
|
119
|
+
this.elementRef = inject(ElementRef);
|
120
|
+
this.enabledInput = input(true, { transform: booleanAttribute, alias: 'enabled' });
|
121
|
+
this.#enabled = linkedSignal(() => this.enabledInput());
|
122
|
+
this.pointerDownOutside = output();
|
123
|
+
this.isPointerInsideDOMTree = signal(false);
|
124
|
+
this.handleAndDispatchPointerDownOutsideEvent = (e) => () => this.pointerDownOutside.emit(e);
|
125
|
+
effect((onCleanup) => {
|
126
|
+
if (!this.#enabled()) {
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
const ownerDocument = this.elementRef.nativeElement.ownerDocument ?? globalThis.document;
|
130
|
+
const handlePointerDown = async (event) => {
|
131
|
+
if (event.target && !this.isPointerInsideDOMTree()) {
|
132
|
+
/**
|
133
|
+
* On touch devices, we need to wait for a click event because browsers implement
|
134
|
+
* a ~350ms delay between the time the user stops touching the display and when the
|
135
|
+
* browser executres events. We need to ensure we don't reactivate pointer-events within
|
136
|
+
* this timeframe otherwise the browser may execute events that should have been prevented.
|
137
|
+
*
|
138
|
+
* Additionally, this also lets us deal automatically with cancellations when a click event
|
139
|
+
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
|
140
|
+
*
|
141
|
+
* This is why we also continuously remove the previous listener, because we cannot be
|
142
|
+
* certain that it was raised, and therefore cleaned-up.
|
143
|
+
*/
|
144
|
+
if (event.pointerType === 'touch') {
|
145
|
+
ownerDocument.removeEventListener('click', this.handleClick);
|
146
|
+
this.handleClick = this.handleAndDispatchPointerDownOutsideEvent(event);
|
147
|
+
ownerDocument.addEventListener('click', this.handleClick, {
|
148
|
+
once: true
|
149
|
+
});
|
150
|
+
}
|
151
|
+
else {
|
152
|
+
this.pointerDownOutside.emit(event);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
// We need to remove the event listener in case the outside click has been canceled.
|
157
|
+
// See: https://github.com/radix-ui/primitives/issues/2171
|
158
|
+
ownerDocument.removeEventListener('click', this.handleClick);
|
159
|
+
}
|
160
|
+
this.isPointerInsideDOMTree.set(false);
|
161
|
+
};
|
162
|
+
/**
|
163
|
+
* if this directive executes in a component that mounts via a `pointerdown` event, the event
|
164
|
+
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
|
165
|
+
* this by delaying the event listener registration on the document.
|
166
|
+
* This is not Angular specific, but rather how the DOM works, ie:
|
167
|
+
* ```
|
168
|
+
* button.addEventListener('pointerdown', () => {
|
169
|
+
* console.log('I will log');
|
170
|
+
* document.addEventListener('pointerdown', () => {
|
171
|
+
* console.log('I will also log');
|
172
|
+
* })
|
173
|
+
* });
|
174
|
+
*/
|
175
|
+
const timerId = window.setTimeout(() => {
|
176
|
+
ownerDocument.addEventListener('pointerdown', handlePointerDown);
|
177
|
+
}, 0);
|
178
|
+
const onPointerDownCapture = () => {
|
179
|
+
if (!this.enabled) {
|
180
|
+
return;
|
181
|
+
}
|
182
|
+
this.isPointerInsideDOMTree.set(true);
|
183
|
+
};
|
184
|
+
this.elementRef.nativeElement.addEventListener('pointerdown', onPointerDownCapture, { capture: true });
|
185
|
+
onCleanup(() => {
|
186
|
+
window.clearTimeout(timerId);
|
187
|
+
ownerDocument.removeEventListener('pointerdown', handlePointerDown);
|
188
|
+
ownerDocument.removeEventListener('click', this.handleClick);
|
189
|
+
this.elementRef.nativeElement.removeEventListener('pointerdown', onPointerDownCapture, {
|
190
|
+
capture: true
|
191
|
+
});
|
192
|
+
});
|
193
|
+
});
|
194
|
+
}
|
195
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxPointerDownOutside, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
196
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxPointerDownOutside, isStandalone: true, selector: "[rdxPointerDownOutside]", inputs: { enabledInput: { classPropertyName: "enabledInput", publicName: "enabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pointerDownOutside: "pointerDownOutside" }, exportAs: ["rdxPointerDownOutside"], ngImport: i0 }); }
|
197
|
+
}
|
198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxPointerDownOutside, decorators: [{
|
199
|
+
type: Directive,
|
200
|
+
args: [{
|
201
|
+
selector: '[rdxPointerDownOutside]',
|
202
|
+
exportAs: 'rdxPointerDownOutside'
|
203
|
+
}]
|
204
|
+
}], ctorParameters: () => [] });
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Generated bundle index. Do not edit.
|
208
|
+
*/
|
209
|
+
|
210
|
+
export { RdxFocusOutside, RdxPointerDownOutside };
|
211
|
+
//# sourceMappingURL=radix-ng-primitives-dismissible-layer.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-dismissible-layer.mjs","sources":["../../../packages/primitives/dismissible-layer/src/utils.ts","../../../packages/primitives/dismissible-layer/radix-ng-primitives-dismissible-layer.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n linkedSignal,\n output,\n signal\n} from '@angular/core';\n\nfunction isLayerExist(layerElement: HTMLElement, targetElement: HTMLElement) {\n const targetLayer = targetElement.closest('[data-dismissable-layer]');\n\n const mainLayer =\n layerElement.dataset['dismissableLayer'] === ''\n ? layerElement\n : (layerElement.querySelector('[data-dismissable-layer]') as HTMLElement);\n\n const nodeList = Array.from(layerElement.ownerDocument.querySelectorAll('[data-dismissable-layer]'));\n\n if (targetLayer && (mainLayer === targetLayer || nodeList.indexOf(mainLayer) < nodeList.indexOf(targetLayer))) {\n return true;\n } else {\n return false;\n }\n}\n\n/**\n * Listens for when focus happens outside a DOM subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */\n@Directive({\n selector: '[rdxFocusOutside]',\n exportAs: 'rdxFocusOutside'\n})\nexport class RdxFocusOutside {\n readonly enabledInput = input<boolean, BooleanInput>(true, { transform: booleanAttribute, alias: 'enabled' });\n\n readonly #enabled = linkedSignal(() => this.enabledInput());\n\n set enabled(value: boolean) {\n if (this.#enabled() !== value) {\n this.#enabled.set(value);\n }\n }\n\n get enabled() {\n return this.#enabled();\n }\n\n readonly focusOutside = output<FocusEvent>();\n\n /*\n * Flag to indicate if the focus is currently within the DOM subtree\n */\n private readonly isFocusInsideDOMTree = signal(false);\n\n /*\n * Handles capturing the focus event to mark focus as inside the DOM subtree\n */\n private readonly focusCaptureHandler = () => {\n if (!this.enabled) return;\n this.isFocusInsideDOMTree.set(true);\n };\n\n /*\n * Handles capturing the blur event to mark focus as outside the DOM subtree\n */\n private readonly blurCaptureHandler = () => {\n if (!this.enabled) return;\n this.isFocusInsideDOMTree.set(false);\n };\n\n constructor() {\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n effect((onCleanup) => {\n if (!this.#enabled()) {\n return;\n }\n\n const ownerDocument = elementRef.nativeElement.ownerDocument ?? globalThis.document;\n\n const focusHandler = async (event: FocusEvent) => {\n if (!elementRef?.nativeElement) {\n return;\n }\n\n await Promise.resolve();\n await Promise.resolve();\n\n const target = event.target as HTMLElement | undefined;\n if (!elementRef.nativeElement || !target || isLayerExist(elementRef.nativeElement, target)) {\n return;\n }\n\n if (target && !this.isFocusInsideDOMTree()) {\n this.focusOutside.emit(event);\n }\n };\n\n elementRef.nativeElement.addEventListener('focus', this.focusCaptureHandler, {\n capture: true\n });\n elementRef.nativeElement.addEventListener('blur', this.blurCaptureHandler, {\n capture: true\n });\n\n ownerDocument.addEventListener('focusin', focusHandler);\n\n onCleanup(() => {\n elementRef.nativeElement.removeEventListener('focus', this.focusCaptureHandler, {\n capture: true\n });\n\n elementRef.nativeElement.removeEventListener('blur', this.blurCaptureHandler, {\n capture: true\n });\n\n ownerDocument.removeEventListener('focusin', focusHandler);\n });\n });\n }\n}\n\n/**\n * Listens for `pointerdown` outside a DOM subtree. We use `pointerdown` rather than `pointerup`\n * to mimic layer dismissing behavior present in OS.\n * Returns props to pass to the node we want to check for outside events.\n */\n@Directive({\n selector: '[rdxPointerDownOutside]',\n exportAs: 'rdxPointerDownOutside'\n})\nexport class RdxPointerDownOutside {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly enabledInput = input<boolean, BooleanInput>(true, { transform: booleanAttribute, alias: 'enabled' });\n\n readonly #enabled = linkedSignal(() => this.enabledInput());\n\n set enabled(value: boolean) {\n if (this.#enabled() !== value) {\n this.#enabled.set(value);\n }\n }\n\n get enabled() {\n return this.#enabled();\n }\n\n readonly pointerDownOutside = output<PointerEvent>();\n\n private readonly isPointerInsideDOMTree = signal(false);\n\n private readonly handleAndDispatchPointerDownOutsideEvent = (e: PointerEvent) => () =>\n this.pointerDownOutside.emit(e);\n\n private handleClick: () => void | undefined;\n\n constructor() {\n effect((onCleanup) => {\n if (!this.#enabled()) {\n return;\n }\n\n const ownerDocument = this.elementRef.nativeElement.ownerDocument ?? globalThis.document;\n\n const handlePointerDown = async (event: PointerEvent) => {\n if (event.target && !this.isPointerInsideDOMTree()) {\n /**\n * On touch devices, we need to wait for a click event because browsers implement\n * a ~350ms delay between the time the user stops touching the display and when the\n * browser executres events. We need to ensure we don't reactivate pointer-events within\n * this timeframe otherwise the browser may execute events that should have been prevented.\n *\n * Additionally, this also lets us deal automatically with cancellations when a click event\n * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.\n *\n * This is why we also continuously remove the previous listener, because we cannot be\n * certain that it was raised, and therefore cleaned-up.\n */\n if (event.pointerType === 'touch') {\n ownerDocument.removeEventListener('click', this.handleClick);\n this.handleClick = this.handleAndDispatchPointerDownOutsideEvent(event);\n ownerDocument.addEventListener('click', this.handleClick, {\n once: true\n });\n } else {\n this.pointerDownOutside.emit(event);\n }\n } else {\n // We need to remove the event listener in case the outside click has been canceled.\n // See: https://github.com/radix-ui/primitives/issues/2171\n ownerDocument.removeEventListener('click', this.handleClick);\n }\n this.isPointerInsideDOMTree.set(false);\n };\n /**\n * if this directive executes in a component that mounts via a `pointerdown` event, the event\n * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n * this by delaying the event listener registration on the document.\n * This is not Angular specific, but rather how the DOM works, ie:\n * ```\n * button.addEventListener('pointerdown', () => {\n * console.log('I will log');\n * document.addEventListener('pointerdown', () => {\n * console.log('I will also log');\n * })\n * });\n */\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener('pointerdown', handlePointerDown);\n }, 0);\n\n const onPointerDownCapture = () => {\n if (!this.enabled) {\n return;\n }\n this.isPointerInsideDOMTree.set(true);\n };\n\n this.elementRef.nativeElement.addEventListener('pointerdown', onPointerDownCapture, { capture: true });\n\n onCleanup(() => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener('pointerdown', handlePointerDown);\n ownerDocument.removeEventListener('click', this.handleClick);\n this.elementRef.nativeElement.removeEventListener('pointerdown', onPointerDownCapture, {\n capture: true\n });\n });\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAaA,SAAS,YAAY,CA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GAlGG,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,MAAA,EAAA,EAAA,YAAA,EAAA,EAAA,iBAAA,EAAA,cAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,kBAAA,EAAA,oBAAA,EAAA,EAAA,QAAA,EAAA,CAAA,uBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAJjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,QAAQ,EAAE;AACb,iBAAA;;;ACxID;;AAEG;;;;"}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { inject, model, input, booleanAttribute, numberAttribute, computed, signal, afterNextRender, Directive } from '@angular/core';
|
3
|
+
import { createContext, watch } from '@radix-ng/primitives/core';
|
4
|
+
import * as i1 from '@radix-ng/primitives/dismissible-layer';
|
5
|
+
import { RdxFocusOutside, RdxPointerDownOutside } from '@radix-ng/primitives/dismissible-layer';
|
6
|
+
|
7
|
+
const [injectEditableRootContext, provideEditableRootContext] = createContext('EditableRoot');
|
8
|
+
const rootContext = () => {
|
9
|
+
const context = inject(RdxEditableRoot);
|
10
|
+
return {
|
11
|
+
disabled: context.disabled,
|
12
|
+
value: context.value,
|
13
|
+
inputValue: context.inputValue,
|
14
|
+
placeholder: context.$placeholder,
|
15
|
+
isEditing: context.isEditing,
|
16
|
+
submitMode: context.submitMode,
|
17
|
+
activationMode: context.activationMode,
|
18
|
+
edit: context.edit,
|
19
|
+
cancel: context.cancel,
|
20
|
+
submit: context.submit,
|
21
|
+
maxLength: context.maxLength,
|
22
|
+
startWithEditMode: context.startWithEditMode,
|
23
|
+
isEmpty: context.isEmpty,
|
24
|
+
readonly: context.readonly,
|
25
|
+
autoResize: context.autoResize,
|
26
|
+
selectOnFocus: context.selectOnFocus,
|
27
|
+
inputRef: context.inputRef
|
28
|
+
};
|
29
|
+
};
|
30
|
+
/**
|
31
|
+
* @group Components
|
32
|
+
*/
|
33
|
+
class RdxEditableRoot {
|
34
|
+
constructor() {
|
35
|
+
this.focusOutside = inject(RdxFocusOutside);
|
36
|
+
this.pointerDownOutside = inject(RdxPointerDownOutside);
|
37
|
+
this.value = model();
|
38
|
+
this.placeholder = input('Enter text...');
|
39
|
+
this.disabled = input(false, { transform: booleanAttribute });
|
40
|
+
this.readonly = input(false, { transform: booleanAttribute });
|
41
|
+
this.selectOnFocus = input(false, { transform: booleanAttribute });
|
42
|
+
this.submitMode = input('blur');
|
43
|
+
this.maxLength = input(undefined, { transform: numberAttribute });
|
44
|
+
/**
|
45
|
+
* Whether to start with the edit mode active
|
46
|
+
*/
|
47
|
+
this.startWithEditMode = input(false, { transform: booleanAttribute });
|
48
|
+
this.activationMode = input('focus');
|
49
|
+
this.autoResize = input(false, { transform: booleanAttribute });
|
50
|
+
this.required = input(false, { transform: booleanAttribute });
|
51
|
+
this.isEmpty = computed(() => this.value() === '');
|
52
|
+
this.$placeholder = computed(() => {
|
53
|
+
return typeof this.placeholder() === 'string'
|
54
|
+
? { edit: this.placeholder(), preview: this.placeholder() }
|
55
|
+
: this.placeholder();
|
56
|
+
});
|
57
|
+
this.isEditing = signal(false);
|
58
|
+
this.inputValue = signal(this.value());
|
59
|
+
this.inputRef = signal(undefined);
|
60
|
+
watch([this.value], ([value]) => {
|
61
|
+
if (value) {
|
62
|
+
this.inputValue.set(this.value());
|
63
|
+
}
|
64
|
+
});
|
65
|
+
watch([this.isEditing], ([value]) => {
|
66
|
+
this.pointerDownOutside.enabled = value;
|
67
|
+
this.focusOutside.enabled = value;
|
68
|
+
});
|
69
|
+
this.pointerDownOutside.pointerDownOutside.subscribe(() => this.handleDismiss());
|
70
|
+
this.focusOutside.focusOutside.subscribe(() => this.handleDismiss());
|
71
|
+
afterNextRender(() => {
|
72
|
+
this.isEditing.set(this.startWithEditMode() ?? false);
|
73
|
+
this.inputValue.set(this.value());
|
74
|
+
});
|
75
|
+
}
|
76
|
+
handleDismiss() {
|
77
|
+
if (this.isEditing()) {
|
78
|
+
if (this.submitMode() === 'blur' || this.submitMode() === 'both') {
|
79
|
+
this.submit();
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
this.cancel();
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
submit() {
|
87
|
+
this.value.set(this.inputValue());
|
88
|
+
this.isEditing.set(false);
|
89
|
+
}
|
90
|
+
cancel() {
|
91
|
+
this.isEditing.set(false);
|
92
|
+
}
|
93
|
+
edit() {
|
94
|
+
this.isEditing.set(true);
|
95
|
+
this.inputValue.set(this.value());
|
96
|
+
}
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxEditableRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
98
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxEditableRoot, isStandalone: true, selector: "[rdxEditableRoot]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, selectOnFocus: { classPropertyName: "selectOnFocus", publicName: "selectOnFocus", isSignal: true, isRequired: false, transformFunction: null }, submitMode: { classPropertyName: "submitMode", publicName: "submitMode", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, startWithEditMode: { classPropertyName: "startWithEditMode", publicName: "startWithEditMode", isSignal: true, isRequired: false, transformFunction: null }, activationMode: { classPropertyName: "activationMode", publicName: "activationMode", isSignal: true, isRequired: false, transformFunction: null }, autoResize: { classPropertyName: "autoResize", publicName: "autoResize", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "attr.data-dismissable-layer": "\"\"" } }, providers: [provideEditableRootContext(rootContext)], exportAs: ["rdxEditableRoot"], hostDirectives: [{ directive: i1.RdxFocusOutside }, { directive: i1.RdxPointerDownOutside }], ngImport: i0 }); }
|
99
|
+
}
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxEditableRoot, decorators: [{
|
101
|
+
type: Directive,
|
102
|
+
args: [{
|
103
|
+
selector: '[rdxEditableRoot]',
|
104
|
+
exportAs: 'rdxEditableRoot',
|
105
|
+
providers: [provideEditableRootContext(rootContext)],
|
106
|
+
hostDirectives: [RdxFocusOutside, RdxPointerDownOutside],
|
107
|
+
host: {
|
108
|
+
'[attr.data-dismissable-layer]': '""'
|
109
|
+
}
|
110
|
+
}]
|
111
|
+
}], ctorParameters: () => [] });
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Generated bundle index. Do not edit.
|
115
|
+
*/
|
116
|
+
|
117
|
+
export { RdxEditableRoot, injectEditableRootContext, provideEditableRootContext };
|
118
|
+
//# sourceMappingURL=radix-ng-primitives-editable.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-editable.mjs","sources":["../../../packages/primitives/editable/src/editable-root.ts","../../../packages/primitives/editable/radix-ng-primitives-editable.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n afterNextRender,\n booleanAttribute,\n computed,\n Directive,\n inject,\n input,\n model,\n numberAttribute,\n Signal,\n signal,\n WritableSignal\n} from '@angular/core';\nimport { createContext, watch } from '@radix-ng/primitives/core';\nimport { RdxFocusOutside, RdxPointerDownOutside } from '@radix-ng/primitives/dismissible-layer';\n\ntype EditableRootContext = {\n disabled: Signal<boolean>;\n value: Signal<string | null | undefined>;\n inputValue: WritableSignal<string | undefined>;\n placeholder: Signal<{ edit: string; preview: string }>;\n isEditing: Signal<boolean>;\n submitMode: Signal<SubmitMode>;\n activationMode: Signal<ActivationMode>;\n edit: () => void;\n cancel: () => void;\n submit: () => void;\n maxLength: Signal<number | undefined>;\n startWithEditMode: Signal<boolean>;\n isEmpty: Signal<boolean>;\n readonly: Signal<boolean>;\n selectOnFocus: Signal<boolean>;\n autoResize: Signal<boolean>;\n inputRef: WritableSignal<HTMLInputElement | undefined>;\n};\n\nexport const [injectEditableRootContext, provideEditableRootContext] =\n createContext<EditableRootContext>('EditableRoot');\n\nconst rootContext = (): EditableRootContext => {\n const context = inject(RdxEditableRoot);\n return {\n disabled: context.disabled,\n value: context.value,\n inputValue: context.inputValue,\n placeholder: context.$placeholder as Signal<{ edit: string; preview: string }>,\n isEditing: context.isEditing,\n submitMode: context.submitMode,\n activationMode: context.activationMode,\n edit: context.edit,\n cancel: context.cancel,\n submit: context.submit,\n maxLength: context.maxLength,\n startWithEditMode: context.startWithEditMode,\n isEmpty: context.isEmpty,\n readonly: context.readonly,\n autoResize: context.autoResize,\n selectOnFocus: context.selectOnFocus,\n inputRef: context.inputRef\n };\n};\n\ntype ActivationMode = 'focus' | 'dblclick' | 'none';\ntype SubmitMode = 'blur' | 'enter' | 'none' | 'both';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxEditableRoot]',\n exportAs: 'rdxEditableRoot',\n providers: [provideEditableRootContext(rootContext)],\n hostDirectives: [RdxFocusOutside, RdxPointerDownOutside],\n host: {\n '[attr.data-dismissable-layer]': '\"\"'\n }\n})\nexport class RdxEditableRoot {\n private readonly focusOutside = inject(RdxFocusOutside);\n readonly pointerDownOutside = inject(RdxPointerDownOutside);\n\n readonly value = model<string>();\n\n readonly placeholder = input<string>('Enter text...');\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly selectOnFocus = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly submitMode = input<SubmitMode>('blur');\n\n readonly maxLength = input<number, NumberInput>(undefined, { transform: numberAttribute });\n\n /**\n * Whether to start with the edit mode active\n */\n readonly startWithEditMode = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly activationMode = input<ActivationMode>('focus');\n\n readonly autoResize = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly required = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly isEmpty = computed(() => this.value() === '');\n\n readonly $placeholder = computed(() => {\n return typeof this.placeholder() === 'string'\n ? { edit: this.placeholder(), preview: this.placeholder() }\n : this.placeholder();\n });\n\n readonly isEditing = signal(false);\n\n readonly inputValue = signal(this.value());\n\n readonly inputRef = signal<HTMLInputElement | undefined>(undefined);\n\n constructor() {\n watch([this.value], ([value]) => {\n if (value) {\n this.inputValue.set(this.value());\n }\n });\n\n watch([this.isEditing], ([value]) => {\n this.pointerDownOutside.enabled = value;\n this.focusOutside.enabled = value;\n });\n\n this.pointerDownOutside.pointerDownOutside.subscribe(() => this.handleDismiss());\n this.focusOutside.focusOutside.subscribe(() => this.handleDismiss());\n\n afterNextRender(() => {\n this.isEditing.set(this.startWithEditMode() ?? false);\n this.inputValue.set(this.value());\n });\n }\n\n handleDismiss() {\n if (this.isEditing()) {\n if (this.submitMode() === 'blur' || this.submitMode() === 'both') {\n this.submit();\n } else {\n this.cancel();\n }\n }\n }\n\n submit() {\n this.value.set(this.inputValue());\n this.isEditing.set(false);\n }\n\n cancel() {\n this.isEditing.set(false);\n }\n\n edit() {\n this.isEditing.set(true);\n this.inputValue.set(this.value());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAqCO,MAAM,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,GAChE,aAAa,CAAsB,cAAc;AAErD,MAAM,WAAW,GAAG,MAA0B;AAC1C,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC;IACvC,OAAO;QACH,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,YAAyD;QAC9E,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,QAAQ,EAAE,OAAO,CAAC;KACrB;AACL,CAAC;AAKD;;AAEG;MAUU,eAAe,CAAA;AA2CxB,IAAA,WAAA,GAAA;AA1CiB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,qBAAqB,CAAC;QAElD,IAAK,CAAA,KAAA,GAAG,KAAK,EAAU;AAEvB,QAAA,IAAA,CAA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A;;;AC7ED;;AAEG;;;;"}
|
@@ -3,7 +3,7 @@ import { InjectionToken, inject, DestroyRef, signal, effect, Injectable, compute
|
|
3
3
|
import { NumberFormatter, NumberParser } from '@internationalized/number';
|
4
4
|
import { Subject, fromEvent } from 'rxjs';
|
5
5
|
import { takeUntil } from 'rxjs/operators';
|
6
|
-
import { getActiveElement, clamp, snapValueToStep, provideToken } from '@radix-ng/primitives/core';
|
6
|
+
import { getActiveElement, isNullish, clamp, snapValueToStep, provideToken } from '@radix-ng/primitives/core';
|
7
7
|
|
8
8
|
const NUMBER_FIELD_ROOT_CONTEXT = new InjectionToken('NUMBER_FIELD_ROOT_CONTEXT');
|
9
9
|
function injectNumberFieldRootContext() {
|
@@ -325,15 +325,15 @@ class RdxNumberFieldRootDirective {
|
|
325
325
|
/**
|
326
326
|
* @ignore
|
327
327
|
*/
|
328
|
-
this.isDecreaseDisabled = computed(() =>
|
329
|
-
(this.min() && !isNaN(this.value())
|
328
|
+
this.isDecreaseDisabled = computed(() => !isNullish(this.value()) &&
|
329
|
+
(this.clampInputValue(this.value()) === this.min() || (this.min() && !isNaN(this.value()))
|
330
330
|
? handleDecimalOperation('-', this.value(), this.step()) < this.min()
|
331
331
|
: false));
|
332
332
|
/**
|
333
333
|
* @ignore
|
334
334
|
*/
|
335
|
-
this.isIncreaseDisabled = computed(() =>
|
336
|
-
(this.max() && !isNaN(this.value())
|
335
|
+
this.isIncreaseDisabled = computed(() => !isNullish(this.value()) &&
|
336
|
+
(this.clampInputValue(this.value()) === this.max() || (this.min() && !isNaN(this.value()))
|
337
337
|
? handleDecimalOperation('+', this.value(), this.step()) > this.max()
|
338
338
|
: false));
|
339
339
|
/**
|
@@ -352,7 +352,7 @@ class RdxNumberFieldRootDirective {
|
|
352
352
|
* with a textValue that can be announced using a minus sign.
|
353
353
|
* @ignore
|
354
354
|
*/
|
355
|
-
this.textValue = computed(() => (isNaN(this.value()) ? '' : this.textValueFormatter().format(this.value()))
|
355
|
+
this.textValue = computed(() => isNullish(this.value()) || isNaN(this.value()) ? '' : this.textValueFormatter().format(this.value()));
|
356
356
|
/**
|
357
357
|
* @ignore
|
358
358
|
*/
|
@@ -406,7 +406,7 @@ class RdxNumberFieldRootDirective {
|
|
406
406
|
*/
|
407
407
|
applyInputValue(val) {
|
408
408
|
const parsedValue = this.numberParser().parse(val);
|
409
|
-
this.value.set(this.clampInputValue(parsedValue));
|
409
|
+
this.value.set(isNaN(parsedValue) ? undefined : this.clampInputValue(parsedValue));
|
410
410
|
// Set to empty state if input value is empty
|
411
411
|
if (!val.length) {
|
412
412
|
return this.setInputValue(val);
|