@datarailsshared/datarailsshared 1.6.359 → 1.6.363
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/datarailsshared-datarailsshared-1.6.363.tgz +0 -0
- package/esm2022/lib/dr-code-editor/dr-code-editor.component.mjs +2 -2
- package/esm2022/lib/dr-dialog/dialog.module.mjs +2 -1
- package/esm2022/lib/dr-dialog/services/dialog.service.mjs +8 -1
- package/esm2022/lib/dr-inputs/button/button.component.mjs +7 -4
- package/esm2022/lib/dr-modal/components/dr-confirm-modal/dr-confirm-modal.component.mjs +210 -0
- package/esm2022/lib/dr-modal/components/dr-modal/dr-modal.component.mjs +73 -0
- package/esm2022/lib/dr-modal/components/dr-modal-container/dr-modal-container.component.mjs +72 -0
- package/esm2022/lib/dr-modal/directives/dr-modal-close.directive.mjs +39 -0
- package/esm2022/lib/dr-modal/dr-modal-config.mjs +3 -0
- package/esm2022/lib/dr-modal/dr-modal-config.provider.mjs +14 -0
- package/esm2022/lib/dr-modal/dr-modal-form.types.mjs +2 -0
- package/esm2022/lib/dr-modal/dr-modal-form.utils.mjs +18 -0
- package/esm2022/lib/dr-modal/dr-modal-ref.mjs +42 -0
- package/esm2022/lib/dr-modal/dr-modal.mjs +9 -0
- package/esm2022/lib/dr-modal/dr-modal.module.mjs +34 -0
- package/esm2022/lib/dr-modal/dr-modal.service.mjs +89 -0
- package/esm2022/lib/dr-modal/dr-modal.slots.mjs +91 -0
- package/esm2022/lib/dr-modal/dr-modal.types.mjs +2 -0
- package/esm2022/lib/dr-modal/public-api.mjs +15 -0
- package/esm2022/lib/utils/async-utils.mjs +32 -0
- package/esm2022/local-api.mjs +3 -1
- package/fesm2022/datarailsshared-datarailsshared.mjs +843 -164
- package/fesm2022/datarailsshared-datarailsshared.mjs.map +1 -1
- package/lib/dr-dialog/dialog.module.d.ts +1 -0
- package/lib/dr-dialog/services/dialog.service.d.ts +7 -0
- package/lib/dr-inputs/button/button.component.d.ts +2 -1
- package/lib/dr-modal/components/dr-confirm-modal/dr-confirm-modal.component.d.ts +19 -0
- package/lib/dr-modal/components/dr-modal/dr-modal.component.d.ts +14 -0
- package/lib/dr-modal/components/dr-modal-container/dr-modal-container.component.d.ts +23 -0
- package/lib/dr-modal/directives/dr-modal-close.directive.d.ts +17 -0
- package/lib/dr-modal/dr-modal-config.d.ts +17 -0
- package/lib/dr-modal/dr-modal-config.provider.d.ts +3 -0
- package/lib/dr-modal/dr-modal-form.types.d.ts +42 -0
- package/lib/dr-modal/dr-modal-form.utils.d.ts +9 -0
- package/lib/dr-modal/dr-modal-ref.d.ts +19 -0
- package/lib/dr-modal/dr-modal.d.ts +5 -0
- package/lib/dr-modal/dr-modal.module.d.ts +9 -0
- package/lib/dr-modal/dr-modal.service.d.ts +20 -0
- package/lib/dr-modal/dr-modal.slots.d.ts +25 -0
- package/lib/dr-modal/dr-modal.types.d.ts +63 -0
- package/lib/dr-modal/public-api.d.ts +14 -0
- package/lib/utils/async-utils.d.ts +18 -0
- package/local-api.d.ts +2 -0
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.6.359.tgz +0 -0
|
@@ -7,6 +7,7 @@ import * as i5 from "../dr-inputs/dr-inputs.module";
|
|
|
7
7
|
import * as i6 from "@angular/forms";
|
|
8
8
|
import * as i7 from "../dr-tooltip/dr-tooltip.module";
|
|
9
9
|
import * as i8 from "../dr-details-list/dr-details-list.module";
|
|
10
|
+
/** @deprecated use DrModalModule instead */
|
|
10
11
|
export declare class DrDialogModule {
|
|
11
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<DrDialogModule, never>;
|
|
12
13
|
static ɵmod: i0.ɵɵNgModuleDeclaration<DrDialogModule, [typeof i1.DialogWrapperComponent, typeof i2.DialogModalWrapperComponent], [typeof i3.CommonModule, typeof i4.MatLegacyDialogModule, typeof i5.DrInputsModule, typeof i6.ReactiveFormsModule, typeof i7.DrTooltipModule, typeof i8.DrDetailsListModule], [typeof i1.DialogWrapperComponent, typeof i2.DialogModalWrapperComponent]>;
|
|
@@ -4,20 +4,27 @@ import { ConfirmDialogData, DialogData } from '../interfaces/dialog-data';
|
|
|
4
4
|
import { DialogWrapperComponent } from '../components/dialog-wrapper/dialog-wrapper.component';
|
|
5
5
|
import { DialogModalWrapperComponent } from '../components/dialog-modal-wrapper/dialog-modal-wrapper.component';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
|
+
/** @deprecated use DrModalService instead */
|
|
7
8
|
export declare class DialogService {
|
|
8
9
|
private dialog;
|
|
9
10
|
private wrapperComponent;
|
|
10
11
|
constructor(dialog: MatDialog);
|
|
11
12
|
/**
|
|
12
13
|
* Function to open modal with custom form
|
|
14
|
+
*
|
|
15
|
+
* @deprecated use DrModalService.open instead
|
|
13
16
|
*/
|
|
14
17
|
openDialogWrapper<T, D = any, R = any>(componentTypeChild: ComponentType<T>, dialogData: DialogData<T>, componentTypeWrapper?: ComponentType<D>): MatDialogRef<any, any>;
|
|
15
18
|
/**
|
|
16
19
|
* Function to open confirmation modal
|
|
20
|
+
*
|
|
21
|
+
* @deprecated use DrModalService.confirm instead
|
|
17
22
|
*/
|
|
18
23
|
openConfirmDialog<R = any>(confirmDialogData: ConfirmDialogData): MatDialogRef<DialogWrapperComponent, R>;
|
|
19
24
|
/**
|
|
20
25
|
* Function to open confirmation modal with inputs
|
|
26
|
+
*
|
|
27
|
+
* @deprecated use DrModalService.confirm instead
|
|
21
28
|
*/
|
|
22
29
|
openConfirmDialogModal<R = any>(confirmDialogData: ConfirmDialogData): MatDialogRef<DialogModalWrapperComponent, R>;
|
|
23
30
|
/**
|
|
@@ -11,6 +11,7 @@ export declare class DrButtonComponent {
|
|
|
11
11
|
disabled: boolean;
|
|
12
12
|
isLoading: boolean;
|
|
13
13
|
isActive: boolean;
|
|
14
|
+
type: 'submit' | 'reset' | 'button';
|
|
14
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<DrButtonComponent, never>;
|
|
15
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DrButtonComponent, "dr-button", never, { "theme": { "alias": "theme"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconColor": { "alias": "iconColor"; "required": false; }; "iconSize": { "alias": "iconSize"; "required": false; }; "iconAfter": { "alias": "iconAfter"; "required": false; }; "iconAfterColor": { "alias": "iconAfterColor"; "required": false; }; "iconAfterSize": { "alias": "iconAfterSize"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "isActive": { "alias": "isActive"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
16
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DrButtonComponent, "dr-button", never, { "theme": { "alias": "theme"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconColor": { "alias": "iconColor"; "required": false; }; "iconSize": { "alias": "iconSize"; "required": false; }; "iconAfter": { "alias": "iconAfter"; "required": false; }; "iconAfterColor": { "alias": "iconAfterColor"; "required": false; }; "iconAfterSize": { "alias": "iconAfterSize"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "isActive": { "alias": "isActive"; "required": false; }; "type": { "alias": "type"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
16
17
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { DrModal } from '../../dr-modal';
|
|
4
|
+
import { DrModalConfirmData } from '../../dr-modal.types';
|
|
5
|
+
import { DrModalFormField } from '../../dr-modal-form.types';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class DrConfirmModalComponent<Fields extends readonly DrModalFormField<any>[] = DrModalFormField[]> extends DrModal<DrModalConfirmData<Fields>, boolean> {
|
|
8
|
+
readonly cancelBtn: import("../../dr-modal.types").DrModalConfirmFooterBtn;
|
|
9
|
+
readonly acceptBtn: import("../../dr-modal.types").DrModalConfirmFooterBtn;
|
|
10
|
+
readonly fields: Fields;
|
|
11
|
+
readonly form: FormGroup<Record<string, FormControl<any>>>;
|
|
12
|
+
readonly selectLoadings: Record<string, Signal<boolean>>;
|
|
13
|
+
readonly isLoading: import("@angular/core").WritableSignal<boolean>;
|
|
14
|
+
onSubmit(): Promise<void>;
|
|
15
|
+
private setItemControl;
|
|
16
|
+
private setItemSelectLoading;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrConfirmModalComponent<any>, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DrConfirmModalComponent<any>, "dr-confirm-modal", never, {}, {}, never, never, true, never>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DrModalHeaderDirective } from '../../dr-modal.slots';
|
|
2
|
+
import { DrModalMaxHeight, DrModalSize } from '../../dr-modal.types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DrModalComponent {
|
|
5
|
+
size: DrModalSize | null;
|
|
6
|
+
maxHeight: DrModalMaxHeight;
|
|
7
|
+
withHeader: boolean;
|
|
8
|
+
withCloseBtn: boolean;
|
|
9
|
+
readonly customHeader?: DrModalHeaderDirective;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalComponent, never>;
|
|
11
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DrModalComponent, "dr-modal, form[dr-modal]", never, { "size": { "alias": "size"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "withHeader": { "alias": "withHeader"; "required": false; }; "withCloseBtn": { "alias": "withCloseBtn"; "required": false; }; }, {}, ["customHeader"], ["dr-modal-header, [dr-modal-header], [drModalHeader]", "dr-modal-title, [dr-modal-title], [drModalTitle]", "dr-modal-subtitle, [dr-modal-subtitle], [drModalSubtitle]", "dr-modal-body, [dr-modal-body], [drModalBody]", "dr-modal-footer, [dr-modal-footer], [drModalFooter]"], true, never>;
|
|
12
|
+
static ngAcceptInputType_withHeader: unknown;
|
|
13
|
+
static ngAcceptInputType_withCloseBtn: unknown;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CdkDialogContainer } from '@angular/cdk/dialog';
|
|
2
|
+
import { DrModalConfig } from '../../dr-modal-config';
|
|
3
|
+
import { DrModalAnimationState } from '../../dr-modal.types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class DrModalContainerComponent extends CdkDialogContainer {
|
|
6
|
+
readonly config: DrModalConfig<any>;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly animationNoop: boolean;
|
|
9
|
+
private readonly animationClasses;
|
|
10
|
+
private readonly animationDuration;
|
|
11
|
+
readonly animationState: import("@angular/core").WritableSignal<DrModalAnimationState>;
|
|
12
|
+
readonly animationClass: import("@angular/core").Signal<string>;
|
|
13
|
+
readonly animationTime: import("@angular/core").Signal<number>;
|
|
14
|
+
readonly hasTitle: import("@angular/core").WritableSignal<boolean>;
|
|
15
|
+
readonly hasSubtitle: import("@angular/core").WritableSignal<boolean>;
|
|
16
|
+
private readonly elementRef;
|
|
17
|
+
protected _contentAttached(): void;
|
|
18
|
+
animateClose(): void;
|
|
19
|
+
private getAnimationDuration;
|
|
20
|
+
private getAnimationClasses;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalContainerComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DrModalContainerComponent, "dr-modal-container", never, {}, {}, never, never, true, never>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class DrModalCloseDirective<TResult = unknown> {
|
|
3
|
+
result?: TResult | '';
|
|
4
|
+
private readonly modalRef;
|
|
5
|
+
/**
|
|
6
|
+
* By default, Angular would assign '' in <button drModalClose>, which is not ideal as we use null for backdrop click and ESC press
|
|
7
|
+
* To understand if drModalClose used without value (<button drModalClose>) we get its attribute.
|
|
8
|
+
* '' attribute means we used drModalClose without any value, null means we used [drModalClose]="''" with binding
|
|
9
|
+
*
|
|
10
|
+
* NOTE: @Attribute will not work as Angular always sets @Attribute null value if it matches any @Input
|
|
11
|
+
*/
|
|
12
|
+
private readonly resultAttr;
|
|
13
|
+
constructor();
|
|
14
|
+
onHostClick(): void;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalCloseDirective<any>, never>;
|
|
16
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DrModalCloseDirective<any>, "[drModalClose]", never, { "result": { "alias": "drModalClose"; "required": false; }; }, {}, never, never, true, never>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { DrModalAnimationClasses, DrModalAnimationDuration } from './dr-modal.types';
|
|
3
|
+
export declare class DrModalConfig<Data = unknown> {
|
|
4
|
+
/** Uniq id to prevent opening multiple modals with the same id */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Data being injected into the child component */
|
|
7
|
+
data?: Data;
|
|
8
|
+
/** Disable closing modal by clicking on backdrop ([modalClose] and modalRef.close will close the modal as usual) */
|
|
9
|
+
disableClose?: boolean;
|
|
10
|
+
/** Injector used for the instantiation of the component to be attached */
|
|
11
|
+
injector?: Injector;
|
|
12
|
+
/** Config for custom animations */
|
|
13
|
+
animation?: {
|
|
14
|
+
class?: DrModalAnimationClasses;
|
|
15
|
+
duration?: DrModalAnimationDuration;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { AsyncValidatorFn, ValidatorFn } from '@angular/forms';
|
|
3
|
+
import { TimeframeOption } from '../models/datePicker';
|
|
4
|
+
export type DrModalFormFieldType = 'input' | 'select' | 'date_picker' | 'checkbox';
|
|
5
|
+
export interface ModalFormFieldBase<Value, Name extends string = string> {
|
|
6
|
+
name: Name;
|
|
7
|
+
value: Value;
|
|
8
|
+
type: DrModalFormFieldType;
|
|
9
|
+
fieldClass?: string;
|
|
10
|
+
validators?: ValidatorFn | ValidatorFn[];
|
|
11
|
+
asyncValidators?: AsyncValidatorFn[];
|
|
12
|
+
label?: string;
|
|
13
|
+
isLabelFullWidth?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DrModalFormInputField<Name extends string = string> extends ModalFormFieldBase<string, Name> {
|
|
17
|
+
type: 'input';
|
|
18
|
+
}
|
|
19
|
+
export interface DrModalFormCheckboxField<Name extends string = string> extends ModalFormFieldBase<boolean, Name> {
|
|
20
|
+
type: 'checkbox';
|
|
21
|
+
}
|
|
22
|
+
export interface DrModalFormDatepickerField<Name extends string = string> extends ModalFormFieldBase<number, Name> {
|
|
23
|
+
type: 'date_picker';
|
|
24
|
+
datePickerFormat?: TimeframeOption;
|
|
25
|
+
}
|
|
26
|
+
export interface DrModalFormSelect<T, Name extends string = string> extends ModalFormFieldBase<T, Name> {
|
|
27
|
+
type: 'select';
|
|
28
|
+
items$: Observable<readonly {
|
|
29
|
+
label: string;
|
|
30
|
+
value: T;
|
|
31
|
+
}[]>;
|
|
32
|
+
addTag?: boolean;
|
|
33
|
+
clearable?: boolean;
|
|
34
|
+
searchable?: boolean;
|
|
35
|
+
isOptional?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type DrModalFormField<T = unknown> = DrModalFormInputField | DrModalFormCheckboxField | DrModalFormDatepickerField | DrModalFormSelect<T>;
|
|
38
|
+
export type DrModalFormResult<Fields extends readonly DrModalFormField[]> = {
|
|
39
|
+
[K in Fields[number]['name']]: Extract<Fields[number], {
|
|
40
|
+
name: K;
|
|
41
|
+
}>['value'];
|
|
42
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DrModalFormCheckboxField, DrModalFormDatepickerField, DrModalFormInputField, DrModalFormSelect } from './dr-modal-form.types';
|
|
3
|
+
export declare const modalFormInput: <N extends string>(config: Omit<DrModalFormInputField<N>, "type">) => DrModalFormInputField<N>;
|
|
4
|
+
export declare const modalFormCheckbox: <N extends string>(config: Omit<DrModalFormCheckboxField<N>, "type">) => DrModalFormCheckboxField<N>;
|
|
5
|
+
export declare const modalFormDatepicker: <N extends string>(config: Omit<DrModalFormDatepickerField<N>, "type">) => DrModalFormDatepickerField<N>;
|
|
6
|
+
export declare const modalFormSelect: <T, N extends string>(config: Omit<DrModalFormSelect<T, N>, "type" | "items$">, items$: Observable<readonly {
|
|
7
|
+
label: string;
|
|
8
|
+
value: T;
|
|
9
|
+
}[]>) => DrModalFormSelect<T, N>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DialogRef } from '@angular/cdk/dialog';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { DrModalConfig } from './dr-modal-config';
|
|
4
|
+
import { DrModalContainerComponent } from './components/dr-modal-container/dr-modal-container.component';
|
|
5
|
+
export declare class DrModalRef<TData = unknown, TResult = unknown, TRef = unknown> {
|
|
6
|
+
private readonly innerRef;
|
|
7
|
+
readonly config: DrModalConfig<TData>;
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly ref: TRef;
|
|
10
|
+
readonly data: TData;
|
|
11
|
+
readonly afterClosed$: Observable<TResult | undefined>;
|
|
12
|
+
readonly container: DrModalContainerComponent;
|
|
13
|
+
disableClose: boolean;
|
|
14
|
+
private result?;
|
|
15
|
+
private isClosing;
|
|
16
|
+
constructor(innerRef: DialogRef<TResult, TRef>, config: DrModalConfig<TData>);
|
|
17
|
+
close(result?: TResult): void;
|
|
18
|
+
private cdkClose;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./components/dr-modal/dr-modal.component";
|
|
3
|
+
import * as i2 from "./dr-modal.slots";
|
|
4
|
+
import * as i3 from "./directives/dr-modal-close.directive";
|
|
5
|
+
export declare class DrModalModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DrModalModule, never, [typeof i1.DrModalComponent, typeof i2.DrModalHeaderDirective, typeof i2.DrModalTitleDirective, typeof i2.DrModalSubtitleDirective, typeof i2.DrModalBodyDirective, typeof i2.DrModalFooterDirective, typeof i3.DrModalCloseDirective], [typeof i1.DrModalComponent, typeof i2.DrModalHeaderDirective, typeof i2.DrModalTitleDirective, typeof i2.DrModalSubtitleDirective, typeof i2.DrModalBodyDirective, typeof i2.DrModalFooterDirective, typeof i3.DrModalCloseDirective]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DrModalModule>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Dialog } from '@angular/cdk/dialog';
|
|
2
|
+
import { DrModalRef } from './dr-modal-ref';
|
|
3
|
+
import { DrModalConfig } from './dr-modal-config';
|
|
4
|
+
import { DrModalFormField } from './dr-modal-form.types';
|
|
5
|
+
import { DrModalComponentRef, DrModalConfirmData } from './dr-modal.types';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class DrModalService {
|
|
8
|
+
private readonly dialog;
|
|
9
|
+
private readonly _modals;
|
|
10
|
+
private readonly defaultConfig;
|
|
11
|
+
private readonly confirmComponentPromise;
|
|
12
|
+
constructor(dialog: Dialog);
|
|
13
|
+
get modals(): readonly DrModalRef[];
|
|
14
|
+
open<TData, TResult = unknown>(component: DrModalComponentRef<TData, TResult>, config?: DrModalConfig<TData>): DrModalRef<TData, TResult>;
|
|
15
|
+
confirm<Fields extends readonly DrModalFormField<any>[] = DrModalFormField<any>[]>(data?: DrModalConfirmData<Fields>): Promise<boolean>;
|
|
16
|
+
closeAll(): void;
|
|
17
|
+
private getConfirmData;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalService, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DrModalService>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class DrModalHeaderDirective {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalHeaderDirective, never>;
|
|
4
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DrModalHeaderDirective, "dr-modal-header, [dr-modal-header], [drModalHeader]", never, {}, {}, never, never, true, never>;
|
|
5
|
+
}
|
|
6
|
+
export declare class DrModalTitleDirective {
|
|
7
|
+
protected readonly id: string;
|
|
8
|
+
constructor();
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalTitleDirective, never>;
|
|
10
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DrModalTitleDirective, "dr-modal-title, [dr-modal-title], [drModalTitle]", never, {}, {}, never, never, true, never>;
|
|
11
|
+
}
|
|
12
|
+
export declare class DrModalSubtitleDirective {
|
|
13
|
+
protected readonly id: string;
|
|
14
|
+
constructor();
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalSubtitleDirective, never>;
|
|
16
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DrModalSubtitleDirective, "dr-modal-subtitle, [dr-modal-subtitle], [drModalSubtitle]", never, {}, {}, never, never, true, never>;
|
|
17
|
+
}
|
|
18
|
+
export declare class DrModalBodyDirective {
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalBodyDirective, never>;
|
|
20
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DrModalBodyDirective, "dr-modal-body, [dr-modal-body], [drModalBody]", never, {}, {}, never, never, true, never>;
|
|
21
|
+
}
|
|
22
|
+
export declare class DrModalFooterDirective {
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DrModalFooterDirective, never>;
|
|
24
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DrModalFooterDirective, "dr-modal-footer, [dr-modal-footer], [drModalFooter]", never, {}, {}, never, never, true, never>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ComponentType } from '@angular/cdk/portal';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { DrModal } from './dr-modal';
|
|
4
|
+
import { ButtonType } from '../dr-inputs/button/button.component';
|
|
5
|
+
import { DrModalFormField, DrModalFormResult } from './dr-modal-form.types';
|
|
6
|
+
/** Modal sizes: xs 400px, sm 460px, md 632px, lg 750px, xl 1100px */
|
|
7
|
+
export type DrModalSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
8
|
+
/** 'size' = use size-based max-height (default); 'max' = no size restriction, max 85vh */
|
|
9
|
+
export type DrModalMaxHeight = 'size' | 'max';
|
|
10
|
+
export type DrModalComponentRef<Data, Result = unknown> = ComponentType<DrModal<Data, Result>>;
|
|
11
|
+
export type DrModalAnimationState = 'enter' | 'leave';
|
|
12
|
+
export interface DrModalAnimationDuration {
|
|
13
|
+
/** delay in ms (default is 150) */
|
|
14
|
+
enter: number;
|
|
15
|
+
/** delay in ms (default is 150) */
|
|
16
|
+
leave: number;
|
|
17
|
+
}
|
|
18
|
+
export interface DrModalAnimationClasses {
|
|
19
|
+
enter: string;
|
|
20
|
+
leave: string;
|
|
21
|
+
/** static class for the modal container to anchor animations to a specific class */
|
|
22
|
+
anchor: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DrModalConfirmData<Fields extends readonly DrModalFormField<any>[] = DrModalFormField<any>[]> {
|
|
25
|
+
title?: string;
|
|
26
|
+
/** HTML supported */
|
|
27
|
+
content?: string;
|
|
28
|
+
/** default is true */
|
|
29
|
+
withCloseBtn?: boolean;
|
|
30
|
+
/** default is 'xs' */
|
|
31
|
+
size?: DrModalSize;
|
|
32
|
+
/** default is 'size' */
|
|
33
|
+
maxHeight?: DrModalMaxHeight;
|
|
34
|
+
/**
|
|
35
|
+
* Modal fields config
|
|
36
|
+
*
|
|
37
|
+
* @example```ts
|
|
38
|
+
* const fields = [
|
|
39
|
+
* modalFormInput({ name: 'email', value: '', label: 'Email', placeholder: 'Enter your email' }),
|
|
40
|
+
* modalFormSelect({ name: 'role', value: 'viewer', label: 'Role', placeholder: 'Select role' }, options$),
|
|
41
|
+
* modalFormCheckbox({ name: 'agree', value: false, label: 'Agree' }),
|
|
42
|
+
* ] as const;
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
fields?: Fields;
|
|
46
|
+
/**
|
|
47
|
+
* Function to be called when user clicks on the confirm button.
|
|
48
|
+
* Result of the form fields will be passed as an argument.
|
|
49
|
+
*/
|
|
50
|
+
confirmFn?: (result: DrModalFormResult<Fields>) => Observable<unknown>;
|
|
51
|
+
/** Custom class for the form wrapper */
|
|
52
|
+
formWrapperClass?: string;
|
|
53
|
+
/** Error message on invalid form */
|
|
54
|
+
errorMessage?: string;
|
|
55
|
+
/** default is { theme: 'primary', label: 'Confirm' } */
|
|
56
|
+
acceptBtn?: DrModalConfirmFooterBtn;
|
|
57
|
+
/** default is { theme: 'secondary', label: 'Cancel' } */
|
|
58
|
+
cancelBtn?: DrModalConfirmFooterBtn;
|
|
59
|
+
}
|
|
60
|
+
export interface DrModalConfirmFooterBtn {
|
|
61
|
+
label?: string;
|
|
62
|
+
theme?: ButtonType;
|
|
63
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './components/dr-modal/dr-modal.component';
|
|
2
|
+
export * from './components/dr-modal-container/dr-modal-container.component';
|
|
3
|
+
export * from './components/dr-confirm-modal/dr-confirm-modal.component';
|
|
4
|
+
export * from './directives/dr-modal-close.directive';
|
|
5
|
+
export * from './dr-modal.module';
|
|
6
|
+
export * from './dr-modal.service';
|
|
7
|
+
export * from './dr-modal.slots';
|
|
8
|
+
export * from './dr-modal';
|
|
9
|
+
export * from './dr-modal.types';
|
|
10
|
+
export * from './dr-modal-config.provider';
|
|
11
|
+
export * from './dr-modal-config';
|
|
12
|
+
export * from './dr-modal-ref';
|
|
13
|
+
export * from './dr-modal-form.types';
|
|
14
|
+
export * from './dr-modal-form.utils';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export type Result<T, E = Error> = [T, null] | [null, E];
|
|
3
|
+
/**
|
|
4
|
+
* A utility function to handle asynchronous operations with a try-catch mechanism.
|
|
5
|
+
* It wraps a promise and returns a tuple containing either the resolved value or the caught error.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const [data, error] = await withResult(someAsyncFunction());
|
|
10
|
+
* if (error != null) {
|
|
11
|
+
* console.log('Success:', data);
|
|
12
|
+
* } else {
|
|
13
|
+
* console.error('Error:', error);
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const withResult: <T, E = Error>(value: Promise<T> | Observable<T>) => Promise<Result<T, E>>;
|
|
18
|
+
export declare const fromPromise: <T>(promise: Promise<T>) => Observable<T>;
|
package/local-api.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export * from './lib/dr-treeview/helpers/treeview-event-parser';
|
|
|
72
72
|
export * from './lib/dr-treeview/helpers/treeview-helper';
|
|
73
73
|
export * from './lib/dr-toastr/default-toastr/default-toastr.component';
|
|
74
74
|
export * from './lib/utils/data-analytics.service';
|
|
75
|
+
export * from './lib/utils/async-utils';
|
|
75
76
|
export * from './lib/models/colors';
|
|
76
77
|
export { TooltipTheme } from './lib/dr-tooltip/enums/tooltip-theme.enum';
|
|
77
78
|
export { Scenario, TScenarioDataChanged } from './lib/dr-tags/_interfaces/scenario';
|
|
@@ -135,6 +136,7 @@ export { DrGalleryComponent } from './lib/dr-gallery/dr-gallery.component';
|
|
|
135
136
|
export { DrProgressBarComponent, TProgressBarTheme } from './lib/dr-progress-bar/dr-progress-bar.component';
|
|
136
137
|
export { DrBadgeComponent, TBadgeColor, TBadgeSize } from './lib/dr-badge/dr-badge.component';
|
|
137
138
|
export { DrSystemMessageComponent, TSystemMessageTheme } from './lib/dr-system-message/dr-system-message.component';
|
|
139
|
+
export * from './lib/dr-modal/public-api';
|
|
138
140
|
export * from './lib/drawer/public-api';
|
|
139
141
|
export * from './lib/stepper-wizard/stepper-wizard.component';
|
|
140
142
|
export * from './lib/stepper-wizard/directives/step-wizard.directive';
|
package/package.json
CHANGED
|
Binary file
|