@acorex/components 18.5.12 → 18.5.13
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +29 -4
- package/calendar/lib/calendar-range.component.d.ts +2 -1
- package/datetime-box/lib/datetime-box.component.d.ts +1 -1
- package/dialog/lib/dialog.class.d.ts +1 -0
- package/esm2022/calendar/lib/calendar-range.component.mjs +7 -7
- package/esm2022/calendar/lib/calendar.component.mjs +3 -3
- package/esm2022/datetime-box/lib/datetime-box.component.mjs +2 -2
- package/esm2022/datetime-picker/lib/datetime-picker.component.mjs +4 -1
- package/esm2022/dialog/lib/dialog.class.mjs +1 -1
- package/esm2022/dialog/lib/dialog.component.mjs +3 -3
- package/esm2022/number-box/lib/number-box.component.mjs +1 -1
- package/esm2022/uploader/index.mjs +2 -1
- package/esm2022/uploader/lib/uploader-browse-handle.directive.mjs +3 -3
- package/esm2022/uploader/lib/uploader-drop-zone.component.mjs +1 -1
- package/esm2022/uploader/lib/uploader-zone.directive.mjs +41 -12
- package/esm2022/uploader/lib/uploader.models.mjs +37 -31
- package/esm2022/uploader/lib/uploader.module.mjs +3 -8
- package/esm2022/uploader/lib/uploader.service.mjs +20 -5
- package/fesm2022/acorex-components-calendar.mjs +8 -8
- package/fesm2022/acorex-components-calendar.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-box.mjs +1 -1
- package/fesm2022/acorex-components-datetime-box.mjs.map +1 -1
- package/fesm2022/acorex-components-datetime-picker.mjs +3 -0
- package/fesm2022/acorex-components-datetime-picker.mjs.map +1 -1
- package/fesm2022/acorex-components-dialog.mjs +2 -2
- package/fesm2022/acorex-components-dialog.mjs.map +1 -1
- package/fesm2022/acorex-components-number-box.mjs.map +1 -1
- package/fesm2022/acorex-components-uploader.mjs +101 -54
- package/fesm2022/acorex-components-uploader.mjs.map +1 -1
- package/number-box/lib/number-box.component.d.ts +1 -1
- package/package.json +47 -47
- package/uploader/index.d.ts +1 -0
- package/uploader/lib/uploader-zone.directive.d.ts +9 -5
- package/uploader/lib/uploader.models.d.ts +26 -9
- package/uploader/lib/uploader.module.d.ts +10 -11
- package/uploader/lib/uploader.service.d.ts +8 -4
@@ -48,7 +48,7 @@ class AXDialogComponent extends MXBaseComponent {
|
|
48
48
|
provide: AXClosbaleComponent,
|
49
49
|
useExisting: AXDialogComponent,
|
50
50
|
},
|
51
|
-
], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-dialog ax-{{ data.type }}-default ax-orientation-{{ data.orientation }}\" cdkDrag
|
51
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-dialog ax-{{ data.type }}-default ax-orientation-{{ data.orientation }}\" tabindex=\"-1\" cdkDrag\n cdkDragHandle [cdkDragDisabled]=\"!data.draggable\">\n <div class=\"ax-dialog-content-wrapper\">\n @if(data.icon !== 'none'){\n <div class=\"ax-dialog-icon-side\">\n <i class=\"ax-dialog-icon {{ data.icon }}\"></i>\n </div>\n }\n <div class=\"ax-dialog-content-side\">\n <div class=\"ax-dialog-title\">{{ data.title }}</div>\n <div class=\"ax-dialog-content\">{{ data.content }}</div>\n </div>\n <div class=\"ax-dialog-dismiss-icon\">\n @if(data.closeButton){\n <i class=\"ax-icon ax-icon-close\"></i>\n }\n </div>\n </div>\n <ax-footer>\n @for(button of data.buttons; let i = $index; track i){\n <ax-button [text]=\"button.text | translate | async \" [tabindex]=\"i\" [axHotkey]=\"button.hotkey\"\n [axAutoFocus]=\"_hasAutoFocus(button)\" (onClick)=\"_handleButtonClick(button)\" [look]=\"button.look\"\n [disabled]=\"button.disabled\" [color]=\"button.color\">\n @if(button.loading){\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n\n </ax-footer>\n</div>", styles: [".ax-dark .ax-dialog.ax-primary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}.ax-dark .ax-dialog.ax-secondary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-secondary-200));color:rgba(var(--ax-color-secondary-fore-tint))}.ax-dark .ax-dialog.ax-success-default .ax-dialog-icon{background-color:rgba(var(--ax-color-success-200));color:rgba(var(--ax-color-success-fore-tint))}.ax-dark .ax-dialog.ax-warning-default .ax-dialog-icon{background-color:rgba(var(--ax-color-warning-200));color:rgba(var(--ax-color-warning-fore-tint))}.ax-dark .ax-dialog.ax-danger-default .ax-dialog-icon{background-color:rgba(var(--ax-color-danger-200));color:rgba(var(--ax-color-danger-fore-tint))}.ax-dark .ax-dialog.ax-info-default .ax-dialog-icon{background-color:rgba(var(--ax-color-info-200));color:rgba(var(--ax-color-info-fore-tint))}.ax-dialog{position:relative;display:flex;width:93vw;flex-direction:column;overflow:hidden;border-radius:var(--ax-rounded-border-default);border-width:1px;background-color:rgba(var(--ax-color-surface));color:rgba(var(--ax-color-surface-fore));outline:2px solid transparent;outline-offset:2px}@media (min-width: 768px){.ax-dialog{width:75vw}}@media (min-width: 1024px){.ax-dialog{width:50vw}}@media (min-width: 1280px){.ax-dialog{width:35vw}}@media (min-width: 1536px){.ax-dialog{width:25vw}}.ax-dialog.ax-orientation-horizontal .ax-dialog-content-wrapper{flex-direction:row}.ax-dialog.ax-orientation-vertical .ax-dialog-content-wrapper{flex-direction:column;align-items:center}.ax-dialog.ax-orientation-vertical .ax-dialog-content-wrapper .ax-dialog-icon-side{margin-bottom:1rem}.ax-dialog.ax-orientation-vertical .ax-dialog-content-wrapper .ax-dialog-content-side{margin:0;text-align:center}.ax-dialog.ax-orientation-vertical ax-footer ax-button{flex:1 1 0%}.ax-dialog .ax-dialog-content-wrapper{display:flex;gap:.5rem;padding:1.5rem 1.5rem 1rem}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-icon-side .ax-dialog-icon{display:flex;height:3rem;width:3rem;cursor:move;align-items:center;justify-content:center;border-radius:9999px;font-size:1.5rem;line-height:2rem}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-content-side{margin-inline-start:1rem;flex:1 1 0%}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-content-side .ax-dialog-title{margin-bottom:.5rem;font-size:1.125rem;line-height:1.5rem;font-weight:500}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-content-side .ax-dialog-content{font-size:.875rem;line-height:1.25rem}.ax-dialog ax-footer{justify-content:flex-end;padding:.75rem 1.5rem}.ax-dialog.ax-primary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-primary-100));color:rgba(var(--ax-color-primary-fore-tint))}.ax-dialog.ax-secondary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-secondary-100));color:rgba(var(--ax-color-secondary-fore-tint))}.ax-dialog.ax-success-default .ax-dialog-icon{background-color:rgba(var(--ax-color-success-100));color:rgba(var(--ax-color-success-fore-tint))}.ax-dialog.ax-warning-default .ax-dialog-icon{background-color:rgba(var(--ax-color-warning-100));color:rgba(var(--ax-color-warning-fore-tint))}.ax-dialog.ax-danger-default .ax-dialog-icon{background-color:rgba(var(--ax-color-danger-100));color:rgba(var(--ax-color-danger-fore-tint))}.ax-dialog.ax-info-default .ax-dialog-icon{background-color:rgba(var(--ax-color-info-100));color:rgba(var(--ax-color-info-fore-tint))}\n"], dependencies: [{ kind: "directive", type: i2.AXAutoFocusDirective, selector: "[axAutoFocus]", inputs: ["axAutoFocus", "axAutoFocusTime"] }, { kind: "directive", type: i2.AXHotkeyDirective, selector: "[axHotkey]", inputs: ["axHotkey"] }, { kind: "directive", type: i3.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i3.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: i4.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: i5.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "component", type: i6.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "pipe", type: i7.AsyncPipe, name: "async" }, { kind: "pipe", type: i8.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
52
52
|
}
|
53
53
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXDialogComponent, decorators: [{
|
54
54
|
type: Component,
|
@@ -57,7 +57,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
57
57
|
provide: AXClosbaleComponent,
|
58
58
|
useExisting: AXDialogComponent,
|
59
59
|
},
|
60
|
-
], template: "<div class=\"ax-dialog ax-{{ data.type }}-default ax-orientation-{{ data.orientation }}\" cdkDrag
|
60
|
+
], template: "<div class=\"ax-dialog ax-{{ data.type }}-default ax-orientation-{{ data.orientation }}\" tabindex=\"-1\" cdkDrag\n cdkDragHandle [cdkDragDisabled]=\"!data.draggable\">\n <div class=\"ax-dialog-content-wrapper\">\n @if(data.icon !== 'none'){\n <div class=\"ax-dialog-icon-side\">\n <i class=\"ax-dialog-icon {{ data.icon }}\"></i>\n </div>\n }\n <div class=\"ax-dialog-content-side\">\n <div class=\"ax-dialog-title\">{{ data.title }}</div>\n <div class=\"ax-dialog-content\">{{ data.content }}</div>\n </div>\n <div class=\"ax-dialog-dismiss-icon\">\n @if(data.closeButton){\n <i class=\"ax-icon ax-icon-close\"></i>\n }\n </div>\n </div>\n <ax-footer>\n @for(button of data.buttons; let i = $index; track i){\n <ax-button [text]=\"button.text | translate | async \" [tabindex]=\"i\" [axHotkey]=\"button.hotkey\"\n [axAutoFocus]=\"_hasAutoFocus(button)\" (onClick)=\"_handleButtonClick(button)\" [look]=\"button.look\"\n [disabled]=\"button.disabled\" [color]=\"button.color\">\n @if(button.loading){\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n\n </ax-footer>\n</div>", styles: [".ax-dark .ax-dialog.ax-primary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-primary-200));color:rgba(var(--ax-color-primary-fore-tint))}.ax-dark .ax-dialog.ax-secondary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-secondary-200));color:rgba(var(--ax-color-secondary-fore-tint))}.ax-dark .ax-dialog.ax-success-default .ax-dialog-icon{background-color:rgba(var(--ax-color-success-200));color:rgba(var(--ax-color-success-fore-tint))}.ax-dark .ax-dialog.ax-warning-default .ax-dialog-icon{background-color:rgba(var(--ax-color-warning-200));color:rgba(var(--ax-color-warning-fore-tint))}.ax-dark .ax-dialog.ax-danger-default .ax-dialog-icon{background-color:rgba(var(--ax-color-danger-200));color:rgba(var(--ax-color-danger-fore-tint))}.ax-dark .ax-dialog.ax-info-default .ax-dialog-icon{background-color:rgba(var(--ax-color-info-200));color:rgba(var(--ax-color-info-fore-tint))}.ax-dialog{position:relative;display:flex;width:93vw;flex-direction:column;overflow:hidden;border-radius:var(--ax-rounded-border-default);border-width:1px;background-color:rgba(var(--ax-color-surface));color:rgba(var(--ax-color-surface-fore));outline:2px solid transparent;outline-offset:2px}@media (min-width: 768px){.ax-dialog{width:75vw}}@media (min-width: 1024px){.ax-dialog{width:50vw}}@media (min-width: 1280px){.ax-dialog{width:35vw}}@media (min-width: 1536px){.ax-dialog{width:25vw}}.ax-dialog.ax-orientation-horizontal .ax-dialog-content-wrapper{flex-direction:row}.ax-dialog.ax-orientation-vertical .ax-dialog-content-wrapper{flex-direction:column;align-items:center}.ax-dialog.ax-orientation-vertical .ax-dialog-content-wrapper .ax-dialog-icon-side{margin-bottom:1rem}.ax-dialog.ax-orientation-vertical .ax-dialog-content-wrapper .ax-dialog-content-side{margin:0;text-align:center}.ax-dialog.ax-orientation-vertical ax-footer ax-button{flex:1 1 0%}.ax-dialog .ax-dialog-content-wrapper{display:flex;gap:.5rem;padding:1.5rem 1.5rem 1rem}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-icon-side .ax-dialog-icon{display:flex;height:3rem;width:3rem;cursor:move;align-items:center;justify-content:center;border-radius:9999px;font-size:1.5rem;line-height:2rem}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-content-side{margin-inline-start:1rem;flex:1 1 0%}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-content-side .ax-dialog-title{margin-bottom:.5rem;font-size:1.125rem;line-height:1.5rem;font-weight:500}.ax-dialog .ax-dialog-content-wrapper .ax-dialog-content-side .ax-dialog-content{font-size:.875rem;line-height:1.25rem}.ax-dialog ax-footer{justify-content:flex-end;padding:.75rem 1.5rem}.ax-dialog.ax-primary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-primary-100));color:rgba(var(--ax-color-primary-fore-tint))}.ax-dialog.ax-secondary-default .ax-dialog-icon{background-color:rgba(var(--ax-color-secondary-100));color:rgba(var(--ax-color-secondary-fore-tint))}.ax-dialog.ax-success-default .ax-dialog-icon{background-color:rgba(var(--ax-color-success-100));color:rgba(var(--ax-color-success-fore-tint))}.ax-dialog.ax-warning-default .ax-dialog-icon{background-color:rgba(var(--ax-color-warning-100));color:rgba(var(--ax-color-warning-fore-tint))}.ax-dialog.ax-danger-default .ax-dialog-icon{background-color:rgba(var(--ax-color-danger-100));color:rgba(var(--ax-color-danger-fore-tint))}.ax-dialog.ax-info-default .ax-dialog-icon{background-color:rgba(var(--ax-color-info-100));color:rgba(var(--ax-color-info-fore-tint))}\n"] }]
|
61
61
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
62
62
|
type: Inject,
|
63
63
|
args: [DIALOG_DATA]
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-components-dialog.mjs","sources":["../../../../libs/components/dialog/src/lib/dialog.component.ts","../../../../libs/components/dialog/src/lib/dialog.component.html","../../../../libs/components/dialog/src/lib/dialog.service.ts","../../../../libs/components/dialog/src/lib/dialog.module.ts","../../../../libs/components/dialog/src/acorex-components-dialog.ts"],"sourcesContent":["import { AXClosbaleComponent, AXComponentCloseEvent, MXBaseComponent } from '@acorex/components/common';\nimport { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';\nimport { ChangeDetectionStrategy, Component, HostBinding, Inject, ViewEncapsulation } from '@angular/core';\nimport { AXDialogButtonItem, AXDialogData } from './dialog.class';\n\n@Component({\n selector: 'ax-dialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: AXClosbaleComponent,\n useExisting: AXDialogComponent,\n },\n ],\n})\nexport class AXDialogComponent extends MXBaseComponent {\n protected _icon: string;\n\n /**\n * @ignore\n */\n constructor(\n @Inject(DIALOG_DATA)\n protected data: AXDialogData,\n private dialogRef: DialogRef<AXComponentCloseEvent>,\n ) {\n super();\n }\n\n protected _handleButtonClick(button: AXDialogButtonItem) {\n if (button.onClick) {\n button.onClick({ source: button });\n }\n }\n\n protected _hasAutoFocus(button: AXDialogButtonItem) {\n const result = button.autofocus || this.data.buttons.length == 1 || !this.data.buttons.some((c) => c.autofocus);\n return result;\n }\n\n close() {\n this.dialogRef.close();\n }\n\n @HostBinding('attr.tabIndex') get tabIndex() {\n return '-1';\n }\n}\n","<div class=\"ax-dialog ax-{{ data.type }}-default ax-orientation-{{ data.orientation }}\" cdkDrag cdkDragHandle\n tabindex=\"-1\">\n <div class=\"ax-dialog-content-wrapper\">\n @if(data.icon !== 'none'){\n <div class=\"ax-dialog-icon-side\">\n <i class=\"ax-dialog-icon {{ data.icon }}\"></i>\n </div>\n }\n <div class=\"ax-dialog-content-side\">\n <div class=\"ax-dialog-title\">{{ data.title }}</div>\n <div class=\"ax-dialog-content\">{{ data.content }}</div>\n </div>\n <div class=\"ax-dialog-dismiss-icon\">\n @if(data.closeButton){\n <i class=\"ax-icon ax-icon-close\"></i>\n }\n </div>\n </div>\n <ax-footer>\n @for(button of data.buttons; let i = $index; track i){\n <ax-button [text]=\"button.text | translate | async \" [tabindex]=\"i\" [axHotkey]=\"button.hotkey\"\n [axAutoFocus]=\"_hasAutoFocus(button)\" (onClick)=\"_handleButtonClick(button)\" [look]=\"button.look\"\n [disabled]=\"button.disabled\" [color]=\"button.color\">\n @if(button.loading){\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n\n </ax-footer>\n</div>","import { AXStyleColorType } from '@acorex/components/common';\nimport { Dialog } from '@angular/cdk/dialog';\nimport { Injectable, inject } from '@angular/core';\nimport { AXDialogConfig, AXDialogRef } from './dialog.class';\nimport { AXDialogComponent } from './dialog.component';\n\n/**\n * The Button is a component which detects user interaction and triggers a corresponding event\n *\n * @category Components\n */\n@Injectable()\nexport class AXDialogService {\n private dialog: Dialog = inject(Dialog);\n\n private detectIcon(type) {\n let icon: string;\n switch (type) {\n case 'success':\n icon = 'ax-icon ax-icon-check';\n break;\n case 'danger':\n icon = 'ax-icon ax-icon-error';\n break;\n case 'warning':\n icon = 'ax-icon ax-icon-warning';\n break;\n default:\n icon = 'ax-icon ax-icon-info';\n break;\n }\n return icon;\n }\n /**\n * Show an alert box with 'Okay' button.\n */\n alert(\n title: string,\n content: string,\n type: AXStyleColorType = 'primary',\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n ): Promise<void> {\n return new Promise((resolve) => {\n const popup = this.open({\n title,\n type: type,\n content,\n icon: this.detectIcon(type),\n orientation,\n buttons: [\n {\n name: 'confirm',\n text: 'okay',\n color: type,\n autofocus: true,\n onClick: () => {\n popup.close();\n if (resolve) {\n resolve();\n }\n },\n },\n ],\n });\n });\n }\n\n /**\n * Show a confirm box with 'Okay' & 'Cancel' buttons.\n */\n\n confirm(\n title: string,\n content: string,\n type: AXStyleColorType = 'primary',\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n ): Promise<{ result: boolean }> {\n return new Promise<{ result: boolean }>((resolve) => {\n const popup = this.open({\n title,\n content,\n type,\n icon: this.detectIcon(type),\n orientation,\n buttons: [\n {\n name: 'confirm',\n text: 'okay',\n color: type,\n autofocus: true,\n onClick: () => {\n popup.close();\n if (resolve) {\n resolve({ result: true });\n }\n },\n },\n {\n name: 'cancel',\n text: 'cancel',\n color: `ghost`,\n onClick: () => {\n popup.close();\n if (resolve) {\n resolve({ result: false });\n }\n },\n hotkey: {\n Escape: () => {\n popup.close();\n if (resolve) {\n resolve({ result: false });\n }\n },\n },\n },\n ],\n });\n });\n }\n\n /**\n * Show a custom dialog box.\n */\n show(options: AXDialogConfig): Promise<{ name: string }> {\n return new Promise((resolve) => {\n const popup = this.open(options);\n options.orientation = options.orientation || 'horizontal';\n (options.icon = options.icon ?? this.detectIcon(options.type)),\n options.buttons?.forEach((b) => {\n const orginalClick = b.onClick;\n b.onClick = () => {\n const e = { source: b, handled: false };\n if (orginalClick) {\n orginalClick(e);\n if (e.handled) {\n resolve({ name: b.name ?? b.text });\n } else {\n popup.close();\n resolve({ name: b.name ?? b.text });\n }\n } else if (resolve) {\n popup.close();\n resolve({ name: b.name ?? b.text });\n } else {\n popup.close();\n }\n };\n });\n });\n }\n\n open(config: AXDialogConfig): AXDialogRef {\n const dialogRef = this.dialog.open(AXDialogComponent, {\n data: config,\n role: 'alertdialog',\n ariaModal: true,\n restoreFocus: true,\n closeOnNavigation: true,\n closeOnDestroy: true,\n hasBackdrop: true,\n disableClose: true,\n panelClass: ['ax-animate-bounceIn', 'ax-animate-faster'],\n });\n return {\n close: () => {\n dialogRef.componentInstance?.close();\n },\n };\n }\n}\n","import { AXButtonModule } from '@acorex/components/button';\nimport { AXCommonModule, AXHotkeysService } from '@acorex/components/common';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { A11yModule } from '@angular/cdk/a11y';\nimport { DialogModule } from '@angular/cdk/dialog';\nimport { DragDropModule } from '@angular/cdk/drag-drop';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXDialogComponent } from './dialog.component';\nimport { AXDialogService } from './dialog.service';\n\nconst COMPONENT = [AXDialogComponent];\nconst MODULES = [\n CommonModule,\n AXCommonModule,\n DragDropModule,\n A11yModule,\n AXButtonModule,\n AXDecoratorModule,\n AXLoadingModule,\n DialogModule,\n AXTranslationModule,\n];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [AXDialogService, AXHotkeysService],\n})\nexport class AXDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBM,MAAO,iBAAkB,SAAQ,eAAe,CAAA;AAGpD;;AAEG;IACH,WAEY,CAAA,IAAkB,EACpB,SAA2C,EAAA;AAEnD,QAAA,KAAK,EAAE,CAAC;QAHE,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAc;QACpB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAkC;KAGpD;AAES,IAAA,kBAAkB,CAAC,MAA0B,EAAA;AACrD,QAAA,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;SACpC;KACF;AAES,IAAA,aAAa,CAAC,MAA0B,EAAA;AAChD,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KA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AY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;AAC/C,iBAAA,CAAA;;;AC/BD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-components-dialog.mjs","sources":["../../../../libs/components/dialog/src/lib/dialog.component.ts","../../../../libs/components/dialog/src/lib/dialog.component.html","../../../../libs/components/dialog/src/lib/dialog.service.ts","../../../../libs/components/dialog/src/lib/dialog.module.ts","../../../../libs/components/dialog/src/acorex-components-dialog.ts"],"sourcesContent":["import { AXClosbaleComponent, AXComponentCloseEvent, MXBaseComponent } from '@acorex/components/common';\nimport { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';\nimport { ChangeDetectionStrategy, Component, HostBinding, Inject, ViewEncapsulation } from '@angular/core';\nimport { AXDialogButtonItem, AXDialogData } from './dialog.class';\n\n@Component({\n selector: 'ax-dialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: AXClosbaleComponent,\n useExisting: AXDialogComponent,\n },\n ],\n})\nexport class AXDialogComponent extends MXBaseComponent {\n protected _icon: string;\n\n /**\n * @ignore\n */\n constructor(\n @Inject(DIALOG_DATA)\n protected data: AXDialogData,\n private dialogRef: DialogRef<AXComponentCloseEvent>,\n ) {\n super();\n }\n\n protected _handleButtonClick(button: AXDialogButtonItem) {\n if (button.onClick) {\n button.onClick({ source: button });\n }\n }\n\n protected _hasAutoFocus(button: AXDialogButtonItem) {\n const result = button.autofocus || this.data.buttons.length == 1 || !this.data.buttons.some((c) => c.autofocus);\n return result;\n }\n\n close() {\n this.dialogRef.close();\n }\n\n @HostBinding('attr.tabIndex') get tabIndex() {\n return '-1';\n }\n}\n","<div class=\"ax-dialog ax-{{ data.type }}-default ax-orientation-{{ data.orientation }}\" tabindex=\"-1\" cdkDrag\n cdkDragHandle [cdkDragDisabled]=\"!data.draggable\">\n <div class=\"ax-dialog-content-wrapper\">\n @if(data.icon !== 'none'){\n <div class=\"ax-dialog-icon-side\">\n <i class=\"ax-dialog-icon {{ data.icon }}\"></i>\n </div>\n }\n <div class=\"ax-dialog-content-side\">\n <div class=\"ax-dialog-title\">{{ data.title }}</div>\n <div class=\"ax-dialog-content\">{{ data.content }}</div>\n </div>\n <div class=\"ax-dialog-dismiss-icon\">\n @if(data.closeButton){\n <i class=\"ax-icon ax-icon-close\"></i>\n }\n </div>\n </div>\n <ax-footer>\n @for(button of data.buttons; let i = $index; track i){\n <ax-button [text]=\"button.text | translate | async \" [tabindex]=\"i\" [axHotkey]=\"button.hotkey\"\n [axAutoFocus]=\"_hasAutoFocus(button)\" (onClick)=\"_handleButtonClick(button)\" [look]=\"button.look\"\n [disabled]=\"button.disabled\" [color]=\"button.color\">\n @if(button.loading){\n <ax-loading></ax-loading>\n }\n </ax-button>\n }\n\n </ax-footer>\n</div>","import { AXStyleColorType } from '@acorex/components/common';\nimport { Dialog } from '@angular/cdk/dialog';\nimport { Injectable, inject } from '@angular/core';\nimport { AXDialogConfig, AXDialogRef } from './dialog.class';\nimport { AXDialogComponent } from './dialog.component';\n\n/**\n * The Button is a component which detects user interaction and triggers a corresponding event\n *\n * @category Components\n */\n@Injectable()\nexport class AXDialogService {\n private dialog: Dialog = inject(Dialog);\n\n private detectIcon(type) {\n let icon: string;\n switch (type) {\n case 'success':\n icon = 'ax-icon ax-icon-check';\n break;\n case 'danger':\n icon = 'ax-icon ax-icon-error';\n break;\n case 'warning':\n icon = 'ax-icon ax-icon-warning';\n break;\n default:\n icon = 'ax-icon ax-icon-info';\n break;\n }\n return icon;\n }\n /**\n * Show an alert box with 'Okay' button.\n */\n alert(\n title: string,\n content: string,\n type: AXStyleColorType = 'primary',\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n ): Promise<void> {\n return new Promise((resolve) => {\n const popup = this.open({\n title,\n type: type,\n content,\n icon: this.detectIcon(type),\n orientation,\n buttons: [\n {\n name: 'confirm',\n text: 'okay',\n color: type,\n autofocus: true,\n onClick: () => {\n popup.close();\n if (resolve) {\n resolve();\n }\n },\n },\n ],\n });\n });\n }\n\n /**\n * Show a confirm box with 'Okay' & 'Cancel' buttons.\n */\n\n confirm(\n title: string,\n content: string,\n type: AXStyleColorType = 'primary',\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n ): Promise<{ result: boolean }> {\n return new Promise<{ result: boolean }>((resolve) => {\n const popup = this.open({\n title,\n content,\n type,\n icon: this.detectIcon(type),\n orientation,\n buttons: [\n {\n name: 'confirm',\n text: 'okay',\n color: type,\n autofocus: true,\n onClick: () => {\n popup.close();\n if (resolve) {\n resolve({ result: true });\n }\n },\n },\n {\n name: 'cancel',\n text: 'cancel',\n color: `ghost`,\n onClick: () => {\n popup.close();\n if (resolve) {\n resolve({ result: false });\n }\n },\n hotkey: {\n Escape: () => {\n popup.close();\n if (resolve) {\n resolve({ result: false });\n }\n },\n },\n },\n ],\n });\n });\n }\n\n /**\n * Show a custom dialog box.\n */\n show(options: AXDialogConfig): Promise<{ name: string }> {\n return new Promise((resolve) => {\n const popup = this.open(options);\n options.orientation = options.orientation || 'horizontal';\n (options.icon = options.icon ?? this.detectIcon(options.type)),\n options.buttons?.forEach((b) => {\n const orginalClick = b.onClick;\n b.onClick = () => {\n const e = { source: b, handled: false };\n if (orginalClick) {\n orginalClick(e);\n if (e.handled) {\n resolve({ name: b.name ?? b.text });\n } else {\n popup.close();\n resolve({ name: b.name ?? b.text });\n }\n } else if (resolve) {\n popup.close();\n resolve({ name: b.name ?? b.text });\n } else {\n popup.close();\n }\n };\n });\n });\n }\n\n open(config: AXDialogConfig): AXDialogRef {\n const dialogRef = this.dialog.open(AXDialogComponent, {\n data: config,\n role: 'alertdialog',\n ariaModal: true,\n restoreFocus: true,\n closeOnNavigation: true,\n closeOnDestroy: true,\n hasBackdrop: true,\n disableClose: true,\n panelClass: ['ax-animate-bounceIn', 'ax-animate-faster'],\n });\n return {\n close: () => {\n dialogRef.componentInstance?.close();\n },\n };\n }\n}\n","import { AXButtonModule } from '@acorex/components/button';\nimport { AXCommonModule, AXHotkeysService } from '@acorex/components/common';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { A11yModule } from '@angular/cdk/a11y';\nimport { DialogModule } from '@angular/cdk/dialog';\nimport { DragDropModule } from '@angular/cdk/drag-drop';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXDialogComponent } from './dialog.component';\nimport { AXDialogService } from './dialog.service';\n\nconst COMPONENT = [AXDialogComponent];\nconst MODULES = [\n CommonModule,\n AXCommonModule,\n DragDropModule,\n A11yModule,\n AXButtonModule,\n AXDecoratorModule,\n AXLoadingModule,\n DialogModule,\n AXTranslationModule,\n];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [AXDialogService, AXHotkeysService],\n})\nexport class AXDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBM,MAAO,iBAAkB,SAAQ,eAAe,CAAA;AAGpD;;AAEG;IACH,WAEY,CAAA,IAAkB,EACpB,SAA2C,EAAA;AAEnD,QAAA,KAAK,EAAE,CAAC;QAHE,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAc;QACpB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAkC;KAGpD;AAES,IAAA,kBAAkB,CAAC,MAA0B,EAAA;AACrD,QAAA,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;SACpC;KACF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AA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,aAFd,CAAC,eAAe,EAAE,gBAAgB,CAAC,YAFjC,OAAO,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAIT,cAAc,EAAA,UAAA,EAAA,CAAA;kBAN1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;AAC/C,iBAAA,CAAA;;;AC/BD;;AAEG;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"acorex-components-number-box.mjs","sources":["../../../../libs/components/number-box/src/lib/number-box.component.ts","../../../../libs/components/number-box/src/lib/number-box.component.html","../../../../libs/components/number-box/src/lib/number-box.module.ts","../../../../libs/components/number-box/src/acorex-components-number-box.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Input,\n ViewChild,\n ViewEncapsulation,\n forwardRef,\n} from '@angular/core';\nimport { IMaskDirective } from 'angular-imask';\nimport { MaskedNumber, createMask } from 'imask';\n\nimport {\n AXClearableComponent,\n AXComponent,\n AXFocusableComponent,\n AXValuableComponent,\n MXInputBaseValueComponent,\n MXLookComponent,\n} from '@acorex/components/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { isEmpty, toNumber } from 'lodash-es';\nimport { classes } from 'polytype';\n\n/**\n * The NumberBox is a component which detects user interaction and triggers a corresponding event\n *\n * @category Components\n */\n@Component({\n selector: 'ax-number-box',\n templateUrl: './number-box.component.html',\n styleUrls: ['./number-box.component.scss'],\n inputs: ['disabled', 'readonly', 'tabIndex', 'placeholder', 'value', 'state', 'name', 'id', 'look'],\n outputs: [\n 'valueChange',\n 'stateChange',\n 'onValueChanged',\n 'onBlur',\n 'onFocus',\n 'readonlyChange',\n 'disabledChange',\n 'onKeyDown',\n 'onKeyUp',\n 'onKeyPress',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n\n providers: [\n { provide: AXComponent, useExisting: AXNumberBoxComponent },\n { provide: AXFocusableComponent, useExisting: AXNumberBoxComponent },\n { provide: AXClearableComponent, useExisting: AXNumberBoxComponent },\n { provide: AXValuableComponent, useExisting: AXNumberBoxComponent },\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AXNumberBoxComponent),\n multi: true,\n },\n ],\n})\nexport class AXNumberBoxComponent extends classes(MXInputBaseValueComponent<number>, MXLookComponent) implements AfterViewInit {\n @ViewChild('input') input: ElementRef<HTMLInputElement>;\n\n private _thousandsSeparator: string;\n /**\n * A character value that specifies the separator character.\n */\n @Input()\n public get thousandsSeparator(): string {\n return this._thousandsSeparator;\n }\n public set thousandsSeparator(v: string) {\n this.setOption({\n name: 'thousandsSeparator',\n value: v ?? '',\n });\n }\n\n private _padDecimalZeros = false;\n /**\n * A character value that specifies the separator character.\n */\n @Input()\n public get padDecimalZeros(): boolean {\n return this._padDecimalZeros;\n }\n public set padDecimalZeros(v: boolean) {\n this.setOption({\n name: 'padDecimalZeros',\n value: v,\n });\n }\n\n /**\n * Specifies the value that is used to increment or decrement the **Integer** part of number\n */\n @Input()\n step = 1;\n\n private _decimals = 0;\n /**\n * Specifies the number of decimals that the user can enter\n */\n @Input()\n public get decimals(): number {\n return this._decimals;\n }\n public set decimals(v: number) {\n this.setOption({\n name: 'decimals',\n value: v ?? 0,\n });\n }\n\n /**\n * Specifies the value that is used to increment or decrement the **Deciaml** part of number\n */\n @Input()\n decimalStep: number | 'auto' = 'auto';\n\n /**\n * Specifies whether the Up and Down spin buttons will be rendered or not\n */\n @Input()\n showSpinButtons = true;\n\n private _minValue: number = Number.MIN_SAFE_INTEGER;\n /**\n * Specifies the smallest value that is valid\n */\n @Input()\n public get minValue(): number {\n return this._minValue;\n }\n public set minValue(v: number) {\n this.setOption({\n name: 'minValue',\n value: v != null ? Number(v) : Number.MIN_SAFE_INTEGER,\n });\n }\n\n private _maxValue: number = Number.MAX_SAFE_INTEGER;\n /**\n * Specifies the greatest value that is valid\n */\n @Input()\n public get maxValue(): number {\n return this._maxValue;\n }\n public set maxValue(v: number) {\n this.setOption({\n name: 'maxValue',\n value: v != null ? Number(v) : Number.MAX_SAFE_INTEGER,\n });\n }\n\n @Input('class')\n classNames: string;\n\n /**\n * @ignore\n */\n _maskObj: MaskedNumber;\n\n @ViewChild(IMaskDirective)\n private _maskDirective: IMaskDirective<MaskedNumber>;\n\n ngAfterViewInit(): void {\n this._updateMask();\n }\n\n override internalOptionChanged(): void {\n this._updateMask();\n }\n\n override reset(): void {\n this.input.nativeElement.value = null;\n super.reset(true);\n }\n\n override internalSetValue(value: any): number {\n // || (value == 0 && !this._maskObj.value)\n if (value == null) {\n return this.defaultValue;\n }\n const v = toNumber(value);\n if (v < this.minValue) return this.minValue;\n if (v > this.maxValue) return this.maxValue;\n return v;\n }\n\n private _updateMask() {\n if (!this._maskObj) {\n this._maskObj = createMask({\n mask: Number,\n min: this.minValue,\n max: this.maxValue,\n thousandsSeparator: this.thousandsSeparator || '',\n scale: this.decimals,\n radix: '.',\n padFractionalZeros: this.decimals > 0 && this.padDecimalZeros,\n });\n\n this._maskObj.format = (v: number, m) => {\n return !isNaN(v)\n ? v.toLocaleString('en-US', {\n useGrouping: false,\n maximumFractionDigits: 20,\n })\n : '';\n };\n } else {\n this._maskObj.updateOptions({\n min: this.minValue,\n max: this.maxValue,\n thousandsSeparator: this.thousandsSeparator || '',\n scale: this.decimals,\n radix: '.',\n padFractionalZeros: this.decimals > 0 && this.padDecimalZeros,\n });\n }\n this._maskDirective?.maskRef?.updateValue();\n this._maskDirective?.maskRef?.updateControl();\n }\n\n _handleModelChange(value: number) {\n if (value == 0 && isEmpty(this.input?.nativeElement?.value)) {\n value = null;\n }\n\n this.commitValue(value, true);\n }\n\n _handleOnKeydownEvent(e: KeyboardEvent) {\n if (this.disabled || this.readonly) return;\n const ignore = () => {\n e.preventDefault();\n e.stopPropagation();\n };\n const input = e.target as HTMLInputElement;\n const valStr = input.value;\n const decimalPointIndex = valStr.indexOf('.');\n const _cursorPos = input.selectionStart!;\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n if (decimalPointIndex > 0 && _cursorPos > decimalPointIndex && this.decimals > 0) {\n e.key === 'ArrowDown' ? this.decimalStepDown(true) : this.decimalStepUp(true);\n } else {\n e.key === 'ArrowDown' ? this.stepDown(true) : this.stepUp(true);\n }\n ignore();\n setTimeout(() => {\n input.setSelectionRange(_cursorPos, _cursorPos);\n }, 5);\n }\n super.emitOnKeydownEvent(e);\n }\n\n _handleUpDownClick(v: -1 | 1) {\n if (this.disabled || this.readonly) return;\n v == 1 ? this.stepUp(true) : this.stepDown(true);\n }\n\n stepUp(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value + toNumber(this.step), u);\n }\n\n stepDown(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value - toNumber(this.step), u);\n }\n\n decimalStepUp(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value + toNumber(this.decimalStep == 'auto' ? 1 / Math.pow(10, this.decimals) : this.decimalStep), u);\n }\n\n decimalStepDown(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value - toNumber(this.decimalStep == 'auto' ? 1 / Math.pow(10, this.decimals) : this.decimalStep), u);\n }\n\n // @HostBinding('class')\n // get __hostClass(): string {\n // return `ax-editor-container ax-look-${this.look} ${this.disabled ? 'ax-state-disabled' : ''}`;\n // }\n}\n","<div class=\"ax-editor-container ax-look-{{look}} {{classNames}}\" [class.ax-state-disabled]=\"disabled\">\n <ng-content select=\"ax-prefix\"> </ng-content>\n <input #input class=\"ax-input\" type=\"text\" [id]=\"id\" [name]=\"name\" [attr.placeholder]=\"placeholder\"\n [attr.autocomplete]=\"'off'\" [imask]=\"_maskObj\" [unmask]=\"'typed'\" [attr.min]=\"minValue\" [attr.max]=\"maxValue\"\n [class.ax-state-disabled]=\"disabled\" [class.ax-state-readonly]=\"readonly\" [disabled]=\"disabled\"\n [readonly]=\"readonly\" [tabindex]=\"tabIndex\" [ngModel]=\"value\" (ngModelChange)=\"_handleModelChange($event)\"\n (keydown)=\"_handleOnKeydownEvent($event)\" (keyup)=\"emitOnKeyupEvent($event)\"\n (keypress)=\"emitOnKeypressEvent($event)\" (focus)=\"emitOnFocusEvent($event)\" (blur)=\"emitOnBlurEvent($event)\" />\n @if(input.value && !disabled && !readonly){\n <ng-content select=\"ax-clear-button\"></ng-content>\n }\n @if(showSpinButtons){\n <div class=\"ax-number-box-control\">\n <button type=\"button\" class=\"ax-general-button ax-button-icon\" [class.ax-state-disabled]=\"disabled\"\n (click)=\"_handleUpDownClick(1)\" tabindex=\"-1\" [disabled]=\"disabled\"><span\n class=\"ax-icon ax-icon-chevron-up ax-arrow-button \"></span></button>\n <button type=\"button\" class=\"ax-general-button ax-button-icon\" [class.ax-state-disabled]=\"disabled\"\n (click)=\"_handleUpDownClick(-1)\" [disabled]=\"disabled\"><span\n class=\"ax-icon ax-icon-chevron-down ax-arrow-button \"></span></button>\n </div>\n\n }\n\n <ng-content select=\"ax-suffix\"> </ng-content>\n</div>\n<ng-content select=\"ax-validation-rule\"> </ng-content>\n<div class=\"ax-error-container\"></div>","import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { IMaskModule } from 'angular-imask';\nimport { AXNumberBoxComponent } from './number-box.component';\n\nconst COMPONENT = [AXNumberBoxComponent];\nconst MODULES = [CommonModule, FormsModule, AXButtonModule, AXDecoratorModule, IMaskModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXNumberBoxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAyBA;;;;AAIG;AAiCG,MAAO,oBAAqB,SAAQ,OAAO,EAAC,yBAAiC,GAAE,eAAe,CAAC,CAAA;AAhCrG,IAAA,WAAA,GAAA;;QAkDU,IAAgB,CAAA,gBAAA,GAAG,KAAK,CAAC;AAejC;;AAEG;QAEH,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;QAED,IAAS,CAAA,SAAA,GAAG,CAAC,CAAC;AAetB;;AAEG;QAEH,IAAW,CAAA,WAAA,GAAoB,MAAM,CAAC;AAEtC;;AAEG;QAEH,IAAe,CAAA,eAAA,GAAG,IAAI,CAAC;AAEf,QAAA,IAAA,CAAA,SAAS,GAAW,MAAM,CAAC,gBAAgB,CAAC;AAe5C,QAAA,IAAA,CAAA,SAAS,GAAW,MAAM,CAAC,gBAAgB,CAAC;AA0JrD,KAAA;AAvOC;;AAEG;AACH,IAAA,IACW,kBAAkB,GAAA;QAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC;KACjC;IACD,IAAW,kBAAkB,CAAC,CAAS,EAAA;QACrC,IAAI,CAAC,SAAS,CAAC;AACb,YAAA,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,CAAC,IAAI,EAAE;AACf,SAAA,CAAC,CAAC;KACJ;AAGD;;AAEG;AACH,IAAA,IACW,eAAe,GAAA;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC;KAC9B;IACD,IAAW,eAAe,CAAC,CAAU,EAAA;QACnC,IAAI,CAAC,SAAS,CAAC;AACb,YAAA,IAAI,EAAE,iBAAiB;AACvB,YAAA,KAAK,EAAE,CAAC;AACT,SAAA,CAAC,CAAC;KACJ;AASD;;AAE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AAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA,CAAA;;;AChBD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"acorex-components-number-box.mjs","sources":["../../../../libs/components/number-box/src/lib/number-box.component.ts","../../../../libs/components/number-box/src/lib/number-box.component.html","../../../../libs/components/number-box/src/lib/number-box.module.ts","../../../../libs/components/number-box/src/acorex-components-number-box.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Input,\n ViewChild,\n ViewEncapsulation,\n forwardRef,\n} from '@angular/core';\nimport { IMaskDirective } from 'angular-imask';\nimport { MaskedNumber, createMask } from 'imask';\n\nimport {\n AXClearableComponent,\n AXComponent,\n AXFocusableComponent,\n AXValuableComponent,\n MXInputBaseValueComponent,\n MXLookComponent,\n} from '@acorex/components/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { isEmpty, toNumber } from 'lodash-es';\nimport { classes } from 'polytype';\n\n/**\n * The NumberBox is a component which detects user interaction and triggers a corresponding event\n *\n * @category Components\n */\n@Component({\n selector: 'ax-number-box',\n templateUrl: './number-box.component.html',\n styleUrls: ['./number-box.component.scss'],\n inputs: ['disabled', 'readonly', 'tabIndex', 'placeholder', 'value', 'state', 'name', 'id', 'look'],\n outputs: [\n 'valueChange',\n 'stateChange',\n 'onValueChanged',\n 'onBlur',\n 'onFocus',\n 'readonlyChange',\n 'disabledChange',\n 'onKeyDown',\n 'onKeyUp',\n 'onKeyPress',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n\n providers: [\n { provide: AXComponent, useExisting: AXNumberBoxComponent },\n { provide: AXFocusableComponent, useExisting: AXNumberBoxComponent },\n { provide: AXClearableComponent, useExisting: AXNumberBoxComponent },\n { provide: AXValuableComponent, useExisting: AXNumberBoxComponent },\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AXNumberBoxComponent),\n multi: true,\n },\n ],\n})\nexport class AXNumberBoxComponent extends classes(MXInputBaseValueComponent<number>, MXLookComponent) implements AfterViewInit {\n @ViewChild('input') input: ElementRef<HTMLInputElement>;\n\n private _thousandsSeparator: string;\n /**\n * A character value that specifies the separator character.\n */\n @Input()\n public get thousandsSeparator(): string {\n return this._thousandsSeparator;\n }\n public set thousandsSeparator(v: string) {\n this.setOption({\n name: 'thousandsSeparator',\n value: v ?? '',\n });\n }\n\n private _padDecimalZeros = false;\n /**\n * A character value that specifies the separator character.\n */\n @Input()\n public get padDecimalZeros(): boolean {\n return this._padDecimalZeros;\n }\n public set padDecimalZeros(v: boolean) {\n this.setOption({\n name: 'padDecimalZeros',\n value: v,\n });\n }\n\n /**\n * Specifies the value that is used to increment or decrement the **Integer** part of number\n */\n @Input()\n step = 1;\n\n private _decimals = 0;\n /**\n * Specifies the number of decimals that the user can enter\n */\n @Input()\n public get decimals(): number {\n return this._decimals;\n }\n public set decimals(v: number) {\n this.setOption({\n name: 'decimals',\n value: v ?? 0,\n });\n }\n\n /**\n * Specifies the value that is used to increment or decrement the **Deciaml** part of number\n */\n @Input()\n decimalStep: number | 'auto' = 'auto';\n\n /**\n * Specifies whether the Up and Down spin buttons will be rendered or not\n */\n @Input()\n showSpinButtons = true;\n\n private _minValue: number = Number.MIN_SAFE_INTEGER;\n /**\n * Specifies the smallest value that is valid\n */\n @Input()\n public get minValue(): number {\n return this._minValue;\n }\n public set minValue(v: number) {\n this.setOption({\n name: 'minValue',\n value: v != null ? Number(v) : Number.MIN_SAFE_INTEGER,\n });\n }\n\n private _maxValue: number = Number.MAX_SAFE_INTEGER;\n /**\n * Specifies the greatest value that is valid\n */\n @Input()\n public get maxValue(): number {\n return this._maxValue;\n }\n public set maxValue(v: number) {\n this.setOption({\n name: 'maxValue',\n value: v != null ? Number(v) : Number.MAX_SAFE_INTEGER,\n });\n }\n\n @Input('class')\n classNames: string;\n\n /**\n * @ignore\n */\n _maskObj: MaskedNumber;\n\n @ViewChild(IMaskDirective)\n private _maskDirective: IMaskDirective<MaskedNumber>;\n\n ngAfterViewInit(): void {\n this._updateMask();\n }\n\n override internalOptionChanged(): void {\n this._updateMask();\n }\n\n override reset(): void {\n this.input.nativeElement.value = null;\n super.reset(true);\n }\n\n override internalSetValue(value: any): number {\n // || (value == 0 && !this._maskObj.value)\n if (value == null) {\n return this.defaultValue;\n }\n const v = toNumber(value);\n if (v < this.minValue) return this.minValue;\n if (v > this.maxValue) return this.maxValue;\n return v;\n }\n\n private _updateMask() {\n if (!this._maskObj) {\n this._maskObj = createMask({\n mask: Number,\n min: this.minValue,\n max: this.maxValue,\n thousandsSeparator: this.thousandsSeparator || '',\n scale: this.decimals,\n radix: '.',\n padFractionalZeros: this.decimals > 0 && this.padDecimalZeros,\n });\n\n this._maskObj.format = (v: number, m) => {\n return !isNaN(v)\n ? v.toLocaleString('en-US', {\n useGrouping: false,\n maximumFractionDigits: 20,\n })\n : '';\n };\n } else {\n this._maskObj.updateOptions({\n min: this.minValue,\n max: this.maxValue,\n thousandsSeparator: this.thousandsSeparator || '',\n scale: this.decimals,\n radix: '.',\n padFractionalZeros: this.decimals > 0 && this.padDecimalZeros,\n });\n }\n this._maskDirective?.maskRef?.updateValue();\n this._maskDirective?.maskRef?.updateControl();\n }\n\n _handleModelChange(value: number) {\n if (value == 0 && isEmpty(this.input?.nativeElement?.value)) {\n value = null;\n }\n\n this.commitValue(value, true);\n }\n\n _handleOnKeydownEvent(e: KeyboardEvent) {\n if (this.disabled || this.readonly) return;\n const ignore = () => {\n e.preventDefault();\n e.stopPropagation();\n };\n const input = e.target as HTMLInputElement;\n const valStr = input.value;\n const decimalPointIndex = valStr.indexOf('.');\n const _cursorPos = input.selectionStart!;\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n if (decimalPointIndex > 0 && _cursorPos > decimalPointIndex && this.decimals > 0) {\n e.key === 'ArrowDown' ? this.decimalStepDown(true) : this.decimalStepUp(true);\n } else {\n e.key === 'ArrowDown' ? this.stepDown(true) : this.stepUp(true);\n }\n ignore();\n setTimeout(() => {\n input.setSelectionRange(_cursorPos, _cursorPos);\n }, 5);\n }\n super.emitOnKeydownEvent(e);\n }\n\n protected _handleUpDownClick(v: -1 | 1) {\n if (this.disabled || this.readonly) return;\n v == 1 ? this.stepUp(true) : this.stepDown(true);\n }\n\n stepUp(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value + toNumber(this.step), u);\n }\n\n stepDown(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value - toNumber(this.step), u);\n }\n\n decimalStepUp(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value + toNumber(this.decimalStep == 'auto' ? 1 / Math.pow(10, this.decimals) : this.decimalStep), u);\n }\n\n decimalStepDown(u = false) {\n if (!this.value) {\n this.commitValue(Math.max(this.minValue, 0), u);\n }\n this.commitValue(this.value - toNumber(this.decimalStep == 'auto' ? 1 / Math.pow(10, this.decimals) : this.decimalStep), u);\n }\n\n // @HostBinding('class')\n // get __hostClass(): string {\n // return `ax-editor-container ax-look-${this.look} ${this.disabled ? 'ax-state-disabled' : ''}`;\n // }\n}\n","<div class=\"ax-editor-container ax-look-{{look}} {{classNames}}\" [class.ax-state-disabled]=\"disabled\">\n <ng-content select=\"ax-prefix\"> </ng-content>\n <input #input class=\"ax-input\" type=\"text\" [id]=\"id\" [name]=\"name\" [attr.placeholder]=\"placeholder\"\n [attr.autocomplete]=\"'off'\" [imask]=\"_maskObj\" [unmask]=\"'typed'\" [attr.min]=\"minValue\" [attr.max]=\"maxValue\"\n [class.ax-state-disabled]=\"disabled\" [class.ax-state-readonly]=\"readonly\" [disabled]=\"disabled\"\n [readonly]=\"readonly\" [tabindex]=\"tabIndex\" [ngModel]=\"value\" (ngModelChange)=\"_handleModelChange($event)\"\n (keydown)=\"_handleOnKeydownEvent($event)\" (keyup)=\"emitOnKeyupEvent($event)\"\n (keypress)=\"emitOnKeypressEvent($event)\" (focus)=\"emitOnFocusEvent($event)\" (blur)=\"emitOnBlurEvent($event)\" />\n @if(input.value && !disabled && !readonly){\n <ng-content select=\"ax-clear-button\"></ng-content>\n }\n @if(showSpinButtons){\n <div class=\"ax-number-box-control\">\n <button type=\"button\" class=\"ax-general-button ax-button-icon\" [class.ax-state-disabled]=\"disabled\"\n (click)=\"_handleUpDownClick(1)\" tabindex=\"-1\" [disabled]=\"disabled\"><span\n class=\"ax-icon ax-icon-chevron-up ax-arrow-button \"></span></button>\n <button type=\"button\" class=\"ax-general-button ax-button-icon\" [class.ax-state-disabled]=\"disabled\"\n (click)=\"_handleUpDownClick(-1)\" [disabled]=\"disabled\"><span\n class=\"ax-icon ax-icon-chevron-down ax-arrow-button \"></span></button>\n </div>\n\n }\n\n <ng-content select=\"ax-suffix\"> </ng-content>\n</div>\n<ng-content select=\"ax-validation-rule\"> </ng-content>\n<div class=\"ax-error-container\"></div>","import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { IMaskModule } from 'angular-imask';\nimport { AXNumberBoxComponent } from './number-box.component';\n\nconst COMPONENT = [AXNumberBoxComponent];\nconst MODULES = [CommonModule, FormsModule, AXButtonModule, AXDecoratorModule, IMaskModule];\n\n@NgModule({\n declarations: [...COMPONENT],\n imports: [...MODULES],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXNumberBoxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAyBA;;;;AAIG;AAiCG,MAAO,oBAAqB,SAAQ,OAAO,EAAC,yBAAiC,GAAE,eAAe,CAAC,CAAA;AAhCrG,IAAA,WAAA,GAAA;;QAkDU,IAAgB,CAAA,gBAAA,GAAG,KAAK,CAAC;AA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AAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAjB,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,iBAAiB,EATX,YAAA,EAAA,CAAA,oBAAoB,CACtB,EAAA,OAAA,EAAA,CAAA,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,aADvE,oBAAoB,CAAA,EAAA,CAAA,CAAA,EAAA;AAS1B,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,iBAAiB,YAJf,OAAO,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAIT,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAN7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;AAC5B,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;AACrB,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA,CAAA;;;AChBD;;AAEG;;;;"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { signal, inject, Injectable, Directive, Input, HostBinding, ElementRef, Component, ViewEncapsulation, NgModule } from '@angular/core';
|
3
|
-
import { AXFileService, AXFileModule } from '@acorex/core/file';
|
2
|
+
import { signal, computed, inject, Injectable, EventEmitter, Directive, Input, Output, HostBinding, ElementRef, Component, ViewEncapsulation, NgModule } from '@angular/core';
|
4
3
|
import * as i3 from '@acorex/core/translation';
|
5
4
|
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
6
5
|
import { AXPopupService, AXPopupModule } from '@acorex/components/popup';
|
6
|
+
import { AXFileService, AXFileModule } from '@acorex/core/file';
|
7
7
|
import { sumBy } from 'lodash-es';
|
8
|
-
import { BehaviorSubject, interval, switchMap, map } from 'rxjs';
|
8
|
+
import { BehaviorSubject, Subject, interval, switchMap, map } from 'rxjs';
|
9
|
+
import { AXUnsubscriber } from '@acorex/core/utils';
|
9
10
|
import { AXClosbaleComponent, MXBaseComponent } from '@acorex/components/common';
|
10
11
|
import { trigger, state, style, AUTO_STYLE, transition, animate } from '@angular/animations';
|
11
12
|
import * as i1$1 from '@angular/common';
|
@@ -20,7 +21,6 @@ import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
20
21
|
import { AXButtonModule } from '@acorex/components/button';
|
21
22
|
import { AXProgressBarModule } from '@acorex/components/progress-bar';
|
22
23
|
import { AXDateTimeModule } from '@acorex/core/date-time';
|
23
|
-
import { HttpClientModule } from '@angular/common/http';
|
24
24
|
|
25
25
|
class AXUploadRequest {
|
26
26
|
get name() {
|
@@ -39,15 +39,18 @@ class AXUploadRequest {
|
|
39
39
|
get size() {
|
40
40
|
return this.file.size;
|
41
41
|
}
|
42
|
-
|
43
|
-
this.
|
44
|
-
|
45
|
-
|
46
|
-
this.
|
42
|
+
get file() {
|
43
|
+
return this.uploadFile;
|
44
|
+
}
|
45
|
+
constructor(uploadFile) {
|
46
|
+
this.uploadFile = uploadFile;
|
47
|
+
this._progress = signal(0);
|
48
|
+
this.progress = computed(() => this._progress());
|
49
|
+
this._estimateTime = signal(0);
|
50
|
+
this.estimateTime = computed(() => this._estimateTime());
|
51
|
+
this._status = signal('new');
|
52
|
+
this.status = computed(() => this._status());
|
47
53
|
this.bytesTransferred = 0;
|
48
|
-
this.uploadSpeed = 1000000; // Simulated upload speed in bytes per interval (e.g., 50KB per interval)
|
49
|
-
this.interval = 1000;
|
50
|
-
this.intervalId = -1;
|
51
54
|
}
|
52
55
|
estimateTimeRemaining(bytesTransferred) {
|
53
56
|
const now = Date.now();
|
@@ -60,32 +63,35 @@ class AXUploadRequest {
|
|
60
63
|
const estimatedTime = Math.ceil(remainingBytes / speed); // Time in milliseconds
|
61
64
|
return estimatedTime; // Return the estimated time in milliseconds
|
62
65
|
}
|
66
|
+
setTransferredBytes(value) {
|
67
|
+
this.bytesTransferred = value;
|
68
|
+
this.updateEstimateTime();
|
69
|
+
}
|
70
|
+
updateEstimateTime() {
|
71
|
+
this._estimateTime.set(this.estimateTimeRemaining(this.bytesTransferred));
|
72
|
+
const progress = Math.floor((this.bytesTransferred / this.size) * 100);
|
73
|
+
this._progress.set(progress);
|
74
|
+
}
|
63
75
|
async upload() {
|
64
76
|
this.startTime = Date.now();
|
65
|
-
this.
|
66
|
-
this.
|
67
|
-
this.
|
68
|
-
this.
|
69
|
-
if (this.bytesTransferred > this.size) {
|
70
|
-
this.bytesTransferred = this.size;
|
71
|
-
}
|
72
|
-
const progress = Math.floor((this.bytesTransferred / this.size) * 100);
|
73
|
-
this.progress.set(progress);
|
74
|
-
this.estimateTime.set(this.estimateTimeRemaining(this.bytesTransferred));
|
75
|
-
if (this.bytesTransferred === this.size) {
|
76
|
-
clearInterval(this.intervalId);
|
77
|
-
this.progress.set(100);
|
78
|
-
this.status.set('completed');
|
79
|
-
}
|
80
|
-
}, this.interval);
|
77
|
+
this._progress.set(0);
|
78
|
+
this._status.set('inprogress');
|
79
|
+
if (this.onStart)
|
80
|
+
this.onStart(this);
|
81
81
|
}
|
82
82
|
cancel() {
|
83
|
-
this.
|
83
|
+
this._status.set('canceled');
|
84
84
|
this.bytesTransferred = 0;
|
85
|
-
this.
|
86
|
-
this.
|
87
|
-
|
88
|
-
|
85
|
+
this._estimateTime.set(0);
|
86
|
+
this._progress.set(0);
|
87
|
+
}
|
88
|
+
finish(data) {
|
89
|
+
this._status.set('completed');
|
90
|
+
this.bytesTransferred = this.size;
|
91
|
+
this._estimateTime.set(0);
|
92
|
+
this._progress.set(100);
|
93
|
+
if (this.onComplete)
|
94
|
+
this.onComplete(this);
|
89
95
|
}
|
90
96
|
}
|
91
97
|
|
@@ -94,6 +100,8 @@ class AXUploaderService {
|
|
94
100
|
this.popupService = inject(AXPopupService);
|
95
101
|
this.fileService = inject(AXFileService);
|
96
102
|
this.files$ = new BehaviorSubject([]);
|
103
|
+
this.onFileUploadComplete = new Subject();
|
104
|
+
this.onFilesUploadComplete = new Subject();
|
97
105
|
this.totalEstimateTime = interval(500).pipe(switchMap(() => this.files$.asObservable()), map((f) => sumBy(f, (c) => c.estimateTime())));
|
98
106
|
}
|
99
107
|
get files() {
|
@@ -119,12 +127,26 @@ class AXUploaderService {
|
|
119
127
|
this.files.value
|
120
128
|
.filter((c) => c.status() == 'new')
|
121
129
|
.forEach((c) => {
|
130
|
+
c.onComplete = () => {
|
131
|
+
this.onFileUploadComplete.next({
|
132
|
+
component: this,
|
133
|
+
uploadedFile: c,
|
134
|
+
isUserInteraction: false
|
135
|
+
});
|
136
|
+
if (this.files.value.every(c => c.status() == 'completed')) {
|
137
|
+
this.onFilesUploadComplete.next({
|
138
|
+
component: this,
|
139
|
+
uploadedFiles: this.files.value,
|
140
|
+
isUserInteraction: false
|
141
|
+
});
|
142
|
+
}
|
143
|
+
};
|
122
144
|
c.upload();
|
123
145
|
});
|
124
146
|
}
|
125
|
-
async browse() {
|
147
|
+
async browse(options = { multiple: false }) {
|
126
148
|
try {
|
127
|
-
const files = await this.fileService.choose();
|
149
|
+
const files = await this.fileService.choose({ multiple: options?.multiple || false, accept: options.accept });
|
128
150
|
if (files.length) {
|
129
151
|
return this.add(files);
|
130
152
|
}
|
@@ -143,7 +165,6 @@ class AXUploaderService {
|
|
143
165
|
this.startUpload();
|
144
166
|
return Promise.resolve(list);
|
145
167
|
}
|
146
|
-
upload() { }
|
147
168
|
async cancelAll() {
|
148
169
|
await Promise.all(this.files$.value.filter((c) => c.status() != 'completed').map((c) => c.cancel()));
|
149
170
|
}
|
@@ -164,18 +185,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
164
185
|
}] });
|
165
186
|
|
166
187
|
class AXUploaderZoneDirective {
|
167
|
-
init() {
|
168
|
-
this.element = this.elementRef.nativeElement;
|
169
|
-
this.element.style.position = 'relative';
|
170
|
-
}
|
171
188
|
constructor(elementRef) {
|
172
189
|
this.elementRef = elementRef;
|
173
190
|
this.multiple = true;
|
174
|
-
this.
|
191
|
+
this.accept = null;
|
175
192
|
this.uploadService = inject(AXUploaderService);
|
193
|
+
this.unsubscriber = inject(AXUnsubscriber);
|
176
194
|
this.translateService = inject(AXTranslationService);
|
195
|
+
this.onChanged = new EventEmitter();
|
196
|
+
this.onFileUploadComplete = new EventEmitter();
|
197
|
+
this.onFilesUploadComplete = new EventEmitter();
|
177
198
|
this.stateClass = 'ax-uploader-overlay-state';
|
178
|
-
this.
|
199
|
+
this.element = this.elementRef.nativeElement;
|
200
|
+
this.element.style.position = 'relative';
|
201
|
+
//
|
202
|
+
this.uploadService
|
203
|
+
.onFileUploadComplete
|
204
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
205
|
+
.subscribe(c => {
|
206
|
+
this.onFileUploadComplete.next(c);
|
207
|
+
});
|
208
|
+
this.uploadService
|
209
|
+
.onFilesUploadComplete
|
210
|
+
.pipe(this.unsubscriber.takeUntilDestroy)
|
211
|
+
.subscribe(c => {
|
212
|
+
this.onFilesUploadComplete.next(c);
|
213
|
+
});
|
214
|
+
//
|
179
215
|
this.element.addEventListener('dragenter', this.handleDragEnter.bind(this), true);
|
180
216
|
this.element.addEventListener('dragover', this.handleDragOver.bind(this), true);
|
181
217
|
this.element.addEventListener('drop', this.handleOnDrop.bind(this), true);
|
@@ -216,22 +252,36 @@ class AXUploaderZoneDirective {
|
|
216
252
|
removeZone() {
|
217
253
|
this.overlayElement.remove();
|
218
254
|
}
|
219
|
-
browser() {
|
220
|
-
this.uploadService.browse();
|
255
|
+
async browser() {
|
256
|
+
const requests = await this.uploadService.browse({ accept: this.accept, multiple: this.multiple });
|
257
|
+
this.onChanged.emit({
|
258
|
+
component: this,
|
259
|
+
requests,
|
260
|
+
isUserInteraction: true
|
261
|
+
});
|
221
262
|
}
|
222
263
|
get __hostClass() {
|
223
264
|
return `ax-drop-zone`;
|
224
265
|
}
|
225
266
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXUploaderZoneDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
226
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.2", type: AXUploaderZoneDirective, selector: "[axUploaderZone]", inputs: { multiple: "multiple" }, host: { properties: { "class": "this.__hostClass" } }, ngImport: i0 }); }
|
267
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.2", type: AXUploaderZoneDirective, selector: "[axUploaderZone]", inputs: { multiple: "multiple", accept: "accept" }, outputs: { onChanged: "onChanged", onFileUploadComplete: "onFileUploadComplete", onFilesUploadComplete: "onFilesUploadComplete" }, host: { properties: { "class": "this.__hostClass" } }, providers: [AXUnsubscriber], ngImport: i0 }); }
|
227
268
|
}
|
228
269
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXUploaderZoneDirective, decorators: [{
|
229
270
|
type: Directive,
|
230
271
|
args: [{
|
231
272
|
selector: '[axUploaderZone]',
|
273
|
+
providers: [AXUnsubscriber]
|
232
274
|
}]
|
233
275
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { multiple: [{
|
234
276
|
type: Input
|
277
|
+
}], accept: [{
|
278
|
+
type: Input
|
279
|
+
}], onChanged: [{
|
280
|
+
type: Output
|
281
|
+
}], onFileUploadComplete: [{
|
282
|
+
type: Output
|
283
|
+
}], onFilesUploadComplete: [{
|
284
|
+
type: Output
|
235
285
|
}], __hostClass: [{
|
236
286
|
type: HostBinding,
|
237
287
|
args: ['class']
|
@@ -248,8 +298,8 @@ class AXUploaderBrowseDirective {
|
|
248
298
|
ngOnDestroy() {
|
249
299
|
this.elemenrRef.nativeElement.removeEventListener('click', this.handleClick.bind(this));
|
250
300
|
}
|
251
|
-
handleClick() {
|
252
|
-
this.uploaderZone.browser();
|
301
|
+
async handleClick() {
|
302
|
+
await this.uploaderZone.browser();
|
253
303
|
}
|
254
304
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXUploaderBrowseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
255
305
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.2", type: AXUploaderBrowseDirective, selector: "[axUploaderBrowseHandle]", ngImport: i0 }); }
|
@@ -314,7 +364,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
314
364
|
|
315
365
|
class AXUploaderDropZoneComponent extends MXBaseComponent {
|
316
366
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXUploaderDropZoneComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
317
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.2", type: AXUploaderDropZoneComponent, selector: "ax-uploader-drop-zone", usesInheritance: true, ngImport: i0, template: "<div class=\"ax-uploader-drop-zone-container\" axUploaderZone>\n <ax-icon class=\"ax-icon ax-icon-upload\"></ax-icon>\n <div class=\"ax-uploader-drop-zone-description\">\n <span>Drag & Drop or <a href=\"#\">Choose file</a> to upload</span>\n <p>SVG, PNG, JPG or GIF (MAX. 800x400px)</p>\n </div>\n</div>", styles: [".ax-uploader-drop-zone-container{display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:.5rem;margin:1rem;padding:1rem;gap:1rem;border:2px dashed;border-color:rgba(var(--ax-color-border-default))}.ax-uploader-drop-zone-container:hover{border-color:rgba(var(--ax-color-primary-500));background-color:rgba(var(--ax-color-primary-50))}.ax-uploader-drop-zone-container ax-icon{font-size:1.875rem;line-height:2.25rem;color:#a3a3a3}.ax-uploader-drop-zone-container .ax-uploader-drop-zone-description{display:flex;flex-direction:column;gap:.5rem}.ax-uploader-drop-zone-container .ax-uploader-drop-zone-description a{color:rgba(var(--ax-color-primary-500))}.ax-uploader-drop-zone-container .ax-uploader-drop-zone-description p{font-size:.875rem;line-height:1.25rem;color:#a3a3a3}\n"], dependencies: [{ kind: "component", type: i1$2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "directive", type: AXUploaderZoneDirective, selector: "[axUploaderZone]", inputs: ["multiple"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
367
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.2", type: AXUploaderDropZoneComponent, selector: "ax-uploader-drop-zone", usesInheritance: true, ngImport: i0, template: "<div class=\"ax-uploader-drop-zone-container\" axUploaderZone>\n <ax-icon class=\"ax-icon ax-icon-upload\"></ax-icon>\n <div class=\"ax-uploader-drop-zone-description\">\n <span>Drag & Drop or <a href=\"#\">Choose file</a> to upload</span>\n <p>SVG, PNG, JPG or GIF (MAX. 800x400px)</p>\n </div>\n</div>", styles: [".ax-uploader-drop-zone-container{display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:.5rem;margin:1rem;padding:1rem;gap:1rem;border:2px dashed;border-color:rgba(var(--ax-color-border-default))}.ax-uploader-drop-zone-container:hover{border-color:rgba(var(--ax-color-primary-500));background-color:rgba(var(--ax-color-primary-50))}.ax-uploader-drop-zone-container ax-icon{font-size:1.875rem;line-height:2.25rem;color:#a3a3a3}.ax-uploader-drop-zone-container .ax-uploader-drop-zone-description{display:flex;flex-direction:column;gap:.5rem}.ax-uploader-drop-zone-container .ax-uploader-drop-zone-description a{color:rgba(var(--ax-color-primary-500))}.ax-uploader-drop-zone-container .ax-uploader-drop-zone-description p{font-size:.875rem;line-height:1.25rem;color:#a3a3a3}\n"], dependencies: [{ kind: "component", type: i1$2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "directive", type: AXUploaderZoneDirective, selector: "[axUploaderZone]", inputs: ["multiple", "accept"], outputs: ["onChanged", "onFileUploadComplete", "onFilesUploadComplete"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
318
368
|
}
|
319
369
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXUploaderDropZoneComponent, decorators: [{
|
320
370
|
type: Component,
|
@@ -328,7 +378,6 @@ class AXUploaderModule {
|
|
328
378
|
AXUploaderZoneDirective,
|
329
379
|
AXUploaderBrowseDirective,
|
330
380
|
AXUploaderDialogContainerComponent], imports: [CommonModule,
|
331
|
-
HttpClientModule,
|
332
381
|
AXDecoratorModule,
|
333
382
|
AXButtonModule,
|
334
383
|
AXTranslationModule,
|
@@ -338,8 +387,7 @@ class AXUploaderModule {
|
|
338
387
|
AXDateTimeModule,
|
339
388
|
AXCircularProgressModule,
|
340
389
|
AXPopupModule], exports: [AXUploaderDropZoneComponent, AXUploaderZoneDirective, AXUploaderBrowseDirective, AXUploaderDialogContainerComponent] }); }
|
341
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXUploaderModule,
|
342
|
-
HttpClientModule,
|
390
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXUploaderModule, imports: [CommonModule,
|
343
391
|
AXDecoratorModule,
|
344
392
|
AXButtonModule,
|
345
393
|
AXTranslationModule,
|
@@ -362,7 +410,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
362
410
|
],
|
363
411
|
imports: [
|
364
412
|
CommonModule,
|
365
|
-
HttpClientModule,
|
366
413
|
AXDecoratorModule,
|
367
414
|
AXButtonModule,
|
368
415
|
AXTranslationModule,
|
@@ -374,7 +421,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
374
421
|
AXPopupModule,
|
375
422
|
],
|
376
423
|
exports: [AXUploaderDropZoneComponent, AXUploaderZoneDirective, AXUploaderBrowseDirective, AXUploaderDialogContainerComponent],
|
377
|
-
providers: [
|
424
|
+
providers: [],
|
378
425
|
}]
|
379
426
|
}] });
|
380
427
|
|
@@ -382,5 +429,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
382
429
|
* Generated bundle index. Do not edit.
|
383
430
|
*/
|
384
431
|
|
385
|
-
export { AXUploaderBrowseDirective, AXUploaderDialogContainerComponent, AXUploaderDropZoneComponent, AXUploaderListComponent, AXUploaderModule, AXUploaderService, AXUploaderZoneDirective };
|
432
|
+
export { AXUploadRequest, AXUploaderBrowseDirective, AXUploaderDialogContainerComponent, AXUploaderDropZoneComponent, AXUploaderListComponent, AXUploaderModule, AXUploaderService, AXUploaderZoneDirective };
|
386
433
|
//# sourceMappingURL=acorex-components-uploader.mjs.map
|